From: Cris Di Sclafani Date: Fri, 12 Mar 2021 16:00:40 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.1 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=694806100855f04388e0f1e0e922ec3b09a6d7a5;p=motion2.git Built motion from commit (unavailable).|2.5.1 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index b30fc0f..a82075f 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:53:02.009Z", "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-12T15:53:00.628Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d1199a6..499adbf 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:53:02.009Z", "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-12T15:53:00.628Z", "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 f05adc6..58d11f3 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 _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 +var _0xf9c6=['exports','INTEGER','sequelize'];(function(_0x229a36,_0x1d2172){var _0x437148=function(_0x444dbd){while(--_0x444dbd){_0x229a36['push'](_0x229a36['shift']());}};_0x437148(++_0x1d2172);}(_0xf9c6,0x83));var _0x6f9c=function(_0x11581b,_0xab7d4d){_0x11581b=_0x11581b-0x0;var _0x2db690=_0xf9c6[_0x11581b];return _0x2db690;};'use strict';var Sequelize=require(_0x6f9c('0x0'));module[_0x6f9c('0x1')]={'ChatInteractionId':{'type':Sequelize[_0x6f9c('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x6f9c('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 da8a2d5..6159d76 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 _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 +var _0xde3e=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','count','offset','set','apply','reject','save','update','then','get','sendStatus','error','stack','name','index','map','UserChatInteraction','rawAttributes','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','user','role','UserChatInteractions','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0x2c27ed,_0x5c50f0){var _0x597bd1=function(_0xd6db18){while(--_0xd6db18){_0x2c27ed['push'](_0x2c27ed['shift']());}};_0x597bd1(++_0x5c50f0);}(_0xde3e,0x1cf));var _0xede3=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xde3e[_0x47aa64];return _0x549c7a;};'use strict';var pdf=require(_0xede3('0x0'));var emlformat=require(_0xede3('0x1'));var rimraf=require(_0xede3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xede3('0x3'));var rp=require('request-promise');var moment=require(_0xede3('0x4'));var BPromise=require(_0xede3('0x5'));var Mustache=require(_0xede3('0x6'));var util=require(_0xede3('0x7'));var path=require('path');var sox=require(_0xede3('0x8'));var csv=require(_0xede3('0x9'));var ejs=require(_0xede3('0xa'));var fs=require('fs');var _=require(_0xede3('0xb'));var squel=require(_0xede3('0xc'));var crypto=require(_0xede3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xede3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xede3('0xf'));var Papa=require('papaparse');var Redis=require(_0xede3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xede3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xede3('0x12'));var logger=require(_0xede3('0x13'))(_0xede3('0x14'));var utils=require('../../config/utils');var config=require(_0xede3('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ddd16,_0x689723){_0x689723=_0x689723||0xcc;return function(_0x16fc7d){if(_0x16fc7d){return _0x3ddd16['sendStatus'](_0x689723);}return _0x3ddd16[_0xede3('0x16')](_0x689723)[_0xede3('0x17')]();};}function respondWithResult(_0x1d7d98,_0x5ae5ec){_0x5ae5ec=_0x5ae5ec||0xc8;return function(_0x1c6243){if(_0x1c6243){return _0x1d7d98[_0xede3('0x16')](_0x5ae5ec)[_0xede3('0x18')](_0x1c6243);}};}function respondWithFilteredResult(_0x5149bf,_0x3fef54){return function(_0xac27ac){if(_0xac27ac){var _0x461fd0=_0xac27ac[_0xede3('0x19')],_0x3e0594=_0x3fef54[_0xede3('0x1a')],_0xb55f29=_0x3fef54[_0xede3('0x1a')]+_0x3fef54['limit'],_0x115e3f;if(_0xb55f29>=_0x461fd0){_0xb55f29=_0x461fd0;_0x115e3f=0xc8;}else{_0x115e3f=0xce;}_0x5149bf['status'](_0x115e3f);return _0x5149bf[_0xede3('0x1b')]('Content-Range',_0x3e0594+'-'+_0xb55f29+'/'+_0x461fd0)[_0xede3('0x18')](_0xac27ac);}return null;};}function patchUpdates(_0x5b33ee){return function(_0x10d4b1){try{jsonpatch[_0xede3('0x1c')](_0x10d4b1,_0x5b33ee,!![]);}catch(_0x4ff041){return BPromise[_0xede3('0x1d')](_0x4ff041);}return _0x10d4b1[_0xede3('0x1e')]();};}function saveUpdates(_0x4a109d,_0xc8ca6){return function(_0x3e7a83){if(_0x3e7a83){return _0x3e7a83[_0xede3('0x1f')](_0x4a109d)['then'](function(_0x24820a){return _0x24820a;});}return null;};}function removeEntity(_0x2360cc,_0x534c2f){return function(_0x4f0d4c){if(_0x4f0d4c){return _0x4f0d4c['destroy']()[_0xede3('0x20')](function(){var _0x11fee0=_0x4f0d4c[_0xede3('0x21')]({'plain':!![]});var _0x10f619='UserChatInteractions';return db['UserProfileResource']['destroy']({'where':{'type':_0x10f619,'resourceId':_0x11fee0['id']}})[_0xede3('0x20')](function(){return _0x4f0d4c;});})[_0xede3('0x20')](function(){_0x2360cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x674d63,_0x1cc868){return function(_0x27a491){if(!_0x27a491){_0x674d63[_0xede3('0x22')](0x194);}return _0x27a491;};}function handleError(_0x53f10d,_0x1426cf){_0x1426cf=_0x1426cf||0x1f4;return function(_0x30ebe0){logger[_0xede3('0x23')](_0x30ebe0[_0xede3('0x24')]);if(_0x30ebe0[_0xede3('0x25')]){delete _0x30ebe0['name'];}_0x53f10d[_0xede3('0x16')](_0x1426cf)['send'](_0x30ebe0);};}exports[_0xede3('0x26')]=function(_0x1b13b0,_0x4f7538){var _0x5865f6={},_0x685703={},_0x10bda2={'count':0x0,'rows':[]};var _0x467161=_[_0xede3('0x27')](db[_0xede3('0x28')][_0xede3('0x29')],function(_0x1296f5){return{'name':_0x1296f5['fieldName'],'type':_0x1296f5['type'][_0xede3('0x2a')]};});_0x685703['model']=_[_0xede3('0x27')](_0x467161,'name');_0x685703[_0xede3('0x2b')]=_['keys'](_0x1b13b0[_0xede3('0x2b')]);_0x685703[_0xede3('0x2c')]=_['intersection'](_0x685703['model'],_0x685703[_0xede3('0x2b')]);_0x5865f6['attributes']=_[_0xede3('0x2d')](_0x685703[_0xede3('0x2e')],qs[_0xede3('0x2f')](_0x1b13b0[_0xede3('0x2b')]['fields']));_0x5865f6[_0xede3('0x30')]=_0x5865f6['attributes']['length']?_0x5865f6[_0xede3('0x30')]:_0x685703[_0xede3('0x2e')];if(!_0x1b13b0[_0xede3('0x2b')][_0xede3('0x31')]('nolimit')){_0x5865f6[_0xede3('0x32')]=qs[_0xede3('0x32')](_0x1b13b0[_0xede3('0x2b')][_0xede3('0x32')]);_0x5865f6['offset']=qs[_0xede3('0x1a')](_0x1b13b0[_0xede3('0x2b')]['offset']);}_0x5865f6[_0xede3('0x33')]=qs[_0xede3('0x34')](_0x1b13b0[_0xede3('0x2b')][_0xede3('0x34')]);_0x5865f6['where']=qs[_0xede3('0x2c')](_[_0xede3('0x35')](_0x1b13b0[_0xede3('0x2b')],_0x685703['filters']),_0x467161);if(_0x1b13b0[_0xede3('0x2b')]['filter']){_0x5865f6[_0xede3('0x36')]=_[_0xede3('0x37')](_0x5865f6[_0xede3('0x36')],{'$or':_[_0xede3('0x27')](_0x467161,function(_0x3db8cb){if(_0x3db8cb[_0xede3('0x38')]!==_0xede3('0x39')){var _0x57255c={};_0x57255c[_0x3db8cb[_0xede3('0x25')]]={'$like':'%'+_0x1b13b0[_0xede3('0x2b')][_0xede3('0x3a')]+'%'};return _0x57255c;}})});}_0x5865f6=_['merge']({},_0x5865f6,_0x1b13b0[_0xede3('0x3b')]);var _0x40c7ab={'where':_0x5865f6[_0xede3('0x36')]};return db[_0xede3('0x28')]['count'](_0x40c7ab)[_0xede3('0x20')](function(_0x242c65){_0x10bda2[_0xede3('0x19')]=_0x242c65;if(_0x1b13b0[_0xede3('0x2b')][_0xede3('0x3c')]){_0x5865f6[_0xede3('0x3d')]=[{'all':!![]}];}return db[_0xede3('0x28')][_0xede3('0x3e')](_0x5865f6);})[_0xede3('0x20')](function(_0x153db5){_0x10bda2[_0xede3('0x3f')]=_0x153db5;return _0x10bda2;})[_0xede3('0x20')](respondWithFilteredResult(_0x4f7538,_0x5865f6))[_0xede3('0x40')](handleError(_0x4f7538,null));};exports[_0xede3('0x41')]=function(_0x3185c3,_0x45c032){var _0x18e4ec={'raw':!![],'where':{'id':_0x3185c3['params']['id']}},_0x8a4362={};_0x8a4362[_0xede3('0x2e')]=_['keys'](db[_0xede3('0x28')][_0xede3('0x29')]);_0x8a4362[_0xede3('0x2b')]=_[_0xede3('0x42')](_0x3185c3[_0xede3('0x2b')]);_0x8a4362[_0xede3('0x2c')]=_['intersection'](_0x8a4362[_0xede3('0x2e')],_0x8a4362[_0xede3('0x2b')]);_0x18e4ec[_0xede3('0x30')]=_[_0xede3('0x2d')](_0x8a4362[_0xede3('0x2e')],qs['fields'](_0x3185c3[_0xede3('0x2b')][_0xede3('0x2f')]));_0x18e4ec[_0xede3('0x30')]=_0x18e4ec['attributes'][_0xede3('0x43')]?_0x18e4ec[_0xede3('0x30')]:_0x8a4362['model'];if(_0x3185c3[_0xede3('0x2b')]['includeAll']){_0x18e4ec[_0xede3('0x3d')]=[{'all':!![]}];}_0x18e4ec=_['merge']({},_0x18e4ec,_0x3185c3[_0xede3('0x3b')]);return db[_0xede3('0x28')][_0xede3('0x44')](_0x18e4ec)[_0xede3('0x20')](handleEntityNotFound(_0x45c032,null))['then'](respondWithResult(_0x45c032,null))[_0xede3('0x40')](handleError(_0x45c032,null));};exports[_0xede3('0x45')]=function(_0x25d538,_0x3cc238){return db[_0xede3('0x28')][_0xede3('0x45')](_0x25d538['body'],{})[_0xede3('0x20')](function(_0x137096){var _0x436dcb=_0x25d538[_0xede3('0x46')][_0xede3('0x21')]({'plain':!![]});if(!_0x436dcb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x436dcb[_0xede3('0x47')]===_0xede3('0x46')){var _0xd33ec0=_0x137096['get']({'plain':!![]});var _0x12228b=_0xede3('0x48');return db[_0xede3('0x49')][_0xede3('0x44')]({'where':{'name':_0x12228b,'userProfileId':_0x436dcb[_0xede3('0x4a')]},'raw':!![]})[_0xede3('0x20')](function(_0x12b376){if(_0x12b376&&_0x12b376[_0xede3('0x4b')]===0x0){return db[_0xede3('0x4c')][_0xede3('0x45')]({'name':_0xd33ec0[_0xede3('0x25')],'resourceId':_0xd33ec0['id'],'type':_0x12b376[_0xede3('0x25')],'sectionId':_0x12b376['id']},{})[_0xede3('0x20')](function(){return _0x137096;});}else{return _0x137096;}})[_0xede3('0x40')](function(_0x2fe115){logger['error'](_0xede3('0x4d'),_0x2fe115);throw _0x2fe115;});}return _0x137096;})['then'](respondWithResult(_0x3cc238,0xc9))[_0xede3('0x40')](handleError(_0x3cc238,null));};exports[_0xede3('0x1f')]=function(_0x369e21,_0x515ee7){if(_0x369e21['body']['id']){delete _0x369e21[_0xede3('0x4e')]['id'];}return db[_0xede3('0x28')]['find']({'where':{'id':_0x369e21[_0xede3('0x4f')]['id']}})[_0xede3('0x20')](handleEntityNotFound(_0x515ee7,null))[_0xede3('0x20')](saveUpdates(_0x369e21['body'],null))[_0xede3('0x20')](respondWithResult(_0x515ee7,null))[_0xede3('0x40')](handleError(_0x515ee7,null));};exports['destroy']=function(_0x59ba31,_0x4557de){return db[_0xede3('0x28')][_0xede3('0x44')]({'where':{'id':_0x59ba31[_0xede3('0x4f')]['id']}})[_0xede3('0x20')](handleEntityNotFound(_0x4557de,null))[_0xede3('0x20')](removeEntity(_0x4557de,null))['catch'](handleError(_0x4557de,null));}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.model.js b/server/api/UserChatInteraction/UserChatInteraction.model.js index e5ba4d2..04d217a 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 _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 +var _0x88d0=['lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./UserChatInteraction.attributes','exports','define','UserChatInteraction'];(function(_0x2e791d,_0x2e33f7){var _0x32d0e2=function(_0x340cec){while(--_0x340cec){_0x2e791d['push'](_0x2e791d['shift']());}};_0x32d0e2(++_0x2e33f7);}(_0x88d0,0x129));var _0x088d=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x88d0[_0x11ce46];return _0x368a1e;};'use strict';var _=require(_0x088d('0x0'));var util=require(_0x088d('0x1'));var logger=require(_0x088d('0x2'))(_0x088d('0x3'));var moment=require(_0x088d('0x4'));var BPromise=require('bluebird');var rp=require(_0x088d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x088d('0x6'));var attributes=require(_0x088d('0x7'));module[_0x088d('0x8')]=function(_0x59a01b,_0x54faaf){return _0x59a01b[_0x088d('0x9')](_0x088d('0xa'),attributes,{'tableName':'user_has_chat_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserChatInteraction/UserChatInteraction.rpc.js b/server/api/UserChatInteraction/UserChatInteraction.rpc.js index ed8a4f6..6e870c2 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 _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 +var _0xf034=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0x29b99b,_0x2a80f7){var _0x2d788c=function(_0x539b18){while(--_0x539b18){_0x29b99b['push'](_0x29b99b['shift']());}};_0x2d788c(++_0x2a80f7);}(_0xf034,0x1e0));var _0x4f03=function(_0x5cbdf2,_0x4de8ca){_0x5cbdf2=_0x5cbdf2-0x0;var _0x19d3a2=_0xf034[_0x5cbdf2];return _0x19d3a2;};'use strict';var _=require(_0x4f03('0x0'));var util=require(_0x4f03('0x1'));var moment=require(_0x4f03('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f03('0x4'))['db'];var utils=require(_0x4f03('0x5'));var logger=require('../../config/logger')(_0x4f03('0x6'));var config=require(_0x4f03('0x7'));var jayson=require(_0x4f03('0x8'));var client=jayson[_0x4f03('0x9')][_0x4f03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3387eb,_0x14a72f,_0x3960fc){return new BPromise(function(_0x145bee,_0x194006){return client['request'](_0x3387eb,_0x3960fc)[_0x4f03('0xb')](function(_0x19df3a){logger[_0x4f03('0xc')](_0x4f03('0xd'),_0x14a72f,_0x4f03('0xe'));logger[_0x4f03('0xf')]('UserChatInteraction,\x20%s,\x20%s,\x20%s',_0x14a72f,'request\x20sent',JSON[_0x4f03('0x10')](_0x19df3a));if(_0x19df3a['error']){if(_0x19df3a[_0x4f03('0x11')][_0x4f03('0x12')]===0x1f4){logger[_0x4f03('0x11')](_0x4f03('0xd'),_0x14a72f,_0x19df3a[_0x4f03('0x11')][_0x4f03('0x13')]);return _0x194006(_0x19df3a['error']['message']);}logger['error']('UserChatInteraction,\x20%s,\x20%s',_0x14a72f,_0x19df3a[_0x4f03('0x11')][_0x4f03('0x13')]);return _0x145bee(_0x19df3a[_0x4f03('0x11')][_0x4f03('0x13')]);}else{logger['info'](_0x4f03('0xd'),_0x14a72f,_0x4f03('0xe'));_0x145bee(_0x19df3a[_0x4f03('0x14')][_0x4f03('0x13')]);}})[_0x4f03('0x15')](function(_0x3b3259){logger[_0x4f03('0x11')]('UserChatInteraction,\x20%s,\x20%s',_0x14a72f,_0x3b3259);_0x194006(_0x3b3259);});});} \ No newline at end of file diff --git a/server/api/UserChatInteraction/index.js b/server/api/UserChatInteraction/index.js index 067c7b9..b822cb1 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 _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 +var _0xb787=['isAuthenticated','index','show','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./UserChatInteraction.controller','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb787,0x160));var _0x7b78=function(_0xe9201a,_0xa01778){_0xe9201a=_0xe9201a-0x0;var _0x263daf=_0xb787[_0xe9201a];return _0x263daf;};'use strict';var multer=require(_0x7b78('0x0'));var util=require(_0x7b78('0x1'));var path=require(_0x7b78('0x2'));var timeout=require(_0x7b78('0x3'));var express=require('express');var router=express[_0x7b78('0x4')]();var auth=require(_0x7b78('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b78('0x6'));var controller=require(_0x7b78('0x7'));router[_0x7b78('0x8')]('/',auth[_0x7b78('0x9')](),controller[_0x7b78('0xa')]);router['get']('/:id',auth[_0x7b78('0x9')](),controller[_0x7b78('0xb')]);router[_0x7b78('0xc')]('/',auth[_0x7b78('0x9')](),controller[_0x7b78('0xd')]);router[_0x7b78('0xe')](_0x7b78('0xf'),auth[_0x7b78('0x9')](),controller[_0x7b78('0x10')]);router['delete'](_0x7b78('0xf'),auth[_0x7b78('0x9')](),controller[_0x7b78('0x11')]);module[_0x7b78('0x12')]=router; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js b/server/api/UserFaxInteraction/UserFaxInteraction.attributes.js index ffb5f4e..eda5b0a 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 _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 +var _0xe215=['exports','INTEGER'];(function(_0x4e02fa,_0x172f89){var _0x5c4b43=function(_0x2bc181){while(--_0x2bc181){_0x4e02fa['push'](_0x4e02fa['shift']());}};_0x5c4b43(++_0x172f89);}(_0xe215,0x170));var _0x5e21=function(_0x4830db,_0x2c3aa9){_0x4830db=_0x4830db-0x0;var _0x49970e=_0xe215[_0x4830db];return _0x49970e;};'use strict';var Sequelize=require('sequelize');module[_0x5e21('0x0')]={'FaxInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x5e21('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 467a814..ed86ac8 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 _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 +var _0x8821=['filter','where','merge','VIRTUAL','options','includeAll','include','UserFaxInteraction','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','get','UserFaxInteractions','UserProfileResource','error','stack','name','send','index','fieldName','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick'];(function(_0x4bde1e,_0x1234ce){var _0x1db645=function(_0x63e664){while(--_0x63e664){_0x4bde1e['push'](_0x4bde1e['shift']());}};_0x1db645(++_0x1234ce);}(_0x8821,0xfc));var _0x1882=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0x8821[_0x24fa1a];return _0xc5621f;};'use strict';var pdf=require(_0x1882('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1882('0x1'));var jsonpatch=require(_0x1882('0x2'));var rp=require(_0x1882('0x3'));var moment=require(_0x1882('0x4'));var BPromise=require(_0x1882('0x5'));var Mustache=require('mustache');var util=require(_0x1882('0x6'));var path=require(_0x1882('0x7'));var sox=require(_0x1882('0x8'));var csv=require(_0x1882('0x9'));var ejs=require(_0x1882('0xa'));var fs=require('fs');var _=require(_0x1882('0xb'));var squel=require(_0x1882('0xc'));var crypto=require(_0x1882('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1882('0xe'));var toCsv=require(_0x1882('0x9'));var querystring=require('querystring');var Papa=require(_0x1882('0xf'));var Redis=require('ioredis');var authService=require(_0x1882('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1882('0x11'))('api');var utils=require(_0x1882('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x1882('0x13'));var db=require(_0x1882('0x14'))['db'];function respondWithStatusCode(_0x4e529c,_0x126571){_0x126571=_0x126571||0xcc;return function(_0x1fd838){if(_0x1fd838){return _0x4e529c['sendStatus'](_0x126571);}return _0x4e529c[_0x1882('0x15')](_0x126571)[_0x1882('0x16')]();};}function respondWithResult(_0x3f1fd7,_0x343460){_0x343460=_0x343460||0xc8;return function(_0x3b21bf){if(_0x3b21bf){return _0x3f1fd7[_0x1882('0x15')](_0x343460)[_0x1882('0x17')](_0x3b21bf);}};}function respondWithFilteredResult(_0x507c3c,_0x5e5fa1){return function(_0x4a75c5){if(_0x4a75c5){var _0x4192eb=_0x4a75c5[_0x1882('0x18')],_0x57c827=_0x5e5fa1[_0x1882('0x19')],_0x237da8=_0x5e5fa1[_0x1882('0x19')]+_0x5e5fa1[_0x1882('0x1a')],_0x4335a8;if(_0x237da8>=_0x4192eb){_0x237da8=_0x4192eb;_0x4335a8=0xc8;}else{_0x4335a8=0xce;}_0x507c3c[_0x1882('0x15')](_0x4335a8);return _0x507c3c[_0x1882('0x1b')]('Content-Range',_0x57c827+'-'+_0x237da8+'/'+_0x4192eb)[_0x1882('0x17')](_0x4a75c5);}return null;};}function patchUpdates(_0x226c38){return function(_0x229b2d){try{jsonpatch['apply'](_0x229b2d,_0x226c38,!![]);}catch(_0x13183a){return BPromise[_0x1882('0x1c')](_0x13183a);}return _0x229b2d[_0x1882('0x1d')]();};}function saveUpdates(_0x378af2,_0x41cca9){return function(_0x53c7d7){if(_0x53c7d7){return _0x53c7d7[_0x1882('0x1e')](_0x378af2)[_0x1882('0x1f')](function(_0x23e39c){return _0x23e39c;});}return null;};}function removeEntity(_0x34ecc7,_0x17a191){return function(_0xb43e63){if(_0xb43e63){return _0xb43e63[_0x1882('0x20')]()[_0x1882('0x1f')](function(){var _0x924350=_0xb43e63[_0x1882('0x21')]({'plain':!![]});var _0x140399=_0x1882('0x22');return db[_0x1882('0x23')]['destroy']({'where':{'type':_0x140399,'resourceId':_0x924350['id']}})[_0x1882('0x1f')](function(){return _0xb43e63;});})[_0x1882('0x1f')](function(){_0x34ecc7[_0x1882('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6e39,_0x142923){return function(_0x2f7e66){if(!_0x2f7e66){_0x4d6e39['sendStatus'](0x194);}return _0x2f7e66;};}function handleError(_0x4bac3d,_0x52d855){_0x52d855=_0x52d855||0x1f4;return function(_0x193463){logger[_0x1882('0x24')](_0x193463[_0x1882('0x25')]);if(_0x193463[_0x1882('0x26')]){delete _0x193463[_0x1882('0x26')];}_0x4bac3d['status'](_0x52d855)[_0x1882('0x27')](_0x193463);};}exports[_0x1882('0x28')]=function(_0xf73b20,_0x587392){var _0x269c5f={},_0x14323e={},_0x12621f={'count':0x0,'rows':[]};var _0x59f1ba=_['map'](db['UserFaxInteraction']['rawAttributes'],function(_0x16f0a3){return{'name':_0x16f0a3[_0x1882('0x29')],'type':_0x16f0a3['type'][_0x1882('0x2a')]};});_0x14323e[_0x1882('0x2b')]=_[_0x1882('0x2c')](_0x59f1ba,'name');_0x14323e['query']=_['keys'](_0xf73b20[_0x1882('0x2d')]);_0x14323e['filters']=_[_0x1882('0x2e')](_0x14323e[_0x1882('0x2b')],_0x14323e[_0x1882('0x2d')]);_0x269c5f[_0x1882('0x2f')]=_['intersection'](_0x14323e[_0x1882('0x2b')],qs['fields'](_0xf73b20[_0x1882('0x2d')][_0x1882('0x30')]));_0x269c5f[_0x1882('0x2f')]=_0x269c5f['attributes'][_0x1882('0x31')]?_0x269c5f['attributes']:_0x14323e[_0x1882('0x2b')];if(!_0xf73b20[_0x1882('0x2d')][_0x1882('0x32')](_0x1882('0x33'))){_0x269c5f[_0x1882('0x1a')]=qs[_0x1882('0x1a')](_0xf73b20[_0x1882('0x2d')][_0x1882('0x1a')]);_0x269c5f['offset']=qs[_0x1882('0x19')](_0xf73b20[_0x1882('0x2d')][_0x1882('0x19')]);}_0x269c5f[_0x1882('0x34')]=qs['sort'](_0xf73b20['query'][_0x1882('0x35')]);_0x269c5f['where']=qs[_0x1882('0x36')](_[_0x1882('0x37')](_0xf73b20[_0x1882('0x2d')],_0x14323e[_0x1882('0x36')]),_0x59f1ba);if(_0xf73b20['query'][_0x1882('0x38')]){_0x269c5f[_0x1882('0x39')]=_[_0x1882('0x3a')](_0x269c5f[_0x1882('0x39')],{'$or':_[_0x1882('0x2c')](_0x59f1ba,function(_0x39fee0){if(_0x39fee0['type']!==_0x1882('0x3b')){var _0x15890b={};_0x15890b[_0x39fee0[_0x1882('0x26')]]={'$like':'%'+_0xf73b20[_0x1882('0x2d')]['filter']+'%'};return _0x15890b;}})});}_0x269c5f=_[_0x1882('0x3a')]({},_0x269c5f,_0xf73b20[_0x1882('0x3c')]);var _0x15f257={'where':_0x269c5f['where']};return db['UserFaxInteraction'][_0x1882('0x18')](_0x15f257)[_0x1882('0x1f')](function(_0xc094ee){_0x12621f[_0x1882('0x18')]=_0xc094ee;if(_0xf73b20['query'][_0x1882('0x3d')]){_0x269c5f[_0x1882('0x3e')]=[{'all':!![]}];}return db[_0x1882('0x3f')]['findAll'](_0x269c5f);})[_0x1882('0x1f')](function(_0x26490b){_0x12621f[_0x1882('0x40')]=_0x26490b;return _0x12621f;})[_0x1882('0x1f')](respondWithFilteredResult(_0x587392,_0x269c5f))[_0x1882('0x41')](handleError(_0x587392,null));};exports[_0x1882('0x42')]=function(_0x1107b1,_0x4ecc90){var _0x5da4a2={'raw':!![],'where':{'id':_0x1107b1[_0x1882('0x43')]['id']}},_0x7c47f2={};_0x7c47f2[_0x1882('0x2b')]=_[_0x1882('0x44')](db[_0x1882('0x3f')]['rawAttributes']);_0x7c47f2[_0x1882('0x2d')]=_[_0x1882('0x44')](_0x1107b1[_0x1882('0x2d')]);_0x7c47f2[_0x1882('0x36')]=_[_0x1882('0x2e')](_0x7c47f2['model'],_0x7c47f2['query']);_0x5da4a2[_0x1882('0x2f')]=_[_0x1882('0x2e')](_0x7c47f2[_0x1882('0x2b')],qs[_0x1882('0x30')](_0x1107b1['query'][_0x1882('0x30')]));_0x5da4a2[_0x1882('0x2f')]=_0x5da4a2[_0x1882('0x2f')][_0x1882('0x31')]?_0x5da4a2[_0x1882('0x2f')]:_0x7c47f2[_0x1882('0x2b')];if(_0x1107b1[_0x1882('0x2d')]['includeAll']){_0x5da4a2[_0x1882('0x3e')]=[{'all':!![]}];}_0x5da4a2=_[_0x1882('0x3a')]({},_0x5da4a2,_0x1107b1[_0x1882('0x3c')]);return db[_0x1882('0x3f')][_0x1882('0x45')](_0x5da4a2)[_0x1882('0x1f')](handleEntityNotFound(_0x4ecc90,null))[_0x1882('0x1f')](respondWithResult(_0x4ecc90,null))[_0x1882('0x41')](handleError(_0x4ecc90,null));};exports[_0x1882('0x46')]=function(_0x253a15,_0x4ef079){return db[_0x1882('0x3f')]['create'](_0x253a15[_0x1882('0x47')],{})[_0x1882('0x1f')](function(_0x5eea93){var _0x53ab19=_0x253a15['user'][_0x1882('0x21')]({'plain':!![]});if(!_0x53ab19)throw new Error(_0x1882('0x48'));if(_0x53ab19[_0x1882('0x49')]==='user'){var _0x550a7c=_0x5eea93[_0x1882('0x21')]({'plain':!![]});var _0x564251=_0x1882('0x22');return db[_0x1882('0x4a')][_0x1882('0x45')]({'where':{'name':_0x564251,'userProfileId':_0x53ab19['userProfileId']},'raw':!![]})[_0x1882('0x1f')](function(_0x53bec2){if(_0x53bec2&&_0x53bec2[_0x1882('0x4b')]===0x0){return db[_0x1882('0x23')][_0x1882('0x46')]({'name':_0x550a7c[_0x1882('0x26')],'resourceId':_0x550a7c['id'],'type':_0x53bec2[_0x1882('0x26')],'sectionId':_0x53bec2['id']},{})[_0x1882('0x1f')](function(){return _0x5eea93;});}else{return _0x5eea93;}})[_0x1882('0x41')](function(_0x5eaa7a){logger[_0x1882('0x24')](_0x1882('0x4c'),_0x5eaa7a);throw _0x5eaa7a;});}return _0x5eea93;})[_0x1882('0x1f')](respondWithResult(_0x4ef079,0xc9))[_0x1882('0x41')](handleError(_0x4ef079,null));};exports[_0x1882('0x1e')]=function(_0x526b08,_0x575149){if(_0x526b08[_0x1882('0x47')]['id']){delete _0x526b08[_0x1882('0x47')]['id'];}return db[_0x1882('0x3f')]['find']({'where':{'id':_0x526b08[_0x1882('0x43')]['id']}})[_0x1882('0x1f')](handleEntityNotFound(_0x575149,null))[_0x1882('0x1f')](saveUpdates(_0x526b08['body'],null))['then'](respondWithResult(_0x575149,null))[_0x1882('0x41')](handleError(_0x575149,null));};exports[_0x1882('0x20')]=function(_0x4ccf02,_0x34c40a){return db[_0x1882('0x3f')][_0x1882('0x45')]({'where':{'id':_0x4ccf02[_0x1882('0x43')]['id']}})[_0x1882('0x1f')](handleEntityNotFound(_0x34c40a,null))['then'](removeEntity(_0x34c40a,null))['catch'](handleError(_0x34c40a,null));}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.model.js b/server/api/UserFaxInteraction/UserFaxInteraction.model.js index 0e51858..ec0cde7 100644 --- a/server/api/UserFaxInteraction/UserFaxInteraction.model.js +++ b/server/api/UserFaxInteraction/UserFaxInteraction.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['request-promise','path','../../config/environment','exports','UserFaxInteraction','user_has_fax_interactions','util','api','moment','bluebird'];(function(_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 +var _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./UserFaxInteraction.attributes','exports','define','user_has_fax_interactions','lodash','../../config/logger'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4cc95a,_0x15c4c7){_0x4cc95a=_0x4cc95a-0x0;var _0x4abee3=_0xb10b[_0x4cc95a];return _0x4abee3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserFaxInteraction',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js b/server/api/UserFaxInteraction/UserFaxInteraction.rpc.js index 6148ccd..2b02e9a 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 _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 +var _0xc734=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','UserFaxInteraction,\x20%s,\x20%s','debug','UserFaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','util','moment','randomstring','ioredis'];(function(_0x40b128,_0x350c80){var _0x375d5e=function(_0x24aa07){while(--_0x24aa07){_0x40b128['push'](_0x40b128['shift']());}};_0x375d5e(++_0x350c80);}(_0xc734,0x1b4));var _0x4c73=function(_0x56a061,_0x53fb1b){_0x56a061=_0x56a061-0x0;var _0x105fa0=_0xc734[_0x56a061];return _0x105fa0;};'use strict';var _=require('lodash');var util=require(_0x4c73('0x0'));var moment=require(_0x4c73('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c73('0x2'));var fs=require('fs');var Redis=require(_0x4c73('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c73('0x4'));var logger=require(_0x4c73('0x5'))(_0x4c73('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c73('0x7'));var client=jayson[_0x4c73('0x8')][_0x4c73('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d6ac7,_0xadde00,_0x367336){return new BPromise(function(_0x5a349c,_0x2997b3){return client[_0x4c73('0xa')](_0x5d6ac7,_0x367336)['then'](function(_0x1802ac){logger[_0x4c73('0xb')](_0x4c73('0xc'),_0xadde00,'request\x20sent');logger[_0x4c73('0xd')](_0x4c73('0xe'),_0xadde00,_0x4c73('0xf'),JSON[_0x4c73('0x10')](_0x1802ac));if(_0x1802ac[_0x4c73('0x11')]){if(_0x1802ac[_0x4c73('0x11')][_0x4c73('0x12')]===0x1f4){logger[_0x4c73('0x11')](_0x4c73('0xc'),_0xadde00,_0x1802ac['error']['message']);return _0x2997b3(_0x1802ac['error'][_0x4c73('0x13')]);}logger['error'](_0x4c73('0xc'),_0xadde00,_0x1802ac[_0x4c73('0x11')][_0x4c73('0x13')]);return _0x5a349c(_0x1802ac[_0x4c73('0x11')][_0x4c73('0x13')]);}else{logger[_0x4c73('0xb')](_0x4c73('0xc'),_0xadde00,_0x4c73('0xf'));_0x5a349c(_0x1802ac['result']['message']);}})['catch'](function(_0xf11fd1){logger[_0x4c73('0x11')]('UserFaxInteraction,\x20%s,\x20%s',_0xadde00,_0xf11fd1);_0x2997b3(_0xf11fd1);});});} \ No newline at end of file diff --git a/server/api/UserFaxInteraction/index.js b/server/api/UserFaxInteraction/index.js index 0fb3416..5f8d13b 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 _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 +var _0x3fe2=['express','Router','../../config/environment','./UserFaxInteraction.controller','get','isAuthenticated','index','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout'];(function(_0x36ab66,_0x836027){var _0x23ae67=function(_0x24bef3){while(--_0x24bef3){_0x36ab66['push'](_0x36ab66['shift']());}};_0x23ae67(++_0x836027);}(_0x3fe2,0xfb));var _0x23fe=function(_0x2747bf,_0x5b2ec6){_0x2747bf=_0x2747bf-0x0;var _0x1fb1b1=_0x3fe2[_0x2747bf];return _0x1fb1b1;};'use strict';var multer=require(_0x23fe('0x0'));var util=require(_0x23fe('0x1'));var path=require(_0x23fe('0x2'));var timeout=require(_0x23fe('0x3'));var express=require(_0x23fe('0x4'));var router=express[_0x23fe('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x23fe('0x6'));var controller=require(_0x23fe('0x7'));router[_0x23fe('0x8')]('/',auth[_0x23fe('0x9')](),controller[_0x23fe('0xa')]);router[_0x23fe('0x8')](_0x23fe('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x23fe('0xc')]('/',auth[_0x23fe('0x9')](),controller[_0x23fe('0xd')]);router[_0x23fe('0xe')](_0x23fe('0xb'),auth[_0x23fe('0x9')](),controller['update']);router['delete'](_0x23fe('0xb'),auth['isAuthenticated'](),controller[_0x23fe('0xf')]);module[_0x23fe('0x10')]=router; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.attributes.js b/server/api/UserMailInteraction/UserMailInteraction.attributes.js index 5d76357..bc90c4a 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 _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 +var _0x2e8f=['INTEGER'];(function(_0xfc33d,_0x3c3d12){var _0x445fa1=function(_0x2823e7){while(--_0x2823e7){_0xfc33d['push'](_0xfc33d['shift']());}};_0x445fa1(++_0x3c3d12);}(_0x2e8f,0x17a));var _0xf2e8=function(_0x1ebe90,_0x5d29fc){_0x1ebe90=_0x1ebe90-0x0;var _0x447c82=_0x2e8f[_0x1ebe90];return _0x447c82;};'use strict';var Sequelize=require('sequelize');module['exports']={'MailInteractionId':{'type':Sequelize[_0xf2e8('0x0')],'primaryKey':!![]},'UserId':{'type':Sequelize['INTEGER'],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.controller.js b/server/api/UserMailInteraction/UserMailInteraction.controller.js index f47c288..20c92b1 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 _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 +var _0x3745=['type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','UserMailInteraction','rows','show','params','keys','filters','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserMailInteractions','UserProfileResource','stack','name','index','map','rawAttributes','fieldName'];(function(_0x5e0910,_0x524b54){var _0x78ec77=function(_0x3971da){while(--_0x3971da){_0x5e0910['push'](_0x5e0910['shift']());}};_0x78ec77(++_0x524b54);}(_0x3745,0x73));var _0x5374=function(_0x3b9790,_0xfbcf4b){_0x3b9790=_0x3b9790-0x0;var _0x50a671=_0x3745[_0x3b9790];return _0x50a671;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5374('0x0'));var zipdir=require(_0x5374('0x1'));var jsonpatch=require(_0x5374('0x2'));var rp=require(_0x5374('0x3'));var moment=require(_0x5374('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5374('0x5'));var util=require(_0x5374('0x6'));var path=require(_0x5374('0x7'));var sox=require(_0x5374('0x8'));var csv=require(_0x5374('0x9'));var ejs=require(_0x5374('0xa'));var fs=require('fs');var _=require(_0x5374('0xb'));var squel=require(_0x5374('0xc'));var crypto=require(_0x5374('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5374('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5374('0xf'));var Papa=require(_0x5374('0x10'));var Redis=require('ioredis');var authService=require(_0x5374('0x11'));var qs=require(_0x5374('0x12'));var as=require(_0x5374('0x13'));var hardwareService=require(_0x5374('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x5374('0x15'));var licenseUtil=require(_0x5374('0x16'));var db=require(_0x5374('0x17'))['db'];function respondWithStatusCode(_0x8fd16a,_0x1bc4a6){_0x1bc4a6=_0x1bc4a6||0xcc;return function(_0x528164){if(_0x528164){return _0x8fd16a[_0x5374('0x18')](_0x1bc4a6);}return _0x8fd16a[_0x5374('0x19')](_0x1bc4a6)[_0x5374('0x1a')]();};}function respondWithResult(_0x55a8ce,_0x340088){_0x340088=_0x340088||0xc8;return function(_0x2a0824){if(_0x2a0824){return _0x55a8ce['status'](_0x340088)[_0x5374('0x1b')](_0x2a0824);}};}function respondWithFilteredResult(_0x91166f,_0x8caba6){return function(_0x45f477){if(_0x45f477){var _0x1003fb=_0x45f477[_0x5374('0x1c')],_0x46165c=_0x8caba6[_0x5374('0x1d')],_0x72390d=_0x8caba6[_0x5374('0x1d')]+_0x8caba6[_0x5374('0x1e')],_0x253440;if(_0x72390d>=_0x1003fb){_0x72390d=_0x1003fb;_0x253440=0xc8;}else{_0x253440=0xce;}_0x91166f['status'](_0x253440);return _0x91166f[_0x5374('0x1f')](_0x5374('0x20'),_0x46165c+'-'+_0x72390d+'/'+_0x1003fb)[_0x5374('0x1b')](_0x45f477);}return null;};}function patchUpdates(_0x56fa30){return function(_0x4b1368){try{jsonpatch[_0x5374('0x21')](_0x4b1368,_0x56fa30,!![]);}catch(_0x2b7fcd){return BPromise[_0x5374('0x22')](_0x2b7fcd);}return _0x4b1368[_0x5374('0x23')]();};}function saveUpdates(_0x995f7f,_0x18b938){return function(_0x3f0f01){if(_0x3f0f01){return _0x3f0f01[_0x5374('0x24')](_0x995f7f)[_0x5374('0x25')](function(_0x473371){return _0x473371;});}return null;};}function removeEntity(_0x441de8,_0x372962){return function(_0x1a1904){if(_0x1a1904){return _0x1a1904[_0x5374('0x26')]()['then'](function(){var _0x4660cc=_0x1a1904['get']({'plain':!![]});var _0xa782c6=_0x5374('0x27');return db[_0x5374('0x28')][_0x5374('0x26')]({'where':{'type':_0xa782c6,'resourceId':_0x4660cc['id']}})['then'](function(){return _0x1a1904;});})[_0x5374('0x25')](function(){_0x441de8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ae19c,_0x2eeec9){return function(_0x121527){if(!_0x121527){_0x4ae19c['sendStatus'](0x194);}return _0x121527;};}function handleError(_0x30438c,_0x2f2a5b){_0x2f2a5b=_0x2f2a5b||0x1f4;return function(_0x4dc69f){logger['error'](_0x4dc69f[_0x5374('0x29')]);if(_0x4dc69f[_0x5374('0x2a')]){delete _0x4dc69f[_0x5374('0x2a')];}_0x30438c[_0x5374('0x19')](_0x2f2a5b)['send'](_0x4dc69f);};}exports[_0x5374('0x2b')]=function(_0x22b2d9,_0x7e5ca4){var _0xcab366={},_0x949f1c={},_0x14a128={'count':0x0,'rows':[]};var _0x1c7af2=_[_0x5374('0x2c')](db['UserMailInteraction'][_0x5374('0x2d')],function(_0xcc669b){return{'name':_0xcc669b[_0x5374('0x2e')],'type':_0xcc669b[_0x5374('0x2f')][_0x5374('0x30')]};});_0x949f1c[_0x5374('0x31')]=_[_0x5374('0x2c')](_0x1c7af2,_0x5374('0x2a'));_0x949f1c['query']=_['keys'](_0x22b2d9[_0x5374('0x32')]);_0x949f1c['filters']=_[_0x5374('0x33')](_0x949f1c['model'],_0x949f1c[_0x5374('0x32')]);_0xcab366[_0x5374('0x34')]=_[_0x5374('0x33')](_0x949f1c[_0x5374('0x31')],qs[_0x5374('0x35')](_0x22b2d9[_0x5374('0x32')][_0x5374('0x35')]));_0xcab366['attributes']=_0xcab366[_0x5374('0x34')]['length']?_0xcab366[_0x5374('0x34')]:_0x949f1c['model'];if(!_0x22b2d9[_0x5374('0x32')][_0x5374('0x36')]('nolimit')){_0xcab366[_0x5374('0x1e')]=qs[_0x5374('0x1e')](_0x22b2d9[_0x5374('0x32')]['limit']);_0xcab366[_0x5374('0x1d')]=qs[_0x5374('0x1d')](_0x22b2d9[_0x5374('0x32')]['offset']);}_0xcab366['order']=qs['sort'](_0x22b2d9[_0x5374('0x32')][_0x5374('0x37')]);_0xcab366[_0x5374('0x38')]=qs['filters'](_[_0x5374('0x39')](_0x22b2d9['query'],_0x949f1c['filters']),_0x1c7af2);if(_0x22b2d9['query'][_0x5374('0x3a')]){_0xcab366[_0x5374('0x38')]=_[_0x5374('0x3b')](_0xcab366['where'],{'$or':_['map'](_0x1c7af2,function(_0x44c934){if(_0x44c934[_0x5374('0x2f')]!=='VIRTUAL'){var _0x6fc7d0={};_0x6fc7d0[_0x44c934['name']]={'$like':'%'+_0x22b2d9['query']['filter']+'%'};return _0x6fc7d0;}})});}_0xcab366=_[_0x5374('0x3b')]({},_0xcab366,_0x22b2d9['options']);var _0x32d19e={'where':_0xcab366[_0x5374('0x38')]};return db['UserMailInteraction'][_0x5374('0x1c')](_0x32d19e)[_0x5374('0x25')](function(_0x4d7bce){_0x14a128[_0x5374('0x1c')]=_0x4d7bce;if(_0x22b2d9[_0x5374('0x32')][_0x5374('0x3c')]){_0xcab366[_0x5374('0x3d')]=[{'all':!![]}];}return db[_0x5374('0x3e')]['findAll'](_0xcab366);})[_0x5374('0x25')](function(_0x29d9af){_0x14a128[_0x5374('0x3f')]=_0x29d9af;return _0x14a128;})[_0x5374('0x25')](respondWithFilteredResult(_0x7e5ca4,_0xcab366))['catch'](handleError(_0x7e5ca4,null));};exports[_0x5374('0x40')]=function(_0x59f267,_0x479783){var _0x1595b0={'raw':!![],'where':{'id':_0x59f267[_0x5374('0x41')]['id']}},_0x5b9c17={};_0x5b9c17[_0x5374('0x31')]=_[_0x5374('0x42')](db[_0x5374('0x3e')][_0x5374('0x2d')]);_0x5b9c17['query']=_['keys'](_0x59f267[_0x5374('0x32')]);_0x5b9c17[_0x5374('0x43')]=_['intersection'](_0x5b9c17[_0x5374('0x31')],_0x5b9c17[_0x5374('0x32')]);_0x1595b0['attributes']=_['intersection'](_0x5b9c17[_0x5374('0x31')],qs[_0x5374('0x35')](_0x59f267['query'][_0x5374('0x35')]));_0x1595b0[_0x5374('0x34')]=_0x1595b0[_0x5374('0x34')][_0x5374('0x44')]?_0x1595b0[_0x5374('0x34')]:_0x5b9c17[_0x5374('0x31')];if(_0x59f267['query'][_0x5374('0x3c')]){_0x1595b0[_0x5374('0x3d')]=[{'all':!![]}];}_0x1595b0=_[_0x5374('0x3b')]({},_0x1595b0,_0x59f267['options']);return db['UserMailInteraction'][_0x5374('0x45')](_0x1595b0)[_0x5374('0x25')](handleEntityNotFound(_0x479783,null))[_0x5374('0x25')](respondWithResult(_0x479783,null))[_0x5374('0x46')](handleError(_0x479783,null));};exports[_0x5374('0x47')]=function(_0x2dfa87,_0x3048c9){return db['UserMailInteraction'][_0x5374('0x47')](_0x2dfa87[_0x5374('0x48')],{})['then'](function(_0x15c85a){var _0x143980=_0x2dfa87['user'][_0x5374('0x49')]({'plain':!![]});if(!_0x143980)throw new Error(_0x5374('0x4a'));if(_0x143980[_0x5374('0x4b')]===_0x5374('0x4c')){var _0x52b7f3=_0x15c85a['get']({'plain':!![]});var _0x5cdc0a=_0x5374('0x27');return db[_0x5374('0x4d')][_0x5374('0x45')]({'where':{'name':_0x5cdc0a,'userProfileId':_0x143980['userProfileId']},'raw':!![]})[_0x5374('0x25')](function(_0x2622e7){if(_0x2622e7&&_0x2622e7[_0x5374('0x4e')]===0x0){return db[_0x5374('0x28')][_0x5374('0x47')]({'name':_0x52b7f3[_0x5374('0x2a')],'resourceId':_0x52b7f3['id'],'type':_0x2622e7['name'],'sectionId':_0x2622e7['id']},{})[_0x5374('0x25')](function(){return _0x15c85a;});}else{return _0x15c85a;}})[_0x5374('0x46')](function(_0x480bf4){logger[_0x5374('0x4f')](_0x5374('0x50'),_0x480bf4);throw _0x480bf4;});}return _0x15c85a;})['then'](respondWithResult(_0x3048c9,0xc9))[_0x5374('0x46')](handleError(_0x3048c9,null));};exports['update']=function(_0x3eff7a,_0x2684f6){if(_0x3eff7a['body']['id']){delete _0x3eff7a[_0x5374('0x48')]['id'];}return db[_0x5374('0x3e')][_0x5374('0x45')]({'where':{'id':_0x3eff7a[_0x5374('0x41')]['id']}})[_0x5374('0x25')](handleEntityNotFound(_0x2684f6,null))[_0x5374('0x25')](saveUpdates(_0x3eff7a[_0x5374('0x48')],null))[_0x5374('0x25')](respondWithResult(_0x2684f6,null))[_0x5374('0x46')](handleError(_0x2684f6,null));};exports[_0x5374('0x26')]=function(_0x5c5bf7,_0x4bfa99){return db['UserMailInteraction'][_0x5374('0x45')]({'where':{'id':_0x5c5bf7[_0x5374('0x41')]['id']}})[_0x5374('0x25')](handleEntityNotFound(_0x4bfa99,null))[_0x5374('0x25')](removeEntity(_0x4bfa99,null))[_0x5374('0x46')](handleError(_0x4bfa99,null));}; \ No newline at end of file diff --git a/server/api/UserMailInteraction/UserMailInteraction.model.js b/server/api/UserMailInteraction/UserMailInteraction.model.js index e782977..503b026 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 _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 +var _0x6b0e=['util','../../config/logger','moment','request-promise','path','../../config/environment','./UserMailInteraction.attributes','exports','user_has_mail_interactions','lodash'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0x6b0e,0x185));var _0xe6b0=function(_0x59a457,_0x44633c){_0x59a457=_0x59a457-0x0;var _0x646321=_0x6b0e[_0x59a457];return _0x646321;};'use strict';var _=require(_0xe6b0('0x0'));var util=require(_0xe6b0('0x1'));var logger=require(_0xe6b0('0x2'))('api');var moment=require(_0xe6b0('0x3'));var BPromise=require('bluebird');var rp=require(_0xe6b0('0x4'));var fs=require('fs');var path=require(_0xe6b0('0x5'));var rimraf=require('rimraf');var config=require(_0xe6b0('0x6'));var attributes=require(_0xe6b0('0x7'));module[_0xe6b0('0x8')]=function(_0x2eb83e,_0x1eb26c){return _0x2eb83e['define']('UserMailInteraction',attributes,{'tableName':_0xe6b0('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 44dcee3..9da4f43 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 _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 +var _0x70e9=['error','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','UserMailInteraction,\x20%s,\x20%s','debug','UserMailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x6f57f5,_0x174cab){var _0x542774=function(_0x112cc9){while(--_0x112cc9){_0x6f57f5['push'](_0x6f57f5['shift']());}};_0x542774(++_0x174cab);}(_0x70e9,0x193));var _0x970e=function(_0x3cbf9b,_0x5d81cf){_0x3cbf9b=_0x3cbf9b-0x0;var _0x325a69=_0x70e9[_0x3cbf9b];return _0x325a69;};'use strict';var _=require('lodash');var util=require(_0x970e('0x0'));var moment=require(_0x970e('0x1'));var BPromise=require('bluebird');var rs=require(_0x970e('0x2'));var fs=require('fs');var Redis=require(_0x970e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x970e('0x4'));var logger=require('../../config/logger')(_0x970e('0x5'));var config=require(_0x970e('0x6'));var jayson=require(_0x970e('0x7'));var client=jayson[_0x970e('0x8')][_0x970e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x303190,_0x1e5701,_0x508324){return new BPromise(function(_0x50cab9,_0x388bf7){return client[_0x970e('0xa')](_0x303190,_0x508324)['then'](function(_0x38c7a0){logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,'request\x20sent');logger[_0x970e('0xd')](_0x970e('0xe'),_0x1e5701,_0x970e('0xf'),JSON[_0x970e('0x10')](_0x38c7a0));if(_0x38c7a0[_0x970e('0x11')]){if(_0x38c7a0[_0x970e('0x11')]['code']===0x1f4){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);return _0x388bf7(_0x38c7a0[_0x970e('0x11')][_0x970e('0x12')]);}logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x38c7a0['error'][_0x970e('0x12')]);return _0x50cab9(_0x38c7a0[_0x970e('0x11')]['message']);}else{logger[_0x970e('0xb')](_0x970e('0xc'),_0x1e5701,_0x970e('0xf'));_0x50cab9(_0x38c7a0[_0x970e('0x13')]['message']);}})[_0x970e('0x14')](function(_0x2ec7f5){logger[_0x970e('0x11')](_0x970e('0xc'),_0x1e5701,_0x2ec7f5);_0x388bf7(_0x2ec7f5);});});} \ No newline at end of file diff --git a/server/api/UserMailInteraction/index.js b/server/api/UserMailInteraction/index.js index 7738bcf..cbd218a 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 _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 +var _0x687b=['post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserMailInteraction.controller','get','isAuthenticated','index','/:id'];(function(_0xd13a88,_0x3c5269){var _0x1c993c=function(_0x245af5){while(--_0x245af5){_0xd13a88['push'](_0xd13a88['shift']());}};_0x1c993c(++_0x3c5269);}(_0x687b,0x14a));var _0xb687=function(_0x431979,_0x2b3eb6){_0x431979=_0x431979-0x0;var _0x731032=_0x687b[_0x431979];return _0x731032;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xb687('0x4'));var interaction=require(_0xb687('0x5'));var config=require(_0xb687('0x6'));var controller=require(_0xb687('0x7'));router[_0xb687('0x8')]('/',auth[_0xb687('0x9')](),controller[_0xb687('0xa')]);router[_0xb687('0x8')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller['show']);router[_0xb687('0xc')]('/',auth[_0xb687('0x9')](),controller['create']);router[_0xb687('0xd')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0xe')]);router[_0xb687('0xf')](_0xb687('0xb'),auth[_0xb687('0x9')](),controller[_0xb687('0x10')]);module[_0xb687('0x11')]=router; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.attributes.js index 9ef09f5..e125fe3 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 _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 +var _0xe2f6=['INTEGER','sequelize','exports'];(function(_0x230802,_0x2ba958){var _0x98272=function(_0x27e985){while(--_0x27e985){_0x230802['push'](_0x230802['shift']());}};_0x98272(++_0x2ba958);}(_0xe2f6,0x79));var _0x6e2f=function(_0x3a4c9c,_0x4d62d4){_0x3a4c9c=_0x3a4c9c-0x0;var _0x36058e=_0xe2f6[_0x3a4c9c];return _0x36058e;};'use strict';var Sequelize=require(_0x6e2f('0x0'));module[_0x6e2f('0x1')]={'OpenchannelInteractionId':{'type':Sequelize[_0x6e2f('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x6e2f('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.controller.js index 6e54d05..90cf132 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 _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 +var _0xd1a5=['fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','params','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','save','update','then','get','UserOpenchannelInteraction','destroy','error','name','send','map'];(function(_0x4b90dd,_0x572f82){var _0x26aa19=function(_0x47b534){while(--_0x47b534){_0x4b90dd['push'](_0x4b90dd['shift']());}};_0x26aa19(++_0x572f82);}(_0xd1a5,0x162));var _0x5d1a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd1a5[_0x40a045];return _0x1a687c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5d1a('0x0'));var rimraf=require(_0x5d1a('0x1'));var zipdir=require(_0x5d1a('0x2'));var jsonpatch=require(_0x5d1a('0x3'));var rp=require(_0x5d1a('0x4'));var moment=require(_0x5d1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5d1a('0x6'));var util=require(_0x5d1a('0x7'));var path=require('path');var sox=require(_0x5d1a('0x8'));var csv=require('to-csv');var ejs=require(_0x5d1a('0x9'));var fs=require('fs');var _=require(_0x5d1a('0xa'));var squel=require(_0x5d1a('0xb'));var crypto=require('crypto');var jsforce=require(_0x5d1a('0xc'));var deskjs=require(_0x5d1a('0xd'));var toCsv=require(_0x5d1a('0xe'));var querystring=require(_0x5d1a('0xf'));var Papa=require(_0x5d1a('0x10'));var Redis=require(_0x5d1a('0x11'));var authService=require(_0x5d1a('0x12'));var qs=require(_0x5d1a('0x13'));var as=require(_0x5d1a('0x14'));var hardwareService=require(_0x5d1a('0x15'));var logger=require(_0x5d1a('0x16'))(_0x5d1a('0x17'));var utils=require(_0x5d1a('0x18'));var config=require(_0x5d1a('0x19'));var licenseUtil=require(_0x5d1a('0x1a'));var db=require(_0x5d1a('0x1b'))['db'];function respondWithStatusCode(_0x5f1f5c,_0x4811ba){_0x4811ba=_0x4811ba||0xcc;return function(_0x30042){if(_0x30042){return _0x5f1f5c[_0x5d1a('0x1c')](_0x4811ba);}return _0x5f1f5c[_0x5d1a('0x1d')](_0x4811ba)['end']();};}function respondWithResult(_0x36848b,_0x456273){_0x456273=_0x456273||0xc8;return function(_0x27a79d){if(_0x27a79d){return _0x36848b[_0x5d1a('0x1d')](_0x456273)[_0x5d1a('0x1e')](_0x27a79d);}};}function respondWithFilteredResult(_0x13fc7c,_0x4da891){return function(_0x5ce4e9){if(_0x5ce4e9){var _0x40054d=_0x5ce4e9[_0x5d1a('0x1f')],_0x3e57c8=_0x4da891[_0x5d1a('0x20')],_0x5d172a=_0x4da891[_0x5d1a('0x20')]+_0x4da891[_0x5d1a('0x21')],_0x21e749;if(_0x5d172a>=_0x40054d){_0x5d172a=_0x40054d;_0x21e749=0xc8;}else{_0x21e749=0xce;}_0x13fc7c[_0x5d1a('0x1d')](_0x21e749);return _0x13fc7c[_0x5d1a('0x22')]('Content-Range',_0x3e57c8+'-'+_0x5d172a+'/'+_0x40054d)[_0x5d1a('0x1e')](_0x5ce4e9);}return null;};}function patchUpdates(_0x3e18f2){return function(_0xb139cf){try{jsonpatch[_0x5d1a('0x23')](_0xb139cf,_0x3e18f2,!![]);}catch(_0x789d93){return BPromise['reject'](_0x789d93);}return _0xb139cf[_0x5d1a('0x24')]();};}function saveUpdates(_0x5f4366,_0x496e77){return function(_0x39a3db){if(_0x39a3db){return _0x39a3db[_0x5d1a('0x25')](_0x5f4366)[_0x5d1a('0x26')](function(_0x207287){return _0x207287;});}return null;};}function removeEntity(_0x44fefd,_0x477a9f){return function(_0x50e440){if(_0x50e440){return _0x50e440['destroy']()[_0x5d1a('0x26')](function(){var _0xde391e=_0x50e440[_0x5d1a('0x27')]({'plain':!![]});var _0x16a8c3=_0x5d1a('0x28');return db['UserProfileResource'][_0x5d1a('0x29')]({'where':{'type':_0x16a8c3,'resourceId':_0xde391e['id']}})[_0x5d1a('0x26')](function(){return _0x50e440;});})[_0x5d1a('0x26')](function(){_0x44fefd[_0x5d1a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x132275,_0x52b369){return function(_0xebbfd4){if(!_0xebbfd4){_0x132275['sendStatus'](0x194);}return _0xebbfd4;};}function handleError(_0xc0a640,_0x5148d8){_0x5148d8=_0x5148d8||0x1f4;return function(_0x440738){logger[_0x5d1a('0x2a')](_0x440738['stack']);if(_0x440738[_0x5d1a('0x2b')]){delete _0x440738[_0x5d1a('0x2b')];}_0xc0a640['status'](_0x5148d8)[_0x5d1a('0x2c')](_0x440738);};}exports['index']=function(_0xa1ae33,_0x457a49){var _0x2a8bd7={},_0x3c7af2={},_0x4700a6={'count':0x0,'rows':[]};var _0x5df48a=_[_0x5d1a('0x2d')](db['UserOpenchannelInteraction']['rawAttributes'],function(_0x5ec9a3){return{'name':_0x5ec9a3[_0x5d1a('0x2e')],'type':_0x5ec9a3[_0x5d1a('0x2f')][_0x5d1a('0x30')]};});_0x3c7af2[_0x5d1a('0x31')]=_['map'](_0x5df48a,'name');_0x3c7af2[_0x5d1a('0x32')]=_[_0x5d1a('0x33')](_0xa1ae33[_0x5d1a('0x32')]);_0x3c7af2[_0x5d1a('0x34')]=_['intersection'](_0x3c7af2['model'],_0x3c7af2['query']);_0x2a8bd7[_0x5d1a('0x35')]=_['intersection'](_0x3c7af2['model'],qs[_0x5d1a('0x36')](_0xa1ae33[_0x5d1a('0x32')][_0x5d1a('0x36')]));_0x2a8bd7[_0x5d1a('0x35')]=_0x2a8bd7[_0x5d1a('0x35')][_0x5d1a('0x37')]?_0x2a8bd7[_0x5d1a('0x35')]:_0x3c7af2['model'];if(!_0xa1ae33['query'][_0x5d1a('0x38')](_0x5d1a('0x39'))){_0x2a8bd7[_0x5d1a('0x21')]=qs[_0x5d1a('0x21')](_0xa1ae33[_0x5d1a('0x32')][_0x5d1a('0x21')]);_0x2a8bd7[_0x5d1a('0x20')]=qs[_0x5d1a('0x20')](_0xa1ae33['query'][_0x5d1a('0x20')]);}_0x2a8bd7[_0x5d1a('0x3a')]=qs[_0x5d1a('0x3b')](_0xa1ae33[_0x5d1a('0x32')][_0x5d1a('0x3b')]);_0x2a8bd7[_0x5d1a('0x3c')]=qs[_0x5d1a('0x34')](_[_0x5d1a('0x3d')](_0xa1ae33['query'],_0x3c7af2[_0x5d1a('0x34')]),_0x5df48a);if(_0xa1ae33['query'][_0x5d1a('0x3e')]){_0x2a8bd7['where']=_[_0x5d1a('0x3f')](_0x2a8bd7[_0x5d1a('0x3c')],{'$or':_[_0x5d1a('0x2d')](_0x5df48a,function(_0x9bb82f){if(_0x9bb82f[_0x5d1a('0x2f')]!==_0x5d1a('0x40')){var _0x18b051={};_0x18b051[_0x9bb82f['name']]={'$like':'%'+_0xa1ae33[_0x5d1a('0x32')]['filter']+'%'};return _0x18b051;}})});}_0x2a8bd7=_[_0x5d1a('0x3f')]({},_0x2a8bd7,_0xa1ae33['options']);var _0x406cb2={'where':_0x2a8bd7[_0x5d1a('0x3c')]};return db[_0x5d1a('0x28')][_0x5d1a('0x1f')](_0x406cb2)[_0x5d1a('0x26')](function(_0x32b892){_0x4700a6['count']=_0x32b892;if(_0xa1ae33['query'][_0x5d1a('0x41')]){_0x2a8bd7['include']=[{'all':!![]}];}return db[_0x5d1a('0x28')]['findAll'](_0x2a8bd7);})[_0x5d1a('0x26')](function(_0x1cb5b7){_0x4700a6[_0x5d1a('0x42')]=_0x1cb5b7;return _0x4700a6;})['then'](respondWithFilteredResult(_0x457a49,_0x2a8bd7))[_0x5d1a('0x43')](handleError(_0x457a49,null));};exports['show']=function(_0x541536,_0x1b2294){var _0x1c0905={'raw':!![],'where':{'id':_0x541536[_0x5d1a('0x44')]['id']}},_0x2741e2={};_0x2741e2['model']=_[_0x5d1a('0x33')](db[_0x5d1a('0x28')]['rawAttributes']);_0x2741e2['query']=_[_0x5d1a('0x33')](_0x541536[_0x5d1a('0x32')]);_0x2741e2[_0x5d1a('0x34')]=_['intersection'](_0x2741e2['model'],_0x2741e2['query']);_0x1c0905[_0x5d1a('0x35')]=_['intersection'](_0x2741e2[_0x5d1a('0x31')],qs[_0x5d1a('0x36')](_0x541536[_0x5d1a('0x32')][_0x5d1a('0x36')]));_0x1c0905[_0x5d1a('0x35')]=_0x1c0905[_0x5d1a('0x35')]['length']?_0x1c0905[_0x5d1a('0x35')]:_0x2741e2['model'];if(_0x541536[_0x5d1a('0x32')]['includeAll']){_0x1c0905['include']=[{'all':!![]}];}_0x1c0905=_['merge']({},_0x1c0905,_0x541536['options']);return db[_0x5d1a('0x28')][_0x5d1a('0x45')](_0x1c0905)[_0x5d1a('0x26')](handleEntityNotFound(_0x1b2294,null))[_0x5d1a('0x26')](respondWithResult(_0x1b2294,null))['catch'](handleError(_0x1b2294,null));};exports[_0x5d1a('0x46')]=function(_0x33ad7a,_0x5e66f9){return db[_0x5d1a('0x28')]['create'](_0x33ad7a[_0x5d1a('0x47')],{})['then'](function(_0x335161){var _0x5e5c9a=_0x33ad7a[_0x5d1a('0x48')][_0x5d1a('0x27')]({'plain':!![]});if(!_0x5e5c9a)throw new Error(_0x5d1a('0x49'));if(_0x5e5c9a[_0x5d1a('0x4a')]===_0x5d1a('0x48')){var _0x4d47ec=_0x335161['get']({'plain':!![]});var _0x13827d='UserOpenchannelInteraction';return db[_0x5d1a('0x4b')][_0x5d1a('0x45')]({'where':{'name':_0x13827d,'userProfileId':_0x5e5c9a[_0x5d1a('0x4c')]},'raw':!![]})[_0x5d1a('0x26')](function(_0x1625c7){if(_0x1625c7&&_0x1625c7[_0x5d1a('0x4d')]===0x0){return db[_0x5d1a('0x4e')][_0x5d1a('0x46')]({'name':_0x4d47ec[_0x5d1a('0x2b')],'resourceId':_0x4d47ec['id'],'type':_0x1625c7['name'],'sectionId':_0x1625c7['id']},{})[_0x5d1a('0x26')](function(){return _0x335161;});}else{return _0x335161;}})[_0x5d1a('0x43')](function(_0x5b3878){logger[_0x5d1a('0x2a')](_0x5d1a('0x4f'),_0x5b3878);throw _0x5b3878;});}return _0x335161;})['then'](respondWithResult(_0x5e66f9,0xc9))[_0x5d1a('0x43')](handleError(_0x5e66f9,null));};exports[_0x5d1a('0x25')]=function(_0x5ea8cd,_0x4f41ce){if(_0x5ea8cd['body']['id']){delete _0x5ea8cd[_0x5d1a('0x47')]['id'];}return db[_0x5d1a('0x28')][_0x5d1a('0x45')]({'where':{'id':_0x5ea8cd['params']['id']}})[_0x5d1a('0x26')](handleEntityNotFound(_0x4f41ce,null))[_0x5d1a('0x26')](saveUpdates(_0x5ea8cd[_0x5d1a('0x47')],null))['then'](respondWithResult(_0x4f41ce,null))[_0x5d1a('0x43')](handleError(_0x4f41ce,null));};exports['destroy']=function(_0x438ee5,_0xbfa6f){return db[_0x5d1a('0x28')][_0x5d1a('0x45')]({'where':{'id':_0x438ee5[_0x5d1a('0x44')]['id']}})[_0x5d1a('0x26')](handleEntityNotFound(_0xbfa6f,null))[_0x5d1a('0x26')](removeEntity(_0xbfa6f,null))[_0x5d1a('0x43')](handleError(_0xbfa6f,null));}; \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js b/server/api/UserOpenchannelInteraction/UserOpenchannelInteraction.model.js index a8962a7..69d9769 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 _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 +var _0x580f=['request-promise','../../config/environment','./UserOpenchannelInteraction.attributes','define','UserOpenchannelInteraction','user_has_openchannel_interactions','lodash','../../config/logger','api','moment','bluebird'];(function(_0x110ea8,_0xacb6fa){var _0x4073cf=function(_0x444fcb){while(--_0x444fcb){_0x110ea8['push'](_0x110ea8['shift']());}};_0x4073cf(++_0xacb6fa);}(_0x580f,0x7f));var _0xf580=function(_0x3f52e1,_0x12177e){_0x3f52e1=_0x3f52e1-0x0;var _0x3cd8b6=_0x580f[_0x3f52e1];return _0x3cd8b6;};'use strict';var _=require(_0xf580('0x0'));var util=require('util');var logger=require(_0xf580('0x1'))(_0xf580('0x2'));var moment=require(_0xf580('0x3'));var BPromise=require(_0xf580('0x4'));var rp=require(_0xf580('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf580('0x6'));var attributes=require(_0xf580('0x7'));module['exports']=function(_0x482600,_0x3109e5){return _0x482600[_0xf580('0x8')](_0xf580('0x9'),attributes,{'tableName':_0xf580('0xa'),'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 9a5d73b..6c31a32 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 _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 +var _0xa759=['request','then','info','UserOpenchannelInteraction,\x20%s,\x20%s','debug','UserOpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','rpc','jayson/promise','http'];(function(_0x3cc651,_0x55e349){var _0x2b0f17=function(_0x5731e6){while(--_0x5731e6){_0x3cc651['push'](_0x3cc651['shift']());}};_0x2b0f17(++_0x55e349);}(_0xa759,0xb5));var _0x9a75=function(_0x5d225a,_0x2debe9){_0x5d225a=_0x5d225a-0x0;var _0x1e7761=_0xa759[_0x5d225a];return _0x1e7761;};'use strict';var _=require(_0x9a75('0x0'));var util=require(_0x9a75('0x1'));var moment=require(_0x9a75('0x2'));var BPromise=require(_0x9a75('0x3'));var rs=require(_0x9a75('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9a75('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a75('0x6'));var client=jayson['client'][_0x9a75('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x506377,_0x468e6c,_0x37c300){return new BPromise(function(_0x40f003,_0x590ee7){return client[_0x9a75('0x8')](_0x506377,_0x37c300)[_0x9a75('0x9')](function(_0x201d04){logger[_0x9a75('0xa')](_0x9a75('0xb'),_0x468e6c,'request\x20sent');logger[_0x9a75('0xc')](_0x9a75('0xd'),_0x468e6c,_0x9a75('0xe'),JSON[_0x9a75('0xf')](_0x201d04));if(_0x201d04['error']){if(_0x201d04[_0x9a75('0x10')][_0x9a75('0x11')]===0x1f4){logger['error'](_0x9a75('0xb'),_0x468e6c,_0x201d04['error'][_0x9a75('0x12')]);return _0x590ee7(_0x201d04[_0x9a75('0x10')]['message']);}logger[_0x9a75('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x468e6c,_0x201d04[_0x9a75('0x10')]['message']);return _0x40f003(_0x201d04[_0x9a75('0x10')][_0x9a75('0x12')]);}else{logger['info'](_0x9a75('0xb'),_0x468e6c,_0x9a75('0xe'));_0x40f003(_0x201d04[_0x9a75('0x13')][_0x9a75('0x12')]);}})[_0x9a75('0x14')](function(_0x45f68e){logger[_0x9a75('0x10')]('UserOpenchannelInteraction,\x20%s,\x20%s',_0x468e6c,_0x45f68e);_0x590ee7(_0x45f68e);});});} \ No newline at end of file diff --git a/server/api/UserOpenchannelInteraction/index.js b/server/api/UserOpenchannelInteraction/index.js index 5ba0778..b120eed 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 _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 +var _0xa177=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./UserOpenchannelInteraction.controller','isAuthenticated','get','post','create','/:id','destroy','exports'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0xa177,0xb0));var _0x7a17=function(_0xc3a877,_0x15222d){_0xc3a877=_0xc3a877-0x0;var _0x86c493=_0xa177[_0xc3a877];return _0x86c493;};'use strict';var multer=require(_0x7a17('0x0'));var util=require(_0x7a17('0x1'));var path=require(_0x7a17('0x2'));var timeout=require(_0x7a17('0x3'));var express=require(_0x7a17('0x4'));var router=express[_0x7a17('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x7a17('0x6'));var config=require(_0x7a17('0x7'));var controller=require(_0x7a17('0x8'));router['get']('/',auth[_0x7a17('0x9')](),controller['index']);router[_0x7a17('0xa')]('/:id',auth[_0x7a17('0x9')](),controller['show']);router[_0x7a17('0xb')]('/',auth[_0x7a17('0x9')](),controller[_0x7a17('0xc')]);router['put'](_0x7a17('0xd'),auth[_0x7a17('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7a17('0x9')](),controller[_0x7a17('0xe')]);module[_0x7a17('0xf')]=router; \ No newline at end of file diff --git a/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js b/server/api/UserSmsInteraction/UserSmsInteraction.attributes.js index 6c37443..33568e3 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 _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 +var _0xcaf8=['INTEGER','sequelize','exports'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xcaf8,0x9d));var _0x8caf=function(_0x528df9,_0x105c4f){_0x528df9=_0x528df9-0x0;var _0x160b1f=_0xcaf8[_0x528df9];return _0x160b1f;};'use strict';var Sequelize=require(_0x8caf('0x0'));module[_0x8caf('0x1')]={'SmsInteractionId':{'type':Sequelize[_0x8caf('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 f189ae3..8160412 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(_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 +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(_0x380acb,_0x4904c9){var _0x369e8d=function(_0x34b674){while(--_0x34b674){_0x380acb['push'](_0x380acb['shift']());}};_0x369e8d(++_0x4904c9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 5c1bffd..a0061e1 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 _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 +var _0xb339=['path','../../config/environment','./UserSmsInteraction.attributes','exports','util','../../config/logger','moment','request-promise'];(function(_0x6b5965,_0x4fe3a8){var _0x615b29=function(_0x39e361){while(--_0x39e361){_0x6b5965['push'](_0x6b5965['shift']());}};_0x615b29(++_0x4fe3a8);}(_0xb339,0xac));var _0x9b33=function(_0x292bab,_0x18b725){_0x292bab=_0x292bab-0x0;var _0x3a1de1=_0xb339[_0x292bab];return _0x3a1de1;};'use strict';var _=require('lodash');var util=require(_0x9b33('0x0'));var logger=require(_0x9b33('0x1'))('api');var moment=require(_0x9b33('0x2'));var BPromise=require('bluebird');var rp=require(_0x9b33('0x3'));var fs=require('fs');var path=require(_0x9b33('0x4'));var rimraf=require('rimraf');var config=require(_0x9b33('0x5'));var attributes=require(_0x9b33('0x6'));module[_0x9b33('0x7')]=function(_0x1f181b,_0x293fe4){return _0x1f181b['define']('UserSmsInteraction',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 d8bf563..9b52515 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 _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 +var _0xa483=['rpc','jayson/promise','client','http','request','then','info','UserSmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3e6aed,_0x97a2f1){var _0x3220dd=function(_0x252cd2){while(--_0x252cd2){_0x3e6aed['push'](_0x3e6aed['shift']());}};_0x3220dd(++_0x97a2f1);}(_0xa483,0x116));var _0x3a48=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa483[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3a48('0x0'));var util=require(_0x3a48('0x1'));var moment=require(_0x3a48('0x2'));var BPromise=require(_0x3a48('0x3'));var rs=require(_0x3a48('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a48('0x5'))['db'];var utils=require(_0x3a48('0x6'));var logger=require('../../config/logger')(_0x3a48('0x7'));var config=require('../../config/environment');var jayson=require(_0x3a48('0x8'));var client=jayson[_0x3a48('0x9')][_0x3a48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c585f,_0xe8be94,_0x55dca8){return new BPromise(function(_0x7a08d7,_0x1f36a9){return client[_0x3a48('0xb')](_0x1c585f,_0x55dca8)[_0x3a48('0xc')](function(_0x4962f5){logger[_0x3a48('0xd')](_0x3a48('0xe'),_0xe8be94,_0x3a48('0xf'));logger['debug']('UserSmsInteraction,\x20%s,\x20%s,\x20%s',_0xe8be94,'request\x20sent',JSON[_0x3a48('0x10')](_0x4962f5));if(_0x4962f5['error']){if(_0x4962f5[_0x3a48('0x11')]['code']===0x1f4){logger['error'](_0x3a48('0xe'),_0xe8be94,_0x4962f5[_0x3a48('0x11')][_0x3a48('0x12')]);return _0x1f36a9(_0x4962f5[_0x3a48('0x11')][_0x3a48('0x12')]);}logger[_0x3a48('0x11')](_0x3a48('0xe'),_0xe8be94,_0x4962f5[_0x3a48('0x11')]['message']);return _0x7a08d7(_0x4962f5[_0x3a48('0x11')][_0x3a48('0x12')]);}else{logger[_0x3a48('0xd')]('UserSmsInteraction,\x20%s,\x20%s',_0xe8be94,'request\x20sent');_0x7a08d7(_0x4962f5['result'][_0x3a48('0x12')]);}})['catch'](function(_0x487aec){logger['error'](_0x3a48('0xe'),_0xe8be94,_0x487aec);_0x1f36a9(_0x487aec);});});} \ No newline at end of file diff --git a/server/api/UserSmsInteraction/index.js b/server/api/UserSmsInteraction/index.js index 56f4b1c..fcd43b0 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 _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 +var _0xc802=['connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','update','delete','/:id','destroy','exports','util'];(function(_0x48562e,_0x1da1bc){var _0x19df96=function(_0xf7fd7e){while(--_0xf7fd7e){_0x48562e['push'](_0x48562e['shift']());}};_0x19df96(++_0x1da1bc);}(_0xc802,0x95));var _0x2c80=function(_0x4fb907,_0xbee72a){_0x4fb907=_0x4fb907-0x0;var _0x55b0ef=_0xc802[_0x4fb907];return _0x55b0ef;};'use strict';var multer=require('multer');var util=require(_0x2c80('0x0'));var path=require('path');var timeout=require(_0x2c80('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2c80('0x2'));var config=require(_0x2c80('0x3'));var controller=require('./UserSmsInteraction.controller');router[_0x2c80('0x4')]('/',auth[_0x2c80('0x5')](),controller[_0x2c80('0x6')]);router[_0x2c80('0x4')]('/:id',auth[_0x2c80('0x5')](),controller['show']);router[_0x2c80('0x7')]('/',auth['isAuthenticated'](),controller[_0x2c80('0x8')]);router[_0x2c80('0x9')]('/:id',auth[_0x2c80('0x5')](),controller[_0x2c80('0xa')]);router[_0x2c80('0xb')](_0x2c80('0xc'),auth[_0x2c80('0x5')](),controller[_0x2c80('0xd')]);module[_0x2c80('0xe')]=router; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.attributes.js index cd76dd5..2a00e95 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 _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 +var _0xbfa1=['sequelize','exports','INTEGER'];(function(_0x16c0bd,_0x9676d2){var _0x48fd60=function(_0x2e3eb3){while(--_0x2e3eb3){_0x16c0bd['push'](_0x16c0bd['shift']());}};_0x48fd60(++_0x9676d2);}(_0xbfa1,0x1e0));var _0x1bfa=function(_0x4fade0,_0x2c4342){_0x4fade0=_0x4fade0-0x0;var _0x25ffdf=_0xbfa1[_0x4fade0];return _0x25ffdf;};'use strict';var Sequelize=require(_0x1bfa('0x0'));module[_0x1bfa('0x1')]={'WhatsappInteractionId':{'type':Sequelize[_0x1bfa('0x2')],'primaryKey':!![]},'UserId':{'type':Sequelize[_0x1bfa('0x2')],'primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.controller.js index 222fc5b..339e4b7 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 _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 +var _0xa4c4=['Content-Range','reject','save','then','get','UserProfileResource','destroy','stack','name','index','map','UserWhatsappInteraction','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','catch','show','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserWhatsappInteractions','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','desk.js','to-csv','papaparse','../../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'];(function(_0x339506,_0x403238){var _0x775d8e=function(_0x23eb78){while(--_0x23eb78){_0x339506['push'](_0x339506['shift']());}};_0x775d8e(++_0x403238);}(_0xa4c4,0xce));var _0x4a4c=function(_0x39cb5c,_0x237565){_0x39cb5c=_0x39cb5c-0x0;var _0x119d08=_0xa4c4[_0x39cb5c];return _0x119d08;};'use strict';var pdf=require(_0x4a4c('0x0'));var emlformat=require(_0x4a4c('0x1'));var rimraf=require(_0x4a4c('0x2'));var zipdir=require(_0x4a4c('0x3'));var jsonpatch=require(_0x4a4c('0x4'));var rp=require(_0x4a4c('0x5'));var moment=require(_0x4a4c('0x6'));var BPromise=require(_0x4a4c('0x7'));var Mustache=require('mustache');var util=require(_0x4a4c('0x8'));var path=require(_0x4a4c('0x9'));var sox=require(_0x4a4c('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4a4c('0xb'));var squel=require(_0x4a4c('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4a4c('0xd'));var toCsv=require(_0x4a4c('0xe'));var querystring=require('querystring');var Papa=require(_0x4a4c('0xf'));var Redis=require('ioredis');var authService=require(_0x4a4c('0x10'));var qs=require(_0x4a4c('0x11'));var as=require(_0x4a4c('0x12'));var hardwareService=require(_0x4a4c('0x13'));var logger=require(_0x4a4c('0x14'))(_0x4a4c('0x15'));var utils=require(_0x4a4c('0x16'));var config=require(_0x4a4c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x4a4c('0x18'))['db'];function respondWithStatusCode(_0x127534,_0x6913b2){_0x6913b2=_0x6913b2||0xcc;return function(_0x412160){if(_0x412160){return _0x127534[_0x4a4c('0x19')](_0x6913b2);}return _0x127534[_0x4a4c('0x1a')](_0x6913b2)[_0x4a4c('0x1b')]();};}function respondWithResult(_0x3ab340,_0x51a7df){_0x51a7df=_0x51a7df||0xc8;return function(_0x1e6871){if(_0x1e6871){return _0x3ab340[_0x4a4c('0x1a')](_0x51a7df)[_0x4a4c('0x1c')](_0x1e6871);}};}function respondWithFilteredResult(_0x1470ca,_0x115e7f){return function(_0x393897){if(_0x393897){var _0x13a81c=_0x393897[_0x4a4c('0x1d')],_0x29282c=_0x115e7f[_0x4a4c('0x1e')],_0x51576b=_0x115e7f['offset']+_0x115e7f['limit'],_0x2b06bc;if(_0x51576b>=_0x13a81c){_0x51576b=_0x13a81c;_0x2b06bc=0xc8;}else{_0x2b06bc=0xce;}_0x1470ca[_0x4a4c('0x1a')](_0x2b06bc);return _0x1470ca['set'](_0x4a4c('0x1f'),_0x29282c+'-'+_0x51576b+'/'+_0x13a81c)[_0x4a4c('0x1c')](_0x393897);}return null;};}function patchUpdates(_0x319d9d){return function(_0x43b41f){try{jsonpatch['apply'](_0x43b41f,_0x319d9d,!![]);}catch(_0x2ed403){return BPromise[_0x4a4c('0x20')](_0x2ed403);}return _0x43b41f[_0x4a4c('0x21')]();};}function saveUpdates(_0xbf2372,_0x2952b3){return function(_0x533f83){if(_0x533f83){return _0x533f83['update'](_0xbf2372)[_0x4a4c('0x22')](function(_0x279b2e){return _0x279b2e;});}return null;};}function removeEntity(_0x5072d1,_0x33491c){return function(_0x576b33){if(_0x576b33){return _0x576b33['destroy']()['then'](function(){var _0x2d5f6b=_0x576b33[_0x4a4c('0x23')]({'plain':!![]});var _0x2c7cf4='UserWhatsappInteractions';return db[_0x4a4c('0x24')][_0x4a4c('0x25')]({'where':{'type':_0x2c7cf4,'resourceId':_0x2d5f6b['id']}})['then'](function(){return _0x576b33;});})[_0x4a4c('0x22')](function(){_0x5072d1[_0x4a4c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x348489,_0x2ba833){return function(_0x51a2ef){if(!_0x51a2ef){_0x348489[_0x4a4c('0x19')](0x194);}return _0x51a2ef;};}function handleError(_0x5a1840,_0x4dc2df){_0x4dc2df=_0x4dc2df||0x1f4;return function(_0x41a6d3){logger['error'](_0x41a6d3[_0x4a4c('0x26')]);if(_0x41a6d3[_0x4a4c('0x27')]){delete _0x41a6d3[_0x4a4c('0x27')];}_0x5a1840['status'](_0x4dc2df)['send'](_0x41a6d3);};}exports[_0x4a4c('0x28')]=function(_0x4bed39,_0x56321c){var _0x2de6b3={},_0x4c56ef={},_0x3b6b54={'count':0x0,'rows':[]};var _0x3225ee=_[_0x4a4c('0x29')](db[_0x4a4c('0x2a')]['rawAttributes'],function(_0x3dddd6){return{'name':_0x3dddd6[_0x4a4c('0x2b')],'type':_0x3dddd6[_0x4a4c('0x2c')]['key']};});_0x4c56ef['model']=_[_0x4a4c('0x29')](_0x3225ee,_0x4a4c('0x27'));_0x4c56ef[_0x4a4c('0x2d')]=_['keys'](_0x4bed39['query']);_0x4c56ef[_0x4a4c('0x2e')]=_[_0x4a4c('0x2f')](_0x4c56ef[_0x4a4c('0x30')],_0x4c56ef[_0x4a4c('0x2d')]);_0x2de6b3[_0x4a4c('0x31')]=_[_0x4a4c('0x2f')](_0x4c56ef[_0x4a4c('0x30')],qs[_0x4a4c('0x32')](_0x4bed39[_0x4a4c('0x2d')]['fields']));_0x2de6b3[_0x4a4c('0x31')]=_0x2de6b3[_0x4a4c('0x31')][_0x4a4c('0x33')]?_0x2de6b3['attributes']:_0x4c56ef[_0x4a4c('0x30')];if(!_0x4bed39[_0x4a4c('0x2d')][_0x4a4c('0x34')](_0x4a4c('0x35'))){_0x2de6b3[_0x4a4c('0x36')]=qs['limit'](_0x4bed39[_0x4a4c('0x2d')]['limit']);_0x2de6b3[_0x4a4c('0x1e')]=qs[_0x4a4c('0x1e')](_0x4bed39[_0x4a4c('0x2d')]['offset']);}_0x2de6b3[_0x4a4c('0x37')]=qs[_0x4a4c('0x38')](_0x4bed39[_0x4a4c('0x2d')][_0x4a4c('0x38')]);_0x2de6b3[_0x4a4c('0x39')]=qs[_0x4a4c('0x2e')](_[_0x4a4c('0x3a')](_0x4bed39[_0x4a4c('0x2d')],_0x4c56ef[_0x4a4c('0x2e')]),_0x3225ee);if(_0x4bed39[_0x4a4c('0x2d')]['filter']){_0x2de6b3[_0x4a4c('0x39')]=_[_0x4a4c('0x3b')](_0x2de6b3[_0x4a4c('0x39')],{'$or':_[_0x4a4c('0x29')](_0x3225ee,function(_0x260fd0){if(_0x260fd0['type']!==_0x4a4c('0x3c')){var _0x43bf8f={};_0x43bf8f[_0x260fd0[_0x4a4c('0x27')]]={'$like':'%'+_0x4bed39[_0x4a4c('0x2d')][_0x4a4c('0x3d')]+'%'};return _0x43bf8f;}})});}_0x2de6b3=_[_0x4a4c('0x3b')]({},_0x2de6b3,_0x4bed39['options']);var _0x198b50={'where':_0x2de6b3[_0x4a4c('0x39')]};return db[_0x4a4c('0x2a')][_0x4a4c('0x1d')](_0x198b50)[_0x4a4c('0x22')](function(_0x27a61a){_0x3b6b54[_0x4a4c('0x1d')]=_0x27a61a;if(_0x4bed39[_0x4a4c('0x2d')][_0x4a4c('0x3e')]){_0x2de6b3['include']=[{'all':!![]}];}return db[_0x4a4c('0x2a')]['findAll'](_0x2de6b3);})[_0x4a4c('0x22')](function(_0x4006b2){_0x3b6b54[_0x4a4c('0x3f')]=_0x4006b2;return _0x3b6b54;})[_0x4a4c('0x22')](respondWithFilteredResult(_0x56321c,_0x2de6b3))[_0x4a4c('0x40')](handleError(_0x56321c,null));};exports[_0x4a4c('0x41')]=function(_0x3245e1,_0x169aef){var _0x7c834b={'raw':!![],'where':{'id':_0x3245e1[_0x4a4c('0x42')]['id']}},_0x3bde2b={};_0x3bde2b['model']=_[_0x4a4c('0x43')](db[_0x4a4c('0x2a')]['rawAttributes']);_0x3bde2b['query']=_[_0x4a4c('0x43')](_0x3245e1[_0x4a4c('0x2d')]);_0x3bde2b[_0x4a4c('0x2e')]=_[_0x4a4c('0x2f')](_0x3bde2b[_0x4a4c('0x30')],_0x3bde2b[_0x4a4c('0x2d')]);_0x7c834b['attributes']=_[_0x4a4c('0x2f')](_0x3bde2b[_0x4a4c('0x30')],qs[_0x4a4c('0x32')](_0x3245e1[_0x4a4c('0x2d')][_0x4a4c('0x32')]));_0x7c834b['attributes']=_0x7c834b['attributes'][_0x4a4c('0x33')]?_0x7c834b['attributes']:_0x3bde2b[_0x4a4c('0x30')];if(_0x3245e1[_0x4a4c('0x2d')][_0x4a4c('0x3e')]){_0x7c834b[_0x4a4c('0x44')]=[{'all':!![]}];}_0x7c834b=_[_0x4a4c('0x3b')]({},_0x7c834b,_0x3245e1['options']);return db[_0x4a4c('0x2a')][_0x4a4c('0x45')](_0x7c834b)[_0x4a4c('0x22')](handleEntityNotFound(_0x169aef,null))[_0x4a4c('0x22')](respondWithResult(_0x169aef,null))[_0x4a4c('0x40')](handleError(_0x169aef,null));};exports[_0x4a4c('0x46')]=function(_0x2669df,_0x528081){return db['UserWhatsappInteraction'][_0x4a4c('0x46')](_0x2669df[_0x4a4c('0x47')],{})[_0x4a4c('0x22')](function(_0x4a3d18){var _0x59b083=_0x2669df[_0x4a4c('0x48')][_0x4a4c('0x23')]({'plain':!![]});if(!_0x59b083)throw new Error(_0x4a4c('0x49'));if(_0x59b083[_0x4a4c('0x4a')]===_0x4a4c('0x48')){var _0x42be74=_0x4a3d18['get']({'plain':!![]});var _0x66266e=_0x4a4c('0x4b');return db['UserProfileSection'][_0x4a4c('0x45')]({'where':{'name':_0x66266e,'userProfileId':_0x59b083[_0x4a4c('0x4c')]},'raw':!![]})[_0x4a4c('0x22')](function(_0x519c97){if(_0x519c97&&_0x519c97['autoAssociation']===0x0){return db[_0x4a4c('0x24')][_0x4a4c('0x46')]({'name':_0x42be74[_0x4a4c('0x27')],'resourceId':_0x42be74['id'],'type':_0x519c97['name'],'sectionId':_0x519c97['id']},{})[_0x4a4c('0x22')](function(){return _0x4a3d18;});}else{return _0x4a3d18;}})[_0x4a4c('0x40')](function(_0x46175b){logger[_0x4a4c('0x4d')](_0x4a4c('0x4e'),_0x46175b);throw _0x46175b;});}return _0x4a3d18;})[_0x4a4c('0x22')](respondWithResult(_0x528081,0xc9))[_0x4a4c('0x40')](handleError(_0x528081,null));};exports['update']=function(_0x7d6213,_0x39ff6a){if(_0x7d6213[_0x4a4c('0x47')]['id']){delete _0x7d6213[_0x4a4c('0x47')]['id'];}return db[_0x4a4c('0x2a')][_0x4a4c('0x45')]({'where':{'id':_0x7d6213[_0x4a4c('0x42')]['id']}})['then'](handleEntityNotFound(_0x39ff6a,null))['then'](saveUpdates(_0x7d6213[_0x4a4c('0x47')],null))[_0x4a4c('0x22')](respondWithResult(_0x39ff6a,null))['catch'](handleError(_0x39ff6a,null));};exports[_0x4a4c('0x25')]=function(_0x4c7518,_0x334852){return db[_0x4a4c('0x2a')]['find']({'where':{'id':_0x4c7518[_0x4a4c('0x42')]['id']}})[_0x4a4c('0x22')](handleEntityNotFound(_0x334852,null))[_0x4a4c('0x22')](removeEntity(_0x334852,null))['catch'](handleError(_0x334852,null));}; \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js b/server/api/UserWhatsappInteraction/UserWhatsappInteraction.model.js index c7d5726..7b4f26a 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 _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 +var _0x0b6b=['define','UserWhatsappInteraction','user_has_whatsapp_interactions','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./UserWhatsappInteraction.attributes','exports'];(function(_0xb25c53,_0x4ac6b6){var _0x4bd9ef=function(_0x2d300d){while(--_0x2d300d){_0xb25c53['push'](_0xb25c53['shift']());}};_0x4bd9ef(++_0x4ac6b6);}(_0x0b6b,0x16b));var _0xb0b6=function(_0xce6f11,_0x3c3137){_0xce6f11=_0xce6f11-0x0;var _0x35b709=_0x0b6b[_0xce6f11];return _0x35b709;};'use strict';var _=require(_0xb0b6('0x0'));var util=require(_0xb0b6('0x1'));var logger=require('../../config/logger')(_0xb0b6('0x2'));var moment=require(_0xb0b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0b6('0x5'));var config=require(_0xb0b6('0x6'));var attributes=require(_0xb0b6('0x7'));module[_0xb0b6('0x8')]=function(_0x45eeee,_0x52db31){return _0x45eeee[_0xb0b6('0x9')](_0xb0b6('0xa'),attributes,{'tableName':_0xb0b6('0xb'),'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 d3e504c..3da2afb 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 _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 +var _0xb149=['UserWhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x188709,_0x8fa239){var _0x34a750=function(_0x553da8){while(--_0x553da8){_0x188709['push'](_0x188709['shift']());}};_0x34a750(++_0x8fa239);}(_0xb149,0x160));var _0x9b14=function(_0x400096,_0x101dc3){_0x400096=_0x400096-0x0;var _0x31755a=_0xb149[_0x400096];return _0x31755a;};'use strict';var _=require(_0x9b14('0x0'));var util=require(_0x9b14('0x1'));var moment=require(_0x9b14('0x2'));var BPromise=require(_0x9b14('0x3'));var rs=require(_0x9b14('0x4'));var fs=require('fs');var Redis=require(_0x9b14('0x5'));var db=require(_0x9b14('0x6'))['db'];var utils=require(_0x9b14('0x7'));var logger=require(_0x9b14('0x8'))(_0x9b14('0x9'));var config=require(_0x9b14('0xa'));var jayson=require(_0x9b14('0xb'));var client=jayson[_0x9b14('0xc')][_0x9b14('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3213d4,_0x5bc178,_0x49b455){return new BPromise(function(_0x40d7a9,_0x28ce2a){return client[_0x9b14('0xe')](_0x3213d4,_0x49b455)['then'](function(_0x3dea57){logger[_0x9b14('0xf')](_0x9b14('0x10'),_0x5bc178,_0x9b14('0x11'));logger[_0x9b14('0x12')]('UserWhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x5bc178,'request\x20sent',JSON['stringify'](_0x3dea57));if(_0x3dea57[_0x9b14('0x13')]){if(_0x3dea57[_0x9b14('0x13')]['code']===0x1f4){logger[_0x9b14('0x13')](_0x9b14('0x10'),_0x5bc178,_0x3dea57[_0x9b14('0x13')]['message']);return _0x28ce2a(_0x3dea57['error']['message']);}logger[_0x9b14('0x13')](_0x9b14('0x10'),_0x5bc178,_0x3dea57[_0x9b14('0x13')][_0x9b14('0x14')]);return _0x40d7a9(_0x3dea57[_0x9b14('0x13')][_0x9b14('0x14')]);}else{logger[_0x9b14('0xf')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x5bc178,'request\x20sent');_0x40d7a9(_0x3dea57[_0x9b14('0x15')][_0x9b14('0x14')]);}})[_0x9b14('0x16')](function(_0x4871de){logger[_0x9b14('0x13')]('UserWhatsappInteraction,\x20%s,\x20%s',_0x5bc178,_0x4871de);_0x28ce2a(_0x4871de);});});} \ No newline at end of file diff --git a/server/api/UserWhatsappInteraction/index.js b/server/api/UserWhatsappInteraction/index.js index fee27a7..a125c82 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 _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 +var _0x6a55=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./UserWhatsappInteraction.controller','get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','multer','path'];(function(_0x3800d3,_0x428dfd){var _0x491c71=function(_0x55a174){while(--_0x55a174){_0x3800d3['push'](_0x3800d3['shift']());}};_0x491c71(++_0x428dfd);}(_0x6a55,0x154));var _0x56a5=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0x6a55[_0x193ddf];return _0x5bc6df;};'use strict';var multer=require(_0x56a5('0x0'));var util=require('util');var path=require(_0x56a5('0x1'));var timeout=require(_0x56a5('0x2'));var express=require('express');var router=express[_0x56a5('0x3')]();var auth=require(_0x56a5('0x4'));var interaction=require(_0x56a5('0x5'));var config=require(_0x56a5('0x6'));var controller=require(_0x56a5('0x7'));router[_0x56a5('0x8')]('/',auth[_0x56a5('0x9')](),controller[_0x56a5('0xa')]);router[_0x56a5('0x8')](_0x56a5('0xb'),auth[_0x56a5('0x9')](),controller[_0x56a5('0xc')]);router[_0x56a5('0xd')]('/',auth[_0x56a5('0x9')](),controller['create']);router[_0x56a5('0xe')](_0x56a5('0xb'),auth['isAuthenticated'](),controller[_0x56a5('0xf')]);router['delete']('/:id',auth[_0x56a5('0x9')](),controller[_0x56a5('0x10')]);module[_0x56a5('0x11')]=router; \ No newline at end of file diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index cf323ca..f0882b9 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 _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 +var _0xc23e=['integration','motionbar','jscripty','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','action','STRING','contactManager'];(function(_0x2074fb,_0x26707f){var _0x4c71d3=function(_0x4d32ef){while(--_0x4d32ef){_0x2074fb['push'](_0x2074fb['shift']());}};_0x4c71d3(++_0x26707f);}(_0xc23e,0x190));var _0xec23=function(_0x532b2f,_0x1b8af3){_0x532b2f=_0x532b2f-0x0;var _0x124eda=_0xc23e[_0x532b2f];return _0x124eda;};'use strict';var Sequelize=require(_0xec23('0x0'));module[_0xec23('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x18394d){return this['getDataValue'](_0xec23('0x2'));}},'action':{'type':Sequelize[_0xec23('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0xec23('0x4'),_0xec23('0x5'),_0xec23('0x6'),_0xec23('0x7'),'urlForward',_0xec23('0x8'),'bot',_0xec23('0x9')]],'msg':_0xec23('0xa')}},'comment':_0xec23('0xa')},'data1':{'type':Sequelize[_0xec23('0x3')](0x1000),'comment':_0xec23('0xb')},'data2':{'type':Sequelize[_0xec23('0x3')](0x1000),'comment':_0xec23('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xec23('0xd')},'data4':{'type':Sequelize[_0xec23('0x3')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xec23('0x3')]},'data7':{'type':Sequelize[_0xec23('0xe')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 3f2c062..7e99f69 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 _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 +var _0x11e5=['name','send','body','find','params','catch','Action','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','stack'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x11e5,0x8b));var _0x511e=function(_0x3c3128,_0x117d7d){_0x3c3128=_0x3c3128-0x0;var _0x26b55e=_0x11e5[_0x3c3128];return _0x26b55e;};'use strict';var pdf=require(_0x511e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x511e('0x1'));var zipdir=require(_0x511e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x511e('0x3'));var moment=require(_0x511e('0x4'));var BPromise=require(_0x511e('0x5'));var Mustache=require('mustache');var util=require(_0x511e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x511e('0x7'));var ejs=require(_0x511e('0x8'));var fs=require('fs');var _=require(_0x511e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x511e('0xa'));var deskjs=require(_0x511e('0xb'));var toCsv=require(_0x511e('0x7'));var querystring=require(_0x511e('0xc'));var Papa=require(_0x511e('0xd'));var Redis=require(_0x511e('0xe'));var authService=require(_0x511e('0xf'));var qs=require(_0x511e('0x10'));var as=require(_0x511e('0x11'));var hardwareService=require(_0x511e('0x12'));var logger=require(_0x511e('0x13'))('api');var utils=require(_0x511e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x511e('0x15'))['db'];function respondWithStatusCode(_0x327880,_0x42679e){_0x42679e=_0x42679e||0xcc;return function(_0x258e2f){if(_0x258e2f){return _0x327880[_0x511e('0x16')](_0x42679e);}return _0x327880[_0x511e('0x17')](_0x42679e)['end']();};}function respondWithResult(_0xdd0dcd,_0x33fd64){_0x33fd64=_0x33fd64||0xc8;return function(_0x4e6507){if(_0x4e6507){return _0xdd0dcd[_0x511e('0x17')](_0x33fd64)[_0x511e('0x18')](_0x4e6507);}};}function respondWithFilteredResult(_0x4f50b9,_0xed773e){return function(_0x162c91){if(_0x162c91){var _0x3b990b=_0x162c91[_0x511e('0x19')],_0x17fd4a=_0xed773e[_0x511e('0x1a')],_0x5b6cd6=_0xed773e['offset']+_0xed773e[_0x511e('0x1b')],_0x3e0415;if(_0x5b6cd6>=_0x3b990b){_0x5b6cd6=_0x3b990b;_0x3e0415=0xc8;}else{_0x3e0415=0xce;}_0x4f50b9['status'](_0x3e0415);return _0x4f50b9[_0x511e('0x1c')]('Content-Range',_0x17fd4a+'-'+_0x5b6cd6+'/'+_0x3b990b)['json'](_0x162c91);}return null;};}function patchUpdates(_0x37ae92){return function(_0x5c4fb9){try{jsonpatch[_0x511e('0x1d')](_0x5c4fb9,_0x37ae92,!![]);}catch(_0x325278){return BPromise[_0x511e('0x1e')](_0x325278);}return _0x5c4fb9[_0x511e('0x1f')]();};}function saveUpdates(_0xd4df6f,_0x3d3f46){return function(_0x3723ff){if(_0x3723ff){return _0x3723ff[_0x511e('0x20')](_0xd4df6f)['then'](function(_0x1e2b41){return _0x1e2b41;});}return null;};}function removeEntity(_0x39e0b4,_0x2ebf30){return function(_0x1a273b){if(_0x1a273b){return _0x1a273b[_0x511e('0x21')]()[_0x511e('0x22')](function(){_0x39e0b4[_0x511e('0x17')](0xcc)[_0x511e('0x23')]();});}};}function handleEntityNotFound(_0x211b90,_0x26618d){return function(_0x4c35e2){if(!_0x4c35e2){_0x211b90['sendStatus'](0x194);}return _0x4c35e2;};}function handleError(_0x3e1711,_0x4d94a1){_0x4d94a1=_0x4d94a1||0x1f4;return function(_0x1ff5c4){logger['error'](_0x1ff5c4[_0x511e('0x24')]);if(_0x1ff5c4[_0x511e('0x25')]){delete _0x1ff5c4[_0x511e('0x25')];}_0x3e1711[_0x511e('0x17')](_0x4d94a1)[_0x511e('0x26')](_0x1ff5c4);};}exports[_0x511e('0x20')]=function(_0x3c057c,_0x4d89a5){if(_0x3c057c[_0x511e('0x27')]['id']){delete _0x3c057c[_0x511e('0x27')]['id'];}return db['Action'][_0x511e('0x28')]({'where':{'id':_0x3c057c[_0x511e('0x29')]['id']}})[_0x511e('0x22')](handleEntityNotFound(_0x4d89a5,null))[_0x511e('0x22')](saveUpdates(_0x3c057c[_0x511e('0x27')],null))['then'](respondWithResult(_0x4d89a5,null))[_0x511e('0x2a')](handleError(_0x4d89a5,null));};exports['destroy']=function(_0x4f6844,_0x262dde){return db[_0x511e('0x2b')][_0x511e('0x28')]({'where':{'id':_0x4f6844[_0x511e('0x29')]['id']}})[_0x511e('0x22')](handleEntityNotFound(_0x262dde,null))['then'](removeEntity(_0x262dde,null))[_0x511e('0x2a')](handleError(_0x262dde,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1e2b921..f7f8296 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 _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 +var _0x6d1d=['lodash','util','moment','bluebird','path','rimraf','../../config/environment','Action'];(function(_0x584120,_0x4cf8df){var _0x3bf7f5=function(_0x2fe61e){while(--_0x2fe61e){_0x584120['push'](_0x584120['shift']());}};_0x3bf7f5(++_0x4cf8df);}(_0x6d1d,0x178));var _0xd6d1=function(_0x483c41,_0xcd46c9){_0x483c41=_0x483c41-0x0;var _0x38986d=_0x6d1d[_0x483c41];return _0x38986d;};'use strict';var _=require(_0xd6d1('0x0'));var util=require(_0xd6d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd6d1('0x2'));var BPromise=require(_0xd6d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6d1('0x4'));var rimraf=require(_0xd6d1('0x5'));var config=require(_0xd6d1('0x6'));var attributes=require('./action.attributes');module['exports']=function(_0x16ce8f,_0x156abd){return _0x16ce8f['define'](_0xd6d1('0x7'),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 1a228b0..9e859ee 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 _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 +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3e950f,_0x1cfb08){var _0x235117=function(_0xfd8228){while(--_0xfd8228){_0x3e950f['push'](_0x3e950f['shift']());}};_0x235117(++_0x1cfb08);}(_0x70e0,0x17b));var _0x070e=function(_0x44b060,_0x1f9fda){_0x44b060=_0x44b060-0x0;var _0x2342a4=_0x70e0[_0x44b060];return _0x2342a4;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 6b53afb..5791f56 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 _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 +var _0xbe83=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports'];(function(_0x787f75,_0x4574d1){var _0x3c9e47=function(_0x60baf2){while(--_0x60baf2){_0x787f75['push'](_0x787f75['shift']());}};_0x3c9e47(++_0x4574d1);}(_0xbe83,0x70));var _0x3be8=function(_0x54cb85,_0x26ea45){_0x54cb85=_0x54cb85-0x0;var _0x5b440a=_0xbe83[_0x54cb85];return _0x5b440a;};'use strict';var multer=require(_0x3be8('0x0'));var util=require(_0x3be8('0x1'));var path=require('path');var timeout=require(_0x3be8('0x2'));var express=require(_0x3be8('0x3'));var router=express[_0x3be8('0x4')]();var auth=require(_0x3be8('0x5'));var interaction=require(_0x3be8('0x6'));var config=require(_0x3be8('0x7'));var controller=require(_0x3be8('0x8'));router[_0x3be8('0x9')](_0x3be8('0xa'),auth[_0x3be8('0xb')](),controller[_0x3be8('0xc')]);router[_0x3be8('0xd')](_0x3be8('0xa'),auth[_0x3be8('0xb')](),controller[_0x3be8('0xe')]);module[_0x3be8('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index bc0b437..e9652a8 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 _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 +var _0xc6cd=['STRING','TEXT','exports'];(function(_0x41cc38,_0xe74996){var _0x41f3fa=function(_0x579a3f){while(--_0x579a3f){_0x41cc38['push'](_0x41cc38['shift']());}};_0x41f3fa(++_0xe74996);}(_0xc6cd,0x1eb));var _0xdc6c=function(_0x3b1c34,_0x4bbdf9){_0x3b1c34=_0x3b1c34-0x0;var _0x368bd1=_0xc6cd[_0x3b1c34];return _0x368bd1;};'use strict';var Sequelize=require('sequelize');module[_0xdc6c('0x0')]={'name':{'type':Sequelize[_0xdc6c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdc6c('0x1')]},'parent':{'type':Sequelize[_0xdc6c('0x1')]},'table':{'type':Sequelize[_0xdc6c('0x1')]},'conditions':{'type':Sequelize[_0xdc6c('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 0e73ba7..6fbba36 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 _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 +var _0xbc6b=['MetricId','metric','function','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','condition','replace','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','MIN(%s)','DATE(%s)','DESC','Limited\x20Query:','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','count','offset','limit','status','set','Content-Range','save','destroy','CustomReports','UserProfileResource','then','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table'];(function(_0x400757,_0x24696f){var _0x4e4135=function(_0x1afb31){while(--_0x1afb31){_0x400757['push'](_0x400757['shift']());}};_0x4e4135(++_0x24696f);}(_0xbc6b,0xd4));var _0xbbc6=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0xbc6b[_0x5c2c7c];return _0xea7ffe;};'use strict';var pdf=require(_0xbbc6('0x0'));var emlformat=require(_0xbbc6('0x1'));var rimraf=require(_0xbbc6('0x2'));var zipdir=require(_0xbbc6('0x3'));var jsonpatch=require(_0xbbc6('0x4'));var rp=require(_0xbbc6('0x5'));var moment=require(_0xbbc6('0x6'));var BPromise=require(_0xbbc6('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xbbc6('0x8'));var csv=require(_0xbbc6('0x9'));var ejs=require(_0xbbc6('0xa'));var fs=require('fs');var _=require(_0xbbc6('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbbc6('0xc'));var toCsv=require(_0xbbc6('0x9'));var querystring=require(_0xbbc6('0xd'));var Papa=require(_0xbbc6('0xe'));var Redis=require(_0xbbc6('0xf'));var authService=require(_0xbbc6('0x10'));var qs=require(_0xbbc6('0x11'));var as=require(_0xbbc6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbc6('0x13'))(_0xbbc6('0x14'));var utils=require('../../config/utils');var config=require(_0xbbc6('0x15'));var licenseUtil=require(_0xbbc6('0x16'));var db=require(_0xbbc6('0x17'))['db'];var dbH=require(_0xbbc6('0x17'))[_0xbbc6('0x18')];function respondWithStatusCode(_0x4edaaf,_0x29d08c){_0x29d08c=_0x29d08c||0xcc;return function(_0x3b7d33){if(_0x3b7d33){return _0x4edaaf[_0xbbc6('0x19')](_0x29d08c);}return _0x4edaaf['status'](_0x29d08c)[_0xbbc6('0x1a')]();};}function respondWithResult(_0x2cc973,_0xbb8065){_0xbb8065=_0xbb8065||0xc8;return function(_0x2871be){if(_0x2871be){return _0x2cc973['status'](_0xbb8065)['json'](_0x2871be);}};}function respondWithFilteredResult(_0xd150,_0x2e4db8){return function(_0x12060e){if(_0x12060e){var _0x41fa77=_0x12060e[_0xbbc6('0x1b')],_0x577557=_0x2e4db8[_0xbbc6('0x1c')],_0xcaca95=_0x2e4db8[_0xbbc6('0x1c')]+_0x2e4db8[_0xbbc6('0x1d')],_0x54972f;if(_0xcaca95>=_0x41fa77){_0xcaca95=_0x41fa77;_0x54972f=0xc8;}else{_0x54972f=0xce;}_0xd150[_0xbbc6('0x1e')](_0x54972f);return _0xd150[_0xbbc6('0x1f')](_0xbbc6('0x20'),_0x577557+'-'+_0xcaca95+'/'+_0x41fa77)['json'](_0x12060e);}return null;};}function patchUpdates(_0x550eef){return function(_0xc6cf5a){try{jsonpatch['apply'](_0xc6cf5a,_0x550eef,!![]);}catch(_0x3080bf){return BPromise['reject'](_0x3080bf);}return _0xc6cf5a[_0xbbc6('0x21')]();};}function saveUpdates(_0x3c5b2d,_0x497c4c){return function(_0xc20812){if(_0xc20812){return _0xc20812['update'](_0x3c5b2d)['then'](function(_0x106ebc){return _0x106ebc;});}return null;};}function removeEntity(_0x1875ba,_0x2c5949){return function(_0x498be5){if(_0x498be5){return _0x498be5[_0xbbc6('0x22')]()['then'](function(){var _0x44f3ab=_0x498be5['get']({'plain':!![]});var _0x15fe9c=_0xbbc6('0x23');return db[_0xbbc6('0x24')][_0xbbc6('0x22')]({'where':{'type':_0x15fe9c,'resourceId':_0x44f3ab['id']}})[_0xbbc6('0x25')](function(){return _0x498be5;});})['then'](function(){_0x1875ba[_0xbbc6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20d1c0,_0x929aea){return function(_0x2ac894){if(!_0x2ac894){_0x20d1c0[_0xbbc6('0x19')](0x194);}return _0x2ac894;};}function handleError(_0x872d5e,_0x8cc7cf){_0x8cc7cf=_0x8cc7cf||0x1f4;return function(_0x1ee457){logger['error'](_0x1ee457['stack']);if(_0x1ee457['name']){delete _0x1ee457[_0xbbc6('0x26')];}_0x872d5e[_0xbbc6('0x1e')](_0x8cc7cf)[_0xbbc6('0x27')](_0x1ee457);};}exports['index']=function(_0x8abe94,_0x1a6651){var _0x3c2d67={},_0x31fb5b={},_0x2acdde={'count':0x0,'rows':[]};var _0x56cf81=_[_0xbbc6('0x28')](db[_0xbbc6('0x29')][_0xbbc6('0x2a')],function(_0x5b7d1b){return{'name':_0x5b7d1b[_0xbbc6('0x2b')],'type':_0x5b7d1b['type'][_0xbbc6('0x2c')]};});_0x31fb5b[_0xbbc6('0x2d')]=_[_0xbbc6('0x28')](_0x56cf81,_0xbbc6('0x26'));_0x31fb5b[_0xbbc6('0x2e')]=_[_0xbbc6('0x2f')](_0x8abe94['query']);_0x31fb5b[_0xbbc6('0x30')]=_[_0xbbc6('0x31')](_0x31fb5b['model'],_0x31fb5b[_0xbbc6('0x2e')]);_0x3c2d67[_0xbbc6('0x32')]=_[_0xbbc6('0x31')](_0x31fb5b[_0xbbc6('0x2d')],qs[_0xbbc6('0x33')](_0x8abe94[_0xbbc6('0x2e')][_0xbbc6('0x33')]));_0x3c2d67['attributes']=_0x3c2d67[_0xbbc6('0x32')][_0xbbc6('0x34')]?_0x3c2d67[_0xbbc6('0x32')]:_0x31fb5b['model'];if(!_0x8abe94[_0xbbc6('0x2e')][_0xbbc6('0x35')](_0xbbc6('0x36'))){_0x3c2d67['limit']=qs['limit'](_0x8abe94[_0xbbc6('0x2e')]['limit']);_0x3c2d67[_0xbbc6('0x1c')]=qs[_0xbbc6('0x1c')](_0x8abe94[_0xbbc6('0x2e')][_0xbbc6('0x1c')]);}_0x3c2d67[_0xbbc6('0x37')]=qs[_0xbbc6('0x38')](_0x8abe94[_0xbbc6('0x2e')][_0xbbc6('0x38')]);_0x3c2d67[_0xbbc6('0x39')]=qs[_0xbbc6('0x30')](_[_0xbbc6('0x3a')](_0x8abe94[_0xbbc6('0x2e')],_0x31fb5b[_0xbbc6('0x30')]),_0x56cf81);if(_0x8abe94[_0xbbc6('0x2e')][_0xbbc6('0x3b')]){_0x3c2d67[_0xbbc6('0x39')]=_[_0xbbc6('0x3c')](_0x3c2d67[_0xbbc6('0x39')],{'$or':_[_0xbbc6('0x28')](_0x56cf81,function(_0x523a23){if(_0x523a23[_0xbbc6('0x3d')]!=='VIRTUAL'){var _0x355244={};_0x355244[_0x523a23['name']]={'$like':'%'+_0x8abe94[_0xbbc6('0x2e')][_0xbbc6('0x3b')]+'%'};return _0x355244;}})});}_0x3c2d67=_['merge']({},_0x3c2d67,_0x8abe94[_0xbbc6('0x3e')]);var _0x495b9a={'where':_0x3c2d67[_0xbbc6('0x39')]};return db[_0xbbc6('0x29')][_0xbbc6('0x1b')](_0x495b9a)['then'](function(_0x5e41f9){_0x2acdde[_0xbbc6('0x1b')]=_0x5e41f9;if(_0x8abe94[_0xbbc6('0x2e')]['includeAll']){_0x3c2d67[_0xbbc6('0x3f')]=[{'all':!![]}];}return db[_0xbbc6('0x29')]['findAll'](_0x3c2d67);})[_0xbbc6('0x25')](function(_0x2ae1d5){_0x2acdde[_0xbbc6('0x40')]=_0x2ae1d5;return _0x2acdde;})['then'](respondWithFilteredResult(_0x1a6651,_0x3c2d67))[_0xbbc6('0x41')](handleError(_0x1a6651,null));};exports[_0xbbc6('0x42')]=function(_0x472d66,_0x4e98e9){var _0x54d109={'raw':![],'where':{'id':_0x472d66[_0xbbc6('0x43')]['id']}},_0x34414b={};_0x34414b[_0xbbc6('0x2d')]=_[_0xbbc6('0x2f')](db[_0xbbc6('0x29')][_0xbbc6('0x2a')]);_0x34414b['query']=_[_0xbbc6('0x2f')](_0x472d66[_0xbbc6('0x2e')]);_0x34414b[_0xbbc6('0x30')]=_[_0xbbc6('0x31')](_0x34414b[_0xbbc6('0x2d')],_0x34414b['query']);_0x54d109[_0xbbc6('0x32')]=_[_0xbbc6('0x31')](_0x34414b[_0xbbc6('0x2d')],qs[_0xbbc6('0x33')](_0x472d66[_0xbbc6('0x2e')][_0xbbc6('0x33')]));_0x54d109[_0xbbc6('0x32')]=_0x54d109[_0xbbc6('0x32')][_0xbbc6('0x34')]?_0x54d109[_0xbbc6('0x32')]:_0x34414b['model'];if(_0x472d66[_0xbbc6('0x2e')]['includeAll']){_0x54d109[_0xbbc6('0x3f')]=[{'all':!![]}];}_0x54d109=_['merge']({},_0x54d109,_0x472d66[_0xbbc6('0x3e')]);return db['AnalyticCustomReport'][_0xbbc6('0x44')](_0x54d109)[_0xbbc6('0x25')](handleEntityNotFound(_0x4e98e9,null))[_0xbbc6('0x25')](respondWithResult(_0x4e98e9,null))[_0xbbc6('0x41')](handleError(_0x4e98e9,null));};exports['create']=function(_0x176f02,_0x5d2ca1){return db[_0xbbc6('0x29')][_0xbbc6('0x45')](_0x176f02['body'],{})[_0xbbc6('0x25')](function(_0x336629){var _0x3fa1f5=_0x176f02[_0xbbc6('0x46')][_0xbbc6('0x47')]({'plain':!![]});if(!_0x3fa1f5)throw new Error(_0xbbc6('0x48'));if(_0x3fa1f5[_0xbbc6('0x49')]==='user'){var _0x59fa2c=_0x336629['get']({'plain':!![]});var _0x3a1ffb=_0xbbc6('0x4a');return db[_0xbbc6('0x4b')][_0xbbc6('0x44')]({'where':{'name':_0x3a1ffb,'userProfileId':_0x3fa1f5[_0xbbc6('0x4c')]},'raw':!![]})[_0xbbc6('0x25')](function(_0x69bc92){if(_0x69bc92&&_0x69bc92[_0xbbc6('0x4d')]===0x0){return db['UserProfileResource'][_0xbbc6('0x45')]({'name':_0x59fa2c[_0xbbc6('0x26')],'resourceId':_0x59fa2c['id'],'type':_0xbbc6('0x23'),'sectionId':_0x69bc92['id']},{})['then'](function(){return _0x336629;});}else{return _0x336629;}})[_0xbbc6('0x41')](function(_0x11410b){logger['error'](_0xbbc6('0x4e'),_0x11410b);throw _0x11410b;});}return _0x336629;})[_0xbbc6('0x25')](respondWithResult(_0x5d2ca1,0xc9))['catch'](handleError(_0x5d2ca1,null));};exports[_0xbbc6('0x4f')]=function(_0x4357ce,_0x58b566){if(_0x4357ce[_0xbbc6('0x50')]['id']){delete _0x4357ce[_0xbbc6('0x50')]['id'];}return db['AnalyticCustomReport'][_0xbbc6('0x44')]({'where':{'id':_0x4357ce['params']['id']}})['then'](handleEntityNotFound(_0x58b566,null))[_0xbbc6('0x25')](saveUpdates(_0x4357ce[_0xbbc6('0x50')],null))[_0xbbc6('0x25')](respondWithResult(_0x58b566,null))[_0xbbc6('0x41')](handleError(_0x58b566,null));};exports[_0xbbc6('0x22')]=function(_0x44f69a,_0xac1b06){return db[_0xbbc6('0x29')]['find']({'where':{'id':_0x44f69a[_0xbbc6('0x43')]['id']}})['then'](handleEntityNotFound(_0xac1b06,null))[_0xbbc6('0x25')](removeEntity(_0xac1b06,null))[_0xbbc6('0x41')](handleError(_0xac1b06,null));};exports[_0xbbc6('0x51')]=function(_0x266fb7,_0xf759c6){var _0xeb665d=0xa;var _0xd9d6da=[_0xbbc6('0x52'),_0xbbc6('0x53'),_0xbbc6('0x54'),_0xbbc6('0x55')];var _0x42443c={'SUM':_0xbbc6('0x56'),'COUNT':_0xbbc6('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xbbc6('0x58'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xbbc6('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbbc6('0x5a')};var _0x580f0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xbbc6('0x5b'),'ROUND':_0xbbc6('0x5c'),'UNIX_TIMESTAMP':_0xbbc6('0x5d')};var _0x351d91=function(_0x148fb1){return!_[_0xbbc6('0x5e')]([_0xbbc6('0x5f'),_0xbbc6('0x60'),_0xbbc6('0x61'),_0xbbc6('0x62')],_0x148fb1);};var _0x1eed8d=function(_0x3135fb){if(!_0x3135fb||!_0x3135fb[_0xbbc6('0x63')]['length']){return'';}for(var _0x45d0a2='(',_0x23a809=0x0;_0x23a809<_0x3135fb['rules'][_0xbbc6('0x34')];_0x23a809+=0x1){_0x23a809>0x0&&(_0x45d0a2+='\x20'+_0x3135fb[_0xbbc6('0x64')]+'\x20');_0x45d0a2+=_0x3135fb[_0xbbc6('0x63')][_0x23a809][_0xbbc6('0x65')]?_0x1eed8d(_0x3135fb[_0xbbc6('0x63')][_0x23a809][_0xbbc6('0x65')]):_0x3135fb[_0xbbc6('0x63')][_0x23a809][_0xbbc6('0x66')]+'\x20'+_0x3135fb[_0xbbc6('0x63')][_0x23a809]['condition']+(_0x351d91(_0x3135fb['rules'][_0x23a809]['condition'])?'\x20'+_0x3135fb[_0xbbc6('0x63')][_0x23a809][_0xbbc6('0x67')]:'');}return _0x45d0a2+')';};var _0x48e1bd={'where':{'id':_0x266fb7[_0xbbc6('0x43')]['id']}},_0x24cd4a,_0x344248,_0x306af9,_0x53c2d8,_0x5e645c;_0x48e1bd=_[_0xbbc6('0x3c')]({},_0x48e1bd,_0x266fb7[_0xbbc6('0x3e')]);return db[_0xbbc6('0x29')]['find'](_0x48e1bd)['then'](function(_0xfc11ad){if(_0xfc11ad){_0x24cd4a=_0xfc11ad;return _0xfc11ad[_0xbbc6('0x68')]();}return null;})[_0xbbc6('0x25')](function(_0xa15a7f){if(_0xa15a7f){if(!_0xa15a7f[_0xbbc6('0x34')]){throw new db[(_0xbbc6('0x69'))][(_0xbbc6('0x6a'))](_0xbbc6('0x6b'),0x193);}_0x344248=_0xa15a7f;return db[_0xbbc6('0x6c')][_0xbbc6('0x6d')]({'raw':!![]});}return null;})[_0xbbc6('0x25')](function(_0x18ed95){if(_0x18ed95){_0x306af9=_[_0xbbc6('0x6e')](_0x18ed95,'id');var _0x487583;var _0x228e7f=squel[_0xbbc6('0x6f')]();_0x228e7f[_0xbbc6('0x70')](_0x24cd4a[_0xbbc6('0x71')]);for(var _0xf1498d=0x0;_0xf1498d<_0x344248[_0xbbc6('0x34')];_0xf1498d+=0x1){_0x487583=_0x344248[_0xf1498d][_0xbbc6('0x72')]?_0x306af9[_0x344248[_0xf1498d][_0xbbc6('0x72')]][_0xbbc6('0x73')]:_0x344248[_0xf1498d][_0xbbc6('0x66')];_0x487583=_0x344248[_0xf1498d][_0xbbc6('0x74')]?_['replace'](_0x42443c[_0x344248[_0xf1498d][_0xbbc6('0x74')]],'%s',_0x487583):_0x487583;_0x487583=_0x344248[_0xf1498d][_0xbbc6('0x75')]?_['replace'](_0x580f0c[_0x344248[_0xf1498d][_0xbbc6('0x75')]],'%s',_0x487583):_0x487583;if(_0x344248[_0xf1498d][_0xbbc6('0x76')]){_0x228e7f[_0xbbc6('0x65')](_0x487583);}_0x344248[_0xf1498d][_0xbbc6('0x77')]&&_0x228e7f[_0xbbc6('0x37')](_0x487583,_0x344248[_0xf1498d]['orderBy']==='DESC'?![]:!![]);_0x228e7f['field'](_0x487583,_0x344248[_0xf1498d][_0xbbc6('0x78')]||_0x487583);}if(_0x24cd4a[_0xbbc6('0x79')]){_0x24cd4a[_0xbbc6('0x79')]=JSON[_0xbbc6('0x7a')](_0x24cd4a[_0xbbc6('0x79')]);for(var _0x5c9368=0x0;_0x5c9368<_0x24cd4a['joins'][_0xbbc6('0x34')];_0x5c9368+=0x1){if(_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x3d')]&&_['includes'](_0xd9d6da,_0x24cd4a[_0xbbc6('0x79')][_0x5c9368]['type'])&&_0x24cd4a['joins'][_0x5c9368]['parentKey']&&_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x7b')]&&_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x7c')]){_0x228e7f[_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x3d')]](_0x24cd4a['joins'][_0x5c9368]['foreignTable'],null,util[_0xbbc6('0x75')](_0xbbc6('0x7d'),_0x24cd4a[_0xbbc6('0x71')],_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x7e')],_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x7b')],_0x24cd4a[_0xbbc6('0x79')][_0x5c9368][_0xbbc6('0x7c')]));}}}if(_0x24cd4a[_0xbbc6('0x7f')]){_0x24cd4a[_0xbbc6('0x7f')]=JSON[_0xbbc6('0x7a')](_0x24cd4a[_0xbbc6('0x7f')]);_0x228e7f[_0xbbc6('0x39')](_0x1eed8d(_0x24cd4a[_0xbbc6('0x7f')][_0xbbc6('0x65')]));}_0x5e645c=_0x228e7f['clone']();_0x228e7f[_0xbbc6('0x1d')](_0xeb665d);_0x228e7f[_0xbbc6('0x1c')](0x0);logger[_0xbbc6('0x80')]('Limited\x20Query:',_0x228e7f[_0xbbc6('0x81')]());return dbH[_0xbbc6('0x82')][_0xbbc6('0x2e')](_0x228e7f[_0xbbc6('0x81')](),{'type':dbH['sequelize'][_0xbbc6('0x83')][_0xbbc6('0x84')]});}})[_0xbbc6('0x25')](respondWithResult(_0xf759c6,null))['catch'](handleError(_0xf759c6,null));};function runReport(_0x5be79e,_0x5a2c66,_0x5da900){var _0x4c7b6b=_0x5a2c66['name'];var _0x1f4ed3=0xa;var _0xd7d1a1=['join',_0xbbc6('0x53'),_0xbbc6('0x54'),_0xbbc6('0x55')];var _0x2b855c={'SUM':_0xbbc6('0x56'),'COUNT':_0xbbc6('0x57'),'COUNT DISTINCT':_0xbbc6('0x85'),'MAX':_0xbbc6('0x58'),'MIN':'MIN(%s)','AVG':_0xbbc6('0x86'),'GROUP_CONCAT':_0xbbc6('0x59'),'GROUP_CONCAT ASC':_0xbbc6('0x87'),'GROUP_CONCAT DESC':_0xbbc6('0x5a')};var _0x5ea5e1={'SEC_TO_TIME':_0xbbc6('0x88'),'DATE':'DATE(%s)','HOUR':_0xbbc6('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbbc6('0x5d')};var _0xd5ab8c=function(_0x44a783){return!_[_0xbbc6('0x5e')]([_0xbbc6('0x5f'),_0xbbc6('0x60'),_0xbbc6('0x61'),_0xbbc6('0x62')],_0x44a783);};var _0x37eb95=function(_0xd5cae){if(!_0xd5cae||!_0xd5cae[_0xbbc6('0x63')][_0xbbc6('0x34')]){return'';}for(var _0x46d351='(',_0x3f6d02=0x0;_0x3f6d02<_0xd5cae[_0xbbc6('0x63')][_0xbbc6('0x34')];_0x3f6d02+=0x1){_0x3f6d02>0x0&&(_0x46d351+='\x20'+_0xd5cae[_0xbbc6('0x64')]+'\x20');_0x46d351+=_0xd5cae[_0xbbc6('0x63')][_0x3f6d02][_0xbbc6('0x65')]?_0x37eb95(_0xd5cae['rules'][_0x3f6d02]['group']):_0xd5cae[_0xbbc6('0x63')][_0x3f6d02][_0xbbc6('0x66')]+'\x20'+_0xd5cae[_0xbbc6('0x63')][_0x3f6d02]['condition']+(_0xd5ab8c(_0xd5cae['rules'][_0x3f6d02][_0xbbc6('0x89')])?'\x20'+_0xd5cae['rules'][_0x3f6d02][_0xbbc6('0x67')]:'');}return _0x46d351+')';};var _0x41dd3e={'where':{'id':_0x5be79e['id']}},_0x27bad8,_0x4d5d89,_0x3dbd56,_0x424e20,_0x15e17d;_0x41dd3e=_[_0xbbc6('0x3c')]({},_0x41dd3e,_0x5da900);return db[_0xbbc6('0x29')][_0xbbc6('0x44')](_0x41dd3e)[_0xbbc6('0x25')](function(_0x40f811){if(_0x40f811){_0x27bad8=_0x40f811;return _0x40f811[_0xbbc6('0x68')]();}return null;})[_0xbbc6('0x25')](function(_0x4798fb){if(_0x4798fb){if(!_0x4798fb['length']){throw new db[(_0xbbc6('0x69'))][(_0xbbc6('0x6a'))](_0xbbc6('0x6b'),0x193);}_0x4d5d89=_0x4798fb;return db[_0xbbc6('0x6c')][_0xbbc6('0x6d')]({'raw':!![]});}return null;})[_0xbbc6('0x25')](function(_0x2d3a7c){if(_0x2d3a7c){_0x3dbd56=_[_0xbbc6('0x6e')](_0x2d3a7c,'id');var _0x5758c3;var _0xb8eb92=squel[_0xbbc6('0x6f')]();_0xb8eb92['from'](_0x27bad8['table']);for(var _0x331b76=0x0;_0x331b76<_0x4d5d89[_0xbbc6('0x34')];_0x331b76+=0x1){_0x5758c3=_0x4d5d89[_0x331b76][_0xbbc6('0x72')]?_0x3dbd56[_0x4d5d89[_0x331b76]['MetricId']][_0xbbc6('0x73')]:_0x4d5d89[_0x331b76]['field'];_0x5758c3=_0x4d5d89[_0x331b76][_0xbbc6('0x74')]?_['replace'](_0x2b855c[_0x4d5d89[_0x331b76]['function']],'%s',_0x5758c3):_0x5758c3;_0x5758c3=_0x4d5d89[_0x331b76][_0xbbc6('0x75')]?_[_0xbbc6('0x8a')](_0x5ea5e1[_0x4d5d89[_0x331b76][_0xbbc6('0x75')]],'%s',_0x5758c3):_0x5758c3;if(_0x4d5d89[_0x331b76][_0xbbc6('0x76')]){_0xb8eb92['group'](_0x5758c3);}_0x4d5d89[_0x331b76]['orderBy']&&_0xb8eb92[_0xbbc6('0x37')](_0x5758c3,_0x4d5d89[_0x331b76][_0xbbc6('0x77')]==='DESC'?![]:!![]);_0xb8eb92[_0xbbc6('0x66')](_0x5758c3,_0x4d5d89[_0x331b76][_0xbbc6('0x78')]||_0x5758c3);}if(_0x27bad8[_0xbbc6('0x79')]){_0x27bad8[_0xbbc6('0x79')]=JSON['parse'](_0x27bad8[_0xbbc6('0x79')]);for(var _0x14f021=0x0;_0x14f021<_0x27bad8['joins']['length'];_0x14f021+=0x1){if(_0x27bad8[_0xbbc6('0x79')][_0x14f021]['type']&&_[_0xbbc6('0x5e')](_0xd7d1a1,_0x27bad8[_0xbbc6('0x79')][_0x14f021][_0xbbc6('0x3d')])&&_0x27bad8['joins'][_0x14f021][_0xbbc6('0x7e')]&&_0x27bad8[_0xbbc6('0x79')][_0x14f021]['foreignTable']&&_0x27bad8[_0xbbc6('0x79')][_0x14f021][_0xbbc6('0x7c')]){_0xb8eb92[_0x27bad8['joins'][_0x14f021][_0xbbc6('0x3d')]](_0x27bad8['joins'][_0x14f021]['foreignTable'],null,util[_0xbbc6('0x75')](_0xbbc6('0x7d'),_0x27bad8[_0xbbc6('0x71')],_0x27bad8['joins'][_0x14f021][_0xbbc6('0x7e')],_0x27bad8[_0xbbc6('0x79')][_0x14f021][_0xbbc6('0x7b')],_0x27bad8[_0xbbc6('0x79')][_0x14f021][_0xbbc6('0x7c')]));}}}if(_0x27bad8['conditions']){_0x27bad8[_0xbbc6('0x7f')]=JSON[_0xbbc6('0x7a')](_0x27bad8[_0xbbc6('0x7f')]);_0xb8eb92[_0xbbc6('0x39')](_0x37eb95(_0x27bad8['conditions'][_0xbbc6('0x65')]));}_0x15e17d=_0xb8eb92[_0xbbc6('0x8b')]();_0xb8eb92[_0xbbc6('0x1d')](_0x1f4ed3);_0xb8eb92['offset'](0x0);return;}})['then'](function(){if(_0x5a2c66[_0xbbc6('0x8c')]==='web'){return null;}var _0x1e4307=_['merge'](_0x5a2c66,{'name':_0x5a2c66[_0xbbc6('0x8d')]||_0x5a2c66[_0xbbc6('0x26')]||_0x27bad8[_0xbbc6('0x26')],'basename':_0x4c7b6b,'savename':util[_0xbbc6('0x75')](_0xbbc6('0x8e'),_0x5a2c66['name']||_0x27bad8[_0xbbc6('0x26')],require(_0xbbc6('0x8f'))[_0xbbc6('0x90')](0x4),_0x5a2c66[_0xbbc6('0x8c')]||_0xbbc6('0x91')),'reportId':_0x27bad8['id'],'reportType':_0xbbc6('0x92')});return db[_0xbbc6('0x93')][_0xbbc6('0x45')](_0x1e4307,{'raw':!![]});})[_0xbbc6('0x25')](function(_0x409092){if(_0x27bad8[_0xbbc6('0x71')]==='cdr'){_0x15e17d[_0xbbc6('0x39')](_0x27bad8['table']+_0xbbc6('0x94'),_0x5a2c66[_0xbbc6('0x95')],_0x5a2c66['endDate']);}else{_0x15e17d[_0xbbc6('0x39')](_0x27bad8[_0xbbc6('0x71')]+_0xbbc6('0x96'),_0x5a2c66[_0xbbc6('0x95')],_0x5a2c66['endDate']);}if(_0x409092){logger['info'](_0xbbc6('0x97'),_0x15e17d[_0xbbc6('0x81')]());require(_0xbbc6('0x98'))[_0xbbc6('0x99')](path[_0xbbc6('0x52')](__dirname,_0xbbc6('0x9a'),_0x409092[_0xbbc6('0x8c')]),[_0x409092['id'],_0x15e17d['toString'](),path[_0xbbc6('0x52')](__dirname,_0xbbc6('0x9b'),_0x409092[_0xbbc6('0x9c')]),_0x4c7b6b]);return _0x409092;}else{var _0x291b8a=squel[_0xbbc6('0x6f')]();_0x291b8a[_0xbbc6('0x70')]('('+_0x15e17d[_0xbbc6('0x81')]()+')',_0xbbc6('0x9d'));_0x291b8a[_0xbbc6('0x66')](_0xbbc6('0x9e'),_0xbbc6('0x1b'));_0x15e17d[_0xbbc6('0x1d')](_0x5a2c66[_0xbbc6('0x1d')]||_0x1f4ed3);_0x15e17d['offset'](_0x5a2c66['offset']||0x0);return dbH['sequelize'][_0xbbc6('0x2e')](_0x291b8a['toString'](),{'type':dbH['sequelize'][_0xbbc6('0x83')][_0xbbc6('0x84')]})[_0xbbc6('0x25')](function(_0x330ce8){if(!_0x330ce8[_0xbbc6('0x34')]){_0x424e20=0x0;}else{_0x424e20=_0x330ce8[0x0][_0xbbc6('0x1b')]||0x0;}return dbH['sequelize'][_0xbbc6('0x2e')](_0x15e17d[_0xbbc6('0x81')](),{'type':dbH[_0xbbc6('0x82')][_0xbbc6('0x83')][_0xbbc6('0x84')]});})[_0xbbc6('0x25')](function(_0x812c9d){return{'rows':_0x812c9d||[],'count':_0x424e20};});}});}exports['run']=function(_0x5c4f70,_0x487670){return runReport(_0x5c4f70[_0xbbc6('0x43')],_0x5c4f70[_0xbbc6('0x2e')],_0x5c4f70[_0xbbc6('0x3e')])['then'](respondWithResult(_0x487670,null))[_0xbbc6('0x41')](handleError(_0x487670,null));};exports['runReport']=runReport;exports[_0xbbc6('0x2e')]=function(_0x3f124c,_0x22f699){var _0x5854e3=0xa;var _0x1231ba=[_0xbbc6('0x52'),'left_join',_0xbbc6('0x54'),_0xbbc6('0x55')];var _0x2177ca={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbbc6('0x85'),'MAX':_0xbbc6('0x58'),'MIN':_0xbbc6('0x9f'),'AVG':_0xbbc6('0x86'),'GROUP_CONCAT':_0xbbc6('0x59'),'GROUP_CONCAT ASC':_0xbbc6('0x87'),'GROUP_CONCAT DESC':_0xbbc6('0x5a')};var _0x1ea1ca={'SEC_TO_TIME':_0xbbc6('0x88'),'DATE':_0xbbc6('0xa0'),'HOUR':_0xbbc6('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbbc6('0x5d')};var _0x273af0=function(_0x1732b1){return!_[_0xbbc6('0x5e')]([_0xbbc6('0x5f'),_0xbbc6('0x60'),_0xbbc6('0x61'),_0xbbc6('0x62')],_0x1732b1);};var _0x58fad4=function(_0x18a0f4){if(!_0x18a0f4||!_0x18a0f4[_0xbbc6('0x63')]['length']){return'';}for(var _0x17acfb='(',_0x582b4a=0x0;_0x582b4a<_0x18a0f4['rules'][_0xbbc6('0x34')];_0x582b4a+=0x1){_0x582b4a>0x0&&(_0x17acfb+='\x20'+_0x18a0f4[_0xbbc6('0x64')]+'\x20');_0x17acfb+=_0x18a0f4[_0xbbc6('0x63')][_0x582b4a][_0xbbc6('0x65')]?_0x58fad4(_0x18a0f4['rules'][_0x582b4a]['group']):_0x18a0f4[_0xbbc6('0x63')][_0x582b4a][_0xbbc6('0x66')]+'\x20'+_0x18a0f4['rules'][_0x582b4a][_0xbbc6('0x89')]+(_0x273af0(_0x18a0f4['rules'][_0x582b4a][_0xbbc6('0x89')])?'\x20'+_0x18a0f4[_0xbbc6('0x63')][_0x582b4a][_0xbbc6('0x67')]:'');}return _0x17acfb+')';};var _0x52ac86={'where':{'id':_0x3f124c[_0xbbc6('0x43')]['id']}},_0x49b532,_0x1f9351,_0x9c0ea5,_0x1c1fcb,_0x3d5d49;_0x52ac86=_[_0xbbc6('0x3c')]({},_0x52ac86,_0x3f124c[_0xbbc6('0x3e')]);return db[_0xbbc6('0x29')][_0xbbc6('0x44')](_0x52ac86)[_0xbbc6('0x25')](function(_0x1e3d57){if(_0x1e3d57){_0x49b532=_0x1e3d57;return _0x1e3d57[_0xbbc6('0x68')]();}return null;})[_0xbbc6('0x25')](function(_0x397e44){if(_0x397e44){if(!_0x397e44[_0xbbc6('0x34')]){throw new db[(_0xbbc6('0x69'))]['ValidationErrorItem'](_0xbbc6('0x6b'),0x193);}_0x1f9351=_0x397e44;return db['AnalyticMetric'][_0xbbc6('0x6d')]({'raw':!![]});}return null;})[_0xbbc6('0x25')](function(_0x2af8c9){if(_0x2af8c9){_0x9c0ea5=_[_0xbbc6('0x6e')](_0x2af8c9,'id');var _0x110903;var _0x132fcb=squel['select']();_0x132fcb[_0xbbc6('0x70')](_0x49b532['table']);for(var _0x11bb89=0x0;_0x11bb89<_0x1f9351['length'];_0x11bb89+=0x1){_0x110903=_0x1f9351[_0x11bb89][_0xbbc6('0x72')]?_0x9c0ea5[_0x1f9351[_0x11bb89]['MetricId']]['metric']:_0x1f9351[_0x11bb89][_0xbbc6('0x66')];_0x110903=_0x1f9351[_0x11bb89][_0xbbc6('0x74')]?_[_0xbbc6('0x8a')](_0x2177ca[_0x1f9351[_0x11bb89][_0xbbc6('0x74')]],'%s',_0x110903):_0x110903;_0x110903=_0x1f9351[_0x11bb89]['format']?_['replace'](_0x1ea1ca[_0x1f9351[_0x11bb89]['format']],'%s',_0x110903):_0x110903;if(_0x1f9351[_0x11bb89][_0xbbc6('0x76')]){_0x132fcb['group'](_0x110903);}_0x1f9351[_0x11bb89][_0xbbc6('0x77')]&&_0x132fcb[_0xbbc6('0x37')](_0x110903,_0x1f9351[_0x11bb89][_0xbbc6('0x77')]===_0xbbc6('0xa1')?![]:!![]);_0x132fcb[_0xbbc6('0x66')](_0x110903,_0x1f9351[_0x11bb89][_0xbbc6('0x78')]||_0x110903);}if(_0x49b532['joins']){_0x49b532[_0xbbc6('0x79')]=JSON[_0xbbc6('0x7a')](_0x49b532['joins']);for(var _0x212251=0x0;_0x212251<_0x49b532['joins'][_0xbbc6('0x34')];_0x212251+=0x1){if(_0x49b532[_0xbbc6('0x79')][_0x212251][_0xbbc6('0x3d')]&&_['includes'](_0x1231ba,_0x49b532[_0xbbc6('0x79')][_0x212251]['type'])&&_0x49b532[_0xbbc6('0x79')][_0x212251][_0xbbc6('0x7e')]&&_0x49b532[_0xbbc6('0x79')][_0x212251][_0xbbc6('0x7b')]&&_0x49b532['joins'][_0x212251][_0xbbc6('0x7c')]){_0x132fcb[_0x49b532['joins'][_0x212251]['type']](_0x49b532[_0xbbc6('0x79')][_0x212251][_0xbbc6('0x7b')],null,util[_0xbbc6('0x75')](_0xbbc6('0x7d'),_0x49b532[_0xbbc6('0x71')],_0x49b532[_0xbbc6('0x79')][_0x212251][_0xbbc6('0x7e')],_0x49b532['joins'][_0x212251][_0xbbc6('0x7b')],_0x49b532[_0xbbc6('0x79')][_0x212251][_0xbbc6('0x7c')]));}}}if(_0x49b532[_0xbbc6('0x7f')]){_0x49b532[_0xbbc6('0x7f')]=JSON['parse'](_0x49b532[_0xbbc6('0x7f')]);_0x132fcb[_0xbbc6('0x39')](_0x58fad4(_0x49b532[_0xbbc6('0x7f')][_0xbbc6('0x65')]));}_0x3d5d49=_0x132fcb[_0xbbc6('0x8b')]();_0x132fcb['limit'](_0x5854e3);_0x132fcb['offset'](0x0);logger['debug'](_0xbbc6('0xa2'),_0x132fcb[_0xbbc6('0x81')]());return dbH[_0xbbc6('0x82')][_0xbbc6('0x2e')](_0x132fcb[_0xbbc6('0x81')](),{'type':dbH['sequelize'][_0xbbc6('0x83')]['SELECT']});}})[_0xbbc6('0x25')](function(){return{'sql':_0x3d5d49['toString']()};})[_0xbbc6('0x25')](respondWithResult(_0x22f699,null))[_0xbbc6('0x41')](handleError(_0x22f699,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 4a9c501..db8ec60 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 _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 +var _0x93b3=['bluebird','path','rimraf','../../config/environment','exports','AnalyticCustomReport','util','../../config/logger','api','moment'];(function(_0x20455f,_0x423034){var _0x185213=function(_0x11260d){while(--_0x11260d){_0x20455f['push'](_0x20455f['shift']());}};_0x185213(++_0x423034);}(_0x93b3,0x1aa));var _0x393b=function(_0xe033e7,_0x561a6d){_0xe033e7=_0xe033e7-0x0;var _0x63031f=_0x93b3[_0xe033e7];return _0x63031f;};'use strict';var _=require('lodash');var util=require(_0x393b('0x0'));var logger=require(_0x393b('0x1'))(_0x393b('0x2'));var moment=require(_0x393b('0x3'));var BPromise=require(_0x393b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x393b('0x5'));var rimraf=require(_0x393b('0x6'));var config=require(_0x393b('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x393b('0x8')]=function(_0x1d43c6,_0x3d454b){return _0x1d43c6['define'](_0x393b('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index e34921a..d465d93 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 _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 +var _0x5877=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5877,0x1ce));var _0x7587=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5877[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7587('0x0'));var util=require(_0x7587('0x1'));var moment=require(_0x7587('0x2'));var BPromise=require(_0x7587('0x3'));var rs=require(_0x7587('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7587('0x5'))['db'];var utils=require(_0x7587('0x6'));var logger=require(_0x7587('0x7'))('rpc');var config=require(_0x7587('0x8'));var jayson=require(_0x7587('0x9'));var client=jayson[_0x7587('0xa')][_0x7587('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e065e,_0x7c0da5,_0x4f9f54){return new BPromise(function(_0xaeff3a,_0x5bd6da){return client[_0x7587('0xc')](_0x2e065e,_0x4f9f54)['then'](function(_0x10c6d0){logger[_0x7587('0xd')](_0x7587('0xe'),_0x7c0da5,_0x7587('0xf'));logger[_0x7587('0x10')](_0x7587('0x11'),_0x7c0da5,_0x7587('0xf'),JSON[_0x7587('0x12')](_0x10c6d0));if(_0x10c6d0[_0x7587('0x13')]){if(_0x10c6d0[_0x7587('0x13')]['code']===0x1f4){logger[_0x7587('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x7c0da5,_0x10c6d0[_0x7587('0x13')][_0x7587('0x14')]);return _0x5bd6da(_0x10c6d0[_0x7587('0x13')][_0x7587('0x14')]);}logger['error'](_0x7587('0xe'),_0x7c0da5,_0x10c6d0['error'][_0x7587('0x14')]);return _0xaeff3a(_0x10c6d0[_0x7587('0x13')][_0x7587('0x14')]);}else{logger[_0x7587('0xd')](_0x7587('0xe'),_0x7c0da5,_0x7587('0xf'));_0xaeff3a(_0x10c6d0['result']['message']);}})[_0x7587('0x15')](function(_0x3a3e5c){logger[_0x7587('0x13')](_0x7587('0xe'),_0x7c0da5,_0x3a3e5c);_0x5bd6da(_0x3a3e5c);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index e1269be..7c3a991 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 _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 +var _0x8941=['express','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/query','query','create','/:id','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x59b583,_0x227f10){var _0x38217b=function(_0x1c1fc4){while(--_0x1c1fc4){_0x59b583['push'](_0x59b583['shift']());}};_0x38217b(++_0x227f10);}(_0x8941,0x1a0));var _0x1894=function(_0x2f697c,_0xa0d1f6){_0x2f697c=_0x2f697c-0x0;var _0x2ed623=_0x8941[_0x2f697c];return _0x2ed623;};'use strict';var multer=require(_0x1894('0x0'));var util=require(_0x1894('0x1'));var path=require(_0x1894('0x2'));var timeout=require(_0x1894('0x3'));var express=require(_0x1894('0x4'));var router=express['Router']();var auth=require(_0x1894('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1894('0x6'));var controller=require(_0x1894('0x7'));router[_0x1894('0x8')]('/',auth[_0x1894('0x9')](),controller[_0x1894('0xa')]);router['get']('/:id',auth[_0x1894('0x9')](),controller[_0x1894('0xb')]);router[_0x1894('0x8')](_0x1894('0xc'),auth[_0x1894('0x9')](),controller[_0x1894('0xd')]);router[_0x1894('0x8')]('/:id/run',auth[_0x1894('0x9')](),controller['run']);router[_0x1894('0x8')](_0x1894('0xe'),auth[_0x1894('0x9')](),controller[_0x1894('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1894('0x10')]);router['put'](_0x1894('0x11'),auth[_0x1894('0x9')](),controller[_0x1894('0x12')]);router['delete'](_0x1894('0x11'),auth[_0x1894('0x9')](),controller[_0x1894('0x13')]);module[_0x1894('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index ef5759c..410efc5 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 _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 +var _0xc479=['STRING','exports'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xc479,0x11b));var _0x9c47=function(_0x16795f,_0x533662){_0x16795f=_0x16795f-0x0;var _0x328f13=_0xc479[_0x16795f];return _0x328f13;};'use strict';var Sequelize=require('sequelize');module[_0x9c47('0x0')]={'name':{'type':Sequelize[_0x9c47('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9c47('0x1')]},'parent':{'type':Sequelize[_0x9c47('0x1')]},'table':{'type':Sequelize[_0x9c47('0x1')]},'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 ae8f331..07e94ef 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 _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 +var _0xbccb=['%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','SELECT','run','runReport','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','count','offset','set','Content-Range','apply','save','update','destroy','then','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','length','limit','order','sort','where','pick','map','VIRTUAL','merge','options','includeAll','include','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','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)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','condition','value','keyBy','metric','alias','output','web'];(function(_0x21bcc6,_0x51f500){var _0x13d711=function(_0x3458c9){while(--_0x3458c9){_0x21bcc6['push'](_0x21bcc6['shift']());}};_0x13d711(++_0x51f500);}(_0xbccb,0xb8));var _0xbbcc=function(_0x256e32,_0x4013bc){_0x256e32=_0x256e32-0x0;var _0x464070=_0xbccb[_0x256e32];return _0x464070;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbcc('0x0'));var rimraf=require(_0xbbcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbcc('0x2'));var rp=require('request-promise');var moment=require(_0xbbcc('0x3'));var BPromise=require(_0xbbcc('0x4'));var Mustache=require(_0xbbcc('0x5'));var util=require(_0xbbcc('0x6'));var path=require(_0xbbcc('0x7'));var sox=require(_0xbbcc('0x8'));var csv=require(_0xbbcc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbbcc('0xa'));var squel=require(_0xbbcc('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbbcc('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbbcc('0xd'));var Redis=require(_0xbbcc('0xe'));var authService=require(_0xbbcc('0xf'));var qs=require(_0xbbcc('0x10'));var as=require(_0xbbcc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbbcc('0x12'))(_0xbbcc('0x13'));var utils=require(_0xbbcc('0x14'));var config=require(_0xbbcc('0x15'));var licenseUtil=require(_0xbbcc('0x16'));var db=require(_0xbbcc('0x17'))['db'];var dbH=require(_0xbbcc('0x17'))[_0xbbcc('0x18')];function respondWithStatusCode(_0x4729b0,_0x56ea0b){_0x56ea0b=_0x56ea0b||0xcc;return function(_0x5416c7){if(_0x5416c7){return _0x4729b0[_0xbbcc('0x19')](_0x56ea0b);}return _0x4729b0[_0xbbcc('0x1a')](_0x56ea0b)['end']();};}function respondWithResult(_0x2127f1,_0x2aa1e3){_0x2aa1e3=_0x2aa1e3||0xc8;return function(_0x516c80){if(_0x516c80){return _0x2127f1['status'](_0x2aa1e3)['json'](_0x516c80);}};}function respondWithFilteredResult(_0xeea6a4,_0x334d98){return function(_0x3e50b2){if(_0x3e50b2){var _0x4ae7a6=_0x3e50b2[_0xbbcc('0x1b')],_0x32a7d6=_0x334d98[_0xbbcc('0x1c')],_0x52c2f9=_0x334d98[_0xbbcc('0x1c')]+_0x334d98['limit'],_0x546d33;if(_0x52c2f9>=_0x4ae7a6){_0x52c2f9=_0x4ae7a6;_0x546d33=0xc8;}else{_0x546d33=0xce;}_0xeea6a4[_0xbbcc('0x1a')](_0x546d33);return _0xeea6a4[_0xbbcc('0x1d')](_0xbbcc('0x1e'),_0x32a7d6+'-'+_0x52c2f9+'/'+_0x4ae7a6)['json'](_0x3e50b2);}return null;};}function patchUpdates(_0x24c982){return function(_0x37b06d){try{jsonpatch[_0xbbcc('0x1f')](_0x37b06d,_0x24c982,!![]);}catch(_0x2bd58d){return BPromise['reject'](_0x2bd58d);}return _0x37b06d[_0xbbcc('0x20')]();};}function saveUpdates(_0x5d064b,_0x5124b7){return function(_0x22e0eb){if(_0x22e0eb){return _0x22e0eb[_0xbbcc('0x21')](_0x5d064b)['then'](function(_0xb82e36){return _0xb82e36;});}return null;};}function removeEntity(_0x7884b6,_0x25a069){return function(_0x35ac46){if(_0x35ac46){return _0x35ac46[_0xbbcc('0x22')]()[_0xbbcc('0x23')](function(){var _0x56c70a=_0x35ac46[_0xbbcc('0x24')]({'plain':!![]});var _0x22e163=_0xbbcc('0x25');return db[_0xbbcc('0x26')][_0xbbcc('0x22')]({'where':{'type':_0x22e163,'resourceId':_0x56c70a['id']}})[_0xbbcc('0x23')](function(){return _0x35ac46;});})[_0xbbcc('0x23')](function(){_0x7884b6[_0xbbcc('0x1a')](0xcc)[_0xbbcc('0x27')]();});}};}function handleEntityNotFound(_0x51e17f,_0x53771a){return function(_0x39a9d8){if(!_0x39a9d8){_0x51e17f[_0xbbcc('0x19')](0x194);}return _0x39a9d8;};}function handleError(_0x446dfe,_0x3faca3){_0x3faca3=_0x3faca3||0x1f4;return function(_0x3c79e2){logger[_0xbbcc('0x28')](_0x3c79e2[_0xbbcc('0x29')]);if(_0x3c79e2['name']){delete _0x3c79e2[_0xbbcc('0x2a')];}_0x446dfe[_0xbbcc('0x1a')](_0x3faca3)[_0xbbcc('0x2b')](_0x3c79e2);};}exports[_0xbbcc('0x2c')]=function(_0x345a03,_0x10f05a){var _0x504697={},_0x39dccd={},_0xdcc7a8={'count':0x0,'rows':[]};var _0x1934d6=_['map'](db[_0xbbcc('0x2d')][_0xbbcc('0x2e')],function(_0x45dc30){return{'name':_0x45dc30[_0xbbcc('0x2f')],'type':_0x45dc30[_0xbbcc('0x30')][_0xbbcc('0x31')]};});_0x39dccd[_0xbbcc('0x32')]=_['map'](_0x1934d6,_0xbbcc('0x2a'));_0x39dccd[_0xbbcc('0x33')]=_['keys'](_0x345a03['query']);_0x39dccd[_0xbbcc('0x34')]=_[_0xbbcc('0x35')](_0x39dccd[_0xbbcc('0x32')],_0x39dccd['query']);_0x504697[_0xbbcc('0x36')]=_[_0xbbcc('0x35')](_0x39dccd['model'],qs['fields'](_0x345a03[_0xbbcc('0x33')]['fields']));_0x504697[_0xbbcc('0x36')]=_0x504697[_0xbbcc('0x36')][_0xbbcc('0x37')]?_0x504697[_0xbbcc('0x36')]:_0x39dccd[_0xbbcc('0x32')];if(!_0x345a03[_0xbbcc('0x33')]['hasOwnProperty']('nolimit')){_0x504697['limit']=qs['limit'](_0x345a03[_0xbbcc('0x33')][_0xbbcc('0x38')]);_0x504697[_0xbbcc('0x1c')]=qs[_0xbbcc('0x1c')](_0x345a03[_0xbbcc('0x33')][_0xbbcc('0x1c')]);}_0x504697[_0xbbcc('0x39')]=qs['sort'](_0x345a03['query'][_0xbbcc('0x3a')]);_0x504697[_0xbbcc('0x3b')]=qs[_0xbbcc('0x34')](_[_0xbbcc('0x3c')](_0x345a03['query'],_0x39dccd[_0xbbcc('0x34')]),_0x1934d6);if(_0x345a03[_0xbbcc('0x33')]['filter']){_0x504697[_0xbbcc('0x3b')]=_['merge'](_0x504697[_0xbbcc('0x3b')],{'$or':_[_0xbbcc('0x3d')](_0x1934d6,function(_0x8cf32b){if(_0x8cf32b[_0xbbcc('0x30')]!==_0xbbcc('0x3e')){var _0x9ecf74={};_0x9ecf74[_0x8cf32b[_0xbbcc('0x2a')]]={'$like':'%'+_0x345a03['query']['filter']+'%'};return _0x9ecf74;}})});}_0x504697=_[_0xbbcc('0x3f')]({},_0x504697,_0x345a03[_0xbbcc('0x40')]);var _0x53b4c9={'where':_0x504697[_0xbbcc('0x3b')]};return db[_0xbbcc('0x2d')][_0xbbcc('0x1b')](_0x53b4c9)[_0xbbcc('0x23')](function(_0x38d0e6){_0xdcc7a8[_0xbbcc('0x1b')]=_0x38d0e6;if(_0x345a03[_0xbbcc('0x33')][_0xbbcc('0x41')]){_0x504697[_0xbbcc('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x504697);})[_0xbbcc('0x23')](function(_0xadddbc){_0xdcc7a8['rows']=_0xadddbc;return _0xdcc7a8;})['then'](respondWithFilteredResult(_0x10f05a,_0x504697))[_0xbbcc('0x43')](handleError(_0x10f05a,null));};exports[_0xbbcc('0x44')]=function(_0x3f984e,_0x2a3f74){var _0x32c4a1={'raw':!![],'where':{'id':_0x3f984e[_0xbbcc('0x45')]['id']}},_0x440253={};_0x440253['model']=_['keys'](db[_0xbbcc('0x2d')][_0xbbcc('0x2e')]);_0x440253[_0xbbcc('0x33')]=_[_0xbbcc('0x46')](_0x3f984e[_0xbbcc('0x33')]);_0x440253[_0xbbcc('0x34')]=_[_0xbbcc('0x35')](_0x440253[_0xbbcc('0x32')],_0x440253[_0xbbcc('0x33')]);_0x32c4a1[_0xbbcc('0x36')]=_['intersection'](_0x440253['model'],qs[_0xbbcc('0x47')](_0x3f984e[_0xbbcc('0x33')][_0xbbcc('0x47')]));_0x32c4a1['attributes']=_0x32c4a1[_0xbbcc('0x36')][_0xbbcc('0x37')]?_0x32c4a1['attributes']:_0x440253[_0xbbcc('0x32')];if(_0x3f984e['query'][_0xbbcc('0x41')]){_0x32c4a1[_0xbbcc('0x42')]=[{'all':!![]}];}_0x32c4a1=_[_0xbbcc('0x3f')]({},_0x32c4a1,_0x3f984e[_0xbbcc('0x40')]);return db[_0xbbcc('0x2d')][_0xbbcc('0x48')](_0x32c4a1)[_0xbbcc('0x23')](handleEntityNotFound(_0x2a3f74,null))[_0xbbcc('0x23')](respondWithResult(_0x2a3f74,null))[_0xbbcc('0x43')](handleError(_0x2a3f74,null));};exports[_0xbbcc('0x49')]=function(_0x4042bb,_0x2df6ff){return db[_0xbbcc('0x2d')]['create'](_0x4042bb[_0xbbcc('0x4a')],{})['then'](function(_0x51f2b9){var _0x2c09d0=_0x4042bb[_0xbbcc('0x4b')][_0xbbcc('0x24')]({'plain':!![]});if(!_0x2c09d0)throw new Error(_0xbbcc('0x4c'));if(_0x2c09d0[_0xbbcc('0x4d')]===_0xbbcc('0x4b')){var _0x11141e=_0x51f2b9[_0xbbcc('0x24')]({'plain':!![]});var _0x247d90=_0xbbcc('0x4e');return db[_0xbbcc('0x4f')][_0xbbcc('0x48')]({'where':{'name':_0x247d90,'userProfileId':_0x2c09d0[_0xbbcc('0x50')]},'raw':!![]})[_0xbbcc('0x23')](function(_0x23c52b){if(_0x23c52b&&_0x23c52b['autoAssociation']===0x0){return db[_0xbbcc('0x26')]['create']({'name':_0x11141e[_0xbbcc('0x2a')],'resourceId':_0x11141e['id'],'type':_0xbbcc('0x25'),'sectionId':_0x23c52b['id']},{})[_0xbbcc('0x23')](function(){return _0x51f2b9;});}else{return _0x51f2b9;}})[_0xbbcc('0x43')](function(_0x1b6c22){logger[_0xbbcc('0x28')](_0xbbcc('0x51'),_0x1b6c22);throw _0x1b6c22;});}return _0x51f2b9;})[_0xbbcc('0x23')](respondWithResult(_0x2df6ff,0xc9))[_0xbbcc('0x43')](handleError(_0x2df6ff,null));};exports[_0xbbcc('0x21')]=function(_0x38237a,_0x2e7623){if(_0x38237a[_0xbbcc('0x4a')]['id']){delete _0x38237a['body']['id'];}return db[_0xbbcc('0x2d')]['find']({'where':{'id':_0x38237a[_0xbbcc('0x45')]['id']}})[_0xbbcc('0x23')](handleEntityNotFound(_0x2e7623,null))['then'](saveUpdates(_0x38237a[_0xbbcc('0x4a')],null))[_0xbbcc('0x23')](respondWithResult(_0x2e7623,null))[_0xbbcc('0x43')](handleError(_0x2e7623,null));};exports['destroy']=function(_0x4e5238,_0x174a5){return db[_0xbbcc('0x2d')]['find']({'where':{'id':_0x4e5238[_0xbbcc('0x45')]['id']}})[_0xbbcc('0x23')](handleEntityNotFound(_0x174a5,null))[_0xbbcc('0x23')](removeEntity(_0x174a5,null))[_0xbbcc('0x43')](handleError(_0x174a5,null));};exports[_0xbbcc('0x52')]=function(_0x2bfc2a,_0x11d2aa){var _0x251313=0xa;var _0x312e27=[_0xbbcc('0x53'),_0xbbcc('0x54'),_0xbbcc('0x55'),_0xbbcc('0x56')];var _0x3ab18f={'SUM':_0xbbcc('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbbcc('0x58'),'MAX':'MAX(%s)','MIN':_0xbbcc('0x59'),'AVG':_0xbbcc('0x5a'),'GROUP_CONCAT':_0xbbcc('0x5b'),'GROUP_CONCAT ASC':_0xbbcc('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5508be={'SEC_TO_TIME':_0xbbcc('0x5d'),'DATE':_0xbbcc('0x5e'),'HOUR':_0xbbcc('0x5f'),'ROUND':_0xbbcc('0x60'),'UNIX_TIMESTAMP':_0xbbcc('0x61')};var _0x45ced4=function(_0x2ea131){return!_[_0xbbcc('0x62')]([_0xbbcc('0x63'),_0xbbcc('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2ea131);};var _0x2e3663=function(_0x12af63){if(!_0x12af63||!_0x12af63[_0xbbcc('0x65')][_0xbbcc('0x37')]){return'';}for(var _0x17bde6='(',_0x2a099f=0x0;_0x2a099f<_0x12af63['rules']['length'];_0x2a099f+=0x1){_0x2a099f>0x0&&(_0x17bde6+='\x20'+_0x12af63[_0xbbcc('0x66')]+'\x20');_0x17bde6+=_0x12af63[_0xbbcc('0x65')][_0x2a099f]['group']?_0x2e3663(_0x12af63['rules'][_0x2a099f][_0xbbcc('0x67')]):_0x12af63[_0xbbcc('0x65')][_0x2a099f][_0xbbcc('0x68')]+'\x20'+_0x12af63[_0xbbcc('0x65')][_0x2a099f]['condition']+(_0x45ced4(_0x12af63[_0xbbcc('0x65')][_0x2a099f]['condition'])?'\x20'+_0x12af63[_0xbbcc('0x65')][_0x2a099f]['value']:'');}return _0x17bde6+')';};var _0x2d7313={'where':{'id':_0x2bfc2a['params']['id']}},_0x8ca74c,_0x394f46,_0x19560f,_0x2be249,_0x13caea;_0x2d7313=_[_0xbbcc('0x3f')]({},_0x2d7313,_0x2bfc2a[_0xbbcc('0x40')]);return db['AnalyticDefaultReport'][_0xbbcc('0x48')](_0x2d7313)[_0xbbcc('0x23')](function(_0x4d2622){if(_0x4d2622){_0x8ca74c=_0x4d2622;return _0x4d2622[_0xbbcc('0x69')]();}return null;})[_0xbbcc('0x23')](function(_0x4d8bd8){if(_0x4d8bd8){if(!_0x4d8bd8[_0xbbcc('0x37')]){throw new db[(_0xbbcc('0x6a'))][(_0xbbcc('0x6b'))](_0xbbcc('0x6c'),0x193);}_0x394f46=_0x4d8bd8;return db[_0xbbcc('0x6d')][_0xbbcc('0x6e')]({'raw':!![]});}return null;})[_0xbbcc('0x23')](function(_0x236459){if(_0x236459){_0x19560f=_['keyBy'](_0x236459,'id');var _0x995fa5;var _0x4687d6=squel[_0xbbcc('0x6f')]();_0x4687d6[_0xbbcc('0x70')](_0x8ca74c[_0xbbcc('0x71')]);for(var _0x808c5f=0x0;_0x808c5f<_0x394f46['length'];_0x808c5f+=0x1){_0x995fa5=_0x394f46[_0x808c5f]['MetricId']?_0x19560f[_0x394f46[_0x808c5f][_0xbbcc('0x72')]]['metric']:_0x394f46[_0x808c5f][_0xbbcc('0x68')];_0x995fa5=_0x394f46[_0x808c5f][_0xbbcc('0x73')]?_[_0xbbcc('0x74')](_0x3ab18f[_0x394f46[_0x808c5f][_0xbbcc('0x73')]],'%s',_0x995fa5):_0x995fa5;_0x995fa5=_0x394f46[_0x808c5f][_0xbbcc('0x75')]?_['replace'](_0x5508be[_0x394f46[_0x808c5f]['format']],'%s',_0x995fa5):_0x995fa5;if(_0x394f46[_0x808c5f][_0xbbcc('0x76')]){_0x4687d6[_0xbbcc('0x67')](_0x995fa5);}_0x394f46[_0x808c5f][_0xbbcc('0x77')]&&_0x4687d6['order'](_0x995fa5,_0x394f46[_0x808c5f][_0xbbcc('0x77')]===_0xbbcc('0x78')?![]:!![]);_0x4687d6[_0xbbcc('0x68')](_0x995fa5,_0x394f46[_0x808c5f]['alias']||_0x995fa5);}if(_0x8ca74c[_0xbbcc('0x79')]){_0x8ca74c[_0xbbcc('0x79')]=JSON[_0xbbcc('0x7a')](_0x8ca74c[_0xbbcc('0x79')]);for(var _0x58b9dc=0x0;_0x58b9dc<_0x8ca74c[_0xbbcc('0x79')][_0xbbcc('0x37')];_0x58b9dc+=0x1){if(_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc][_0xbbcc('0x30')]&&_[_0xbbcc('0x62')](_0x312e27,_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc]['type'])&&_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc]['parentKey']&&_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc][_0xbbcc('0x7b')]&&_0x8ca74c['joins'][_0x58b9dc][_0xbbcc('0x7c')]){_0x4687d6[_0x8ca74c['joins'][_0x58b9dc][_0xbbcc('0x30')]](_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc][_0xbbcc('0x7b')],null,util[_0xbbcc('0x75')](_0xbbcc('0x7d'),_0x8ca74c[_0xbbcc('0x71')],_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc][_0xbbcc('0x7e')],_0x8ca74c['joins'][_0x58b9dc][_0xbbcc('0x7b')],_0x8ca74c[_0xbbcc('0x79')][_0x58b9dc][_0xbbcc('0x7c')]));}}}if(_0x8ca74c[_0xbbcc('0x7f')]){_0x8ca74c['conditions']=JSON[_0xbbcc('0x7a')](_0x8ca74c[_0xbbcc('0x7f')]);_0x4687d6[_0xbbcc('0x3b')](_0x2e3663(_0x8ca74c[_0xbbcc('0x7f')]['group']));}_0x13caea=_0x4687d6[_0xbbcc('0x80')]();_0x4687d6['limit'](_0x251313);_0x4687d6[_0xbbcc('0x1c')](0x0);logger[_0xbbcc('0x81')](_0xbbcc('0x82'),_0x4687d6[_0xbbcc('0x83')]());return dbH[_0xbbcc('0x84')][_0xbbcc('0x33')](_0x4687d6['toString'](),{'type':dbH[_0xbbcc('0x84')][_0xbbcc('0x85')]['SELECT']});}})[_0xbbcc('0x23')](respondWithResult(_0x11d2aa,null))[_0xbbcc('0x43')](handleError(_0x11d2aa,null));};function runReport(_0x9732de,_0x472c7b,_0x565231){var _0x2b4c50=_0x472c7b['name'];var _0x50e024=0xa;var _0x1a004b=[_0xbbcc('0x53'),_0xbbcc('0x54'),_0xbbcc('0x55'),'cross_join'];var _0x52b6e8={'SUM':'SUM(%s)','COUNT':_0xbbcc('0x86'),'COUNT DISTINCT':_0xbbcc('0x58'),'MAX':_0xbbcc('0x87'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbbcc('0x88')};var _0x3ac334={'SEC_TO_TIME':_0xbbcc('0x5d'),'DATE':_0xbbcc('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0xbbcc('0x60'),'UNIX_TIMESTAMP':_0xbbcc('0x61')};var _0xa9d90f=function(_0x4220ae){return!_[_0xbbcc('0x62')]([_0xbbcc('0x63'),_0xbbcc('0x64'),_0xbbcc('0x89'),_0xbbcc('0x8a')],_0x4220ae);};var _0x1a6e2d=function(_0x47be13){if(!_0x47be13||!_0x47be13['rules'][_0xbbcc('0x37')]){return'';}for(var _0x22f45b='(',_0x4ed1d6=0x0;_0x4ed1d6<_0x47be13['rules']['length'];_0x4ed1d6+=0x1){_0x4ed1d6>0x0&&(_0x22f45b+='\x20'+_0x47be13[_0xbbcc('0x66')]+'\x20');_0x22f45b+=_0x47be13['rules'][_0x4ed1d6][_0xbbcc('0x67')]?_0x1a6e2d(_0x47be13[_0xbbcc('0x65')][_0x4ed1d6][_0xbbcc('0x67')]):_0x47be13[_0xbbcc('0x65')][_0x4ed1d6]['field']+'\x20'+_0x47be13['rules'][_0x4ed1d6][_0xbbcc('0x8b')]+(_0xa9d90f(_0x47be13[_0xbbcc('0x65')][_0x4ed1d6][_0xbbcc('0x8b')])?'\x20'+_0x47be13[_0xbbcc('0x65')][_0x4ed1d6][_0xbbcc('0x8c')]:'');}return _0x22f45b+')';};var _0x523edd={'where':{'id':_0x9732de['id']}},_0x89eaf0,_0x30551c,_0x379f2d,_0x328716,_0x2b25dc;_0x523edd=_['merge']({},_0x523edd,_0x565231);return db[_0xbbcc('0x2d')][_0xbbcc('0x48')](_0x523edd)['then'](function(_0x2745bb){if(_0x2745bb){_0x89eaf0=_0x2745bb;return _0x2745bb[_0xbbcc('0x69')]();}return null;})[_0xbbcc('0x23')](function(_0x4a3a88){if(_0x4a3a88){if(!_0x4a3a88['length']){throw new db[(_0xbbcc('0x6a'))][(_0xbbcc('0x6b'))](_0xbbcc('0x6c'),0x193);}_0x30551c=_0x4a3a88;return db[_0xbbcc('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x45297d){if(_0x45297d){_0x379f2d=_[_0xbbcc('0x8d')](_0x45297d,'id');var _0x216fc8;var _0x57ae47=squel[_0xbbcc('0x6f')]();_0x57ae47[_0xbbcc('0x70')](_0x89eaf0[_0xbbcc('0x71')]);for(var _0x3817ef=0x0;_0x3817ef<_0x30551c['length'];_0x3817ef+=0x1){_0x216fc8=_0x30551c[_0x3817ef][_0xbbcc('0x72')]?_0x379f2d[_0x30551c[_0x3817ef][_0xbbcc('0x72')]][_0xbbcc('0x8e')]:_0x30551c[_0x3817ef]['field'];_0x216fc8=_0x30551c[_0x3817ef][_0xbbcc('0x73')]?_[_0xbbcc('0x74')](_0x52b6e8[_0x30551c[_0x3817ef]['function']],'%s',_0x216fc8):_0x216fc8;_0x216fc8=_0x30551c[_0x3817ef][_0xbbcc('0x75')]?_[_0xbbcc('0x74')](_0x3ac334[_0x30551c[_0x3817ef][_0xbbcc('0x75')]],'%s',_0x216fc8):_0x216fc8;if(_0x30551c[_0x3817ef][_0xbbcc('0x76')]){_0x57ae47[_0xbbcc('0x67')](_0x216fc8);}_0x30551c[_0x3817ef][_0xbbcc('0x77')]&&_0x57ae47[_0xbbcc('0x39')](_0x216fc8,_0x30551c[_0x3817ef][_0xbbcc('0x77')]===_0xbbcc('0x78')?![]:!![]);_0x57ae47['field'](_0x216fc8,_0x30551c[_0x3817ef][_0xbbcc('0x8f')]||_0x216fc8);}if(_0x89eaf0[_0xbbcc('0x79')]){_0x89eaf0['joins']=JSON['parse'](_0x89eaf0['joins']);for(var _0x2ad4c5=0x0;_0x2ad4c5<_0x89eaf0['joins'][_0xbbcc('0x37')];_0x2ad4c5+=0x1){if(_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x30')]&&_[_0xbbcc('0x62')](_0x1a004b,_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x30')])&&_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x7e')]&&_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5]['foreignTable']&&_0x89eaf0['joins'][_0x2ad4c5][_0xbbcc('0x7c')]){_0x57ae47[_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5]['type']](_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x7b')],null,util['format'](_0xbbcc('0x7d'),_0x89eaf0[_0xbbcc('0x71')],_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x7e')],_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x7b')],_0x89eaf0[_0xbbcc('0x79')][_0x2ad4c5][_0xbbcc('0x7c')]));}}}if(_0x89eaf0['conditions']){_0x89eaf0[_0xbbcc('0x7f')]=JSON['parse'](_0x89eaf0[_0xbbcc('0x7f')]);_0x57ae47['where'](_0x1a6e2d(_0x89eaf0[_0xbbcc('0x7f')][_0xbbcc('0x67')]));}_0x2b25dc=_0x57ae47[_0xbbcc('0x80')]();_0x57ae47[_0xbbcc('0x38')](_0x50e024);_0x57ae47[_0xbbcc('0x1c')](0x0);return;}})[_0xbbcc('0x23')](function(){if(_0x472c7b[_0xbbcc('0x90')]===_0xbbcc('0x91')){return null;}var _0x323c5a=_[_0xbbcc('0x3f')](_0x472c7b,{'name':_0x472c7b['fullPath']||_0x472c7b[_0xbbcc('0x2a')]||_0x89eaf0[_0xbbcc('0x2a')],'basename':_0x2b4c50,'savename':util[_0xbbcc('0x75')](_0xbbcc('0x92'),_0x472c7b['name']||_0x89eaf0['name'],require(_0xbbcc('0x93'))[_0xbbcc('0x94')](0x4),_0x472c7b['output']||_0xbbcc('0x95')),'reportId':_0x89eaf0['id'],'reportType':_0xbbcc('0x96')});return db['AnalyticExtractedReport'][_0xbbcc('0x49')](_0x323c5a,{'raw':!![]});})[_0xbbcc('0x23')](function(_0x186609){if(_0x89eaf0[_0xbbcc('0x71')]===_0xbbcc('0x97')){_0x2b25dc[_0xbbcc('0x3b')](_0x89eaf0[_0xbbcc('0x71')]+_0xbbcc('0x98'),_0x472c7b[_0xbbcc('0x99')],_0x472c7b['endDate']);}else{_0x2b25dc[_0xbbcc('0x3b')](_0x89eaf0[_0xbbcc('0x71')]+_0xbbcc('0x9a'),_0x472c7b[_0xbbcc('0x99')],_0x472c7b['endDate']);}if(_0x186609){logger[_0xbbcc('0x9b')](_0xbbcc('0x9c'),_0x2b25dc[_0xbbcc('0x83')]());require(_0xbbcc('0x9d'))[_0xbbcc('0x9e')](path[_0xbbcc('0x53')](__dirname,_0xbbcc('0x9f'),_0x186609[_0xbbcc('0x90')]),[_0x186609['id'],_0x2b25dc['toString'](),path['join'](__dirname,_0xbbcc('0xa0'),_0x186609[_0xbbcc('0xa1')]),_0x2b4c50]);return _0x186609;}else{var _0x8a81c2=squel['select']();_0x8a81c2[_0xbbcc('0x70')]('('+_0x2b25dc[_0xbbcc('0x83')]()+')','countTable');_0x8a81c2[_0xbbcc('0x68')]('COUNT(*)','count');_0x2b25dc[_0xbbcc('0x38')](_0x472c7b[_0xbbcc('0x38')]||_0x50e024);_0x2b25dc[_0xbbcc('0x1c')](_0x472c7b['offset']||0x0);return dbH[_0xbbcc('0x84')][_0xbbcc('0x33')](_0x8a81c2['toString'](),{'type':dbH['sequelize'][_0xbbcc('0x85')][_0xbbcc('0xa2')]})[_0xbbcc('0x23')](function(_0x39434e){if(!_0x39434e[_0xbbcc('0x37')]){_0x328716=0x0;}else{_0x328716=_0x39434e[0x0][_0xbbcc('0x1b')]||0x0;}return dbH[_0xbbcc('0x84')]['query'](_0x2b25dc[_0xbbcc('0x83')](),{'type':dbH[_0xbbcc('0x84')][_0xbbcc('0x85')][_0xbbcc('0xa2')]});})[_0xbbcc('0x23')](function(_0x47fe9b){return{'rows':_0x47fe9b||[],'count':_0x328716};});}});}exports[_0xbbcc('0xa3')]=function(_0x573b60,_0x289e15){return runReport(_0x573b60['params'],_0x573b60[_0xbbcc('0x33')],_0x573b60[_0xbbcc('0x40')])[_0xbbcc('0x23')](respondWithResult(_0x289e15,null))['catch'](handleError(_0x289e15,null));};exports[_0xbbcc('0xa4')]=runReport;exports[_0xbbcc('0x33')]=function(_0x182a3c,_0xbfe881){var _0x41e164=0xa;var _0x33c121=[_0xbbcc('0x53'),'left_join',_0xbbcc('0x55'),_0xbbcc('0x56')];var _0xf902d0={'SUM':_0xbbcc('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xbbcc('0x58'),'MAX':_0xbbcc('0x87'),'MIN':_0xbbcc('0x59'),'AVG':_0xbbcc('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbbcc('0x5c'),'GROUP_CONCAT DESC':_0xbbcc('0x88')};var _0x5b8196={'SEC_TO_TIME':_0xbbcc('0x5d'),'DATE':'DATE(%s)','HOUR':_0xbbcc('0x5f'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbbcc('0x61')};var _0x1cdef2=function(_0x6140e7){return!_[_0xbbcc('0x62')](['IS\x20NULL',_0xbbcc('0x64'),_0xbbcc('0x89'),'IS\x20NOT\x20EMPTY'],_0x6140e7);};var _0x5d743a=function(_0xaa1ba8){if(!_0xaa1ba8||!_0xaa1ba8['rules'][_0xbbcc('0x37')]){return'';}for(var _0x1d443d='(',_0x55b85b=0x0;_0x55b85b<_0xaa1ba8[_0xbbcc('0x65')][_0xbbcc('0x37')];_0x55b85b+=0x1){_0x55b85b>0x0&&(_0x1d443d+='\x20'+_0xaa1ba8['operator']+'\x20');_0x1d443d+=_0xaa1ba8[_0xbbcc('0x65')][_0x55b85b][_0xbbcc('0x67')]?_0x5d743a(_0xaa1ba8[_0xbbcc('0x65')][_0x55b85b][_0xbbcc('0x67')]):_0xaa1ba8['rules'][_0x55b85b][_0xbbcc('0x68')]+'\x20'+_0xaa1ba8['rules'][_0x55b85b]['condition']+(_0x1cdef2(_0xaa1ba8[_0xbbcc('0x65')][_0x55b85b][_0xbbcc('0x8b')])?'\x20'+_0xaa1ba8['rules'][_0x55b85b][_0xbbcc('0x8c')]:'');}return _0x1d443d+')';};var _0x32d7bd={'where':{'id':_0x182a3c[_0xbbcc('0x45')]['id']}},_0xc8e013,_0x441629,_0x230343,_0x1984cf,_0x2f1637;_0x32d7bd=_[_0xbbcc('0x3f')]({},_0x32d7bd,_0x182a3c[_0xbbcc('0x40')]);return db[_0xbbcc('0x2d')][_0xbbcc('0x48')](_0x32d7bd)[_0xbbcc('0x23')](function(_0x17cc87){if(_0x17cc87){_0xc8e013=_0x17cc87;return _0x17cc87['getFields']();}return null;})['then'](function(_0xfe6d7c){if(_0xfe6d7c){if(!_0xfe6d7c[_0xbbcc('0x37')]){throw new db[(_0xbbcc('0x6a'))][(_0xbbcc('0x6b'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x441629=_0xfe6d7c;return db[_0xbbcc('0x6d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0xba2481){if(_0xba2481){_0x230343=_[_0xbbcc('0x8d')](_0xba2481,'id');var _0x2345da;var _0x3c29bd=squel[_0xbbcc('0x6f')]();_0x3c29bd['from'](_0xc8e013[_0xbbcc('0x71')]);for(var _0x369305=0x0;_0x369305<_0x441629['length'];_0x369305+=0x1){_0x2345da=_0x441629[_0x369305][_0xbbcc('0x72')]?_0x230343[_0x441629[_0x369305][_0xbbcc('0x72')]]['metric']:_0x441629[_0x369305]['field'];_0x2345da=_0x441629[_0x369305]['function']?_[_0xbbcc('0x74')](_0xf902d0[_0x441629[_0x369305][_0xbbcc('0x73')]],'%s',_0x2345da):_0x2345da;_0x2345da=_0x441629[_0x369305]['format']?_[_0xbbcc('0x74')](_0x5b8196[_0x441629[_0x369305][_0xbbcc('0x75')]],'%s',_0x2345da):_0x2345da;if(_0x441629[_0x369305]['groupBy']){_0x3c29bd['group'](_0x2345da);}_0x441629[_0x369305][_0xbbcc('0x77')]&&_0x3c29bd[_0xbbcc('0x39')](_0x2345da,_0x441629[_0x369305][_0xbbcc('0x77')]==='DESC'?![]:!![]);_0x3c29bd[_0xbbcc('0x68')](_0x2345da,_0x441629[_0x369305][_0xbbcc('0x8f')]||_0x2345da);}if(_0xc8e013[_0xbbcc('0x79')]){_0xc8e013[_0xbbcc('0x79')]=JSON[_0xbbcc('0x7a')](_0xc8e013[_0xbbcc('0x79')]);for(var _0x4b800c=0x0;_0x4b800c<_0xc8e013[_0xbbcc('0x79')][_0xbbcc('0x37')];_0x4b800c+=0x1){if(_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x30')]&&_['includes'](_0x33c121,_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x30')])&&_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x7e')]&&_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x7b')]&&_0xc8e013[_0xbbcc('0x79')][_0x4b800c]['foreignKey']){_0x3c29bd[_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x30')]](_0xc8e013['joins'][_0x4b800c][_0xbbcc('0x7b')],null,util[_0xbbcc('0x75')](_0xbbcc('0x7d'),_0xc8e013[_0xbbcc('0x71')],_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x7e')],_0xc8e013[_0xbbcc('0x79')][_0x4b800c][_0xbbcc('0x7b')],_0xc8e013['joins'][_0x4b800c][_0xbbcc('0x7c')]));}}}if(_0xc8e013['conditions']){_0xc8e013[_0xbbcc('0x7f')]=JSON[_0xbbcc('0x7a')](_0xc8e013['conditions']);_0x3c29bd[_0xbbcc('0x3b')](_0x5d743a(_0xc8e013[_0xbbcc('0x7f')][_0xbbcc('0x67')]));}_0x2f1637=_0x3c29bd['clone']();_0x3c29bd[_0xbbcc('0x38')](_0x41e164);_0x3c29bd[_0xbbcc('0x1c')](0x0);logger['debug'](_0xbbcc('0x82'),_0x3c29bd[_0xbbcc('0x83')]());return dbH[_0xbbcc('0x84')]['query'](_0x3c29bd['toString'](),{'type':dbH['sequelize'][_0xbbcc('0x85')][_0xbbcc('0xa2')]});}})['then'](function(){return{'sql':_0x2f1637[_0xbbcc('0x83')]()};})[_0xbbcc('0x23')](respondWithResult(_0xbfe881,null))[_0xbbcc('0x43')](handleError(_0xbfe881,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index b4956b3..9cf62de 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 _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 +var _0x4833=['define','analytics_default_reports','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports'];(function(_0x1e91d7,_0x562013){var _0x5f0025=function(_0x2ad4ab){while(--_0x2ad4ab){_0x1e91d7['push'](_0x1e91d7['shift']());}};_0x5f0025(++_0x562013);}(_0x4833,0xd4));var _0x3483=function(_0x28cbc0,_0x203516){_0x28cbc0=_0x28cbc0-0x0;var _0x4b3cf5=_0x4833[_0x28cbc0];return _0x4b3cf5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3483('0x0'))(_0x3483('0x1'));var moment=require(_0x3483('0x2'));var BPromise=require('bluebird');var rp=require(_0x3483('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3483('0x4'));var config=require(_0x3483('0x5'));var attributes=require(_0x3483('0x6'));module[_0x3483('0x7')]=function(_0x181773,_0x28eea3){return _0x181773[_0x3483('0x8')]('AnalyticDefaultReport',attributes,{'tableName':_0x3483('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index b8aef9b..e5ed64c 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 _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 +var _0xa1b9=['request','then','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x2e31a1,_0x25e655){var _0xb4fbb1=function(_0x5aa46a){while(--_0x5aa46a){_0x2e31a1['push'](_0x2e31a1['shift']());}};_0xb4fbb1(++_0x25e655);}(_0xa1b9,0x71));var _0x9a1b=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa1b9[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x9a1b('0x0'));var util=require('util');var moment=require(_0x9a1b('0x1'));var BPromise=require(_0x9a1b('0x2'));var rs=require(_0x9a1b('0x3'));var fs=require('fs');var Redis=require(_0x9a1b('0x4'));var db=require(_0x9a1b('0x5'))['db'];var utils=require(_0x9a1b('0x6'));var logger=require(_0x9a1b('0x7'))('rpc');var config=require(_0x9a1b('0x8'));var jayson=require(_0x9a1b('0x9'));var client=jayson[_0x9a1b('0xa')][_0x9a1b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47cb95,_0x185401,_0x534151){return new BPromise(function(_0x17b671,_0x4387ac){return client[_0x9a1b('0xc')](_0x47cb95,_0x534151)[_0x9a1b('0xd')](function(_0x1ddb9e){logger['info'](_0x9a1b('0xe'),_0x185401,_0x9a1b('0xf'));logger[_0x9a1b('0x10')](_0x9a1b('0x11'),_0x185401,_0x9a1b('0xf'),JSON[_0x9a1b('0x12')](_0x1ddb9e));if(_0x1ddb9e[_0x9a1b('0x13')]){if(_0x1ddb9e['error'][_0x9a1b('0x14')]===0x1f4){logger[_0x9a1b('0x13')](_0x9a1b('0xe'),_0x185401,_0x1ddb9e['error'][_0x9a1b('0x15')]);return _0x4387ac(_0x1ddb9e[_0x9a1b('0x13')][_0x9a1b('0x15')]);}logger[_0x9a1b('0x13')](_0x9a1b('0xe'),_0x185401,_0x1ddb9e[_0x9a1b('0x13')][_0x9a1b('0x15')]);return _0x17b671(_0x1ddb9e[_0x9a1b('0x13')][_0x9a1b('0x15')]);}else{logger[_0x9a1b('0x16')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x185401,_0x9a1b('0xf'));_0x17b671(_0x1ddb9e[_0x9a1b('0x17')]['message']);}})[_0x9a1b('0x18')](function(_0xbac830){logger[_0x9a1b('0x13')](_0x9a1b('0xe'),_0x185401,_0xbac830);_0x4387ac(_0xbac830);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 390d4b7..5fa444e 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 _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 +var _0x388c=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','show','/:id/preview','/:id/run','run','/:id/query','create','put','/:id','delete'];(function(_0x412a9b,_0x279575){var _0x41d9e5=function(_0x11d856){while(--_0x11d856){_0x412a9b['push'](_0x412a9b['shift']());}};_0x41d9e5(++_0x279575);}(_0x388c,0xff));var _0xc388=function(_0x1ada9d,_0x326655){_0x1ada9d=_0x1ada9d-0x0;var _0x66110=_0x388c[_0x1ada9d];return _0x66110;};'use strict';var multer=require(_0xc388('0x0'));var util=require(_0xc388('0x1'));var path=require(_0xc388('0x2'));var timeout=require(_0xc388('0x3'));var express=require('express');var router=express[_0xc388('0x4')]();var auth=require(_0xc388('0x5'));var interaction=require(_0xc388('0x6'));var config=require(_0xc388('0x7'));var controller=require(_0xc388('0x8'));router['get']('/',auth[_0xc388('0x9')](),controller[_0xc388('0xa')]);router[_0xc388('0xb')]('/:id',auth[_0xc388('0x9')](),controller[_0xc388('0xc')]);router['get'](_0xc388('0xd'),auth[_0xc388('0x9')](),controller['preview']);router['get'](_0xc388('0xe'),auth['isAuthenticated'](),controller[_0xc388('0xf')]);router['get'](_0xc388('0x10'),auth[_0xc388('0x9')](),controller['query']);router['post']('/',auth[_0xc388('0x9')](),controller[_0xc388('0x11')]);router[_0xc388('0x12')](_0xc388('0x13'),auth[_0xc388('0x9')](),controller['update']);router[_0xc388('0x14')](_0xc388('0x13'),auth[_0xc388('0x9')](),controller[_0xc388('0x15')]);module[_0xc388('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f78cf49..09d222c 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 _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 +var _0x072e=['sequelize','moment','STRING','ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x72d276,_0x5c0a71){var _0x295b10=function(_0x2b43f5){while(--_0x2b43f5){_0x72d276['push'](_0x72d276['shift']());}};_0x295b10(++_0x5c0a71);}(_0x072e,0x108));var _0xe072=function(_0xb4572c,_0x1bce60){_0xb4572c=_0xb4572c-0x0;var _0x1ff13b=_0x072e[_0xb4572c];return _0x1ff13b;};'use strict';var Sequelize=require(_0xe072('0x0'));var moment=require(_0xe072('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0xe072('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xe072('0x3')](_0xe072('0x4'),'pdf',_0xe072('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xe072('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xe072('0x6')]},'endDate':{'type':Sequelize[_0xe072('0x6')]},'status':{'type':Sequelize[_0xe072('0x2')],'defaultValue':_0xe072('0x7')},'type':{'type':Sequelize[_0xe072('0x3')](_0xe072('0x8'),_0xe072('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xe072('0xa')](0xb)[_0xe072('0xb')]},'reportType':{'type':Sequelize[_0xe072('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 4fd74ed..227d2b8 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 _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 +var _0xfb50=['basename','toLowerCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','error','stack','name','send','index','AnalyticExtractedReport','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','download','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s'];(function(_0x50a118,_0x76c03e){var _0x128bf4=function(_0x5ae1b4){while(--_0x5ae1b4){_0x50a118['push'](_0x50a118['shift']());}};_0x128bf4(++_0x76c03e);}(_0xfb50,0xca));var _0x0fb5=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xfb50[_0x2f1762];return _0x8ab21;};'use strict';var pdf=require(_0x0fb5('0x0'));var emlformat=require(_0x0fb5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0fb5('0x2'));var jsonpatch=require(_0x0fb5('0x3'));var rp=require(_0x0fb5('0x4'));var moment=require(_0x0fb5('0x5'));var BPromise=require(_0x0fb5('0x6'));var Mustache=require(_0x0fb5('0x7'));var util=require(_0x0fb5('0x8'));var path=require(_0x0fb5('0x9'));var sox=require(_0x0fb5('0xa'));var csv=require(_0x0fb5('0xb'));var ejs=require(_0x0fb5('0xc'));var fs=require('fs');var _=require(_0x0fb5('0xd'));var squel=require(_0x0fb5('0xe'));var crypto=require(_0x0fb5('0xf'));var jsforce=require(_0x0fb5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x0fb5('0xb'));var querystring=require(_0x0fb5('0x11'));var Papa=require(_0x0fb5('0x12'));var Redis=require(_0x0fb5('0x13'));var authService=require(_0x0fb5('0x14'));var qs=require(_0x0fb5('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fb5('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x0fb5('0x17'));var config=require(_0x0fb5('0x18'));var licenseUtil=require(_0x0fb5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x561ae6,_0x3be36e){_0x3be36e=_0x3be36e||0xcc;return function(_0x4f1015){if(_0x4f1015){return _0x561ae6[_0x0fb5('0x1a')](_0x3be36e);}return _0x561ae6['status'](_0x3be36e)[_0x0fb5('0x1b')]();};}function respondWithResult(_0x57a927,_0x674405){_0x674405=_0x674405||0xc8;return function(_0x21f38f){if(_0x21f38f){return _0x57a927[_0x0fb5('0x1c')](_0x674405)[_0x0fb5('0x1d')](_0x21f38f);}};}function respondWithFilteredResult(_0x2f124f,_0x3b1ed7){return function(_0x2b2f25){if(_0x2b2f25){var _0x2d3dc2=_0x2b2f25[_0x0fb5('0x1e')],_0x50afef=_0x3b1ed7[_0x0fb5('0x1f')],_0x4aac53=_0x3b1ed7['offset']+_0x3b1ed7['limit'],_0x5caf37;if(_0x4aac53>=_0x2d3dc2){_0x4aac53=_0x2d3dc2;_0x5caf37=0xc8;}else{_0x5caf37=0xce;}_0x2f124f['status'](_0x5caf37);return _0x2f124f['set']('Content-Range',_0x50afef+'-'+_0x4aac53+'/'+_0x2d3dc2)[_0x0fb5('0x1d')](_0x2b2f25);}return null;};}function patchUpdates(_0x32169f){return function(_0x116853){try{jsonpatch[_0x0fb5('0x20')](_0x116853,_0x32169f,!![]);}catch(_0x4c01ae){return BPromise[_0x0fb5('0x21')](_0x4c01ae);}return _0x116853[_0x0fb5('0x22')]();};}function saveUpdates(_0x11ff2d,_0x124c79){return function(_0x18f238){if(_0x18f238){return _0x18f238[_0x0fb5('0x23')](_0x11ff2d)['then'](function(_0x4c232c){return _0x4c232c;});}return null;};}function removeEntity(_0x4690de,_0x48702a){return function(_0x4e5149){if(_0x4e5149){return _0x4e5149['destroy']()[_0x0fb5('0x24')](function(){var _0x303919=_0x4e5149[_0x0fb5('0x25')]({'plain':!![]});var _0x5a95c6=_0x0fb5('0x26');return db[_0x0fb5('0x27')]['destroy']({'where':{'type':_0x5a95c6,'resourceId':_0x303919['id']}})[_0x0fb5('0x24')](function(){return _0x4e5149;});})[_0x0fb5('0x24')](function(){_0x4690de['status'](0xcc)[_0x0fb5('0x1b')]();});}};}function handleEntityNotFound(_0x473bd1,_0x2340f8){return function(_0xfdaf1){if(!_0xfdaf1){_0x473bd1[_0x0fb5('0x1a')](0x194);}return _0xfdaf1;};}function handleError(_0x315506,_0x5f0adf){_0x5f0adf=_0x5f0adf||0x1f4;return function(_0xd915d1){logger[_0x0fb5('0x28')](_0xd915d1[_0x0fb5('0x29')]);if(_0xd915d1[_0x0fb5('0x2a')]){delete _0xd915d1['name'];}_0x315506[_0x0fb5('0x1c')](_0x5f0adf)[_0x0fb5('0x2b')](_0xd915d1);};}exports[_0x0fb5('0x2c')]=function(_0x215d42,_0x512e45){var _0x4469ae={},_0x2d77ab={},_0x1e3a3c={'count':0x0,'rows':[]};var _0x396068=_['map'](db[_0x0fb5('0x2d')][_0x0fb5('0x2e')],function(_0x2c4b7a){return{'name':_0x2c4b7a[_0x0fb5('0x2f')],'type':_0x2c4b7a['type'][_0x0fb5('0x30')]};});_0x2d77ab[_0x0fb5('0x31')]=_[_0x0fb5('0x32')](_0x396068,'name');_0x2d77ab[_0x0fb5('0x33')]=_['keys'](_0x215d42[_0x0fb5('0x33')]);_0x2d77ab[_0x0fb5('0x34')]=_['intersection'](_0x2d77ab['model'],_0x2d77ab['query']);_0x4469ae[_0x0fb5('0x35')]=_[_0x0fb5('0x36')](_0x2d77ab[_0x0fb5('0x31')],qs[_0x0fb5('0x37')](_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x37')]));_0x4469ae['attributes']=_0x4469ae[_0x0fb5('0x35')][_0x0fb5('0x38')]?_0x4469ae['attributes']:_0x2d77ab[_0x0fb5('0x31')];if(!_0x215d42['query'][_0x0fb5('0x39')](_0x0fb5('0x3a'))){_0x4469ae[_0x0fb5('0x3b')]=qs[_0x0fb5('0x3b')](_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x3b')]);_0x4469ae[_0x0fb5('0x1f')]=qs[_0x0fb5('0x1f')](_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x1f')]);}_0x4469ae[_0x0fb5('0x3c')]=qs[_0x0fb5('0x3d')](_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x3d')]);_0x4469ae[_0x0fb5('0x3e')]=qs['filters'](_[_0x0fb5('0x3f')](_0x215d42[_0x0fb5('0x33')],_0x2d77ab[_0x0fb5('0x34')]),_0x396068);if(_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x40')]){_0x4469ae[_0x0fb5('0x3e')]=_[_0x0fb5('0x41')](_0x4469ae[_0x0fb5('0x3e')],{'$or':_[_0x0fb5('0x32')](_0x396068,function(_0xeb9ca7){if(_0xeb9ca7[_0x0fb5('0x42')]!=='VIRTUAL'){var _0x46b480={};_0x46b480[_0xeb9ca7['name']]={'$like':'%'+_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x40')]+'%'};return _0x46b480;}})});}_0x4469ae=_[_0x0fb5('0x41')]({},_0x4469ae,_0x215d42[_0x0fb5('0x43')]);var _0x4f3a54={'where':_0x4469ae[_0x0fb5('0x3e')]};return db[_0x0fb5('0x2d')]['count'](_0x4f3a54)[_0x0fb5('0x24')](function(_0x12931c){_0x1e3a3c[_0x0fb5('0x1e')]=_0x12931c;if(_0x215d42[_0x0fb5('0x33')][_0x0fb5('0x44')]){_0x4469ae[_0x0fb5('0x45')]=[{'all':!![]}];}return db[_0x0fb5('0x2d')][_0x0fb5('0x46')](_0x4469ae);})['then'](function(_0x121120){_0x1e3a3c[_0x0fb5('0x47')]=_0x121120;return _0x1e3a3c;})[_0x0fb5('0x24')](respondWithFilteredResult(_0x512e45,_0x4469ae))[_0x0fb5('0x48')](handleError(_0x512e45,null));};exports[_0x0fb5('0x49')]=function(_0x549433,_0x273c07){var _0x2bdaa3={'raw':!![],'where':{'id':_0x549433[_0x0fb5('0x4a')]['id']}},_0xbd32ee={};_0xbd32ee[_0x0fb5('0x31')]=_['keys'](db[_0x0fb5('0x2d')][_0x0fb5('0x2e')]);_0xbd32ee[_0x0fb5('0x33')]=_[_0x0fb5('0x4b')](_0x549433[_0x0fb5('0x33')]);_0xbd32ee[_0x0fb5('0x34')]=_[_0x0fb5('0x36')](_0xbd32ee[_0x0fb5('0x31')],_0xbd32ee[_0x0fb5('0x33')]);_0x2bdaa3[_0x0fb5('0x35')]=_[_0x0fb5('0x36')](_0xbd32ee[_0x0fb5('0x31')],qs[_0x0fb5('0x37')](_0x549433[_0x0fb5('0x33')][_0x0fb5('0x37')]));_0x2bdaa3['attributes']=_0x2bdaa3['attributes'][_0x0fb5('0x38')]?_0x2bdaa3[_0x0fb5('0x35')]:_0xbd32ee[_0x0fb5('0x31')];if(_0x549433[_0x0fb5('0x33')][_0x0fb5('0x44')]){_0x2bdaa3[_0x0fb5('0x45')]=[{'all':!![]}];}_0x2bdaa3=_[_0x0fb5('0x41')]({},_0x2bdaa3,_0x549433[_0x0fb5('0x43')]);return db[_0x0fb5('0x2d')][_0x0fb5('0x4c')](_0x2bdaa3)[_0x0fb5('0x24')](handleEntityNotFound(_0x273c07,null))[_0x0fb5('0x24')](respondWithResult(_0x273c07,null))[_0x0fb5('0x48')](handleError(_0x273c07,null));};exports[_0x0fb5('0x4d')]=function(_0x26bf89,_0x183111){return db[_0x0fb5('0x2d')][_0x0fb5('0x4d')](_0x26bf89[_0x0fb5('0x4e')],{})[_0x0fb5('0x24')](function(_0x5261d2){var _0x4c3e89=_0x26bf89['user']['get']({'plain':!![]});if(!_0x4c3e89)throw new Error(_0x0fb5('0x4f'));if(_0x4c3e89[_0x0fb5('0x50')]===_0x0fb5('0x51')){var _0x38ff48=_0x5261d2[_0x0fb5('0x25')]({'plain':!![]});var _0x138d8e=_0x0fb5('0x26');return db[_0x0fb5('0x52')][_0x0fb5('0x4c')]({'where':{'name':_0x138d8e,'userProfileId':_0x4c3e89[_0x0fb5('0x53')]},'raw':!![]})[_0x0fb5('0x24')](function(_0x8e80ad){if(_0x8e80ad&&_0x8e80ad[_0x0fb5('0x54')]===0x0){return db[_0x0fb5('0x27')][_0x0fb5('0x4d')]({'name':_0x38ff48[_0x0fb5('0x2a')],'resourceId':_0x38ff48['id'],'type':_0x8e80ad[_0x0fb5('0x2a')],'sectionId':_0x8e80ad['id']},{})[_0x0fb5('0x24')](function(){return _0x5261d2;});}else{return _0x5261d2;}})['catch'](function(_0x3c2b3f){logger[_0x0fb5('0x28')](_0x0fb5('0x55'),_0x3c2b3f);throw _0x3c2b3f;});}return _0x5261d2;})['then'](respondWithResult(_0x183111,0xc9))[_0x0fb5('0x48')](handleError(_0x183111,null));};exports['update']=function(_0x9cc91c,_0x2e78fa){if(_0x9cc91c[_0x0fb5('0x4e')]['id']){delete _0x9cc91c['body']['id'];}return db[_0x0fb5('0x2d')][_0x0fb5('0x4c')]({'where':{'id':_0x9cc91c[_0x0fb5('0x4a')]['id']}})[_0x0fb5('0x24')](handleEntityNotFound(_0x2e78fa,null))[_0x0fb5('0x24')](saveUpdates(_0x9cc91c['body'],null))[_0x0fb5('0x24')](respondWithResult(_0x2e78fa,null))[_0x0fb5('0x48')](handleError(_0x2e78fa,null));};exports[_0x0fb5('0x56')]=function(_0x55e91d,_0x5bb099){return db[_0x0fb5('0x2d')][_0x0fb5('0x4c')]({'where':{'id':_0x55e91d[_0x0fb5('0x4a')]['id']}})[_0x0fb5('0x24')](handleEntityNotFound(_0x5bb099,null))[_0x0fb5('0x24')](removeEntity(_0x5bb099,null))[_0x0fb5('0x48')](handleError(_0x5bb099,null));};exports[_0x0fb5('0x57')]=function(_0x303627,_0x1ec303,_0x4ac7bb){return db[_0x0fb5('0x2d')][_0x0fb5('0x4c')]({'where':{'id':_0x303627[_0x0fb5('0x4a')]['id']},'attributes':[_0x0fb5('0x2a'),'basename',_0x0fb5('0x58'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x1ec303,null))[_0x0fb5('0x24')](function(_0x2aac35){if(_0x2aac35){if(!fs[_0x0fb5('0x59')](path[_0x0fb5('0x5a')](config[_0x0fb5('0x5b')],_0x0fb5('0x5c'),_0x2aac35['savename']))){throw new db[(_0x0fb5('0x5d'))][(_0x0fb5('0x5e'))](_0x0fb5('0x5f'));}if(_0x303627[_0x0fb5('0x33')][_0x0fb5('0x60')]){return _0x1ec303[_0x0fb5('0x1a')](0xc8);}return _0x1ec303[_0x0fb5('0x57')](path['join'](config['root'],_0x0fb5('0x5c'),_0x2aac35[_0x0fb5('0x58')]),util['format'](_0x0fb5('0x61'),_0x2aac35[_0x0fb5('0x62')]||_0x2aac35[_0x0fb5('0x2a')],_0x2aac35['output'][_0x0fb5('0x63')]()));}})['catch'](handleError(_0x1ec303,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 0b17c53..a9cd13f 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 _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 +var _0xb6ba=['lodash','../../config/logger','path','../../config/environment','exports','define','AnalyticExtractedReport'];(function(_0x26baa,_0x538511){var _0x46585a=function(_0xff1126){while(--_0xff1126){_0x26baa['push'](_0x26baa['shift']());}};_0x46585a(++_0x538511);}(_0xb6ba,0x1b2));var _0xab6b=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0xb6ba[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0xab6b('0x0'));var util=require('util');var logger=require(_0xab6b('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab6b('0x2'));var rimraf=require('rimraf');var config=require(_0xab6b('0x3'));var attributes=require('./analyticExtractedReport.attributes');module[_0xab6b('0x4')]=function(_0x71bae7,_0x1e27d3){return _0x71bae7[_0xab6b('0x5')](_0xab6b('0x6'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 296142c..9af56b0 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 _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 +var _0x7cae=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x7cae,0x1b2));var _0xe7ca=function(_0x28a1f6,_0x14543e){_0x28a1f6=_0x28a1f6-0x0;var _0x4a7ede=_0x7cae[_0x28a1f6];return _0x4a7ede;};'use strict';var _=require(_0xe7ca('0x0'));var util=require(_0xe7ca('0x1'));var moment=require(_0xe7ca('0x2'));var BPromise=require(_0xe7ca('0x3'));var rs=require(_0xe7ca('0x4'));var fs=require('fs');var Redis=require(_0xe7ca('0x5'));var db=require(_0xe7ca('0x6'))['db'];var utils=require(_0xe7ca('0x7'));var logger=require(_0xe7ca('0x8'))(_0xe7ca('0x9'));var config=require(_0xe7ca('0xa'));var jayson=require(_0xe7ca('0xb'));var client=jayson[_0xe7ca('0xc')][_0xe7ca('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x160eea,_0x182dfe,_0x505345){return new BPromise(function(_0x3b4b4a,_0x35afdb){return client[_0xe7ca('0xe')](_0x160eea,_0x505345)[_0xe7ca('0xf')](function(_0x23c865){logger[_0xe7ca('0x10')](_0xe7ca('0x11'),_0x182dfe,_0xe7ca('0x12'));logger[_0xe7ca('0x13')](_0xe7ca('0x14'),_0x182dfe,_0xe7ca('0x12'),JSON[_0xe7ca('0x15')](_0x23c865));if(_0x23c865['error']){if(_0x23c865['error'][_0xe7ca('0x16')]===0x1f4){logger[_0xe7ca('0x17')](_0xe7ca('0x11'),_0x182dfe,_0x23c865['error'][_0xe7ca('0x18')]);return _0x35afdb(_0x23c865[_0xe7ca('0x17')][_0xe7ca('0x18')]);}logger[_0xe7ca('0x17')](_0xe7ca('0x11'),_0x182dfe,_0x23c865[_0xe7ca('0x17')]['message']);return _0x3b4b4a(_0x23c865[_0xe7ca('0x17')][_0xe7ca('0x18')]);}else{logger[_0xe7ca('0x10')](_0xe7ca('0x11'),_0x182dfe,_0xe7ca('0x12'));_0x3b4b4a(_0x23c865['result'][_0xe7ca('0x18')]);}})[_0xe7ca('0x19')](function(_0x5ceee2){logger[_0xe7ca('0x17')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x182dfe,_0x5ceee2);_0x35afdb(_0x5ceee2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1a23535..1d02235 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 _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 +var _0xd353=['connect-timeout','express','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','delete','multer','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd353,0x7e));var _0x3d35=function(_0x37b1b1,_0x3876ef){_0x37b1b1=_0x37b1b1-0x0;var _0x334f3b=_0xd353[_0x37b1b1];return _0x334f3b;};'use strict';var multer=require(_0x3d35('0x0'));var util=require(_0x3d35('0x1'));var path=require('path');var timeout=require(_0x3d35('0x2'));var express=require(_0x3d35('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3d35('0x4'));var config=require('../../config/environment');var controller=require(_0x3d35('0x5'));router[_0x3d35('0x6')]('/',auth[_0x3d35('0x7')](),controller[_0x3d35('0x8')]);router[_0x3d35('0x6')](_0x3d35('0x9'),auth[_0x3d35('0x7')](),controller['show']);router[_0x3d35('0x6')](_0x3d35('0xa'),auth[_0x3d35('0x7')](),controller[_0x3d35('0xb')]);router[_0x3d35('0xc')]('/',auth[_0x3d35('0x7')](),controller[_0x3d35('0xd')]);router[_0x3d35('0xe')](_0x3d35('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3d35('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 15f2c97..1820f6b 100644 --- a/server/api/analyticFieldReport/analyticFieldReport.attributes.js +++ b/server/api/analyticFieldReport/analyticFieldReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['exports','TEXT','STRING','sequelize'];(function(_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 +var _0x814b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x228d7c,_0xf01e7d){var _0x1ffa97=function(_0x5418dd){while(--_0x5418dd){_0x228d7c['push'](_0x228d7c['shift']());}};_0x1ffa97(++_0xf01e7d);}(_0x814b,0x1a2));var _0xb814=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x814b[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'field':{'type':Sequelize[_0xb814('0x2')]},'alias':{'type':Sequelize[_0xb814('0x3')]},'function':{'type':Sequelize[_0xb814('0x3')]},'format':{'type':Sequelize[_0xb814('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb814('0x3')]},'custom':{'type':Sequelize[_0xb814('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 5390244..d25fef2 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 _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 +var _0x4817=['merge','VIRTUAL','options','findAll','rows','show','params','intersection','includeAll','find','create','body','catch','bulkCreate','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x500aeb,_0x29fdba){var _0x5f3052=function(_0x415fc8){while(--_0x415fc8){_0x500aeb['push'](_0x500aeb['shift']());}};_0x5f3052(++_0x29fdba);}(_0x4817,0x160));var _0x7481=function(_0x5a9001,_0x4fabba){_0x5a9001=_0x5a9001-0x0;var _0x4c263d=_0x4817[_0x5a9001];return _0x4c263d;};'use strict';var pdf=require(_0x7481('0x0'));var emlformat=require(_0x7481('0x1'));var rimraf=require(_0x7481('0x2'));var zipdir=require(_0x7481('0x3'));var jsonpatch=require(_0x7481('0x4'));var rp=require(_0x7481('0x5'));var moment=require('moment');var BPromise=require(_0x7481('0x6'));var Mustache=require(_0x7481('0x7'));var util=require(_0x7481('0x8'));var path=require(_0x7481('0x9'));var sox=require(_0x7481('0xa'));var csv=require(_0x7481('0xb'));var ejs=require(_0x7481('0xc'));var fs=require('fs');var _=require(_0x7481('0xd'));var squel=require(_0x7481('0xe'));var crypto=require(_0x7481('0xf'));var jsforce=require(_0x7481('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x7481('0xb'));var querystring=require(_0x7481('0x11'));var Papa=require(_0x7481('0x12'));var Redis=require(_0x7481('0x13'));var authService=require(_0x7481('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7481('0x15'));var hardwareService=require(_0x7481('0x16'));var logger=require('../../config/logger')(_0x7481('0x17'));var utils=require('../../config/utils');var config=require(_0x7481('0x18'));var licenseUtil=require(_0x7481('0x19'));var db=require(_0x7481('0x1a'))['db'];function respondWithStatusCode(_0x10594f,_0x8392f7){_0x8392f7=_0x8392f7||0xcc;return function(_0x32bdab){if(_0x32bdab){return _0x10594f[_0x7481('0x1b')](_0x8392f7);}return _0x10594f[_0x7481('0x1c')](_0x8392f7)['end']();};}function respondWithResult(_0x3b1605,_0x10050a){_0x10050a=_0x10050a||0xc8;return function(_0x570864){if(_0x570864){return _0x3b1605[_0x7481('0x1c')](_0x10050a)[_0x7481('0x1d')](_0x570864);}};}function respondWithFilteredResult(_0x343955,_0x13b02d){return function(_0x48177){if(_0x48177){var _0x36e805=_0x48177[_0x7481('0x1e')],_0x305b1f=_0x13b02d[_0x7481('0x1f')],_0x5d259f=_0x13b02d[_0x7481('0x1f')]+_0x13b02d[_0x7481('0x20')],_0x4c56f2;if(_0x5d259f>=_0x36e805){_0x5d259f=_0x36e805;_0x4c56f2=0xc8;}else{_0x4c56f2=0xce;}_0x343955['status'](_0x4c56f2);return _0x343955['set'](_0x7481('0x21'),_0x305b1f+'-'+_0x5d259f+'/'+_0x36e805)[_0x7481('0x1d')](_0x48177);}return null;};}function patchUpdates(_0xa46eb0){return function(_0x540032){try{jsonpatch['apply'](_0x540032,_0xa46eb0,!![]);}catch(_0xb77fb7){return BPromise[_0x7481('0x22')](_0xb77fb7);}return _0x540032[_0x7481('0x23')]();};}function saveUpdates(_0x44207e,_0x33ae43){return function(_0x76fbf7){if(_0x76fbf7){return _0x76fbf7[_0x7481('0x24')](_0x44207e)[_0x7481('0x25')](function(_0x7b9143){return _0x7b9143;});}return null;};}function removeEntity(_0x57bd40,_0x541d05){return function(_0x12f5eb){if(_0x12f5eb){return _0x12f5eb[_0x7481('0x26')]()[_0x7481('0x25')](function(){_0x57bd40[_0x7481('0x1c')](0xcc)[_0x7481('0x27')]();});}};}function handleEntityNotFound(_0x451aea,_0xbca000){return function(_0xe2b8bb){if(!_0xe2b8bb){_0x451aea['sendStatus'](0x194);}return _0xe2b8bb;};}function handleError(_0x1c5f54,_0x2750e8){_0x2750e8=_0x2750e8||0x1f4;return function(_0xb55cee){logger[_0x7481('0x28')](_0xb55cee[_0x7481('0x29')]);if(_0xb55cee['name']){delete _0xb55cee[_0x7481('0x2a')];}_0x1c5f54[_0x7481('0x1c')](_0x2750e8)[_0x7481('0x2b')](_0xb55cee);};}exports['index']=function(_0x5c255f,_0x1ad59f){var _0x317f11={},_0x1c80a6={},_0x5825e7={'count':0x0,'rows':[]};var _0x91960f=_[_0x7481('0x2c')](db[_0x7481('0x2d')]['rawAttributes'],function(_0x3dd8ad){return{'name':_0x3dd8ad[_0x7481('0x2e')],'type':_0x3dd8ad[_0x7481('0x2f')][_0x7481('0x30')]};});_0x1c80a6[_0x7481('0x31')]=_[_0x7481('0x2c')](_0x91960f,_0x7481('0x2a'));_0x1c80a6[_0x7481('0x32')]=_[_0x7481('0x33')](_0x5c255f['query']);_0x1c80a6[_0x7481('0x34')]=_['intersection'](_0x1c80a6['model'],_0x1c80a6[_0x7481('0x32')]);_0x317f11[_0x7481('0x35')]=_['intersection'](_0x1c80a6['model'],qs[_0x7481('0x36')](_0x5c255f[_0x7481('0x32')]['fields']));_0x317f11['attributes']=_0x317f11[_0x7481('0x35')][_0x7481('0x37')]?_0x317f11[_0x7481('0x35')]:_0x1c80a6[_0x7481('0x31')];if(!_0x5c255f[_0x7481('0x32')][_0x7481('0x38')](_0x7481('0x39'))){_0x317f11[_0x7481('0x20')]=qs[_0x7481('0x20')](_0x5c255f[_0x7481('0x32')][_0x7481('0x20')]);_0x317f11[_0x7481('0x1f')]=qs[_0x7481('0x1f')](_0x5c255f[_0x7481('0x32')][_0x7481('0x1f')]);}_0x317f11[_0x7481('0x3a')]=qs[_0x7481('0x3b')](_0x5c255f[_0x7481('0x32')][_0x7481('0x3b')]);_0x317f11[_0x7481('0x3c')]=qs['filters'](_[_0x7481('0x3d')](_0x5c255f['query'],_0x1c80a6[_0x7481('0x34')]),_0x91960f);if(_0x5c255f[_0x7481('0x32')][_0x7481('0x3e')]){_0x317f11[_0x7481('0x3c')]=_[_0x7481('0x3f')](_0x317f11[_0x7481('0x3c')],{'$or':_['map'](_0x91960f,function(_0x59e911){if(_0x59e911[_0x7481('0x2f')]!==_0x7481('0x40')){var _0x4fd038={};_0x4fd038[_0x59e911['name']]={'$like':'%'+_0x5c255f[_0x7481('0x32')][_0x7481('0x3e')]+'%'};return _0x4fd038;}})});}_0x317f11=_[_0x7481('0x3f')]({},_0x317f11,_0x5c255f[_0x7481('0x41')]);var _0x49de9d={'where':_0x317f11[_0x7481('0x3c')]};return db['AnalyticFieldReport'][_0x7481('0x1e')](_0x49de9d)[_0x7481('0x25')](function(_0x2c4b0d){_0x5825e7[_0x7481('0x1e')]=_0x2c4b0d;if(_0x5c255f[_0x7481('0x32')]['includeAll']){_0x317f11['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0x7481('0x42')](_0x317f11);})[_0x7481('0x25')](function(_0xf1fa7f){_0x5825e7[_0x7481('0x43')]=_0xf1fa7f;return _0x5825e7;})['then'](respondWithFilteredResult(_0x1ad59f,_0x317f11))['catch'](handleError(_0x1ad59f,null));};exports[_0x7481('0x44')]=function(_0x2a84b1,_0xc28f17){var _0x1fd520={'raw':![],'where':{'id':_0x2a84b1[_0x7481('0x45')]['id']}},_0x1092c8={};_0x1092c8[_0x7481('0x31')]=_['keys'](db[_0x7481('0x2d')]['rawAttributes']);_0x1092c8[_0x7481('0x32')]=_[_0x7481('0x33')](_0x2a84b1['query']);_0x1092c8['filters']=_[_0x7481('0x46')](_0x1092c8[_0x7481('0x31')],_0x1092c8[_0x7481('0x32')]);_0x1fd520['attributes']=_[_0x7481('0x46')](_0x1092c8[_0x7481('0x31')],qs[_0x7481('0x36')](_0x2a84b1[_0x7481('0x32')][_0x7481('0x36')]));_0x1fd520[_0x7481('0x35')]=_0x1fd520[_0x7481('0x35')]['length']?_0x1fd520['attributes']:_0x1092c8[_0x7481('0x31')];if(_0x2a84b1[_0x7481('0x32')][_0x7481('0x47')]){_0x1fd520['include']=[{'all':!![]}];}_0x1fd520=_[_0x7481('0x3f')]({},_0x1fd520,_0x2a84b1[_0x7481('0x41')]);return db[_0x7481('0x2d')][_0x7481('0x48')](_0x1fd520)['then'](handleEntityNotFound(_0xc28f17,null))[_0x7481('0x25')](respondWithResult(_0xc28f17,null))['catch'](handleError(_0xc28f17,null));};exports[_0x7481('0x49')]=function(_0x53e1ed,_0x7d1f27){return db[_0x7481('0x2d')][_0x7481('0x49')](_0x53e1ed[_0x7481('0x4a')],{})['then'](respondWithResult(_0x7d1f27,0xc9))[_0x7481('0x4b')](handleError(_0x7d1f27,null));};exports[_0x7481('0x4c')]=function(_0x410b64,_0x338dc7){return db[_0x7481('0x2d')][_0x7481('0x4c')](_0x410b64[_0x7481('0x4a')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x338dc7,0xc9))[_0x7481('0x4b')](handleError(_0x338dc7,null));};exports[_0x7481('0x24')]=function(_0x2e53f0,_0x369ec8){if(_0x2e53f0['body']['id']){delete _0x2e53f0[_0x7481('0x4a')]['id'];}return db[_0x7481('0x2d')][_0x7481('0x48')]({'where':{'id':_0x2e53f0[_0x7481('0x45')]['id']}})['then'](handleEntityNotFound(_0x369ec8,null))[_0x7481('0x25')](saveUpdates(_0x2e53f0[_0x7481('0x4a')],null))[_0x7481('0x25')](respondWithResult(_0x369ec8,null))[_0x7481('0x4b')](handleError(_0x369ec8,null));};exports['destroy']=function(_0x5b9cee,_0x2d13c1){return db[_0x7481('0x2d')][_0x7481('0x48')]({'where':{'id':_0x5b9cee[_0x7481('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d13c1,null))[_0x7481('0x25')](removeEntity(_0x2d13c1,null))[_0x7481('0x4b')](handleError(_0x2d13c1,null));};exports[_0x7481('0x4d')]=function(_0x25018b,_0x25f90a){return db[_0x7481('0x2d')][_0x7481('0x26')]({'where':{'id':_0x25018b[_0x7481('0x32')][_0x7481('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x7481('0x25')](respondWithResult(_0x25f90a,0xcc))[_0x7481('0x4b')](handleError(_0x25f90a,null));};exports['addFields']=function(_0x2481e0,_0x1f64ea,_0x46d9bb){return db[_0x7481('0x4f')][_0x7481('0x50')]({'where':{'id':_0x2481e0[_0x7481('0x45')]['id']}})[_0x7481('0x25')](handleEntityNotFound(_0x1f64ea,null))['then'](function(_0x733990){if(_0x733990){return db[_0x7481('0x51')][_0x7481('0x52')](function(_0x5bda6c){return db[_0x7481('0x2d')]['destroy']({'where':{'CustomReportId':_0x2481e0[_0x7481('0x45')]['id']},'transaction':_0x5bda6c})[_0x7481('0x25')](function(_0x2a74b7){var _0x3d2fbf=_[_0x7481('0x2c')](_0x2481e0[_0x7481('0x4a')],function(_0x449a3a){delete _0x449a3a['id'];_0x449a3a['CustomReportId']=_0x2481e0[_0x7481('0x45')]['id'];return _0x449a3a;});return db['AnalyticFieldReport'][_0x7481('0x4c')](_0x3d2fbf,{'transaction':_0x5bda6c});});})['then'](function(){return db[_0x7481('0x2d')]['findAll']({'where':{'CustomReportId':_0x2481e0[_0x7481('0x45')]['id']}});});}})[_0x7481('0x25')](respondWithResult(_0x1f64ea,null))[_0x7481('0x4b')](handleError(_0x1f64ea,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ee67995..71dcc3e 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 _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 +var _0x9330=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9330,0x19a));var _0x0933=function(_0x1e7561,_0x2684c8){_0x1e7561=_0x1e7561-0x0;var _0x278ea8=_0x9330[_0x1e7561];return _0x278ea8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0933('0x0'))(_0x0933('0x1'));var moment=require('moment');var BPromise=require(_0x0933('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0933('0x3'));var rimraf=require(_0x0933('0x4'));var config=require(_0x0933('0x5'));var attributes=require(_0x0933('0x6'));module[_0x0933('0x7')]=function(_0x1c8de1,_0xb52622){return _0x1c8de1[_0x0933('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x0933('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index c8c504f..f059392 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 _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 +var _0xcee5=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','request\x20sent','stringify'];(function(_0xc3c6d,_0x2454d8){var _0x327460=function(_0x42e88c){while(--_0x42e88c){_0xc3c6d['push'](_0xc3c6d['shift']());}};_0x327460(++_0x2454d8);}(_0xcee5,0x18d));var _0x5cee=function(_0x1d5ffa,_0x296403){_0x1d5ffa=_0x1d5ffa-0x0;var _0x2f2a3d=_0xcee5[_0x1d5ffa];return _0x2f2a3d;};'use strict';var _=require(_0x5cee('0x0'));var util=require(_0x5cee('0x1'));var moment=require(_0x5cee('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cee('0x3'));var fs=require('fs');var Redis=require(_0x5cee('0x4'));var db=require(_0x5cee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cee('0x6'))(_0x5cee('0x7'));var config=require(_0x5cee('0x8'));var jayson=require(_0x5cee('0x9'));var client=jayson['client'][_0x5cee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b9d79,_0x39ce57,_0x48b2d3){return new BPromise(function(_0x48e47a,_0x45b9c9){return client[_0x5cee('0xb')](_0x5b9d79,_0x48b2d3)[_0x5cee('0xc')](function(_0x29fe4e){logger[_0x5cee('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x39ce57,'request\x20sent');logger[_0x5cee('0xe')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x39ce57,_0x5cee('0xf'),JSON[_0x5cee('0x10')](_0x29fe4e));if(_0x29fe4e[_0x5cee('0x11')]){if(_0x29fe4e[_0x5cee('0x11')][_0x5cee('0x12')]===0x1f4){logger[_0x5cee('0x11')](_0x5cee('0x13'),_0x39ce57,_0x29fe4e[_0x5cee('0x11')][_0x5cee('0x14')]);return _0x45b9c9(_0x29fe4e['error'][_0x5cee('0x14')]);}logger[_0x5cee('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x39ce57,_0x29fe4e[_0x5cee('0x11')][_0x5cee('0x14')]);return _0x48e47a(_0x29fe4e[_0x5cee('0x11')][_0x5cee('0x14')]);}else{logger['info'](_0x5cee('0x13'),_0x39ce57,_0x5cee('0xf'));_0x48e47a(_0x29fe4e[_0x5cee('0x15')]['message']);}})[_0x5cee('0x16')](function(_0x28280b){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x39ce57,_0x28280b);_0x45b9c9(_0x28280b);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 25bf0ba..b3b5e83 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 _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 +var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x55ca,0x126));var _0xa55c=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0x55ca[_0x53c4f8];return _0x416458;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9ccb1fd..9413c0c 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 _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 +var _0x4849=['sequelize','exports','STRING','TEXT'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4849,0xf8));var _0x9484=function(_0x28ce38,_0x37a35a){_0x28ce38=_0x28ce38-0x0;var _0x5dbf25=_0x4849[_0x28ce38];return _0x5dbf25;};'use strict';var Sequelize=require(_0x9484('0x0'));module[_0x9484('0x1')]={'name':{'type':Sequelize[_0x9484('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x9484('0x3')]},'description':{'type':Sequelize[_0x9484('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index e3d0b63..8a64199 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 _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 +var _0xea08=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','set','json','reject','save','then','destroy','get','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','sort','pick','filter','merge','options','AnalyticMetric','count','includeAll','findAll','rows','catch','show','params','find','create','body','user','role','Metrics','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5f44b,_0x2b1b76){var _0x1b6244=function(_0x31fcf2){while(--_0x31fcf2){_0x5f44b['push'](_0x5f44b['shift']());}};_0x1b6244(++_0x2b1b76);}(_0xea08,0xe1));var _0x8ea0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xea08[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0x8ea0('0x0'));var emlformat=require(_0x8ea0('0x1'));var rimraf=require(_0x8ea0('0x2'));var zipdir=require(_0x8ea0('0x3'));var jsonpatch=require(_0x8ea0('0x4'));var rp=require(_0x8ea0('0x5'));var moment=require(_0x8ea0('0x6'));var BPromise=require(_0x8ea0('0x7'));var Mustache=require(_0x8ea0('0x8'));var util=require(_0x8ea0('0x9'));var path=require(_0x8ea0('0xa'));var sox=require(_0x8ea0('0xb'));var csv=require(_0x8ea0('0xc'));var ejs=require(_0x8ea0('0xd'));var fs=require('fs');var _=require(_0x8ea0('0xe'));var squel=require(_0x8ea0('0xf'));var crypto=require(_0x8ea0('0x10'));var jsforce=require(_0x8ea0('0x11'));var deskjs=require(_0x8ea0('0x12'));var toCsv=require(_0x8ea0('0xc'));var querystring=require(_0x8ea0('0x13'));var Papa=require(_0x8ea0('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8ea0('0x15'));var as=require(_0x8ea0('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8ea0('0x17'));var utils=require(_0x8ea0('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea0('0x19'));var db=require(_0x8ea0('0x1a'))['db'];function respondWithStatusCode(_0x350cde,_0x27fb72){_0x27fb72=_0x27fb72||0xcc;return function(_0x54cf47){if(_0x54cf47){return _0x350cde[_0x8ea0('0x1b')](_0x27fb72);}return _0x350cde[_0x8ea0('0x1c')](_0x27fb72)['end']();};}function respondWithResult(_0x286fcc,_0x345bb5){_0x345bb5=_0x345bb5||0xc8;return function(_0x5c4c80){if(_0x5c4c80){return _0x286fcc[_0x8ea0('0x1c')](_0x345bb5)['json'](_0x5c4c80);}};}function respondWithFilteredResult(_0x4b86e0,_0x347581){return function(_0x4789c4){if(_0x4789c4){var _0x3306c5=_0x4789c4['count'],_0x32ffee=_0x347581[_0x8ea0('0x1d')],_0x4cb8cd=_0x347581['offset']+_0x347581[_0x8ea0('0x1e')],_0x29a0d8;if(_0x4cb8cd>=_0x3306c5){_0x4cb8cd=_0x3306c5;_0x29a0d8=0xc8;}else{_0x29a0d8=0xce;}_0x4b86e0[_0x8ea0('0x1c')](_0x29a0d8);return _0x4b86e0[_0x8ea0('0x1f')]('Content-Range',_0x32ffee+'-'+_0x4cb8cd+'/'+_0x3306c5)[_0x8ea0('0x20')](_0x4789c4);}return null;};}function patchUpdates(_0x5bebe7){return function(_0x46be45){try{jsonpatch['apply'](_0x46be45,_0x5bebe7,!![]);}catch(_0x1b3c59){return BPromise[_0x8ea0('0x21')](_0x1b3c59);}return _0x46be45[_0x8ea0('0x22')]();};}function saveUpdates(_0x594931,_0x5bc7b4){return function(_0x5df75b){if(_0x5df75b){return _0x5df75b['update'](_0x594931)[_0x8ea0('0x23')](function(_0x14ae1c){return _0x14ae1c;});}return null;};}function removeEntity(_0x1813fb,_0x4dddce){return function(_0x3dc72e){if(_0x3dc72e){return _0x3dc72e[_0x8ea0('0x24')]()[_0x8ea0('0x23')](function(){var _0x333a42=_0x3dc72e[_0x8ea0('0x25')]({'plain':!![]});var _0x40bb8f='Metrics';return db['UserProfileResource'][_0x8ea0('0x24')]({'where':{'type':_0x40bb8f,'resourceId':_0x333a42['id']}})[_0x8ea0('0x23')](function(){return _0x3dc72e;});})[_0x8ea0('0x23')](function(){_0x1813fb[_0x8ea0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161d6e,_0x5b59b9){return function(_0x39e7c3){if(!_0x39e7c3){_0x161d6e[_0x8ea0('0x1b')](0x194);}return _0x39e7c3;};}function handleError(_0xf4d415,_0x1678cd){_0x1678cd=_0x1678cd||0x1f4;return function(_0x5bfc67){logger['error'](_0x5bfc67['stack']);if(_0x5bfc67[_0x8ea0('0x26')]){delete _0x5bfc67[_0x8ea0('0x26')];}_0xf4d415[_0x8ea0('0x1c')](_0x1678cd)['send'](_0x5bfc67);};}exports['index']=function(_0x12d6bf,_0x4d993d){var _0x599069={},_0x1ec85a={},_0xba0d83={'count':0x0,'rows':[]};var _0x1617fc=_[_0x8ea0('0x27')](db['AnalyticMetric'][_0x8ea0('0x28')],function(_0x3e5700){return{'name':_0x3e5700[_0x8ea0('0x29')],'type':_0x3e5700[_0x8ea0('0x2a')][_0x8ea0('0x2b')]};});_0x1ec85a['model']=_[_0x8ea0('0x27')](_0x1617fc,_0x8ea0('0x26'));_0x1ec85a[_0x8ea0('0x2c')]=_[_0x8ea0('0x2d')](_0x12d6bf[_0x8ea0('0x2c')]);_0x1ec85a[_0x8ea0('0x2e')]=_[_0x8ea0('0x2f')](_0x1ec85a['model'],_0x1ec85a[_0x8ea0('0x2c')]);_0x599069[_0x8ea0('0x30')]=_[_0x8ea0('0x2f')](_0x1ec85a['model'],qs[_0x8ea0('0x31')](_0x12d6bf['query'][_0x8ea0('0x31')]));_0x599069['attributes']=_0x599069['attributes']['length']?_0x599069[_0x8ea0('0x30')]:_0x1ec85a[_0x8ea0('0x32')];if(!_0x12d6bf['query'][_0x8ea0('0x33')](_0x8ea0('0x34'))){_0x599069[_0x8ea0('0x1e')]=qs[_0x8ea0('0x1e')](_0x12d6bf[_0x8ea0('0x2c')][_0x8ea0('0x1e')]);_0x599069[_0x8ea0('0x1d')]=qs[_0x8ea0('0x1d')](_0x12d6bf[_0x8ea0('0x2c')][_0x8ea0('0x1d')]);}_0x599069['order']=qs['sort'](_0x12d6bf[_0x8ea0('0x2c')][_0x8ea0('0x35')]);_0x599069['where']=qs['filters'](_[_0x8ea0('0x36')](_0x12d6bf['query'],_0x1ec85a[_0x8ea0('0x2e')]),_0x1617fc);if(_0x12d6bf[_0x8ea0('0x2c')][_0x8ea0('0x37')]){_0x599069['where']=_[_0x8ea0('0x38')](_0x599069['where'],{'$or':_['map'](_0x1617fc,function(_0x1a87b3){if(_0x1a87b3[_0x8ea0('0x2a')]!=='VIRTUAL'){var _0x190289={};_0x190289[_0x1a87b3[_0x8ea0('0x26')]]={'$like':'%'+_0x12d6bf[_0x8ea0('0x2c')][_0x8ea0('0x37')]+'%'};return _0x190289;}})});}_0x599069=_[_0x8ea0('0x38')]({},_0x599069,_0x12d6bf[_0x8ea0('0x39')]);var _0x5117c9={'where':_0x599069['where']};return db[_0x8ea0('0x3a')][_0x8ea0('0x3b')](_0x5117c9)[_0x8ea0('0x23')](function(_0x1f63d3){_0xba0d83['count']=_0x1f63d3;if(_0x12d6bf['query'][_0x8ea0('0x3c')]){_0x599069['include']=[{'all':!![]}];}return db[_0x8ea0('0x3a')][_0x8ea0('0x3d')](_0x599069);})['then'](function(_0x4b81da){_0xba0d83[_0x8ea0('0x3e')]=_0x4b81da;return _0xba0d83;})[_0x8ea0('0x23')](respondWithFilteredResult(_0x4d993d,_0x599069))[_0x8ea0('0x3f')](handleError(_0x4d993d,null));};exports[_0x8ea0('0x40')]=function(_0x3a1863,_0x1f27be){var _0x3bdedf={'raw':!![],'where':{'id':_0x3a1863[_0x8ea0('0x41')]['id']}},_0x30e181={};_0x30e181['model']=_[_0x8ea0('0x2d')](db[_0x8ea0('0x3a')][_0x8ea0('0x28')]);_0x30e181[_0x8ea0('0x2c')]=_[_0x8ea0('0x2d')](_0x3a1863[_0x8ea0('0x2c')]);_0x30e181[_0x8ea0('0x2e')]=_[_0x8ea0('0x2f')](_0x30e181[_0x8ea0('0x32')],_0x30e181[_0x8ea0('0x2c')]);_0x3bdedf[_0x8ea0('0x30')]=_['intersection'](_0x30e181[_0x8ea0('0x32')],qs[_0x8ea0('0x31')](_0x3a1863[_0x8ea0('0x2c')][_0x8ea0('0x31')]));_0x3bdedf['attributes']=_0x3bdedf[_0x8ea0('0x30')]['length']?_0x3bdedf['attributes']:_0x30e181[_0x8ea0('0x32')];if(_0x3a1863[_0x8ea0('0x2c')][_0x8ea0('0x3c')]){_0x3bdedf['include']=[{'all':!![]}];}_0x3bdedf=_[_0x8ea0('0x38')]({},_0x3bdedf,_0x3a1863['options']);return db['AnalyticMetric'][_0x8ea0('0x42')](_0x3bdedf)['then'](handleEntityNotFound(_0x1f27be,null))[_0x8ea0('0x23')](respondWithResult(_0x1f27be,null))['catch'](handleError(_0x1f27be,null));};exports[_0x8ea0('0x43')]=function(_0x10bab6,_0xe6ab11){return db[_0x8ea0('0x3a')][_0x8ea0('0x43')](_0x10bab6[_0x8ea0('0x44')],{})[_0x8ea0('0x23')](function(_0x1e261b){var _0x434207=_0x10bab6[_0x8ea0('0x45')]['get']({'plain':!![]});if(!_0x434207)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x434207[_0x8ea0('0x46')]==='user'){var _0x534a8b=_0x1e261b['get']({'plain':!![]});var _0x1e2c74=_0x8ea0('0x47');return db[_0x8ea0('0x48')]['find']({'where':{'name':_0x1e2c74,'userProfileId':_0x434207[_0x8ea0('0x49')]},'raw':!![]})[_0x8ea0('0x23')](function(_0x1c25d9){if(_0x1c25d9&&_0x1c25d9[_0x8ea0('0x4a')]===0x0){return db[_0x8ea0('0x4b')][_0x8ea0('0x43')]({'name':_0x534a8b[_0x8ea0('0x26')],'resourceId':_0x534a8b['id'],'type':_0x1c25d9[_0x8ea0('0x26')],'sectionId':_0x1c25d9['id']},{})[_0x8ea0('0x23')](function(){return _0x1e261b;});}else{return _0x1e261b;}})['catch'](function(_0x54a747){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54a747);throw _0x54a747;});}return _0x1e261b;})[_0x8ea0('0x23')](respondWithResult(_0xe6ab11,0xc9))[_0x8ea0('0x3f')](handleError(_0xe6ab11,null));};exports[_0x8ea0('0x4c')]=function(_0x446699,_0x419cb7){if(_0x446699['body']['id']){delete _0x446699['body']['id'];}return db[_0x8ea0('0x3a')][_0x8ea0('0x42')]({'where':{'id':_0x446699['params']['id']}})[_0x8ea0('0x23')](handleEntityNotFound(_0x419cb7,null))['then'](saveUpdates(_0x446699[_0x8ea0('0x44')],null))[_0x8ea0('0x23')](respondWithResult(_0x419cb7,null))[_0x8ea0('0x3f')](handleError(_0x419cb7,null));};exports[_0x8ea0('0x24')]=function(_0x583358,_0x33b537){return db['AnalyticMetric']['find']({'where':{'id':_0x583358['params']['id']}})[_0x8ea0('0x23')](handleEntityNotFound(_0x33b537,null))[_0x8ea0('0x23')](removeEntity(_0x33b537,null))['catch'](handleError(_0x33b537,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d678828..3f629d8 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 _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 +var _0x503f=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','util','../../config/logger','api'];(function(_0x5661d9,_0x410683){var _0x221bde=function(_0x3d8714){while(--_0x3d8714){_0x5661d9['push'](_0x5661d9['shift']());}};_0x221bde(++_0x410683);}(_0x503f,0x189));var _0xf503=function(_0x42306d,_0x195e0a){_0x42306d=_0x42306d-0x0;var _0x474231=_0x503f[_0x42306d];return _0x474231;};'use strict';var _=require('lodash');var util=require(_0xf503('0x0'));var logger=require(_0xf503('0x1'))(_0xf503('0x2'));var moment=require(_0xf503('0x3'));var BPromise=require(_0xf503('0x4'));var rp=require(_0xf503('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf503('0x6'));var config=require(_0xf503('0x7'));var attributes=require(_0xf503('0x8'));module['exports']=function(_0x3c5ff0,_0x4d3f06){return _0x3c5ff0[_0xf503('0x9')](_0xf503('0xa'),attributes,{'tableName':_0xf503('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index ded6a90..5c7a76f 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 _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 +var _0x68a6=['error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x31916f,_0x4cfb84){var _0x779ea5=function(_0x551dba){while(--_0x551dba){_0x31916f['push'](_0x31916f['shift']());}};_0x779ea5(++_0x4cfb84);}(_0x68a6,0x148));var _0x668a=function(_0x38100b,_0x3bba33){_0x38100b=_0x38100b-0x0;var _0x221eb4=_0x68a6[_0x38100b];return _0x221eb4;};'use strict';var _=require(_0x668a('0x0'));var util=require(_0x668a('0x1'));var moment=require(_0x668a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x668a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x668a('0x4'))(_0x668a('0x5'));var config=require(_0x668a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x668a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d6616,_0x1c352b,_0x47fbcc){return new BPromise(function(_0x23e171,_0x2368c0){return client['request'](_0x5d6616,_0x47fbcc)[_0x668a('0x8')](function(_0x4a08f8){logger[_0x668a('0x9')](_0x668a('0xa'),_0x1c352b,_0x668a('0xb'));logger[_0x668a('0xc')](_0x668a('0xd'),_0x1c352b,_0x668a('0xb'),JSON['stringify'](_0x4a08f8));if(_0x4a08f8['error']){if(_0x4a08f8[_0x668a('0xe')][_0x668a('0xf')]===0x1f4){logger['error'](_0x668a('0xa'),_0x1c352b,_0x4a08f8[_0x668a('0xe')][_0x668a('0x10')]);return _0x2368c0(_0x4a08f8[_0x668a('0xe')][_0x668a('0x10')]);}logger[_0x668a('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x1c352b,_0x4a08f8['error'][_0x668a('0x10')]);return _0x23e171(_0x4a08f8[_0x668a('0xe')][_0x668a('0x10')]);}else{logger[_0x668a('0x9')](_0x668a('0xa'),_0x1c352b,'request\x20sent');_0x23e171(_0x4a08f8[_0x668a('0x11')]['message']);}})[_0x668a('0x12')](function(_0x205e90){logger['error'](_0x668a('0xa'),_0x1c352b,_0x205e90);_0x2368c0(_0x205e90);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 577a821..8fac397 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 _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 +var _0x2ef3=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x60ad95,_0x317958){var _0x54e424=function(_0x12a925){while(--_0x12a925){_0x60ad95['push'](_0x60ad95['shift']());}};_0x54e424(++_0x317958);}(_0x2ef3,0xba));var _0x32ef=function(_0x206c61,_0x450f24){_0x206c61=_0x206c61-0x0;var _0x22185b=_0x2ef3[_0x206c61];return _0x22185b;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./analyticMetric.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0xc')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0xe')](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xf')]);router['delete']('/:id',auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index fd9f8d0..143a043 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 _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 +var _0xb098=['sequelize','exports'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0xb098,0x13a));var _0x8b09=function(_0x52b8a7,_0xb04d78){_0x52b8a7=_0x52b8a7-0x0;var _0x234ceb=_0xb098[_0x52b8a7];return _0x234ceb;};'use strict';var Sequelize=require(_0x8b09('0x0'));module[_0x8b09('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index db7b74b..e7d1b80 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 _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 +var _0x4235=['save','update','then','destroy','end','sendStatus','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','options','catch','create','body','find','params','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4235,0x71));var _0x5423=function(_0x4d9443,_0xe0d01f){_0x4d9443=_0x4d9443-0x0;var _0x350586=_0x4235[_0x4d9443];return _0x350586;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5423('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5423('0x1'));var rp=require(_0x5423('0x2'));var moment=require(_0x5423('0x3'));var BPromise=require(_0x5423('0x4'));var Mustache=require(_0x5423('0x5'));var util=require(_0x5423('0x6'));var path=require(_0x5423('0x7'));var sox=require(_0x5423('0x8'));var csv=require(_0x5423('0x9'));var ejs=require(_0x5423('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5423('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5423('0xc'));var toCsv=require(_0x5423('0x9'));var querystring=require(_0x5423('0xd'));var Papa=require('papaparse');var Redis=require(_0x5423('0xe'));var authService=require(_0x5423('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5423('0x10'));var hardwareService=require(_0x5423('0x11'));var logger=require(_0x5423('0x12'))('api');var utils=require(_0x5423('0x13'));var config=require(_0x5423('0x14'));var licenseUtil=require(_0x5423('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f456,_0x4a8e88){_0x4a8e88=_0x4a8e88||0xcc;return function(_0x3c6507){if(_0x3c6507){return _0x11f456['sendStatus'](_0x4a8e88);}return _0x11f456[_0x5423('0x16')](_0x4a8e88)['end']();};}function respondWithResult(_0x43a27e,_0x496c95){_0x496c95=_0x496c95||0xc8;return function(_0x38c8f6){if(_0x38c8f6){return _0x43a27e[_0x5423('0x16')](_0x496c95)[_0x5423('0x17')](_0x38c8f6);}};}function respondWithFilteredResult(_0xe3f965,_0x4eb153){return function(_0x256536){if(_0x256536){var _0xa3fea0=_0x256536[_0x5423('0x18')],_0x360559=_0x4eb153['offset'],_0x2108a6=_0x4eb153[_0x5423('0x19')]+_0x4eb153[_0x5423('0x1a')],_0x1ae71d;if(_0x2108a6>=_0xa3fea0){_0x2108a6=_0xa3fea0;_0x1ae71d=0xc8;}else{_0x1ae71d=0xce;}_0xe3f965[_0x5423('0x16')](_0x1ae71d);return _0xe3f965[_0x5423('0x1b')](_0x5423('0x1c'),_0x360559+'-'+_0x2108a6+'/'+_0xa3fea0)['json'](_0x256536);}return null;};}function patchUpdates(_0x1e97c6){return function(_0x1321a4){try{jsonpatch[_0x5423('0x1d')](_0x1321a4,_0x1e97c6,!![]);}catch(_0x37ffe6){return BPromise[_0x5423('0x1e')](_0x37ffe6);}return _0x1321a4[_0x5423('0x1f')]();};}function saveUpdates(_0x1becfc,_0x1e1706){return function(_0x16ad7a){if(_0x16ad7a){return _0x16ad7a[_0x5423('0x20')](_0x1becfc)[_0x5423('0x21')](function(_0x4ba1e3){return _0x4ba1e3;});}return null;};}function removeEntity(_0x581b41,_0x552c6e){return function(_0x521546){if(_0x521546){return _0x521546[_0x5423('0x22')]()['then'](function(){_0x581b41['status'](0xcc)[_0x5423('0x23')]();});}};}function handleEntityNotFound(_0x2ff394,_0x3827d2){return function(_0x28a5e7){if(!_0x28a5e7){_0x2ff394[_0x5423('0x24')](0x194);}return _0x28a5e7;};}function handleError(_0x5ce9f5,_0x1117a7){_0x1117a7=_0x1117a7||0x1f4;return function(_0x4c536d){logger[_0x5423('0x25')](_0x4c536d['stack']);if(_0x4c536d['name']){delete _0x4c536d[_0x5423('0x26')];}_0x5ce9f5[_0x5423('0x16')](_0x1117a7)[_0x5423('0x27')](_0x4c536d);};}exports[_0x5423('0x28')]=function(_0x19ac3e,_0x1ed6cb){var _0x110110={},_0x370110={},_0xe4c19f={'count':0x0,'rows':[]};var _0x4c86c9=_[_0x5423('0x29')](db[_0x5423('0x2a')][_0x5423('0x2b')],function(_0x5c380b){return{'name':_0x5c380b[_0x5423('0x2c')],'type':_0x5c380b[_0x5423('0x2d')][_0x5423('0x2e')]};});_0x370110['model']=_[_0x5423('0x29')](_0x4c86c9,_0x5423('0x26'));_0x370110[_0x5423('0x2f')]=_[_0x5423('0x30')](_0x19ac3e[_0x5423('0x2f')]);_0x370110['filters']=_[_0x5423('0x31')](_0x370110[_0x5423('0x32')],_0x370110[_0x5423('0x2f')]);_0x110110[_0x5423('0x33')]=_[_0x5423('0x31')](_0x370110[_0x5423('0x32')],qs[_0x5423('0x34')](_0x19ac3e[_0x5423('0x2f')][_0x5423('0x34')]));_0x110110['attributes']=_0x110110[_0x5423('0x33')][_0x5423('0x35')]?_0x110110['attributes']:_0x370110[_0x5423('0x32')];if(!_0x19ac3e[_0x5423('0x2f')][_0x5423('0x36')]('nolimit')){_0x110110['limit']=qs['limit'](_0x19ac3e['query'][_0x5423('0x1a')]);_0x110110[_0x5423('0x19')]=qs['offset'](_0x19ac3e[_0x5423('0x2f')]['offset']);}_0x110110[_0x5423('0x37')]=qs[_0x5423('0x38')](_0x19ac3e[_0x5423('0x2f')][_0x5423('0x38')]);_0x110110[_0x5423('0x39')]=qs['filters'](_['pick'](_0x19ac3e[_0x5423('0x2f')],_0x370110[_0x5423('0x3a')]),_0x4c86c9);if(_0x19ac3e['query'][_0x5423('0x3b')]){_0x110110[_0x5423('0x39')]=_[_0x5423('0x3c')](_0x110110[_0x5423('0x39')],{'$or':_[_0x5423('0x29')](_0x4c86c9,function(_0x48efd7){if(_0x48efd7[_0x5423('0x2d')]!==_0x5423('0x3d')){var _0x28d418={};_0x28d418[_0x48efd7[_0x5423('0x26')]]={'$like':'%'+_0x19ac3e['query'][_0x5423('0x3b')]+'%'};return _0x28d418;}})});}_0x110110=_[_0x5423('0x3c')]({},_0x110110,_0x19ac3e['options']);var _0x23bf2c={'where':_0x110110[_0x5423('0x39')]};return db[_0x5423('0x2a')]['count'](_0x23bf2c)[_0x5423('0x21')](function(_0x2307da){_0xe4c19f[_0x5423('0x18')]=_0x2307da;if(_0x19ac3e[_0x5423('0x2f')][_0x5423('0x3e')]){_0x110110[_0x5423('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5423('0x40')](_0x110110);})[_0x5423('0x21')](function(_0x27d1f6){_0xe4c19f[_0x5423('0x41')]=_0x27d1f6;return _0xe4c19f;})[_0x5423('0x21')](respondWithFilteredResult(_0x1ed6cb,_0x110110))['catch'](handleError(_0x1ed6cb,null));};exports['show']=function(_0x50629d,_0x4ed490){var _0x4a9b9e={'raw':!![],'where':{'id':_0x50629d['params']['id']}},_0x315ad2={};_0x315ad2[_0x5423('0x32')]=_[_0x5423('0x30')](db[_0x5423('0x2a')][_0x5423('0x2b')]);_0x315ad2['query']=_[_0x5423('0x30')](_0x50629d['query']);_0x315ad2[_0x5423('0x3a')]=_[_0x5423('0x31')](_0x315ad2['model'],_0x315ad2['query']);_0x4a9b9e[_0x5423('0x33')]=_[_0x5423('0x31')](_0x315ad2[_0x5423('0x32')],qs[_0x5423('0x34')](_0x50629d[_0x5423('0x2f')][_0x5423('0x34')]));_0x4a9b9e[_0x5423('0x33')]=_0x4a9b9e[_0x5423('0x33')][_0x5423('0x35')]?_0x4a9b9e[_0x5423('0x33')]:_0x315ad2[_0x5423('0x32')];if(_0x50629d[_0x5423('0x2f')][_0x5423('0x3e')]){_0x4a9b9e[_0x5423('0x3f')]=[{'all':!![]}];}_0x4a9b9e=_['merge']({},_0x4a9b9e,_0x50629d[_0x5423('0x42')]);return db['AnalyticTreeReport']['find'](_0x4a9b9e)[_0x5423('0x21')](handleEntityNotFound(_0x4ed490,null))['then'](respondWithResult(_0x4ed490,null))[_0x5423('0x43')](handleError(_0x4ed490,null));};exports[_0x5423('0x44')]=function(_0x79a55c,_0x4c31d6){return db[_0x5423('0x2a')][_0x5423('0x44')](_0x79a55c[_0x5423('0x45')],{})[_0x5423('0x21')](respondWithResult(_0x4c31d6,0xc9))[_0x5423('0x43')](handleError(_0x4c31d6,null));};exports[_0x5423('0x20')]=function(_0x2507d8,_0x3a03e8){if(_0x2507d8['body']['id']){delete _0x2507d8[_0x5423('0x45')]['id'];}return db[_0x5423('0x2a')]['find']({'where':{'id':_0x2507d8['params']['id']}})['then'](handleEntityNotFound(_0x3a03e8,null))[_0x5423('0x21')](saveUpdates(_0x2507d8[_0x5423('0x45')],null))[_0x5423('0x21')](respondWithResult(_0x3a03e8,null))[_0x5423('0x43')](handleError(_0x3a03e8,null));};exports['destroy']=function(_0x225100,_0x1f4789){return db[_0x5423('0x2a')][_0x5423('0x46')]({'where':{'id':_0x225100[_0x5423('0x47')]['id']}})[_0x5423('0x21')](handleEntityNotFound(_0x1f4789,null))[_0x5423('0x21')](removeEntity(_0x1f4789,null))[_0x5423('0x43')](handleError(_0x1f4789,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7311d40..4bc62ec 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 _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 +var _0x2cf5=['bluebird','request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api'];(function(_0xdb926f,_0x5c252b){var _0x3def36=function(_0x382947){while(--_0x382947){_0xdb926f['push'](_0xdb926f['shift']());}};_0x3def36(++_0x5c252b);}(_0x2cf5,0x19f));var _0x52cf=function(_0x255932,_0x1bff8c){_0x255932=_0x255932-0x0;var _0x5a4738=_0x2cf5[_0x255932];return _0x5a4738;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var logger=require('../../config/logger')(_0x52cf('0x2'));var moment=require('moment');var BPromise=require(_0x52cf('0x3'));var rp=require(_0x52cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x52cf('0x5'));var attributes=require(_0x52cf('0x6'));module[_0x52cf('0x7')]=function(_0x1001bd,_0x31185d){return _0x1001bd[_0x52cf('0x8')](_0x52cf('0x9'),attributes,{'tableName':_0x52cf('0xa'),'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 b015534..e7beed8 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 _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 +var _0x741e=['../../mysqldb','../../config/utils','client','then','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticTreeReport,\x20%s,\x20%s','result','catch','bluebird','ioredis'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0x741e,0x75));var _0xe741=function(_0x4354fa,_0x10c5ad){_0x4354fa=_0x4354fa-0x0;var _0x19e958=_0x741e[_0x4354fa];return _0x19e958;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe741('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe741('0x1'));var db=require(_0xe741('0x2'))['db'];var utils=require(_0xe741('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe741('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x246ae1,_0x14aa84,_0x483b77){return new BPromise(function(_0x27c760,_0x11dab6){return client['request'](_0x246ae1,_0x483b77)[_0xe741('0x5')](function(_0x252790){logger[_0xe741('0x6')]('AnalyticTreeReport,\x20%s,\x20%s',_0x14aa84,_0xe741('0x7'));logger[_0xe741('0x8')](_0xe741('0x9'),_0x14aa84,'request\x20sent',JSON[_0xe741('0xa')](_0x252790));if(_0x252790[_0xe741('0xb')]){if(_0x252790['error'][_0xe741('0xc')]===0x1f4){logger[_0xe741('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x14aa84,_0x252790[_0xe741('0xb')][_0xe741('0xd')]);return _0x11dab6(_0x252790[_0xe741('0xb')][_0xe741('0xd')]);}logger[_0xe741('0xb')]('AnalyticTreeReport,\x20%s,\x20%s',_0x14aa84,_0x252790[_0xe741('0xb')][_0xe741('0xd')]);return _0x27c760(_0x252790[_0xe741('0xb')][_0xe741('0xd')]);}else{logger['info'](_0xe741('0xe'),_0x14aa84,_0xe741('0x7'));_0x27c760(_0x252790[_0xe741('0xf')][_0xe741('0xd')]);}})[_0xe741('0x10')](function(_0x2a0aea){logger[_0xe741('0xb')](_0xe741('0xe'),_0x14aa84,_0x2a0aea);_0x11dab6(_0x2a0aea);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 9b12b7f..d0d23ef 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 _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 +var _0xc9bd=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x294c05,_0x54a6a7){var _0x268d69=function(_0x38db52){while(--_0x38db52){_0x294c05['push'](_0x294c05['shift']());}};_0x268d69(++_0x54a6a7);}(_0xc9bd,0x6c));var _0xdc9b=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0xc9bd[_0x1af0e5];return _0x3c444a;};'use strict';var multer=require(_0xdc9b('0x0'));var util=require(_0xdc9b('0x1'));var path=require(_0xdc9b('0x2'));var timeout=require(_0xdc9b('0x3'));var express=require(_0xdc9b('0x4'));var router=express['Router']();var auth=require(_0xdc9b('0x5'));var interaction=require(_0xdc9b('0x6'));var config=require(_0xdc9b('0x7'));var controller=require(_0xdc9b('0x8'));router[_0xdc9b('0x9')]('/',auth[_0xdc9b('0xa')](),controller[_0xdc9b('0xb')]);router[_0xdc9b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdc9b('0xc')]);router[_0xdc9b('0xd')]('/',auth[_0xdc9b('0xa')](),controller[_0xdc9b('0xe')]);router['put'](_0xdc9b('0xf'),auth['isAuthenticated'](),controller[_0xdc9b('0x10')]);router[_0xdc9b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xdc9b('0x12')]);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 8949341..0bf9724 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 _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 +var _0x9774=['STRING','sequelize','exports'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x9774,0xd9));var _0x4977=function(_0x1e0c1d,_0x57cd80){_0x1e0c1d=_0x1e0c1d-0x0;var _0x3a1260=_0x9774[_0x1e0c1d];return _0x3a1260;};'use strict';var Sequelize=require(_0x4977('0x0'));module[_0x4977('0x1')]={'name':{'type':Sequelize[_0x4977('0x2')]},'basename':{'type':Sequelize[_0x4977('0x2')]},'type':{'type':Sequelize[_0x4977('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 83f4d99..7853207 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 _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 +var _0x3aea=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','send','Attachment','rawAttributes','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','clone','find','omit','createdAt','updatedAt','create','body','basename','file','filename','type','mimetype','download','join','root','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5194b9,_0x50fab6){var _0x1b6cb5=function(_0x2d2589){while(--_0x2d2589){_0x5194b9['push'](_0x5194b9['shift']());}};_0x1b6cb5(++_0x50fab6);}(_0x3aea,0x13e));var _0xa3ae=function(_0x378b02,_0x2f2a0){_0x378b02=_0x378b02-0x0;var _0x399107=_0x3aea[_0x378b02];return _0x399107;};'use strict';var pdf=require(_0xa3ae('0x0'));var emlformat=require(_0xa3ae('0x1'));var rimraf=require(_0xa3ae('0x2'));var zipdir=require(_0xa3ae('0x3'));var jsonpatch=require(_0xa3ae('0x4'));var rp=require(_0xa3ae('0x5'));var moment=require(_0xa3ae('0x6'));var BPromise=require(_0xa3ae('0x7'));var Mustache=require(_0xa3ae('0x8'));var util=require('util');var path=require(_0xa3ae('0x9'));var sox=require(_0xa3ae('0xa'));var csv=require('to-csv');var ejs=require(_0xa3ae('0xb'));var fs=require('fs');var _=require(_0xa3ae('0xc'));var squel=require(_0xa3ae('0xd'));var crypto=require(_0xa3ae('0xe'));var jsforce=require(_0xa3ae('0xf'));var deskjs=require(_0xa3ae('0x10'));var toCsv=require(_0xa3ae('0x11'));var querystring=require(_0xa3ae('0x12'));var Papa=require('papaparse');var Redis=require(_0xa3ae('0x13'));var authService=require(_0xa3ae('0x14'));var qs=require(_0xa3ae('0x15'));var as=require(_0xa3ae('0x16'));var hardwareService=require(_0xa3ae('0x17'));var logger=require(_0xa3ae('0x18'))(_0xa3ae('0x19'));var utils=require('../../config/utils');var config=require(_0xa3ae('0x1a'));var licenseUtil=require(_0xa3ae('0x1b'));var db=require(_0xa3ae('0x1c'))['db'];function respondWithStatusCode(_0x2c04ba,_0x5cf954){_0x5cf954=_0x5cf954||0xcc;return function(_0x728726){if(_0x728726){return _0x2c04ba[_0xa3ae('0x1d')](_0x5cf954);}return _0x2c04ba[_0xa3ae('0x1e')](_0x5cf954)['end']();};}function respondWithResult(_0x3455a8,_0x36966e){_0x36966e=_0x36966e||0xc8;return function(_0x2f7532){if(_0x2f7532){return _0x3455a8['status'](_0x36966e)[_0xa3ae('0x1f')](_0x2f7532);}};}function respondWithFilteredResult(_0x26295a,_0xbcd171){return function(_0xa69c19){if(_0xa69c19){var _0x33015d=_0xa69c19[_0xa3ae('0x20')],_0x17b996=_0xbcd171['offset'],_0x1e9a34=_0xbcd171[_0xa3ae('0x21')]+_0xbcd171['limit'],_0x54e7a3;if(_0x1e9a34>=_0x33015d){_0x1e9a34=_0x33015d;_0x54e7a3=0xc8;}else{_0x54e7a3=0xce;}_0x26295a[_0xa3ae('0x1e')](_0x54e7a3);return _0x26295a[_0xa3ae('0x22')](_0xa3ae('0x23'),_0x17b996+'-'+_0x1e9a34+'/'+_0x33015d)['json'](_0xa69c19);}return null;};}function patchUpdates(_0x375f8d){return function(_0x141868){try{jsonpatch['apply'](_0x141868,_0x375f8d,!![]);}catch(_0x25ee61){return BPromise[_0xa3ae('0x24')](_0x25ee61);}return _0x141868[_0xa3ae('0x25')]();};}function saveUpdates(_0xfe3b4b,_0x591b22){return function(_0x1ab0d5){if(_0x1ab0d5){return _0x1ab0d5[_0xa3ae('0x26')](_0xfe3b4b)[_0xa3ae('0x27')](function(_0x17d21e){return _0x17d21e;});}return null;};}function removeEntity(_0x899f01,_0x59ef68){return function(_0x520b6b){if(_0x520b6b){return _0x520b6b[_0xa3ae('0x28')]()[_0xa3ae('0x27')](function(){_0x899f01[_0xa3ae('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de9a1,_0x2fd29d){return function(_0x5fb017){if(!_0x5fb017){_0x3de9a1[_0xa3ae('0x1d')](0x194);}return _0x5fb017;};}function handleError(_0x413438,_0x2bea28){_0x2bea28=_0x2bea28||0x1f4;return function(_0x3df3b9){logger['error'](_0x3df3b9[_0xa3ae('0x29')]);if(_0x3df3b9[_0xa3ae('0x2a')]){delete _0x3df3b9[_0xa3ae('0x2a')];}_0x413438[_0xa3ae('0x1e')](_0x2bea28)[_0xa3ae('0x2b')](_0x3df3b9);};}exports['index']=function(_0x272361,_0x2f91be){var _0x238c77={},_0x3d524f={},_0x3b2d36={'count':0x0,'rows':[]};var _0x192526=_['map'](db[_0xa3ae('0x2c')][_0xa3ae('0x2d')],function(_0x24ba82){return{'name':_0x24ba82['fieldName'],'type':_0x24ba82['type']['key']};});_0x3d524f[_0xa3ae('0x2e')]=_[_0xa3ae('0x2f')](_0x192526,'name');_0x3d524f['query']=_['keys'](_0x272361[_0xa3ae('0x30')]);_0x3d524f[_0xa3ae('0x31')]=_[_0xa3ae('0x32')](_0x3d524f[_0xa3ae('0x2e')],_0x3d524f[_0xa3ae('0x30')]);_0x238c77[_0xa3ae('0x33')]=_[_0xa3ae('0x32')](_0x3d524f[_0xa3ae('0x2e')],qs['fields'](_0x272361[_0xa3ae('0x30')][_0xa3ae('0x34')]));_0x238c77['attributes']=_0x238c77[_0xa3ae('0x33')][_0xa3ae('0x35')]?_0x238c77[_0xa3ae('0x33')]:_0x3d524f[_0xa3ae('0x2e')];if(!_0x272361[_0xa3ae('0x30')][_0xa3ae('0x36')]('nolimit')){_0x238c77[_0xa3ae('0x37')]=qs[_0xa3ae('0x37')](_0x272361[_0xa3ae('0x30')][_0xa3ae('0x37')]);_0x238c77[_0xa3ae('0x21')]=qs[_0xa3ae('0x21')](_0x272361[_0xa3ae('0x30')][_0xa3ae('0x21')]);}_0x238c77[_0xa3ae('0x38')]=qs[_0xa3ae('0x39')](_0x272361['query'][_0xa3ae('0x39')]);_0x238c77[_0xa3ae('0x3a')]=qs[_0xa3ae('0x31')](_[_0xa3ae('0x3b')](_0x272361[_0xa3ae('0x30')],_0x3d524f[_0xa3ae('0x31')]),_0x192526);if(_0x272361[_0xa3ae('0x30')][_0xa3ae('0x3c')]){_0x238c77[_0xa3ae('0x3a')]=_[_0xa3ae('0x3d')](_0x238c77[_0xa3ae('0x3a')],{'$or':_['map'](_0x192526,function(_0x11e307){if(_0x11e307['type']!=='VIRTUAL'){var _0x36dba2={};_0x36dba2[_0x11e307[_0xa3ae('0x2a')]]={'$like':'%'+_0x272361[_0xa3ae('0x30')][_0xa3ae('0x3c')]+'%'};return _0x36dba2;}})});}_0x238c77=_[_0xa3ae('0x3d')]({},_0x238c77,_0x272361[_0xa3ae('0x3e')]);var _0x33a5f2={'where':_0x238c77[_0xa3ae('0x3a')]};return db[_0xa3ae('0x2c')]['count'](_0x33a5f2)[_0xa3ae('0x27')](function(_0x4df123){_0x3b2d36['count']=_0x4df123;if(_0x272361[_0xa3ae('0x30')][_0xa3ae('0x3f')]){_0x238c77[_0xa3ae('0x40')]=[{'all':!![]}];}return db[_0xa3ae('0x2c')][_0xa3ae('0x41')](_0x238c77);})[_0xa3ae('0x27')](function(_0x364842){_0x3b2d36[_0xa3ae('0x42')]=_0x364842;return _0x3b2d36;})['then'](respondWithFilteredResult(_0x2f91be,_0x238c77))[_0xa3ae('0x43')](handleError(_0x2f91be,null));};exports[_0xa3ae('0x44')]=function(_0x54b464,_0xae3a85){var _0x543898={'raw':!![],'where':{'id':_0x54b464[_0xa3ae('0x45')]['id']}},_0x1a8f8b={};_0x1a8f8b['model']=_[_0xa3ae('0x46')](db['Attachment']['rawAttributes']);_0x1a8f8b['query']=_[_0xa3ae('0x46')](_0x54b464['query']);_0x1a8f8b[_0xa3ae('0x31')]=_['intersection'](_0x1a8f8b[_0xa3ae('0x2e')],_0x1a8f8b[_0xa3ae('0x30')]);_0x543898['attributes']=_[_0xa3ae('0x32')](_0x1a8f8b[_0xa3ae('0x2e')],qs[_0xa3ae('0x34')](_0x54b464[_0xa3ae('0x30')]['fields']));_0x543898['attributes']=_0x543898['attributes'][_0xa3ae('0x35')]?_0x543898['attributes']:_0x1a8f8b[_0xa3ae('0x2e')];if(_0x54b464['query'][_0xa3ae('0x3f')]){_0x543898[_0xa3ae('0x40')]=[{'all':!![]}];}_0x543898=_[_0xa3ae('0x3d')]({},_0x543898,_0x54b464[_0xa3ae('0x3e')]);return db[_0xa3ae('0x2c')]['find'](_0x543898)[_0xa3ae('0x27')](handleEntityNotFound(_0xae3a85,null))['then'](respondWithResult(_0xae3a85,null))[_0xa3ae('0x43')](handleError(_0xae3a85,null));};exports[_0xa3ae('0x47')]=function(_0x2d059e,_0x2a7858){var _0x830cbc={'where':{'id':_0x2d059e[_0xa3ae('0x45')]['id']}},_0x4a84b5={};_0x4a84b5['model']=_[_0xa3ae('0x46')](db[_0xa3ae('0x2c')][_0xa3ae('0x2d')]);_0x830cbc['attributes']=_[_0xa3ae('0x32')](_0x4a84b5[_0xa3ae('0x2e')],qs[_0xa3ae('0x34')](_0x2d059e['query'][_0xa3ae('0x34')]));_0x830cbc['attributes']=_0x830cbc[_0xa3ae('0x33')][_0xa3ae('0x35')]?_0x830cbc['attributes']:_0x4a84b5[_0xa3ae('0x2e')];if(_0x2d059e[_0xa3ae('0x30')][_0xa3ae('0x3f')]){_0x830cbc[_0xa3ae('0x40')]=[{'all':!![]}];}_0x830cbc=_[_0xa3ae('0x3d')]({},_0x830cbc,_0x2d059e[_0xa3ae('0x3e')]);return db[_0xa3ae('0x2c')][_0xa3ae('0x48')](_0x830cbc)[_0xa3ae('0x27')](handleEntityNotFound(_0x2a7858,null))[_0xa3ae('0x27')](function(_0x42bdf1){if(_0x42bdf1){var _0x27fd7d=_0x42bdf1['get']({'plain':!![]});_0x27fd7d=qs[_0xa3ae('0x49')](_0x27fd7d,['id',_0xa3ae('0x4a'),_0xa3ae('0x4b')]);_0x2d059e['body']=_['omit'](_0x2d059e['body'],['id',_0xa3ae('0x4a'),_0xa3ae('0x4b')]);return db[_0xa3ae('0x2c')][_0xa3ae('0x4c')](_[_0xa3ae('0x3d')](_0x27fd7d,_0x2d059e[_0xa3ae('0x4d')]),{'include':_0x2d059e['query'][_0xa3ae('0x3f')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2a7858,0xc9))['catch'](handleError(_0x2a7858,null));};exports['update']=function(_0x43c91c,_0x2c8514){if(_0x43c91c[_0xa3ae('0x4d')]['id']){delete _0x43c91c[_0xa3ae('0x4d')]['id'];}return db[_0xa3ae('0x2c')][_0xa3ae('0x48')]({'where':{'id':_0x43c91c[_0xa3ae('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c8514,null))['then'](saveUpdates(_0x43c91c[_0xa3ae('0x4d')],null))[_0xa3ae('0x27')](respondWithResult(_0x2c8514,null))['catch'](handleError(_0x2c8514,null));};exports[_0xa3ae('0x28')]=function(_0x2aa344,_0x3f4439){return db[_0xa3ae('0x2c')][_0xa3ae('0x48')]({'where':{'id':_0x2aa344[_0xa3ae('0x45')]['id']}})[_0xa3ae('0x27')](handleEntityNotFound(_0x3f4439,null))['then'](removeEntity(_0x3f4439,null))[_0xa3ae('0x43')](handleError(_0x3f4439,null));};exports[_0xa3ae('0x4c')]=function(_0x2c739f,_0x432dcb,_0x296c11){_0x2c739f[_0xa3ae('0x4d')][_0xa3ae('0x2a')]=_0x2c739f['file']['originalname'];_0x2c739f[_0xa3ae('0x4d')][_0xa3ae('0x4e')]=_0x2c739f[_0xa3ae('0x4f')][_0xa3ae('0x50')];_0x2c739f['body'][_0xa3ae('0x51')]=_0x2c739f[_0xa3ae('0x4f')][_0xa3ae('0x52')];return db['Attachment'][_0xa3ae('0x4c')](_0x2c739f[_0xa3ae('0x4d')])[_0xa3ae('0x27')](respondWithResult(_0x432dcb,0xc9))[_0xa3ae('0x43')](handleError(_0x432dcb,null));};exports[_0xa3ae('0x53')]=function(_0x98a845,_0xc8ed01,_0x3cc2cb){return db['Attachment']['findOne']({'where':{'id':_0x98a845[_0xa3ae('0x45')]['id']},'raw':!![]})[_0xa3ae('0x27')](handleEntityNotFound(_0xc8ed01,null))[_0xa3ae('0x27')](function(_0x148f25){if(_0x148f25){return _0xc8ed01['download'](path[_0xa3ae('0x54')](config[_0xa3ae('0x55')],'server/files/attachments/',_0x148f25[_0xa3ae('0x4e')]));}})[_0xa3ae('0x43')](handleError(_0xc8ed01,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 9b27ca0..d374da7 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 _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 +var _0x35ff=['../../config/logger','moment','bluebird','path','../../config/environment','./attachment.attributes','exports','define','attachments','util'];(function(_0x3f3d4b,_0x1b99d4){var _0x22c2ca=function(_0x518f6a){while(--_0x518f6a){_0x3f3d4b['push'](_0x3f3d4b['shift']());}};_0x22c2ca(++_0x1b99d4);}(_0x35ff,0xb3));var _0xf35f=function(_0x5526c9,_0x19475e){_0x5526c9=_0x5526c9-0x0;var _0xb002ed=_0x35ff[_0x5526c9];return _0xb002ed;};'use strict';var _=require('lodash');var util=require(_0xf35f('0x0'));var logger=require(_0xf35f('0x1'))('api');var moment=require(_0xf35f('0x2'));var BPromise=require(_0xf35f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf35f('0x4'));var rimraf=require('rimraf');var config=require(_0xf35f('0x5'));var attributes=require(_0xf35f('0x6'));module[_0xf35f('0x7')]=function(_0x1f9847,_0x1821a6){return _0x1f9847[_0xf35f('0x8')]('Attachment',attributes,{'tableName':_0xf35f('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 57c9891..6a77c22 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 _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 +var _0xa27c=['jayson/promise','client','http','request','Attachment,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','Attachment','options','raw','CreateAttachment','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4542ab,_0x5f0cd5){var _0x595f68=function(_0x30c66b){while(--_0x30c66b){_0x4542ab['push'](_0x4542ab['shift']());}};_0x595f68(++_0x5f0cd5);}(_0xa27c,0x124));var _0xca27=function(_0x486d79,_0x573471){_0x486d79=_0x486d79-0x0;var _0x3e588a=_0xa27c[_0x486d79];return _0x3e588a;};'use strict';var _=require(_0xca27('0x0'));var util=require(_0xca27('0x1'));var moment=require(_0xca27('0x2'));var BPromise=require(_0xca27('0x3'));var rs=require(_0xca27('0x4'));var fs=require('fs');var Redis=require(_0xca27('0x5'));var db=require(_0xca27('0x6'))['db'];var utils=require(_0xca27('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xca27('0x8'));var client=jayson[_0xca27('0x9')][_0xca27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27082e,_0x1c789a,_0x49c277){return new BPromise(function(_0x8b54c9,_0x298f71){return client[_0xca27('0xb')](_0x27082e,_0x49c277)['then'](function(_0x3d6585){logger['info'](_0xca27('0xc'),_0x1c789a,'request\x20sent');logger[_0xca27('0xd')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1c789a,'request\x20sent',JSON[_0xca27('0xe')](_0x3d6585));if(_0x3d6585['error']){if(_0x3d6585[_0xca27('0xf')][_0xca27('0x10')]===0x1f4){logger['error'](_0xca27('0xc'),_0x1c789a,_0x3d6585[_0xca27('0xf')][_0xca27('0x11')]);return _0x298f71(_0x3d6585[_0xca27('0xf')][_0xca27('0x11')]);}logger[_0xca27('0xf')]('Attachment,\x20%s,\x20%s',_0x1c789a,_0x3d6585[_0xca27('0xf')][_0xca27('0x11')]);return _0x8b54c9(_0x3d6585[_0xca27('0xf')][_0xca27('0x11')]);}else{logger[_0xca27('0x12')](_0xca27('0xc'),_0x1c789a,_0xca27('0x13'));_0x8b54c9(_0x3d6585['result'][_0xca27('0x11')]);}})[_0xca27('0x14')](function(_0x4a72d2){logger[_0xca27('0xf')](_0xca27('0xc'),_0x1c789a,_0x4a72d2);_0x298f71(_0x4a72d2);});});}exports['CreateAttachment']=function(_0x28dbdb){var _0x1b0b9f=this;return new Promise(function(_0x477e2a,_0x1018f1){return db[_0xca27('0x15')]['create'](_0x28dbdb['body'],{'raw':_0x28dbdb[_0xca27('0x16')]?_0x28dbdb[_0xca27('0x16')][_0xca27('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x550c7b){logger[_0xca27('0x12')](_0xca27('0x18'),_0x28dbdb);logger['debug'](_0xca27('0x18'),_0x28dbdb,JSON[_0xca27('0xe')](_0x550c7b));_0x477e2a(_0x550c7b);})[_0xca27('0x14')](function(_0x54b5da){logger[_0xca27('0xf')](_0xca27('0x18'),_0x54b5da[_0xca27('0x11')],_0x28dbdb);_0x1018f1(_0x1b0b9f[_0xca27('0xf')](0x1f4,_0x54b5da[_0xca27('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f4eb86f..dcb4294 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 _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 +var _0x3779=['../../config/environment','isAuthenticated','index','/:id','show','post','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','file','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2d84ee,_0x27624d){var _0x148672=function(_0x39396f){while(--_0x39396f){_0x2d84ee['push'](_0x2d84ee['shift']());}};_0x148672(++_0x27624d);}(_0x3779,0x102));var _0x9377=function(_0xf15be4,_0x2c2591){_0xf15be4=_0xf15be4-0x0;var _0x2b6849=_0x3779[_0xf15be4];return _0x2b6849;};'use strict';var multer=require(_0x9377('0x0'));var util=require(_0x9377('0x1'));var path=require('path');var timeout=require(_0x9377('0x2'));var express=require(_0x9377('0x3'));var router=express[_0x9377('0x4')]();var auth=require(_0x9377('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9377('0x6'));var controller=require('./attachment.controller');router['get']('/',auth[_0x9377('0x7')](),controller[_0x9377('0x8')]);router['get'](_0x9377('0x9'),auth[_0x9377('0x7')](),controller[_0x9377('0xa')]);router['get']('/:id/download',auth[_0x9377('0x7')](),controller['download']);router[_0x9377('0xb')]('/:id/clone',auth[_0x9377('0x7')](),controller['clone']);var upload=multer({'storage':multer[_0x9377('0xc')]({'destination':function(_0x5a536f,_0x537e90,_0x1f1b40){_0x1f1b40(null,path[_0x9377('0xd')](config[_0x9377('0xe')],_0x9377('0xf')));},'filename':function(_0x3b127d,_0x1aafca,_0x50bd45){_0x50bd45(null,util[_0x9377('0x10')](_0x9377('0x11'),Date[_0x9377('0x12')](),_0x1aafca[_0x9377('0x13')][_0x9377('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x9377('0xb')]('/',upload['single'](_0x9377('0x15')),controller['create']);router['put']('/:id',auth[_0x9377('0x7')](),controller[_0x9377('0x16')]);router['delete']('/:id',auth[_0x9377('0x7')](),controller['destroy']);module[_0x9377('0x17')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 3bebeda..d88b065 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 _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 +var _0x950f=['../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login','profile','use','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','emails','value','admin','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x950f,0x151));var _0xf950=function(_0x2d5678,_0xdfb48f){_0x2d5678=_0x2d5678-0x0;var _0x4ad11a=_0x950f[_0x2d5678];return _0x4ad11a;};'use strict';var _=require(_0xf950('0x0'));var passport=require(_0xf950('0x1'));var GoogleStrategy=require(_0xf950('0x2'))['Strategy'];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0xf950('0x3'));var signToken=require(_0xf950('0x4'))['signToken'];var utils=require(_0xf950('0x5'));exports[_0xf950('0x6')]=passport[_0xf950('0x7')](_0xf950('0x8'),{'failureRedirect':_0xf950('0x9'),'scope':[_0xf950('0xa'),'email'],'session':![]});exports['callback']=passport[_0xf950('0x7')](_0xf950('0x8'),{'failureRedirect':_0xf950('0x9'),'session':![]});passport[_0xf950('0xb')](new GoogleStrategy({'clientID':config['google']?config[_0xf950('0x8')]['clientID']:'id','clientSecret':config['google']?config[_0xf950('0x8')][_0xf950('0xc')]:_0xf950('0xd'),'callbackURL':config[_0xf950('0x8')]?config[_0xf950('0x8')][_0xf950('0xe')]:''},function(_0x5cd4fa,_0x50c2b9,_0x27b7a4,_0x4f4c6c){var _0xd8ad85,_0x335354;return db[_0xf950('0xf')][_0xf950('0x10')]({'where':{'id':0x1},'attributes':[_0xf950('0x11'),_0xf950('0x12')],'raw':!![]})[_0xf950('0x13')](function(_0x38c5b3){_0xd8ad85=_0x38c5b3;return db['User'][_0xf950('0x14')]({'where':{'email':_[_0xf950('0x15')](_0x27b7a4[_0xf950('0x16')],_0xf950('0x17')),'role':{'$or':[_0xf950('0x18'),'user','agent']}}});})[_0xf950('0x13')](function(_0x2f0f20){_0x335354=_0x2f0f20;if(_0x335354){if(_0x335354[_0xf950('0x19')]){return _0x4f4c6c(_0xf950('0x1a'));}else if(_0xd8ad85[_0xf950('0x12')]>0x0){if(_0x335354[_0xf950('0x1b')]){if(moment(_0x335354[_0xf950('0x1c')])[_0xf950('0x1d')](_0xd8ad85[_0xf950('0x12')],_0xf950('0x1e'))>moment()){return _0x4f4c6c(_0xf950('0x1a'));}else{return utils[_0xf950('0x1f')](_0x335354,0x0,![],null)[_0xf950('0x13')](function(){return utils[_0xf950('0x20')](_0x335354);})[_0xf950('0x13')](function(){return _0x4f4c6c(null,_0x335354);});}}else{return utils[_0xf950('0x20')](_0x335354)[_0xf950('0x13')](function(){return _0x4f4c6c(null,_0x335354);});}}else{return utils[_0xf950('0x20')](_0x335354)[_0xf950('0x13')](function(){return _0x4f4c6c(null,_0x335354);});}}return _0x4f4c6c(_0xf950('0x1a'));})[_0xf950('0x21')](function(_0x133de3){_0x4f4c6c(_0x133de3);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2d800cf..00efa0f 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 _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 +var _0xbdeb=['./authGoogle.controller','../../components/auth/service','get','login','isMiddleware','setTokenCookie','exports','passport'];(function(_0x4f2c3a,_0x6bde90){var _0x17d91c=function(_0xaaf630){while(--_0xaaf630){_0x4f2c3a['push'](_0x4f2c3a['shift']());}};_0x17d91c(++_0x6bde90);}(_0xbdeb,0x6f));var _0xbbde=function(_0x3728bd,_0x405db5){_0x3728bd=_0x3728bd-0x0;var _0xdf5cb5=_0xbdeb[_0x3728bd];return _0xdf5cb5;};'use strict';var express=require('express');var passport=require(_0xbbde('0x0'));var router=express['Router']();var controller=require(_0xbbde('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0xbbde('0x2'));router[_0xbbde('0x3')]('/',controller[_0xbbde('0x4')]);router[_0xbbde('0x3')]('/callback',controller['callback'],authService[_0xbbde('0x5')],userController[_0xbbde('0x4')],authService[_0xbbde('0x6')]);module[_0xbbde('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 50b1824..11ff6ae 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 _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 +var _0xa46e=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','send','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','Password\x20reset!','use','util','passport','Strategy','jayson/promise','lodash','moment','../../components/auth/service','client','Setting','findOne','password','salt','role','blocked','blockedAt','admin','user','then','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','allowedLoginAttempts','blockDuration','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut'];(function(_0x37237c,_0x2b74aa){var _0x47089c=function(_0x28666e){while(--_0x28666e){_0x37237c['push'](_0x37237c['shift']());}};_0x47089c(++_0x2b74aa);}(_0xa46e,0x8a));var _0xea46=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xa46e[_0xdea41a];return _0x15d0d8;};'use strict';var util=require(_0xea46('0x0'));var passport=require(_0xea46('0x1'));var LocalStrategy=require('passport-local')[_0xea46('0x2')];var jayson=require(_0xea46('0x3'));var _=require(_0xea46('0x4'));var rs=require('randomstring');var moment=require(_0xea46('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xea46('0x6'));var utils=require('../../config/utils');var client=jayson[_0xea46('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x10bee5,_0x3dc26f,_0x5f1cd1,_0x2d1b30){var _0x42771a,_0xe7d428;return db[_0xea46('0x8')][_0xea46('0x9')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})['then'](function(_0x2c82e){_0x42771a=_0x2c82e;return _0x10bee5[_0xea46('0x9')]({'attributes':['id','name',_0xea46('0xa'),_0xea46('0xb'),_0xea46('0xc'),'disabled',_0xea46('0xd'),_0xea46('0xe'),'loginAttempts'],'where':{'name':_0x3dc26f,'role':{'$or':[_0xea46('0xf'),_0xea46('0x10'),'agent']}}});})[_0xea46('0x11')](function(_0x4e4d3f){if(!_0x4e4d3f||_0x4e4d3f&&_0x4e4d3f[_0xea46('0x12')]!==_0x3dc26f){throw new Error(_0xea46('0x13'));}else{_0xe7d428=_0x4e4d3f;return _0xe7d428;}})[_0xea46('0x11')](function(){_0xe7d428[_0xea46('0x14')](_0x5f1cd1,function(_0xc76198,_0x2ef436){var _0x81ee45=_0xe7d428[_0xea46('0x15')]+0x1;if(_0xc76198){return _0x2d1b30(_0xc76198);}else if(!_0x2ef436){if(_0xe7d428[_0xea46('0x16')]){return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x42771a[_0xea46('0x17')]>0x0){if(_0xe7d428[_0xea46('0xd')]){if(_0x42771a[_0xea46('0x18')]>0x0){if(moment(_0xe7d428['blockedAt'])['add'](_0x42771a[_0xea46('0x18')],_0xea46('0x19'))>moment()){return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0xe7d428,_0x81ee45,![],null)[_0xea46('0x11')](function(){return _0x2d1b30(null,![],{'message':_0xea46('0x13')});});}}else{return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x81ee45>=_0x42771a[_0xea46('0x17')]){return utils[_0xea46('0x1a')](_0xe7d428,0x0,!![],moment())[_0xea46('0x11')](function(){return _0x2d1b30(null,![],{'message':_0xea46('0x13')});});}else{return utils['clearBlockUser'](_0xe7d428,_0x81ee45,![],null)[_0xea46('0x11')](function(){return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xe7d428[_0xea46('0x16')]){return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x42771a['allowedLoginAttempts']>0x0){if(_0xe7d428['blocked']){if(_0x42771a[_0xea46('0x18')]>0x0){if(moment(_0xe7d428[_0xea46('0xe')])[_0xea46('0x1b')](_0x42771a['blockDuration'],_0xea46('0x19'))>moment()){return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xea46('0x1a')](_0xe7d428,0x0,![],null)[_0xea46('0x11')](function(){return utils['getLicense'](_0xe7d428);})[_0xea46('0x11')](function(){return _0x2d1b30(null,_0xe7d428);});}}else{return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0xea46('0x1a')](_0xe7d428,0x0,![],null)[_0xea46('0x11')](function(){return utils[_0xea46('0x1c')](_0xe7d428);})['then'](function(){return _0x2d1b30(null,_0xe7d428);})['catch'](function(_0x44e797){return _0x2d1b30(null,![],_0x44e797);});}}else{if(_0xe7d428[_0xea46('0xd')]){return _0x2d1b30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xea46('0x1c')](_0xe7d428)['then'](function(){return _0x2d1b30(null,_0xe7d428);});}}}});})[_0xea46('0x1d')](function(_0x51ca27){return _0x2d1b30(null,![],_0x51ca27);});}function sendServiceMail(_0x158ecd){return db[_0xea46('0x1e')][_0xea46('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xea46('0x12'),_0xea46('0x20')],'include':[{'model':db[_0xea46('0x21')],'as':'Smtp'}]})[_0xea46('0x11')](function(_0x338e96){if(!_0x338e96){throw new Error(_0xea46('0x22'));}var _0x5e0e35={'tls':{'rejectUnauthorized':![]}};if(_0x338e96[_0xea46('0x23')][_0xea46('0x24')]){_0x5e0e35[_0xea46('0x24')]=_0x338e96['Smtp']['service'];}else{_0x5e0e35['host']=_0x338e96[_0xea46('0x23')][_0xea46('0x25')];_0x5e0e35[_0xea46('0x26')]=_0x338e96[_0xea46('0x23')][_0xea46('0x26')];_0x5e0e35[_0xea46('0x27')]=_0x338e96[_0xea46('0x23')][_0xea46('0x27')];}if(_0x338e96[_0xea46('0x23')][_0xea46('0x28')]){_0x5e0e35[_0xea46('0x29')]={'user':_0x338e96['Smtp'][_0xea46('0x10')],'pass':_0x338e96[_0xea46('0x23')][_0xea46('0x2a')]};}var _0x213c5a={'account':_0x5e0e35,'message':_[_0xea46('0x2b')]({'from':util[_0xea46('0x2c')](_0xea46('0x2d'),_0x338e96['name'],_0x338e96[_0xea46('0x20')]||_0x338e96[_0xea46('0x23')][_0xea46('0x10')])},_0x158ecd)};return client[_0xea46('0x2e')](_0xea46('0x2f'),_0x213c5a);})['then'](function(_0x483ec7){if(_0x483ec7[_0xea46('0x30')]){throw new Error(util[_0xea46('0x2c')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x483ec7[_0xea46('0x30')][_0xea46('0x31')]||JSON[_0xea46('0x32')](_0x483ec7[_0xea46('0x30')])));}return!![];});}function handleError(_0x49827f,_0x4b9ca7,_0x1b9406){return _0x49827f['status'](_0x4b9ca7||0x1f4)[_0xea46('0x33')]({'message':_0x1b9406?_0x1b9406[_0xea46('0x31')]||_0x1b9406:''});}exports['login']=function(_0x1e61fd,_0x273de6,_0x5f5697){passport[_0xea46('0x14')](_0xea46('0x34'),function(_0x5f37f2,_0xe70a45,_0x41e9e8){var _0x3fc311=_0x5f37f2||_0x41e9e8;if(_0x3fc311){return handleError(_0x273de6,0x191,_0x3fc311);}if(!_0xe70a45){return handleError(_0x273de6,0x194,{'message':_0xea46('0x35')});}else{var _0x4a0287={'payload':{'id':_0xe70a45['id'],'role':_0xe70a45[_0xea46('0xc')]},'options':{'expiresIn':0x15180}};return authService[_0xea46('0x36')](_0x4a0287)[_0xea46('0x11')](function(_0x1a6233){_0x273de6[_0xea46('0x37')]({'id':_0xe70a45['id'],'token':_0x1a6233,'statusCall':'','isAlreadyLogged':_0xe70a45['online']});});}})(_0x1e61fd,_0x273de6,_0x5f5697);};exports[_0xea46('0x38')]=function(_0xdb2e11,_0x4fb9eb,_0x1206ac){if(!_0xdb2e11[_0xea46('0x39')][_0xea46('0x20')]){return handleError(_0x4fb9eb,0x1f4,{'message':_0xea46('0x3a')});}var _0x50564c=rs[_0xea46('0x3b')]();_0xdb2e11[_0xea46('0x39')][_0xea46('0x20')]=_0xdb2e11['body'][_0xea46('0x20')][_0xea46('0x3c')]()[_0xea46('0x3d')]();var _0x32c81c;return db[_0xea46('0x8')][_0xea46('0x9')]({'where':{'id':0x1},'attributes':[_0xea46('0x17'),_0xea46('0x18')],'raw':!![]})[_0xea46('0x11')](function(_0x23ab02){_0x32c81c=_0x23ab02;return db[_0xea46('0x3e')][_0xea46('0x1f')]({'where':{'email':_0xdb2e11[_0xea46('0x39')][_0xea46('0x20')]}});})[_0xea46('0x11')](function(_0x5cac42){if(!_0x5cac42){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x5cac42[_0xea46('0x16')]){throw new Error(_0xea46('0x3f'));}if(_0x5cac42[_0xea46('0xd')]){if(moment(_0x5cac42[_0xea46('0xe')])['add'](_0x32c81c['blockDuration'],'minutes')>moment()){throw new Error(_0xea46('0x40'));}else{_0x5cac42[_0xea46('0xd')]=![];_0x5cac42['blockedAt']=null;}}_0x5cac42[_0xea46('0x41')]=_0x50564c;_0x5cac42[_0xea46('0x42')]=Date[_0xea46('0x43')]()+0x36ee80;return _0x5cac42[_0xea46('0x44')]();})[_0xea46('0x11')](function(){return sendServiceMail({'to':_0xdb2e11['body'][_0xea46('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xea46('0x45')+_0xea46('0x46')+_0xea46('0x47')+_0xdb2e11[_0xea46('0x48')][_0xea46('0x25')]+_0xea46('0x49')+_0x50564c+'\x0a\x0a'+_0xea46('0x4a')});})['then'](function(){_0x4fb9eb[_0xea46('0x4b')](0xc8)[_0xea46('0x33')]({'message':'Reset\x20Email\x20sent!'});})[_0xea46('0x1d')](function(_0x42e305){return handleError(_0x4fb9eb,0x1f4,_0x42e305);});};exports[_0xea46('0x4c')]=function(_0x548572,_0x5dd433,_0x5f77c4){return db[_0xea46('0x3e')][_0xea46('0x1f')]({'where':{'resetPasswordToken':_0x548572[_0xea46('0x4d')][_0xea46('0x4e')],'resetPasswordExpires':{'$gt':Date[_0xea46('0x43')]()}}})[_0xea46('0x11')](function(_0x192cc1){if(!_0x192cc1){throw new Error(_0xea46('0x4f'));}return db[_0xea46('0x8')]['findOne']({'attributes':['id',_0xea46('0x50'),'enforcePasswordHistory',_0xea46('0x51')]})[_0xea46('0x11')](function(_0x949159){if(_0x949159['securePassword'])authService[_0xea46('0x52')](_0x548572[_0xea46('0x39')][_0xea46('0xa')]);if(!_0x949159[_0xea46('0x53')]||!_0x192cc1['previousPasswords'])return _0x192cc1;authService['validatePasswordHistory'](_0x548572[_0xea46('0x39')][_0xea46('0xa')],_0x192cc1['previousPasswords'],_0x949159[_0xea46('0x51')]);return _0x192cc1;})['then'](function(){_0x192cc1[_0xea46('0xa')]=_0x548572[_0xea46('0x39')][_0xea46('0xa')];_0x192cc1[_0xea46('0x41')]=null;_0x192cc1[_0xea46('0x42')]=null;return _0x192cc1[_0xea46('0x44')]();});})[_0xea46('0x11')](function(){_0x5dd433['status'](0xc8)['send']({'message':_0xea46('0x54')});})['catch'](function(_0x855801){return handleError(_0x5dd433,0x1f4,_0x855801);});};passport[_0xea46('0x55')](new LocalStrategy({'usernameField':_0xea46('0x12'),'passwordField':'password'},function(_0x130e91,_0x4fcd7b,_0xc12018){return localAuthenticate(db[_0xea46('0x3e')],_0x130e91,_0x4fcd7b,_0xc12018);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4daba3c..a880f9c 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 _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 +var _0x6240=['/reset/:token','express','Router','./authLocal.controller','post','login','forgot'];(function(_0x380ad3,_0x433809){var _0x1a1dad=function(_0x558840){while(--_0x558840){_0x380ad3['push'](_0x380ad3['shift']());}};_0x1a1dad(++_0x433809);}(_0x6240,0x14a));var _0x0624=function(_0x2e9a03,_0x4b6b57){_0x2e9a03=_0x2e9a03-0x0;var _0x1a2588=_0x6240[_0x2e9a03];return _0x1a2588;};'use strict';var express=require(_0x0624('0x0'));var router=express[_0x0624('0x1')]();var controller=require(_0x0624('0x2'));router[_0x0624('0x3')]('/',controller[_0x0624('0x4')]);router[_0x0624('0x3')]('/forgot',controller[_0x0624('0x5')]);router[_0x0624('0x3')](_0x0624('0x6'),controller['reset']);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 51e2164..f04472b 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 _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 +var _0xc67d=['BOOLEAN','exports','STRING'];(function(_0x5b2e3f,_0x42141d){var _0x579b5e=function(_0x192751){while(--_0x192751){_0x5b2e3f['push'](_0x5b2e3f['shift']());}};_0x579b5e(++_0x42141d);}(_0xc67d,0x1de));var _0xdc67=function(_0x20d904,_0x1f5cd7){_0x20d904=_0x20d904-0x0;var _0x47fb38=_0xc67d[_0x20d904];return _0x47fb38;};'use strict';var Sequelize=require('sequelize');module[_0xdc67('0x0')]={'name':{'type':Sequelize[_0xdc67('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xdc67('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xdc67('0x2')],'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 421da70..abe22ee 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(_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 +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(_0xa9cc69,_0x4c723f){var _0x4a47f6=function(_0x2061c9){while(--_0x2061c9){_0xa9cc69['push'](_0xa9cc69['shift']());}};_0x4a47f6(++_0x4c723f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_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 a605e13..75644b6 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 _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 +var _0x56d3=['../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','api','moment','request-promise','path','rimraf'];(function(_0x29cf9b,_0x1d73e2){var _0x4137c1=function(_0x5ea346){while(--_0x5ea346){_0x29cf9b['push'](_0x29cf9b['shift']());}};_0x4137c1(++_0x1d73e2);}(_0x56d3,0x191));var _0x356d=function(_0x5287ce,_0x14b7eb){_0x5287ce=_0x5287ce-0x0;var _0x18f8c0=_0x56d3[_0x5287ce];return _0x18f8c0;};'use strict';var _=require(_0x356d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x356d('0x1'));var moment=require(_0x356d('0x2'));var BPromise=require('bluebird');var rp=require(_0x356d('0x3'));var fs=require('fs');var path=require(_0x356d('0x4'));var rimraf=require(_0x356d('0x5'));var config=require(_0x356d('0x6'));var attributes=require(_0x356d('0x7'));module[_0x356d('0x8')]=function(_0x4e82e0,_0x1aacf2){return _0x4e82e0['define'](_0x356d('0x9'),attributes,{'tableName':_0x356d('0xa'),'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 e832b63..60d8c7a 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 _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 +var _0xa9fd=['util','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x30b0f6,_0x28ec8f){var _0x4a792c=function(_0x5080aa){while(--_0x5080aa){_0x30b0f6['push'](_0x30b0f6['shift']());}};_0x4a792c(++_0x28ec8f);}(_0xa9fd,0xa0));var _0xda9f=function(_0x420279,_0x584c5c){_0x420279=_0x420279-0x0;var _0x34439f=_0xa9fd[_0x420279];return _0x34439f;};'use strict';var _=require('lodash');var util=require(_0xda9f('0x0'));var moment=require(_0xda9f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda9f('0x2'))['db'];var utils=require(_0xda9f('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xda9f('0x4'));var jayson=require(_0xda9f('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27375b,_0x28e7e1,_0x1ad5c5){return new BPromise(function(_0x4d75e3,_0x5444aa){return client['request'](_0x27375b,_0x1ad5c5)['then'](function(_0x5a1b35){logger[_0xda9f('0x6')](_0xda9f('0x7'),_0x28e7e1,_0xda9f('0x8'));logger[_0xda9f('0x9')](_0xda9f('0xa'),_0x28e7e1,_0xda9f('0x8'),JSON[_0xda9f('0xb')](_0x5a1b35));if(_0x5a1b35[_0xda9f('0xc')]){if(_0x5a1b35['error']['code']===0x1f4){logger[_0xda9f('0xc')]('Automation,\x20%s,\x20%s',_0x28e7e1,_0x5a1b35[_0xda9f('0xc')][_0xda9f('0xd')]);return _0x5444aa(_0x5a1b35[_0xda9f('0xc')]['message']);}logger[_0xda9f('0xc')](_0xda9f('0x7'),_0x28e7e1,_0x5a1b35[_0xda9f('0xc')][_0xda9f('0xd')]);return _0x4d75e3(_0x5a1b35[_0xda9f('0xc')][_0xda9f('0xd')]);}else{logger[_0xda9f('0x6')]('Automation,\x20%s,\x20%s',_0x28e7e1,'request\x20sent');_0x4d75e3(_0x5a1b35[_0xda9f('0xe')]['message']);}})[_0xda9f('0xf')](function(_0x260653){logger[_0xda9f('0xc')](_0xda9f('0x7'),_0x28e7e1,_0x260653);_0x5444aa(_0x260653);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e21c7ee..a010d5e 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 _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 +var _0x2b47=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','show','get','/:id/actions','post','/:id/conditions','addConditions','/:id','update','delete','destroy','exports','multer'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2b47,0x77));var _0x72b4=function(_0x1252b4,_0x20c758){_0x1252b4=_0x1252b4-0x0;var _0x327f9a=_0x2b47[_0x1252b4];return _0x327f9a;};'use strict';var multer=require(_0x72b4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x72b4('0x1'));var express=require(_0x72b4('0x2'));var router=express[_0x72b4('0x3')]();var auth=require(_0x72b4('0x4'));var interaction=require(_0x72b4('0x5'));var config=require('../../config/environment');var controller=require(_0x72b4('0x6'));router['get']('/',auth[_0x72b4('0x7')](),controller[_0x72b4('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x72b4('0x9')]);router[_0x72b4('0xa')]('/:id/conditions',auth[_0x72b4('0x7')](),controller['getConditions']);router['get'](_0x72b4('0xb'),auth[_0x72b4('0x7')](),controller['getActions']);router['post']('/',auth[_0x72b4('0x7')](),controller['create']);router[_0x72b4('0xc')](_0x72b4('0xd'),auth[_0x72b4('0x7')](),controller[_0x72b4('0xe')]);router['post'](_0x72b4('0xb'),auth[_0x72b4('0x7')](),controller['addActions']);router['put'](_0x72b4('0xf'),auth[_0x72b4('0x7')](),controller[_0x72b4('0x10')]);router[_0x72b4('0x11')](_0x72b4('0xf'),auth[_0x72b4('0x7')](),controller[_0x72b4('0x12')]);module[_0x72b4('0x13')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 77b3877..ce7908d 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 _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 +var _0xb343=['#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','ENUM','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence'];(function(_0x1dfe9c,_0x8d7f1){var _0x51cd7d=function(_0x2aa8f2){while(--_0x2aa8f2){_0x1dfe9c['push'](_0x1dfe9c['shift']());}};_0x51cd7d(++_0x8d7f1);}(_0xb343,0xa9));var _0x3b34=function(_0x8d3c42,_0x2bae5e){_0x8d3c42=_0x8d3c42-0x0;var _0x331523=_0xb343[_0x8d3c42];return _0x331523;};'use strict';var Sequelize=require(_0x3b34('0x0'));module[_0x3b34('0x1')]={'name':{'type':Sequelize[_0x3b34('0x2')],'unique':_0x3b34('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x3b34('0x4')),'allowNull':![],'defaultValue':_0x3b34('0x4')},'description':{'type':Sequelize[_0x3b34('0x2')]},'active':{'type':Sequelize[_0x3b34('0x5')],'defaultValue':0x0,'comment':_0x3b34('0x6')},'limitCalls':{'type':Sequelize[_0x3b34('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x3b34('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x3b34('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3b34('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x3b34('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b34('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3b34('0x7')](0x5)[_0x3b34('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b34('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b34('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b34('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'comment':_0x3b34('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x3b34('0x7')](0x5)[_0x3b34('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b34('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3b34('0x2')],'defaultValue':_0x3b34('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x3b34('0x11')](_0x3b34('0x12'),'never','onlyIfOpen'),'defaultValue':_0x3b34('0x12')},'dialAMDActive':{'type':Sequelize[_0x3b34('0x5')],'defaultValue':0x0,'comment':_0x3b34('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x3b34('0x7')](0x9)[_0x3b34('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3b34('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x3b34('0x7')](0x9)[_0x3b34('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3b34('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x3b34('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3b34('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x3b34('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3b34('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x3b34('0x7')](0x9)[_0x3b34('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3b34('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3b34('0x7')](0x9)[_0x3b34('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3b34('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3b34('0x7')](0x9)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x3b34('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3b34('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3b34('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3b34('0x7')](0x9)[_0x3b34('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x3b34('0x11')](_0x3b34('0x1c'),_0x3b34('0x1d')),'defaultValue':_0x3b34('0x1c')},'dialPrefix':{'type':Sequelize[_0x3b34('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3b34('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3b34('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b34('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x3b34('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b34('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x3b34('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b34('0x22')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b34('0x23')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3b34('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3b34('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x3b34('0x7')](0x5)[_0x3b34('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3b34('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3b34('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3b34('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'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 32597db..b6e33d5 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 _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 +var _0x3feb=['../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','Campaign','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','merge','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','findOne','hasOwnProperty','pick','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','dialCheckDuplicateType','insert','into','fromQuery','phone','ContactId','field','scheduledAt','CmListId','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','ListId','cm_contacts','push','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','rimraf','zip-dir','request-promise','moment','util','path','sox','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3ec216,_0x4e8a36){var _0x4dee68=function(_0x40b09c){while(--_0x40b09c){_0x3ec216['push'](_0x3ec216['shift']());}};_0x4dee68(++_0x4e8a36);}(_0x3feb,0xf4));var _0xb3fe=function(_0x4420da,_0x4c65fc){_0x4420da=_0x4420da-0x0;var _0x51f9c3=_0x3feb[_0x4420da];return _0x51f9c3;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb3fe('0x0'));var zipdir=require(_0xb3fe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3fe('0x2'));var moment=require(_0xb3fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb3fe('0x4'));var path=require(_0xb3fe('0x5'));var sox=require(_0xb3fe('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb3fe('0x7'));var squel=require('squel');var crypto=require(_0xb3fe('0x8'));var jsforce=require(_0xb3fe('0x9'));var deskjs=require(_0xb3fe('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb3fe('0xb'));var Papa=require(_0xb3fe('0xc'));var Redis=require(_0xb3fe('0xd'));var authService=require(_0xb3fe('0xe'));var qs=require(_0xb3fe('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3fe('0x10'));var logger=require(_0xb3fe('0x11'))(_0xb3fe('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xb3fe('0x13'));var db=require(_0xb3fe('0x14'))['db'];function respondWithStatusCode(_0x2d10d7,_0xfa0738){_0xfa0738=_0xfa0738||0xcc;return function(_0x131d4a){if(_0x131d4a){return _0x2d10d7['sendStatus'](_0xfa0738);}return _0x2d10d7[_0xb3fe('0x15')](_0xfa0738)[_0xb3fe('0x16')]();};}function respondWithResult(_0x10bdbe,_0x3d3171){_0x3d3171=_0x3d3171||0xc8;return function(_0x460323){if(_0x460323){return _0x10bdbe[_0xb3fe('0x15')](_0x3d3171)[_0xb3fe('0x17')](_0x460323);}};}function respondWithFilteredResult(_0x6c15ed,_0x2122bb){return function(_0x4ed4a9){if(_0x4ed4a9){var _0x20572=_0x4ed4a9[_0xb3fe('0x18')],_0x471740=_0x2122bb['offset'],_0x58ba53=_0x2122bb[_0xb3fe('0x19')]+_0x2122bb[_0xb3fe('0x1a')],_0x3f7c45;if(_0x58ba53>=_0x20572){_0x58ba53=_0x20572;_0x3f7c45=0xc8;}else{_0x3f7c45=0xce;}_0x6c15ed[_0xb3fe('0x15')](_0x3f7c45);return _0x6c15ed[_0xb3fe('0x1b')]('Content-Range',_0x471740+'-'+_0x58ba53+'/'+_0x20572)[_0xb3fe('0x17')](_0x4ed4a9);}return null;};}function patchUpdates(_0x3f8674){return function(_0x30bfb7){try{jsonpatch[_0xb3fe('0x1c')](_0x30bfb7,_0x3f8674,!![]);}catch(_0x18f568){return BPromise[_0xb3fe('0x1d')](_0x18f568);}return _0x30bfb7[_0xb3fe('0x1e')]();};}function saveUpdates(_0x184eb9,_0x444e4a){return function(_0xb4e7a0){if(_0xb4e7a0){return _0xb4e7a0[_0xb3fe('0x1f')](_0x184eb9)[_0xb3fe('0x20')](function(_0x20b667){return _0x20b667;});}return null;};}function removeEntity(_0x477b00,_0x36c83d){return function(_0x5ae89b){if(_0x5ae89b){return _0x5ae89b[_0xb3fe('0x21')]()['then'](function(){var _0x86891c=_0x5ae89b[_0xb3fe('0x22')]({'plain':!![]});var _0x2aedcb=_0xb3fe('0x23');return db[_0xb3fe('0x24')][_0xb3fe('0x21')]({'where':{'type':_0x2aedcb,'resourceId':_0x86891c['id']}})[_0xb3fe('0x20')](function(){return _0x5ae89b;});})[_0xb3fe('0x20')](function(){_0x477b00[_0xb3fe('0x15')](0xcc)[_0xb3fe('0x16')]();});}};}function handleEntityNotFound(_0x51f5f7,_0x4a4ae7){return function(_0x568314){if(!_0x568314){_0x51f5f7[_0xb3fe('0x25')](0x194);}return _0x568314;};}function handleError(_0x30f100,_0x58803b){_0x58803b=_0x58803b||0x1f4;return function(_0x2e3126){logger[_0xb3fe('0x26')](_0x2e3126[_0xb3fe('0x27')]);if(_0x2e3126[_0xb3fe('0x28')]){delete _0x2e3126[_0xb3fe('0x28')];}_0x30f100[_0xb3fe('0x15')](_0x58803b)[_0xb3fe('0x29')](_0x2e3126);};}exports['index']=function(_0x4d3498,_0x2f5f8a){var _0x144557={},_0x502ce6={},_0x45dcef={'count':0x0,'rows':[]};var _0x3573a6=_['map'](db[_0xb3fe('0x2a')]['rawAttributes'],function(_0x1060cc){return{'name':_0x1060cc[_0xb3fe('0x2b')],'type':_0x1060cc[_0xb3fe('0x2c')][_0xb3fe('0x2d')]};});_0x502ce6[_0xb3fe('0x2e')]=_['map'](_0x3573a6,_0xb3fe('0x28'));_0x502ce6['query']=_[_0xb3fe('0x2f')](_0x4d3498[_0xb3fe('0x30')]);_0x502ce6[_0xb3fe('0x31')]=_[_0xb3fe('0x32')](_0x502ce6[_0xb3fe('0x2e')],_0x502ce6[_0xb3fe('0x30')]);_0x144557[_0xb3fe('0x33')]=_['intersection'](_0x502ce6['model'],qs[_0xb3fe('0x34')](_0x4d3498[_0xb3fe('0x30')][_0xb3fe('0x34')]));_0x144557[_0xb3fe('0x33')]=_0x144557['attributes'][_0xb3fe('0x35')]?_0x144557[_0xb3fe('0x33')]:_0x502ce6['model'];if(!_0x4d3498[_0xb3fe('0x30')]['hasOwnProperty'](_0xb3fe('0x36'))){_0x144557[_0xb3fe('0x1a')]=qs[_0xb3fe('0x1a')](_0x4d3498[_0xb3fe('0x30')][_0xb3fe('0x1a')]);_0x144557['offset']=qs['offset'](_0x4d3498[_0xb3fe('0x30')][_0xb3fe('0x19')]);}_0x144557[_0xb3fe('0x37')]=qs[_0xb3fe('0x38')](_0x4d3498[_0xb3fe('0x30')]['sort']);_0x144557[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_['pick'](_0x4d3498['query'],_0x502ce6[_0xb3fe('0x31')]),_0x3573a6);if(_0x4d3498[_0xb3fe('0x30')][_0xb3fe('0x3a')]){_0x144557[_0xb3fe('0x39')]=_['merge'](_0x144557[_0xb3fe('0x39')],{'$or':_[_0xb3fe('0x3b')](_0x3573a6,function(_0x49596e){if(_0x49596e[_0xb3fe('0x2c')]!==_0xb3fe('0x3c')){var _0x188e07={};_0x188e07[_0x49596e[_0xb3fe('0x28')]]={'$like':'%'+_0x4d3498[_0xb3fe('0x30')][_0xb3fe('0x3a')]+'%'};return _0x188e07;}})});}_0x144557=_['merge']({},_0x144557,_0x4d3498[_0xb3fe('0x3d')]);var _0x307978={'where':_0x144557[_0xb3fe('0x39')]};return db[_0xb3fe('0x2a')][_0xb3fe('0x18')](_0x307978)[_0xb3fe('0x20')](function(_0x3f0de0){_0x45dcef[_0xb3fe('0x18')]=_0x3f0de0;if(_0x4d3498[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0x144557[_0xb3fe('0x3f')]=[{'all':!![]}];}return db[_0xb3fe('0x2a')][_0xb3fe('0x40')](_0x144557);})[_0xb3fe('0x20')](function(_0x29dba6){_0x45dcef[_0xb3fe('0x41')]=_0x29dba6;return _0x45dcef;})[_0xb3fe('0x20')](respondWithFilteredResult(_0x2f5f8a,_0x144557))[_0xb3fe('0x42')](handleError(_0x2f5f8a,null));};exports[_0xb3fe('0x43')]=function(_0x1e6d01,_0x56b3f6){var _0x250925={'raw':![],'where':{'id':_0x1e6d01[_0xb3fe('0x44')]['id']}},_0x3963b2={};_0x3963b2['model']=_[_0xb3fe('0x2f')](db[_0xb3fe('0x2a')][_0xb3fe('0x45')]);_0x3963b2[_0xb3fe('0x30')]=_[_0xb3fe('0x2f')](_0x1e6d01[_0xb3fe('0x30')]);_0x3963b2[_0xb3fe('0x31')]=_['intersection'](_0x3963b2[_0xb3fe('0x2e')],_0x3963b2['query']);_0x250925[_0xb3fe('0x33')]=_['intersection'](_0x3963b2[_0xb3fe('0x2e')],qs[_0xb3fe('0x34')](_0x1e6d01[_0xb3fe('0x30')][_0xb3fe('0x34')]));_0x250925['attributes']=_0x250925[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x250925['attributes']:_0x3963b2[_0xb3fe('0x2e')];if(_0x1e6d01[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0x250925[_0xb3fe('0x3f')]=[{'all':!![]}];}_0x250925=_[_0xb3fe('0x46')]({},_0x250925,_0x1e6d01['options']);return db[_0xb3fe('0x2a')]['find'](_0x250925)[_0xb3fe('0x20')](handleEntityNotFound(_0x56b3f6,null))[_0xb3fe('0x20')](respondWithResult(_0x56b3f6,null))[_0xb3fe('0x42')](handleError(_0x56b3f6,null));};exports[_0xb3fe('0x47')]=function(_0x55ec7d,_0xe70626){return db[_0xb3fe('0x2a')][_0xb3fe('0x47')](_0x55ec7d[_0xb3fe('0x48')],{})['then'](function(_0x2c29ae){var _0x4c48af=_0x55ec7d['user'][_0xb3fe('0x22')]({'plain':!![]});if(!_0x4c48af)throw new Error(_0xb3fe('0x49'));if(_0x4c48af[_0xb3fe('0x4a')]===_0xb3fe('0x4b')){var _0x15e4a9=_0x2c29ae[_0xb3fe('0x22')]({'plain':!![]});var _0x2b097b=_0xb3fe('0x23');return db[_0xb3fe('0x4c')][_0xb3fe('0x4d')]({'where':{'name':_0x2b097b,'userProfileId':_0x4c48af['userProfileId']},'raw':!![]})['then'](function(_0x1e47d8){if(_0x1e47d8&&_0x1e47d8[_0xb3fe('0x4e')]===0x0){return db[_0xb3fe('0x24')][_0xb3fe('0x47')]({'name':_0x15e4a9['name'],'resourceId':_0x15e4a9['id'],'type':_0x1e47d8[_0xb3fe('0x28')],'sectionId':_0x1e47d8['id']},{})[_0xb3fe('0x20')](function(){return _0x2c29ae;});}else{return _0x2c29ae;}})['catch'](function(_0x4ff8a3){logger[_0xb3fe('0x26')](_0xb3fe('0x4f'),_0x4ff8a3);throw _0x4ff8a3;});}return _0x2c29ae;})[_0xb3fe('0x20')](respondWithResult(_0xe70626,0xc9))['catch'](handleError(_0xe70626,null));};exports[_0xb3fe('0x50')]=function(_0x50ae84,_0x20843b){var _0x5bc247={'where':{'id':_0x50ae84[_0xb3fe('0x44')]['id']}},_0x5ad290={};_0x5ad290[_0xb3fe('0x2e')]=_[_0xb3fe('0x2f')](db[_0xb3fe('0x2a')][_0xb3fe('0x45')]);_0x5bc247['attributes']=_[_0xb3fe('0x32')](_0x5ad290[_0xb3fe('0x2e')],qs[_0xb3fe('0x34')](_0x50ae84[_0xb3fe('0x30')]['fields']));_0x5bc247[_0xb3fe('0x33')]=_0x5bc247[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x5bc247['attributes']:_0x5ad290[_0xb3fe('0x2e')];if(_0x50ae84[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0x5bc247[_0xb3fe('0x3f')]=[{'all':!![]}];}_0x5bc247=_[_0xb3fe('0x46')]({},_0x5bc247,_0x50ae84[_0xb3fe('0x3d')]);return db[_0xb3fe('0x2a')][_0xb3fe('0x4d')](_0x5bc247)[_0xb3fe('0x20')](handleEntityNotFound(_0x20843b,null))[_0xb3fe('0x20')](function(_0x376e51){if(_0x376e51){var _0x1098c8=_0x376e51['get']({'plain':!![]});_0x1098c8=qs[_0xb3fe('0x51')](_0x1098c8,['id',_0xb3fe('0x52'),_0xb3fe('0x53')]);_0x50ae84[_0xb3fe('0x48')]=_[_0xb3fe('0x51')](_0x50ae84[_0xb3fe('0x48')],['id',_0xb3fe('0x52'),'updatedAt']);return db[_0xb3fe('0x2a')][_0xb3fe('0x47')](_[_0xb3fe('0x46')](_0x1098c8,_0x50ae84['body']),{'include':_0x50ae84[_0xb3fe('0x30')]['includeAll']?[{'all':!![]}]:undefined})[_0xb3fe('0x20')](function(_0x13e740){var _0xc64bed=_0x50ae84['user'][_0xb3fe('0x22')]({'plain':!![]});if(!_0xc64bed)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc64bed[_0xb3fe('0x4a')]===_0xb3fe('0x4b')){var _0x474261=_0x13e740[_0xb3fe('0x22')]({'plain':!![]});var _0xa1cd93=_0xb3fe('0x23');return db['UserProfileSection']['find']({'where':{'name':_0xa1cd93,'userProfileId':_0xc64bed['userProfileId']},'raw':!![]})[_0xb3fe('0x20')](function(_0x272400){if(_0x272400&&_0x272400[_0xb3fe('0x4e')]===0x0){return db[_0xb3fe('0x24')][_0xb3fe('0x47')]({'name':_0x474261[_0xb3fe('0x28')],'resourceId':_0x474261['id'],'type':_0x272400[_0xb3fe('0x28')],'sectionId':_0x272400['id']},{})[_0xb3fe('0x20')](function(){return _0x13e740;});}else{return _0x13e740;}})[_0xb3fe('0x42')](function(_0xe7fbf8){logger[_0xb3fe('0x26')](_0xb3fe('0x4f'),_0xe7fbf8);throw _0xe7fbf8;});}return _0x13e740;});}})['then'](respondWithResult(_0x20843b,0xc9))[_0xb3fe('0x42')](handleError(_0x20843b,null));};exports['update']=function(_0x4428df,_0x2e0604){if(_0x4428df[_0xb3fe('0x48')]['id']){delete _0x4428df[_0xb3fe('0x48')]['id'];}return db['Campaign']['find']({'where':{'id':_0x4428df[_0xb3fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x2e0604,null))[_0xb3fe('0x20')](saveUpdates(_0x4428df[_0xb3fe('0x48')],null))[_0xb3fe('0x20')](respondWithResult(_0x2e0604,null))['catch'](handleError(_0x2e0604,null));};exports[_0xb3fe('0x21')]=function(_0x5ca641,_0x16e099){return db[_0xb3fe('0x2a')][_0xb3fe('0x4d')]({'where':{'id':_0x5ca641[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x16e099,null))['then'](removeEntity(_0x16e099,null))['catch'](handleError(_0x16e099,null));};exports['getHoppers']=function(_0x1663f3,_0x4cf93b,_0x21f53c){var _0x59e8fc={'raw':!![],'where':{}};var _0x15f281={};var _0x23089b={'count':0x0,'rows':[]};return db['Campaign'][_0xb3fe('0x54')]({'where':{'id':_0x1663f3[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x4cf93b,null))[_0xb3fe('0x20')](function(_0x1691e7){if(_0x1691e7){_0x15f281['model']=_['keys'](db['CmHopper'][_0xb3fe('0x45')]);_0x15f281['query']=_[_0xb3fe('0x2f')](_0x1663f3['query']);_0x15f281['filters']=_[_0xb3fe('0x32')](_0x15f281[_0xb3fe('0x2e')],_0x15f281[_0xb3fe('0x30')]);_0x59e8fc[_0xb3fe('0x33')]=_[_0xb3fe('0x32')](_0x15f281[_0xb3fe('0x2e')],qs[_0xb3fe('0x34')](_0x1663f3[_0xb3fe('0x30')]['fields']));_0x59e8fc[_0xb3fe('0x33')]=_0x59e8fc[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x59e8fc['attributes']:_0x15f281[_0xb3fe('0x2e')];if(!_0x1663f3[_0xb3fe('0x30')][_0xb3fe('0x55')](_0xb3fe('0x36'))){_0x59e8fc[_0xb3fe('0x1a')]=qs['limit'](_0x1663f3[_0xb3fe('0x30')][_0xb3fe('0x1a')]);_0x59e8fc[_0xb3fe('0x19')]=qs[_0xb3fe('0x19')](_0x1663f3['query'][_0xb3fe('0x19')]);}_0x59e8fc[_0xb3fe('0x37')]=qs[_0xb3fe('0x38')](_0x1663f3[_0xb3fe('0x30')][_0xb3fe('0x38')]);_0x59e8fc[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_[_0xb3fe('0x56')](_0x1663f3[_0xb3fe('0x30')],_0x15f281[_0xb3fe('0x31')]));_0x59e8fc[_0xb3fe('0x39')][_0xb3fe('0x57')]=_0x1691e7['id'];if(_0x1663f3['query'][_0xb3fe('0x3a')]){_0x59e8fc['where']=_['merge'](_0x59e8fc[_0xb3fe('0x39')],{'$or':_[_0xb3fe('0x3b')](_0x59e8fc[_0xb3fe('0x33')],function(_0x4cb3c1){var _0x126ef5={};_0x126ef5[_0x4cb3c1]={'$like':'%'+_0x1663f3[_0xb3fe('0x30')][_0xb3fe('0x3a')]+'%'};return _0x126ef5;})});}_0x59e8fc=_[_0xb3fe('0x46')]({},_0x59e8fc,_0x1663f3[_0xb3fe('0x3d')]);return db[_0xb3fe('0x58')]['count']({'where':_0x59e8fc[_0xb3fe('0x39')]})[_0xb3fe('0x20')](function(_0x2717a3){_0x23089b[_0xb3fe('0x18')]=_0x2717a3;if(_0x1663f3[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0x59e8fc[_0xb3fe('0x3f')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x59e8fc);})[_0xb3fe('0x20')](function(_0x56c33c){_0x23089b[_0xb3fe('0x41')]=_0x56c33c;return _0x23089b;});}})['then'](respondWithFilteredResult(_0x4cf93b,_0x59e8fc))[_0xb3fe('0x42')](handleError(_0x4cf93b,null));};exports[_0xb3fe('0x59')]=function(_0x3c7dc9,_0x231873,_0x517eb7){var _0x40fca4={'raw':!![],'where':{}};var _0x557f37={};var _0x9a7d37={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3c7dc9['params']['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x231873,null))[_0xb3fe('0x20')](function(_0x295d74){if(_0x295d74){_0x557f37[_0xb3fe('0x2e')]=_[_0xb3fe('0x2f')](db[_0xb3fe('0x5a')][_0xb3fe('0x45')]);_0x557f37['query']=_[_0xb3fe('0x2f')](_0x3c7dc9[_0xb3fe('0x30')]);_0x557f37[_0xb3fe('0x31')]=_[_0xb3fe('0x32')](_0x557f37['model'],_0x557f37[_0xb3fe('0x30')]);_0x40fca4[_0xb3fe('0x33')]=_[_0xb3fe('0x32')](_0x557f37[_0xb3fe('0x2e')],qs[_0xb3fe('0x34')](_0x3c7dc9[_0xb3fe('0x30')][_0xb3fe('0x34')]));_0x40fca4[_0xb3fe('0x33')]=_0x40fca4[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x40fca4[_0xb3fe('0x33')]:_0x557f37[_0xb3fe('0x2e')];if(!_0x3c7dc9[_0xb3fe('0x30')]['hasOwnProperty'](_0xb3fe('0x36'))){_0x40fca4[_0xb3fe('0x1a')]=qs[_0xb3fe('0x1a')](_0x3c7dc9['query'][_0xb3fe('0x1a')]);_0x40fca4[_0xb3fe('0x19')]=qs[_0xb3fe('0x19')](_0x3c7dc9[_0xb3fe('0x30')][_0xb3fe('0x19')]);}_0x40fca4[_0xb3fe('0x37')]=qs[_0xb3fe('0x38')](_0x3c7dc9[_0xb3fe('0x30')][_0xb3fe('0x38')]);_0x40fca4[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_[_0xb3fe('0x56')](_0x3c7dc9[_0xb3fe('0x30')],_0x557f37[_0xb3fe('0x31')]));_0x40fca4['where'][_0xb3fe('0x57')]=_0x295d74['id'];if(_0x3c7dc9[_0xb3fe('0x30')][_0xb3fe('0x3a')]){_0x40fca4[_0xb3fe('0x39')]=_['merge'](_0x40fca4[_0xb3fe('0x39')],{'$or':_[_0xb3fe('0x3b')](_0x40fca4[_0xb3fe('0x33')],function(_0x27f2fc){var _0x18d9aa={};_0x18d9aa[_0x27f2fc]={'$like':'%'+_0x3c7dc9[_0xb3fe('0x30')]['filter']+'%'};return _0x18d9aa;})});}_0x40fca4=_[_0xb3fe('0x46')]({},_0x40fca4,_0x3c7dc9[_0xb3fe('0x3d')]);return db['CmHopperHistory'][_0xb3fe('0x18')]({'where':_0x40fca4[_0xb3fe('0x39')]})[_0xb3fe('0x20')](function(_0x453bff){_0x9a7d37[_0xb3fe('0x18')]=_0x453bff;if(_0x3c7dc9[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0x40fca4[_0xb3fe('0x3f')]=[{'all':!![]}];}return db[_0xb3fe('0x5a')][_0xb3fe('0x40')](_0x40fca4);})[_0xb3fe('0x20')](function(_0x230ffc){_0x9a7d37[_0xb3fe('0x41')]=_0x230ffc;return _0x9a7d37;});}})[_0xb3fe('0x20')](respondWithFilteredResult(_0x231873,_0x40fca4))[_0xb3fe('0x42')](handleError(_0x231873,null));};exports['getHopperFinals']=function(_0x7ad8e9,_0x3f4b65,_0x3def8a){var _0xfd370b={'raw':!![],'where':{}};var _0x392a9b={};var _0x13b8d8={'count':0x0,'rows':[]};return db[_0xb3fe('0x2a')]['findOne']({'where':{'id':_0x7ad8e9[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x3f4b65,null))['then'](function(_0x1df3ef){if(_0x1df3ef){_0x392a9b['model']=_[_0xb3fe('0x2f')](db[_0xb3fe('0x5b')][_0xb3fe('0x45')]);_0x392a9b[_0xb3fe('0x30')]=_[_0xb3fe('0x2f')](_0x7ad8e9[_0xb3fe('0x30')]);_0x392a9b[_0xb3fe('0x31')]=_[_0xb3fe('0x32')](_0x392a9b['model'],_0x392a9b[_0xb3fe('0x30')]);_0xfd370b[_0xb3fe('0x33')]=_[_0xb3fe('0x32')](_0x392a9b['model'],qs[_0xb3fe('0x34')](_0x7ad8e9[_0xb3fe('0x30')][_0xb3fe('0x34')]));_0xfd370b[_0xb3fe('0x33')]=_0xfd370b['attributes'][_0xb3fe('0x35')]?_0xfd370b[_0xb3fe('0x33')]:_0x392a9b['model'];if(!_0x7ad8e9['query']['hasOwnProperty'](_0xb3fe('0x36'))){_0xfd370b[_0xb3fe('0x1a')]=qs[_0xb3fe('0x1a')](_0x7ad8e9[_0xb3fe('0x30')][_0xb3fe('0x1a')]);_0xfd370b['offset']=qs['offset'](_0x7ad8e9['query'][_0xb3fe('0x19')]);}_0xfd370b[_0xb3fe('0x37')]=qs['sort'](_0x7ad8e9[_0xb3fe('0x30')][_0xb3fe('0x38')]);_0xfd370b[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_[_0xb3fe('0x56')](_0x7ad8e9[_0xb3fe('0x30')],_0x392a9b[_0xb3fe('0x31')]));_0xfd370b[_0xb3fe('0x39')]['CampaignId']=_0x1df3ef['id'];if(_0x7ad8e9['query'][_0xb3fe('0x3a')]){_0xfd370b[_0xb3fe('0x39')]=_['merge'](_0xfd370b[_0xb3fe('0x39')],{'$or':_[_0xb3fe('0x3b')](_0xfd370b[_0xb3fe('0x33')],function(_0x5e80cb){var _0x19293b={};_0x19293b[_0x5e80cb]={'$like':'%'+_0x7ad8e9['query'][_0xb3fe('0x3a')]+'%'};return _0x19293b;})});}_0xfd370b=_[_0xb3fe('0x46')]({},_0xfd370b,_0x7ad8e9['options']);return db[_0xb3fe('0x5b')][_0xb3fe('0x18')]({'where':_0xfd370b[_0xb3fe('0x39')]})[_0xb3fe('0x20')](function(_0x400258){_0x13b8d8[_0xb3fe('0x18')]=_0x400258;if(_0x7ad8e9[_0xb3fe('0x30')][_0xb3fe('0x3e')]){_0xfd370b[_0xb3fe('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb3fe('0x40')](_0xfd370b);})[_0xb3fe('0x20')](function(_0x3ef105){_0x13b8d8[_0xb3fe('0x41')]=_0x3ef105;return _0x13b8d8;});}})[_0xb3fe('0x20')](respondWithFilteredResult(_0x3f4b65,_0xfd370b))['catch'](handleError(_0x3f4b65,null));};exports['getHopperBlacks']=function(_0x4107d2,_0x468e83,_0x21e044){var _0x1e75b5={'raw':!![],'where':{}};var _0x55b692={};var _0x12ae41={'count':0x0,'rows':[]};return db['Campaign'][_0xb3fe('0x54')]({'where':{'id':_0x4107d2[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x468e83,null))[_0xb3fe('0x20')](function(_0x59a237){if(_0x59a237){_0x55b692[_0xb3fe('0x2e')]=_['keys'](db[_0xb3fe('0x5c')][_0xb3fe('0x45')]);_0x55b692[_0xb3fe('0x30')]=_['keys'](_0x4107d2[_0xb3fe('0x30')]);_0x55b692['filters']=_[_0xb3fe('0x32')](_0x55b692['model'],_0x55b692[_0xb3fe('0x30')]);_0x1e75b5[_0xb3fe('0x33')]=_[_0xb3fe('0x32')](_0x55b692['model'],qs[_0xb3fe('0x34')](_0x4107d2[_0xb3fe('0x30')][_0xb3fe('0x34')]));_0x1e75b5['attributes']=_0x1e75b5[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x1e75b5['attributes']:_0x55b692[_0xb3fe('0x2e')];if(!_0x4107d2[_0xb3fe('0x30')][_0xb3fe('0x55')]('nolimit')){_0x1e75b5[_0xb3fe('0x1a')]=qs[_0xb3fe('0x1a')](_0x4107d2[_0xb3fe('0x30')]['limit']);_0x1e75b5[_0xb3fe('0x19')]=qs['offset'](_0x4107d2[_0xb3fe('0x30')][_0xb3fe('0x19')]);}_0x1e75b5['order']=qs['sort'](_0x4107d2[_0xb3fe('0x30')]['sort']);_0x1e75b5[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_['pick'](_0x4107d2[_0xb3fe('0x30')],_0x55b692['filters']));_0x1e75b5[_0xb3fe('0x39')][_0xb3fe('0x57')]=_0x59a237['id'];if(_0x4107d2[_0xb3fe('0x30')][_0xb3fe('0x3a')]){_0x1e75b5[_0xb3fe('0x39')]=_['merge'](_0x1e75b5[_0xb3fe('0x39')],{'$or':_[_0xb3fe('0x3b')](_0x1e75b5['attributes'],function(_0xfdb31e){var _0xc99036={};_0xc99036[_0xfdb31e]={'$like':'%'+_0x4107d2[_0xb3fe('0x30')]['filter']+'%'};return _0xc99036;})});}_0x1e75b5=_['merge']({},_0x1e75b5,_0x4107d2[_0xb3fe('0x3d')]);return db[_0xb3fe('0x5c')][_0xb3fe('0x18')]({'where':_0x1e75b5[_0xb3fe('0x39')]})[_0xb3fe('0x20')](function(_0x490869){_0x12ae41[_0xb3fe('0x18')]=_0x490869;if(_0x4107d2['query'][_0xb3fe('0x3e')]){_0x1e75b5[_0xb3fe('0x3f')]=[{'all':!![]}];}return db[_0xb3fe('0x5c')][_0xb3fe('0x40')](_0x1e75b5);})[_0xb3fe('0x20')](function(_0x4bb9c3){_0x12ae41[_0xb3fe('0x41')]=_0x4bb9c3;return _0x12ae41;});}})[_0xb3fe('0x20')](respondWithFilteredResult(_0x468e83,_0x1e75b5))[_0xb3fe('0x42')](handleError(_0x468e83,null));};exports[_0xb3fe('0x5d')]=function(_0x17fbd2,_0x354856,_0x435f87){var _0x4499a0={};var _0x2de610={};var _0x59b33f;var _0x9ffd89;return db[_0xb3fe('0x2a')][_0xb3fe('0x54')]({'where':{'id':_0x17fbd2['params']['id']}})['then'](handleEntityNotFound(_0x354856,null))[_0xb3fe('0x20')](function(_0xe22fbe){if(_0xe22fbe){_0x59b33f=_0xe22fbe;_0x2de610[_0xb3fe('0x2e')]=_[_0xb3fe('0x2f')](db[_0xb3fe('0x5e')]['rawAttributes']);_0x2de610[_0xb3fe('0x30')]=_[_0xb3fe('0x2f')](_0x17fbd2[_0xb3fe('0x30')]);_0x2de610[_0xb3fe('0x31')]=_[_0xb3fe('0x32')](_0x2de610['model'],_0x2de610[_0xb3fe('0x30')]);_0x4499a0['attributes']=_[_0xb3fe('0x32')](_0x2de610['model'],qs[_0xb3fe('0x34')](_0x17fbd2[_0xb3fe('0x30')][_0xb3fe('0x34')]));_0x4499a0[_0xb3fe('0x33')]=_0x4499a0[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x4499a0[_0xb3fe('0x33')]:_0x2de610['model'];_0x4499a0[_0xb3fe('0x37')]=qs[_0xb3fe('0x38')](_0x17fbd2[_0xb3fe('0x30')]['sort']);_0x4499a0[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_[_0xb3fe('0x56')](_0x17fbd2[_0xb3fe('0x30')],_0x2de610[_0xb3fe('0x31')]));if(_0x17fbd2[_0xb3fe('0x30')][_0xb3fe('0x3a')]){_0x4499a0['where']=_[_0xb3fe('0x46')](_0x4499a0[_0xb3fe('0x39')],{'$or':_['map'](_0x4499a0['attributes'],function(_0x49604d){var _0x3f8b71={};_0x3f8b71[_0x49604d]={'$like':'%'+_0x17fbd2[_0xb3fe('0x30')][_0xb3fe('0x3a')]+'%'};return _0x3f8b71;})});}_0x4499a0=_[_0xb3fe('0x46')]({},_0x4499a0,_0x17fbd2['options']);return _0x59b33f[_0xb3fe('0x5d')](_0x4499a0);}})[_0xb3fe('0x20')](function(_0x4ae7e6){if(_0x4ae7e6){_0x9ffd89=_0x4ae7e6['length'];if(!_0x17fbd2['query'][_0xb3fe('0x55')](_0xb3fe('0x36'))){_0x4499a0[_0xb3fe('0x1a')]=qs['limit'](_0x17fbd2[_0xb3fe('0x30')][_0xb3fe('0x1a')]);_0x4499a0[_0xb3fe('0x19')]=qs[_0xb3fe('0x19')](_0x17fbd2[_0xb3fe('0x30')][_0xb3fe('0x19')]);}return _0x59b33f[_0xb3fe('0x5d')](_0x4499a0);}})['then'](function(_0x37ffcb){if(_0x37ffcb){return _0x37ffcb?{'count':_0x9ffd89,'rows':_0x37ffcb}:null;}})[_0xb3fe('0x20')](respondWithResult(_0x354856,null))[_0xb3fe('0x42')](handleError(_0x354856,null));};exports['addLists']=function(_0xafbe47,_0x5814ae,_0xd885bd){var _0x3a23c5,_0x30df21;return db['Campaign'][_0xb3fe('0x4d')]({'where':{'id':_0xafbe47[_0xb3fe('0x44')]['id']}})['then'](handleEntityNotFound(_0x5814ae,null))[_0xb3fe('0x20')](function(_0x4a351d){if(_0x4a351d){_0x30df21=_0x4a351d;return _0x4a351d[_0xb3fe('0x5f')](_0xafbe47['body'][_0xb3fe('0x60')],_[_0xb3fe('0x51')](_0xafbe47[_0xb3fe('0x48')],[_0xb3fe('0x60'),'id'])||{});}return null;})['spread'](function(_0x476a45){var _0x1e6fe2;_0x3a23c5=_0x476a45||[];var _0x218985=[];if(_0x476a45){for(var _0x44f3da=0x0;_0x44f3da<_0x476a45[_0xb3fe('0x35')];_0x44f3da+=0x1){var _0x5cdbf8=_0x476a45[_0x44f3da]['get']({'plain':!![]});_0x30df21[_0xb3fe('0x61')]=_0xafbe47[_0xb3fe('0x48')][_0xb3fe('0x61')]?_0xafbe47[_0xb3fe('0x48')]['dialCheckDuplicateType']:_0x30df21[_0xb3fe('0x61')];switch(_0x30df21[_0xb3fe('0x61')]){case'always':_0x1e6fe2=squel[_0xb3fe('0x62')]()[_0xb3fe('0x63')]('cm_hopper')[_0xb3fe('0x64')]([_0xb3fe('0x65'),'scheduledAt',_0xb3fe('0x66'),'ListId',_0xb3fe('0x57'),_0xb3fe('0x52'),_0xb3fe('0x53')],squel['select']()[_0xb3fe('0x67')]('phone',_0xb3fe('0x65'))['field']('NOW()',_0xb3fe('0x68'))[_0xb3fe('0x67')]('id',_0xb3fe('0x66'))[_0xb3fe('0x67')](_0x5cdbf8[_0xb3fe('0x69')][_0xb3fe('0x6a')](),'ListId')[_0xb3fe('0x67')](_0xafbe47[_0xb3fe('0x44')]['id'][_0xb3fe('0x6a')](),_0xb3fe('0x57'))[_0xb3fe('0x67')]('NOW()',_0xb3fe('0x52'))[_0xb3fe('0x67')](_0xb3fe('0x6b'),_0xb3fe('0x53'))[_0xb3fe('0x6c')]('cm_contacts')['where'](_0xb3fe('0x6d'))['where'](_0xb3fe('0x6e'),_0x5cdbf8[_0xb3fe('0x69')][_0xb3fe('0x6a')]())[_0xb3fe('0x39')](_0xb3fe('0x6f'))[_0xb3fe('0x39')](_0xb3fe('0x70'),squel[_0xb3fe('0x71')]()[_0xb3fe('0x67')](_0xb3fe('0x72'))[_0xb3fe('0x6c')](_0xb3fe('0x73'))[_0xb3fe('0x39')](_0xb3fe('0x74'),_0xafbe47[_0xb3fe('0x44')]['id'][_0xb3fe('0x6a')]()))[_0xb3fe('0x39')](_0xb3fe('0x70'),squel['select']()[_0xb3fe('0x67')](_0xb3fe('0x75'))[_0xb3fe('0x6c')]('cm_hopper')[_0xb3fe('0x39')](_0xb3fe('0x74'),_0xafbe47[_0xb3fe('0x44')]['id']['toString']())))['toString']();break;case _0xb3fe('0x76'):_0x1e6fe2=squel[_0xb3fe('0x62')]()[_0xb3fe('0x63')](_0xb3fe('0x77'))['fromQuery']([_0xb3fe('0x65'),_0xb3fe('0x68'),_0xb3fe('0x66'),'ListId',_0xb3fe('0x57'),'createdAt',_0xb3fe('0x53')],squel[_0xb3fe('0x71')]()[_0xb3fe('0x67')](_0xb3fe('0x65'),'phone')['field'](_0xb3fe('0x6b'),'scheduledAt')[_0xb3fe('0x67')]('id',_0xb3fe('0x66'))[_0xb3fe('0x67')](_0x5cdbf8[_0xb3fe('0x69')]['toString'](),_0xb3fe('0x78'))[_0xb3fe('0x67')](_0xafbe47[_0xb3fe('0x44')]['id'][_0xb3fe('0x6a')](),_0xb3fe('0x57'))[_0xb3fe('0x67')](_0xb3fe('0x6b'),_0xb3fe('0x52'))[_0xb3fe('0x67')](_0xb3fe('0x6b'),_0xb3fe('0x53'))[_0xb3fe('0x6c')](_0xb3fe('0x79'))[_0xb3fe('0x39')](_0xb3fe('0x6d'))['where'](_0xb3fe('0x6e'),_0x5cdbf8['CmListId'][_0xb3fe('0x6a')]())[_0xb3fe('0x39')](_0xb3fe('0x6f'))[_0xb3fe('0x39')](_0xb3fe('0x70'),squel[_0xb3fe('0x71')]()[_0xb3fe('0x67')](_0xb3fe('0x75'))['from'](_0xb3fe('0x77'))[_0xb3fe('0x39')](_0xb3fe('0x74'),_0xafbe47['params']['id']['toString']())))[_0xb3fe('0x6a')]();break;default:_0x1e6fe2=squel[_0xb3fe('0x62')]()[_0xb3fe('0x63')](_0xb3fe('0x77'))['fromQuery']([_0xb3fe('0x65'),_0xb3fe('0x68'),_0xb3fe('0x66'),_0xb3fe('0x78'),_0xb3fe('0x57'),_0xb3fe('0x52'),_0xb3fe('0x53')],squel[_0xb3fe('0x71')]()[_0xb3fe('0x67')]('phone',_0xb3fe('0x65'))[_0xb3fe('0x67')]('NOW()',_0xb3fe('0x68'))[_0xb3fe('0x67')]('id',_0xb3fe('0x66'))['field'](_0x5cdbf8[_0xb3fe('0x69')][_0xb3fe('0x6a')](),_0xb3fe('0x78'))[_0xb3fe('0x67')](_0xafbe47[_0xb3fe('0x44')]['id'][_0xb3fe('0x6a')](),_0xb3fe('0x57'))['field'](_0xb3fe('0x6b'),_0xb3fe('0x52'))[_0xb3fe('0x67')]('NOW()',_0xb3fe('0x53'))[_0xb3fe('0x6c')]('cm_contacts')[_0xb3fe('0x39')](_0xb3fe('0x6d'))[_0xb3fe('0x39')](_0xb3fe('0x6e'),_0x5cdbf8[_0xb3fe('0x69')][_0xb3fe('0x6a')]())[_0xb3fe('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xb3fe('0x6a')]();}_0x218985[_0xb3fe('0x7a')](db['sequelize'][_0xb3fe('0x30')](_0x1e6fe2));}return BPromise[_0xb3fe('0x7b')](_0x218985);}})[_0xb3fe('0x20')](function(){return _0x3a23c5;})[_0xb3fe('0x20')](respondWithResult(_0x5814ae,null))[_0xb3fe('0x42')](handleError(_0x5814ae,null));};exports[_0xb3fe('0x7c')]=function(_0x5744e0,_0x11a305,_0x2fb7f9){return db['Campaign'][_0xb3fe('0x4d')]({'where':{'id':_0x5744e0[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x11a305,null))[_0xb3fe('0x20')](function(_0x152ce4){if(_0x152ce4){return _0x152ce4[_0xb3fe('0x7c')](_0x5744e0[_0xb3fe('0x30')][_0xb3fe('0x60')]);}})['then'](function(_0x17db30){if(_0x17db30){return db[_0xb3fe('0x58')][_0xb3fe('0x21')]({'where':{'ListId':_0x5744e0[_0xb3fe('0x30')][_0xb3fe('0x60')],'CampaignId':_0x5744e0[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](function(){return _0x17db30;});}})[_0xb3fe('0x20')](respondWithStatusCode(_0x11a305,null))['catch'](handleError(_0x11a305,null));};exports[_0xb3fe('0x7d')]=function(_0x53920f,_0x98a508,_0x417c53){var _0x19e621={};var _0x1fbc8c={};var _0x40c1dd;var _0x481960;return db[_0xb3fe('0x2a')]['findOne']({'where':{'id':_0x53920f[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x98a508,null))[_0xb3fe('0x20')](function(_0x2bedbd){if(_0x2bedbd){_0x40c1dd=_0x2bedbd;_0x1fbc8c[_0xb3fe('0x2e')]=_[_0xb3fe('0x2f')](db[_0xb3fe('0x5e')]['rawAttributes']);_0x1fbc8c[_0xb3fe('0x30')]=_[_0xb3fe('0x2f')](_0x53920f[_0xb3fe('0x30')]);_0x1fbc8c[_0xb3fe('0x31')]=_[_0xb3fe('0x32')](_0x1fbc8c[_0xb3fe('0x2e')],_0x1fbc8c[_0xb3fe('0x30')]);_0x19e621['attributes']=_[_0xb3fe('0x32')](_0x1fbc8c[_0xb3fe('0x2e')],qs[_0xb3fe('0x34')](_0x53920f[_0xb3fe('0x30')]['fields']));_0x19e621['attributes']=_0x19e621[_0xb3fe('0x33')][_0xb3fe('0x35')]?_0x19e621['attributes']:_0x1fbc8c[_0xb3fe('0x2e')];_0x19e621[_0xb3fe('0x37')]=qs[_0xb3fe('0x38')](_0x53920f[_0xb3fe('0x30')][_0xb3fe('0x38')]);_0x19e621[_0xb3fe('0x39')]=qs[_0xb3fe('0x31')](_['pick'](_0x53920f[_0xb3fe('0x30')],_0x1fbc8c[_0xb3fe('0x31')]));if(_0x53920f[_0xb3fe('0x30')][_0xb3fe('0x3a')]){_0x19e621['where']=_[_0xb3fe('0x46')](_0x19e621[_0xb3fe('0x39')],{'$or':_[_0xb3fe('0x3b')](_0x19e621[_0xb3fe('0x33')],function(_0x5db3df){var _0x6612e1={};_0x6612e1[_0x5db3df]={'$like':'%'+_0x53920f[_0xb3fe('0x30')][_0xb3fe('0x3a')]+'%'};return _0x6612e1;})});}_0x19e621=_[_0xb3fe('0x46')]({},_0x19e621,_0x53920f[_0xb3fe('0x3d')]);return _0x40c1dd['getBlackLists'](_0x19e621);}})[_0xb3fe('0x20')](function(_0x4c15ea){if(_0x4c15ea){_0x481960=_0x4c15ea[_0xb3fe('0x35')];if(!_0x53920f[_0xb3fe('0x30')]['hasOwnProperty'](_0xb3fe('0x36'))){_0x19e621[_0xb3fe('0x1a')]=qs[_0xb3fe('0x1a')](_0x53920f[_0xb3fe('0x30')][_0xb3fe('0x1a')]);_0x19e621[_0xb3fe('0x19')]=qs[_0xb3fe('0x19')](_0x53920f['query'][_0xb3fe('0x19')]);}return _0x40c1dd['getBlackLists'](_0x19e621);}})['then'](function(_0x427525){if(_0x427525){return _0x427525?{'count':_0x481960,'rows':_0x427525}:null;}})[_0xb3fe('0x20')](respondWithResult(_0x98a508,null))[_0xb3fe('0x42')](handleError(_0x98a508,null));};exports[_0xb3fe('0x7e')]=function(_0x106c8f,_0x63a99f,_0x21a7d0){var _0x4deba9,_0x364eaa;return db[_0xb3fe('0x2a')][_0xb3fe('0x4d')]({'where':{'id':_0x106c8f[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](handleEntityNotFound(_0x63a99f,null))[_0xb3fe('0x20')](function(_0x335ed2){if(_0x335ed2){_0x364eaa=_0x335ed2;return _0x335ed2[_0xb3fe('0x7e')](_0x106c8f[_0xb3fe('0x48')][_0xb3fe('0x60')],_[_0xb3fe('0x51')](_0x106c8f[_0xb3fe('0x48')],[_0xb3fe('0x60'),'id'])||{});}return null;})['spread'](function(_0x1a26de){var _0x3f7507;_0x4deba9=_0x1a26de||[];var _0x8737e3=[];if(_0x1a26de){for(var _0x4f5f4d=0x0;_0x4f5f4d<_0x1a26de[_0xb3fe('0x35')];_0x4f5f4d+=0x1){var _0x54c5a2=_0x1a26de[_0x4f5f4d][_0xb3fe('0x22')]({'plain':!![]});_0x3f7507=squel['insert']()[_0xb3fe('0x63')](_0xb3fe('0x7f'))[_0xb3fe('0x64')]([_0xb3fe('0x65'),_0xb3fe('0x66'),_0xb3fe('0x78'),_0xb3fe('0x57'),'createdAt',_0xb3fe('0x53')],squel[_0xb3fe('0x71')]()[_0xb3fe('0x67')](_0xb3fe('0x65'),_0xb3fe('0x65'))['field']('id',_0xb3fe('0x66'))[_0xb3fe('0x67')](_0x54c5a2[_0xb3fe('0x69')]['toString'](),_0xb3fe('0x78'))[_0xb3fe('0x67')](_0x106c8f[_0xb3fe('0x44')]['id'][_0xb3fe('0x6a')](),_0xb3fe('0x57'))[_0xb3fe('0x67')](_0xb3fe('0x6b'),_0xb3fe('0x52'))['field'](_0xb3fe('0x6b'),_0xb3fe('0x53'))[_0xb3fe('0x6c')](_0xb3fe('0x79'))['where'](_0xb3fe('0x6d'))[_0xb3fe('0x39')](_0xb3fe('0x6e'),_0x54c5a2[_0xb3fe('0x69')][_0xb3fe('0x6a')]())[_0xb3fe('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xb3fe('0x6a')]();_0x8737e3[_0xb3fe('0x7a')](db[_0xb3fe('0x80')][_0xb3fe('0x30')](_0x3f7507));}return BPromise[_0xb3fe('0x7b')](_0x8737e3);}})['then'](function(){return _0x4deba9;})[_0xb3fe('0x20')](respondWithResult(_0x63a99f,null))[_0xb3fe('0x42')](handleError(_0x63a99f,null));};exports[_0xb3fe('0x81')]=function(_0x62e5e8,_0x2a8b47,_0x17fd08){return db[_0xb3fe('0x2a')][_0xb3fe('0x4d')]({'where':{'id':_0x62e5e8['params']['id']}})['then'](handleEntityNotFound(_0x2a8b47,null))[_0xb3fe('0x20')](function(_0x154752){if(_0x154752){return _0x154752[_0xb3fe('0x81')](_0x62e5e8[_0xb3fe('0x30')]['ids']);}})[_0xb3fe('0x20')](function(_0x3b3947){if(_0x3b3947){return db['CmHopperBlack'][_0xb3fe('0x21')]({'where':{'ListId':_0x62e5e8[_0xb3fe('0x30')][_0xb3fe('0x60')],'CampaignId':_0x62e5e8[_0xb3fe('0x44')]['id']}})[_0xb3fe('0x20')](function(){return _0x3b3947;});}})[_0xb3fe('0x20')](respondWithStatusCode(_0x2a8b47,null))['catch'](handleError(_0x2a8b47,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 80c7aed..c48c803 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 _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 +var _0xbe01=['./campaign.attributes','define','Campaign','campaigns','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x60b6fe,_0x49603b){var _0xdc9604=function(_0xfc58c9){while(--_0xfc58c9){_0x60b6fe['push'](_0x60b6fe['shift']());}};_0xdc9604(++_0x49603b);}(_0xbe01,0xfb));var _0x1be0=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xbe01[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x1be0('0x0'));var util=require(_0x1be0('0x1'));var logger=require(_0x1be0('0x2'))(_0x1be0('0x3'));var moment=require(_0x1be0('0x4'));var BPromise=require(_0x1be0('0x5'));var rp=require(_0x1be0('0x6'));var fs=require('fs');var path=require(_0x1be0('0x7'));var rimraf=require(_0x1be0('0x8'));var config=require('../../config/environment');var attributes=require(_0x1be0('0x9'));module['exports']=function(_0x5de988,_0x2d4dcf){return _0x5de988[_0x1be0('0xa')](_0x1be0('0xb'),attributes,{'tableName':_0x1be0('0xc'),'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 f36f6dc..577433c 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(_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 +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0xdcad6e,_0x5d3083){var _0x4fcec1=function(_0x263cf4){while(--_0x263cf4){_0xdcad6e['push'](_0xdcad6e['shift']());}};_0x4fcec1(++_0x5d3083);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 274f7c4..d5611c9 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 _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 +var _0xb148=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','addLists','/:id/blacklists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers'];(function(_0x231cf3,_0x219708){var _0x3cdec6=function(_0x494af8){while(--_0x494af8){_0x231cf3['push'](_0x231cf3['shift']());}};_0x3cdec6(++_0x219708);}(_0xb148,0x1dc));var _0x8b14=function(_0x4fc80b,_0xfe1b3d){_0x4fc80b=_0x4fc80b-0x0;var _0x119dba=_0xb148[_0x4fc80b];return _0x119dba;};'use strict';var multer=require(_0x8b14('0x0'));var util=require(_0x8b14('0x1'));var path=require(_0x8b14('0x2'));var timeout=require(_0x8b14('0x3'));var express=require(_0x8b14('0x4'));var router=express['Router']();var auth=require(_0x8b14('0x5'));var interaction=require(_0x8b14('0x6'));var config=require(_0x8b14('0x7'));var controller=require('./campaign.controller');router[_0x8b14('0x8')]('/',auth[_0x8b14('0x9')](),controller[_0x8b14('0xa')]);router['get'](_0x8b14('0xb'),auth[_0x8b14('0x9')](),controller[_0x8b14('0xc')]);router[_0x8b14('0x8')](_0x8b14('0xd'),auth['isAuthenticated'](),controller[_0x8b14('0xe')]);router['get'](_0x8b14('0xf'),auth['isAuthenticated'](),controller[_0x8b14('0x10')]);router[_0x8b14('0x8')](_0x8b14('0x11'),auth[_0x8b14('0x9')](),controller['getHopperFinals']);router[_0x8b14('0x8')](_0x8b14('0x12'),auth[_0x8b14('0x9')](),controller[_0x8b14('0x13')]);router[_0x8b14('0x8')](_0x8b14('0x14'),auth[_0x8b14('0x9')](),controller[_0x8b14('0x15')]);router[_0x8b14('0x8')]('/:id/blacklists',auth[_0x8b14('0x9')](),controller[_0x8b14('0x16')]);router[_0x8b14('0x17')]('/',auth[_0x8b14('0x9')](),controller[_0x8b14('0x18')]);router[_0x8b14('0x17')](_0x8b14('0x19'),auth[_0x8b14('0x9')](),controller['clone']);router['post'](_0x8b14('0x14'),auth[_0x8b14('0x9')](),controller[_0x8b14('0x1a')]);router[_0x8b14('0x17')](_0x8b14('0x1b'),auth[_0x8b14('0x9')](),controller[_0x8b14('0x1c')]);router[_0x8b14('0x1d')](_0x8b14('0xb'),auth[_0x8b14('0x9')](),controller['update']);router[_0x8b14('0x1e')](_0x8b14('0xb'),auth[_0x8b14('0x9')](),controller[_0x8b14('0x1f')]);router[_0x8b14('0x1e')]('/:id/lists',auth[_0x8b14('0x9')](),controller[_0x8b14('0x20')]);router[_0x8b14('0x1e')](_0x8b14('0x1b'),auth[_0x8b14('0x9')](),controller[_0x8b14('0x21')]);module[_0x8b14('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 3e6c23b..c54e141 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 _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 +var _0x4c53=['TEXT','VIRTUAL','getDataValue','STRING'];(function(_0x341552,_0x1b66d2){var _0x146c72=function(_0xba5304){while(--_0xba5304){_0x341552['push'](_0x341552['shift']());}};_0x146c72(++_0x1b66d2);}(_0x4c53,0x1bb));var _0x34c5=function(_0x5725b3,_0x414841){_0x5725b3=_0x5725b3-0x0;var _0x8b2a56=_0x4c53[_0x5725b3];return _0x8b2a56;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize[_0x34c5('0x0')],'allowNull':![]},'value':{'type':Sequelize[_0x34c5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x34c5('0x0')]},'name':{'type':Sequelize[_0x34c5('0x2')],'get':function(){return this[_0x34c5('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 4342c69..ef05e5f 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_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 +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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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 5c4a92c..06c90c4 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 _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 +var _0x8482=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x580b1a,_0x4fe77b){var _0x375a71=function(_0x368284){while(--_0x368284){_0x580b1a['push'](_0x580b1a['shift']());}};_0x375a71(++_0x4fe77b);}(_0x8482,0x14e));var _0x2848=function(_0x42cd8c,_0x199e9a){_0x42cd8c=_0x42cd8c-0x0;var _0xc14c17=_0x8482[_0x42cd8c];return _0xc14c17;};'use strict';var _=require('lodash');var util=require(_0x2848('0x0'));var logger=require(_0x2848('0x1'))(_0x2848('0x2'));var moment=require(_0x2848('0x3'));var BPromise=require(_0x2848('0x4'));var rp=require(_0x2848('0x5'));var fs=require('fs');var path=require(_0x2848('0x6'));var rimraf=require(_0x2848('0x7'));var config=require(_0x2848('0x8'));var attributes=require(_0x2848('0x9'));module['exports']=function(_0x1eb602,_0x44e406){return _0x1eb602['define'](_0x2848('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2848('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5704b54..6a69b6a 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 _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 +var _0x12ec=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CannedAnswer,\x20%s,\x20%s','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x62c128,_0x1f5876){var _0x4c3c69=function(_0x56d510){while(--_0x56d510){_0x62c128['push'](_0x62c128['shift']());}};_0x4c3c69(++_0x1f5876);}(_0x12ec,0x1b1));var _0xc12e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x12ec[_0x29b609];return _0x54c952;};'use strict';var _=require(_0xc12e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc12e('0x1'));var rs=require(_0xc12e('0x2'));var fs=require('fs');var Redis=require(_0xc12e('0x3'));var db=require(_0xc12e('0x4'))['db'];var utils=require(_0xc12e('0x5'));var logger=require(_0xc12e('0x6'))(_0xc12e('0x7'));var config=require(_0xc12e('0x8'));var jayson=require(_0xc12e('0x9'));var client=jayson['client'][_0xc12e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ae128,_0x4235aa,_0x128b16){return new BPromise(function(_0xae9727,_0x5e11b7){return client[_0xc12e('0xb')](_0x5ae128,_0x128b16)[_0xc12e('0xc')](function(_0x561181){logger[_0xc12e('0xd')](_0xc12e('0xe'),_0x4235aa,'request\x20sent');logger[_0xc12e('0xf')](_0xc12e('0x10'),_0x4235aa,_0xc12e('0x11'),JSON[_0xc12e('0x12')](_0x561181));if(_0x561181['error']){if(_0x561181['error'][_0xc12e('0x13')]===0x1f4){logger[_0xc12e('0x14')](_0xc12e('0xe'),_0x4235aa,_0x561181[_0xc12e('0x14')][_0xc12e('0x15')]);return _0x5e11b7(_0x561181['error'][_0xc12e('0x15')]);}logger[_0xc12e('0x14')](_0xc12e('0xe'),_0x4235aa,_0x561181[_0xc12e('0x14')][_0xc12e('0x15')]);return _0xae9727(_0x561181[_0xc12e('0x14')][_0xc12e('0x15')]);}else{logger[_0xc12e('0xd')](_0xc12e('0xe'),_0x4235aa,_0xc12e('0x11'));_0xae9727(_0x561181['result'][_0xc12e('0x15')]);}})[_0xc12e('0x16')](function(_0x37f59c){logger[_0xc12e('0x14')](_0xc12e('0xe'),_0x4235aa,_0x37f59c);_0x5e11b7(_0x37f59c);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 12d49c8..f59e703 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 _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 +var _0xc114=['express','Router','../../components/auth/service','isAuthenticated','show','post','put','/:id','update','delete','destroy','util','path','connect-timeout'];(function(_0xae3753,_0x46c158){var _0xae5564=function(_0x369114){while(--_0x369114){_0xae3753['push'](_0xae3753['shift']());}};_0xae5564(++_0x46c158);}(_0xc114,0x1e7));var _0x4c11=function(_0x32399b,_0x244790){_0x32399b=_0x32399b-0x0;var _0x1fdda0=_0xc114[_0x32399b];return _0x1fdda0;};'use strict';var multer=require('multer');var util=require(_0x4c11('0x0'));var path=require(_0x4c11('0x1'));var timeout=require(_0x4c11('0x2'));var express=require(_0x4c11('0x3'));var router=express[_0x4c11('0x4')]();var auth=require(_0x4c11('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x4c11('0x6')](),controller[_0x4c11('0x7')]);router[_0x4c11('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4c11('0x9')](_0x4c11('0xa'),auth[_0x4c11('0x6')](),controller[_0x4c11('0xb')]);router[_0x4c11('0xc')](_0x4c11('0xa'),auth[_0x4c11('0x6')](),controller[_0x4c11('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index eee8f19..fcd310b 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 _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 +var _0xc28d=['sequelize','exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x37a1fe,_0x2c4294){var _0x17cfb6=function(_0x1fd785){while(--_0x1fd785){_0x37a1fe['push'](_0x37a1fe['shift']());}};_0x17cfb6(++_0x2c4294);}(_0xc28d,0x1d6));var _0xdc28=function(_0x381606,_0x53382c){_0x381606=_0x381606-0x0;var _0x31c4ca=_0xc28d[_0x381606];return _0x31c4ca;};'use strict';var Sequelize=require(_0xdc28('0x0'));module[_0xdc28('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xdc28('0x2')},'clid':{'type':Sequelize[_0xdc28('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xdc28('0x3')]},'lastdata':{'type':Sequelize[_0xdc28('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xdc28('0x3')]},'amaflags':{'type':Sequelize[_0xdc28('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xdc28('0x3')]},'uniqueid':{'type':Sequelize[_0xdc28('0x3')]},'linkedid':{'type':Sequelize[_0xdc28('0x3')]},'sequence':{'type':Sequelize[_0xdc28('0x3')]},'peeraccount':{'type':Sequelize[_0xdc28('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xdc28('0x3')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index ef0a656..82840e9 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 _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 +var _0x8ccd=['options','includeAll','include','rows','show','params','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','Cdr','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type'];(function(_0x1b72cc,_0x1dc3da){var _0x33b52b=function(_0x1751a4){while(--_0x1751a4){_0x1b72cc['push'](_0x1b72cc['shift']());}};_0x33b52b(++_0x1dc3da);}(_0x8ccd,0xa0));var _0xd8cc=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x8ccd[_0x43d11d];return _0x38cd08;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd8cc('0x0'));var rimraf=require(_0xd8cc('0x1'));var zipdir=require(_0xd8cc('0x2'));var jsonpatch=require(_0xd8cc('0x3'));var rp=require(_0xd8cc('0x4'));var moment=require(_0xd8cc('0x5'));var BPromise=require(_0xd8cc('0x6'));var Mustache=require('mustache');var util=require(_0xd8cc('0x7'));var path=require('path');var sox=require(_0xd8cc('0x8'));var csv=require(_0xd8cc('0x9'));var ejs=require(_0xd8cc('0xa'));var fs=require('fs');var _=require(_0xd8cc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd8cc('0xc'));var deskjs=require(_0xd8cc('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd8cc('0xe'));var Papa=require(_0xd8cc('0xf'));var Redis=require('ioredis');var authService=require(_0xd8cc('0x10'));var qs=require(_0xd8cc('0x11'));var as=require(_0xd8cc('0x12'));var hardwareService=require(_0xd8cc('0x13'));var logger=require(_0xd8cc('0x14'))(_0xd8cc('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd8cc('0x16'));var db=require(_0xd8cc('0x17'))['db'];function respondWithStatusCode(_0x566fcd,_0x56e9a2){_0x56e9a2=_0x56e9a2||0xcc;return function(_0x2b07f8){if(_0x2b07f8){return _0x566fcd[_0xd8cc('0x18')](_0x56e9a2);}return _0x566fcd[_0xd8cc('0x19')](_0x56e9a2)[_0xd8cc('0x1a')]();};}function respondWithResult(_0x221dcc,_0x2cd3dc){_0x2cd3dc=_0x2cd3dc||0xc8;return function(_0x40da4b){if(_0x40da4b){return _0x221dcc[_0xd8cc('0x19')](_0x2cd3dc)[_0xd8cc('0x1b')](_0x40da4b);}};}function respondWithFilteredResult(_0x465767,_0x52d78f){return function(_0x23fb4b){if(_0x23fb4b){var _0x1fb501=_0x23fb4b[_0xd8cc('0x1c')],_0x46d9e2=_0x52d78f[_0xd8cc('0x1d')],_0x59d3b1=_0x52d78f['offset']+_0x52d78f[_0xd8cc('0x1e')],_0x5b9784;if(_0x59d3b1>=_0x1fb501){_0x59d3b1=_0x1fb501;_0x5b9784=0xc8;}else{_0x5b9784=0xce;}_0x465767[_0xd8cc('0x19')](_0x5b9784);return _0x465767[_0xd8cc('0x1f')](_0xd8cc('0x20'),_0x46d9e2+'-'+_0x59d3b1+'/'+_0x1fb501)[_0xd8cc('0x1b')](_0x23fb4b);}return null;};}function patchUpdates(_0x53d223){return function(_0x4a71ed){try{jsonpatch[_0xd8cc('0x21')](_0x4a71ed,_0x53d223,!![]);}catch(_0x41c74b){return BPromise['reject'](_0x41c74b);}return _0x4a71ed[_0xd8cc('0x22')]();};}function saveUpdates(_0x4f52d8,_0x2b5721){return function(_0x19591b){if(_0x19591b){return _0x19591b[_0xd8cc('0x23')](_0x4f52d8)[_0xd8cc('0x24')](function(_0x47ac26){return _0x47ac26;});}return null;};}function removeEntity(_0x14a910,_0x17284d){return function(_0xfcdb3b){if(_0xfcdb3b){return _0xfcdb3b[_0xd8cc('0x25')]()['then'](function(){_0x14a910[_0xd8cc('0x19')](0xcc)[_0xd8cc('0x1a')]();});}};}function handleEntityNotFound(_0x215d6e,_0x360d8d){return function(_0x156ccd){if(!_0x156ccd){_0x215d6e['sendStatus'](0x194);}return _0x156ccd;};}function handleError(_0x3d5335,_0x11460c){_0x11460c=_0x11460c||0x1f4;return function(_0x41d31a){logger['error'](_0x41d31a[_0xd8cc('0x26')]);if(_0x41d31a[_0xd8cc('0x27')]){delete _0x41d31a[_0xd8cc('0x27')];}_0x3d5335['status'](_0x11460c)[_0xd8cc('0x28')](_0x41d31a);};}exports[_0xd8cc('0x29')]=function(_0x218bec,_0x49698b){var _0x3db589={},_0x560a0f={},_0x51ac4c={'count':0x0,'rows':[]};var _0xcbc041=_[_0xd8cc('0x2a')](db[_0xd8cc('0x2b')]['rawAttributes'],function(_0x28bc22){return{'name':_0x28bc22[_0xd8cc('0x2c')],'type':_0x28bc22['type'][_0xd8cc('0x2d')]};});_0x560a0f[_0xd8cc('0x2e')]=_[_0xd8cc('0x2a')](_0xcbc041,_0xd8cc('0x27'));_0x560a0f[_0xd8cc('0x2f')]=_[_0xd8cc('0x30')](_0x218bec[_0xd8cc('0x2f')]);_0x560a0f[_0xd8cc('0x31')]=_[_0xd8cc('0x32')](_0x560a0f[_0xd8cc('0x2e')],_0x560a0f[_0xd8cc('0x2f')]);_0x3db589['attributes']=_[_0xd8cc('0x32')](_0x560a0f[_0xd8cc('0x2e')],qs[_0xd8cc('0x33')](_0x218bec[_0xd8cc('0x2f')][_0xd8cc('0x33')]));_0x3db589['attributes']=_0x3db589[_0xd8cc('0x34')]['length']?_0x3db589[_0xd8cc('0x34')]:_0x560a0f['model'];if(!_0x218bec['query'][_0xd8cc('0x35')](_0xd8cc('0x36'))){_0x3db589['limit']=qs['limit'](_0x218bec[_0xd8cc('0x2f')][_0xd8cc('0x1e')]);_0x3db589['offset']=qs[_0xd8cc('0x1d')](_0x218bec[_0xd8cc('0x2f')]['offset']);}_0x3db589[_0xd8cc('0x37')]=qs[_0xd8cc('0x38')](_0x218bec[_0xd8cc('0x2f')][_0xd8cc('0x38')]);_0x3db589['where']=qs[_0xd8cc('0x31')](_[_0xd8cc('0x39')](_0x218bec['query'],_0x560a0f[_0xd8cc('0x31')]),_0xcbc041);if(_0x218bec['query'][_0xd8cc('0x3a')]){_0x3db589['where']=_[_0xd8cc('0x3b')](_0x3db589[_0xd8cc('0x3c')],{'$or':_[_0xd8cc('0x2a')](_0xcbc041,function(_0xc54ce1){if(_0xc54ce1[_0xd8cc('0x3d')]!=='VIRTUAL'){var _0x4e59fe={};_0x4e59fe[_0xc54ce1[_0xd8cc('0x27')]]={'$like':'%'+_0x218bec['query'][_0xd8cc('0x3a')]+'%'};return _0x4e59fe;}})});}_0x3db589=_[_0xd8cc('0x3b')]({},_0x3db589,_0x218bec[_0xd8cc('0x3e')]);var _0x2f5456={'where':_0x3db589[_0xd8cc('0x3c')]};return db[_0xd8cc('0x2b')][_0xd8cc('0x1c')](_0x2f5456)[_0xd8cc('0x24')](function(_0x362771){_0x51ac4c[_0xd8cc('0x1c')]=_0x362771;if(_0x218bec[_0xd8cc('0x2f')][_0xd8cc('0x3f')]){_0x3db589[_0xd8cc('0x40')]=[{'all':!![]}];}return db[_0xd8cc('0x2b')]['findAll'](_0x3db589);})['then'](function(_0xbb9cd4){_0x51ac4c[_0xd8cc('0x41')]=_0xbb9cd4;return _0x51ac4c;})[_0xd8cc('0x24')](respondWithFilteredResult(_0x49698b,_0x3db589))['catch'](handleError(_0x49698b,null));};exports[_0xd8cc('0x42')]=function(_0x5b6c3b,_0x23b0d2){var _0x4c6a27={'raw':!![],'where':{'id':_0x5b6c3b[_0xd8cc('0x43')]['id']}},_0x4a691c={};_0x4a691c[_0xd8cc('0x2e')]=_[_0xd8cc('0x30')](db[_0xd8cc('0x2b')]['rawAttributes']);_0x4a691c[_0xd8cc('0x2f')]=_[_0xd8cc('0x30')](_0x5b6c3b['query']);_0x4a691c[_0xd8cc('0x31')]=_[_0xd8cc('0x32')](_0x4a691c[_0xd8cc('0x2e')],_0x4a691c[_0xd8cc('0x2f')]);_0x4c6a27[_0xd8cc('0x34')]=_[_0xd8cc('0x32')](_0x4a691c[_0xd8cc('0x2e')],qs['fields'](_0x5b6c3b[_0xd8cc('0x2f')][_0xd8cc('0x33')]));_0x4c6a27[_0xd8cc('0x34')]=_0x4c6a27[_0xd8cc('0x34')][_0xd8cc('0x44')]?_0x4c6a27['attributes']:_0x4a691c['model'];if(_0x5b6c3b[_0xd8cc('0x2f')]['includeAll']){_0x4c6a27['include']=[{'all':!![]}];}_0x4c6a27=_[_0xd8cc('0x3b')]({},_0x4c6a27,_0x5b6c3b[_0xd8cc('0x3e')]);return db[_0xd8cc('0x2b')][_0xd8cc('0x45')](_0x4c6a27)['then'](handleEntityNotFound(_0x23b0d2,null))[_0xd8cc('0x24')](respondWithResult(_0x23b0d2,null))[_0xd8cc('0x46')](handleError(_0x23b0d2,null));};exports['create']=function(_0x2f6c28,_0x3d9e87){return db[_0xd8cc('0x2b')][_0xd8cc('0x47')](_0x2f6c28[_0xd8cc('0x48')],{})['then'](respondWithResult(_0x3d9e87,0xc9))['catch'](handleError(_0x3d9e87,null));};exports['update']=function(_0x3ee23f,_0x15654f){if(_0x3ee23f['body']['id']){delete _0x3ee23f[_0xd8cc('0x48')]['id'];}return db[_0xd8cc('0x2b')][_0xd8cc('0x45')]({'where':{'id':_0x3ee23f[_0xd8cc('0x43')]['id']}})[_0xd8cc('0x24')](handleEntityNotFound(_0x15654f,null))['then'](saveUpdates(_0x3ee23f[_0xd8cc('0x48')],null))[_0xd8cc('0x24')](respondWithResult(_0x15654f,null))[_0xd8cc('0x46')](handleError(_0x15654f,null));};exports[_0xd8cc('0x25')]=function(_0x55d7b2,_0x4dec83){return db[_0xd8cc('0x2b')][_0xd8cc('0x45')]({'where':{'id':_0x55d7b2[_0xd8cc('0x43')]['id']}})['then'](handleEntityNotFound(_0x4dec83,null))[_0xd8cc('0x24')](removeEntity(_0x4dec83,null))[_0xd8cc('0x46')](handleError(_0x4dec83,null));};exports[_0xd8cc('0x49')]=function(_0x193289,_0x30a611){return db[_0xd8cc('0x2b')]['describe']()[_0xd8cc('0x24')](respondWithResult(_0x30a611,null))[_0xd8cc('0x46')](handleError(_0x30a611,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index f472f93..268d2a0 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 _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 +var _0x4137=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api'];(function(_0x455730,_0x33a55f){var _0x43ca34=function(_0x15bd3c){while(--_0x15bd3c){_0x455730['push'](_0x455730['shift']());}};_0x43ca34(++_0x33a55f);}(_0x4137,0xf8));var _0x7413=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4137[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var logger=require(_0x7413('0x2'))(_0x7413('0x3'));var moment=require(_0x7413('0x4'));var BPromise=require(_0x7413('0x5'));var rp=require(_0x7413('0x6'));var fs=require('fs');var path=require(_0x7413('0x7'));var rimraf=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var attributes=require(_0x7413('0xa'));module[_0x7413('0xb')]=function(_0x4fbade,_0xc808cd){return _0x4fbade[_0x7413('0xc')](_0x7413('0xd'),attributes,{'tableName':_0x7413('0xe'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x7413('0xf')]},{'name':_0x7413('0x10'),'fields':['calldate']},{'name':_0x7413('0x11'),'fields':[_0x7413('0x11')]},{'name':'dst','fields':[_0x7413('0x12')]},{'name':_0x7413('0x13'),'fields':[_0x7413('0x13')]},{'name':_0x7413('0x14'),'fields':[_0x7413('0x14')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 8292a60..98a4147 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 _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 +var _0x3f41=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x355adc,_0xac51ab){var _0x4df04f=function(_0x4a787d){while(--_0x4a787d){_0x355adc['push'](_0x355adc['shift']());}};_0x4df04f(++_0xac51ab);}(_0x3f41,0x158));var _0x13f4=function(_0x5519a9,_0x1c5147){_0x5519a9=_0x5519a9-0x0;var _0x32f2cc=_0x3f41[_0x5519a9];return _0x32f2cc;};'use strict';var _=require(_0x13f4('0x0'));var util=require(_0x13f4('0x1'));var moment=require('moment');var BPromise=require(_0x13f4('0x2'));var rs=require(_0x13f4('0x3'));var fs=require('fs');var Redis=require(_0x13f4('0x4'));var db=require(_0x13f4('0x5'))['db'];var utils=require(_0x13f4('0x6'));var logger=require(_0x13f4('0x7'))(_0x13f4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x13f4('0x9')][_0x13f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56075d,_0x5de077,_0x114aa1){return new BPromise(function(_0x19b6e1,_0x49924d){return client[_0x13f4('0xb')](_0x56075d,_0x114aa1)[_0x13f4('0xc')](function(_0x20e4d5){logger['info'](_0x13f4('0xd'),_0x5de077,_0x13f4('0xe'));logger[_0x13f4('0xf')](_0x13f4('0x10'),_0x5de077,_0x13f4('0xe'),JSON[_0x13f4('0x11')](_0x20e4d5));if(_0x20e4d5[_0x13f4('0x12')]){if(_0x20e4d5[_0x13f4('0x12')][_0x13f4('0x13')]===0x1f4){logger[_0x13f4('0x12')](_0x13f4('0xd'),_0x5de077,_0x20e4d5[_0x13f4('0x12')][_0x13f4('0x14')]);return _0x49924d(_0x20e4d5[_0x13f4('0x12')][_0x13f4('0x14')]);}logger[_0x13f4('0x12')](_0x13f4('0xd'),_0x5de077,_0x20e4d5[_0x13f4('0x12')]['message']);return _0x19b6e1(_0x20e4d5[_0x13f4('0x12')][_0x13f4('0x14')]);}else{logger['info'](_0x13f4('0xd'),_0x5de077,_0x13f4('0xe'));_0x19b6e1(_0x20e4d5[_0x13f4('0x15')][_0x13f4('0x14')]);}})[_0x13f4('0x16')](function(_0x2f8383){logger[_0x13f4('0x12')]('Cdr,\x20%s,\x20%s',_0x5de077,_0x2f8383);_0x49924d(_0x2f8383);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index e01f68e..972dfa4 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 _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 +var _0xa841=['destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete'];(function(_0x5b0fcf,_0x3d83b2){var _0x5c3462=function(_0x523738){while(--_0x523738){_0x5b0fcf['push'](_0x5b0fcf['shift']());}};_0x5c3462(++_0x3d83b2);}(_0xa841,0x191));var _0x1a84=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa841[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x1a84('0x0'));var util=require(_0x1a84('0x1'));var path=require('path');var timeout=require(_0x1a84('0x2'));var express=require(_0x1a84('0x3'));var router=express[_0x1a84('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1a84('0x5'));var config=require(_0x1a84('0x6'));var controller=require(_0x1a84('0x7'));router[_0x1a84('0x8')]('/',auth[_0x1a84('0x9')](),controller[_0x1a84('0xa')]);router[_0x1a84('0x8')](_0x1a84('0xb'),auth[_0x1a84('0x9')](),controller[_0x1a84('0xc')]);router[_0x1a84('0x8')](_0x1a84('0xd'),auth[_0x1a84('0x9')](),controller[_0x1a84('0xe')]);router[_0x1a84('0xf')]('/',auth[_0x1a84('0x9')](),controller[_0x1a84('0x10')]);router[_0x1a84('0x11')](_0x1a84('0xd'),auth[_0x1a84('0x9')](),controller['update']);router[_0x1a84('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1a84('0x13')]);module[_0x1a84('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index a764744..588bc61 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 _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 +var _0xdb46=['exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0xdf9a3,_0x59b0ab){var _0xe01d17=function(_0x1c8dd6){while(--_0x1c8dd6){_0xdf9a3['push'](_0xdf9a3['shift']());}};_0xe01d17(++_0x59b0ab);}(_0xdb46,0xd7));var _0x6db4=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0xdb46[_0x420b24];return _0x4da552;};'use strict';var Sequelize=require('sequelize');module[_0x6db4('0x0')]={'priority':{'type':Sequelize[_0x6db4('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x6db4('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x6db4('0x3')]()},'description':{'type':Sequelize[_0x6db4('0x2')]},'interval':{'type':Sequelize[_0x6db4('0x2')],'defaultValue':_0x6db4('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 3a226d4..33a883b 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 _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 +var _0x103f=['intersection','attributes','fields','includeAll','merge','options','find','catch','body','ChatApplication','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','error','name','params','model','keys','query','filters'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x103f,0xe2));var _0xf103=function(_0x244814,_0x2d9973){_0x244814=_0x244814-0x0;var _0x2d0cc0=_0x103f[_0x244814];return _0x2d0cc0;};'use strict';var pdf=require(_0xf103('0x0'));var emlformat=require(_0xf103('0x1'));var rimraf=require(_0xf103('0x2'));var zipdir=require(_0xf103('0x3'));var jsonpatch=require(_0xf103('0x4'));var rp=require('request-promise');var moment=require(_0xf103('0x5'));var BPromise=require(_0xf103('0x6'));var Mustache=require(_0xf103('0x7'));var util=require(_0xf103('0x8'));var path=require(_0xf103('0x9'));var sox=require(_0xf103('0xa'));var csv=require(_0xf103('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf103('0xc'));var squel=require('squel');var crypto=require(_0xf103('0xd'));var jsforce=require(_0xf103('0xe'));var deskjs=require(_0xf103('0xf'));var toCsv=require(_0xf103('0xb'));var querystring=require(_0xf103('0x10'));var Papa=require(_0xf103('0x11'));var Redis=require(_0xf103('0x12'));var authService=require(_0xf103('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf103('0x14'));var hardwareService=require(_0xf103('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf103('0x16'));var config=require(_0xf103('0x17'));var licenseUtil=require(_0xf103('0x18'));var db=require(_0xf103('0x19'))['db'];function respondWithStatusCode(_0x489445,_0x4ea500){_0x4ea500=_0x4ea500||0xcc;return function(_0x4e774b){if(_0x4e774b){return _0x489445[_0xf103('0x1a')](_0x4ea500);}return _0x489445[_0xf103('0x1b')](_0x4ea500)['end']();};}function respondWithResult(_0x299a3d,_0x1e6ec7){_0x1e6ec7=_0x1e6ec7||0xc8;return function(_0x17b557){if(_0x17b557){return _0x299a3d['status'](_0x1e6ec7)[_0xf103('0x1c')](_0x17b557);}};}function respondWithFilteredResult(_0xa78a06,_0x15711a){return function(_0x4c3d04){if(_0x4c3d04){var _0x5cdb3d=_0x4c3d04[_0xf103('0x1d')],_0x1a1469=_0x15711a[_0xf103('0x1e')],_0x32dcd9=_0x15711a[_0xf103('0x1e')]+_0x15711a[_0xf103('0x1f')],_0x388328;if(_0x32dcd9>=_0x5cdb3d){_0x32dcd9=_0x5cdb3d;_0x388328=0xc8;}else{_0x388328=0xce;}_0xa78a06[_0xf103('0x1b')](_0x388328);return _0xa78a06['set'](_0xf103('0x20'),_0x1a1469+'-'+_0x32dcd9+'/'+_0x5cdb3d)['json'](_0x4c3d04);}return null;};}function patchUpdates(_0x92c738){return function(_0x4a4138){try{jsonpatch[_0xf103('0x21')](_0x4a4138,_0x92c738,!![]);}catch(_0xf81fb6){return BPromise[_0xf103('0x22')](_0xf81fb6);}return _0x4a4138['save']();};}function saveUpdates(_0xff095f,_0x2c6514){return function(_0x4cbc65){if(_0x4cbc65){return _0x4cbc65[_0xf103('0x23')](_0xff095f)[_0xf103('0x24')](function(_0x26204e){return _0x26204e;});}return null;};}function removeEntity(_0x23016a,_0x24722c){return function(_0x30a8e9){if(_0x30a8e9){return _0x30a8e9['destroy']()[_0xf103('0x24')](function(){_0x23016a[_0xf103('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd7195a,_0x14658e){return function(_0x3a54a4){if(!_0x3a54a4){_0xd7195a[_0xf103('0x1a')](0x194);}return _0x3a54a4;};}function handleError(_0xa9b104,_0x1bd9f4){_0x1bd9f4=_0x1bd9f4||0x1f4;return function(_0x3abc7e){logger[_0xf103('0x25')](_0x3abc7e['stack']);if(_0x3abc7e[_0xf103('0x26')]){delete _0x3abc7e[_0xf103('0x26')];}_0xa9b104[_0xf103('0x1b')](_0x1bd9f4)['send'](_0x3abc7e);};}exports['show']=function(_0x1c8331,_0x20c2ef){var _0x19f398={'raw':!![],'where':{'id':_0x1c8331[_0xf103('0x27')]['id']}},_0x53f3b0={};_0x53f3b0[_0xf103('0x28')]=_[_0xf103('0x29')](db['ChatApplication']['rawAttributes']);_0x53f3b0[_0xf103('0x2a')]=_[_0xf103('0x29')](_0x1c8331[_0xf103('0x2a')]);_0x53f3b0[_0xf103('0x2b')]=_[_0xf103('0x2c')](_0x53f3b0['model'],_0x53f3b0[_0xf103('0x2a')]);_0x19f398[_0xf103('0x2d')]=_[_0xf103('0x2c')](_0x53f3b0[_0xf103('0x28')],qs['fields'](_0x1c8331['query'][_0xf103('0x2e')]));_0x19f398[_0xf103('0x2d')]=_0x19f398['attributes']['length']?_0x19f398[_0xf103('0x2d')]:_0x53f3b0[_0xf103('0x28')];if(_0x1c8331[_0xf103('0x2a')][_0xf103('0x2f')]){_0x19f398['include']=[{'all':!![]}];}_0x19f398=_[_0xf103('0x30')]({},_0x19f398,_0x1c8331[_0xf103('0x31')]);return db['ChatApplication'][_0xf103('0x32')](_0x19f398)[_0xf103('0x24')](handleEntityNotFound(_0x20c2ef,null))[_0xf103('0x24')](respondWithResult(_0x20c2ef,null))[_0xf103('0x33')](handleError(_0x20c2ef,null));};exports[_0xf103('0x23')]=function(_0x2bb989,_0x2d5996){if(_0x2bb989[_0xf103('0x34')]['id']){delete _0x2bb989[_0xf103('0x34')]['id'];}return db['ChatApplication'][_0xf103('0x32')]({'where':{'id':_0x2bb989[_0xf103('0x27')]['id']}})[_0xf103('0x24')](handleEntityNotFound(_0x2d5996,null))[_0xf103('0x24')](saveUpdates(_0x2bb989['body'],null))['then'](respondWithResult(_0x2d5996,null))[_0xf103('0x33')](handleError(_0x2d5996,null));};exports['destroy']=function(_0x52afe5,_0x1013d1){return db[_0xf103('0x35')][_0xf103('0x32')]({'where':{'id':_0x52afe5[_0xf103('0x27')]['id']}})[_0xf103('0x24')](handleEntityNotFound(_0x1013d1,null))[_0xf103('0x24')](removeEntity(_0x1013d1,null))['catch'](handleError(_0x1013d1,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b1a9ae9..99f7bf2 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(_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 +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(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 232cc5f..7d7ca91 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 _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 +var _0xe8fd=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','debug','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xe8fd,0x178));var _0xde8f=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xe8fd[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0xde8f('0x0'));var util=require(_0xde8f('0x1'));var moment=require(_0xde8f('0x2'));var BPromise=require(_0xde8f('0x3'));var rs=require(_0xde8f('0x4'));var fs=require('fs');var Redis=require(_0xde8f('0x5'));var db=require(_0xde8f('0x6'))['db'];var utils=require(_0xde8f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xde8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xde8f('0x9')][_0xde8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26d254,_0x32167c,_0x30d586){return new BPromise(function(_0x247464,_0x5cff57){return client['request'](_0x26d254,_0x30d586)[_0xde8f('0xb')](function(_0x53fc38){logger[_0xde8f('0xc')]('ChatApplication,\x20%s,\x20%s',_0x32167c,'request\x20sent');logger[_0xde8f('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x32167c,_0xde8f('0xe'),JSON['stringify'](_0x53fc38));if(_0x53fc38[_0xde8f('0xf')]){if(_0x53fc38[_0xde8f('0xf')][_0xde8f('0x10')]===0x1f4){logger[_0xde8f('0xf')](_0xde8f('0x11'),_0x32167c,_0x53fc38[_0xde8f('0xf')]['message']);return _0x5cff57(_0x53fc38[_0xde8f('0xf')]['message']);}logger['error'](_0xde8f('0x11'),_0x32167c,_0x53fc38[_0xde8f('0xf')][_0xde8f('0x12')]);return _0x247464(_0x53fc38[_0xde8f('0xf')][_0xde8f('0x12')]);}else{logger[_0xde8f('0xc')](_0xde8f('0x11'),_0x32167c,_0xde8f('0xe'));_0x247464(_0x53fc38[_0xde8f('0x13')]['message']);}})[_0xde8f('0x14')](function(_0x221fcb){logger[_0xde8f('0xf')](_0xde8f('0x11'),_0x32167c,_0x221fcb);_0x5cff57(_0x221fcb);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b403fec..d60e4e8 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 _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 +var _0x3ccc=['express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','exports','multer','util','path','connect-timeout'];(function(_0x57d89c,_0x2812c4){var _0x3be11a=function(_0x2849d4){while(--_0x2849d4){_0x57d89c['push'](_0x57d89c['shift']());}};_0x3be11a(++_0x2812c4);}(_0x3ccc,0xdc));var _0xc3cc=function(_0x59bd64,_0x237f2b){_0x59bd64=_0x59bd64-0x0;var _0x378c0e=_0x3ccc[_0x59bd64];return _0x378c0e;};'use strict';var multer=require(_0xc3cc('0x0'));var util=require(_0xc3cc('0x1'));var path=require(_0xc3cc('0x2'));var timeout=require(_0xc3cc('0x3'));var express=require(_0xc3cc('0x4'));var router=express[_0xc3cc('0x5')]();var auth=require(_0xc3cc('0x6'));var interaction=require(_0xc3cc('0x7'));var config=require('../../config/environment');var controller=require(_0xc3cc('0x8'));router[_0xc3cc('0x9')](_0xc3cc('0xa'),auth[_0xc3cc('0xb')](),controller[_0xc3cc('0xc')]);router[_0xc3cc('0xd')](_0xc3cc('0xa'),auth[_0xc3cc('0xb')](),controller[_0xc3cc('0xe')]);router['delete'](_0xc3cc('0xa'),auth[_0xc3cc('0xb')](),controller['destroy']);module[_0xc3cc('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 9a8de25..736f57f 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 _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 +var _0x0cd1=['STRING','BOOLEAN','exports'];(function(_0x14ebee,_0xff1904){var _0xbf1219=function(_0x3e528d){while(--_0x3e528d){_0x14ebee['push'](_0x14ebee['shift']());}};_0xbf1219(++_0xff1904);}(_0x0cd1,0x1e2));var _0x10cd=function(_0x3aadde,_0x50f23f){_0x3aadde=_0x3aadde-0x0;var _0x21df4e=_0x0cd1[_0x3aadde];return _0x21df4e;};'use strict';var Sequelize=require('sequelize');module[_0x10cd('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x10cd('0x1')]},'write':{'type':Sequelize[_0x10cd('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 85c72b5..0c45926 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 _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 +var _0x46c1=['describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./chatGroup.socket','register','jayson/promise','http','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','ChatGroup','includeAll','include','findAll','rows','show','options','find','create','body','params'];(function(_0x4bc428,_0xf56dd9){var _0x3ca37f=function(_0x39db20){while(--_0x39db20){_0x4bc428['push'](_0x4bc428['shift']());}};_0x3ca37f(++_0xf56dd9);}(_0x46c1,0x7c));var _0x146c=function(_0x5cc6c1,_0x5e09db){_0x5cc6c1=_0x5cc6c1-0x0;var _0x4c8192=_0x46c1[_0x5cc6c1];return _0x4c8192;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x146c('0x0'));var rimraf=require(_0x146c('0x1'));var zipdir=require(_0x146c('0x2'));var jsonpatch=require(_0x146c('0x3'));var rp=require(_0x146c('0x4'));var moment=require('moment');var BPromise=require(_0x146c('0x5'));var Mustache=require(_0x146c('0x6'));var util=require(_0x146c('0x7'));var path=require(_0x146c('0x8'));var sox=require(_0x146c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x146c('0xa'));var squel=require(_0x146c('0xb'));var crypto=require(_0x146c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x146c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x146c('0xe'));var Papa=require(_0x146c('0xf'));var Redis=require('ioredis');var authService=require(_0x146c('0x10'));var qs=require(_0x146c('0x11'));var as=require(_0x146c('0x12'));var hardwareService=require(_0x146c('0x13'));var logger=require('../../config/logger')(_0x146c('0x14'));var utils=require('../../config/utils');var config=require(_0x146c('0x15'));var licenseUtil=require(_0x146c('0x16'));var db=require(_0x146c('0x17'))['db'];config['redis']=_[_0x146c('0x18')](config['redis'],{'host':_0x146c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x146c('0x1a')]));require(_0x146c('0x1b'))[_0x146c('0x1c')](socket);var jayson=require(_0x146c('0x1d'));var client=jayson['client'][_0x146c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xa535fd,_0x552524,_0x25a3b3,_0x50bdae){return new BPromise(function(_0x4a554b,_0x15aaf4){var _0x512ac8=_0x50bdae||client;return _0x512ac8[_0x146c('0x1f')](_0xa535fd,_0x25a3b3)[_0x146c('0x20')](function(_0x731da7){logger['info'](_0x146c('0x21'),_0x552524,_0x146c('0x22'));logger[_0x146c('0x23')](_0x146c('0x24'),_0x552524,_0x146c('0x22'),JSON[_0x146c('0x25')](_0x731da7));if(_0x731da7[_0x146c('0x26')]){if(_0x731da7[_0x146c('0x26')][_0x146c('0x27')]===0x1f4){logger['error'](_0x146c('0x21'),_0x552524,_0x731da7[_0x146c('0x26')][_0x146c('0x28')]);return _0x15aaf4(_0x731da7[_0x146c('0x26')][_0x146c('0x28')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x552524,_0x731da7[_0x146c('0x26')][_0x146c('0x28')]);return _0x4a554b(_0x731da7[_0x146c('0x26')][_0x146c('0x28')]);}else{logger['info'](_0x146c('0x21'),_0x552524,_0x146c('0x22'));_0x4a554b(_0x731da7[_0x146c('0x29')][_0x146c('0x28')]);}})[_0x146c('0x2a')](function(_0x5e042f){logger['error'](_0x146c('0x21'),_0x552524,_0x5e042f);_0x15aaf4(_0x5e042f);});});}function respondWithStatusCode(_0x3651b3,_0x393e6c){_0x393e6c=_0x393e6c||0xcc;return function(_0x46c83c){if(_0x46c83c){return _0x3651b3['sendStatus'](_0x393e6c);}return _0x3651b3[_0x146c('0x2b')](_0x393e6c)[_0x146c('0x2c')]();};}function respondWithResult(_0x4260f1,_0x3ad5fb){_0x3ad5fb=_0x3ad5fb||0xc8;return function(_0x109a3f){if(_0x109a3f){return _0x4260f1[_0x146c('0x2b')](_0x3ad5fb)[_0x146c('0x2d')](_0x109a3f);}};}function respondWithFilteredResult(_0x428157,_0x3bd8b5){return function(_0x5158b2){if(_0x5158b2){var _0x7c336b=_0x5158b2[_0x146c('0x2e')],_0x566d90=_0x3bd8b5[_0x146c('0x2f')],_0x5c44ef=_0x3bd8b5[_0x146c('0x2f')]+_0x3bd8b5[_0x146c('0x30')],_0x3a88f9;if(_0x5c44ef>=_0x7c336b){_0x5c44ef=_0x7c336b;_0x3a88f9=0xc8;}else{_0x3a88f9=0xce;}_0x428157[_0x146c('0x2b')](_0x3a88f9);return _0x428157[_0x146c('0x31')](_0x146c('0x32'),_0x566d90+'-'+_0x5c44ef+'/'+_0x7c336b)[_0x146c('0x2d')](_0x5158b2);}return null;};}function patchUpdates(_0x19c71d){return function(_0x317374){try{jsonpatch['apply'](_0x317374,_0x19c71d,!![]);}catch(_0x280d01){return BPromise[_0x146c('0x33')](_0x280d01);}return _0x317374['save']();};}function saveUpdates(_0x28ac45,_0x257e5d){return function(_0x3b591b){if(_0x3b591b){return _0x3b591b[_0x146c('0x34')](_0x28ac45)[_0x146c('0x20')](function(_0x4a584e){return _0x4a584e;});}return null;};}function removeEntity(_0x5c9584,_0x3dbf1c){return function(_0xe77c87){if(_0xe77c87){return _0xe77c87[_0x146c('0x35')]()[_0x146c('0x20')](function(){_0x5c9584[_0x146c('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1230bc,_0x22b317){return function(_0x38246d){if(!_0x38246d){_0x1230bc[_0x146c('0x36')](0x194);}return _0x38246d;};}function handleError(_0x4bfa56,_0x31437b){_0x31437b=_0x31437b||0x1f4;return function(_0x21756f){logger[_0x146c('0x26')](_0x21756f[_0x146c('0x37')]);if(_0x21756f[_0x146c('0x38')]){delete _0x21756f[_0x146c('0x38')];}_0x4bfa56[_0x146c('0x2b')](_0x31437b)[_0x146c('0x39')](_0x21756f);};}exports[_0x146c('0x3a')]=function(_0x95b262,_0x209dba){var _0x2af0af={},_0x22a737={},_0x1eda27={'count':0x0,'rows':[]};var _0x301985=_[_0x146c('0x3b')](db['ChatGroup'][_0x146c('0x3c')],function(_0x527c6e){return{'name':_0x527c6e[_0x146c('0x3d')],'type':_0x527c6e[_0x146c('0x3e')]['key']};});_0x22a737[_0x146c('0x3f')]=_['map'](_0x301985,'name');_0x22a737[_0x146c('0x40')]=_[_0x146c('0x41')](_0x95b262[_0x146c('0x40')]);_0x22a737[_0x146c('0x42')]=_[_0x146c('0x43')](_0x22a737['model'],_0x22a737[_0x146c('0x40')]);_0x2af0af[_0x146c('0x44')]=_['intersection'](_0x22a737[_0x146c('0x3f')],qs[_0x146c('0x45')](_0x95b262[_0x146c('0x40')][_0x146c('0x45')]));_0x2af0af[_0x146c('0x44')]=_0x2af0af[_0x146c('0x44')][_0x146c('0x46')]?_0x2af0af[_0x146c('0x44')]:_0x22a737['model'];if(!_0x95b262[_0x146c('0x40')][_0x146c('0x47')](_0x146c('0x48'))){_0x2af0af[_0x146c('0x30')]=qs[_0x146c('0x30')](_0x95b262[_0x146c('0x40')][_0x146c('0x30')]);_0x2af0af[_0x146c('0x2f')]=qs[_0x146c('0x2f')](_0x95b262[_0x146c('0x40')]['offset']);}_0x2af0af[_0x146c('0x49')]=qs[_0x146c('0x4a')](_0x95b262[_0x146c('0x40')]['sort']);_0x2af0af[_0x146c('0x4b')]=qs[_0x146c('0x42')](_[_0x146c('0x4c')](_0x95b262['query'],_0x22a737[_0x146c('0x42')]),_0x301985);if(_0x95b262[_0x146c('0x40')]['filter']){_0x2af0af[_0x146c('0x4b')]=_[_0x146c('0x4d')](_0x2af0af[_0x146c('0x4b')],{'$or':_[_0x146c('0x3b')](_0x301985,function(_0x423941){if(_0x423941['type']!=='VIRTUAL'){var _0x2e5c79={};_0x2e5c79[_0x423941['name']]={'$like':'%'+_0x95b262[_0x146c('0x40')][_0x146c('0x4e')]+'%'};return _0x2e5c79;}})});}_0x2af0af=_[_0x146c('0x4d')]({},_0x2af0af,_0x95b262['options']);var _0x15dd8f={'where':_0x2af0af[_0x146c('0x4b')]};return db[_0x146c('0x4f')][_0x146c('0x2e')](_0x15dd8f)[_0x146c('0x20')](function(_0x5dca52){_0x1eda27['count']=_0x5dca52;if(_0x95b262[_0x146c('0x40')][_0x146c('0x50')]){_0x2af0af[_0x146c('0x51')]=[{'all':!![]}];}return db[_0x146c('0x4f')][_0x146c('0x52')](_0x2af0af);})[_0x146c('0x20')](function(_0x499eaa){_0x1eda27[_0x146c('0x53')]=_0x499eaa;return _0x1eda27;})['then'](respondWithFilteredResult(_0x209dba,_0x2af0af))[_0x146c('0x2a')](handleError(_0x209dba,null));};exports[_0x146c('0x54')]=function(_0x5a6e88,_0x58f581){var _0x3555f1={'raw':!![],'where':{'id':_0x5a6e88['params']['id']}},_0x510544={};_0x510544['model']=_[_0x146c('0x41')](db[_0x146c('0x4f')][_0x146c('0x3c')]);_0x510544[_0x146c('0x40')]=_['keys'](_0x5a6e88[_0x146c('0x40')]);_0x510544[_0x146c('0x42')]=_['intersection'](_0x510544[_0x146c('0x3f')],_0x510544[_0x146c('0x40')]);_0x3555f1[_0x146c('0x44')]=_[_0x146c('0x43')](_0x510544[_0x146c('0x3f')],qs[_0x146c('0x45')](_0x5a6e88[_0x146c('0x40')]['fields']));_0x3555f1['attributes']=_0x3555f1['attributes'][_0x146c('0x46')]?_0x3555f1['attributes']:_0x510544[_0x146c('0x3f')];if(_0x5a6e88[_0x146c('0x40')][_0x146c('0x50')]){_0x3555f1[_0x146c('0x51')]=[{'all':!![]}];}_0x3555f1=_[_0x146c('0x4d')]({},_0x3555f1,_0x5a6e88[_0x146c('0x55')]);return db[_0x146c('0x4f')][_0x146c('0x56')](_0x3555f1)['then'](handleEntityNotFound(_0x58f581,null))['then'](respondWithResult(_0x58f581,null))['catch'](handleError(_0x58f581,null));};exports[_0x146c('0x57')]=function(_0x491c54,_0x4d4501){return db[_0x146c('0x4f')][_0x146c('0x57')](_0x491c54[_0x146c('0x58')],{})['then'](respondWithResult(_0x4d4501,0xc9))['catch'](handleError(_0x4d4501,null));};exports['update']=function(_0x2852ab,_0x2514a6){if(_0x2852ab[_0x146c('0x58')]['id']){delete _0x2852ab[_0x146c('0x58')]['id'];}return db[_0x146c('0x4f')][_0x146c('0x56')]({'where':{'id':_0x2852ab['params']['id']}})['then'](handleEntityNotFound(_0x2514a6,null))[_0x146c('0x20')](saveUpdates(_0x2852ab[_0x146c('0x58')],null))['then'](respondWithResult(_0x2514a6,null))['catch'](handleError(_0x2514a6,null));};exports[_0x146c('0x35')]=function(_0x55f0d3,_0x410808){return db[_0x146c('0x4f')][_0x146c('0x56')]({'where':{'id':_0x55f0d3[_0x146c('0x59')]['id']}})[_0x146c('0x20')](handleEntityNotFound(_0x410808,null))['then'](removeEntity(_0x410808,null))[_0x146c('0x2a')](handleError(_0x410808,null));};exports[_0x146c('0x5a')]=function(_0x1e52d3,_0x229f10){return db[_0x146c('0x4f')]['describe']()['then'](respondWithResult(_0x229f10,null))[_0x146c('0x2a')](handleError(_0x229f10,null));};exports['getUnread']=function(_0x38f4a8,_0x5d1a2a,_0x3d239e){return db[_0x146c('0x5b')]['count']({'where':{'ChatGroupId':_0x38f4a8[_0x146c('0x59')]['id'],'ToId':_0x38f4a8[_0x146c('0x5c')]['id'],'read':![]}})[_0x146c('0x20')](function(_0x3a784b){return{'id':_[_0x146c('0x5d')](_0x38f4a8[_0x146c('0x59')]['id']),'count':_0x3a784b};})['then'](respondWithResult(_0x5d1a2a,null))[_0x146c('0x2a')](handleError(_0x5d1a2a,null));};exports[_0x146c('0x5e')]=function(_0x4c97c0,_0xcf87ce,_0x5884b3){return db['ChatGroup'][_0x146c('0x56')]({'where':{'id':_0x4c97c0[_0x146c('0x59')]['id']}})[_0x146c('0x20')](handleEntityNotFound(_0xcf87ce,null))[_0x146c('0x20')](function(_0x3666c1){if(_0x3666c1){return _0x3666c1['addMembers'](_0x4c97c0[_0x146c('0x58')][_0x146c('0x5f')],_[_0x146c('0x60')](_0x4c97c0[_0x146c('0x58')],[_0x146c('0x5f'),'id'])||{});}})[_0x146c('0x20')](respondWithResult(_0xcf87ce,null))['catch'](handleError(_0xcf87ce,null));};exports[_0x146c('0x61')]=function(_0x5a4d37,_0x60efae,_0x35aef7){var _0x53ef6a={};var _0x5d0f17={};var _0x399bda;var _0x2ba6e6;return db[_0x146c('0x4f')][_0x146c('0x62')]({'where':{'id':_0x5a4d37['params']['id']}})['then'](handleEntityNotFound(_0x60efae,null))['then'](function(_0x2ae36f){if(_0x2ae36f){_0x399bda=_0x2ae36f;_0x5d0f17[_0x146c('0x3f')]=_[_0x146c('0x41')](db[_0x146c('0x63')][_0x146c('0x3c')]);_0x5d0f17['query']=_[_0x146c('0x41')](_0x5a4d37[_0x146c('0x40')]);_0x5d0f17[_0x146c('0x42')]=_[_0x146c('0x43')](_0x5d0f17[_0x146c('0x3f')],_0x5d0f17['query']);_0x53ef6a['attributes']=_[_0x146c('0x43')](_0x5d0f17[_0x146c('0x3f')],qs[_0x146c('0x45')](_0x5a4d37[_0x146c('0x40')]['fields']));_0x53ef6a[_0x146c('0x44')]=_0x53ef6a[_0x146c('0x44')][_0x146c('0x46')]?_0x53ef6a[_0x146c('0x44')]:_0x5d0f17['model'];_0x53ef6a['order']=qs[_0x146c('0x4a')](_0x5a4d37[_0x146c('0x40')]['sort']);_0x53ef6a[_0x146c('0x4b')]=qs[_0x146c('0x42')](_[_0x146c('0x4c')](_0x5a4d37[_0x146c('0x40')],_0x5d0f17[_0x146c('0x42')]));if(_0x5a4d37[_0x146c('0x40')][_0x146c('0x4e')]){_0x53ef6a['where']=_[_0x146c('0x4d')](_0x53ef6a[_0x146c('0x4b')],{'$or':_[_0x146c('0x3b')](_0x53ef6a[_0x146c('0x44')],function(_0x18ad68){var _0x10758f={};_0x10758f[_0x18ad68]={'$like':'%'+_0x5a4d37[_0x146c('0x40')][_0x146c('0x4e')]+'%'};return _0x10758f;})});}_0x53ef6a=_[_0x146c('0x4d')]({},_0x53ef6a,_0x5a4d37[_0x146c('0x55')]);return _0x399bda[_0x146c('0x61')](_0x53ef6a);}})[_0x146c('0x20')](function(_0x37cd2e){if(_0x37cd2e){_0x2ba6e6=_0x37cd2e['length'];if(!_0x5a4d37['query'][_0x146c('0x47')](_0x146c('0x48'))){_0x53ef6a[_0x146c('0x30')]=qs[_0x146c('0x30')](_0x5a4d37[_0x146c('0x40')][_0x146c('0x30')]);_0x53ef6a[_0x146c('0x2f')]=qs[_0x146c('0x2f')](_0x5a4d37[_0x146c('0x40')][_0x146c('0x2f')]);}return _0x399bda[_0x146c('0x61')](_0x53ef6a);}})[_0x146c('0x20')](function(_0x30678e){if(_0x30678e){return _0x30678e?{'count':_0x2ba6e6,'rows':_0x30678e}:null;}})['then'](respondWithResult(_0x60efae,null))[_0x146c('0x2a')](handleError(_0x60efae,null));};exports['removeMembers']=function(_0x4ba759,_0x514fab,_0x17e590){return db[_0x146c('0x4f')]['find']({'where':{'id':_0x4ba759[_0x146c('0x59')]['id']}})[_0x146c('0x20')](handleEntityNotFound(_0x514fab,null))[_0x146c('0x20')](function(_0x59eed9){if(_0x59eed9){return _0x59eed9[_0x146c('0x64')](_0x4ba759[_0x146c('0x40')][_0x146c('0x5f')]);}})[_0x146c('0x20')](respondWithStatusCode(_0x514fab,null))[_0x146c('0x2a')](handleError(_0x514fab,null));};exports[_0x146c('0x65')]=function(_0x3725a7,_0xcdd1e9,_0x584f1a){if(_0x3725a7['body']['id']){delete _0x3725a7[_0x146c('0x58')]['id'];}return db['ChatGroup'][_0x146c('0x56')]({'where':{'id':_0x3725a7[_0x146c('0x59')]['id']}})[_0x146c('0x20')](handleEntityNotFound(_0xcdd1e9,null))[_0x146c('0x20')](function(_0x263cf3){if(_0x263cf3){_0x3725a7[_0x146c('0x58')][_0x146c('0x66')]=_0x263cf3['id'];return db[_0x146c('0x5b')][_0x146c('0x57')](_0x3725a7[_0x146c('0x58')]);}})['then'](respondWithResult(_0xcdd1e9,null))[_0x146c('0x2a')](handleError(_0xcdd1e9,null));};exports['getMessages']=function(_0x1c82f2,_0x5842e8,_0x59a5b5){var _0x5d3b72={};var _0x3952cf={};var _0xed0e88;var _0x441672;return db[_0x146c('0x4f')][_0x146c('0x62')]({'where':{'id':_0x1c82f2[_0x146c('0x59')]['id']}})[_0x146c('0x20')](handleEntityNotFound(_0x5842e8,null))[_0x146c('0x20')](function(_0x123ea4){if(_0x123ea4){_0xed0e88=_0x123ea4;_0x3952cf[_0x146c('0x3f')]=_['keys'](db[_0x146c('0x5b')][_0x146c('0x3c')]);_0x3952cf[_0x146c('0x40')]=_[_0x146c('0x41')](_0x1c82f2[_0x146c('0x40')]);_0x3952cf[_0x146c('0x42')]=_[_0x146c('0x43')](_0x3952cf[_0x146c('0x3f')],_0x3952cf['query']);_0x5d3b72[_0x146c('0x44')]=_[_0x146c('0x43')](_0x3952cf[_0x146c('0x3f')],qs['fields'](_0x1c82f2[_0x146c('0x40')][_0x146c('0x45')]));_0x5d3b72[_0x146c('0x44')]=_0x5d3b72[_0x146c('0x44')][_0x146c('0x46')]?_0x5d3b72[_0x146c('0x44')]:_0x3952cf[_0x146c('0x3f')];_0x5d3b72[_0x146c('0x49')]=qs[_0x146c('0x4a')](_0x1c82f2[_0x146c('0x40')]['sort']);_0x5d3b72[_0x146c('0x4b')]=qs[_0x146c('0x42')](_[_0x146c('0x4c')](_0x1c82f2['query'],_0x3952cf[_0x146c('0x42')]));if(_0x1c82f2[_0x146c('0x40')]['filter']){_0x5d3b72[_0x146c('0x4b')]=_['merge'](_0x5d3b72['where'],{'$or':_[_0x146c('0x3b')](_0x5d3b72['attributes'],function(_0x571ae8){var _0x101530={};_0x101530[_0x571ae8]={'$like':'%'+_0x1c82f2[_0x146c('0x40')][_0x146c('0x4e')]+'%'};return _0x101530;})});}if(_0x1c82f2['query'][_0x146c('0x67')]){var _0x4499ac=_0x1c82f2[_0x146c('0x40')][_0x146c('0x67')][_0x146c('0x68')](',');var _0x14a96d={};_0x14a96d[_0x4499ac[0x0]]={'$gte':moment(_0x4499ac[0x1])['format'](_0x146c('0x69'))};_0x5d3b72['where']=_[_0x146c('0x4d')](_0x5d3b72['where'],_0x14a96d);}_0x5d3b72=_[_0x146c('0x4d')]({},_0x5d3b72,_0x1c82f2[_0x146c('0x55')]);return _0xed0e88[_0x146c('0x6a')](_0x5d3b72);}})['then'](function(_0x4a86d6){if(_0x4a86d6){_0x441672=_0x4a86d6[_0x146c('0x46')];if(!_0x1c82f2['query'][_0x146c('0x47')](_0x146c('0x48'))){_0x5d3b72[_0x146c('0x30')]=qs[_0x146c('0x30')](_0x1c82f2[_0x146c('0x40')][_0x146c('0x30')]);_0x5d3b72[_0x146c('0x2f')]=qs[_0x146c('0x2f')](_0x1c82f2[_0x146c('0x40')]['offset']);}return _0xed0e88[_0x146c('0x6a')](_0x5d3b72);}})['then'](function(_0x5b7843){if(_0x5b7843){return _0x5b7843?{'count':_0x441672,'rows':_0x5b7843}:null;}})[_0x146c('0x20')](respondWithResult(_0x5842e8,null))[_0x146c('0x2a')](handleError(_0x5842e8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f2c4a5d..83c6f77 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(_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 +var _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0xadb5,0xad));var _0x5adb=function(_0x39d30a,_0x20261a){_0x39d30a=_0x39d30a-0x0;var _0x57b49b=_0xadb5[_0x39d30a];return _0x57b49b;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index db3a0d2..e86261f 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 _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 +var _0xc0a4=['define','ChatGroup','chat_groups','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0xc0a4,0x147));var _0x4c0a=function(_0x21425c,_0x1231e6){_0x21425c=_0x21425c-0x0;var _0x1724f6=_0xc0a4[_0x21425c];return _0x1724f6;};'use strict';var _=require('lodash');var util=require(_0x4c0a('0x0'));var logger=require(_0x4c0a('0x1'))(_0x4c0a('0x2'));var moment=require('moment');var BPromise=require(_0x4c0a('0x3'));var rp=require(_0x4c0a('0x4'));var fs=require('fs');var path=require(_0x4c0a('0x5'));var rimraf=require(_0x4c0a('0x6'));var config=require(_0x4c0a('0x7'));var attributes=require('./chatGroup.attributes');module[_0x4c0a('0x8')]=function(_0x1a78a1,_0x12af4b){return _0x1a78a1[_0x4c0a('0x9')](_0x4c0a('0xa'),attributes,{'tableName':_0x4c0a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 8469fb0..b913000 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 _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 +var _0x89b2=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xde4825,_0x44d0e0){var _0x37e001=function(_0x4ff30b){while(--_0x4ff30b){_0xde4825['push'](_0xde4825['shift']());}};_0x37e001(++_0x44d0e0);}(_0x89b2,0x16b));var _0x289b=function(_0x82f6aa,_0xc6acd1){_0x82f6aa=_0x82f6aa-0x0;var _0x3ff4d0=_0x89b2[_0x82f6aa];return _0x3ff4d0;};'use strict';var _=require(_0x289b('0x0'));var util=require(_0x289b('0x1'));var moment=require(_0x289b('0x2'));var BPromise=require(_0x289b('0x3'));var rs=require(_0x289b('0x4'));var fs=require('fs');var Redis=require(_0x289b('0x5'));var db=require(_0x289b('0x6'))['db'];var utils=require(_0x289b('0x7'));var logger=require(_0x289b('0x8'))(_0x289b('0x9'));var config=require(_0x289b('0xa'));var jayson=require(_0x289b('0xb'));var client=jayson['client'][_0x289b('0xc')]({'port':0x232a});config[_0x289b('0xd')]=_[_0x289b('0xe')](config[_0x289b('0xd')],{'host':_0x289b('0xf'),'port':0x18eb});var socket=require(_0x289b('0x10'))(new Redis(config['redis']));require(_0x289b('0x11'))['register'](socket);function respondWithRpcPromise(_0x28abeb,_0x1c9630,_0x362d01){return new BPromise(function(_0x295d9f,_0x2d5a5e){return client[_0x289b('0x12')](_0x28abeb,_0x362d01)[_0x289b('0x13')](function(_0x125802){logger[_0x289b('0x14')](_0x289b('0x15'),_0x1c9630,_0x289b('0x16'));logger[_0x289b('0x17')](_0x289b('0x18'),_0x1c9630,'request\x20sent',JSON[_0x289b('0x19')](_0x125802));if(_0x125802[_0x289b('0x1a')]){if(_0x125802['error'][_0x289b('0x1b')]===0x1f4){logger[_0x289b('0x1a')](_0x289b('0x15'),_0x1c9630,_0x125802[_0x289b('0x1a')][_0x289b('0x1c')]);return _0x2d5a5e(_0x125802[_0x289b('0x1a')][_0x289b('0x1c')]);}logger[_0x289b('0x1a')](_0x289b('0x15'),_0x1c9630,_0x125802[_0x289b('0x1a')]['message']);return _0x295d9f(_0x125802[_0x289b('0x1a')]['message']);}else{logger['info'](_0x289b('0x15'),_0x1c9630,_0x289b('0x16'));_0x295d9f(_0x125802['result'][_0x289b('0x1c')]);}})[_0x289b('0x1d')](function(_0x65bcb3){logger[_0x289b('0x1a')]('ChatGroup,\x20%s,\x20%s',_0x1c9630,_0x65bcb3);_0x2d5a5e(_0x65bcb3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 725b7e0..28c4eea 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 _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 +var _0xf767=['./chatGroup.events','save','remove','removeListener','register','length'];(function(_0x43003b,_0x1eb536){var _0x5cc8b4=function(_0x59a6b9){while(--_0x59a6b9){_0x43003b['push'](_0x43003b['shift']());}};_0x5cc8b4(++_0x1eb536);}(_0xf767,0x18c));var _0x7f76=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0xf767[_0x2d9c6a];return _0xf3c918;};'use strict';var ChatGroupEvents=require(_0x7f76('0x0'));var events=[_0x7f76('0x1'),_0x7f76('0x2'),'update'];function createListener(_0x2f5729,_0x4e924a){return function(_0x103daa){_0x4e924a['emit'](_0x2f5729,_0x103daa);};}function removeListener(_0x3e02fe,_0x419a3d){return function(){ChatGroupEvents[_0x7f76('0x3')](_0x3e02fe,_0x419a3d);};}exports[_0x7f76('0x4')]=function(_0x3f0f24){for(var _0x2131d5=0x0,_0x2a2ee0=events[_0x7f76('0x5')];_0x2131d5<_0x2a2ee0;_0x2131d5++){var _0x14fd6f=events[_0x2131d5];var _0x41e21b=createListener('chatGroup:'+_0x14fd6f,_0x3f0f24);ChatGroupEvents['on'](_0x14fd6f,_0x41e21b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index b1223fc..8e8c43b 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 _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 +var _0xe259=['/:id/members','getMembers','create','post','addMembers','/:id/messages','addMessage','delete','destroy','removeMembers','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/unread','getUnread'];(function(_0x11e704,_0xcd014c){var _0x453175=function(_0x856b34){while(--_0x856b34){_0x11e704['push'](_0x11e704['shift']());}};_0x453175(++_0xcd014c);}(_0xe259,0x1ab));var _0x9e25=function(_0x4a232f,_0x4f25de){_0x4a232f=_0x4a232f-0x0;var _0x43eff3=_0xe259[_0x4a232f];return _0x43eff3;};'use strict';var multer=require('multer');var util=require(_0x9e25('0x0'));var path=require('path');var timeout=require(_0x9e25('0x1'));var express=require(_0x9e25('0x2'));var router=express[_0x9e25('0x3')]();var auth=require(_0x9e25('0x4'));var interaction=require(_0x9e25('0x5'));var config=require('../../config/environment');var controller=require('./chatGroup.controller');router['get']('/',auth[_0x9e25('0x6')](),controller[_0x9e25('0x7')]);router[_0x9e25('0x8')](_0x9e25('0x9'),auth[_0x9e25('0x6')](),controller[_0x9e25('0xa')]);router[_0x9e25('0x8')](_0x9e25('0xb'),auth['isAuthenticated'](),controller[_0x9e25('0xc')]);router[_0x9e25('0x8')](_0x9e25('0xd'),auth[_0x9e25('0x6')](),controller[_0x9e25('0xe')]);router[_0x9e25('0x8')](_0x9e25('0xf'),auth[_0x9e25('0x6')](),controller[_0x9e25('0x10')]);router['get']('/:id/messages',auth[_0x9e25('0x6')](),controller['getMessages']);router['post']('/',auth[_0x9e25('0x6')](),controller[_0x9e25('0x11')]);router[_0x9e25('0x12')](_0x9e25('0xf'),auth[_0x9e25('0x6')](),controller[_0x9e25('0x13')]);router[_0x9e25('0x12')](_0x9e25('0x14'),auth[_0x9e25('0x6')](),controller[_0x9e25('0x15')]);router['put']('/:id',auth[_0x9e25('0x6')](),controller['update']);router[_0x9e25('0x16')]('/:id',auth[_0x9e25('0x6')](),controller[_0x9e25('0x17')]);router[_0x9e25('0x16')](_0x9e25('0xf'),auth[_0x9e25('0x6')](),controller[_0x9e25('0x18')]);module[_0x9e25('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index eb871b8..fd57a89 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 _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 +var _0x5ca5=['STRING','DATE','long','out','sequelize','exports','BOOLEAN','ENUM','star','TEXT'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x5ca5,0x176));var _0x55ca=function(_0x2b2fe2,_0x2f8911){_0x2b2fe2=_0x2b2fe2-0x0;var _0x573441=_0x5ca5[_0x2b2fe2];return _0x573441;};'use strict';var Sequelize=require(_0x55ca('0x0'));module[_0x55ca('0x1')]={'closed':{'type':Sequelize[_0x55ca('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x55ca('0x3')](_0x55ca('0x4'),'thumb'),'defaultValue':_0x55ca('0x4')},'ratingMessage':{'type':Sequelize[_0x55ca('0x5')]},'pathTranscript':{'type':Sequelize[_0x55ca('0x5')]},'mailTranscript':{'type':Sequelize[_0x55ca('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x55ca('0x7')]},'disposition':{'type':Sequelize[_0x55ca('0x6')]},'secondDisposition':{'type':Sequelize[_0x55ca('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x55ca('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x55ca('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x55ca('0x6')]},'deviceVendor':{'type':Sequelize[_0x55ca('0x6')]},'deviceType':{'type':Sequelize[_0x55ca('0x6')]},'referer':{'type':Sequelize[_0x55ca('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT'](_0x55ca('0x8'))},'read1stAt':{'type':Sequelize[_0x55ca('0x7')]},'lastMsgAt':{'type':Sequelize[_0x55ca('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x55ca('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x55ca('0x6')]},'customerPort':{'type':Sequelize[_0x55ca('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 360cb58..04df5b3 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 _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 +var _0x15ed=['user','role','agent','i.ChatWebsiteId\x20IS\x20NULL','ChatWebsiteId','sequelize','toString','count','keyBy','merge','ChatInteraction','a.key','Account.key','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','show','params','includeAll','include','options','create','destroy','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','POST','MotionCWB:','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','closed','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','attachId','join','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','CmContact','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','ids','getMessages','nolimit','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','includeAgent','addTags','setTags','emit','chatInteractionTags:save','removeTags','download','root','files','tmp','server','transcript-%d-%s.zip','firstName','lastName','attachments','Attachment','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','%s\x20#%d','Chat','YYYY-MM-DD','Account','Owner','closedAt','disposition','browserName','osName','referer','customerIp','customerPort','N.A.','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','downloadInteraction.html','toFile','.pdf','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','color','from','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','length','conditions','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','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','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$lte','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL'];(function(_0x4e50b6,_0x2286c6){var _0x2b5000=function(_0x3fba1f){while(--_0x3fba1f){_0x4e50b6['push'](_0x4e50b6['shift']());}};_0x2b5000(++_0x2286c6);}(_0x15ed,0x1d0));var _0xd15e=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x15ed[_0x28b0a1];return _0x21470c;};'use strict';var pdf=require(_0xd15e('0x0'));var emlformat=require(_0xd15e('0x1'));var rimraf=require(_0xd15e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd15e('0x3'));var moment=require(_0xd15e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd15e('0x5'));var util=require(_0xd15e('0x6'));var path=require(_0xd15e('0x7'));var sox=require(_0xd15e('0x8'));var csv=require(_0xd15e('0x9'));var ejs=require(_0xd15e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd15e('0xb'));var crypto=require(_0xd15e('0xc'));var jsforce=require(_0xd15e('0xd'));var deskjs=require(_0xd15e('0xe'));var toCsv=require(_0xd15e('0x9'));var querystring=require(_0xd15e('0xf'));var Papa=require(_0xd15e('0x10'));var Redis=require('ioredis');var authService=require(_0xd15e('0x11'));var qs=require(_0xd15e('0x12'));var as=require(_0xd15e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd15e('0x14'))(_0xd15e('0x15'));var utils=require(_0xd15e('0x16'));var config=require(_0xd15e('0x17'));var licenseUtil=require(_0xd15e('0x18'));var db=require('../../mysqldb')['db'];config[_0xd15e('0x19')]=_[_0xd15e('0x1a')](config[_0xd15e('0x19')],{'host':_0xd15e('0x1b'),'port':0x18eb});var socket=require(_0xd15e('0x1c'))(new Redis(config[_0xd15e('0x19')]));require(_0xd15e('0x1d'))['register'](socket);var jayson=require(_0xd15e('0x1e'));var client=jayson[_0xd15e('0x1f')][_0xd15e('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x386457,_0x40e118,_0x3ec9c3,_0x5c800){return new BPromise(function(_0x42e4fa,_0x46a77b){var _0x1d43da=_0x5c800||client;return _0x1d43da[_0xd15e('0x21')](_0x386457,_0x3ec9c3)[_0xd15e('0x22')](function(_0x19e3ae){logger['info'](_0xd15e('0x23'),_0x40e118,'request\x20sent');logger[_0xd15e('0x24')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x40e118,_0xd15e('0x25'),JSON[_0xd15e('0x26')](_0x19e3ae));if(_0x19e3ae[_0xd15e('0x27')]){if(_0x19e3ae[_0xd15e('0x27')][_0xd15e('0x28')]===0x1f4){logger[_0xd15e('0x27')](_0xd15e('0x23'),_0x40e118,_0x19e3ae['error']['message']);return _0x46a77b(_0x19e3ae['error'][_0xd15e('0x29')]);}logger[_0xd15e('0x27')](_0xd15e('0x23'),_0x40e118,_0x19e3ae[_0xd15e('0x27')]['message']);return _0x42e4fa(_0x19e3ae[_0xd15e('0x27')][_0xd15e('0x29')]);}else{logger[_0xd15e('0x2a')](_0xd15e('0x23'),_0x40e118,_0xd15e('0x25'));_0x42e4fa(_0x19e3ae[_0xd15e('0x2b')][_0xd15e('0x29')]);}})['catch'](function(_0x3b691e){logger['error'](_0xd15e('0x23'),_0x40e118,_0x3b691e);_0x46a77b(_0x3b691e);});});}function respondWithStatusCode(_0x32a78b,_0x5f2bd5){_0x5f2bd5=_0x5f2bd5||0xcc;return function(_0x26b951){if(_0x26b951){return _0x32a78b[_0xd15e('0x2c')](_0x5f2bd5);}return _0x32a78b[_0xd15e('0x2d')](_0x5f2bd5)[_0xd15e('0x2e')]();};}function respondWithResult(_0x2375f0,_0x1b8a26){_0x1b8a26=_0x1b8a26||0xc8;return function(_0x16acdb){if(_0x16acdb){return _0x2375f0[_0xd15e('0x2d')](_0x1b8a26)[_0xd15e('0x2f')](_0x16acdb);}};}function respondWithFilteredResult(_0x5e05e7,_0x6e30f6){return function(_0x425afd){if(_0x425afd){var _0x4eee0f=_0x425afd['count'],_0x4ab27f=_0x6e30f6[_0xd15e('0x30')],_0x1d521c=_0x6e30f6[_0xd15e('0x30')]+_0x6e30f6[_0xd15e('0x31')],_0x2abb02;if(_0x1d521c>=_0x4eee0f){_0x1d521c=_0x4eee0f;_0x2abb02=0xc8;}else{_0x2abb02=0xce;}_0x5e05e7[_0xd15e('0x2d')](_0x2abb02);return _0x5e05e7[_0xd15e('0x32')](_0xd15e('0x33'),_0x4ab27f+'-'+_0x1d521c+'/'+_0x4eee0f)[_0xd15e('0x2f')](_0x425afd);}return null;};}function patchUpdates(_0x2905c3){return function(_0x29175b){try{jsonpatch[_0xd15e('0x34')](_0x29175b,_0x2905c3,!![]);}catch(_0x33a80e){return BPromise[_0xd15e('0x35')](_0x33a80e);}return _0x29175b[_0xd15e('0x36')]();};}function saveUpdates(_0x5a7462,_0x423084){return function(_0x422fdb){if(_0x422fdb){return _0x422fdb[_0xd15e('0x37')](_0x5a7462)[_0xd15e('0x22')](function(_0x9d9c11){return _0x9d9c11;});}return null;};}function removeEntity(_0x526e75,_0x4f6bc8){return function(_0x1d79a5){if(_0x1d79a5){return _0x1d79a5['destroy']()[_0xd15e('0x22')](function(){_0x526e75[_0xd15e('0x2d')](0xcc)[_0xd15e('0x2e')]();});}};}function handleEntityNotFound(_0x5ec950,_0x457a6e){return function(_0x28bb6c){if(!_0x28bb6c){_0x5ec950[_0xd15e('0x2c')](0x194);}return _0x28bb6c;};}function handleError(_0x2a4a3b,_0x1b08e7){_0x1b08e7=_0x1b08e7||0x1f4;return function(_0x27056b){logger['error'](_0x27056b[_0xd15e('0x38')]);if(_0x27056b[_0xd15e('0x39')]){delete _0x27056b[_0xd15e('0x39')];}_0x2a4a3b[_0xd15e('0x2d')](_0x1b08e7)[_0xd15e('0x3a')](_0x27056b);};}function getInteractionUsers(_0x38b91c,_0x597638){return new BPromise(function(_0x2b4b40,_0x740bb6){try{if(_0x597638[_0x38b91c['id']]){_0x38b91c[_0xd15e('0x3b')]=_[_0xd15e('0x3c')](_0x597638[_0x38b91c['id']],function(_0x4b2e33){return{'id':_0x4b2e33['id'],'fullname':_0x4b2e33[_0xd15e('0x3d')]};});}}catch(_0xcf8424){_0x740bb6(_0xcf8424);}_0x2b4b40(_0x38b91c);});}function getInteractionTags(_0x1803ce,_0x177eb5){return new BPromise(function(_0xd50707,_0x312bd6){try{if(_0x1803ce[_0xd15e('0x3e')]){_0x1803ce[_0xd15e('0x3f')]=[];_0x1803ce[_0xd15e('0x3e')][_0xd15e('0x40')](',')[_0xd15e('0x41')](function(_0x4b4bcb){_0x1803ce[_0xd15e('0x3f')][_0xd15e('0x42')](_0x177eb5[_0x4b4bcb]);});}delete _0x1803ce[_0xd15e('0x3e')];}catch(_0x51fda1){_0x312bd6(_0x51fda1);}_0xd50707(_0x1803ce);});}function updateChatInteraction(_0x51e9bb,_0x5ccb84,_0x2e0124){return new BPromise(function(_0x4a484c,_0x4efe58){return getInteractionUsers(_0x51e9bb,_0x2e0124)[_0xd15e('0x22')](function(_0x1d849f){return getInteractionTags(_0x1d849f,_0x5ccb84);})[_0xd15e('0x22')](function(_0x105389){_0x4a484c(_0x105389);})[_0xd15e('0x43')](function(_0x1e2d25){_0x4efe58(_0x1e2d25);});});}exports[_0xd15e('0x44')]=function(_0x291295,_0x6288ef){var _0x23e8b2={},_0x150b18={},_0x5bf839={'count':0x0,'rows':[]};var _0xa2e0aa=_[_0xd15e('0x3c')](db['ChatInteraction'][_0xd15e('0x45')],function(_0x3d7ab9){return{'name':_0x3d7ab9[_0xd15e('0x46')],'type':_0x3d7ab9['type'][_0xd15e('0x47')]};});_0x150b18[_0xd15e('0x48')]=_[_0xd15e('0x3c')](_0xa2e0aa,'name');_0x150b18[_0xd15e('0x49')]=_['keys'](_0x291295[_0xd15e('0x49')]);_0x150b18[_0xd15e('0x4a')]=_[_0xd15e('0x4b')](_0x150b18['model'],_0x150b18[_0xd15e('0x49')]);_0x23e8b2[_0xd15e('0x4c')]=_['intersection'](_0x150b18['model'],qs[_0xd15e('0x4d')](_0x291295[_0xd15e('0x49')][_0xd15e('0x4d')]));_0x23e8b2[_0xd15e('0x4c')]=_0x23e8b2[_0xd15e('0x4c')]['length']?_0x23e8b2['attributes']:_0x150b18[_0xd15e('0x48')];if(!_0x291295[_0xd15e('0x49')][_0xd15e('0x4e')]('nolimit')){_0x23e8b2['limit']=qs[_0xd15e('0x31')](_0x291295['query'][_0xd15e('0x31')]);_0x23e8b2[_0xd15e('0x30')]=qs['offset'](_0x291295[_0xd15e('0x49')][_0xd15e('0x30')]);}_0x23e8b2[_0xd15e('0x4f')]=qs['sort'](_0x291295[_0xd15e('0x49')][_0xd15e('0x50')]);_0x23e8b2[_0xd15e('0x51')]=qs[_0xd15e('0x4a')](_[_0xd15e('0x52')](_0x291295['query'],_0x150b18[_0xd15e('0x4a')]),_0xa2e0aa);var _0x2d07b3=[];var _0x577b13=squel[_0xd15e('0x53')]()[_0xd15e('0x54')]('id')['field']('name')[_0xd15e('0x54')](_0xd15e('0x55'))[_0xd15e('0x56')]('tools_tags');var _0x309d6b=squel[_0xd15e('0x53')]()[_0xd15e('0x54')]('u.id')['field'](_0xd15e('0x57'))[_0xd15e('0x54')](_0xd15e('0x58'))[_0xd15e('0x56')]('user_has_chat_interactions','ui')[_0xd15e('0x59')](_0xd15e('0x5a'),'u',_0xd15e('0x5b'));var _0x5b4589=squel[_0xd15e('0x53')]()['from'](_0xd15e('0x5c'),'i')[_0xd15e('0x59')]('cm_contacts','c',_0xd15e('0x5d'))['left_join'](_0xd15e('0x5a'),'o',_0xd15e('0x5e'))[_0xd15e('0x59')](_0xd15e('0x5f'),'a','a.id\x20=\x20i.ChatWebsiteId')[_0xd15e('0x59')](_0xd15e('0x60'),'me',_0xd15e('0x61'))[_0xd15e('0x59')](_0xd15e('0x62'),'it',_0xd15e('0x63'))[_0xd15e('0x59')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x49a798=squel[_0xd15e('0x64')]();var _0x57525a=[];var _0x5ee020=squel[_0xd15e('0x64')]();var _0x167279;if(_0x291295[_0xd15e('0x49')][_0xd15e('0x65')]){_0x167279=as[_0xd15e('0x66')](_0x291295['query'][_0xd15e('0x65')]);var _0x35afe3=_0x167279[_0xd15e('0x67')];for(var _0x43f805=0x0;_0x43f805<_0x167279['conditions'][_0xd15e('0x68')];_0x43f805++){var _0x110605=_0x167279[_0xd15e('0x69')][_0x43f805];var _0x3e33cb='i';var _0x339664=_['find'](_0xa2e0aa,[_0xd15e('0x39'),_0x110605[_0xd15e('0x54')]]);if(!_0x339664){switch(_0x110605[_0xd15e('0x54')]){case _0xd15e('0x6a'):if(_0x110605[_0xd15e('0x6b')]==0x1){_0x5b4589['having']('`'+_0x110605[_0xd15e('0x54')]+_0xd15e('0x6c'));}else{_0x5b4589['having']('`'+_0x110605['field']+_0xd15e('0x6d'));}break;case _0xd15e('0x6e'):if(_0x110605[_0xd15e('0x6f')]==='$substring'){if(_0x110605[_0xd15e('0x6b')][_0xd15e('0x40')]('\x20')['length']>0x1){_0x49a798[_0x35afe3](_0xd15e('0x70'),qs[_0xd15e('0x71')](_0x110605[_0xd15e('0x6b')]),null);}else{var _0x391217='%'+_0x110605['value']+'%';_0x49a798[_0x35afe3]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x391217,_0x391217,_0x391217);}}else{_0x339664=_[_0xd15e('0x72')](_0xa2e0aa,['name',_0xd15e('0x73')]);_0x110605['field']='ContactId';_0x4305d1=as[_0xd15e('0x74')](_0x3e33cb,_0x339664[_0xd15e('0x75')],_0x110605);_0x49a798[_0x35afe3](_0x4305d1[_0xd15e('0x76')],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x77')],_0x4305d1[_0xd15e('0x6b')]['end']);}break;case _0xd15e('0x78'):var _0x23c4fc=_0x110605[_0xd15e('0x6b')]['split'](',')[_0xd15e('0x3c')](function(_0x473dac){return Number(_0x473dac);});_0x23c4fc[_0xd15e('0x41')](function(_0x31ce65){_0x5ee020['or'](_0xd15e('0x79'),'%,'+_0x31ce65+',%');});_0x57525a=_[_0xd15e('0x7a')](_0x57525a,_0x23c4fc);break;case _0xd15e('0x7b'):if(_0x110605['operator']===_0xd15e('0x7c')){_0x49a798[_0x35afe3](_0xd15e('0x7d'),'%'+_0x110605['value']+'%',null);}else{_0x339664=_['find'](_0xa2e0aa,[_0xd15e('0x39'),_0xd15e('0x7e')]);_0x110605[_0xd15e('0x54')]=_0xd15e('0x7e');_0x4305d1=as['buildExpression'](_0x3e33cb,_0x339664[_0xd15e('0x75')],_0x110605);_0x49a798[_0x35afe3](_0x4305d1['text'],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x77')],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x2e')]);}break;case _0xd15e('0x7f'):_0x4305d1=as[_0xd15e('0x74')]('me',null,_0x110605);_0x49a798[_0x35afe3](_0x4305d1['text'],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x77')],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x2e')]);break;}}else{var _0x4305d1=as[_0xd15e('0x74')](_0x3e33cb,_0x339664[_0xd15e('0x75')],_0x110605);_0x49a798[_0x35afe3](_0x4305d1['text'],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x77')],_0x4305d1[_0xd15e('0x6b')][_0xd15e('0x2e')]);}}}else{var _0x2c9036=_(_0x291295[_0xd15e('0x49')])[_0xd15e('0x80')]()['map'](function(_0x4987a2){return _[_0xd15e('0x81')](_0xa2e0aa,['name',_0x4987a2])?_0x4987a2:undefined;})[_0xd15e('0x82')]()[_0xd15e('0x6b')]();if(!_[_0xd15e('0x83')](_0x2c9036)){_0x2c9036[_0xd15e('0x41')](function(_0x38df8a){if(_0x38df8a==='ChatWebsiteId'){_0x5b4589[_0xd15e('0x51')](_0xd15e('0x84'),[]['concat'](_0x291295[_0xd15e('0x49')][_0x38df8a]));}else if(_0x38df8a===_0xd15e('0x85')){var _0x13b4ee=JSON['parse'](_0x291295[_0xd15e('0x49')][_0x38df8a])['$gte'];var _0x20794b=JSON[_0xd15e('0x86')](_0x291295[_0xd15e('0x49')][_0x38df8a])[_0xd15e('0x87')];_0x5b4589[_0xd15e('0x51')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x13b4ee,_0x20794b);}else{if(_0x291295[_0xd15e('0x49')][_0x38df8a]===_0xd15e('0x88')){_0x5b4589[_0xd15e('0x51')]('i.'+_0x38df8a+_0xd15e('0x89'));}else{_0x5b4589['where']('i.'+_0x38df8a+'\x20=\x20?',_0x291295[_0xd15e('0x49')][_0x38df8a]);}}});}if(_0x291295[_0xd15e('0x49')]['read']){if(_0x291295[_0xd15e('0x49')][_0xd15e('0x8a')]==0x1){_0x5b4589[_0xd15e('0x8b')](_0xd15e('0x8c'));}else{_0x5b4589[_0xd15e('0x8b')](_0xd15e('0x8d'));}}if(_0x291295[_0xd15e('0x49')][_0xd15e('0x8e')]){_0x57525a=_[_0xd15e('0x8f')](_0x291295[_0xd15e('0x49')][_0xd15e('0x8e')])?_0x291295['query'][_0xd15e('0x8e')]:new Array(_0x291295[_0xd15e('0x49')][_0xd15e('0x8e')]);_0x57525a[_0xd15e('0x41')](function(_0x220da9){_0x5ee020['or'](_0xd15e('0x79'),'%,'+_0x220da9+',%');});}if(_0x291295[_0xd15e('0x49')]['filter']){var _0x5d5994=_0x291295[_0xd15e('0x49')]['filter']['replace']('\x5c','\x5c\x5c')[_0xd15e('0x90')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5d5994)){_0x49a798['or'](_0xd15e('0x91'),_0x5d5994+'%');}else{_0x49a798['or'](_0xd15e('0x92'),qs[_0xd15e('0x71')](_0x5d5994))['or'](_0xd15e('0x93'),_0x5d5994+'%');}}}_0x5b4589[_0xd15e('0x51')](_0x49a798);_0x5b4589['group'](_0xd15e('0x94'));var _0x18d0d9={'type':db[_0xd15e('0x95')][_0xd15e('0x96')][_0xd15e('0x97')],'raw':!![]};var _0x1986c0=_0x5b4589[_0xd15e('0x98')]();_0x1986c0[_0xd15e('0x54')](_0xd15e('0x94'));_0x1986c0[_0xd15e('0x54')](_0xd15e('0x99'),_0xd15e('0x6a'));if(_0x23e8b2['order']){_0x23e8b2[_0xd15e('0x4f')][_0xd15e('0x41')](function(_0x1111a8){var _0x511e16=_0x1111a8[0x0]===_0xd15e('0x9a')?_0x1111a8[0x0]:'i.'+_0x1111a8[0x0];_0x5b4589[_0xd15e('0x4f')](_0x511e16,_0x1111a8[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x57525a)){_0x5b4589[_0xd15e('0x8b')](_0x5ee020);_0x1986c0[_0xd15e('0x51')](_0xd15e('0x9b'),_0x57525a);}BPromise[_0xd15e('0x9c')]()[_0xd15e('0x22')](function(){if(!_0x167279){if(_0x291295[_0xd15e('0x49')]['ChatWebsiteId'])return;_0x1986c0[_0xd15e('0x51')](_0xd15e('0x9d'));_0x5b4589[_0xd15e('0x51')](_0xd15e('0x9d'));return;}if(_0x291295[_0xd15e('0x9e')][_0xd15e('0x9f')]!==_0xd15e('0xa0'))return;return _0x291295[_0xd15e('0x9e')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xd15e('0x22')](function(_0xf04c88){if(_[_0xd15e('0x83')](_0xf04c88)){_0x1986c0[_0xd15e('0x51')](_0xd15e('0xa1'));_0x5b4589['where']('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1986c0['where'](_0xd15e('0x84'),_[_0xd15e('0x3c')](_0xf04c88,'id'));_0x5b4589[_0xd15e('0x51')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd15e('0x3c')](_0xf04c88,'id'));}});})[_0xd15e('0x22')](function(){if(_0x291295[_0xd15e('0x9e')][_0xd15e('0x9f')]===_0xd15e('0xa0')&&!_0x167279&&!_0x291295['query'][_0xd15e('0xa2')])return[];return db[_0xd15e('0xa3')][_0xd15e('0x49')](_0x1986c0[_0xd15e('0xa4')](),_0x18d0d9);})['then'](function(_0x520f23){_0x5bf839[_0xd15e('0xa5')]=_0x520f23[_0xd15e('0x68')];if(_0x5bf839[_0xd15e('0xa5')]===0x0)return[];return db[_0xd15e('0xa3')][_0xd15e('0x49')](_0x577b13[_0xd15e('0xa4')](),_0x18d0d9)[_0xd15e('0x22')](function(_0x52d7c3){_0x2d07b3=_[_0xd15e('0xa6')](_0x52d7c3,'id');_0x18d0d9=_[_0xd15e('0xa7')](_0x18d0d9,{'model':db[_0xd15e('0xa8')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x291295[_0xd15e('0x49')][_0xd15e('0x4d')]){_0x23e8b2[_0xd15e('0x4c')][_0xd15e('0x41')](function(_0x4d24a0){_0x5b4589[_0xd15e('0x54')]('i.'+_0x4d24a0);});}else{_0x5b4589[_0xd15e('0x54')](_0xd15e('0x99'),_0xd15e('0x6a'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xa9'),_0xd15e('0xaa'));_0x5b4589['field']('a.mandatoryDisposition',_0xd15e('0xab'));_0x5b4589[_0xd15e('0x54')]('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',_0xd15e('0x9a'));_0x5b4589[_0xd15e('0x54')]('i.*');_0x5b4589[_0xd15e('0x54')](_0xd15e('0xac'),'Contact.firstName');_0x5b4589[_0xd15e('0x54')](_0xd15e('0xad'),_0xd15e('0xae'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xaf'),'Contact.email');_0x5b4589['field']('c.phone',_0xd15e('0xb0'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xb1'),_0xd15e('0xb2'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xb3'),_0xd15e('0xb4'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xb5'),_0xd15e('0xb6'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xb7'),_0xd15e('0xb8'));_0x5b4589[_0xd15e('0x54')](_0xd15e('0xb9'),_0xd15e('0x3e'));}if(_0x23e8b2[_0xd15e('0x31')])_0x5b4589[_0xd15e('0x31')](_0x23e8b2[_0xd15e('0x31')]);if(_0x23e8b2['offset'])_0x5b4589['offset'](_0x23e8b2['offset']);return db[_0xd15e('0xa3')][_0xd15e('0x49')](_0x5b4589['toString'](),_0x18d0d9);})[_0xd15e('0x22')](function(_0x14c3d7){_0x309d6b[_0xd15e('0x51')](_0xd15e('0xba'),_[_0xd15e('0x3c')](_0x14c3d7,'id'));return db[_0xd15e('0xa3')][_0xd15e('0x49')](_0x309d6b[_0xd15e('0xa4')](),_0x18d0d9)[_0xd15e('0x22')](function(_0xda1488){var _0x549125=_[_0xd15e('0xbb')](_0xda1488,_0xd15e('0xbc'));var _0x3dd84d=[];_0x14c3d7[_0xd15e('0x41')](function(_0x2a823e){_0x3dd84d[_0xd15e('0x42')](updateChatInteraction(_0x2a823e,_0x2d07b3,_0x549125));});return BPromise[_0xd15e('0xbd')](_0x3dd84d);});});})[_0xd15e('0x22')](function(_0x1fd9e0){_0x5bf839['rows']=_0x1fd9e0;return _0x5bf839;})[_0xd15e('0x22')](respondWithFilteredResult(_0x6288ef,_0x23e8b2))[_0xd15e('0x43')](handleError(_0x6288ef,null));};exports[_0xd15e('0xbe')]=function(_0x16a09f,_0x3c5fe4){var _0x4004a5={'raw':![],'where':{'id':_0x16a09f[_0xd15e('0xbf')]['id']}},_0x274a4c={};_0x274a4c[_0xd15e('0x48')]=_[_0xd15e('0x80')](db[_0xd15e('0xa8')][_0xd15e('0x45')]);_0x274a4c[_0xd15e('0x49')]=_[_0xd15e('0x80')](_0x16a09f['query']);_0x274a4c[_0xd15e('0x4a')]=_[_0xd15e('0x4b')](_0x274a4c['model'],_0x274a4c[_0xd15e('0x49')]);_0x4004a5['attributes']=_[_0xd15e('0x4b')](_0x274a4c['model'],qs[_0xd15e('0x4d')](_0x16a09f[_0xd15e('0x49')][_0xd15e('0x4d')]));_0x4004a5[_0xd15e('0x4c')]=_0x4004a5[_0xd15e('0x4c')]['length']?_0x4004a5['attributes']:_0x274a4c[_0xd15e('0x48')];if(_0x16a09f[_0xd15e('0x49')][_0xd15e('0xc0')]){_0x4004a5[_0xd15e('0xc1')]=[{'all':!![]}];}_0x4004a5=_[_0xd15e('0xa7')]({},_0x4004a5,_0x16a09f[_0xd15e('0xc2')]);return db[_0xd15e('0xa8')][_0xd15e('0x72')](_0x4004a5)[_0xd15e('0x22')](handleEntityNotFound(_0x3c5fe4,null))[_0xd15e('0x22')](respondWithResult(_0x3c5fe4,null))[_0xd15e('0x43')](handleError(_0x3c5fe4,null));};exports[_0xd15e('0xc3')]=function(_0x497abf,_0x5b316e){return db[_0xd15e('0xa8')][_0xd15e('0xc3')](_0x497abf[_0xd15e('0x7f')],{})[_0xd15e('0x22')](respondWithResult(_0x5b316e,0xc9))['catch'](handleError(_0x5b316e,null));};exports[_0xd15e('0x37')]=function(_0x16cfef,_0x252670){if(_0x16cfef[_0xd15e('0x7f')]['id']){delete _0x16cfef[_0xd15e('0x7f')]['id'];}return db[_0xd15e('0xa8')][_0xd15e('0x72')]({'where':{'id':_0x16cfef['params']['id']}})['then'](handleEntityNotFound(_0x252670,null))[_0xd15e('0x22')](saveUpdates(_0x16cfef[_0xd15e('0x7f')],null))[_0xd15e('0x22')](respondWithResult(_0x252670,null))[_0xd15e('0x43')](handleError(_0x252670,null));};exports[_0xd15e('0xc4')]=function(_0x578847,_0x12cd21){return db[_0xd15e('0xa8')]['find']({'where':{'id':_0x578847[_0xd15e('0xbf')]['id']}})[_0xd15e('0x22')](handleEntityNotFound(_0x12cd21,null))[_0xd15e('0x22')](removeEntity(_0x12cd21,null))[_0xd15e('0x43')](handleError(_0x12cd21,null));};exports[_0xd15e('0xc5')]=function(_0x274ff3,_0x39f9ab){return db[_0xd15e('0xa8')]['describe']()[_0xd15e('0x22')](respondWithResult(_0x39f9ab,null))[_0xd15e('0x43')](handleError(_0x39f9ab,null));};exports[_0xd15e('0xc6')]=function(_0x261426,_0x4cac8e){var _0x909c91=_0x261426[_0xd15e('0xbf')]['id'];var _0x5701eb;var _0x2f6709;var _0x3a0a72;return db[_0xd15e('0xa8')]['findOne']({'where':{'id':_0x909c91}})['then'](function(_0x558ab4){_0x5701eb=_0x558ab4;return db[_0xd15e('0xc7')][_0xd15e('0xc8')]({'where':{'id':_0x558ab4[_0xd15e('0xa2')]},'attributes':['id',_0xd15e('0xc9'),'vidaooEscalation'],'raw':!![]});})[_0xd15e('0x22')](function(_0x1f566b){if(_0x1f566b&&_0x1f566b[_0xd15e('0xc9')]&&_0x1f566b[_0xd15e('0xca')]){_0x2f6709=_0x1f566b;var _0xdeb2d7={'rejectUnauthorized':![],'method':_0xd15e('0xcb'),'uri':'https://api-vidaoo.xcally.com/api/v1/sessions','headers':{'X-APIKEY':_0x1f566b[_0xd15e('0xc9')]},'body':{'name':_0xd15e('0xcc')+_0x909c91},'redirect':_0xd15e('0xcd'),'json':!![]};return rp(_0xdeb2d7);}else{throw new db['Sequelize'][(_0xd15e('0xce'))](_0xd15e('0xcf'));}})['then'](function(_0x4b775c){_0x3a0a72=_0x4b775c;if(_0x3a0a72['id']){var _0x2822dc={'body':_0x3a0a72['join_url'],'ChatWebsiteId':_0x2f6709['id'],'ChatInteractionId':_0x5701eb['id'],'direction':'out','UserId':_0x261426[_0xd15e('0x9e')]['id']};return db[_0xd15e('0xd0')]['create'](_0x2822dc,{});}else{throw new db[(_0xd15e('0x95'))][(_0xd15e('0xce'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd15e('0x22')](function(){return _0x5701eb['updateAttributes']({'vidaooSessionId':_0x3a0a72['id']});})[_0xd15e('0x22')](respondWithResult(_0x4cac8e,null))[_0xd15e('0x43')](handleError(_0x4cac8e,null));};exports[_0xd15e('0xd1')]=function(_0x55749c,_0x19cadf){if(_0x55749c[_0xd15e('0x7f')]['id']){delete _0x55749c[_0xd15e('0x7f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x55749c[_0xd15e('0xbf')]['id']}})[_0xd15e('0x22')](handleEntityNotFound(_0x19cadf,null))[_0xd15e('0x22')](saveUpdates(_0x55749c['body'],null))[_0xd15e('0x22')](respondWithResult(_0x19cadf,null))[_0xd15e('0x43')](handleError(_0x19cadf,null));};exports[_0xd15e('0xd2')]=function(_0x255b9c,_0x581554,_0x3cdce2){if(_0x255b9c[_0xd15e('0x7f')]['id']){delete _0x255b9c['body']['id'];}return db[_0xd15e('0xa8')]['find']({'where':{'id':_0x255b9c[_0xd15e('0xbf')]['id']}})[_0xd15e('0x22')](function(_0x79b47b){if(!_0x79b47b){logger[_0xd15e('0x27')](_0xd15e('0xd3'),_0xd15e('0xd2'),0x194,_0xd15e('0xd4'));_0x581554[_0xd15e('0x2c')](0x194);}else{if(_0x79b47b[_0xd15e('0x7e')]){throw new db['Sequelize'][(_0xd15e('0xce'))]('Interaction\x20already\x20assigned');}}return _0x79b47b;})[_0xd15e('0x22')](function(_0x2d67c5){if(_0x2d67c5){return _0x2d67c5[_0xd15e('0x37')]({'closed':_0x255b9c[_0xd15e('0x7f')][_0xd15e('0xd5')],'disposition':_0x255b9c[_0xd15e('0x7f')]['disposition']})[_0xd15e('0x22')](function(_0x1c1fa5){return _0x1c1fa5;});}})[_0xd15e('0x22')](function(_0x17aabf){return respondWithRpcPromise('AbandonInteraction','abandon',_0x255b9c['body'],client9004);})[_0xd15e('0x22')](respondWithResult(_0x581554,null))[_0xd15e('0x43')](handleError(_0x581554,null));};exports['attachmentUpload']=function(_0xfac210,_0x21bbbe,_0x27475b){_0xfac210['body'][_0xd15e('0x39')]=_0xfac210[_0xd15e('0xd6')][_0xd15e('0xd7')];_0xfac210[_0xd15e('0x7f')][_0xd15e('0xd8')]=_0xfac210[_0xd15e('0xd6')][_0xd15e('0xd9')];_0xfac210['body'][_0xd15e('0x75')]=_0xfac210[_0xd15e('0xd6')][_0xd15e('0xda')];return db['Attachment'][_0xd15e('0xc3')](_0xfac210[_0xd15e('0x7f')])[_0xd15e('0x22')](respondWithResult(_0x21bbbe,0xc9))['catch'](handleError(_0x21bbbe,null));};exports[_0xd15e('0xdb')]=function(_0x14ebd0,_0x3d7449,_0x878eb3){return db[_0xd15e('0xa8')][_0xd15e('0xc8')]({'where':{'id':_0x14ebd0['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3d7449,null))[_0xd15e('0x22')](function(_0x438339){if(_0x438339){if(_0x438339[_0xd15e('0xd5')]){return _0x3d7449[_0xd15e('0x2d')](0x193)[_0xd15e('0x2f')]({'status':0x193,'message':_0xd15e('0xdc')});}return db['Attachment']['findOne']({'where':{'id':_0x14ebd0['query'][_0xd15e('0xdd')]},'raw':!![]})['then'](handleEntityNotFound(_0x3d7449,null));}})[_0xd15e('0x22')](function(_0x276041){if(_0x276041){return _0x3d7449['download'](path[_0xd15e('0xde')](config['root'],'server/files/attachments/',_0x276041[_0xd15e('0xd8')]));}})['catch'](handleError(_0x3d7449,null));};exports[_0xd15e('0xdf')]=function(_0x11b683,_0xf696f1){var _0x211ae9=null;var _0x1d3b89=null;var _0x1d8eda=null;var _0xaef4fd=null;if(_0x11b683['body']['id']){delete _0x11b683['body']['id'];}if(_0x11b683[_0xd15e('0x7f')][_0xd15e('0xe0')]){_0xaef4fd=path[_0xd15e('0xde')](config['root'],_0xd15e('0xe1'),util[_0xd15e('0xe2')](_0xd15e('0xe3'),Date[_0xd15e('0xe4')]()));_0x11b683[_0xd15e('0x7f')][_0xd15e('0xe5')]=_0xaef4fd;}return db['ChatInteraction'][_0xd15e('0x72')]({'where':{'id':_0x11b683[_0xd15e('0xbf')]['id']},'include':[{'model':db[_0xd15e('0xd0')],'as':_0xd15e('0xe6'),'include':[{'model':db['User'],'as':_0xd15e('0x7b')}]}]})[_0xd15e('0x22')](handleEntityNotFound(_0xf696f1,null))[_0xd15e('0x22')](saveUpdates(_0x11b683[_0xd15e('0x7f')],null))[_0xd15e('0x22')](function(_0x137869){if(_0x137869){_0x211ae9=_0x137869;return db[_0xd15e('0xc7')]['find']({'where':{'id':_0x211ae9['ChatWebsiteId']}});}})[_0xd15e('0x22')](function(_0x2e73ab){if(_0x2e73ab){_0x1d8eda=_0x2e73ab;return db[_0xd15e('0xe7')]['find']({'where':{'id':_0x211ae9[_0xd15e('0x73')]}});}})[_0xd15e('0x22')](function(_0x986be4){if(_0x986be4){_0x1d3b89=_0x986be4;if(_0xaef4fd){var _0x5292dc=null;for(var _0x5f007b=0x1;_0x5f007b<_0x211ae9['Messages']['length'];++_0x5f007b){_0x5292dc=_0x211ae9['Messages'][_0x5f007b];var _0x7de89c=_0x5292dc['UserId']?util[_0xd15e('0xe2')](_0xd15e('0xe8'),_0x1d8eda[_0xd15e('0xe9')],_0x5292dc[_0xd15e('0x7e')]):_0xd15e('0xea');var _0x6399b9=_0x11b683[_0xd15e('0x7f')][_0xd15e('0xeb')]||util[_0xd15e('0xe2')](_0xd15e('0xe8'),_0xd15e('0xec'),_0x5292dc[_0xd15e('0x73')]);switch(_0x1d8eda[_0xd15e('0xed')]){case'website_alias':_0x7de89c=_0x5292dc[_0xd15e('0x7e')]?util[_0xd15e('0xe2')]('%s%d',_0x1d8eda[_0xd15e('0xe9')],_0x5292dc[_0xd15e('0x7e')]):_0xd15e('0xea');break;case _0xd15e('0xee'):_0x7de89c=_0x5292dc[_0xd15e('0x7e')]?_0x5292dc['User'][_0xd15e('0xef')]||_0x5292dc[_0xd15e('0x7b')][_0xd15e('0x3d')]:'System';break;case'agent_fullname':_0x7de89c=_0x5292dc[_0xd15e('0x7e')]?_0x5292dc[_0xd15e('0x7b')][_0xd15e('0x3d')]:_0xd15e('0xea');break;default:_0x7de89c=_0x5292dc['UserId']?util[_0xd15e('0xe2')]('%s%d',_0x1d8eda[_0xd15e('0xe9')],_0x5292dc['UserId']):_0xd15e('0xea');}var _0xcf0d6f=util[_0xd15e('0xe2')](_0xd15e('0xf0'),moment(_0x5292dc[_0xd15e('0x85')])[_0xd15e('0xe2')](_0xd15e('0xf1')),_0x5292dc[_0xd15e('0xf2')]==='in'?_0x6399b9:_0x7de89c,_0x5292dc[_0xd15e('0x7f')]);if(!_0x5292dc[_0xd15e('0xf3')]){fs[_0xd15e('0xf4')](_0xaef4fd,_0xcf0d6f);}}return db['MailAccount'][_0xd15e('0xc8')]({'where':{'service':!![]},'include':[{'model':db[_0xd15e('0xf5')],'as':_0xd15e('0xf6'),'raw':!![]}]});}}})[_0xd15e('0x22')](function(_0xc66b28){if(_0xc66b28&&_0xc66b28['Smtp']&&_0x11b683[_0xd15e('0x7f')]){var _0x2c5f08={'tls':{'rejectUnauthorized':![]}};if(_0xc66b28['Smtp']['service']){_0x2c5f08[_0xd15e('0xf7')]=_0xc66b28[_0xd15e('0xf6')][_0xd15e('0xf7')];}else{_0x2c5f08[_0xd15e('0xf8')]=_0xc66b28[_0xd15e('0xf6')][_0xd15e('0xf8')];_0x2c5f08[_0xd15e('0xf9')]=_0xc66b28['Smtp']['port'];_0x2c5f08['secure']=_0xc66b28['Smtp'][_0xd15e('0xfa')];}if(_0xc66b28['Smtp'][_0xd15e('0xfb')]){_0x2c5f08[_0xd15e('0xfc')]={'user':_0xc66b28['Smtp'][_0xd15e('0x9e')],'pass':_0xc66b28[_0xd15e('0xf6')][_0xd15e('0xfd')]};}return respondWithRpcPromise('SendMail',_0xd15e('0xfe'),{'account':_0x2c5f08,'message':{'from':util[_0xd15e('0xe2')](_0xd15e('0xff'),_0xc66b28['name'],_0xc66b28[_0xd15e('0x100')]||_0xc66b28[_0xd15e('0xf6')]['user']),'to':_0x11b683[_0xd15e('0x7f')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0xd15e('0xe2')](_0xd15e('0x101'),_0x11b683[_0xd15e('0x7f')][_0xd15e('0xe0')]),'attachments':[{'path':_0xaef4fd}]}})[_0xd15e('0x22')](function(){return _0x211ae9;})['catch'](function(_0x288534){console['error'](_0x288534);});}else{return _0x211ae9;}})[_0xd15e('0x22')](respondWithStatusCode(_0xf696f1,0xc8))['catch'](handleError(_0xf696f1,null));};exports[_0xd15e('0x102')]=function(_0x1ab44e,_0x3b9bfe,_0x5effb8){return db[_0xd15e('0xd0')][_0xd15e('0x72')]({'where':{'id':_0x1ab44e[_0xd15e('0xbf')]['id']}})['then'](handleEntityNotFound(_0x3b9bfe,null))[_0xd15e('0x22')](function(_0x35f8cc){if(_0x35f8cc){return _0x35f8cc[_0xd15e('0x102')](_0x1ab44e[_0xd15e('0x7f')]['ids'],_[_0xd15e('0x103')](_0x1ab44e[_0xd15e('0x7f')],[_0xd15e('0x104'),'id'])||{});}})[_0xd15e('0x22')](respondWithResult(_0x3b9bfe,null))['catch'](handleError(_0x3b9bfe,null));};exports[_0xd15e('0x105')]=function(_0x3da1a8,_0x5e1db4,_0x3637b1){var _0x21f20a={'raw':![],'where':{}};var _0x5f5285={};var _0x2f49aa={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xd15e('0xc8')]({'where':{'id':_0x3da1a8['params']['id']}})[_0xd15e('0x22')](handleEntityNotFound(_0x5e1db4,null))[_0xd15e('0x22')](function(_0x123994){if(_0x123994){_0x5f5285[_0xd15e('0x48')]=_[_0xd15e('0x80')](db[_0xd15e('0xd0')][_0xd15e('0x45')]);_0x5f5285[_0xd15e('0x49')]=_[_0xd15e('0x80')](_0x3da1a8[_0xd15e('0x49')]);_0x5f5285['filters']=_[_0xd15e('0x4b')](_0x5f5285['model'],_0x5f5285['query']);_0x21f20a[_0xd15e('0x4c')]=_[_0xd15e('0x4b')](_0x5f5285[_0xd15e('0x48')],qs['fields'](_0x3da1a8[_0xd15e('0x49')]['fields']));_0x21f20a[_0xd15e('0x4c')]=_0x21f20a[_0xd15e('0x4c')]['length']?_0x21f20a['attributes']:_0x5f5285[_0xd15e('0x48')];if(!_0x3da1a8[_0xd15e('0x49')][_0xd15e('0x4e')](_0xd15e('0x106'))){_0x21f20a['limit']=qs[_0xd15e('0x31')](_0x3da1a8[_0xd15e('0x49')][_0xd15e('0x31')]);_0x21f20a[_0xd15e('0x30')]=qs[_0xd15e('0x30')](_0x3da1a8[_0xd15e('0x49')][_0xd15e('0x30')]);}_0x21f20a['order']=qs[_0xd15e('0x50')](_0x3da1a8[_0xd15e('0x49')]['sort']);_0x21f20a[_0xd15e('0x51')]=qs[_0xd15e('0x4a')](_['pick'](_0x3da1a8[_0xd15e('0x49')],_0x5f5285['filters']));_0x21f20a[_0xd15e('0x51')][_0xd15e('0xbc')]=_0x123994['id'];if(_0x3da1a8[_0xd15e('0x49')][_0xd15e('0x107')]){_0x21f20a[_0xd15e('0x51')]=_[_0xd15e('0xa7')](_0x21f20a[_0xd15e('0x51')],{'$or':_[_0xd15e('0x3c')](_0x21f20a[_0xd15e('0x4c')],function(_0x2c435e){var _0x50c81e={};_0x50c81e[_0x2c435e]={'$like':'%'+_0x3da1a8['query']['filter']+'%'};return _0x50c81e;})});}if(_0x3da1a8[_0xd15e('0x49')][_0xd15e('0x108')]){var _0x441e5d=_0x3da1a8['query'][_0xd15e('0x108')][_0xd15e('0x40')](',');var _0x227cbc={};_0x227cbc[_0x441e5d[0x0]]={'$gte':moment(_0x441e5d[0x1])[_0xd15e('0xe2')](_0xd15e('0x109'))};_0x21f20a['where']=_[_0xd15e('0xa7')](_0x21f20a[_0xd15e('0x51')],_0x227cbc);}_0x21f20a=_[_0xd15e('0xa7')]({},_0x21f20a,_0x3da1a8[_0xd15e('0xc2')]);return db['ChatMessage'][_0xd15e('0xa5')]({'where':_0x21f20a[_0xd15e('0x51')]})['then'](function(_0x34bbbf){_0x2f49aa['count']=_0x34bbbf;if(_0x3da1a8[_0xd15e('0x49')][_0xd15e('0xc0')]){_0x21f20a[_0xd15e('0xc1')]=[{'all':!![]}];}return db['ChatMessage'][_0xd15e('0x10a')](_0x21f20a);})[_0xd15e('0x22')](function(_0x1b4bfa){_0x2f49aa[_0xd15e('0x10b')]=_0x1b4bfa;return _0x2f49aa;});}})[_0xd15e('0x22')](respondWithFilteredResult(_0x5e1db4,_0x21f20a))[_0xd15e('0x43')](handleError(_0x5e1db4,null));};exports['getMyMessages']=function(_0x15dbd4,_0x6f850a,_0x5a33ab){var _0x437569={'where':{}},_0x23e6fe={},_0x6e6f50={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xd15e('0xc8')]({'where':{'id':_0x15dbd4[_0xd15e('0xbf')]['id']}})[_0xd15e('0x22')](handleEntityNotFound(_0x6f850a,null))[_0xd15e('0x22')](function(_0x3ba38b){if(_0x3ba38b){_0x23e6fe[_0xd15e('0x48')]=_[_0xd15e('0x80')](db[_0xd15e('0xd0')][_0xd15e('0x45')]);_0x23e6fe[_0xd15e('0x49')]=_[_0xd15e('0x80')](_0x15dbd4[_0xd15e('0x49')]);_0x23e6fe[_0xd15e('0x4a')]=_['intersection'](_0x23e6fe['model'],_0x23e6fe[_0xd15e('0x49')]);_0x437569[_0xd15e('0x4c')]=_['intersection'](_0x23e6fe[_0xd15e('0x48')],qs[_0xd15e('0x4d')](_0x15dbd4[_0xd15e('0x49')][_0xd15e('0x4d')]));_0x437569[_0xd15e('0x4c')]=_0x437569[_0xd15e('0x4c')]['length']?_0x437569['attributes']:_0x23e6fe[_0xd15e('0x48')];if(!_0x15dbd4['query'][_0xd15e('0x4e')](_0xd15e('0x106'))){_0x437569[_0xd15e('0x31')]=qs['limit'](_0x15dbd4[_0xd15e('0x49')][_0xd15e('0x31')]);_0x437569[_0xd15e('0x30')]=qs['offset'](_0x15dbd4['query'][_0xd15e('0x30')]);}_0x437569[_0xd15e('0x4f')]=qs['sort'](_0x15dbd4['query'][_0xd15e('0x50')]);_0x437569[_0xd15e('0x51')]=qs[_0xd15e('0x4a')](_[_0xd15e('0x52')](_0x15dbd4[_0xd15e('0x49')],_0x23e6fe[_0xd15e('0x4a')]));_0x437569[_0xd15e('0x51')][_0xd15e('0xbc')]=_0x3ba38b['id'];if(_0x15dbd4[_0xd15e('0x49')][_0xd15e('0x107')]){_0x437569[_0xd15e('0x51')]=_[_0xd15e('0xa7')](_0x437569[_0xd15e('0x51')],{'$or':_['map'](_0x437569[_0xd15e('0x4c')],function(_0xe97755){var _0x29c6ea={};_0x29c6ea[_0xe97755]={'$like':'%'+_0x15dbd4[_0xd15e('0x49')]['filter']+'%'};return _0x29c6ea;})});}_0x437569[_0xd15e('0x51')][_0xd15e('0xf3')]=![];if(_0x15dbd4[_0xd15e('0x49')]['id']){_0x437569[_0xd15e('0x51')]['id']={'$gt':_0x15dbd4['query']['id']};}_0x437569=_[_0xd15e('0xa7')]({},_0x437569,_0x15dbd4['options']);return db['ChatMessage']['count']({'where':_0x437569[_0xd15e('0x51')]})[_0xd15e('0x22')](function(_0x46aeb6){_0x6e6f50[_0xd15e('0xa5')]=_0x46aeb6;_0x437569['include']=[];if(_0x15dbd4[_0xd15e('0x49')][_0xd15e('0x10c')]){_0x437569[_0xd15e('0xc1')][_0xd15e('0x42')]({'model':db[_0xd15e('0x7b')],'as':_0xd15e('0x7b'),'attributes':['id',_0xd15e('0x3d'),_0xd15e('0xef')]});}if(_0x15dbd4[_0xd15e('0x49')]['includeAll']){_0x437569['include']=[{'all':!![]}];}return db[_0xd15e('0xd0')]['findAll'](_0x437569);})[_0xd15e('0x22')](function(_0x3a30ef){_0x6e6f50[_0xd15e('0x10b')]=_0x3a30ef;return _0x6e6f50;});}})[_0xd15e('0x22')](respondWithFilteredResult(_0x6f850a,_0x437569))[_0xd15e('0x43')](handleError(_0x6f850a,null));};exports[_0xd15e('0x10d')]=function(_0x175cd5,_0xcf8cec,_0x2f623f){return db[_0xd15e('0xa8')]['find']({'where':{'id':_0x175cd5[_0xd15e('0xbf')]['id']}})['then'](handleEntityNotFound(_0xcf8cec,null))[_0xd15e('0x22')](function(_0x758d26){if(_0x758d26){return _0x758d26[_0xd15e('0x10e')](_0x175cd5[_0xd15e('0x7f')][_0xd15e('0x104')],_[_0xd15e('0x103')](_0x175cd5[_0xd15e('0x7f')],[_0xd15e('0x104'),'id'])||{})['spread'](function(){return db[_0xd15e('0x78')][_0xd15e('0x10a')]({'attributes':['id',_0xd15e('0x39'),_0xd15e('0x55')],'where':{'id':_0x175cd5[_0xd15e('0x7f')]['ids']}});})[_0xd15e('0x22')](function(_0x5c7ada){socket[_0xd15e('0x10f')](_0xd15e('0x110'),{'id':Number(_0x175cd5[_0xd15e('0xbf')]['id']),'tags':_0x5c7ada||[]});return{'id':Number(_0x175cd5['params']['id']),'tags':_0x5c7ada||[]};});}})[_0xd15e('0x22')](respondWithResult(_0xcf8cec,null))[_0xd15e('0x43')](handleError(_0xcf8cec,null));};exports[_0xd15e('0x111')]=function(_0x5aedf9,_0x423b1e,_0x47b155){return db[_0xd15e('0xa8')]['find']({'where':{'id':_0x5aedf9['params']['id']}})[_0xd15e('0x22')](handleEntityNotFound(_0x423b1e,null))[_0xd15e('0x22')](function(_0x1036d1){if(_0x1036d1){return _0x1036d1[_0xd15e('0x111')](_0x5aedf9[_0xd15e('0x49')][_0xd15e('0x104')]);}})[_0xd15e('0x22')](respondWithStatusCode(_0x423b1e,null))[_0xd15e('0x43')](handleError(_0x423b1e,null));};exports[_0xd15e('0x112')]=function(_0x2f5a22,_0x1e06eb){var _0x227981=moment()['unix']()[_0xd15e('0xa4')]();var _0x49a2b4=path[_0xd15e('0xde')](config[_0xd15e('0x113')],'server',_0xd15e('0x114'),_0xd15e('0x115'));var _0x2ae3e2=path[_0xd15e('0xde')](config[_0xd15e('0x113')],_0xd15e('0x116'),_0xd15e('0x114'),'attachments');var _0x1d148e=path['join'](_0x49a2b4,_0x227981);var _0xc727a7=util['format'](_0xd15e('0x117'),_0x2f5a22[_0xd15e('0xbf')]['id'],_0x227981);var _0x304f13=path[_0xd15e('0xde')](_0x49a2b4,_0xc727a7);var _0x2c76b6=[];_0x2c76b6[_0xd15e('0x42')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2c76b6[_0xd15e('0x42')]({'model':db[_0xd15e('0xe7')],'as':_0xd15e('0x6e'),'attributes':['id',_0xd15e('0x118'),_0xd15e('0x119')],'raw':!![]});if(_0x2f5a22['query'][_0xd15e('0x11a')]){_0x2c76b6[_0xd15e('0x42')]({'model':db[_0xd15e('0x11b')],'as':_0xd15e('0x11b'),'raw':!![]});}var _0x257d57=[{'model':db[_0xd15e('0xd0')],'as':'Messages','attributes':['id',_0xd15e('0x7f'),_0xd15e('0x85'),_0xd15e('0xf2'),_0xd15e('0xf3'),_0xd15e('0x8a')],'include':_0x2c76b6}];_0x257d57[_0xd15e('0x42')]({'model':db[_0xd15e('0xc7')],'as':'Account','attributes':['id',_0xd15e('0x39')]});_0x257d57['push']({'model':db[_0xd15e('0x7b')],'as':'Owner','attributes':['id',_0xd15e('0x3d')]});return db[_0xd15e('0xa8')][_0xd15e('0x72')]({'where':{'id':_0x2f5a22[_0xd15e('0xbf')]['id']},'include':_0x257d57})[_0xd15e('0x22')](handleEntityNotFound(_0x1e06eb,null))['then'](function(_0x5c048f){if(_0x5c048f){var _0x3c3a93=_0x5c048f[_0xd15e('0x11c')]({'plain':!![]});fs[_0xd15e('0x11d')](_0x1d148e);var _0x46eae2={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0xd15e('0x11e')}},'footer':{'height':_0xd15e('0x11f'),'contents':{'default':util[_0xd15e('0xe2')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format'](_0xd15e('0x120'),_0xd15e('0x121'),_0x3c3a93['id']),moment()[_0xd15e('0xe2')](_0xd15e('0x122'))['toString']())}}};var _0x3b7977={'channel':_0xd15e('0x121'),'account':_0x3c3a93[_0xd15e('0x123')][_0xd15e('0x39')],'agent':_0x3c3a93['Owner']?_0x3c3a93[_0xd15e('0x124')][_0xd15e('0x3d')]:'N.A.','createdAt':moment(_0x3c3a93[_0xd15e('0x85')])[_0xd15e('0xe2')](_0xd15e('0x109'))[_0xd15e('0xa4')](),'closedAt':_0x3c3a93[_0xd15e('0xd5')]?moment(_0x3c3a93[_0xd15e('0x125')])[_0xd15e('0xe2')](_0xd15e('0x109'))[_0xd15e('0xa4')]():'','disposition':_0x3c3a93[_0xd15e('0x126')],'chatInfo':{'browser':_0x3c3a93[_0xd15e('0x127')],'os':_0x3c3a93[_0xd15e('0x128')],'referer':_0x3c3a93[_0xd15e('0x129')],'customerIp':_0x3c3a93[_0xd15e('0x12a')],'customerPort':_0x3c3a93[_0xd15e('0x12b')]?_0x3c3a93[_0xd15e('0x12b')]:_0xd15e('0x12c')},'messages':_(_0x3c3a93[_0xd15e('0xe6')])['tail']()[_0xd15e('0x107')]({'secret':![]})[_0xd15e('0x3c')](function(_0x59f2b0){if(_0x59f2b0[_0xd15e('0x11b')]){var _0x330fa9=path[_0xd15e('0xde')](_0x2ae3e2,_0x59f2b0[_0xd15e('0x11b')]['basename']);if(fs[_0xd15e('0x12d')](_0x330fa9)){fs[_0xd15e('0x12e')](_0x330fa9)[_0xd15e('0x12f')](fs[_0xd15e('0x130')](path[_0xd15e('0xde')](_0x1d148e,_0x59f2b0[_0xd15e('0x11b')][_0xd15e('0xd8')])));}}return{'date':moment(_0x59f2b0[_0xd15e('0x85')])[_0xd15e('0xe2')](_0xd15e('0x109'))[_0xd15e('0xa4')](),'sender':_0x59f2b0[_0xd15e('0xf2')]===_0xd15e('0x131')?_0x59f2b0[_0xd15e('0x7b')]?_0x59f2b0[_0xd15e('0x7b')][_0xd15e('0x3d')]:'System':_0x59f2b0[_0xd15e('0x6e')][_0xd15e('0x118')]+(_0x59f2b0['Contact'][_0xd15e('0x119')]?'\x20'+_0x59f2b0['Contact'][_0xd15e('0x119')]:''),'body':_0x59f2b0['Attachment']?_0x59f2b0[_0xd15e('0x11b')][_0xd15e('0xd8')]:_0x59f2b0[_0xd15e('0x7f')],'direction':_0x59f2b0[_0xd15e('0xf2')]==='out'?'A':'C','secret':_0x59f2b0[_0xd15e('0xf3')],'read':_0x59f2b0['read'],'attachment':_0x59f2b0[_0xd15e('0x11b')]};})[_0xd15e('0x6b')]()};return ejs[_0xd15e('0x132')](path['join'](config[_0xd15e('0x113')],_0xd15e('0x116'),'views',_0xd15e('0x133')),{'interaction':_0x3b7977})[_0xd15e('0x22')](function(_0x540d37){return new BPromise(function(_0x4d0a97,_0xcadcdc){pdf[_0xd15e('0xc3')](_0x540d37,_0x46eae2)[_0xd15e('0x134')](path['join'](_0x1d148e,'transcript-'+_0x3c3a93['id']+'-'+_0x227981+_0xd15e('0x135')),function(_0x3a14d9,_0x5e822e){if(_0x3a14d9)return _0xcadcdc(_0x3a14d9);_0x4d0a97(_0x5e822e);});});})[_0xd15e('0x22')](function(){return new BPromise(function(_0x8e8e01,_0x2ee55a){zipdir(_0x1d148e,{'saveTo':_0x304f13},function(_0x4e1674,_0x1ef4f0){if(_0x4e1674)return _0x2ee55a(_0x4e1674);return _0x8e8e01(_0x1ef4f0);});})['then'](function(){return new BPromise(function(_0x460432,_0x194181){rimraf(_0x1d148e,function(_0x4989f2){if(_0x4989f2)_0x194181(_0x4989f2);return _0x460432();});});})[_0xd15e('0x22')](function(){return _0x1e06eb[_0xd15e('0x112')](_0x304f13,_0xc727a7,function(_0x448f77){if(_0x448f77){console['log']('err',_0x448f77);}else{fs[_0xd15e('0x136')](_0x304f13);}});});});}else{return _0x1e06eb[_0xd15e('0x2c')](0xc8);}})[_0xd15e('0x43')](handleError(_0x1e06eb,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 562a10c..cb17132 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 _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 +var _0x9c4b=['setDataValue','findAll','then','length','emit','catch','hook','exports','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','update','remove'];(function(_0x8691b4,_0x30e0e2){var _0x281c7d=function(_0x3b613b){while(--_0x3b613b){_0x8691b4['push'](_0x8691b4['shift']());}};_0x281c7d(++_0x30e0e2);}(_0x9c4b,0x14a));var _0xb9c4=function(_0x575d4d,_0x127e72){_0x575d4d=_0x575d4d-0x0;var _0x3fac37=_0x9c4b[_0x575d4d];return _0x3fac37;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xb9c4('0x0')];var ChatMessage=require(_0xb9c4('0x1'))['db'][_0xb9c4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb9c4('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb9c4('0x4'),'afterDestroy':_0xb9c4('0x5')};function emitEvent(_0xa8811a){return function(_0x228553,_0x1f8c2,_0x2433e6){_0x228553['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x30718e){_0x228553[_0xb9c4('0x6')]('Users',_0x30718e['map'](function(_0x54d2ec){return{'id':_0x54d2ec['id']};}));return ChatMessage[_0xb9c4('0x7')]({'where':{'ChatInteractionId':_0x228553['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb9c4('0x8')](function(_0x3a8eb3){_0x228553[_0xb9c4('0x6')]('unreadMessages',_0x3a8eb3[_0xb9c4('0x9')]);ChatInteractionEvents['emit'](_0xa8811a+':'+_0x228553['id'],_0x228553);ChatInteractionEvents[_0xb9c4('0xa')](_0xa8811a,_0x228553);_0x2433e6(null);})[_0xb9c4('0xb')](_0x2433e6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0xb9c4('0xc')](e,emitEvent(event));}}module[_0xb9c4('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 5cf923c..d43b89a 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 _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 +var _0x7c87=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','format'];(function(_0x241114,_0x37c17d){var _0xa01a07=function(_0x217ec0){while(--_0x217ec0){_0x241114['push'](_0x241114['shift']());}};_0xa01a07(++_0x37c17d);}(_0x7c87,0x1c5));var _0x77c8=function(_0x5debee,_0xb99330){_0x5debee=_0x5debee-0x0;var _0x8cad29=_0x7c87[_0x5debee];return _0x8cad29;};'use strict';var _=require('lodash');var util=require(_0x77c8('0x0'));var logger=require(_0x77c8('0x1'))(_0x77c8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x77c8('0x3'));var rimraf=require(_0x77c8('0x4'));var config=require('../../config/environment');var attributes=require(_0x77c8('0x5'));module[_0x77c8('0x6')]=function(_0x39046b,_0x19b609){return _0x39046b[_0x77c8('0x7')](_0x77c8('0x8'),attributes,{'tableName':_0x77c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8c0c0a,_0x51ab74,_0x284866){if(_0x8c0c0a['changed'](_0x77c8('0xa'))){_0x8c0c0a['closedAt']=moment()[_0x77c8('0xb')](_0x77c8('0xc'));}_0x284866(null,_0x8c0c0a);}},'charset':_0x77c8('0xd'),'collate':_0x77c8('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 341dcb6..dfb7ead 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 _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 +var _0xb38c=['catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','find','then','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xb38c,0x104));var _0xcb38=function(_0x4e4519,_0x392ae){_0x4e4519=_0x4e4519-0x0;var _0x340044=_0xb38c[_0x4e4519];return _0x340044;};'use strict';var _=require('lodash');var util=require(_0xcb38('0x0'));var moment=require(_0xcb38('0x1'));var BPromise=require(_0xcb38('0x2'));var rs=require(_0xcb38('0x3'));var fs=require('fs');var Redis=require(_0xcb38('0x4'));var db=require(_0xcb38('0x5'))['db'];var utils=require(_0xcb38('0x6'));var logger=require('../../config/logger')(_0xcb38('0x7'));var config=require(_0xcb38('0x8'));var jayson=require(_0xcb38('0x9'));var client=jayson[_0xcb38('0xa')][_0xcb38('0xb')]({'port':0x232a});config[_0xcb38('0xc')]=_[_0xcb38('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcb38('0xe'))(new Redis(config[_0xcb38('0xc')]));require(_0xcb38('0xf'))[_0xcb38('0x10')](socket);function respondWithRpcPromise(_0xde6e58,_0x5db381,_0x548b0b){return new BPromise(function(_0x5c3d72,_0x2204db){return client[_0xcb38('0x11')](_0xde6e58,_0x548b0b)['then'](function(_0x2cb3bf){logger['info'](_0xcb38('0x12'),_0x5db381,'request\x20sent');logger[_0xcb38('0x13')](_0xcb38('0x14'),_0x5db381,_0xcb38('0x15'),JSON[_0xcb38('0x16')](_0x2cb3bf));if(_0x2cb3bf[_0xcb38('0x17')]){if(_0x2cb3bf[_0xcb38('0x17')]['code']===0x1f4){logger[_0xcb38('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x5db381,_0x2cb3bf[_0xcb38('0x17')][_0xcb38('0x18')]);return _0x2204db(_0x2cb3bf[_0xcb38('0x17')][_0xcb38('0x18')]);}logger[_0xcb38('0x17')](_0xcb38('0x12'),_0x5db381,_0x2cb3bf[_0xcb38('0x17')][_0xcb38('0x18')]);return _0x5c3d72(_0x2cb3bf['error'][_0xcb38('0x18')]);}else{logger[_0xcb38('0x19')](_0xcb38('0x12'),_0x5db381,_0xcb38('0x15'));_0x5c3d72(_0x2cb3bf[_0xcb38('0x1a')][_0xcb38('0x18')]);}})[_0xcb38('0x1b')](function(_0x1c917a){logger['error'](_0xcb38('0x12'),_0x5db381,_0x1c917a);_0x2204db(_0x1c917a);});});}exports[_0xcb38('0x1c')]=function(_0x306f23){var _0x113dce=this;return new Promise(function(_0x936e75,_0x5364b3){return db[_0xcb38('0x1d')][_0xcb38('0x1e')](_0x306f23[_0xcb38('0x1f')],{'raw':_0x306f23[_0xcb38('0x20')]?_0x306f23[_0xcb38('0x20')][_0xcb38('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x306f23[_0xcb38('0x20')]?_0x306f23['options']['where']||null:null,'attributes':_0x306f23[_0xcb38('0x20')]?_0x306f23['options']['attributes']||null:null,'limit':_0x306f23['options']?_0x306f23[_0xcb38('0x20')]['limit']||null:null})['then'](function(_0x175508){logger[_0xcb38('0x19')]('UpdateChatInteraction',_0x306f23);logger['debug'](_0xcb38('0x1c'),_0x306f23,JSON[_0xcb38('0x16')](_0x175508));_0x936e75(_0x175508);})['catch'](function(_0x5974ba){logger[_0xcb38('0x17')](_0xcb38('0x1c'),_0x5974ba[_0xcb38('0x18')],_0x306f23);_0x5364b3(_0x113dce[_0xcb38('0x17')](0x1f4,_0x5974ba['message']));});});};exports['AddTagsToChatInteraction']=function(_0x34b517){return new Promise(function(_0x3d6a70,_0x17a6b7){return db['ChatInteraction'][_0xcb38('0x22')]({'where':_0x34b517[_0xcb38('0x20')]?_0x34b517[_0xcb38('0x20')]['where']||null:null})[_0xcb38('0x23')](function(_0x1faae2){if(_0x1faae2){return _0x1faae2[_0xcb38('0x24')](_0x34b517[_0xcb38('0x1f')][_0xcb38('0x25')],_[_0xcb38('0x26')](_0x34b517[_0xcb38('0x1f')],[_0xcb38('0x25'),'id'])||{});}})[_0xcb38('0x27')](function(_0x568a1a){logger[_0xcb38('0x19')](_0xcb38('0x28'),_0x34b517);logger[_0xcb38('0x13')](_0xcb38('0x28'),_0x34b517,JSON[_0xcb38('0x16')](_0x568a1a));_0x3d6a70(_0x568a1a);})['catch'](function(_0x3690d8){logger['error'](_0xcb38('0x28'),_0x3690d8[_0xcb38('0x18')],_0x34b517);_0x17a6b7(_this[_0xcb38('0x17')](0x1f4,_0x3690d8[_0xcb38('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6530433..adbe5ee 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 _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 +var _0x4030=['removeListener','chatInteraction:','./chatInteraction.events','save','update','emit'];(function(_0x76b303,_0x3e255a){var _0x278e3d=function(_0x5593ec){while(--_0x5593ec){_0x76b303['push'](_0x76b303['shift']());}};_0x278e3d(++_0x3e255a);}(_0x4030,0x1ee));var _0x0403=function(_0x5c6299,_0x11bd28){_0x5c6299=_0x5c6299-0x0;var _0x23b564=_0x4030[_0x5c6299];return _0x23b564;};'use strict';var ChatInteractionEvents=require(_0x0403('0x0'));var events=[_0x0403('0x1'),'remove',_0x0403('0x2')];function createListener(_0x2cf71b,_0xa44447){return function(_0x1bdccb){_0xa44447[_0x0403('0x3')](_0x2cf71b,_0x1bdccb);};}function removeListener(_0x4c0bdd,_0x1cdfaf){return function(){ChatInteractionEvents[_0x0403('0x4')](_0x4c0bdd,_0x1cdfaf);};}exports['register']=function(_0x2905e7){for(var _0x262ea6=0x0,_0x38f863=events['length'];_0x262ea6<_0x38f863;_0x262ea6++){var _0x1ebed0=events[_0x262ea6];var _0x355a5d=createListener(_0x0403('0x5')+_0x1ebed0,_0x2905e7);ChatInteractionEvents['on'](_0x1ebed0,_0x355a5d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d5f8e12..293eb78 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 _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 +var _0x5490=['close','delete','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','tracked','chatinteraction:addtags','addTags','put','chat','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x5490,0x10f));var _0x0549=function(_0x46c9fa,_0x2e6b22){_0x46c9fa=_0x46c9fa-0x0;var _0xc9ae8c=_0x5490[_0x46c9fa];return _0xc9ae8c;};'use strict';var multer=require('multer');var util=require(_0x0549('0x0'));var path=require(_0x0549('0x1'));var timeout=require(_0x0549('0x2'));var express=require(_0x0549('0x3'));var router=express[_0x0549('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0549('0x5'));var config=require('../../config/environment');var controller=require(_0x0549('0x6'));router[_0x0549('0x7')]('/',auth[_0x0549('0x8')](),controller[_0x0549('0x9')]);router[_0x0549('0x7')](_0x0549('0xa'),auth[_0x0549('0x8')](),controller['describe']);router[_0x0549('0x7')](_0x0549('0xb'),auth[_0x0549('0xc')](),controller[_0x0549('0xd')]);router[_0x0549('0x7')](_0x0549('0xe'),auth[_0x0549('0xc')](),controller[_0x0549('0xf')]);router['get']('/:id/messages',auth[_0x0549('0x8')](),controller[_0x0549('0x10')]);router[_0x0549('0x7')](_0x0549('0x11'),auth[_0x0549('0xc')](),controller[_0x0549('0x12')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x0549('0x13')]);router[_0x0549('0x14')]('/',auth[_0x0549('0x8')](),controller[_0x0549('0x15')]);router['post'](_0x0549('0x16'),auth[_0x0549('0x8')](),controller[_0x0549('0x17')]);var upload=multer({'storage':multer[_0x0549('0x18')]({'destination':function(_0x3e5d17,_0x416ea5,_0x88a672){_0x88a672(null,path[_0x0549('0x19')](config[_0x0549('0x1a')],_0x0549('0x1b')));},'filename':function(_0x48b5cd,_0x1f1b4a,_0x46fec8){_0x46fec8(null,util[_0x0549('0x1c')](_0x0549('0x1d'),Date[_0x0549('0x1e')](),_0x1f1b4a[_0x0549('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x0549('0x20'),upload[_0x0549('0x21')](_0x0549('0x22')),controller[_0x0549('0x23')]);router[_0x0549('0x14')](_0x0549('0x24'),auth[_0x0549('0xc')](),controller['addMessage']);router[_0x0549('0x14')]('/:id/tags',auth[_0x0549('0x8')](),interaction[_0x0549('0x25')]('chat',_0x0549('0x26')),controller[_0x0549('0x27')]);router[_0x0549('0x28')](_0x0549('0xb'),auth[_0x0549('0x8')](),interaction[_0x0549('0x25')](_0x0549('0x29'),'chatinteraction:update'),controller[_0x0549('0x2a')]);router[_0x0549('0x28')](_0x0549('0x2b'),controller[_0x0549('0x2c')]);router[_0x0549('0x28')](_0x0549('0x2d'),auth[_0x0549('0xc')](),controller['abandon']);router[_0x0549('0x28')](_0x0549('0x2e'),controller[_0x0549('0x2f')]);router[_0x0549('0x30')](_0x0549('0xb'),auth[_0x0549('0x8')](),interaction[_0x0549('0x25')](_0x0549('0x29'),'chatinteraction:destroy'),controller[_0x0549('0x31')]);router['delete'](_0x0549('0x32'),auth[_0x0549('0x8')](),controller[_0x0549('0x33')]);module[_0x0549('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 abb5b38..0357ac6 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 _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 +var _0xda2d=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0x1fbd2b,_0x430f20){var _0x3bea25=function(_0x49c993){while(--_0x49c993){_0x1fbd2b['push'](_0x1fbd2b['shift']());}};_0x3bea25(++_0x430f20);}(_0xda2d,0x102));var _0xdda2=function(_0x1a7942,_0x5e106a){_0x1a7942=_0x1a7942-0x0;var _0x5c2da0=_0xda2d[_0x1a7942];return _0x5c2da0;};'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 388cd96..f790bcc 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 _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 +var _0xaed6=['admin','fullname','userpic','internal','online','lastLoginAt','allowmessenger','-online','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','resourceId','push','user','read','-createdAt','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','count','offset','limit','Content-Range','json','reject','update','then','destroy','stack','name','index','map','ChatInternalMessage','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','agent'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xaed6,0xe2));var _0x6aed=function(_0x29e6fc,_0x37548a){_0x29e6fc=_0x29e6fc-0x0;var _0x43194b=_0xaed6[_0x29e6fc];return _0x43194b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6aed('0x0'));var rimraf=require(_0x6aed('0x1'));var zipdir=require(_0x6aed('0x2'));var jsonpatch=require(_0x6aed('0x3'));var rp=require(_0x6aed('0x4'));var moment=require(_0x6aed('0x5'));var BPromise=require(_0x6aed('0x6'));var Mustache=require(_0x6aed('0x7'));var util=require(_0x6aed('0x8'));var path=require(_0x6aed('0x9'));var sox=require('sox');var csv=require(_0x6aed('0xa'));var ejs=require(_0x6aed('0xb'));var fs=require('fs');var _=require(_0x6aed('0xc'));var squel=require(_0x6aed('0xd'));var crypto=require(_0x6aed('0xe'));var jsforce=require(_0x6aed('0xf'));var deskjs=require(_0x6aed('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6aed('0x11'));var Redis=require(_0x6aed('0x12'));var authService=require(_0x6aed('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6aed('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6aed('0x15'))('api');var utils=require(_0x6aed('0x16'));var config=require(_0x6aed('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6aed('0x18'))['db'];config[_0x6aed('0x19')]=_['defaults'](config[_0x6aed('0x19')],{'host':_0x6aed('0x1a'),'port':0x18eb});var socket=require(_0x6aed('0x1b'))(new Redis(config[_0x6aed('0x19')]));require('./chatInternalMessage.socket')[_0x6aed('0x1c')](socket);function respondWithStatusCode(_0x6ab7bd,_0x354b49){_0x354b49=_0x354b49||0xcc;return function(_0xff38f1){if(_0xff38f1){return _0x6ab7bd[_0x6aed('0x1d')](_0x354b49);}return _0x6ab7bd['status'](_0x354b49)[_0x6aed('0x1e')]();};}function respondWithResult(_0x3a22b5,_0x58973b){_0x58973b=_0x58973b||0xc8;return function(_0x4315fe){if(_0x4315fe){return _0x3a22b5[_0x6aed('0x1f')](_0x58973b)['json'](_0x4315fe);}};}function respondWithFilteredResult(_0xd31da6,_0x1cc759){return function(_0x2b8ffa){if(_0x2b8ffa){var _0x9d2fe3=_0x2b8ffa[_0x6aed('0x20')],_0xdf021a=_0x1cc759[_0x6aed('0x21')],_0x5d96af=_0x1cc759['offset']+_0x1cc759[_0x6aed('0x22')],_0x1426d2;if(_0x5d96af>=_0x9d2fe3){_0x5d96af=_0x9d2fe3;_0x1426d2=0xc8;}else{_0x1426d2=0xce;}_0xd31da6[_0x6aed('0x1f')](_0x1426d2);return _0xd31da6['set'](_0x6aed('0x23'),_0xdf021a+'-'+_0x5d96af+'/'+_0x9d2fe3)[_0x6aed('0x24')](_0x2b8ffa);}return null;};}function patchUpdates(_0x266fa9){return function(_0xbf03d5){try{jsonpatch['apply'](_0xbf03d5,_0x266fa9,!![]);}catch(_0x239129){return BPromise[_0x6aed('0x25')](_0x239129);}return _0xbf03d5['save']();};}function saveUpdates(_0x2bb5e1,_0x28bfab){return function(_0x2166f5){if(_0x2166f5){return _0x2166f5[_0x6aed('0x26')](_0x2bb5e1)[_0x6aed('0x27')](function(_0x2ba3a7){return _0x2ba3a7;});}return null;};}function removeEntity(_0x4e3ed0,_0x296ef3){return function(_0x1bd792){if(_0x1bd792){return _0x1bd792[_0x6aed('0x28')]()[_0x6aed('0x27')](function(){_0x4e3ed0['status'](0xcc)[_0x6aed('0x1e')]();});}};}function handleEntityNotFound(_0x20d2b0,_0x4a1853){return function(_0x45ec40){if(!_0x45ec40){_0x20d2b0[_0x6aed('0x1d')](0x194);}return _0x45ec40;};}function handleError(_0x30923b,_0x49cc6f){_0x49cc6f=_0x49cc6f||0x1f4;return function(_0x736a63){logger['error'](_0x736a63[_0x6aed('0x29')]);if(_0x736a63['name']){delete _0x736a63[_0x6aed('0x2a')];}_0x30923b[_0x6aed('0x1f')](_0x49cc6f)['send'](_0x736a63);};}exports[_0x6aed('0x2b')]=function(_0x50f7f7,_0x121da1){var _0x5b4207={},_0x35cf24={},_0x4d5239={'count':0x0,'rows':[]};var _0x21f7a6=_[_0x6aed('0x2c')](db[_0x6aed('0x2d')][_0x6aed('0x2e')],function(_0xac28b3){return{'name':_0xac28b3['fieldName'],'type':_0xac28b3[_0x6aed('0x2f')][_0x6aed('0x30')]};});_0x35cf24['model']=_[_0x6aed('0x2c')](_0x21f7a6,'name');_0x35cf24[_0x6aed('0x31')]=_[_0x6aed('0x32')](_0x50f7f7[_0x6aed('0x31')]);_0x35cf24[_0x6aed('0x33')]=_[_0x6aed('0x34')](_0x35cf24[_0x6aed('0x35')],_0x35cf24['query']);_0x5b4207['attributes']=_[_0x6aed('0x34')](_0x35cf24[_0x6aed('0x35')],qs[_0x6aed('0x36')](_0x50f7f7['query'][_0x6aed('0x36')]));_0x5b4207[_0x6aed('0x37')]=_0x5b4207[_0x6aed('0x37')][_0x6aed('0x38')]?_0x5b4207[_0x6aed('0x37')]:_0x35cf24['model'];if(!_0x50f7f7['query'][_0x6aed('0x39')]('nolimit')){_0x5b4207[_0x6aed('0x22')]=qs[_0x6aed('0x22')](_0x50f7f7[_0x6aed('0x31')]['limit']);_0x5b4207[_0x6aed('0x21')]=qs['offset'](_0x50f7f7['query'][_0x6aed('0x21')]);}_0x5b4207[_0x6aed('0x3a')]=qs[_0x6aed('0x3b')](_0x50f7f7[_0x6aed('0x31')]['sort']);_0x5b4207[_0x6aed('0x3c')]=qs[_0x6aed('0x33')](_['pick'](_0x50f7f7[_0x6aed('0x31')],_0x35cf24['filters']),_0x21f7a6);if(_0x50f7f7['query'][_0x6aed('0x3d')]){_0x5b4207[_0x6aed('0x3c')]=_['merge'](_0x5b4207[_0x6aed('0x3c')],{'$or':_[_0x6aed('0x2c')](_0x21f7a6,function(_0xca78c0){if(_0xca78c0['type']!==_0x6aed('0x3e')){var _0x5162da={};_0x5162da[_0xca78c0[_0x6aed('0x2a')]]={'$like':'%'+_0x50f7f7[_0x6aed('0x31')][_0x6aed('0x3d')]+'%'};return _0x5162da;}})});}_0x5b4207=_[_0x6aed('0x3f')]({},_0x5b4207,_0x50f7f7[_0x6aed('0x40')]);var _0x1a53d0={'where':_0x5b4207[_0x6aed('0x3c')]};return db['ChatInternalMessage'][_0x6aed('0x20')](_0x1a53d0)[_0x6aed('0x27')](function(_0x55929a){_0x4d5239[_0x6aed('0x20')]=_0x55929a;if(_0x50f7f7['query'][_0x6aed('0x41')]){_0x5b4207[_0x6aed('0x42')]=[{'all':!![]}];}return db[_0x6aed('0x2d')][_0x6aed('0x43')](_0x5b4207);})[_0x6aed('0x27')](function(_0x3a12c7){_0x4d5239['rows']=_0x3a12c7;return _0x4d5239;})[_0x6aed('0x27')](respondWithFilteredResult(_0x121da1,_0x5b4207))[_0x6aed('0x44')](handleError(_0x121da1,null));};exports[_0x6aed('0x45')]=function(_0x5250fc,_0x502120){var _0x2747d3={'raw':!![],'where':{'id':_0x5250fc[_0x6aed('0x46')]['id']}},_0x4338b7={};_0x4338b7[_0x6aed('0x35')]=_[_0x6aed('0x32')](db[_0x6aed('0x2d')]['rawAttributes']);_0x4338b7[_0x6aed('0x31')]=_[_0x6aed('0x32')](_0x5250fc[_0x6aed('0x31')]);_0x4338b7[_0x6aed('0x33')]=_[_0x6aed('0x34')](_0x4338b7[_0x6aed('0x35')],_0x4338b7['query']);_0x2747d3[_0x6aed('0x37')]=_[_0x6aed('0x34')](_0x4338b7[_0x6aed('0x35')],qs[_0x6aed('0x36')](_0x5250fc[_0x6aed('0x31')][_0x6aed('0x36')]));_0x2747d3[_0x6aed('0x37')]=_0x2747d3[_0x6aed('0x37')][_0x6aed('0x38')]?_0x2747d3[_0x6aed('0x37')]:_0x4338b7['model'];if(_0x5250fc[_0x6aed('0x31')][_0x6aed('0x41')]){_0x2747d3['include']=[{'all':!![]}];}_0x2747d3=_[_0x6aed('0x3f')]({},_0x2747d3,_0x5250fc['options']);return db[_0x6aed('0x2d')][_0x6aed('0x47')](_0x2747d3)[_0x6aed('0x27')](handleEntityNotFound(_0x502120,null))[_0x6aed('0x27')](respondWithResult(_0x502120,null))[_0x6aed('0x44')](handleError(_0x502120,null));};exports[_0x6aed('0x48')]=function(_0x55f54b,_0xad5c2f){return db[_0x6aed('0x2d')][_0x6aed('0x48')](_0x55f54b['body'],{})['then'](respondWithResult(_0xad5c2f,0xc9))[_0x6aed('0x44')](handleError(_0xad5c2f,null));};exports['update']=function(_0x3c8e3d,_0x120c93){if(_0x3c8e3d[_0x6aed('0x49')]['id']){delete _0x3c8e3d[_0x6aed('0x49')]['id'];}return db[_0x6aed('0x2d')][_0x6aed('0x47')]({'where':{'id':_0x3c8e3d[_0x6aed('0x46')]['id']}})[_0x6aed('0x27')](handleEntityNotFound(_0x120c93,null))[_0x6aed('0x27')](saveUpdates(_0x3c8e3d['body'],null))[_0x6aed('0x27')](respondWithResult(_0x120c93,null))['catch'](handleError(_0x120c93,null));};exports['destroy']=function(_0x538579,_0x37ed18){return db['ChatInternalMessage']['find']({'where':{'id':_0x538579[_0x6aed('0x46')]['id']}})[_0x6aed('0x27')](handleEntityNotFound(_0x37ed18,null))[_0x6aed('0x27')](removeEntity(_0x37ed18,null))[_0x6aed('0x44')](handleError(_0x37ed18,null));};exports[_0x6aed('0x4a')]=function(_0x5dcb5a,_0x28608e){return db['ChatInternalMessage'][_0x6aed('0x4a')]()[_0x6aed('0x27')](respondWithResult(_0x28608e,null))[_0x6aed('0x44')](handleError(_0x28608e,null));};function wrapUser(_0x1e3a6d){return function(_0xee1c7d){var _0x55a80d=_0x1e3a6d[_0x6aed('0x4b')]({'plain':!![]});_0x55a80d[_0x6aed('0x4c')]=[];if(_0xee1c7d){_0x55a80d[_0x6aed('0x4d')]=_0xee1c7d[_0x6aed('0x4e')];_0x55a80d['lastMessage']=_0xee1c7d;}else{_0x55a80d[_0x6aed('0x4d')]=moment(0x0)[_0x6aed('0x4f')](_0x6aed('0x50'));_0x55a80d[_0x6aed('0x51')]={};}return _0x55a80d;};}exports['getUsers']=function(_0x2f40ea,_0x8ebcad,_0x287bd6){var _0x543cb7=[];return db['User'][_0x6aed('0x43')]({'where':{'role':[_0x6aed('0x52'),_0x6aed('0x53'),'user']},'attributes':['id',_0x6aed('0x54'),_0x6aed('0x2a'),'role',_0x6aed('0x55'),_0x6aed('0x56'),_0x6aed('0x57'),_0x6aed('0x58'),_0x6aed('0x59'),'showWebBar'],'order':qs[_0x6aed('0x3b')](_0x6aed('0x5a')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x6aed('0x2a'),_0x6aed('0x2f')],'through':{'attributes':[]}}]})[_0x6aed('0x27')](function(_0x19798a){if(_0x19798a){var _0x49f54f=_0x2f40ea['user']['get']({'plain':!![]});if(!_0x49f54f)throw new Error(_0x6aed('0x5b'));if(_0x49f54f[_0x6aed('0x5c')]==='user'){return db[_0x6aed('0x5d')][_0x6aed('0x47')]({'where':{'name':_0x6aed('0x5e'),'userProfileId':_0x49f54f[_0x6aed('0x5f')]},'raw':!![]})[_0x6aed('0x27')](function(_0x2dc80b){if(_0x2dc80b){if(_0x2dc80b['autoAssociation']===0x0){return db[_0x6aed('0x60')][_0x6aed('0x43')]({'where':{'sectionId':_0x2dc80b['id']},'raw':!![]})[_0x6aed('0x27')](function(_0x3628f7){var _0xa0ebdd=[];if(_[_0x6aed('0x61')](_0x3628f7)){_0xa0ebdd=_[_0x6aed('0x3d')](_0x19798a,function(_0x30d19a){if(_0x30d19a[_0x6aed('0x5c')]!=='agent'){return _0x30d19a;}});return _0xa0ebdd;}else{for(var _0x1782c6=0x0;_0x1782c6<_0x19798a[_0x6aed('0x38')];_0x1782c6++){var _0x40f1f2=_0x19798a[_0x1782c6];if(_0x40f1f2['role']===_0x6aed('0x52')){var _0x4f3f10=_[_0x6aed('0x47')](_0x3628f7,function(_0x18e543){return _0x18e543[_0x6aed('0x62')]===_0x40f1f2['id'];});if(_0x4f3f10)_0xa0ebdd[_0x6aed('0x63')](_0x40f1f2);}else{_0xa0ebdd['push'](_0x40f1f2);}}return _0xa0ebdd;}});}else{return _0x19798a;}}else{var _0x45d929=_[_0x6aed('0x3d')](_0x19798a,function(_0x4e5a15){if(_0x4e5a15['role']!==_0x6aed('0x52')){return _0x4e5a15;}});return _0x45d929;}});}else{return _0x19798a;}}})[_0x6aed('0x27')](function(_0x410bd7){var _0x480206=[];if(_0x410bd7){_0x543cb7=_0x410bd7;for(var _0x58852a=0x0;_0x58852a<_0x410bd7['length'];_0x58852a+=0x1){_0x543cb7[_0x58852a][_0x6aed('0x4c')]=[];_0x480206[_0x6aed('0x63')](db['ChatInternalMessage'][_0x6aed('0x47')]({'where':{'FromId':[_0x2f40ea['user']['id'],_0x410bd7[_0x58852a]['id']],'ToId':[_0x2f40ea[_0x6aed('0x64')]['id'],_0x410bd7[_0x58852a]['id']],'ChatGroupId':null},'attributes':['id',_0x6aed('0x4e'),'FromId','ToId',_0x6aed('0x65'),_0x6aed('0x49')],'order':qs['sort'](_0x6aed('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x6aed('0x27')](wrapUser(_0x410bd7[_0x58852a])));}return BPromise['all'](_0x480206);}return[];})['then'](function(_0x55aaf8){return{'rows':_0x55aaf8,'count':_0x55aaf8[_0x6aed('0x38')]};})[_0x6aed('0x27')](respondWithResult(_0x8ebcad,null))[_0x6aed('0x44')](handleError(_0x8ebcad,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index b091ed5..4431fcb 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 _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 +var _0x98a8=['remove','emit','hook','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98a8,0x12c));var _0x898a=function(_0x1682a1,_0x585532){_0x1682a1=_0x1682a1-0x0;var _0xfaffd1=_0x98a8[_0x1682a1];return _0xfaffd1;};'use strict';var EventEmitter=require(_0x898a('0x0'));var ChatInternalMessage=require(_0x898a('0x1'))['db'][_0x898a('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x898a('0x3')](0x0);var events={'afterCreate':_0x898a('0x4'),'afterUpdate':_0x898a('0x5'),'afterDestroy':_0x898a('0x6')};function emitEvent(_0x4a0836){return function(_0x2bb3e2,_0xf84a19,_0x1b3dd0){ChatInternalMessageEvents[_0x898a('0x7')](_0x4a0836+':'+_0x2bb3e2['id'],_0x2bb3e2);ChatInternalMessageEvents[_0x898a('0x7')](_0x4a0836,_0x2bb3e2);_0x1b3dd0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x898a('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 8343f02..3640c0f 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 _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 +var _0xe706=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x4d247c,_0x3dff9e){var _0x42c60c=function(_0x399acd){while(--_0x399acd){_0x4d247c['push'](_0x4d247c['shift']());}};_0x42c60c(++_0x3dff9e);}(_0xe706,0xa3));var _0x6e70=function(_0x13b3f2,_0x1f230e){_0x13b3f2=_0x13b3f2-0x0;var _0x476495=_0xe706[_0x13b3f2];return _0x476495;};'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':!![],'charset':_0x6e70('0xe'),'collate':_0x6e70('0xf')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index bf38bef..c73a060 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 _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 +var _0xb566=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','code','error','ChatInternalMessage,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x545194,_0x336bc3){var _0x2eafd7=function(_0x44b6c3){while(--_0x44b6c3){_0x545194['push'](_0x545194['shift']());}};_0x2eafd7(++_0x336bc3);}(_0xb566,0x8a));var _0x6b56=function(_0x4dcc2d,_0x422839){_0x4dcc2d=_0x4dcc2d-0x0;var _0x1bbd79=_0xb566[_0x4dcc2d];return _0x1bbd79;};'use strict';var _=require(_0x6b56('0x0'));var util=require(_0x6b56('0x1'));var moment=require(_0x6b56('0x2'));var BPromise=require(_0x6b56('0x3'));var rs=require(_0x6b56('0x4'));var fs=require('fs');var Redis=require(_0x6b56('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6b56('0x6'));var logger=require(_0x6b56('0x7'))(_0x6b56('0x8'));var config=require('../../config/environment');var jayson=require(_0x6b56('0x9'));var client=jayson[_0x6b56('0xa')][_0x6b56('0xb')]({'port':0x232a});config[_0x6b56('0xc')]=_[_0x6b56('0xd')](config[_0x6b56('0xc')],{'host':_0x6b56('0xe'),'port':0x18eb});var socket=require(_0x6b56('0xf'))(new Redis(config['redis']));require(_0x6b56('0x10'))[_0x6b56('0x11')](socket);function respondWithRpcPromise(_0x2fe509,_0x221ec2,_0x2d1407){return new BPromise(function(_0x1f114a,_0x2712b2){return client[_0x6b56('0x12')](_0x2fe509,_0x2d1407)[_0x6b56('0x13')](function(_0x51384e){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x221ec2,_0x6b56('0x14'));logger[_0x6b56('0x15')](_0x6b56('0x16'),_0x221ec2,'request\x20sent',JSON['stringify'](_0x51384e));if(_0x51384e['error']){if(_0x51384e['error'][_0x6b56('0x17')]===0x1f4){logger[_0x6b56('0x18')](_0x6b56('0x19'),_0x221ec2,_0x51384e[_0x6b56('0x18')][_0x6b56('0x1a')]);return _0x2712b2(_0x51384e[_0x6b56('0x18')]['message']);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x221ec2,_0x51384e[_0x6b56('0x18')]['message']);return _0x1f114a(_0x51384e['error'][_0x6b56('0x1a')]);}else{logger[_0x6b56('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x221ec2,_0x6b56('0x14'));_0x1f114a(_0x51384e['result'][_0x6b56('0x1a')]);}})[_0x6b56('0x1c')](function(_0x5bcfc9){logger[_0x6b56('0x18')](_0x6b56('0x19'),_0x221ec2,_0x5bcfc9);_0x2712b2(_0x5bcfc9);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index e94a946..e543e49 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 _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 +var _0xff96=['chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x2426d7,_0x2e62f2){var _0x89a084=function(_0xa16e98){while(--_0xa16e98){_0x2426d7['push'](_0x2426d7['shift']());}};_0x89a084(++_0x2e62f2);}(_0xff96,0x179));var _0x6ff9=function(_0x3fcc5,_0x5771ad){_0x3fcc5=_0x3fcc5-0x0;var _0x3977fc=_0xff96[_0x3fcc5];return _0x3977fc;};'use strict';var ChatInternalMessageEvents=require(_0x6ff9('0x0'));var events=[_0x6ff9('0x1'),_0x6ff9('0x2'),_0x6ff9('0x3')];function createListener(_0xa3cf6b,_0x19b956){return function(_0xc1de29){_0x19b956[_0x6ff9('0x4')](_0xa3cf6b,_0xc1de29);};}function removeListener(_0x3561d7,_0x207c06){return function(){ChatInternalMessageEvents[_0x6ff9('0x5')](_0x3561d7,_0x207c06);};}exports[_0x6ff9('0x6')]=function(_0x4adb77){for(var _0x3efaff=0x0,_0x5509ee=events['length'];_0x3efaff<_0x5509ee;_0x3efaff++){var _0x4f982b=events[_0x3efaff];var _0x5d56f4=createListener(_0x6ff9('0x7')+_0x4f982b,_0x4adb77);ChatInternalMessageEvents['on'](_0x4f982b,_0x5d56f4);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index de7e4cd..0747308 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 _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 +var _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0x2a18fa,_0x5c4b9e){var _0xcbcd76=function(_0x2083d5){while(--_0x2083d5){_0x2a18fa['push'](_0x2a18fa['shift']());}};_0xcbcd76(++_0x5c4b9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 4d32a2c..4a5a3f0 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 _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 +var _0x3999=['medium','BOOLEAN','out','STRING','sequelize','exports'];(function(_0x17966d,_0x2112f0){var _0x1971c8=function(_0x522b25){while(--_0x522b25){_0x17966d['push'](_0x17966d['shift']());}};_0x1971c8(++_0x2112f0);}(_0x3999,0xa0));var _0x9399=function(_0x5a49fa,_0x27ad30){_0x5a49fa=_0x5a49fa-0x0;var _0x5dd34f=_0x3999[_0x5a49fa];return _0x5dd34f;};'use strict';var Sequelize=require(_0x9399('0x0'));module[_0x9399('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9399('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9399('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9399('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x9399('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x9399('0x5')]},'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 1f6150b..bf2f426 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 _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 +var _0x8256=['query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','show','keys','create','body','find','params','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','EventManager','acceptmessage','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','event','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../config/license/util','redis','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','model'];(function(_0x2eb15c,_0x21c769){var _0x523ed4=function(_0x1e816b){while(--_0x1e816b){_0x2eb15c['push'](_0x2eb15c['shift']());}};_0x523ed4(++_0x21c769);}(_0x8256,0x1b1));var _0x6825=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8256[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0x6825('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6825('0x1'));var zipdir=require(_0x6825('0x2'));var jsonpatch=require(_0x6825('0x3'));var rp=require(_0x6825('0x4'));var moment=require('moment');var BPromise=require(_0x6825('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6825('0x6'));var csv=require(_0x6825('0x7'));var ejs=require(_0x6825('0x8'));var fs=require('fs');var _=require(_0x6825('0x9'));var squel=require(_0x6825('0xa'));var crypto=require(_0x6825('0xb'));var jsforce=require(_0x6825('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6825('0x7'));var querystring=require('querystring');var Papa=require(_0x6825('0xd'));var Redis=require(_0x6825('0xe'));var authService=require(_0x6825('0xf'));var qs=require(_0x6825('0x10'));var as=require(_0x6825('0x11'));var hardwareService=require(_0x6825('0x12'));var logger=require(_0x6825('0x13'))(_0x6825('0x14'));var utils=require(_0x6825('0x15'));var config=require(_0x6825('0x16'));var licenseUtil=require(_0x6825('0x17'));var db=require('../../mysqldb')['db'];config[_0x6825('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6825('0x19'))(new Redis(config[_0x6825('0x18')]));require(_0x6825('0x1a'))[_0x6825('0x1b')](socket);var jayson=require(_0x6825('0x1c'));var client=jayson[_0x6825('0x1d')][_0x6825('0x1e')]({'port':0x232c});var client9002=jayson[_0x6825('0x1d')][_0x6825('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x58f466,_0x4597c8,_0x131d83,_0x1b5a50){return new BPromise(function(_0xa126c5,_0x2cc597){var _0x11d810=_0x1b5a50||client;return _0x11d810[_0x6825('0x1f')](_0x58f466,_0x131d83)[_0x6825('0x20')](function(_0x14b328){logger[_0x6825('0x21')](_0x6825('0x22'),_0x4597c8,_0x6825('0x23'));logger[_0x6825('0x24')](_0x6825('0x25'),_0x4597c8,_0x6825('0x23'),JSON['stringify'](_0x14b328));if(_0x14b328['error']){if(_0x14b328[_0x6825('0x26')][_0x6825('0x27')]===0x1f4){logger['error'](_0x6825('0x22'),_0x4597c8,_0x14b328['error'][_0x6825('0x28')]);return _0x2cc597(_0x14b328['error'][_0x6825('0x28')]);}logger[_0x6825('0x26')](_0x6825('0x22'),_0x4597c8,_0x14b328['error'][_0x6825('0x28')]);return _0xa126c5(_0x14b328[_0x6825('0x26')][_0x6825('0x28')]);}else{logger[_0x6825('0x21')](_0x6825('0x22'),_0x4597c8,'request\x20sent');_0xa126c5(_0x14b328[_0x6825('0x29')]['message']);}})[_0x6825('0x2a')](function(_0x3cc790){logger[_0x6825('0x26')]('ChatMessage,\x20%s,\x20%s',_0x4597c8,_0x3cc790);_0x2cc597(_0x3cc790);});});}function respondWithStatusCode(_0x3146db,_0xc1cf1e){_0xc1cf1e=_0xc1cf1e||0xcc;return function(_0x4fff30){if(_0x4fff30){return _0x3146db[_0x6825('0x2b')](_0xc1cf1e);}return _0x3146db[_0x6825('0x2c')](_0xc1cf1e)[_0x6825('0x2d')]();};}function respondWithResult(_0xa8df0b,_0x32bfc2){_0x32bfc2=_0x32bfc2||0xc8;return function(_0x58d6a7){if(_0x58d6a7){return _0xa8df0b['status'](_0x32bfc2)[_0x6825('0x2e')](_0x58d6a7);}};}function respondWithFilteredResult(_0x15947d,_0x564b38){return function(_0x4538ff){if(_0x4538ff){var _0xebe001=_0x4538ff[_0x6825('0x2f')],_0x4b633f=_0x564b38[_0x6825('0x30')],_0x5529d7=_0x564b38[_0x6825('0x30')]+_0x564b38[_0x6825('0x31')],_0x49332e;if(_0x5529d7>=_0xebe001){_0x5529d7=_0xebe001;_0x49332e=0xc8;}else{_0x49332e=0xce;}_0x15947d[_0x6825('0x2c')](_0x49332e);return _0x15947d[_0x6825('0x32')](_0x6825('0x33'),_0x4b633f+'-'+_0x5529d7+'/'+_0xebe001)['json'](_0x4538ff);}return null;};}function patchUpdates(_0x5ce1d8){return function(_0xc9d220){try{jsonpatch[_0x6825('0x34')](_0xc9d220,_0x5ce1d8,!![]);}catch(_0x16b752){return BPromise['reject'](_0x16b752);}return _0xc9d220['save']();};}function saveUpdates(_0x59073a,_0xe5149c){return function(_0x5de060){if(_0x5de060){return _0x5de060[_0x6825('0x35')](_0x59073a)[_0x6825('0x20')](function(_0x162240){return _0x162240;});}return null;};}function removeEntity(_0x44cad4,_0x143700){return function(_0x591ac8){if(_0x591ac8){return _0x591ac8[_0x6825('0x36')]()['then'](function(){_0x44cad4[_0x6825('0x2c')](0xcc)[_0x6825('0x2d')]();});}};}function handleEntityNotFound(_0x280476,_0x1b695e){return function(_0x2fc1a0){if(!_0x2fc1a0){_0x280476['sendStatus'](0x194);}return _0x2fc1a0;};}function handleError(_0x481c13,_0x3333bf){_0x3333bf=_0x3333bf||0x1f4;return function(_0x2c63f8){logger[_0x6825('0x26')](_0x2c63f8[_0x6825('0x37')]);if(_0x2c63f8['name']){delete _0x2c63f8[_0x6825('0x38')];}_0x481c13[_0x6825('0x2c')](_0x3333bf)[_0x6825('0x39')](_0x2c63f8);};}exports[_0x6825('0x3a')]=function(_0x110aa2,_0x3e9618){var _0x4444e9={},_0x1426f7={},_0x2221ef={'count':0x0,'rows':[]};var _0x33defd=_[_0x6825('0x3b')](db[_0x6825('0x3c')][_0x6825('0x3d')],function(_0x4fe020){return{'name':_0x4fe020['fieldName'],'type':_0x4fe020['type']['key']};});_0x1426f7[_0x6825('0x3e')]=_[_0x6825('0x3b')](_0x33defd,_0x6825('0x38'));_0x1426f7[_0x6825('0x3f')]=_['keys'](_0x110aa2[_0x6825('0x3f')]);_0x1426f7['filters']=_[_0x6825('0x40')](_0x1426f7[_0x6825('0x3e')],_0x1426f7['query']);_0x4444e9[_0x6825('0x41')]=_[_0x6825('0x40')](_0x1426f7[_0x6825('0x3e')],qs[_0x6825('0x42')](_0x110aa2[_0x6825('0x3f')][_0x6825('0x42')]));_0x4444e9[_0x6825('0x41')]=_0x4444e9['attributes'][_0x6825('0x43')]?_0x4444e9[_0x6825('0x41')]:_0x1426f7['model'];if(!_0x110aa2[_0x6825('0x3f')][_0x6825('0x44')]('nolimit')){_0x4444e9[_0x6825('0x31')]=qs[_0x6825('0x31')](_0x110aa2[_0x6825('0x3f')][_0x6825('0x31')]);_0x4444e9[_0x6825('0x30')]=qs[_0x6825('0x30')](_0x110aa2['query'][_0x6825('0x30')]);}_0x4444e9[_0x6825('0x45')]=qs[_0x6825('0x46')](_0x110aa2[_0x6825('0x3f')][_0x6825('0x46')]);_0x4444e9[_0x6825('0x47')]=qs[_0x6825('0x48')](_['pick'](_0x110aa2[_0x6825('0x3f')],_0x1426f7[_0x6825('0x48')]),_0x33defd);if(_0x110aa2[_0x6825('0x3f')]['filter']){_0x4444e9['where']=_[_0x6825('0x49')](_0x4444e9[_0x6825('0x47')],{'$or':_[_0x6825('0x3b')](_0x33defd,function(_0x2fa176){if(_0x2fa176[_0x6825('0x4a')]!==_0x6825('0x4b')){var _0x4377da={};_0x4377da[_0x2fa176[_0x6825('0x38')]]={'$like':'%'+_0x110aa2[_0x6825('0x3f')][_0x6825('0x4c')]+'%'};return _0x4377da;}})});}_0x4444e9=_[_0x6825('0x49')]({},_0x4444e9,_0x110aa2[_0x6825('0x4d')]);var _0x21c4d6={'where':_0x4444e9[_0x6825('0x47')]};return db[_0x6825('0x3c')]['count'](_0x21c4d6)[_0x6825('0x20')](function(_0x245fcc){_0x2221ef[_0x6825('0x2f')]=_0x245fcc;if(_0x110aa2[_0x6825('0x3f')][_0x6825('0x4e')]){_0x4444e9[_0x6825('0x4f')]=[{'all':!![]}];}return db[_0x6825('0x3c')]['findAll'](_0x4444e9);})[_0x6825('0x20')](function(_0x3937d0){_0x2221ef['rows']=_0x3937d0;return _0x2221ef;})[_0x6825('0x20')](respondWithFilteredResult(_0x3e9618,_0x4444e9))[_0x6825('0x2a')](handleError(_0x3e9618,null));};exports[_0x6825('0x50')]=function(_0xa22187,_0x2366db){var _0xceead1={'raw':!![],'where':{'id':_0xa22187['params']['id']}},_0x270c0f={};_0x270c0f[_0x6825('0x3e')]=_[_0x6825('0x51')](db[_0x6825('0x3c')]['rawAttributes']);_0x270c0f[_0x6825('0x3f')]=_[_0x6825('0x51')](_0xa22187[_0x6825('0x3f')]);_0x270c0f[_0x6825('0x48')]=_[_0x6825('0x40')](_0x270c0f[_0x6825('0x3e')],_0x270c0f['query']);_0xceead1[_0x6825('0x41')]=_['intersection'](_0x270c0f['model'],qs[_0x6825('0x42')](_0xa22187['query'][_0x6825('0x42')]));_0xceead1['attributes']=_0xceead1['attributes'][_0x6825('0x43')]?_0xceead1[_0x6825('0x41')]:_0x270c0f['model'];if(_0xa22187['query'][_0x6825('0x4e')]){_0xceead1[_0x6825('0x4f')]=[{'all':!![]}];}_0xceead1=_[_0x6825('0x49')]({},_0xceead1,_0xa22187[_0x6825('0x4d')]);return db['ChatMessage']['find'](_0xceead1)['then'](handleEntityNotFound(_0x2366db,null))[_0x6825('0x20')](respondWithResult(_0x2366db,null))[_0x6825('0x2a')](handleError(_0x2366db,null));};exports['create']=function(_0x2e17f3,_0x492ef8){return db[_0x6825('0x3c')][_0x6825('0x52')](_0x2e17f3[_0x6825('0x53')],{})[_0x6825('0x20')](respondWithResult(_0x492ef8,0xc9))[_0x6825('0x2a')](handleError(_0x492ef8,null));};exports[_0x6825('0x35')]=function(_0x955769,_0x2bf7cc){if(_0x955769[_0x6825('0x53')]['id']){delete _0x955769[_0x6825('0x53')]['id'];}return db[_0x6825('0x3c')][_0x6825('0x54')]({'where':{'id':_0x955769[_0x6825('0x55')]['id']}})[_0x6825('0x20')](handleEntityNotFound(_0x2bf7cc,null))[_0x6825('0x20')](saveUpdates(_0x955769[_0x6825('0x53')],null))[_0x6825('0x20')](respondWithResult(_0x2bf7cc,null))[_0x6825('0x2a')](handleError(_0x2bf7cc,null));};exports['destroy']=function(_0x36a6db,_0x29020b){return db[_0x6825('0x3c')][_0x6825('0x54')]({'where':{'id':_0x36a6db[_0x6825('0x55')]['id']}})['then'](handleEntityNotFound(_0x29020b,null))[_0x6825('0x20')](removeEntity(_0x29020b,null))[_0x6825('0x2a')](handleError(_0x29020b,null));};exports[_0x6825('0x56')]=function(_0x361dc9,_0x16d439){return db[_0x6825('0x3c')][_0x6825('0x56')]()[_0x6825('0x20')](respondWithResult(_0x16d439,null))[_0x6825('0x2a')](handleError(_0x16d439,null));};var interaction_log=require(_0x6825('0x13'))(_0x6825('0x57'));exports[_0x6825('0x58')]=function(_0x245ead,_0x22232d,_0x1b95cc){var _0xcfc30e={'agent':{},'channel':_0x6825('0x59')};if(_0x245ead[_0x6825('0x53')]['id']){delete _0x245ead[_0x6825('0x53')]['id'];}_0x245ead['body'][_0x6825('0x5a')]=!![];_0x245ead[_0x6825('0x53')][_0x6825('0x5b')]=moment()[_0x6825('0x5c')](_0x6825('0x5d'));_0x245ead[_0x6825('0x53')]['UserId']=_0x245ead[_0x6825('0x53')][_0x6825('0x5e')]||_0x245ead[_0x6825('0x5f')]['id'];_0xcfc30e[_0x6825('0x60')]['id']=_0x245ead[_0x6825('0x53')]['UserId'];return db[_0x6825('0x3c')][_0x6825('0x54')]({'where':{'id':_0x245ead[_0x6825('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6825('0x61')}]})[_0x6825('0x20')](handleEntityNotFound(_0x22232d,null))[_0x6825('0x20')](saveUpdates(_0x245ead[_0x6825('0x53')],null))[_0x6825('0x20')](function(_0xe3c8f1){if(_0xe3c8f1){_0xcfc30e['message']=_0xe3c8f1['get']({'plain':!![]});return db[_0x6825('0x62')][_0x6825('0x54')]({'where':{'id':_0xe3c8f1[_0x6825('0x63')]}});}return null;})[_0x6825('0x20')](handleEntityNotFound(_0x22232d,null))[_0x6825('0x20')](function(_0x27ec6b){if(_0x27ec6b){return _0x27ec6b[_0x6825('0x35')]({'UserId':_0x245ead[_0x6825('0x53')]['UserId'],'read1stAt':_[_0x6825('0x64')](_0x27ec6b[_0x6825('0x65')])?moment()[_0x6825('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6825('0x20')](function(_0x229595){if(_0x229595){_0xcfc30e[_0x6825('0x66')]=_0x229595[_0x6825('0x67')]({'plain':!![]});interaction_log[_0x6825('0x21')](_0x6825('0x68'),_0x245ead[_0x6825('0x5f')]['id'],_0x245ead[_0x6825('0x5f')][_0x6825('0x38')],_0x245ead[_0x6825('0x5f')][_0x6825('0x69')],_0xcfc30e['interaction']['id'],_0x245ead[_0x6825('0x53')]?JSON[_0x6825('0x6a')](_0x245ead['body']):_0x6825('0x6b'));return respondWithRpcPromise(_0x6825('0x6c'),_0x6825('0x6d'),_0xcfc30e);}return null;})[_0x6825('0x20')](function(_0x533f20){if(_0x533f20){if(_0x245ead['body'][_0x6825('0x6e')]){_0xcfc30e[_0x6825('0x28')]['interface']=util[_0x6825('0x5c')](_0x6825('0x6f'),_0x245ead[_0x6825('0x5f')][_0x6825('0x38')]);_0xcfc30e[_0x6825('0x28')][_0x6825('0x70')]=_0xcfc30e[_0x6825('0x70')];_0xcfc30e[_0x6825('0x28')]['event']=_0x6825('0x58');return respondWithRpcPromise('EventManager',_0x6825('0x71'),{'event':_0x6825('0x72'),'message':_[_0x6825('0x49')](_0xcfc30e[_0x6825('0x28')],JSON[_0x6825('0x73')](_0xcfc30e['interaction'][_0x6825('0x74')]))},client9002)[_0x6825('0x20')](function(){return _0xcfc30e;});}return _0xcfc30e;}return null;})[_0x6825('0x20')](respondWithResult(_0x22232d,null))[_0x6825('0x2a')](handleError(_0x22232d,null));};var interaction_log=require(_0x6825('0x13'))(_0x6825('0x57'));exports[_0x6825('0x75')]=function(_0x4311f3,_0x4ff5a6,_0xd33516){var _0x3c74aa={'agent':{},'channel':_0x6825('0x59')};if(_0x4311f3[_0x6825('0x53')]['id']){delete _0x4311f3[_0x6825('0x53')]['id'];}_0x4311f3[_0x6825('0x53')]['UserId']=_0x4311f3[_0x6825('0x53')][_0x6825('0x5e')]||_0x4311f3['user']['id'];_0x3c74aa['agent']['id']=_0x4311f3[_0x6825('0x53')][_0x6825('0x5e')];return db[_0x6825('0x3c')][_0x6825('0x54')]({'where':{'id':_0x4311f3[_0x6825('0x55')]['id'],'UserId':null}})[_0x6825('0x20')](handleEntityNotFound(_0x4ff5a6,null))[_0x6825('0x20')](function(_0x17e558){if(_0x17e558){_0x3c74aa[_0x6825('0x28')]=_0x17e558[_0x6825('0x67')]({'plain':!![]});return db[_0x6825('0x62')][_0x6825('0x54')]({'where':{'id':_0x17e558['ChatInteractionId']}});}return null;})[_0x6825('0x20')](handleEntityNotFound(_0x4ff5a6,null))[_0x6825('0x20')](function(_0x484cd9){if(_0x484cd9){_0x3c74aa[_0x6825('0x66')]=_0x484cd9[_0x6825('0x67')]({'plain':!![]});interaction_log[_0x6825('0x21')](_0x6825('0x76'),_0x4311f3['user']['id'],_0x4311f3['user'][_0x6825('0x38')],_0x4311f3[_0x6825('0x5f')][_0x6825('0x69')],_0x3c74aa[_0x6825('0x66')]['id'],_0x4311f3['body']?JSON[_0x6825('0x6a')](_0x4311f3[_0x6825('0x53')]):_0x6825('0x6b'));return respondWithRpcPromise(_0x6825('0x77'),_0x6825('0x78'),_0x3c74aa);}return null;})[_0x6825('0x20')](function(_0x324e6a){if(_0x324e6a){_0x324e6a[_0x6825('0x28')][_0x6825('0x79')]=util[_0x6825('0x5c')]('SIP/%s',_0x4311f3[_0x6825('0x5f')][_0x6825('0x38')]);_0x324e6a[_0x6825('0x28')][_0x6825('0x70')]=_0x3c74aa[_0x6825('0x70')];_0x324e6a['message'][_0x6825('0x7a')]=_0x6825('0x75');respondWithRpcPromise('EventManager',_0x6825('0x71'),{'event':_0x6825('0x7b'),'message':_0x324e6a[_0x6825('0x28')]},client9002);return _0x3c74aa;}return null;})[_0x6825('0x20')](respondWithResult(_0x4ff5a6,null))[_0x6825('0x2a')](handleError(_0x4ff5a6,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 876e110..f5f6f83 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 _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 +var _0xf863=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','remove'];(function(_0x4c294f,_0x30910f){var _0x95f040=function(_0x34fdad){while(--_0x34fdad){_0x4c294f['push'](_0x4c294f['shift']());}};_0x95f040(++_0x30910f);}(_0xf863,0x158));var _0x3f86=function(_0x4f9f88,_0x5d9a3a){_0x4f9f88=_0x4f9f88-0x0;var _0x4572d8=_0xf863[_0x4f9f88];return _0x4572d8;};'use strict';var EventEmitter=require(_0x3f86('0x0'));var ChatMessage=require(_0x3f86('0x1'))['db'][_0x3f86('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3f86('0x3')](0x0);var events={'afterCreate':_0x3f86('0x4'),'afterUpdate':'update','afterDestroy':_0x3f86('0x5')};function emitEvent(_0x3233c7){return function(_0x451b47,_0x53de54,_0xf0f0eb){ChatMessageEvents[_0x3f86('0x6')](_0x3233c7+':'+_0x451b47['id'],_0x451b47);ChatMessageEvents[_0x3f86('0x6')](_0x3233c7,_0x451b47);_0xf0f0eb(null);};}for(var e in events){if(events[_0x3f86('0x7')](e)){var event=events[e];ChatMessage[_0x3f86('0x8')](e,emitEvent(event));}}module[_0x3f86('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 30eabf4..d30540b 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 _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 +var _0xf8d1=['ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','UserId'];(function(_0xd16e3c,_0x3ee045){var _0x2edb6f=function(_0x344fab){while(--_0x344fab){_0xd16e3c['push'](_0xd16e3c['shift']());}};_0x2edb6f(++_0x3ee045);}(_0xf8d1,0x10d));var _0x1f8d=function(_0xf01e2f,_0xedf3d5){_0xf01e2f=_0xf01e2f-0x0;var _0xbc865a=_0xf8d1[_0xf01e2f];return _0xbc865a;};'use strict';var _=require(_0x1f8d('0x0'));var util=require(_0x1f8d('0x1'));var logger=require('../../config/logger')(_0x1f8d('0x2'));var moment=require(_0x1f8d('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f8d('0x4'));var fs=require('fs');var path=require(_0x1f8d('0x5'));var rimraf=require(_0x1f8d('0x6'));var config=require(_0x1f8d('0x7'));var attributes=require(_0x1f8d('0x8'));module[_0x1f8d('0x9')]=function(_0x57f5c3,_0x55e849){return _0x57f5c3[_0x1f8d('0xa')](_0x1f8d('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x1f8d('0xc'),'fields':[_0x1f8d('0xd')],'type':_0x1f8d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5ace45,_0x3ed169,_0x26dad3){var _0x5c612c=_0x57f5c3['models'];var _0x1a8745=_0x5ace45[_0x1f8d('0xf')]({'plain':!![]});if(_0x1a8745['direction'][_0x1f8d('0x10')]()==='in'||_0x1a8745[_0x1f8d('0x11')][_0x1f8d('0x10')]()==='out'&&!_0x1a8745[_0x1f8d('0x12')]&&!_[_0x1f8d('0x13')](_0x1a8745[_0x1f8d('0x14')])){_0x5c612c[_0x1f8d('0x15')][_0x1f8d('0x16')]({'where':{'id':_0x1a8745[_0x1f8d('0x17')]}})[_0x1f8d('0x18')](function(_0x5a3c41){if(_0x5a3c41){_0x5a3c41[_0x1f8d('0x19')]({'lastMsgAt':_0x1a8745[_0x1f8d('0x1a')],'lastMsgDirection':_0x1a8745[_0x1f8d('0x11')][_0x1f8d('0x10')]()});}})[_0x1f8d('0x1b')](function(_0xb6076d){console['error'](_0xb6076d);});}_0x26dad3();}},'charset':_0x1f8d('0x1c'),'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 ebb2435..b13eac2 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 _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 +var _0xcc22=['raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatMessage','create','body','options'];(function(_0xea4f8e,_0x2686f1){var _0x826c47=function(_0x8429a3){while(--_0x8429a3){_0xea4f8e['push'](_0xea4f8e['shift']());}};_0x826c47(++_0x2686f1);}(_0xcc22,0x101));var _0x2cc2=function(_0x31ac5a,_0x57fe90){_0x31ac5a=_0x31ac5a-0x0;var _0x5595ce=_0xcc22[_0x31ac5a];return _0x5595ce;};'use strict';var _=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var moment=require(_0x2cc2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cc2('0x3'))['db'];var utils=require(_0x2cc2('0x4'));var logger=require(_0x2cc2('0x5'))(_0x2cc2('0x6'));var config=require(_0x2cc2('0x7'));var jayson=require(_0x2cc2('0x8'));var client=jayson[_0x2cc2('0x9')][_0x2cc2('0xa')]({'port':0x232a});config[_0x2cc2('0xb')]=_['defaults'](config[_0x2cc2('0xb')],{'host':_0x2cc2('0xc'),'port':0x18eb});var socket=require(_0x2cc2('0xd'))(new Redis(config[_0x2cc2('0xb')]));require(_0x2cc2('0xe'))[_0x2cc2('0xf')](socket);function respondWithRpcPromise(_0x1fd2f6,_0x506861,_0x65d554){return new BPromise(function(_0x3c2cb2,_0x64092e){return client[_0x2cc2('0x10')](_0x1fd2f6,_0x65d554)[_0x2cc2('0x11')](function(_0x3022f3){logger[_0x2cc2('0x12')](_0x2cc2('0x13'),_0x506861,_0x2cc2('0x14'));logger[_0x2cc2('0x15')](_0x2cc2('0x16'),_0x506861,'request\x20sent',JSON['stringify'](_0x3022f3));if(_0x3022f3[_0x2cc2('0x17')]){if(_0x3022f3[_0x2cc2('0x17')]['code']===0x1f4){logger[_0x2cc2('0x17')]('ChatMessage,\x20%s,\x20%s',_0x506861,_0x3022f3['error']['message']);return _0x64092e(_0x3022f3[_0x2cc2('0x17')][_0x2cc2('0x18')]);}logger[_0x2cc2('0x17')](_0x2cc2('0x13'),_0x506861,_0x3022f3[_0x2cc2('0x17')][_0x2cc2('0x18')]);return _0x3c2cb2(_0x3022f3[_0x2cc2('0x17')][_0x2cc2('0x18')]);}else{logger[_0x2cc2('0x12')](_0x2cc2('0x13'),_0x506861,_0x2cc2('0x14'));_0x3c2cb2(_0x3022f3[_0x2cc2('0x19')][_0x2cc2('0x18')]);}})[_0x2cc2('0x1a')](function(_0x510f55){logger['error'](_0x2cc2('0x13'),_0x506861,_0x510f55);_0x64092e(_0x510f55);});});}exports[_0x2cc2('0x1b')]=function(_0x544701){var _0x403dda=this;return new Promise(function(_0x29cb25,_0x5395dd){return db['ChatMessage'][_0x2cc2('0x1c')](_0x544701[_0x2cc2('0x1d')],{'raw':_0x544701[_0x2cc2('0x1e')]?_0x544701['options'][_0x2cc2('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x22ddf0){logger[_0x2cc2('0x12')]('CreateChatMessage',_0x544701);logger[_0x2cc2('0x15')]('CreateChatMessage',_0x544701,JSON['stringify'](_0x22ddf0));_0x29cb25(_0x22ddf0);})[_0x2cc2('0x1a')](function(_0x46e954){logger[_0x2cc2('0x17')](_0x2cc2('0x1b'),_0x46e954[_0x2cc2('0x18')],_0x544701);_0x5395dd(_0x403dda[_0x2cc2('0x17')](0x1f4,_0x46e954[_0x2cc2('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f3c5540..8bae980 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 _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 +var _0x33af=['emit','removeListener','register','length','chatMessage:','save','update'];(function(_0x678871,_0x418434){var _0x1c9fcd=function(_0xc588db){while(--_0xc588db){_0x678871['push'](_0x678871['shift']());}};_0x1c9fcd(++_0x418434);}(_0x33af,0xec));var _0xf33a=function(_0x4b54fb,_0x2150e4){_0x4b54fb=_0x4b54fb-0x0;var _0x375eb4=_0x33af[_0x4b54fb];return _0x375eb4;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){ChatMessageEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);ChatMessageEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 80a6e79..1b5370f 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 _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 +var _0x9975=['/:id','show','post','tracked','chatmessage:create','/:id/accept','accept','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9975,0x1ef));var _0x5997=function(_0x45b6b4,_0x260632){_0x45b6b4=_0x45b6b4-0x0;var _0x351446=_0x9975[_0x45b6b4];return _0x351446;};'use strict';var multer=require('multer');var util=require(_0x5997('0x0'));var path=require(_0x5997('0x1'));var timeout=require(_0x5997('0x2'));var express=require(_0x5997('0x3'));var router=express[_0x5997('0x4')]();var auth=require(_0x5997('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5997('0x6'));var controller=require('./chatMessage.controller');router[_0x5997('0x7')]('/',auth[_0x5997('0x8')](),controller[_0x5997('0x9')]);router['get']('/describe',auth[_0x5997('0x8')](),controller[_0x5997('0xa')]);router['get'](_0x5997('0xb'),auth[_0x5997('0x8')](),controller[_0x5997('0xc')]);router[_0x5997('0xd')]('/',auth['isAuthenticated'](),interaction[_0x5997('0xe')]('chat',_0x5997('0xf')),controller['create']);router['put']('/:id',controller['update']);router['put'](_0x5997('0x10'),auth[_0x5997('0x8')](),controller[_0x5997('0x11')]);router[_0x5997('0x12')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0x5997('0x13')](_0x5997('0xb'),auth[_0x5997('0x8')](),controller[_0x5997('0x14')]);module[_0x5997('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 15e0515..bcd3d50 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 _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 +var _0x26c9=['TEXT','medium','sequelize','exports'];(function(_0x513573,_0x31aae1){var _0x545427=function(_0x58d119){while(--_0x58d119){_0x513573['push'](_0x513573['shift']());}};_0x545427(++_0x31aae1);}(_0x26c9,0x7a));var _0x926c=function(_0x6fa1c9,_0x1834f2){_0x6fa1c9=_0x6fa1c9-0x0;var _0x3ebf6f=_0x26c9[_0x6fa1c9];return _0x3ebf6f;};'use strict';var Sequelize=require(_0x926c('0x0'));module[_0x926c('0x1')]={'body':{'type':Sequelize[_0x926c('0x2')](_0x926c('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 8358dfc..ce1025b 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 _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 +var _0xb8cb=['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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','stack','send','index','map','ChatOfflineMessage','fieldName','type','key','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','rawAttributes','include','find','catch','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x467fb7,_0x2f74ca){var _0x3bef91=function(_0x5a3144){while(--_0x5a3144){_0x467fb7['push'](_0x467fb7['shift']());}};_0x3bef91(++_0x2f74ca);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x41af4f,_0x4858bc){_0x41af4f=_0x41af4f-0x0;var _0x5b641c=_0xb8cb[_0x41af4f];return _0x5b641c;};'use strict';var pdf=require(_0xbb8c('0x0'));var emlformat=require(_0xbb8c('0x1'));var rimraf=require(_0xbb8c('0x2'));var zipdir=require(_0xbb8c('0x3'));var jsonpatch=require(_0xbb8c('0x4'));var rp=require(_0xbb8c('0x5'));var moment=require(_0xbb8c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbb8c('0x7'));var util=require(_0xbb8c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xbb8c('0x9'));var ejs=require(_0xbb8c('0xa'));var fs=require('fs');var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0x9'));var querystring=require(_0xbb8c('0xf'));var Papa=require(_0xbb8c('0x10'));var Redis=require(_0xbb8c('0x11'));var authService=require(_0xbb8c('0x12'));var qs=require(_0xbb8c('0x13'));var as=require(_0xbb8c('0x14'));var hardwareService=require(_0xbb8c('0x15'));var logger=require(_0xbb8c('0x16'))('api');var utils=require(_0xbb8c('0x17'));var config=require(_0xbb8c('0x18'));var licenseUtil=require(_0xbb8c('0x19'));var db=require(_0xbb8c('0x1a'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1b')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1c')](_0x57e624)[_0xbb8c('0x1d')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1e')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=_0x403710[_0xbb8c('0x1f')],_0x3a695d=_0x425891[_0xbb8c('0x20')],_0x2c04d1=_0x425891['offset']+_0x425891[_0xbb8c('0x21')],_0x3988cf;if(_0x2c04d1>=_0x2cc079){_0x2c04d1=_0x2cc079;_0x3988cf=0xc8;}else{_0x3988cf=0xce;}_0x1e6dc9[_0xbb8c('0x1c')](_0x3988cf);return _0x1e6dc9[_0xbb8c('0x22')](_0xbb8c('0x23'),_0x3a695d+'-'+_0x2c04d1+'/'+_0x2cc079)[_0xbb8c('0x1e')](_0x403710);}return null;};}function patchUpdates(_0x25e2c4){return function(_0x520ea9){try{jsonpatch[_0xbb8c('0x24')](_0x520ea9,_0x25e2c4,!![]);}catch(_0x30e1b7){return BPromise['reject'](_0x30e1b7);}return _0x520ea9[_0xbb8c('0x25')]();};}function saveUpdates(_0x5e2803,_0x44a56e){return function(_0x570c0b){if(_0x570c0b){return _0x570c0b[_0xbb8c('0x26')](_0x5e2803)[_0xbb8c('0x27')](function(_0x1e2539){return _0x1e2539;});}return null;};}function removeEntity(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['destroy']()[_0xbb8c('0x27')](function(){_0x546215[_0xbb8c('0x1c')](0xcc)[_0xbb8c('0x1d')]();});}};}function handleEntityNotFound(_0xec7fb5,_0x362a2f){return function(_0x582c05){if(!_0x582c05){_0xec7fb5[_0xbb8c('0x1b')](0x194);}return _0x582c05;};}function handleError(_0x51f25a,_0x29d4af){_0x29d4af=_0x29d4af||0x1f4;return function(_0x5f4f96){logger['error'](_0x5f4f96[_0xbb8c('0x28')]);if(_0x5f4f96['name']){delete _0x5f4f96['name'];}_0x51f25a[_0xbb8c('0x1c')](_0x29d4af)[_0xbb8c('0x29')](_0x5f4f96);};}exports[_0xbb8c('0x2a')]=function(_0x4928e4,_0x5b8cd1){var _0x17576b={},_0x2aed0b={},_0x4cb223={'count':0x0,'rows':[]};var _0x26c8cd=_[_0xbb8c('0x2b')](db[_0xbb8c('0x2c')]['rawAttributes'],function(_0x271ad7){return{'name':_0x271ad7[_0xbb8c('0x2d')],'type':_0x271ad7[_0xbb8c('0x2e')][_0xbb8c('0x2f')]};});_0x2aed0b[_0xbb8c('0x30')]=_[_0xbb8c('0x2b')](_0x26c8cd,_0xbb8c('0x31'));_0x2aed0b[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x4928e4[_0xbb8c('0x32')]);_0x2aed0b['filters']=_['intersection'](_0x2aed0b[_0xbb8c('0x30')],_0x2aed0b[_0xbb8c('0x32')]);_0x17576b[_0xbb8c('0x34')]=_[_0xbb8c('0x35')](_0x2aed0b[_0xbb8c('0x30')],qs['fields'](_0x4928e4[_0xbb8c('0x32')][_0xbb8c('0x36')]));_0x17576b[_0xbb8c('0x34')]=_0x17576b[_0xbb8c('0x34')][_0xbb8c('0x37')]?_0x17576b[_0xbb8c('0x34')]:_0x2aed0b[_0xbb8c('0x30')];if(!_0x4928e4[_0xbb8c('0x32')][_0xbb8c('0x38')]('nolimit')){_0x17576b[_0xbb8c('0x21')]=qs[_0xbb8c('0x21')](_0x4928e4[_0xbb8c('0x32')]['limit']);_0x17576b['offset']=qs[_0xbb8c('0x20')](_0x4928e4[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x17576b[_0xbb8c('0x39')]=qs['sort'](_0x4928e4[_0xbb8c('0x32')][_0xbb8c('0x3a')]);_0x17576b[_0xbb8c('0x3b')]=qs[_0xbb8c('0x3c')](_[_0xbb8c('0x3d')](_0x4928e4['query'],_0x2aed0b[_0xbb8c('0x3c')]),_0x26c8cd);if(_0x4928e4[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x17576b[_0xbb8c('0x3b')]=_['merge'](_0x17576b[_0xbb8c('0x3b')],{'$or':_[_0xbb8c('0x2b')](_0x26c8cd,function(_0x1f0e1a){if(_0x1f0e1a[_0xbb8c('0x2e')]!==_0xbb8c('0x3f')){var _0x262205={};_0x262205[_0x1f0e1a[_0xbb8c('0x31')]]={'$like':'%'+_0x4928e4[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x262205;}})});}_0x17576b=_[_0xbb8c('0x40')]({},_0x17576b,_0x4928e4[_0xbb8c('0x41')]);var _0x1f4d03={'where':_0x17576b['where']};return db[_0xbb8c('0x2c')][_0xbb8c('0x1f')](_0x1f4d03)[_0xbb8c('0x27')](function(_0xc2b2a){_0x4cb223['count']=_0xc2b2a;if(_0x4928e4[_0xbb8c('0x32')]['includeAll']){_0x17576b['include']=[{'all':!![]}];}return db[_0xbb8c('0x2c')][_0xbb8c('0x42')](_0x17576b);})[_0xbb8c('0x27')](function(_0x525f49){_0x4cb223[_0xbb8c('0x43')]=_0x525f49;return _0x4cb223;})[_0xbb8c('0x27')](respondWithFilteredResult(_0x5b8cd1,_0x17576b))['catch'](handleError(_0x5b8cd1,null));};exports[_0xbb8c('0x44')]=function(_0x8ac716,_0x3b8311){var _0x15830c={'raw':!![],'where':{'id':_0x8ac716[_0xbb8c('0x45')]['id']}},_0x4800a3={};_0x4800a3[_0xbb8c('0x30')]=_[_0xbb8c('0x33')](db['ChatOfflineMessage'][_0xbb8c('0x46')]);_0x4800a3[_0xbb8c('0x32')]=_['keys'](_0x8ac716['query']);_0x4800a3[_0xbb8c('0x3c')]=_[_0xbb8c('0x35')](_0x4800a3['model'],_0x4800a3['query']);_0x15830c[_0xbb8c('0x34')]=_['intersection'](_0x4800a3[_0xbb8c('0x30')],qs['fields'](_0x8ac716[_0xbb8c('0x32')]['fields']));_0x15830c[_0xbb8c('0x34')]=_0x15830c[_0xbb8c('0x34')][_0xbb8c('0x37')]?_0x15830c[_0xbb8c('0x34')]:_0x4800a3[_0xbb8c('0x30')];if(_0x8ac716[_0xbb8c('0x32')]['includeAll']){_0x15830c[_0xbb8c('0x47')]=[{'all':!![]}];}_0x15830c=_['merge']({},_0x15830c,_0x8ac716[_0xbb8c('0x41')]);return db[_0xbb8c('0x2c')][_0xbb8c('0x48')](_0x15830c)[_0xbb8c('0x27')](handleEntityNotFound(_0x3b8311,null))[_0xbb8c('0x27')](respondWithResult(_0x3b8311,null))[_0xbb8c('0x49')](handleError(_0x3b8311,null));};exports['create']=function(_0x4e8f0a,_0x110760){return db[_0xbb8c('0x2c')]['create'](_0x4e8f0a[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x110760,0xc9))[_0xbb8c('0x49')](handleError(_0x110760,null));};exports['update']=function(_0x62c789,_0x5c53a9){if(_0x62c789[_0xbb8c('0x4a')]['id']){delete _0x62c789[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2c')]['find']({'where':{'id':_0x62c789[_0xbb8c('0x45')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c53a9,null))[_0xbb8c('0x27')](saveUpdates(_0x62c789[_0xbb8c('0x4a')],null))[_0xbb8c('0x27')](respondWithResult(_0x5c53a9,null))[_0xbb8c('0x49')](handleError(_0x5c53a9,null));};exports[_0xbb8c('0x4b')]=function(_0x211aac,_0x83b509){return db[_0xbb8c('0x2c')]['find']({'where':{'id':_0x211aac[_0xbb8c('0x45')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x83b509,null))[_0xbb8c('0x27')](removeEntity(_0x83b509,null))['catch'](handleError(_0x83b509,null));};exports[_0xbb8c('0x4c')]=function(_0x22899e,_0x83c1f9){return db[_0xbb8c('0x2c')][_0xbb8c('0x4c')]()[_0xbb8c('0x27')](respondWithResult(_0x83c1f9,null))[_0xbb8c('0x49')](handleError(_0x83c1f9,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 0049ee7..6002c76 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 _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 +var _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','define','ChatOfflineMessage','utf8mb4','utf8mb4_unicode_ci'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x99e9,0xb4));var _0x999e=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x99e9[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x999e('0xa'),'collate':_0x999e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 68c1f39..92cbf74 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 _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 +var _0xb3a9=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x24ad5f,_0x4fcf81){var _0xabb54e=function(_0x3b4e86){while(--_0x3b4e86){_0x24ad5f['push'](_0x24ad5f['shift']());}};_0xabb54e(++_0x4fcf81);}(_0xb3a9,0x11b));var _0x9b3a=function(_0x259640,_0x1325e0){_0x259640=_0x259640-0x0;var _0x40b1ed=_0xb3a9[_0x259640];return _0x40b1ed;};'use strict';var _=require(_0x9b3a('0x0'));var util=require(_0x9b3a('0x1'));var moment=require('moment');var BPromise=require(_0x9b3a('0x2'));var rs=require(_0x9b3a('0x3'));var fs=require('fs');var Redis=require(_0x9b3a('0x4'));var db=require(_0x9b3a('0x5'))['db'];var utils=require(_0x9b3a('0x6'));var logger=require(_0x9b3a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9b3a('0x8'));var client=jayson[_0x9b3a('0x9')][_0x9b3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1903,_0x4b07c1,_0x5ccdd4){return new BPromise(function(_0x17cbc5,_0x601c21){return client[_0x9b3a('0xb')](_0x5f1903,_0x5ccdd4)[_0x9b3a('0xc')](function(_0x6ad0bd){logger[_0x9b3a('0xd')](_0x9b3a('0xe'),_0x4b07c1,_0x9b3a('0xf'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4b07c1,_0x9b3a('0xf'),JSON[_0x9b3a('0x10')](_0x6ad0bd));if(_0x6ad0bd['error']){if(_0x6ad0bd[_0x9b3a('0x11')][_0x9b3a('0x12')]===0x1f4){logger[_0x9b3a('0x11')](_0x9b3a('0xe'),_0x4b07c1,_0x6ad0bd[_0x9b3a('0x11')]['message']);return _0x601c21(_0x6ad0bd[_0x9b3a('0x11')][_0x9b3a('0x13')]);}logger[_0x9b3a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4b07c1,_0x6ad0bd[_0x9b3a('0x11')]['message']);return _0x17cbc5(_0x6ad0bd[_0x9b3a('0x11')][_0x9b3a('0x13')]);}else{logger['info'](_0x9b3a('0xe'),_0x4b07c1,'request\x20sent');_0x17cbc5(_0x6ad0bd['result'][_0x9b3a('0x13')]);}})[_0x9b3a('0x14')](function(_0x14e718){logger[_0x9b3a('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4b07c1,_0x14e718);_0x601c21(_0x14e718);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d7de1b9..99064ac 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 _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 +var _0x0ef3=['destroy','exports','util','express','Router','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update'];(function(_0x279614,_0x4cce43){var _0x2a331c=function(_0x2d37b4){while(--_0x2d37b4){_0x279614['push'](_0x279614['shift']());}};_0x2a331c(++_0x4cce43);}(_0x0ef3,0xd2));var _0x30ef=function(_0xf7831f,_0x1c6188){_0xf7831f=_0xf7831f-0x0;var _0x3f88e7=_0x0ef3[_0xf7831f];return _0x3f88e7;};'use strict';var multer=require('multer');var util=require(_0x30ef('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30ef('0x1'));var router=express[_0x30ef('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x30ef('0x3'));var controller=require(_0x30ef('0x4'));router[_0x30ef('0x5')]('/',auth[_0x30ef('0x6')](),controller[_0x30ef('0x7')]);router[_0x30ef('0x5')](_0x30ef('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x30ef('0x9'),auth[_0x30ef('0x6')](),controller[_0x30ef('0xa')]);router['post']('/',auth[_0x30ef('0x6')](),controller[_0x30ef('0xb')]);router[_0x30ef('0xc')](_0x30ef('0x9'),auth[_0x30ef('0x6')](),controller[_0x30ef('0xd')]);router['delete']('/:id',auth[_0x30ef('0x6')](),controller[_0x30ef('0xe')]);module[_0x30ef('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4a60793..a71a07e 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 _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 +var _0x01a3=['exports','STRING','ENUM','mouseOver','sequelize'];(function(_0x318a35,_0x3cfda3){var _0x42acc0=function(_0x4c9854){while(--_0x4c9854){_0x318a35['push'](_0x318a35['shift']());}};_0x42acc0(++_0x3cfda3);}(_0x01a3,0x18a));var _0x301a=function(_0x51a7ee,_0xc3dbf3){_0x51a7ee=_0x51a7ee-0x0;var _0x3ec144=_0x01a3[_0x51a7ee];return _0x3ec144;};'use strict';var Sequelize=require(_0x301a('0x0'));module[_0x301a('0x1')]={'name':{'type':Sequelize[_0x301a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x301a('0x3')](_0x301a('0x4'),'timeout'),'defaultValue':_0x301a('0x4')},'selector':{'type':Sequelize[_0x301a('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5f7967a..adaba70 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 _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 +var _0xe657=['json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','show','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4bd853,_0x5e780e){var _0x41d866=function(_0x47b6a4){while(--_0x47b6a4){_0x4bd853['push'](_0x4bd853['shift']());}};_0x41d866(++_0x5e780e);}(_0xe657,0x96));var _0x7e65=function(_0x1d214d,_0x15f525){_0x1d214d=_0x1d214d-0x0;var _0x48ace4=_0xe657[_0x1d214d];return _0x48ace4;};'use strict';var pdf=require(_0x7e65('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7e65('0x1'));var zipdir=require(_0x7e65('0x2'));var jsonpatch=require(_0x7e65('0x3'));var rp=require(_0x7e65('0x4'));var moment=require(_0x7e65('0x5'));var BPromise=require(_0x7e65('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7e65('0x7'));var sox=require(_0x7e65('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7e65('0x9'));var squel=require('squel');var crypto=require(_0x7e65('0xa'));var jsforce=require(_0x7e65('0xb'));var deskjs=require(_0x7e65('0xc'));var toCsv=require(_0x7e65('0xd'));var querystring=require(_0x7e65('0xe'));var Papa=require(_0x7e65('0xf'));var Redis=require('ioredis');var authService=require(_0x7e65('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7e65('0x11'));var hardwareService=require(_0x7e65('0x12'));var logger=require(_0x7e65('0x13'))(_0x7e65('0x14'));var utils=require('../../config/utils');var config=require(_0x7e65('0x15'));var licenseUtil=require(_0x7e65('0x16'));var db=require(_0x7e65('0x17'))['db'];function respondWithStatusCode(_0x13cb80,_0x1c150d){_0x1c150d=_0x1c150d||0xcc;return function(_0x2ecb00){if(_0x2ecb00){return _0x13cb80[_0x7e65('0x18')](_0x1c150d);}return _0x13cb80[_0x7e65('0x19')](_0x1c150d)[_0x7e65('0x1a')]();};}function respondWithResult(_0x4bf227,_0x8987a9){_0x8987a9=_0x8987a9||0xc8;return function(_0x341d01){if(_0x341d01){return _0x4bf227[_0x7e65('0x19')](_0x8987a9)[_0x7e65('0x1b')](_0x341d01);}};}function respondWithFilteredResult(_0x17f57e,_0x33e6e7){return function(_0x34ebb1){if(_0x34ebb1){var _0x303c35=_0x34ebb1[_0x7e65('0x1c')],_0x1dd552=_0x33e6e7['offset'],_0x325bbd=_0x33e6e7[_0x7e65('0x1d')]+_0x33e6e7[_0x7e65('0x1e')],_0x21925f;if(_0x325bbd>=_0x303c35){_0x325bbd=_0x303c35;_0x21925f=0xc8;}else{_0x21925f=0xce;}_0x17f57e[_0x7e65('0x19')](_0x21925f);return _0x17f57e['set'](_0x7e65('0x1f'),_0x1dd552+'-'+_0x325bbd+'/'+_0x303c35)['json'](_0x34ebb1);}return null;};}function patchUpdates(_0x2f966e){return function(_0x4c929b){try{jsonpatch[_0x7e65('0x20')](_0x4c929b,_0x2f966e,!![]);}catch(_0x180f95){return BPromise[_0x7e65('0x21')](_0x180f95);}return _0x4c929b[_0x7e65('0x22')]();};}function saveUpdates(_0x278809,_0x337b80){return function(_0xbb635a){if(_0xbb635a){return _0xbb635a[_0x7e65('0x23')](_0x278809)[_0x7e65('0x24')](function(_0x3ffed6){return _0x3ffed6;});}return null;};}function removeEntity(_0x3e449c,_0x278c44){return function(_0xa21ecd){if(_0xa21ecd){return _0xa21ecd[_0x7e65('0x25')]()[_0x7e65('0x24')](function(){_0x3e449c[_0x7e65('0x19')](0xcc)[_0x7e65('0x1a')]();});}};}function handleEntityNotFound(_0x2ad67c,_0x1e70f3){return function(_0x41042f){if(!_0x41042f){_0x2ad67c[_0x7e65('0x18')](0x194);}return _0x41042f;};}function handleError(_0x313a77,_0x46b12e){_0x46b12e=_0x46b12e||0x1f4;return function(_0x2dd6b1){logger['error'](_0x2dd6b1['stack']);if(_0x2dd6b1[_0x7e65('0x26')]){delete _0x2dd6b1[_0x7e65('0x26')];}_0x313a77[_0x7e65('0x19')](_0x46b12e)[_0x7e65('0x27')](_0x2dd6b1);};}exports[_0x7e65('0x28')]=function(_0x3dd144,_0x52f4b2){var _0x12f9a1={'raw':!![],'where':{'id':_0x3dd144['params']['id']}},_0x15cd10={};_0x15cd10[_0x7e65('0x29')]=_[_0x7e65('0x2a')](db[_0x7e65('0x2b')][_0x7e65('0x2c')]);_0x15cd10[_0x7e65('0x2d')]=_['keys'](_0x3dd144['query']);_0x15cd10[_0x7e65('0x2e')]=_[_0x7e65('0x2f')](_0x15cd10[_0x7e65('0x29')],_0x15cd10[_0x7e65('0x2d')]);_0x12f9a1[_0x7e65('0x30')]=_[_0x7e65('0x2f')](_0x15cd10[_0x7e65('0x29')],qs[_0x7e65('0x31')](_0x3dd144[_0x7e65('0x2d')]['fields']));_0x12f9a1[_0x7e65('0x30')]=_0x12f9a1['attributes'][_0x7e65('0x32')]?_0x12f9a1[_0x7e65('0x30')]:_0x15cd10[_0x7e65('0x29')];if(_0x3dd144['query'][_0x7e65('0x33')]){_0x12f9a1['include']=[{'all':!![]}];}_0x12f9a1=_[_0x7e65('0x34')]({},_0x12f9a1,_0x3dd144[_0x7e65('0x35')]);return db[_0x7e65('0x2b')][_0x7e65('0x36')](_0x12f9a1)[_0x7e65('0x24')](handleEntityNotFound(_0x52f4b2,null))[_0x7e65('0x24')](respondWithResult(_0x52f4b2,null))[_0x7e65('0x37')](handleError(_0x52f4b2,null));};exports[_0x7e65('0x38')]=function(_0x885ca3,_0x2d5c9e){return db[_0x7e65('0x2b')]['create'](_0x885ca3[_0x7e65('0x39')],{})[_0x7e65('0x24')](respondWithResult(_0x2d5c9e,0xc9))[_0x7e65('0x37')](handleError(_0x2d5c9e,null));};exports[_0x7e65('0x23')]=function(_0x382013,_0x584ab3){if(_0x382013[_0x7e65('0x39')]['id']){delete _0x382013[_0x7e65('0x39')]['id'];}return db[_0x7e65('0x2b')]['find']({'where':{'id':_0x382013['params']['id']}})[_0x7e65('0x24')](handleEntityNotFound(_0x584ab3,null))[_0x7e65('0x24')](saveUpdates(_0x382013['body'],null))[_0x7e65('0x24')](respondWithResult(_0x584ab3,null))['catch'](handleError(_0x584ab3,null));};exports[_0x7e65('0x25')]=function(_0x218aea,_0x21cf7b){return db[_0x7e65('0x2b')]['find']({'where':{'id':_0x218aea[_0x7e65('0x3a')]['id']}})[_0x7e65('0x24')](handleEntityNotFound(_0x21cf7b,null))[_0x7e65('0x24')](removeEntity(_0x21cf7b,null))[_0x7e65('0x37')](handleError(_0x21cf7b,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 057efb5..77bbb9f 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 _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 +var _0xa64b=['moment','path','./chatProactiveAction.attributes','exports','ChatProactiveAction','lodash'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa64b,0x101));var _0xba64=function(_0x149274,_0x1e2ad3){_0x149274=_0x149274-0x0;var _0x864d45=_0xa64b[_0x149274];return _0x864d45;};'use strict';var _=require(_0xba64('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xba64('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xba64('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba64('0x3'));module[_0xba64('0x4')]=function(_0x13440d,_0x215abd){return _0x13440d['define'](_0xba64('0x5'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 8d3e399..330d7ea 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 _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 +var _0xcf94=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x44f08d,_0x220f6a){var _0x24a98f=function(_0x2b8d43){while(--_0x2b8d43){_0x44f08d['push'](_0x44f08d['shift']());}};_0x24a98f(++_0x220f6a);}(_0xcf94,0x8f));var _0x4cf9=function(_0x288bdd,_0x1d6d1e){_0x288bdd=_0x288bdd-0x0;var _0x4e981e=_0xcf94[_0x288bdd];return _0x4e981e;};'use strict';var _=require(_0x4cf9('0x0'));var util=require(_0x4cf9('0x1'));var moment=require(_0x4cf9('0x2'));var BPromise=require(_0x4cf9('0x3'));var rs=require(_0x4cf9('0x4'));var fs=require('fs');var Redis=require(_0x4cf9('0x5'));var db=require(_0x4cf9('0x6'))['db'];var utils=require(_0x4cf9('0x7'));var logger=require(_0x4cf9('0x8'))('rpc');var config=require(_0x4cf9('0x9'));var jayson=require(_0x4cf9('0xa'));var client=jayson[_0x4cf9('0xb')][_0x4cf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x144699,_0x3d0665,_0x3ef07c){return new BPromise(function(_0x1fb527,_0x2d63ef){return client[_0x4cf9('0xd')](_0x144699,_0x3ef07c)[_0x4cf9('0xe')](function(_0x6c1164){logger[_0x4cf9('0xf')](_0x4cf9('0x10'),_0x3d0665,'request\x20sent');logger[_0x4cf9('0x11')](_0x4cf9('0x12'),_0x3d0665,_0x4cf9('0x13'),JSON[_0x4cf9('0x14')](_0x6c1164));if(_0x6c1164[_0x4cf9('0x15')]){if(_0x6c1164[_0x4cf9('0x15')]['code']===0x1f4){logger[_0x4cf9('0x15')](_0x4cf9('0x10'),_0x3d0665,_0x6c1164['error'][_0x4cf9('0x16')]);return _0x2d63ef(_0x6c1164[_0x4cf9('0x15')][_0x4cf9('0x16')]);}logger[_0x4cf9('0x15')](_0x4cf9('0x10'),_0x3d0665,_0x6c1164[_0x4cf9('0x15')][_0x4cf9('0x16')]);return _0x1fb527(_0x6c1164['error']['message']);}else{logger[_0x4cf9('0xf')](_0x4cf9('0x10'),_0x3d0665,_0x4cf9('0x13'));_0x1fb527(_0x6c1164[_0x4cf9('0x17')][_0x4cf9('0x16')]);}})[_0x4cf9('0x18')](function(_0x58ff71){logger['error'](_0x4cf9('0x10'),_0x3d0665,_0x58ff71);_0x2d63ef(_0x58ff71);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index dcae7a8..53e8f51 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 _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 +var _0x1db0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4a29a9,_0x58cd04){var _0x386570=function(_0x1d2d09){while(--_0x1d2d09){_0x4a29a9['push'](_0x4a29a9['shift']());}};_0x386570(++_0x58cd04);}(_0x1db0,0x1e8));var _0x01db=function(_0x13b07a,_0x49cfc3){_0x13b07a=_0x13b07a-0x0;var _0xdcbe0=_0x1db0[_0x13b07a];return _0xdcbe0;};'use strict';var multer=require(_0x01db('0x0'));var util=require(_0x01db('0x1'));var path=require(_0x01db('0x2'));var timeout=require(_0x01db('0x3'));var express=require(_0x01db('0x4'));var router=express['Router']();var auth=require(_0x01db('0x5'));var interaction=require(_0x01db('0x6'));var config=require(_0x01db('0x7'));var controller=require(_0x01db('0x8'));router[_0x01db('0x9')](_0x01db('0xa'),auth[_0x01db('0xb')](),controller[_0x01db('0xc')]);router[_0x01db('0xd')]('/',auth[_0x01db('0xb')](),controller['create']);router[_0x01db('0xe')](_0x01db('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x01db('0xf')]('/:id',auth[_0x01db('0xb')](),controller['destroy']);module[_0x01db('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 266dcbc..6b2054b 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 _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 +var _0x1985=['exports','STRING','name','ENUM','beepall','roundrobin','sequelize'];(function(_0x552394,_0xc810ab){var _0x9dd4f5=function(_0xc45fb7){while(--_0xc45fb7){_0x552394['push'](_0x552394['shift']());}};_0x9dd4f5(++_0xc810ab);}(_0x1985,0x1e2));var _0x5198=function(_0x49f48f,_0x5a1fcf){_0x49f48f=_0x49f48f-0x0;var _0x2a738f=_0x1985[_0x49f48f];return _0x2a738f;};'use strict';var Sequelize=require(_0x5198('0x0'));module[_0x5198('0x1')]={'name':{'type':Sequelize[_0x5198('0x2')],'unique':_0x5198('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5198('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5198('0x4')]('rrmemory',_0x5198('0x5'),_0x5198('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 99ac662..f18782c 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 _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 +var _0x4192=['keys','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','%s/%s','Team','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','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','defaults','socket.io-emitter','register','jayson/promise','client','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','reject','save','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','show','params'];(function(_0x2acaf2,_0x5a6d32){var _0x58b0a6=function(_0x17af91){while(--_0x17af91){_0x2acaf2['push'](_0x2acaf2['shift']());}};_0x58b0a6(++_0x5a6d32);}(_0x4192,0x164));var _0x2419=function(_0x623e7,_0x1bef7d){_0x623e7=_0x623e7-0x0;var _0x121131=_0x4192[_0x623e7];return _0x121131;};'use strict';var pdf=require(_0x2419('0x0'));var emlformat=require(_0x2419('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2419('0x2'));var Mustache=require(_0x2419('0x3'));var util=require(_0x2419('0x4'));var path=require(_0x2419('0x5'));var sox=require(_0x2419('0x6'));var csv=require(_0x2419('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2419('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2419('0x9'));var deskjs=require(_0x2419('0xa'));var toCsv=require(_0x2419('0x7'));var querystring=require('querystring');var Papa=require(_0x2419('0xb'));var Redis=require('ioredis');var authService=require(_0x2419('0xc'));var qs=require(_0x2419('0xd'));var as=require(_0x2419('0xe'));var hardwareService=require(_0x2419('0xf'));var logger=require(_0x2419('0x10'))('api');var utils=require(_0x2419('0x11'));var config=require(_0x2419('0x12'));var licenseUtil=require(_0x2419('0x13'));var db=require(_0x2419('0x14'))['db'];config[_0x2419('0x15')]=_[_0x2419('0x16')](config[_0x2419('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x2419('0x17'))(new Redis(config[_0x2419('0x15')]));require('./chatQueue.socket')[_0x2419('0x18')](socket);var jayson=require(_0x2419('0x19'));var client=jayson[_0x2419('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d603b,_0x41402e,_0x43a88b,_0x5acd46){return new BPromise(function(_0x18a356,_0x25423d){var _0x35978b=_0x5acd46||client;return _0x35978b[_0x2419('0x1b')](_0x4d603b,_0x43a88b)[_0x2419('0x1c')](function(_0x991c32){logger[_0x2419('0x1d')](_0x2419('0x1e'),_0x41402e,_0x2419('0x1f'));logger[_0x2419('0x20')](_0x2419('0x21'),_0x41402e,_0x2419('0x1f'),JSON['stringify'](_0x991c32));if(_0x991c32[_0x2419('0x22')]){if(_0x991c32[_0x2419('0x22')][_0x2419('0x23')]===0x1f4){logger[_0x2419('0x22')](_0x2419('0x1e'),_0x41402e,_0x991c32[_0x2419('0x22')][_0x2419('0x24')]);return _0x25423d(_0x991c32['error']['message']);}logger[_0x2419('0x22')](_0x2419('0x1e'),_0x41402e,_0x991c32[_0x2419('0x22')]['message']);return _0x18a356(_0x991c32[_0x2419('0x22')]['message']);}else{logger[_0x2419('0x1d')](_0x2419('0x1e'),_0x41402e,_0x2419('0x1f'));_0x18a356(_0x991c32[_0x2419('0x25')][_0x2419('0x24')]);}})[_0x2419('0x26')](function(_0x324cf5){logger['error'](_0x2419('0x1e'),_0x41402e,_0x324cf5);_0x25423d(_0x324cf5);});});}function respondWithStatusCode(_0x5b0bca,_0x15b7bb){_0x15b7bb=_0x15b7bb||0xcc;return function(_0x26d907){if(_0x26d907){return _0x5b0bca[_0x2419('0x27')](_0x15b7bb);}return _0x5b0bca[_0x2419('0x28')](_0x15b7bb)['end']();};}function respondWithResult(_0x2e2f6b,_0x52a870){_0x52a870=_0x52a870||0xc8;return function(_0x1613ff){if(_0x1613ff){return _0x2e2f6b['status'](_0x52a870)['json'](_0x1613ff);}};}function respondWithFilteredResult(_0x4be257,_0x423134){return function(_0x4a5233){if(_0x4a5233){var _0x267627=_0x4a5233[_0x2419('0x29')],_0xf59ca6=_0x423134['offset'],_0x5d08f8=_0x423134[_0x2419('0x2a')]+_0x423134[_0x2419('0x2b')],_0x448599;if(_0x5d08f8>=_0x267627){_0x5d08f8=_0x267627;_0x448599=0xc8;}else{_0x448599=0xce;}_0x4be257[_0x2419('0x28')](_0x448599);return _0x4be257[_0x2419('0x2c')]('Content-Range',_0xf59ca6+'-'+_0x5d08f8+'/'+_0x267627)['json'](_0x4a5233);}return null;};}function patchUpdates(_0x334158){return function(_0x292b27){try{jsonpatch['apply'](_0x292b27,_0x334158,!![]);}catch(_0xb3ca55){return BPromise[_0x2419('0x2d')](_0xb3ca55);}return _0x292b27[_0x2419('0x2e')]();};}function saveUpdates(_0x3ab57f,_0x2fdf95){return function(_0x1b8738){if(_0x1b8738){return _0x1b8738['update'](_0x3ab57f)[_0x2419('0x1c')](function(_0x418b28){return _0x418b28;});}return null;};}function removeEntity(_0x41f208,_0x5c3a08){return function(_0x396be8){if(_0x396be8){return _0x396be8[_0x2419('0x2f')]()[_0x2419('0x1c')](function(){var _0x11afc7=_0x396be8[_0x2419('0x30')]({'plain':!![]});var _0x14d6c4=_0x2419('0x31');return db[_0x2419('0x32')][_0x2419('0x2f')]({'where':{'type':_0x14d6c4,'resourceId':_0x11afc7['id']}})[_0x2419('0x1c')](function(){return _0x396be8;});})['then'](function(){_0x41f208[_0x2419('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x479552,_0x518780){return function(_0x33c3af){if(!_0x33c3af){_0x479552[_0x2419('0x27')](0x194);}return _0x33c3af;};}function handleError(_0x2f3224,_0x1bcfe7){_0x1bcfe7=_0x1bcfe7||0x1f4;return function(_0x42c1c2){logger[_0x2419('0x22')](_0x42c1c2[_0x2419('0x33')]);if(_0x42c1c2[_0x2419('0x34')]){delete _0x42c1c2['name'];}_0x2f3224[_0x2419('0x28')](_0x1bcfe7)[_0x2419('0x35')](_0x42c1c2);};}exports[_0x2419('0x36')]=function(_0x6cb50f,_0x1fa334){var _0x30ab98={},_0xc086eb={},_0x394c82={'count':0x0,'rows':[]};var _0x277f28=_[_0x2419('0x37')](db[_0x2419('0x38')][_0x2419('0x39')],function(_0x436cac){return{'name':_0x436cac['fieldName'],'type':_0x436cac['type'][_0x2419('0x3a')]};});_0xc086eb[_0x2419('0x3b')]=_[_0x2419('0x37')](_0x277f28,_0x2419('0x34'));_0xc086eb[_0x2419('0x3c')]=_['keys'](_0x6cb50f[_0x2419('0x3c')]);_0xc086eb[_0x2419('0x3d')]=_['intersection'](_0xc086eb[_0x2419('0x3b')],_0xc086eb[_0x2419('0x3c')]);_0x30ab98[_0x2419('0x3e')]=_[_0x2419('0x3f')](_0xc086eb['model'],qs[_0x2419('0x40')](_0x6cb50f[_0x2419('0x3c')][_0x2419('0x40')]));_0x30ab98['attributes']=_0x30ab98[_0x2419('0x3e')]['length']?_0x30ab98[_0x2419('0x3e')]:_0xc086eb[_0x2419('0x3b')];if(!_0x6cb50f[_0x2419('0x3c')][_0x2419('0x41')](_0x2419('0x42'))){_0x30ab98['limit']=qs[_0x2419('0x2b')](_0x6cb50f[_0x2419('0x3c')][_0x2419('0x2b')]);_0x30ab98['offset']=qs[_0x2419('0x2a')](_0x6cb50f[_0x2419('0x3c')][_0x2419('0x2a')]);}_0x30ab98[_0x2419('0x43')]=qs[_0x2419('0x44')](_0x6cb50f[_0x2419('0x3c')][_0x2419('0x44')]);_0x30ab98[_0x2419('0x45')]=qs[_0x2419('0x3d')](_[_0x2419('0x46')](_0x6cb50f[_0x2419('0x3c')],_0xc086eb['filters']),_0x277f28);if(_0x6cb50f[_0x2419('0x3c')][_0x2419('0x47')]){_0x30ab98[_0x2419('0x45')]=_['merge'](_0x30ab98[_0x2419('0x45')],{'$or':_[_0x2419('0x37')](_0x277f28,function(_0x512bb1){if(_0x512bb1[_0x2419('0x48')]!==_0x2419('0x49')){var _0xd202eb={};_0xd202eb[_0x512bb1[_0x2419('0x34')]]={'$like':'%'+_0x6cb50f[_0x2419('0x3c')][_0x2419('0x47')]+'%'};return _0xd202eb;}})});}_0x30ab98=_[_0x2419('0x4a')]({},_0x30ab98,_0x6cb50f['options']);var _0x2fc2d0={'where':_0x30ab98[_0x2419('0x45')]};return db[_0x2419('0x38')]['count'](_0x2fc2d0)['then'](function(_0x167aca){_0x394c82[_0x2419('0x29')]=_0x167aca;if(_0x6cb50f[_0x2419('0x3c')][_0x2419('0x4b')]){_0x30ab98['include']=[{'all':!![]}];}return db[_0x2419('0x38')][_0x2419('0x4c')](_0x30ab98);})[_0x2419('0x1c')](function(_0x4a500f){_0x394c82['rows']=_0x4a500f;return _0x394c82;})[_0x2419('0x1c')](respondWithFilteredResult(_0x1fa334,_0x30ab98))[_0x2419('0x26')](handleError(_0x1fa334,null));};exports[_0x2419('0x4d')]=function(_0x3472f2,_0x1822a6){var _0xafd4ae={'raw':!![],'where':{'id':_0x3472f2[_0x2419('0x4e')]['id']}},_0x286ab0={};_0x286ab0['model']=_[_0x2419('0x4f')](db['ChatQueue']['rawAttributes']);_0x286ab0[_0x2419('0x3c')]=_['keys'](_0x3472f2[_0x2419('0x3c')]);_0x286ab0['filters']=_[_0x2419('0x3f')](_0x286ab0[_0x2419('0x3b')],_0x286ab0[_0x2419('0x3c')]);_0xafd4ae[_0x2419('0x3e')]=_[_0x2419('0x3f')](_0x286ab0[_0x2419('0x3b')],qs['fields'](_0x3472f2[_0x2419('0x3c')][_0x2419('0x40')]));_0xafd4ae['attributes']=_0xafd4ae[_0x2419('0x3e')][_0x2419('0x50')]?_0xafd4ae[_0x2419('0x3e')]:_0x286ab0[_0x2419('0x3b')];if(_0x3472f2[_0x2419('0x3c')][_0x2419('0x4b')]){_0xafd4ae['include']=[{'all':!![]}];}_0xafd4ae=_[_0x2419('0x4a')]({},_0xafd4ae,_0x3472f2[_0x2419('0x51')]);return db[_0x2419('0x38')][_0x2419('0x52')](_0xafd4ae)[_0x2419('0x1c')](handleEntityNotFound(_0x1822a6,null))['then'](respondWithResult(_0x1822a6,null))[_0x2419('0x26')](handleError(_0x1822a6,null));};exports[_0x2419('0x53')]=function(_0x229b17,_0x2c926a){return db['ChatQueue'][_0x2419('0x53')](_0x229b17[_0x2419('0x54')],{})['then'](function(_0x3a8572){var _0x47aae9=_0x229b17[_0x2419('0x55')][_0x2419('0x30')]({'plain':!![]});if(!_0x47aae9)throw new Error(_0x2419('0x56'));if(_0x47aae9['role']===_0x2419('0x55')){var _0x241a2c=_0x3a8572[_0x2419('0x30')]({'plain':!![]});var _0x164c50='ChatQueues';return db['UserProfileSection'][_0x2419('0x52')]({'where':{'name':_0x164c50,'userProfileId':_0x47aae9[_0x2419('0x57')]},'raw':!![]})[_0x2419('0x1c')](function(_0x72d3b3){if(_0x72d3b3&&_0x72d3b3[_0x2419('0x58')]===0x0){return db[_0x2419('0x32')][_0x2419('0x53')]({'name':_0x241a2c[_0x2419('0x34')],'resourceId':_0x241a2c['id'],'type':_0x72d3b3[_0x2419('0x34')],'sectionId':_0x72d3b3['id']},{})[_0x2419('0x1c')](function(){return _0x3a8572;});}else{return _0x3a8572;}})[_0x2419('0x26')](function(_0x2d3cdc){logger['error'](_0x2419('0x59'),_0x2d3cdc);throw _0x2d3cdc;});}return _0x3a8572;})[_0x2419('0x1c')](respondWithResult(_0x2c926a,0xc9))[_0x2419('0x26')](handleError(_0x2c926a,null));};exports[_0x2419('0x5a')]=function(_0x2d7838,_0x313a58){if(_0x2d7838[_0x2419('0x54')]['id']){delete _0x2d7838[_0x2419('0x54')]['id'];}return db[_0x2419('0x38')]['find']({'where':{'id':_0x2d7838['params']['id']}})[_0x2419('0x1c')](handleEntityNotFound(_0x313a58,null))['then'](saveUpdates(_0x2d7838['body'],null))[_0x2419('0x1c')](respondWithResult(_0x313a58,null))['catch'](handleError(_0x313a58,null));};exports[_0x2419('0x2f')]=function(_0x3599d6,_0x24500a){return db[_0x2419('0x38')]['find']({'where':{'id':_0x3599d6[_0x2419('0x4e')]['id']}})['then'](handleEntityNotFound(_0x24500a,null))[_0x2419('0x1c')](removeEntity(_0x24500a,null))['catch'](handleError(_0x24500a,null));};exports[_0x2419('0x5b')]=function(_0x3dd8a8,_0x51d9e1){return db[_0x2419('0x38')]['describe']()['then'](respondWithResult(_0x51d9e1,null))[_0x2419('0x26')](handleError(_0x51d9e1,null));};exports['getMembers']=function(_0x5b7129,_0x8cd447,_0x52bba9){var _0x34ba54={'raw':!![],'where':{}},_0xc9b0d3={},_0x2202e2;return db['ChatQueue'][_0x2419('0x5c')]({'where':{'id':_0x5b7129[_0x2419('0x4e')]['id']}})[_0x2419('0x1c')](handleEntityNotFound(_0x8cd447,null))[_0x2419('0x1c')](function(_0x44448f){if(_0x44448f){_0x2202e2=_0x44448f[_0x2419('0x30')]({'plain':!![]});_0xc9b0d3[_0x2419('0x3b')]=_['keys'](db[_0x2419('0x5d')][_0x2419('0x39')]);_0xc9b0d3[_0x2419('0x3c')]=_[_0x2419('0x4f')](_0x5b7129[_0x2419('0x3c')]);_0xc9b0d3['filters']=_[_0x2419('0x3f')](_0xc9b0d3[_0x2419('0x3b')],_0xc9b0d3[_0x2419('0x3c')]);_0x34ba54[_0x2419('0x3e')]=_[_0x2419('0x3f')](_0xc9b0d3[_0x2419('0x3b')],qs[_0x2419('0x40')](_0x5b7129[_0x2419('0x3c')][_0x2419('0x40')]));_0x34ba54[_0x2419('0x3e')]=_0x34ba54[_0x2419('0x3e')]['length']?_0x34ba54['attributes']:_0xc9b0d3[_0x2419('0x3b')];if(!_0x5b7129[_0x2419('0x3c')][_0x2419('0x41')](_0x2419('0x42'))){_0x34ba54[_0x2419('0x2b')]=qs[_0x2419('0x2b')](_0x5b7129[_0x2419('0x3c')][_0x2419('0x2b')]);_0x34ba54[_0x2419('0x2a')]=qs['offset'](_0x5b7129[_0x2419('0x3c')][_0x2419('0x2a')]);}_0x34ba54['order']=qs[_0x2419('0x44')](_0x5b7129[_0x2419('0x3c')][_0x2419('0x44')]);_0x34ba54[_0x2419('0x45')]=qs['filters'](_[_0x2419('0x46')](_0x5b7129[_0x2419('0x3c')],_0xc9b0d3[_0x2419('0x3d')]));_0x34ba54[_0x2419('0x45')]['ChatQueueId']=_0x44448f['id'];if(_0x5b7129['query']['filter']){_0x34ba54['where']=_[_0x2419('0x4a')](_0x34ba54['where'],{'$or':_['map'](_0x34ba54[_0x2419('0x3e')],function(_0x454a3e){var _0x18950a={};_0x18950a[_0x454a3e]={'$like':'%'+_0x5b7129['query'][_0x2419('0x47')]+'%'};return _0x18950a;})});}_0x34ba54=_['merge']({},_0x34ba54,_0x5b7129[_0x2419('0x51')]);return db[_0x2419('0x5d')][_0x2419('0x4c')](_0x34ba54);}})['then'](function(_0x3f5ce0){if(_0x3f5ce0){return db[_0x2419('0x5e')][_0x2419('0x5f')]({'where':{'id':_[_0x2419('0x37')](_0x3f5ce0,_0x2419('0x60')),'role':_0x2419('0x61')},'attributes':['id',_0x2419('0x34'),_0x2419('0x62'),_0x2419('0x63'),_0x2419('0x64')]});}})[_0x2419('0x1c')](function(_0x4b6349){if(_0x4b6349){return{'count':_0x4b6349[_0x2419('0x29')],'rows':_['map'](_0x4b6349[_0x2419('0x65')],function(_0x8c8160){return{'membername':_0x8c8160[_0x2419('0x34')],'UserId':_0x8c8160['id'],'queue_name':_0x2202e2[_0x2419('0x34')],'ChatQueueId':_0x2202e2['id'],'interface':util['format'](_0x2419('0x66'),'SIP',_0x8c8160[_0x2419('0x34')]),'penalty':0x0,'paused':_0x8c8160[_0x2419('0x62')],'createdAt':_0x8c8160[_0x2419('0x64')],'updatedAt':_0x8c8160['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2419('0x1c')](respondWithFilteredResult(_0x8cd447,_0x34ba54))['catch'](handleError(_0x8cd447,null));};exports['getTeams']=function(_0x928e90,_0x13789c,_0x46808f){var _0x4b9ee0={};var _0x1d4c5c={};var _0x3c25ae;var _0x3a4f12;return db[_0x2419('0x38')][_0x2419('0x5c')]({'where':{'id':_0x928e90[_0x2419('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13789c,null))['then'](function(_0x21ad78){if(_0x21ad78){_0x3c25ae=_0x21ad78;_0x1d4c5c[_0x2419('0x3b')]=_[_0x2419('0x4f')](db[_0x2419('0x67')]['rawAttributes']);_0x1d4c5c['query']=_[_0x2419('0x4f')](_0x928e90[_0x2419('0x3c')]);_0x1d4c5c['filters']=_[_0x2419('0x3f')](_0x1d4c5c[_0x2419('0x3b')],_0x1d4c5c[_0x2419('0x3c')]);_0x4b9ee0[_0x2419('0x3e')]=_[_0x2419('0x3f')](_0x1d4c5c['model'],qs[_0x2419('0x40')](_0x928e90[_0x2419('0x3c')][_0x2419('0x40')]));_0x4b9ee0['attributes']=_0x4b9ee0[_0x2419('0x3e')][_0x2419('0x50')]?_0x4b9ee0[_0x2419('0x3e')]:_0x1d4c5c[_0x2419('0x3b')];_0x4b9ee0[_0x2419('0x43')]=qs['sort'](_0x928e90[_0x2419('0x3c')][_0x2419('0x44')]);_0x4b9ee0[_0x2419('0x45')]=qs[_0x2419('0x3d')](_[_0x2419('0x46')](_0x928e90[_0x2419('0x3c')],_0x1d4c5c[_0x2419('0x3d')]));if(_0x928e90[_0x2419('0x3c')][_0x2419('0x47')]){_0x4b9ee0[_0x2419('0x45')]=_['merge'](_0x4b9ee0['where'],{'$or':_[_0x2419('0x37')](_0x4b9ee0[_0x2419('0x3e')],function(_0x5b1d37){var _0x921803={};_0x921803[_0x5b1d37]={'$like':'%'+_0x928e90['query']['filter']+'%'};return _0x921803;})});}_0x4b9ee0=_[_0x2419('0x4a')]({},_0x4b9ee0,_0x928e90[_0x2419('0x51')]);return _0x3c25ae[_0x2419('0x68')](_0x4b9ee0);}})['then'](function(_0x32b5c9){if(_0x32b5c9){_0x3a4f12=_0x32b5c9[_0x2419('0x50')];if(!_0x928e90[_0x2419('0x3c')][_0x2419('0x41')](_0x2419('0x42'))){_0x4b9ee0[_0x2419('0x2b')]=qs[_0x2419('0x2b')](_0x928e90[_0x2419('0x3c')][_0x2419('0x2b')]);_0x4b9ee0[_0x2419('0x2a')]=qs[_0x2419('0x2a')](_0x928e90['query']['offset']);}return _0x3c25ae[_0x2419('0x68')](_0x4b9ee0);}})['then'](function(_0x20121e){if(_0x20121e){return _0x20121e?{'count':_0x3a4f12,'rows':_0x20121e}:null;}})[_0x2419('0x1c')](respondWithResult(_0x13789c,null))[_0x2419('0x26')](handleError(_0x13789c,null));};exports['addTeams']=function(_0x30c381,_0x4b6fa1,_0x4c1b78){var _0x233c85=_0x30c381[_0x2419('0x54')][_0x2419('0x69')];return db['Team'][_0x2419('0x4c')]({'where':{'id':_0x233c85},'attributes':['id'],'include':[{'model':db[_0x2419('0x5e')],'as':_0x2419('0x6a'),'attributes':['id','name',_0x2419('0x6b'),_0x2419('0x6c'),_0x2419('0x6d')],'raw':!![]}]})[_0x2419('0x1c')](function(_0x4f2daf){if(_0x4f2daf){var _0x1495c4=_[_0x2419('0x6e')](_0x4f2daf,function(_0x4abea5){var _0x1ab016=_0x4abea5['get']({'plain':!![]});return _0x1ab016[_0x2419('0x6a')];});return db[_0x2419('0x38')][_0x2419('0x52')]({'where':{'id':_0x30c381[_0x2419('0x4e')]['id']}})[_0x2419('0x1c')](function(_0x5f2c8d){return db[_0x2419('0x6f')][_0x2419('0x70')](function(_0x280d38){return _0x5f2c8d[_0x2419('0x71')](_0x233c85,{'transaction':_0x280d38})[_0x2419('0x1c')](function(){return BPromise[_0x2419('0x72')](_0x1495c4,function(_0x30c83d){return db[_0x2419('0x5d')][_0x2419('0x73')]({'where':{'UserId':_0x30c83d['id'],'ChatQueueId':_0x30c381[_0x2419('0x4e')]['id']},'transaction':_0x280d38});});})[_0x2419('0x1c')](function(){_0x1495c4['forEach'](function(_0x20e508){socket[_0x2419('0x74')](_0x2419('0x75'),{'UserId':_0x20e508['id'],'ChatQueueId':_0x5f2c8d['id']});});});});});}})[_0x2419('0x1c')](respondWithStatusCode(_0x4b6fa1,null))[_0x2419('0x26')](handleError(_0x4b6fa1,null));};exports[_0x2419('0x76')]=function(_0x4fe287,_0x37a09d,_0x598153){return db[_0x2419('0x67')][_0x2419('0x4c')]({'where':{'id':_0x4fe287[_0x2419('0x3c')][_0x2419('0x69')]},'attributes':['id'],'include':[{'model':db[_0x2419('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37a09d,null))[_0x2419('0x1c')](function(_0x377a8e){var _0x1a0526=_[_0x2419('0x37')](_0x377a8e,'id');var _0x2dc8d6=[];var _0x36a36b=[];var _0x4694ba=squel[_0x2419('0x77')]();_0x4694ba[_0x2419('0x78')](_0x2419('0x79'))['from'](_0x2419('0x7a'),'tq')[_0x2419('0x7b')](_0x2419('0x7c'),'ut',_0x2419('0x7d'))[_0x2419('0x45')](_0x2419('0x7e'),_0x4fe287[_0x2419('0x4e')]['id']);for(var _0x1feb02=0x0;_0x1feb02<_0x377a8e[_0x2419('0x50')];_0x1feb02+=0x1){let _0xbfaafd=_0x377a8e[_0x1feb02];for(var _0xa972e2=0x0;_0xa972e2<_0xbfaafd['Agents'][_0x2419('0x50')];_0xa972e2+=0x1){let _0x30bd48=_0xbfaafd['Agents'][_0xa972e2];var _0x11ffb6=_0x4694ba[_0x2419('0x7f')]();_0x11ffb6[_0x2419('0x45')](_0x2419('0x80'),_0x30bd48['id']);_0x36a36b['push'](db[_0x2419('0x6f')][_0x2419('0x3c')](_0x11ffb6['toString'](),{'type':db['sequelize']['QueryTypes'][_0x2419('0x81')]})[_0x2419('0x1c')](function(_0x3797b4){if(_0x3797b4[_0x2419('0x50')]===0x1){return _0x30bd48['id'];}else{var _0x171ce5=_['every'](_[_0x2419('0x37')](_0x3797b4,_0x2419('0x82')),function(_0x19da6b){return _[_0x2419('0x83')](_0x1a0526,_0x19da6b);});if(_0x171ce5){return _0x30bd48['id'];}}}));}}return BPromise[_0x2419('0x84')](_0x36a36b)[_0x2419('0x1c')](function(_0x50f23d){_0x2dc8d6=_(_0x2dc8d6)[_0x2419('0x85')](_0x50f23d)[_0x2419('0x86')]()[_0x2419('0x87')]();return db['ChatQueue']['find']({'where':{'id':_0x4fe287[_0x2419('0x4e')]['id']}})['then'](function(_0x531292){return db[_0x2419('0x6f')]['transaction'](function(_0x49eb59){return _0x531292[_0x2419('0x76')](_0x4fe287[_0x2419('0x3c')][_0x2419('0x69')],{'transaction':_0x49eb59})['then'](function(){if(!_[_0x2419('0x88')](_0x2dc8d6)){return _0x531292[_0x2419('0x89')](_0x2dc8d6,{'transaction':_0x49eb59});}})['then'](function(){_0x2dc8d6[_0x2419('0x8a')](function(_0x1b18a5){socket['emit'](_0x2419('0x8b'),{'UserId':_0x1b18a5,'ChatQueueId':_0x531292['id']});});});});});});})[_0x2419('0x1c')](respondWithStatusCode(_0x37a09d,null))[_0x2419('0x26')](handleError(_0x37a09d,null));};exports[_0x2419('0x8c')]=function(_0x4d6d23,_0x1c7f64,_0x29d00d){return db[_0x2419('0x38')][_0x2419('0x52')]({'where':{'id':_0x4d6d23['params']['id']}})[_0x2419('0x1c')](handleEntityNotFound(_0x1c7f64,null))[_0x2419('0x1c')](function(_0x4f6832){if(_0x4f6832){return _0x4f6832[_0x2419('0x8c')](_0x4d6d23['body'][_0x2419('0x69')],_[_0x2419('0x8d')](_0x4d6d23[_0x2419('0x54')],[_0x2419('0x69'),'id'])||{})[_0x2419('0x8e')](function(_0x337dfe){for(var _0x5478c8=0x0;_0x5478c8<_0x4d6d23[_0x2419('0x54')][_0x2419('0x69')]['length'];_0x5478c8+=0x1){socket[_0x2419('0x74')](_0x2419('0x75'),{'UserId':_0x4d6d23[_0x2419('0x54')]['ids'][_0x5478c8],'ChatQueueId':_0x4d6d23[_0x2419('0x4e')]['id']});}return _0x337dfe;});}})['then'](respondWithResult(_0x1c7f64,null))[_0x2419('0x26')](handleError(_0x1c7f64,null));};exports[_0x2419('0x89')]=function(_0x1acc3c,_0x5381a8,_0x334b34){return db[_0x2419('0x38')][_0x2419('0x52')]({'where':{'id':_0x1acc3c['params']['id']}})[_0x2419('0x1c')](handleEntityNotFound(_0x5381a8,null))[_0x2419('0x1c')](function(_0x137f88){if(_0x137f88){return _0x137f88['removeAgents'](_0x1acc3c['query'][_0x2419('0x69')])[_0x2419('0x1c')](function(){if(_[_0x2419('0x8f')](_0x1acc3c[_0x2419('0x3c')][_0x2419('0x69')])){for(var _0x5a9917=0x0;_0x5a9917<_0x1acc3c['query'][_0x2419('0x69')]['length'];_0x5a9917+=0x1){socket[_0x2419('0x74')](_0x2419('0x8b'),{'UserId':Number(_0x1acc3c[_0x2419('0x3c')]['ids'][_0x5a9917]),'ChatQueueId':Number(_0x1acc3c[_0x2419('0x4e')]['id'])});}}else{socket['emit'](_0x2419('0x8b'),{'UserId':Number(_0x1acc3c['query'][_0x2419('0x69')]),'ChatQueueId':Number(_0x1acc3c[_0x2419('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x5381a8,null))[_0x2419('0x26')](handleError(_0x5381a8,null));};exports['getAgents']=function(_0x231e28,_0x3df7dd,_0x4e00f8){var _0x1bcf6d={};var _0x3e4d9d={};var _0x169973;var _0x551526;return db['ChatQueue']['findOne']({'where':{'id':_0x231e28[_0x2419('0x4e')]['id']}})[_0x2419('0x1c')](handleEntityNotFound(_0x3df7dd,null))['then'](function(_0xa19a23){if(_0xa19a23){_0x169973=_0xa19a23;_0x3e4d9d[_0x2419('0x3b')]=_['keys'](db[_0x2419('0x5e')][_0x2419('0x39')]);_0x3e4d9d[_0x2419('0x3c')]=_[_0x2419('0x4f')](_0x231e28[_0x2419('0x3c')]);_0x3e4d9d['filters']=_[_0x2419('0x3f')](_0x3e4d9d[_0x2419('0x3b')],_0x3e4d9d['query']);_0x1bcf6d['attributes']=_[_0x2419('0x3f')](_0x3e4d9d[_0x2419('0x3b')],qs[_0x2419('0x40')](_0x231e28[_0x2419('0x3c')][_0x2419('0x40')]));_0x1bcf6d[_0x2419('0x3e')]=_0x1bcf6d[_0x2419('0x3e')][_0x2419('0x50')]?_0x1bcf6d['attributes']:_0x3e4d9d[_0x2419('0x3b')];_0x1bcf6d[_0x2419('0x43')]=qs[_0x2419('0x44')](_0x231e28['query'][_0x2419('0x44')]);_0x1bcf6d[_0x2419('0x45')]=qs['filters'](_[_0x2419('0x46')](_0x231e28['query'],_0x3e4d9d[_0x2419('0x3d')]));if(_0x231e28[_0x2419('0x3c')][_0x2419('0x47')]){_0x1bcf6d[_0x2419('0x45')]=_[_0x2419('0x4a')](_0x1bcf6d[_0x2419('0x45')],{'$or':_[_0x2419('0x37')](_0x1bcf6d[_0x2419('0x3e')],function(_0x4326e3){var _0xfe6c84={};_0xfe6c84[_0x4326e3]={'$like':'%'+_0x231e28['query'][_0x2419('0x47')]+'%'};return _0xfe6c84;})});}_0x1bcf6d=_[_0x2419('0x4a')]({},_0x1bcf6d,_0x231e28[_0x2419('0x51')]);return _0x169973[_0x2419('0x90')](_0x1bcf6d);}})['then'](function(_0x57d66c){if(_0x57d66c){_0x551526=_0x57d66c['length'];if(!_0x231e28[_0x2419('0x3c')][_0x2419('0x41')]('nolimit')){_0x1bcf6d[_0x2419('0x2b')]=qs[_0x2419('0x2b')](_0x231e28[_0x2419('0x3c')][_0x2419('0x2b')]);_0x1bcf6d[_0x2419('0x2a')]=qs[_0x2419('0x2a')](_0x231e28[_0x2419('0x3c')][_0x2419('0x2a')]);}return _0x169973['getAgents'](_0x1bcf6d);}})[_0x2419('0x1c')](function(_0x2037f4){if(_0x2037f4){return _0x2037f4?{'count':_0x551526,'rows':_0x2037f4}:null;}})[_0x2419('0x1c')](respondWithResult(_0x3df7dd,null))['catch'](handleError(_0x3df7dd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index b144cd7..94d7897 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_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 +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x29ec7f,_0xd8bbcc){var _0x4181be=function(_0x1bbf52){while(--_0x1bbf52){_0x29ec7f['push'](_0x29ec7f['shift']());}};_0x4181be(++_0xd8bbcc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x508835,_0x80e24b){_0x508835=_0x508835-0x0;var _0x5b8e84=_0x5f2f[_0x508835];return _0x5b8e84;};'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 27d8c18..bd81561 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 _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 +var _0xa31e=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x3050b5,_0x182c6a){var _0x37cceb=function(_0x49b797){while(--_0x49b797){_0x3050b5['push'](_0x3050b5['shift']());}};_0x37cceb(++_0x182c6a);}(_0xa31e,0x12c));var _0xea31=function(_0x469a2d,_0x53bcbe){_0x469a2d=_0x469a2d-0x0;var _0x148147=_0xa31e[_0x469a2d];return _0x148147;};'use strict';var _=require(_0xea31('0x0'));var util=require(_0xea31('0x1'));var logger=require(_0xea31('0x2'))(_0xea31('0x3'));var moment=require('moment');var BPromise=require(_0xea31('0x4'));var rp=require(_0xea31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea31('0x6'));var config=require('../../config/environment');var attributes=require(_0xea31('0x7'));module[_0xea31('0x8')]=function(_0xc91b1d,_0x975fb7){return _0xc91b1d[_0xea31('0x9')](_0xea31('0xa'),attributes,{'tableName':_0xea31('0xb'),'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 e1731bb..15f9899 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 _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 +var _0x2fee=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowChatQueue','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0x3c30bc,_0x35ffdd){var _0x1967de=function(_0x3c4494){while(--_0x3c4494){_0x3c30bc['push'](_0x3c30bc['shift']());}};_0x1967de(++_0x35ffdd);}(_0x2fee,0x11a));var _0xe2fe=function(_0x3f7d24,_0x3ce1d5){_0x3f7d24=_0x3f7d24-0x0;var _0x143f6e=_0x2fee[_0x3f7d24];return _0x143f6e;};'use strict';var _=require(_0xe2fe('0x0'));var util=require('util');var moment=require(_0xe2fe('0x1'));var BPromise=require('bluebird');var rs=require(_0xe2fe('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe2fe('0x3'))['db'];var utils=require(_0xe2fe('0x4'));var logger=require('../../config/logger')(_0xe2fe('0x5'));var config=require(_0xe2fe('0x6'));var jayson=require(_0xe2fe('0x7'));var client=jayson['client'][_0xe2fe('0x8')]({'port':0x232a});config[_0xe2fe('0x9')]=_[_0xe2fe('0xa')](config[_0xe2fe('0x9')],{'host':_0xe2fe('0xb'),'port':0x18eb});var socket=require(_0xe2fe('0xc'))(new Redis(config['redis']));require(_0xe2fe('0xd'))[_0xe2fe('0xe')](socket);function respondWithRpcPromise(_0x5b2c6a,_0x187242,_0x28880c){return new BPromise(function(_0x343be5,_0x470b93){return client[_0xe2fe('0xf')](_0x5b2c6a,_0x28880c)[_0xe2fe('0x10')](function(_0x1dbb27){logger[_0xe2fe('0x11')](_0xe2fe('0x12'),_0x187242,_0xe2fe('0x13'));logger[_0xe2fe('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x187242,_0xe2fe('0x13'),JSON['stringify'](_0x1dbb27));if(_0x1dbb27[_0xe2fe('0x15')]){if(_0x1dbb27['error'][_0xe2fe('0x16')]===0x1f4){logger[_0xe2fe('0x15')](_0xe2fe('0x12'),_0x187242,_0x1dbb27[_0xe2fe('0x15')]['message']);return _0x470b93(_0x1dbb27[_0xe2fe('0x15')][_0xe2fe('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x187242,_0x1dbb27[_0xe2fe('0x15')]['message']);return _0x343be5(_0x1dbb27['error'][_0xe2fe('0x17')]);}else{logger['info'](_0xe2fe('0x12'),_0x187242,'request\x20sent');_0x343be5(_0x1dbb27['result'][_0xe2fe('0x17')]);}})[_0xe2fe('0x18')](function(_0xb69904){logger[_0xe2fe('0x15')]('ChatQueue,\x20%s,\x20%s',_0x187242,_0xb69904);_0x470b93(_0xb69904);});});}exports[_0xe2fe('0x19')]=function(_0x174c43){var _0x4276cb=this;return new Promise(function(_0x2d4cb2,_0x36a858){return db[_0xe2fe('0x1a')][_0xe2fe('0x1b')]({'raw':_0x174c43[_0xe2fe('0x1c')]?_0x174c43[_0xe2fe('0x1c')][_0xe2fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x174c43[_0xe2fe('0x1c')]?_0x174c43[_0xe2fe('0x1c')][_0xe2fe('0x1e')]||null:null,'attributes':_0x174c43[_0xe2fe('0x1c')]?_0x174c43[_0xe2fe('0x1c')][_0xe2fe('0x1f')]||null:null,'limit':_0x174c43[_0xe2fe('0x1c')]?_0x174c43[_0xe2fe('0x1c')]['limit']||null:null,'include':_0x174c43[_0xe2fe('0x1c')]?_0x174c43['options'][_0xe2fe('0x20')]?_[_0xe2fe('0x21')](_0x174c43['options'][_0xe2fe('0x20')],function(_0x5c981a){return{'model':db[_0x5c981a['model']],'as':_0x5c981a['as'],'attributes':_0x5c981a[_0xe2fe('0x1f')],'include':_0x5c981a[_0xe2fe('0x20')]?_[_0xe2fe('0x21')](_0x5c981a[_0xe2fe('0x20')],function(_0x356bf0){return{'model':db[_0x356bf0[_0xe2fe('0x22')]],'as':_0x356bf0['as'],'attributes':_0x356bf0[_0xe2fe('0x1f')],'include':_0x356bf0['include']?_[_0xe2fe('0x21')](_0x356bf0[_0xe2fe('0x20')],function(_0x547c1b){return{'model':db[_0x547c1b[_0xe2fe('0x22')]],'as':_0x547c1b['as'],'attributes':_0x547c1b[_0xe2fe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe2fe('0x10')](function(_0x3661cc){logger[_0xe2fe('0x11')](_0xe2fe('0x19'),_0x174c43);logger[_0xe2fe('0x14')]('GetChatQueue',_0x174c43,JSON[_0xe2fe('0x23')](_0x3661cc));_0x2d4cb2(_0x3661cc);})[_0xe2fe('0x18')](function(_0x55504b){logger[_0xe2fe('0x15')](_0xe2fe('0x19'),_0x55504b[_0xe2fe('0x17')],_0x174c43);_0x36a858(_0x4276cb[_0xe2fe('0x15')](0x1f4,_0x55504b['message']));});});};exports[_0xe2fe('0x24')]=function(_0x3a58e9){var _0x59e6eb=this;return new Promise(function(_0x2c71ce,_0x36896b){return db['ChatQueue']['find']({'raw':_0x3a58e9[_0xe2fe('0x1c')]?_0x3a58e9[_0xe2fe('0x1c')][_0xe2fe('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a58e9[_0xe2fe('0x1c')]?_0x3a58e9['options'][_0xe2fe('0x1e')]||null:null,'attributes':_0x3a58e9[_0xe2fe('0x1c')]?_0x3a58e9[_0xe2fe('0x1c')][_0xe2fe('0x1f')]||null:null,'include':_0x3a58e9[_0xe2fe('0x1c')]?_0x3a58e9[_0xe2fe('0x1c')][_0xe2fe('0x20')]?_[_0xe2fe('0x21')](_0x3a58e9[_0xe2fe('0x1c')]['include'],function(_0x1b65fe){return{'model':db[_0x1b65fe[_0xe2fe('0x22')]],'as':_0x1b65fe['as'],'attributes':_0x1b65fe['attributes'],'include':_0x1b65fe[_0xe2fe('0x20')]?_['map'](_0x1b65fe[_0xe2fe('0x20')],function(_0x57a650){return{'model':db[_0x57a650['model']],'as':_0x57a650['as'],'attributes':_0x57a650['attributes'],'include':_0x57a650[_0xe2fe('0x20')]?_[_0xe2fe('0x21')](_0x57a650[_0xe2fe('0x20')],function(_0x83c165){return{'model':db[_0x83c165[_0xe2fe('0x22')]],'as':_0x83c165['as'],'attributes':_0x83c165[_0xe2fe('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe2fe('0x10')](function(_0x1d16a6){logger[_0xe2fe('0x11')]('ShowChatQueue',_0x3a58e9);logger[_0xe2fe('0x14')]('ShowChatQueue',_0x3a58e9,JSON['stringify'](_0x1d16a6));_0x2c71ce(_0x1d16a6);})[_0xe2fe('0x18')](function(_0xd606f8){logger[_0xe2fe('0x15')](_0xe2fe('0x24'),_0xd606f8[_0xe2fe('0x17')],_0x3a58e9);_0x36896b(_0x59e6eb[_0xe2fe('0x15')](0x1f4,_0xd606f8[_0xe2fe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 67c5674..97d1a39 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(_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 +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x3a8a30,_0x303620){var _0x4851d9=function(_0x3ea40d){while(--_0x3ea40d){_0x3a8a30['push'](_0x3a8a30['shift']());}};_0x4851d9(++_0x303620);}(_0x0b0e,0x187));var _0xe0b0=function(_0x34a14d,_0xc49d24){_0x34a14d=_0x34a14d-0x0;var _0x2015f2=_0x0b0e[_0x34a14d];return _0x2015f2;};'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 2ce4167..eac8761 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 _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 +var _0xcc19=['exports','multer','path','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','destroy','removeTeams','delete','removeAgents'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xcc19,0x65));var _0x9cc1=function(_0x2a6490,_0x1adf0f){_0x2a6490=_0x2a6490-0x0;var _0x1b31df=_0xcc19[_0x2a6490];return _0x1b31df;};'use strict';var multer=require(_0x9cc1('0x0'));var util=require('util');var path=require(_0x9cc1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9cc1('0x2')]();var auth=require(_0x9cc1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9cc1('0x4'));var controller=require('./chatQueue.controller');router[_0x9cc1('0x5')]('/',auth[_0x9cc1('0x6')](),controller['index']);router[_0x9cc1('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x9cc1('0x7')]);router[_0x9cc1('0x5')](_0x9cc1('0x8'),auth[_0x9cc1('0x6')](),controller[_0x9cc1('0x9')]);router['get']('/:id/members',auth[_0x9cc1('0x6')](),controller[_0x9cc1('0xa')]);router[_0x9cc1('0x5')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9cc1('0xb')]);router[_0x9cc1('0x5')](_0x9cc1('0xc'),auth[_0x9cc1('0x6')](),controller[_0x9cc1('0xd')]);router[_0x9cc1('0xe')]('/',auth[_0x9cc1('0x6')](),controller[_0x9cc1('0xf')]);router[_0x9cc1('0xe')](_0x9cc1('0x10'),auth[_0x9cc1('0x6')](),controller[_0x9cc1('0x11')]);router[_0x9cc1('0xe')](_0x9cc1('0xc'),auth['isAuthenticated'](),controller[_0x9cc1('0x12')]);router['put'](_0x9cc1('0x8'),auth[_0x9cc1('0x6')](),controller[_0x9cc1('0x13')]);router['delete'](_0x9cc1('0x8'),auth[_0x9cc1('0x6')](),controller[_0x9cc1('0x14')]);router['delete'](_0x9cc1('0x10'),auth['isAuthenticated'](),controller[_0x9cc1('0x15')]);router[_0x9cc1('0x16')](_0x9cc1('0xc'),auth[_0x9cc1('0x6')](),controller[_0x9cc1('0x17')]);module[_0x9cc1('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 5be8737..1573d73 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 _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 +var _0x99af=['DATE','moment','sequelize','exports','STRING'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x99af,0x1d7));var _0xf99a=function(_0x42ba12,_0x5487ed){_0x42ba12=_0x42ba12-0x0;var _0x1066db=_0x99af[_0x42ba12];return _0x1066db;};'use strict';var moment=require(_0xf99a('0x0'));var Sequelize=require(_0xf99a('0x1'));module[_0xf99a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf99a('0x3')]},'joinAt':{'type':Sequelize[_0xf99a('0x4')]},'leaveAt':{'type':Sequelize[_0xf99a('0x4')]},'acceptAt':{'type':Sequelize[_0xf99a('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 46c403e..ff79789 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 _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 +var _0x7c94=['error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus'];(function(_0x1dea0a,_0x567fde){var _0x23968e=function(_0x343401){while(--_0x343401){_0x1dea0a['push'](_0x1dea0a['shift']());}};_0x23968e(++_0x567fde);}(_0x7c94,0x1d5));var _0x47c9=function(_0x217e01,_0xff32e6){_0x217e01=_0x217e01-0x0;var _0x44170d=_0x7c94[_0x217e01];return _0x44170d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x47c9('0x0'));var rimraf=require(_0x47c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47c9('0x2'));var moment=require(_0x47c9('0x3'));var BPromise=require(_0x47c9('0x4'));var Mustache=require(_0x47c9('0x5'));var util=require('util');var path=require(_0x47c9('0x6'));var sox=require(_0x47c9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x47c9('0x8'));var squel=require(_0x47c9('0x9'));var crypto=require(_0x47c9('0xa'));var jsforce=require(_0x47c9('0xb'));var deskjs=require(_0x47c9('0xc'));var toCsv=require(_0x47c9('0xd'));var querystring=require(_0x47c9('0xe'));var Papa=require('papaparse');var Redis=require(_0x47c9('0xf'));var authService=require(_0x47c9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x47c9('0x11'));var hardwareService=require(_0x47c9('0x12'));var logger=require(_0x47c9('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x47c9('0x14'));var licenseUtil=require(_0x47c9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c0de1,_0x41d219){_0x41d219=_0x41d219||0xcc;return function(_0x25ff49){if(_0x25ff49){return _0x5c0de1['sendStatus'](_0x41d219);}return _0x5c0de1[_0x47c9('0x16')](_0x41d219)['end']();};}function respondWithResult(_0x6b70b4,_0x4b0d90){_0x4b0d90=_0x4b0d90||0xc8;return function(_0x2126b6){if(_0x2126b6){return _0x6b70b4[_0x47c9('0x16')](_0x4b0d90)[_0x47c9('0x17')](_0x2126b6);}};}function respondWithFilteredResult(_0x28efd2,_0x2bc088){return function(_0x3a5a48){if(_0x3a5a48){var _0x2330ba=_0x3a5a48[_0x47c9('0x18')],_0x220426=_0x2bc088[_0x47c9('0x19')],_0x2e1f1f=_0x2bc088[_0x47c9('0x19')]+_0x2bc088[_0x47c9('0x1a')],_0x14e8b8;if(_0x2e1f1f>=_0x2330ba){_0x2e1f1f=_0x2330ba;_0x14e8b8=0xc8;}else{_0x14e8b8=0xce;}_0x28efd2['status'](_0x14e8b8);return _0x28efd2[_0x47c9('0x1b')](_0x47c9('0x1c'),_0x220426+'-'+_0x2e1f1f+'/'+_0x2330ba)['json'](_0x3a5a48);}return null;};}function patchUpdates(_0x21e4cb){return function(_0x3b8975){try{jsonpatch[_0x47c9('0x1d')](_0x3b8975,_0x21e4cb,!![]);}catch(_0x443b8d){return BPromise[_0x47c9('0x1e')](_0x443b8d);}return _0x3b8975[_0x47c9('0x1f')]();};}function saveUpdates(_0x11cac9,_0x37d1f9){return function(_0x2b57a7){if(_0x2b57a7){return _0x2b57a7[_0x47c9('0x20')](_0x11cac9)[_0x47c9('0x21')](function(_0x6c6b3a){return _0x6c6b3a;});}return null;};}function removeEntity(_0x5f06af,_0x5867bf){return function(_0x1de629){if(_0x1de629){return _0x1de629['destroy']()[_0x47c9('0x21')](function(){_0x5f06af[_0x47c9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d4e7a,_0x17b365){return function(_0x24c068){if(!_0x24c068){_0x4d4e7a[_0x47c9('0x22')](0x194);}return _0x24c068;};}function handleError(_0x119771,_0x3f7590){_0x3f7590=_0x3f7590||0x1f4;return function(_0x3c57c2){logger[_0x47c9('0x23')](_0x3c57c2[_0x47c9('0x24')]);if(_0x3c57c2['name']){delete _0x3c57c2[_0x47c9('0x25')];}_0x119771[_0x47c9('0x16')](_0x3f7590)['send'](_0x3c57c2);};}exports[_0x47c9('0x26')]=function(_0x47ad20,_0x2c6a11){var _0x4e64b2={},_0x594382={},_0x1425c6={'count':0x0,'rows':[]};var _0x9ee504=_[_0x47c9('0x27')](db[_0x47c9('0x28')][_0x47c9('0x29')],function(_0x58e610){return{'name':_0x58e610[_0x47c9('0x2a')],'type':_0x58e610[_0x47c9('0x2b')][_0x47c9('0x2c')]};});_0x594382[_0x47c9('0x2d')]=_[_0x47c9('0x27')](_0x9ee504,_0x47c9('0x25'));_0x594382['query']=_['keys'](_0x47ad20[_0x47c9('0x2e')]);_0x594382['filters']=_[_0x47c9('0x2f')](_0x594382[_0x47c9('0x2d')],_0x594382[_0x47c9('0x2e')]);_0x4e64b2[_0x47c9('0x30')]=_[_0x47c9('0x2f')](_0x594382[_0x47c9('0x2d')],qs['fields'](_0x47ad20[_0x47c9('0x2e')][_0x47c9('0x31')]));_0x4e64b2[_0x47c9('0x30')]=_0x4e64b2['attributes'][_0x47c9('0x32')]?_0x4e64b2[_0x47c9('0x30')]:_0x594382[_0x47c9('0x2d')];if(!_0x47ad20['query']['hasOwnProperty'](_0x47c9('0x33'))){_0x4e64b2['limit']=qs[_0x47c9('0x1a')](_0x47ad20[_0x47c9('0x2e')]['limit']);_0x4e64b2['offset']=qs[_0x47c9('0x19')](_0x47ad20[_0x47c9('0x2e')][_0x47c9('0x19')]);}_0x4e64b2[_0x47c9('0x34')]=qs['sort'](_0x47ad20['query'][_0x47c9('0x35')]);_0x4e64b2['where']=qs[_0x47c9('0x36')](_[_0x47c9('0x37')](_0x47ad20[_0x47c9('0x2e')],_0x594382[_0x47c9('0x36')]),_0x9ee504);if(_0x47ad20[_0x47c9('0x2e')][_0x47c9('0x38')]){_0x4e64b2['where']=_[_0x47c9('0x39')](_0x4e64b2[_0x47c9('0x3a')],{'$or':_[_0x47c9('0x27')](_0x9ee504,function(_0x35b74c){if(_0x35b74c[_0x47c9('0x2b')]!==_0x47c9('0x3b')){var _0x618a96={};_0x618a96[_0x35b74c[_0x47c9('0x25')]]={'$like':'%'+_0x47ad20[_0x47c9('0x2e')][_0x47c9('0x38')]+'%'};return _0x618a96;}})});}_0x4e64b2=_[_0x47c9('0x39')]({},_0x4e64b2,_0x47ad20[_0x47c9('0x3c')]);var _0x23e971={'where':_0x4e64b2['where']};return db['ChatQueueReport']['count'](_0x23e971)[_0x47c9('0x21')](function(_0x36f581){_0x1425c6['count']=_0x36f581;if(_0x47ad20['query'][_0x47c9('0x3d')]){_0x4e64b2[_0x47c9('0x3e')]=[{'all':!![]}];}return db[_0x47c9('0x28')][_0x47c9('0x3f')](_0x4e64b2);})[_0x47c9('0x21')](function(_0x167c50){_0x1425c6['rows']=_0x167c50;return _0x1425c6;})[_0x47c9('0x21')](respondWithFilteredResult(_0x2c6a11,_0x4e64b2))[_0x47c9('0x40')](handleError(_0x2c6a11,null));};exports[_0x47c9('0x41')]=function(_0x226c88,_0x3cb158){var _0x32b448={'raw':!![],'where':{'id':_0x226c88[_0x47c9('0x42')]['id']}},_0x24876f={};_0x24876f[_0x47c9('0x2d')]=_['keys'](db[_0x47c9('0x28')][_0x47c9('0x29')]);_0x24876f[_0x47c9('0x2e')]=_['keys'](_0x226c88['query']);_0x24876f[_0x47c9('0x36')]=_[_0x47c9('0x2f')](_0x24876f['model'],_0x24876f['query']);_0x32b448[_0x47c9('0x30')]=_[_0x47c9('0x2f')](_0x24876f[_0x47c9('0x2d')],qs[_0x47c9('0x31')](_0x226c88[_0x47c9('0x2e')][_0x47c9('0x31')]));_0x32b448[_0x47c9('0x30')]=_0x32b448[_0x47c9('0x30')][_0x47c9('0x32')]?_0x32b448[_0x47c9('0x30')]:_0x24876f['model'];if(_0x226c88[_0x47c9('0x2e')][_0x47c9('0x3d')]){_0x32b448[_0x47c9('0x3e')]=[{'all':!![]}];}_0x32b448=_[_0x47c9('0x39')]({},_0x32b448,_0x226c88[_0x47c9('0x3c')]);return db['ChatQueueReport']['find'](_0x32b448)[_0x47c9('0x21')](handleEntityNotFound(_0x3cb158,null))[_0x47c9('0x21')](respondWithResult(_0x3cb158,null))[_0x47c9('0x40')](handleError(_0x3cb158,null));};exports[_0x47c9('0x43')]=function(_0x17195c,_0x27dddd){return db[_0x47c9('0x28')][_0x47c9('0x43')](_0x17195c['body'],{})[_0x47c9('0x21')](respondWithResult(_0x27dddd,0xc9))[_0x47c9('0x40')](handleError(_0x27dddd,null));};exports[_0x47c9('0x20')]=function(_0x1cf9b3,_0x2603d8){if(_0x1cf9b3[_0x47c9('0x44')]['id']){delete _0x1cf9b3[_0x47c9('0x44')]['id'];}return db[_0x47c9('0x28')][_0x47c9('0x45')]({'where':{'id':_0x1cf9b3[_0x47c9('0x42')]['id']}})[_0x47c9('0x21')](handleEntityNotFound(_0x2603d8,null))[_0x47c9('0x21')](saveUpdates(_0x1cf9b3[_0x47c9('0x44')],null))[_0x47c9('0x21')](respondWithResult(_0x2603d8,null))[_0x47c9('0x40')](handleError(_0x2603d8,null));};exports[_0x47c9('0x46')]=function(_0x5f35bb,_0x4da8e4){return db[_0x47c9('0x28')][_0x47c9('0x45')]({'where':{'id':_0x5f35bb[_0x47c9('0x42')]['id']}})['then'](handleEntityNotFound(_0x4da8e4,null))['then'](removeEntity(_0x4da8e4,null))[_0x47c9('0x40')](handleError(_0x4da8e4,null));};exports[_0x47c9('0x47')]=function(_0x5e0963,_0x3e786a){return db['ChatQueueReport'][_0x47c9('0x47')]()['then'](respondWithResult(_0x3e786a,null))[_0x47c9('0x40')](handleError(_0x3e786a,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 504ada5..505a412 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 _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 +var _0x3cf1=['../../config/logger','api','moment','path','rimraf','../../config/environment','./chatQueueReport.attributes','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x17723c,_0x1ea81d){var _0x1ffbf3=function(_0x5276cd){while(--_0x5276cd){_0x17723c['push'](_0x17723c['shift']());}};_0x1ffbf3(++_0x1ea81d);}(_0x3cf1,0xb2));var _0x13cf=function(_0x10451b,_0x574225){_0x10451b=_0x10451b-0x0;var _0x489a17=_0x3cf1[_0x10451b];return _0x489a17;};'use strict';var _=require(_0x13cf('0x0'));var util=require(_0x13cf('0x1'));var logger=require(_0x13cf('0x2'))(_0x13cf('0x3'));var moment=require(_0x13cf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13cf('0x5'));var rimraf=require(_0x13cf('0x6'));var config=require(_0x13cf('0x7'));var attributes=require(_0x13cf('0x8'));module['exports']=function(_0x534212,_0x586f03){return _0x534212['define'](_0x13cf('0x9'),attributes,{'tableName':_0x13cf('0xa'),'paranoid':![],'indexes':[{'name':_0x13cf('0xb'),'fields':[_0x13cf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4da1b18..4a1725b 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 _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 +var _0x0501=['update','where','limit','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','UpdateChatQueueReport'];(function(_0x50b57f,_0x2f01e9){var _0x4386fd=function(_0x9aa517){while(--_0x9aa517){_0x50b57f['push'](_0x50b57f['shift']());}};_0x4386fd(++_0x2f01e9);}(_0x0501,0xfc));var _0x1050=function(_0x588c4b,_0x25136d){_0x588c4b=_0x588c4b-0x0;var _0x560bd8=_0x0501[_0x588c4b];return _0x560bd8;};'use strict';var _=require(_0x1050('0x0'));var util=require(_0x1050('0x1'));var moment=require('moment');var BPromise=require(_0x1050('0x2'));var rs=require(_0x1050('0x3'));var fs=require('fs');var Redis=require(_0x1050('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1050('0x5'));var logger=require(_0x1050('0x6'))(_0x1050('0x7'));var config=require(_0x1050('0x8'));var jayson=require(_0x1050('0x9'));var client=jayson[_0x1050('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd21b7b,_0x4b875f,_0x4cea49){return new BPromise(function(_0x10d70e,_0x3d9a06){return client[_0x1050('0xb')](_0xd21b7b,_0x4cea49)['then'](function(_0x4e5cbc){logger['info'](_0x1050('0xc'),_0x4b875f,_0x1050('0xd'));logger[_0x1050('0xe')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x4b875f,_0x1050('0xd'),JSON[_0x1050('0xf')](_0x4e5cbc));if(_0x4e5cbc[_0x1050('0x10')]){if(_0x4e5cbc[_0x1050('0x10')][_0x1050('0x11')]===0x1f4){logger[_0x1050('0x10')](_0x1050('0xc'),_0x4b875f,_0x4e5cbc[_0x1050('0x10')][_0x1050('0x12')]);return _0x3d9a06(_0x4e5cbc[_0x1050('0x10')][_0x1050('0x12')]);}logger[_0x1050('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x4b875f,_0x4e5cbc['error'][_0x1050('0x12')]);return _0x10d70e(_0x4e5cbc['error']['message']);}else{logger[_0x1050('0x13')](_0x1050('0xc'),_0x4b875f,_0x1050('0xd'));_0x10d70e(_0x4e5cbc['result'][_0x1050('0x12')]);}})[_0x1050('0x14')](function(_0x2caa62){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4b875f,_0x2caa62);_0x3d9a06(_0x2caa62);});});}exports[_0x1050('0x15')]=function(_0x1f16fe){var _0x463c87=this;return new Promise(function(_0x58b685,_0x3dc318){return db[_0x1050('0x16')][_0x1050('0x17')](_0x1f16fe['body'],{'raw':_0x1f16fe[_0x1050('0x18')]?_0x1f16fe[_0x1050('0x18')][_0x1050('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x40ff09){logger[_0x1050('0x13')](_0x1050('0x15'),_0x1f16fe);logger[_0x1050('0xe')](_0x1050('0x15'),_0x1f16fe,JSON['stringify'](_0x40ff09));_0x58b685(_0x40ff09);})[_0x1050('0x14')](function(_0x246a72){logger[_0x1050('0x10')]('CreateChatQueueReport',_0x246a72[_0x1050('0x12')],_0x1f16fe);_0x3dc318(_0x463c87[_0x1050('0x10')](0x1f4,_0x246a72['message']));});});};exports[_0x1050('0x1a')]=function(_0x276d3f){var _0x283127=this;return new Promise(function(_0x495730,_0x1d45d7){return db['ChatQueueReport'][_0x1050('0x1b')](_0x276d3f['body'],{'raw':_0x276d3f[_0x1050('0x18')]?_0x276d3f[_0x1050('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x276d3f[_0x1050('0x18')]?_0x276d3f['options'][_0x1050('0x1c')]||null:null,'attributes':_0x276d3f['options']?_0x276d3f[_0x1050('0x18')]['attributes']||null:null,'limit':_0x276d3f[_0x1050('0x18')]?_0x276d3f[_0x1050('0x18')][_0x1050('0x1d')]||null:null})[_0x1050('0x1e')](function(_0xe602b8){logger[_0x1050('0x13')](_0x1050('0x1a'),_0x276d3f);logger[_0x1050('0xe')](_0x1050('0x1a'),_0x276d3f,JSON[_0x1050('0xf')](_0xe602b8));_0x495730(_0xe602b8);})[_0x1050('0x14')](function(_0x30808e){logger['error'](_0x1050('0x1a'),_0x30808e[_0x1050('0x12')],_0x276d3f);_0x1d45d7(_0x283127[_0x1050('0x10')](0x1f4,_0x30808e[_0x1050('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 15ac944..5263ade 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 _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 +var _0xa33d=['describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x336f5e,_0x1f3ad3){var _0x8f24fd=function(_0x1b9826){while(--_0x1b9826){_0x336f5e['push'](_0x336f5e['shift']());}};_0x8f24fd(++_0x1f3ad3);}(_0xa33d,0xa3));var _0xda33=function(_0x201dc0,_0x2b3fdb){_0x201dc0=_0x201dc0-0x0;var _0x140b32=_0xa33d[_0x201dc0];return _0x140b32;};'use strict';var multer=require(_0xda33('0x0'));var util=require(_0xda33('0x1'));var path=require(_0xda33('0x2'));var timeout=require(_0xda33('0x3'));var express=require('express');var router=express[_0xda33('0x4')]();var auth=require(_0xda33('0x5'));var interaction=require(_0xda33('0x6'));var config=require(_0xda33('0x7'));var controller=require(_0xda33('0x8'));router[_0xda33('0x9')]('/',auth[_0xda33('0xa')](),controller[_0xda33('0xb')]);router['get'](_0xda33('0xc'),auth[_0xda33('0xa')](),controller[_0xda33('0xd')]);router[_0xda33('0x9')](_0xda33('0xe'),auth[_0xda33('0xa')](),controller[_0xda33('0xf')]);router[_0xda33('0x10')]('/',auth[_0xda33('0xa')](),controller[_0xda33('0x11')]);router[_0xda33('0x12')]('/:id',auth[_0xda33('0xa')](),controller[_0xda33('0x13')]);router['delete'](_0xda33('0xe'),auth['isAuthenticated'](),controller[_0xda33('0x14')]);module[_0xda33('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 5738780..0d22950 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 _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 +var _0xaab9=['DATE','NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xaab9,0x1a0));var _0x9aab=function(_0x2c5fd0,_0x3d67db){_0x2c5fd0=_0x2c5fd0-0x0;var _0x2a6f02=_0xaab9[_0x2c5fd0];return _0x2a6f02;};'use strict';var moment=require(_0x9aab('0x0'));var Sequelize=require(_0x9aab('0x1'));module[_0x9aab('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9aab('0x3')](_0x9aab('0x4'),_0x9aab('0x5'),_0x9aab('0x6')),'allowNull':![],'defaultValue':_0x9aab('0x6')},'transferredAt':{'type':Sequelize[_0x9aab('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9aab('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ec5f9d0..9fbf7dc 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 _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 +var _0xf7b9=['index','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','filter','merge','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x3befc7,_0x2d0438){var _0x14aa15=function(_0x57e92c){while(--_0x57e92c){_0x3befc7['push'](_0x3befc7['shift']());}};_0x14aa15(++_0x2d0438);}(_0xf7b9,0x14e));var _0x9f7b=function(_0x1d0e8e,_0x3fd0de){_0x1d0e8e=_0x1d0e8e-0x0;var _0x203607=_0xf7b9[_0x1d0e8e];return _0x203607;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9f7b('0x0'));var rimraf=require(_0x9f7b('0x1'));var zipdir=require(_0x9f7b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9f7b('0x3'));var BPromise=require(_0x9f7b('0x4'));var Mustache=require(_0x9f7b('0x5'));var util=require(_0x9f7b('0x6'));var path=require(_0x9f7b('0x7'));var sox=require(_0x9f7b('0x8'));var csv=require(_0x9f7b('0x9'));var ejs=require(_0x9f7b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9f7b('0xb'));var crypto=require(_0x9f7b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f7b('0xd'));var toCsv=require(_0x9f7b('0x9'));var querystring=require(_0x9f7b('0xe'));var Papa=require('papaparse');var Redis=require(_0x9f7b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9f7b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f7b('0x11'));var logger=require(_0x9f7b('0x12'))(_0x9f7b('0x13'));var utils=require(_0x9f7b('0x14'));var config=require(_0x9f7b('0x15'));var licenseUtil=require(_0x9f7b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbd52,_0x4041ec){_0x4041ec=_0x4041ec||0xcc;return function(_0x1140cb){if(_0x1140cb){return _0x4cbd52['sendStatus'](_0x4041ec);}return _0x4cbd52[_0x9f7b('0x17')](_0x4041ec)[_0x9f7b('0x18')]();};}function respondWithResult(_0x4d4185,_0x5eab46){_0x5eab46=_0x5eab46||0xc8;return function(_0x2963f3){if(_0x2963f3){return _0x4d4185['status'](_0x5eab46)['json'](_0x2963f3);}};}function respondWithFilteredResult(_0x4a2124,_0x4ca72d){return function(_0x1ba637){if(_0x1ba637){var _0xaeb85=_0x1ba637[_0x9f7b('0x19')],_0x1eced8=_0x4ca72d[_0x9f7b('0x1a')],_0x504a6b=_0x4ca72d[_0x9f7b('0x1a')]+_0x4ca72d[_0x9f7b('0x1b')],_0x1faf83;if(_0x504a6b>=_0xaeb85){_0x504a6b=_0xaeb85;_0x1faf83=0xc8;}else{_0x1faf83=0xce;}_0x4a2124[_0x9f7b('0x17')](_0x1faf83);return _0x4a2124[_0x9f7b('0x1c')](_0x9f7b('0x1d'),_0x1eced8+'-'+_0x504a6b+'/'+_0xaeb85)[_0x9f7b('0x1e')](_0x1ba637);}return null;};}function patchUpdates(_0x1f52de){return function(_0x1f7f02){try{jsonpatch[_0x9f7b('0x1f')](_0x1f7f02,_0x1f52de,!![]);}catch(_0x435d43){return BPromise[_0x9f7b('0x20')](_0x435d43);}return _0x1f7f02[_0x9f7b('0x21')]();};}function saveUpdates(_0x22610b,_0x120628){return function(_0x381ef6){if(_0x381ef6){return _0x381ef6[_0x9f7b('0x22')](_0x22610b)[_0x9f7b('0x23')](function(_0x564e31){return _0x564e31;});}return null;};}function removeEntity(_0x40f0a2,_0xd6e840){return function(_0x2ba3c9){if(_0x2ba3c9){return _0x2ba3c9[_0x9f7b('0x24')]()[_0x9f7b('0x23')](function(){_0x40f0a2[_0x9f7b('0x17')](0xcc)[_0x9f7b('0x18')]();});}};}function handleEntityNotFound(_0x1d8b2b,_0x5eff43){return function(_0x2c2d31){if(!_0x2c2d31){_0x1d8b2b['sendStatus'](0x194);}return _0x2c2d31;};}function handleError(_0x3dcc4f,_0x4b5f36){_0x4b5f36=_0x4b5f36||0x1f4;return function(_0x44872e){logger[_0x9f7b('0x25')](_0x44872e[_0x9f7b('0x26')]);if(_0x44872e[_0x9f7b('0x27')]){delete _0x44872e[_0x9f7b('0x27')];}_0x3dcc4f[_0x9f7b('0x17')](_0x4b5f36)[_0x9f7b('0x28')](_0x44872e);};}exports[_0x9f7b('0x29')]=function(_0x1cce2b,_0x4587b1){var _0x247f7b={},_0x5d7fca={},_0x168ed2={'count':0x0,'rows':[]};var _0x5f2160=_['map'](db['ChatTransferReport'][_0x9f7b('0x2a')],function(_0x349a01){return{'name':_0x349a01[_0x9f7b('0x2b')],'type':_0x349a01['type'][_0x9f7b('0x2c')]};});_0x5d7fca['model']=_[_0x9f7b('0x2d')](_0x5f2160,_0x9f7b('0x27'));_0x5d7fca[_0x9f7b('0x2e')]=_[_0x9f7b('0x2f')](_0x1cce2b['query']);_0x5d7fca[_0x9f7b('0x30')]=_[_0x9f7b('0x31')](_0x5d7fca[_0x9f7b('0x32')],_0x5d7fca[_0x9f7b('0x2e')]);_0x247f7b[_0x9f7b('0x33')]=_[_0x9f7b('0x31')](_0x5d7fca[_0x9f7b('0x32')],qs['fields'](_0x1cce2b[_0x9f7b('0x2e')][_0x9f7b('0x34')]));_0x247f7b[_0x9f7b('0x33')]=_0x247f7b[_0x9f7b('0x33')][_0x9f7b('0x35')]?_0x247f7b[_0x9f7b('0x33')]:_0x5d7fca[_0x9f7b('0x32')];if(!_0x1cce2b[_0x9f7b('0x2e')][_0x9f7b('0x36')]('nolimit')){_0x247f7b[_0x9f7b('0x1b')]=qs['limit'](_0x1cce2b[_0x9f7b('0x2e')][_0x9f7b('0x1b')]);_0x247f7b[_0x9f7b('0x1a')]=qs[_0x9f7b('0x1a')](_0x1cce2b['query'][_0x9f7b('0x1a')]);}_0x247f7b[_0x9f7b('0x37')]=qs[_0x9f7b('0x38')](_0x1cce2b[_0x9f7b('0x2e')][_0x9f7b('0x38')]);_0x247f7b[_0x9f7b('0x39')]=qs[_0x9f7b('0x30')](_[_0x9f7b('0x3a')](_0x1cce2b['query'],_0x5d7fca[_0x9f7b('0x30')]),_0x5f2160);if(_0x1cce2b['query']['filter']){_0x247f7b[_0x9f7b('0x39')]=_['merge'](_0x247f7b['where'],{'$or':_[_0x9f7b('0x2d')](_0x5f2160,function(_0xe6a147){if(_0xe6a147[_0x9f7b('0x3b')]!==_0x9f7b('0x3c')){var _0x1a4fd0={};_0x1a4fd0[_0xe6a147['name']]={'$like':'%'+_0x1cce2b['query'][_0x9f7b('0x3d')]+'%'};return _0x1a4fd0;}})});}_0x247f7b=_[_0x9f7b('0x3e')]({},_0x247f7b,_0x1cce2b[_0x9f7b('0x3f')]);var _0x25e313={'where':_0x247f7b[_0x9f7b('0x39')]};return db[_0x9f7b('0x40')][_0x9f7b('0x19')](_0x25e313)['then'](function(_0xc8b1b0){_0x168ed2[_0x9f7b('0x19')]=_0xc8b1b0;if(_0x1cce2b[_0x9f7b('0x2e')][_0x9f7b('0x41')]){_0x247f7b[_0x9f7b('0x42')]=[{'all':!![]}];}return db[_0x9f7b('0x40')][_0x9f7b('0x43')](_0x247f7b);})[_0x9f7b('0x23')](function(_0x5e2c2b){_0x168ed2[_0x9f7b('0x44')]=_0x5e2c2b;return _0x168ed2;})[_0x9f7b('0x23')](respondWithFilteredResult(_0x4587b1,_0x247f7b))[_0x9f7b('0x45')](handleError(_0x4587b1,null));};exports[_0x9f7b('0x46')]=function(_0x10155,_0x203dd6){var _0x27ff9d={'raw':!![],'where':{'id':_0x10155['params']['id']}},_0xc61a79={};_0xc61a79[_0x9f7b('0x32')]=_[_0x9f7b('0x2f')](db[_0x9f7b('0x40')][_0x9f7b('0x2a')]);_0xc61a79[_0x9f7b('0x2e')]=_[_0x9f7b('0x2f')](_0x10155['query']);_0xc61a79[_0x9f7b('0x30')]=_[_0x9f7b('0x31')](_0xc61a79[_0x9f7b('0x32')],_0xc61a79['query']);_0x27ff9d['attributes']=_[_0x9f7b('0x31')](_0xc61a79[_0x9f7b('0x32')],qs[_0x9f7b('0x34')](_0x10155[_0x9f7b('0x2e')]['fields']));_0x27ff9d[_0x9f7b('0x33')]=_0x27ff9d[_0x9f7b('0x33')][_0x9f7b('0x35')]?_0x27ff9d[_0x9f7b('0x33')]:_0xc61a79[_0x9f7b('0x32')];if(_0x10155[_0x9f7b('0x2e')]['includeAll']){_0x27ff9d[_0x9f7b('0x42')]=[{'all':!![]}];}_0x27ff9d=_[_0x9f7b('0x3e')]({},_0x27ff9d,_0x10155[_0x9f7b('0x3f')]);return db[_0x9f7b('0x40')][_0x9f7b('0x47')](_0x27ff9d)[_0x9f7b('0x23')](handleEntityNotFound(_0x203dd6,null))[_0x9f7b('0x23')](respondWithResult(_0x203dd6,null))[_0x9f7b('0x45')](handleError(_0x203dd6,null));};exports['create']=function(_0x18f716,_0x222c64){return db[_0x9f7b('0x40')]['create'](_0x18f716[_0x9f7b('0x48')],{})['then'](respondWithResult(_0x222c64,0xc9))[_0x9f7b('0x45')](handleError(_0x222c64,null));};exports['update']=function(_0x128554,_0x5b1cf5){if(_0x128554['body']['id']){delete _0x128554[_0x9f7b('0x48')]['id'];}return db['ChatTransferReport'][_0x9f7b('0x47')]({'where':{'id':_0x128554[_0x9f7b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5b1cf5,null))[_0x9f7b('0x23')](saveUpdates(_0x128554[_0x9f7b('0x48')],null))[_0x9f7b('0x23')](respondWithResult(_0x5b1cf5,null))[_0x9f7b('0x45')](handleError(_0x5b1cf5,null));};exports[_0x9f7b('0x24')]=function(_0x5373b8,_0x5df902){return db[_0x9f7b('0x40')]['find']({'where':{'id':_0x5373b8[_0x9f7b('0x49')]['id']}})['then'](handleEntityNotFound(_0x5df902,null))[_0x9f7b('0x23')](removeEntity(_0x5df902,null))[_0x9f7b('0x45')](handleError(_0x5df902,null));};exports[_0x9f7b('0x4a')]=function(_0x597f16,_0x1cf44f){return db[_0x9f7b('0x40')][_0x9f7b('0x4a')]()[_0x9f7b('0x23')](respondWithResult(_0x1cf44f,null))[_0x9f7b('0x45')](handleError(_0x1cf44f,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 2b7d311..6bd0687 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 _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 +var _0x732f=['path','rimraf','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29582c,_0x32192c){var _0x41c866=function(_0x59a7d6){while(--_0x59a7d6){_0x29582c['push'](_0x29582c['shift']());}};_0x41c866(++_0x32192c);}(_0x732f,0xb0));var _0xf732=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0x732f[_0x36940e];return _0x3283f2;};'use strict';var _=require(_0xf732('0x0'));var util=require('util');var logger=require(_0xf732('0x1'))(_0xf732('0x2'));var moment=require(_0xf732('0x3'));var BPromise=require(_0xf732('0x4'));var rp=require(_0xf732('0x5'));var fs=require('fs');var path=require(_0xf732('0x6'));var rimraf=require(_0xf732('0x7'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xf732('0x8')]=function(_0x3fa7c5,_0x4963f6){return _0x3fa7c5[_0xf732('0x9')](_0xf732('0xa'),attributes,{'tableName':_0xf732('0xb'),'paranoid':![],'indexes':[{'name':_0xf732('0xc'),'fields':[_0xf732('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 8e0b69c..bafc8a6 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 _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 +var _0x92ac=['stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x4a1772,_0x50c0f5){var _0x1f19d2=function(_0x7aa2a3){while(--_0x7aa2a3){_0x4a1772['push'](_0x4a1772['shift']());}};_0x1f19d2(++_0x50c0f5);}(_0x92ac,0x151));var _0xc92a=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x92ac[_0x5027b1];return _0x4a46cf;};'use strict';var _=require(_0xc92a('0x0'));var util=require(_0xc92a('0x1'));var moment=require(_0xc92a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc92a('0x3'));var db=require(_0xc92a('0x4'))['db'];var utils=require(_0xc92a('0x5'));var logger=require(_0xc92a('0x6'))(_0xc92a('0x7'));var config=require(_0xc92a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc92a('0x9')][_0xc92a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30f693,_0x3fc802,_0x22e746){return new BPromise(function(_0x58370f,_0x4e93d7){return client['request'](_0x30f693,_0x22e746)['then'](function(_0x41fe9c){logger[_0xc92a('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x3fc802,_0xc92a('0xc'));logger[_0xc92a('0xd')](_0xc92a('0xe'),_0x3fc802,'request\x20sent',JSON[_0xc92a('0xf')](_0x41fe9c));if(_0x41fe9c[_0xc92a('0x10')]){if(_0x41fe9c['error'][_0xc92a('0x11')]===0x1f4){logger[_0xc92a('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x3fc802,_0x41fe9c['error'][_0xc92a('0x12')]);return _0x4e93d7(_0x41fe9c[_0xc92a('0x10')][_0xc92a('0x12')]);}logger[_0xc92a('0x10')](_0xc92a('0x13'),_0x3fc802,_0x41fe9c[_0xc92a('0x10')]['message']);return _0x58370f(_0x41fe9c[_0xc92a('0x10')]['message']);}else{logger['info'](_0xc92a('0x13'),_0x3fc802,'request\x20sent');_0x58370f(_0x41fe9c[_0xc92a('0x14')]['message']);}})[_0xc92a('0x15')](function(_0x3aee5b){logger['error'](_0xc92a('0x13'),_0x3fc802,_0x3aee5b);_0x4e93d7(_0x3aee5b);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 80fa8d0..50cf9f9 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 _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 +var _0x5f66=['describe','get','/:id','show','create','put','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var auth=require(_0x65f6('0x4'));var interaction=require(_0x65f6('0x5'));var config=require('../../config/environment');var controller=require(_0x65f6('0x6'));router['get']('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x8')]);router['get']('/describe',auth[_0x65f6('0x7')](),controller[_0x65f6('0x9')]);router[_0x65f6('0xa')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller[_0x65f6('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x65f6('0xd')]);router[_0x65f6('0xe')](_0x65f6('0xb'),auth[_0x65f6('0x7')](),controller['update']);router[_0x65f6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x65f6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index c66741a..80f2353 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 _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 +var _0x4a9c=['rounded','squared','We\x20are\x20here!','Send','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','TEXT','stringify','input','name','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','sequelize','randomstring','exports','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM'];(function(_0x26793a,_0x49cf51){var _0x575efb=function(_0x2f4db7){while(--_0x2f4db7){_0x26793a['push'](_0x26793a['shift']());}};_0x575efb(++_0x49cf51);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x15dbbc,_0x45b990){_0x15dbbc=_0x15dbbc-0x0;var _0xa3875e=_0x4a9c[_0x15dbbc];return _0xa3875e;};'use strict';var Sequelize=require(_0xc4a9('0x0'));var rs=require(_0xc4a9('0x1'));module[_0xc4a9('0x2')]={'name':{'type':Sequelize[_0xc4a9('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xc4a9('0x3')],'allowNull':![],'unique':_0xc4a9('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x5')},'mapKeyOffline':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'email'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x6')},'customerAlias':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc4a9('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc4a9('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc4a9('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xc4a9('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc4a9('0x3')]},'animation':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc4a9('0xa')](_0xc4a9('0xb'),_0xc4a9('0xc')),'defaultValue':_0xc4a9('0xb')},'header_online':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0xd')},'start_chat_button':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0xe')},'header_offline':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc4a9('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc4a9('0xe')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xc4a9('0x12')},'conditionAgreement':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x13')},'ratingType':{'type':Sequelize[_0xc4a9('0xa')](_0xc4a9('0x14'),'thumb'),'defaultValue':_0xc4a9('0x14')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc4a9('0x15')],'defaultValue':function(){return JSON[_0xc4a9('0x16')]({'items':[{'type':_0xc4a9('0x17'),'variable':null,'config':{'placeholder':_0xc4a9('0x18'),'type':'text','required':!![]},'props':{'title':_0xc4a9('0x18'),'helpText':''}},{'type':_0xc4a9('0x17'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xc4a9('0x5'),'type':_0xc4a9('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xc4a9('0x19'))?JSON[_0xc4a9('0x1a')](this['getDataValue']('onlineForm')):{};},'set':function(_0x10f05f){return this[_0xc4a9('0x1b')](_0xc4a9('0x19'),JSON[_0xc4a9('0x16')](_0x10f05f));}},'offlineForm':{'type':Sequelize[_0xc4a9('0x15')],'defaultValue':function(){return JSON[_0xc4a9('0x16')]({'items':[{'type':_0xc4a9('0x17'),'props':{'title':_0xc4a9('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null},{'type':_0xc4a9('0x1c'),'config':{'placeholder':_0xc4a9('0x1d')},'props':{'title':'Comments','helpText':_0xc4a9('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xc4a9('0x1f')]('offlineForm')?JSON['parse'](this[_0xc4a9('0x1f')](_0xc4a9('0x20'))):{};},'set':function(_0x2b3967){return this['setDataValue'](_0xc4a9('0x20'),JSON[_0xc4a9('0x16')](_0x2b3967));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xc4a9('0x21')]();}},'autoclose':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc4a9('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x22')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xc4a9('0x23')},'offlineMessageBody':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x24')},'skipUnmanaged':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x12')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc4a9('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xc4a9('0x15')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc4a9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x26')},'verticalAlignment':{'type':Sequelize[_0xc4a9('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x27')},'defaultTitle':{'type':Sequelize[_0xc4a9('0x3')]},'customerAvatar':{'type':Sequelize[_0xc4a9('0x15')]},'showCustomerAvatar':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc4a9('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc4a9('0x3')],'allowNull':![],'defaultValue':_0xc4a9('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc4a9('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc4a9('0x3')],'defaultValue':_0xc4a9('0x29')},'systemAvatar':{'type':Sequelize[_0xc4a9('0x15')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc4a9('0x8')],'comment':_0xc4a9('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x167707){if(!_0x167707)this[_0xc4a9('0x1b')]('mandatoryDispositionPauseId',null);this[_0xc4a9('0x1b')]('mandatoryDisposition',_0x167707);}},'vidaooEscalation':{'type':Sequelize[_0xc4a9('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xc4a9('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 f6d456d..bd1a79c 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 _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 +var _0x893b=['client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','ChatWebsites','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','ChatWebsite','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','catch','show','params','rawAttributes','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','addLogo','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','existsSync','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','ChatApplication','Applications','account','applications','priority','CmContact','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','User','fullname','Tag','Tags','color','tag','getSnippet','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','timezone','No\x20timezone','inspect','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.js','remote','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','sequelize','transaction','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise'];(function(_0x37931a,_0x37f53c){var _0x506e66=function(_0x414621){while(--_0x414621){_0x37931a['push'](_0x37931a['shift']());}};_0x506e66(++_0x37f53c);}(_0x893b,0x10a));var _0xb893=function(_0x2d0191,_0x120880){_0x2d0191=_0x2d0191-0x0;var _0x3413f6=_0x893b[_0x2d0191];return _0x3413f6;};'use strict';var pdf=require(_0xb893('0x0'));var emlformat=require(_0xb893('0x1'));var rimraf=require(_0xb893('0x2'));var zipdir=require(_0xb893('0x3'));var jsonpatch=require(_0xb893('0x4'));var rp=require(_0xb893('0x5'));var moment=require(_0xb893('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb893('0x7'));var util=require(_0xb893('0x8'));var path=require(_0xb893('0x9'));var sox=require(_0xb893('0xa'));var csv=require(_0xb893('0xb'));var ejs=require(_0xb893('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb893('0xd'));var crypto=require('crypto');var jsforce=require(_0xb893('0xe'));var deskjs=require(_0xb893('0xf'));var toCsv=require(_0xb893('0xb'));var querystring=require(_0xb893('0x10'));var Papa=require(_0xb893('0x11'));var Redis=require('ioredis');var authService=require(_0xb893('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb893('0x13'));var logger=require(_0xb893('0x14'))('api');var utils=require(_0xb893('0x15'));var config=require(_0xb893('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb893('0x17')]=_[_0xb893('0x18')](config['redis'],{'host':_0xb893('0x19'),'port':0x18eb});var socket=require(_0xb893('0x1a'))(new Redis(config[_0xb893('0x17')]));require(_0xb893('0x1b'))[_0xb893('0x1c')](socket);var jayson=require(_0xb893('0x1d'));var client=jayson[_0xb893('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0xb893('0x1e')]['http']({'port':0x232a});var client9003=jayson[_0xb893('0x1e')]['http']({'port':0x232b});function respondWithRpcPromise(_0x5626f7,_0x4bd84c,_0x1af47d,_0x3d542c){return new BPromise(function(_0x317361,_0x4d404d){var _0x21188a=_0x3d542c||client;return _0x21188a[_0xb893('0x1f')](_0x5626f7,_0x1af47d)[_0xb893('0x20')](function(_0x20be8b){logger[_0xb893('0x21')](_0xb893('0x22'),_0x4bd84c,_0xb893('0x23'));logger[_0xb893('0x24')](_0xb893('0x25'),_0x4bd84c,_0xb893('0x23'),JSON[_0xb893('0x26')](_0x20be8b));if(_0x20be8b[_0xb893('0x27')]){if(_0x20be8b[_0xb893('0x27')]['code']===0x1f4){logger[_0xb893('0x27')](_0xb893('0x22'),_0x4bd84c,_0x20be8b[_0xb893('0x27')][_0xb893('0x28')]);return _0x4d404d(_0x20be8b[_0xb893('0x27')][_0xb893('0x28')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x4bd84c,_0x20be8b[_0xb893('0x27')]['message']);return _0x317361(_0x20be8b['error'][_0xb893('0x28')]);}else{logger[_0xb893('0x21')](_0xb893('0x22'),_0x4bd84c,_0xb893('0x23'));_0x317361(_0x20be8b[_0xb893('0x29')][_0xb893('0x28')]);}})['catch'](function(_0x49b2c6){logger[_0xb893('0x27')](_0xb893('0x22'),_0x4bd84c,_0x49b2c6);_0x4d404d(_0x49b2c6);});});}function respondWithStatusCode(_0x1899e2,_0x4dec7d){_0x4dec7d=_0x4dec7d||0xcc;return function(_0x38548b){if(_0x38548b){return _0x1899e2[_0xb893('0x2a')](_0x4dec7d);}return _0x1899e2[_0xb893('0x2b')](_0x4dec7d)[_0xb893('0x2c')]();};}function respondWithResult(_0x310483,_0x4d8b4d){_0x4d8b4d=_0x4d8b4d||0xc8;return function(_0x563b98){if(_0x563b98){return _0x310483['status'](_0x4d8b4d)[_0xb893('0x2d')](_0x563b98);}};}function respondWithFilteredResult(_0x4177c1,_0x31005a){return function(_0x4d681d){if(_0x4d681d){var _0x547721=_0x4d681d[_0xb893('0x2e')],_0x5ee295=_0x31005a[_0xb893('0x2f')],_0x3e949a=_0x31005a[_0xb893('0x2f')]+_0x31005a[_0xb893('0x30')],_0x4fd28b;if(_0x3e949a>=_0x547721){_0x3e949a=_0x547721;_0x4fd28b=0xc8;}else{_0x4fd28b=0xce;}_0x4177c1[_0xb893('0x2b')](_0x4fd28b);return _0x4177c1[_0xb893('0x31')](_0xb893('0x32'),_0x5ee295+'-'+_0x3e949a+'/'+_0x547721)[_0xb893('0x2d')](_0x4d681d);}return null;};}function patchUpdates(_0x5f4a5b){return function(_0x5bc02f){try{jsonpatch[_0xb893('0x33')](_0x5bc02f,_0x5f4a5b,!![]);}catch(_0x4b4a47){return BPromise[_0xb893('0x34')](_0x4b4a47);}return _0x5bc02f[_0xb893('0x35')]();};}function saveUpdates(_0x3cf93c,_0x538eb7){return function(_0x2e9cb1){if(_0x2e9cb1){return _0x2e9cb1['update'](_0x3cf93c)['then'](function(_0x5d7be9){return _0x5d7be9;});}return null;};}function removeEntity(_0x1576a6,_0x47ee9a){return function(_0x2d0b6e){if(_0x2d0b6e){return _0x2d0b6e[_0xb893('0x36')]()[_0xb893('0x20')](function(){var _0x4b2597=_0x2d0b6e['get']({'plain':!![]});var _0x56299a=_0xb893('0x37');return db[_0xb893('0x38')][_0xb893('0x36')]({'where':{'type':_0x56299a,'resourceId':_0x4b2597['id']}})['then'](function(){return _0x2d0b6e;});})[_0xb893('0x20')](function(){_0x1576a6[_0xb893('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58134a,_0x28b68f){return function(_0x31ede9){if(!_0x31ede9){_0x58134a[_0xb893('0x2a')](0x194);}return _0x31ede9;};}function handleError(_0x3eb9d7,_0x34188e){_0x34188e=_0x34188e||0x1f4;return function(_0x38ad8e){logger['error'](_0x38ad8e[_0xb893('0x39')]);if(_0x38ad8e[_0xb893('0x3a')]){delete _0x38ad8e[_0xb893('0x3a')];}_0x3eb9d7[_0xb893('0x2b')](_0x34188e)['send'](_0x38ad8e);};}exports[_0xb893('0x3b')]=function(_0x392baf,_0x3fd3d6){var _0x3ede69={'include':[{'model':db[_0xb893('0x3c')],'as':_0xb893('0x3d')}]},_0x267f14={},_0x25e64d={'count':0x0,'rows':[]};var _0x55613e=_['map'](db[_0xb893('0x3e')]['rawAttributes'],function(_0x3b2a3d){return{'name':_0x3b2a3d['fieldName'],'type':_0x3b2a3d[_0xb893('0x3f')]['key']};});_0x267f14[_0xb893('0x40')]=_[_0xb893('0x41')](_0x55613e,_0xb893('0x3a'));_0x267f14[_0xb893('0x42')]=_[_0xb893('0x43')](_0x392baf[_0xb893('0x42')]);_0x267f14['filters']=_[_0xb893('0x44')](_0x267f14[_0xb893('0x40')],_0x267f14[_0xb893('0x42')]);_0x3ede69[_0xb893('0x45')]=_[_0xb893('0x44')](_0x267f14[_0xb893('0x40')],qs[_0xb893('0x46')](_0x392baf[_0xb893('0x42')]['fields']));_0x3ede69[_0xb893('0x45')]=_0x3ede69[_0xb893('0x45')][_0xb893('0x47')]?_0x3ede69[_0xb893('0x45')]:_0x267f14['model'];if(!_0x392baf[_0xb893('0x42')][_0xb893('0x48')]('nolimit')){_0x3ede69[_0xb893('0x30')]=qs[_0xb893('0x30')](_0x392baf[_0xb893('0x42')]['limit']);_0x3ede69['offset']=qs[_0xb893('0x2f')](_0x392baf[_0xb893('0x42')][_0xb893('0x2f')]);}_0x3ede69[_0xb893('0x49')]=qs[_0xb893('0x4a')](_0x392baf[_0xb893('0x42')][_0xb893('0x4a')]);_0x3ede69[_0xb893('0x4b')]=qs[_0xb893('0x4c')](_[_0xb893('0x4d')](_0x392baf[_0xb893('0x42')],_0x267f14[_0xb893('0x4c')]),_0x55613e);if(_0x392baf[_0xb893('0x42')][_0xb893('0x4e')]){_0x3ede69[_0xb893('0x4b')]=_['merge'](_0x3ede69[_0xb893('0x4b')],{'$or':_['map'](_0x55613e,function(_0x3fc475){if(_0x3fc475['type']!==_0xb893('0x4f')){var _0x27cbf0={};_0x27cbf0[_0x3fc475['name']]={'$like':'%'+_0x392baf[_0xb893('0x42')][_0xb893('0x4e')]+'%'};return _0x27cbf0;}})});}_0x3ede69=_[_0xb893('0x50')]({},_0x3ede69,_0x392baf['options']);var _0x426460={'where':_0x3ede69[_0xb893('0x4b')]};return db['ChatWebsite']['count'](_0x426460)[_0xb893('0x20')](function(_0x29e6f6){_0x25e64d[_0xb893('0x2e')]=_0x29e6f6;if(_0x392baf[_0xb893('0x42')][_0xb893('0x51')]){_0x3ede69['include']=[{'all':!![]}];}return db[_0xb893('0x3e')][_0xb893('0x52')](_0x3ede69);})['then'](function(_0x4105e4){_0x25e64d['rows']=_0x4105e4;return _0x25e64d;})[_0xb893('0x20')](respondWithFilteredResult(_0x3fd3d6,_0x3ede69))[_0xb893('0x53')](handleError(_0x3fd3d6,null));};exports[_0xb893('0x54')]=function(_0x153891,_0x50647a){var _0x1fbf46={'raw':![],'where':{'id':_0x153891[_0xb893('0x55')]['id']},'include':[{'model':db[_0xb893('0x3c')],'as':_0xb893('0x3d')}]},_0x2568c5={};_0x2568c5[_0xb893('0x40')]=_[_0xb893('0x43')](db['ChatWebsite'][_0xb893('0x56')]);_0x2568c5['query']=_[_0xb893('0x43')](_0x153891[_0xb893('0x42')]);_0x2568c5[_0xb893('0x4c')]=_['intersection'](_0x2568c5[_0xb893('0x40')],_0x2568c5[_0xb893('0x42')]);_0x1fbf46[_0xb893('0x45')]=_['intersection'](_0x2568c5['model'],qs[_0xb893('0x46')](_0x153891[_0xb893('0x42')][_0xb893('0x46')]));_0x1fbf46[_0xb893('0x45')]=_0x1fbf46['attributes']['length']?_0x1fbf46[_0xb893('0x45')]:_0x2568c5[_0xb893('0x40')];if(_0x153891[_0xb893('0x42')][_0xb893('0x51')]){_0x1fbf46[_0xb893('0x57')]=[{'all':!![]}];}_0x1fbf46=_['merge']({},_0x1fbf46,_0x153891[_0xb893('0x58')]);return db[_0xb893('0x3e')][_0xb893('0x59')](_0x1fbf46)[_0xb893('0x20')](handleEntityNotFound(_0x50647a,null))[_0xb893('0x20')](respondWithResult(_0x50647a,null))[_0xb893('0x53')](handleError(_0x50647a,null));};exports[_0xb893('0x5a')]=function(_0x1cf637,_0x40d960){return db[_0xb893('0x3e')]['create'](_0x1cf637[_0xb893('0x5b')],{})[_0xb893('0x20')](function(_0x5d6fbe){var _0x343f0e=_0x1cf637[_0xb893('0x5c')]['get']({'plain':!![]});if(!_0x343f0e)throw new Error(_0xb893('0x5d'));if(_0x343f0e[_0xb893('0x5e')]===_0xb893('0x5c')){var _0x7b9e3d=_0x5d6fbe[_0xb893('0x5f')]({'plain':!![]});var _0x3811b9=_0xb893('0x37');return db[_0xb893('0x60')][_0xb893('0x59')]({'where':{'name':_0x3811b9,'userProfileId':_0x343f0e[_0xb893('0x61')]},'raw':!![]})['then'](function(_0x4e7e94){if(_0x4e7e94&&_0x4e7e94[_0xb893('0x62')]===0x0){return db[_0xb893('0x38')]['create']({'name':_0x7b9e3d['name'],'resourceId':_0x7b9e3d['id'],'type':_0x4e7e94['name'],'sectionId':_0x4e7e94['id']},{})[_0xb893('0x20')](function(){return _0x5d6fbe;});}else{return _0x5d6fbe;}})[_0xb893('0x53')](function(_0x2411d1){logger[_0xb893('0x27')](_0xb893('0x63'),_0x2411d1);throw _0x2411d1;});}return _0x5d6fbe;})[_0xb893('0x20')](respondWithResult(_0x40d960,0xc9))[_0xb893('0x53')](handleError(_0x40d960,null));};exports[_0xb893('0x64')]=function(_0xc021fc,_0x341b60){if(_0xc021fc['body']['id']){delete _0xc021fc[_0xb893('0x5b')]['id'];}return db[_0xb893('0x3e')]['find']({'where':{'id':_0xc021fc['params']['id']},'include':[{'model':db[_0xb893('0x3c')],'as':_0xb893('0x3d')}]})[_0xb893('0x20')](handleEntityNotFound(_0x341b60,null))['then'](saveUpdates(_0xc021fc[_0xb893('0x5b')],null))[_0xb893('0x20')](respondWithResult(_0x341b60,null))[_0xb893('0x53')](handleError(_0x341b60,null));};exports[_0xb893('0x36')]=function(_0x2c8686,_0x1e2be4){return db[_0xb893('0x3e')]['find']({'where':{'id':_0x2c8686[_0xb893('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e2be4,null))[_0xb893('0x20')](removeEntity(_0x1e2be4,null))['catch'](handleError(_0x1e2be4,null));};exports[_0xb893('0x65')]=function(_0x148294,_0x2d5a2b){return db[_0xb893('0x3e')][_0xb893('0x65')]()['then'](respondWithResult(_0x2d5a2b,null))[_0xb893('0x53')](handleError(_0x2d5a2b,null));};exports[_0xb893('0x66')]=function(_0x3d0c24,_0x17b27d,_0x435c87){if(_0x3d0c24[_0xb893('0x5b')]['id']){delete _0x3d0c24[_0xb893('0x5b')]['id'];}return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x3d0c24[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x17b27d,null))['then'](function(_0x37e193){if(_0x37e193){_0x3d0c24[_0xb893('0x5b')][_0xb893('0x67')]=_0x37e193['id'];return db[_0xb893('0x68')]['create'](_0x3d0c24[_0xb893('0x5b')]);}})[_0xb893('0x20')](respondWithResult(_0x17b27d,null))[_0xb893('0x53')](handleError(_0x17b27d,null));};exports[_0xb893('0x69')]=function(_0x2297fe,_0x51e2e5,_0x594309){var _0x1d4caf={'raw':![],'where':{}};var _0x2e84a1={};var _0x654ab0={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x2297fe[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x51e2e5,null))['then'](function(_0x3f3c33){if(_0x3f3c33){_0x2e84a1[_0xb893('0x40')]=_[_0xb893('0x43')](db['Disposition'][_0xb893('0x56')]);_0x2e84a1[_0xb893('0x42')]=_[_0xb893('0x43')](_0x2297fe[_0xb893('0x42')]);_0x2e84a1[_0xb893('0x4c')]=_[_0xb893('0x44')](_0x2e84a1['model'],_0x2e84a1[_0xb893('0x42')]);_0x1d4caf[_0xb893('0x45')]=_[_0xb893('0x44')](_0x2e84a1[_0xb893('0x40')],qs[_0xb893('0x46')](_0x2297fe['query'][_0xb893('0x46')]));_0x1d4caf[_0xb893('0x45')]=_0x1d4caf[_0xb893('0x45')][_0xb893('0x47')]?_0x1d4caf[_0xb893('0x45')]:_0x2e84a1[_0xb893('0x40')];if(!_0x2297fe[_0xb893('0x42')][_0xb893('0x48')]('nolimit')){_0x1d4caf[_0xb893('0x30')]=qs['limit'](_0x2297fe[_0xb893('0x42')][_0xb893('0x30')]);_0x1d4caf[_0xb893('0x2f')]=qs[_0xb893('0x2f')](_0x2297fe[_0xb893('0x42')][_0xb893('0x2f')]);}_0x1d4caf[_0xb893('0x49')]=qs[_0xb893('0x4a')](_0x2297fe[_0xb893('0x42')]['sort']);_0x1d4caf[_0xb893('0x4b')]=qs['filters'](_[_0xb893('0x4d')](_0x2297fe[_0xb893('0x42')],_0x2e84a1[_0xb893('0x4c')]));_0x1d4caf['where'][_0xb893('0x67')]=_0x3f3c33['id'];if(_0x2297fe[_0xb893('0x42')]['filter']){_0x1d4caf['where']=_[_0xb893('0x50')](_0x1d4caf[_0xb893('0x4b')],{'$or':_[_0xb893('0x41')](_0x1d4caf['attributes'],function(_0x8251bf){var _0x49ae0d={};_0x49ae0d[_0x8251bf]={'$like':'%'+_0x2297fe[_0xb893('0x42')]['filter']+'%'};return _0x49ae0d;})});}_0x1d4caf=_[_0xb893('0x50')]({},_0x1d4caf,_0x2297fe[_0xb893('0x58')]);return db[_0xb893('0x68')][_0xb893('0x2e')]({'where':_0x1d4caf[_0xb893('0x4b')]})[_0xb893('0x20')](function(_0x1dd01a){_0x654ab0[_0xb893('0x2e')]=_0x1dd01a;if(_0x2297fe[_0xb893('0x42')][_0xb893('0x51')]){_0x1d4caf['include']=[{'all':!![]}];}return db[_0xb893('0x68')][_0xb893('0x52')](_0x1d4caf);})[_0xb893('0x20')](function(_0x34127b){_0x654ab0[_0xb893('0x6a')]=_0x34127b;return _0x654ab0;});}})[_0xb893('0x20')](respondWithFilteredResult(_0x51e2e5,_0x1d4caf))['catch'](handleError(_0x51e2e5,null));};exports['removeDispositions']=function(_0x17ebd7,_0x5db720,_0x223231){return db['ChatWebsite'][_0xb893('0x59')]({'where':{'id':_0x17ebd7[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x5db720,null))[_0xb893('0x20')](function(_0x147d99){if(_0x147d99){return _0x147d99[_0xb893('0x6b')](_0x17ebd7[_0xb893('0x42')][_0xb893('0x6c')]);}})['then'](respondWithStatusCode(_0x5db720,null))[_0xb893('0x53')](handleError(_0x5db720,null));};exports[_0xb893('0x6d')]=function(_0x4702e8,_0x5c76b2,_0x1fb60c){if(_0x4702e8[_0xb893('0x5b')]['id']){delete _0x4702e8['body']['id'];}return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x4702e8[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x5c76b2,null))[_0xb893('0x20')](function(_0x3199dc){if(_0x3199dc){_0x4702e8[_0xb893('0x5b')][_0xb893('0x67')]=_0x3199dc['id'];return db[_0xb893('0x6e')][_0xb893('0x5a')](_0x4702e8[_0xb893('0x5b')]);}})[_0xb893('0x20')](respondWithResult(_0x5c76b2,null))['catch'](handleError(_0x5c76b2,null));};exports[_0xb893('0x6f')]=function(_0x567d81,_0x328f49,_0x4a512a){var _0x5d0325={'raw':![],'where':{}};var _0x55c93f={};var _0x38eabf={'count':0x0,'rows':[]};return db[_0xb893('0x3e')][_0xb893('0x70')]({'where':{'id':_0x567d81[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x328f49,null))[_0xb893('0x20')](function(_0x51709d){if(_0x51709d){_0x55c93f[_0xb893('0x40')]=_['keys'](db['CannedAnswer'][_0xb893('0x56')]);_0x55c93f[_0xb893('0x42')]=_[_0xb893('0x43')](_0x567d81[_0xb893('0x42')]);_0x55c93f[_0xb893('0x4c')]=_[_0xb893('0x44')](_0x55c93f[_0xb893('0x40')],_0x55c93f[_0xb893('0x42')]);_0x5d0325[_0xb893('0x45')]=_[_0xb893('0x44')](_0x55c93f['model'],qs['fields'](_0x567d81[_0xb893('0x42')][_0xb893('0x46')]));_0x5d0325[_0xb893('0x45')]=_0x5d0325[_0xb893('0x45')]['length']?_0x5d0325[_0xb893('0x45')]:_0x55c93f[_0xb893('0x40')];if(!_0x567d81[_0xb893('0x42')][_0xb893('0x48')](_0xb893('0x71'))){_0x5d0325[_0xb893('0x30')]=qs[_0xb893('0x30')](_0x567d81[_0xb893('0x42')][_0xb893('0x30')]);_0x5d0325[_0xb893('0x2f')]=qs['offset'](_0x567d81[_0xb893('0x42')][_0xb893('0x2f')]);}_0x5d0325[_0xb893('0x49')]=qs[_0xb893('0x4a')](_0x567d81[_0xb893('0x42')][_0xb893('0x4a')]);_0x5d0325[_0xb893('0x4b')]=qs['filters'](_[_0xb893('0x4d')](_0x567d81[_0xb893('0x42')],_0x55c93f['filters']));_0x5d0325['where'][_0xb893('0x67')]=_0x51709d['id'];if(_0x567d81[_0xb893('0x42')]['filter']){_0x5d0325[_0xb893('0x4b')]=_[_0xb893('0x50')](_0x5d0325[_0xb893('0x4b')],{'$or':_[_0xb893('0x41')](_0x5d0325[_0xb893('0x45')],function(_0x103b86){var _0x25380e={};_0x25380e[_0x103b86]={'$like':'%'+_0x567d81[_0xb893('0x42')][_0xb893('0x4e')]+'%'};return _0x25380e;})});}_0x5d0325=_[_0xb893('0x50')]({},_0x5d0325,_0x567d81['options']);return db['CannedAnswer']['count']({'where':_0x5d0325['where']})[_0xb893('0x20')](function(_0x3a4284){_0x38eabf[_0xb893('0x2e')]=_0x3a4284;if(_0x567d81[_0xb893('0x42')][_0xb893('0x51')]){_0x5d0325[_0xb893('0x57')]=[{'all':!![]}];}return db[_0xb893('0x6e')][_0xb893('0x52')](_0x5d0325);})[_0xb893('0x20')](function(_0x27d899){_0x38eabf[_0xb893('0x6a')]=_0x27d899;return _0x38eabf;});}})['then'](respondWithFilteredResult(_0x328f49,_0x5d0325))['catch'](handleError(_0x328f49,null));};exports[_0xb893('0x72')]=function(_0x148a76,_0x1ace90,_0x38bfb6){return db['ChatWebsite'][_0xb893('0x59')]({'where':{'id':_0x148a76[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x1ace90,null))[_0xb893('0x20')](function(_0x4dfaeb){if(_0x4dfaeb){return _0x4dfaeb['removeAnswers'](_0x148a76[_0xb893('0x42')]['ids']);}})[_0xb893('0x20')](respondWithStatusCode(_0x1ace90,null))['catch'](handleError(_0x1ace90,null));};exports[_0xb893('0x73')]=function(_0x143c99,_0x9de7d5,_0x5348e3){_0x143c99['body']['sitepic']=_0x143c99['file']['filename'];return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x143c99[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x9de7d5,null))['then'](saveUpdates(_0x143c99[_0xb893('0x5b')],null))['then'](respondWithResult(_0x9de7d5,null))[_0xb893('0x53')](handleError(_0x9de7d5,null));};exports['addAvatar']=function(_0x271305,_0x1c6cc4,_0x1530a8){_0x271305[_0xb893('0x5b')][_0xb893('0x74')]=_0x271305[_0xb893('0x75')][_0xb893('0x76')];return db['ChatWebsite'][_0xb893('0x59')]({'where':{'id':_0x271305['params']['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x1c6cc4,null))[_0xb893('0x20')](saveUpdates(_0x271305[_0xb893('0x5b')],null))[_0xb893('0x20')](respondWithResult(_0x1c6cc4,null))[_0xb893('0x53')](handleError(_0x1c6cc4,null));};exports[_0xb893('0x77')]=function(_0x3e09bc,_0x2fcb01,_0x317be2){_0x3e09bc['body'][_0xb893('0x78')]=_0x3e09bc[_0xb893('0x75')][_0xb893('0x76')];return db[_0xb893('0x3e')]['find']({'where':{'id':_0x3e09bc['params']['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x2fcb01,null))[_0xb893('0x20')](saveUpdates(_0x3e09bc[_0xb893('0x5b')],null))[_0xb893('0x20')](respondWithResult(_0x2fcb01,null))[_0xb893('0x53')](handleError(_0x2fcb01,null));};exports[_0xb893('0x79')]=function(_0x4c144c,_0x1c3047,_0x598841){_0x4c144c[_0xb893('0x5b')][_0xb893('0x7a')]=_0x4c144c[_0xb893('0x75')][_0xb893('0x76')];return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x4c144c['params']['id']}})['then'](handleEntityNotFound(_0x1c3047,null))[_0xb893('0x20')](saveUpdates(_0x4c144c['body'],null))[_0xb893('0x20')](respondWithResult(_0x1c3047,null))[_0xb893('0x53')](handleError(_0x1c3047,null));};exports['getLogo']=function(_0x2b06eb,_0x4bb8db,_0x16d30a){var _0x5d49dd=path[_0xb893('0x7b')](config['root'],_0xb893('0x7c'));var _0x204013={'where':{'id':_0x2b06eb[_0xb893('0x55')]['id']},'attributes':['id',_0xb893('0x7d')],'raw':!![]};var _0x36e7ef=![];return require(_0xb893('0x7e'))[_0xb893('0x7f')]()[_0xb893('0x20')](function(_0x57b3f3){if(_0x57b3f3){_0x36e7ef=_0x57b3f3['custom'];}})[_0xb893('0x20')](function(){return db[_0xb893('0x3e')][_0xb893('0x59')](_0x204013);})[_0xb893('0x20')](handleEntityNotFound(_0x4bb8db,null))['then'](function(_0x77f1a){if(_0x77f1a){if(!_['isNil'](_0x77f1a[_0xb893('0x7d')])){if(fs[_0xb893('0x80')](path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x82'),_0x77f1a[_0xb893('0x7d')]))&&_0x36e7ef){_0x5d49dd=path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x82'),_0x77f1a[_0xb893('0x7d')]);}}return _0x4bb8db[_0xb893('0x83')](_0x5d49dd);}})['catch'](handleError(_0x4bb8db,null));};exports[_0xb893('0x84')]=function(_0x2cc647,_0x413524,_0x55394d){var _0x2ee15a=path['join'](config[_0xb893('0x81')],_0xb893('0x85'));var _0x52f4ea={'where':{'id':_0x2cc647[_0xb893('0x55')]['id']},'attributes':['id',_0xb893('0x74')],'raw':!![]};return db[_0xb893('0x3e')]['find'](_0x52f4ea)[_0xb893('0x20')](handleEntityNotFound(_0x413524,null))[_0xb893('0x20')](function(_0x36109f){if(_0x36109f){if(!_[_0xb893('0x86')](_0x36109f[_0xb893('0x74')])){if(fs['existsSync'](path[_0xb893('0x7b')](config['root'],'server/files/images/avatars/',_0x36109f['agentAvatar']))){_0x2ee15a=path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x87'),_0x36109f[_0xb893('0x74')]);}}return _0x413524['download'](_0x2ee15a);}})[_0xb893('0x53')](handleError(_0x413524,null));};exports[_0xb893('0x88')]=function(_0x111deb,_0x5aa9ff,_0x584a99){var _0x25d3c1=path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x89'));var _0x14c853={'where':{'id':_0x111deb[_0xb893('0x55')]['id']},'attributes':['id','customerAvatar',_0xb893('0x8a')],'raw':!![]};return db[_0xb893('0x3e')][_0xb893('0x59')](_0x14c853)['then'](handleEntityNotFound(_0x5aa9ff,null))[_0xb893('0x20')](function(_0x1f6daf){if(_0x1f6daf){if(!_[_0xb893('0x86')](_0x1f6daf[_0xb893('0x78')])){if(fs[_0xb893('0x80')](path[_0xb893('0x7b')](config['root'],_0xb893('0x87'),_0x1f6daf[_0xb893('0x78')]))&&_0x1f6daf['showCustomerAvatar']){_0x25d3c1=path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x87'),_0x1f6daf['customerAvatar']);}}return _0x5aa9ff['download'](_0x25d3c1);}})['catch'](handleError(_0x5aa9ff,null));};exports[_0xb893('0x8b')]=function(_0x12d398,_0x4342db,_0xd2c464){var _0xdd9add=path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x8c'));var _0x263b8d={'where':{'id':_0x12d398[_0xb893('0x55')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xb893('0x3e')]['find'](_0x263b8d)[_0xb893('0x20')](handleEntityNotFound(_0x4342db,null))[_0xb893('0x20')](function(_0x426016){if(_0x426016){if(!_[_0xb893('0x86')](_0x426016[_0xb893('0x7a')])){if(fs['existsSync'](path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x87'),_0x426016[_0xb893('0x7a')]))){_0xdd9add=path[_0xb893('0x7b')](config[_0xb893('0x81')],'server/files/images/avatars/',_0x426016[_0xb893('0x7a')]);}}return _0x4342db[_0xb893('0x83')](_0xdd9add);}})[_0xb893('0x53')](handleError(_0x4342db,null));};exports['notify']=function(_0x13df62,_0x1ee659,_0x16d660){var _0x2a2498=require(_0xb893('0x8d'));var _0x423d44=new _0x2a2498();var _0x296578=_0x423d44[_0xb893('0x8e')](_0x13df62[_0xb893('0x8f')][_0xb893('0x90')])[_0xb893('0x91')]();var _0x72ed5e={'body':_0x13df62['body'],'channel':_0xb893('0x92')};var _0x4b2e8c=[];var _0x301e34=[];var _0x42fb15={};var _0x14025d=![];return db['CmContact'][_0xb893('0x65')]()[_0xb893('0x20')](function(_0x1b898a){if(!_0x1b898a){throw new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0x95'));}_0x4b2e8c=_[_0xb893('0x96')](_[_0xb893('0x43')](_0x1b898a),['createdAt',_0xb893('0x97')]);_0x301e34=_[_0xb893('0x96')](_[_0xb893('0x43')](_0x1b898a),[_0xb893('0x98'),_0xb893('0x97'),_0xb893('0x99'),_0xb893('0x9a')]);if(_0x13df62[_0xb893('0x5b')]['id']){delete _0x13df62['body']['id'];}if(_['isNil'](_0x13df62['body']['from'])){throw new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0x9b'));}if(_['isNil'](_0x13df62[_0xb893('0x5b')][_0xb893('0x5b')])||_0x13df62[_0xb893('0x5b')][_0xb893('0x5b')]===''){throw new db[(_0xb893('0x93'))][(_0xb893('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb893('0x86')](_0x13df62[_0xb893('0x5b')]['mapKey'])){throw new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0x9c')+_0x301e34);}if(!_[_0xb893('0x9d')](_0x301e34,_0x13df62[_0xb893('0x5b')][_0xb893('0x9e')])){throw new db[(_0xb893('0x93'))]['ValidationError'](_0xb893('0x9f')+_0x301e34);}_0x42fb15[_0x13df62[_0xb893('0x5b')][_0xb893('0x9e')]]=_0x13df62[_0xb893('0x5b')][_0xb893('0xa0')];})[_0xb893('0x20')](function(){return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x13df62[_0xb893('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xb893('0xa1'),'include':[{'model':db['CmContact'],'as':_0xb893('0xa2'),'where':_0x42fb15,'limit':0x1,'order':[[_0xb893('0x97'),'DESC']]}]},{'model':db[_0xb893('0xa3')],'as':_0xb893('0xa4')}]});})[_0xb893('0x20')](handleEntityNotFound(_0x1ee659,null))[_0xb893('0x20')](function(_0x58dfb2){if(_0x58dfb2&&_0x58dfb2[_0xb893('0xa1')]){_0x72ed5e[_0xb893('0xa5')]=_0x58dfb2;_0x72ed5e[_0xb893('0xa6')]=_0x58dfb2[_0xb893('0xa4')];_0x72ed5e['list']=_0x58dfb2[_0xb893('0xa1')];_0x72ed5e['applications']=_['orderBy'](_0x72ed5e[_0xb893('0xa6')],[_0xb893('0xa7')],['asc']);if(_0x72ed5e[_0xb893('0xa5')][_0xb893('0xa4')]){delete _0x72ed5e['account']['Applications'];}if(_0x72ed5e[_0xb893('0xa5')][_0xb893('0xa1')]&&_0x72ed5e[_0xb893('0xa5')][_0xb893('0xa1')][_0xb893('0xa2')][_0xb893('0x47')]){return _0x72ed5e['account'][_0xb893('0xa1')][_0xb893('0xa2')][0x0];}var _0x2b919f=_[_0xb893('0x18')](_0x13df62[_0xb893('0x5b')],{'firstName':_0x13df62[_0xb893('0x5b')]['from'],'ListId':_0x58dfb2['ListId']});_0x2b919f[_0x13df62[_0xb893('0x5b')][_0xb893('0x9e')]]=_0x13df62['body'][_0xb893('0xa0')];return db[_0xb893('0xa8')]['create'](_0x2b919f,{'fields':_0x4b2e8c,'raw':!![]});}})['then'](handleEntityNotFound(_0x1ee659,null))[_0xb893('0x20')](function(_0x38fe28){_0x72ed5e[_0xb893('0xa9')]=_0x38fe28;var _0x39ddd3=_0x13df62['body'][_0xb893('0xaa')];if(_0x13df62[_0xb893('0x8f')][_0xb893('0xab')]){_0x39ddd3=_0x13df62[_0xb893('0x8f')][_0xb893('0xab')];}else if(_0x13df62[_0xb893('0x8f')][_0xb893('0xac')]){_0x39ddd3=_[_0xb893('0xad')](_0x13df62[_0xb893('0x8f')]['x-forwarded-for'][_0xb893('0xae')](','));}if(_0x38fe28){var _0x7585b6={'ContactId':_0x38fe28['id'],'ChatWebsiteId':_0x13df62['params']['id'],'from':(_0x38fe28[_0xb893('0xaf')]||'')+'\x20'+(_0x38fe28[_0xb893('0xb0')]||''),'customerIp':_0x39ddd3,'customerPort':_0x13df62['headers']['x-real-port']?_0x13df62[_0xb893('0x8f')][_0xb893('0xb1')]:null,'referer':_0x13df62[_0xb893('0x5b')][_0xb893('0xb2')],'browserName':_0x296578[_0xb893('0xb3')][_0xb893('0x3a')]&&_0x296578[_0xb893('0xb3')][_0xb893('0xb4')]?util[_0xb893('0xb5')](_0xb893('0xb6'),_0x296578[_0xb893('0xb3')][_0xb893('0x3a')],_0x296578[_0xb893('0xb3')][_0xb893('0xb4')]):_0xb893('0xb7'),'browserVersion':_0x296578[_0xb893('0xb3')][_0xb893('0xb4')]||_0xb893('0xb7'),'osName':util['format'](_0xb893('0xb6'),_0x296578['os'][_0xb893('0x3a')],_0x296578['os'][_0xb893('0xb4')]),'osVersion':_0x296578['os'][_0xb893('0xb4')],'deviceModel':_0x296578[_0xb893('0xb8')]['model']&&_0x296578[_0xb893('0xb8')][_0xb893('0xb9')]?util[_0xb893('0xb5')]('%s\x20%s\x20%s',_0x296578[_0xb893('0xb8')][_0xb893('0x40')],_0x296578['device'][_0xb893('0xb9')],_0x296578[_0xb893('0xb8')]['type']):null,'deviceVendor':_0x296578[_0xb893('0xb8')]['vendor'],'deviceType':_0x296578['device']['type'],'formData':JSON[_0xb893('0x26')](_0x13df62['body'])};var _0xf7a17d={'ChatWebsiteId':_0x13df62[_0xb893('0x55')]['id'],'closed':![]};if(_0x13df62['body'][_0xb893('0xba')]){_0xf7a17d[_0xb893('0xba')]=_0x13df62[_0xb893('0x5b')][_0xb893('0xba')];return db[_0xb893('0xbb')][_0xb893('0x59')]({'where':_0xf7a17d})[_0xb893('0x20')](function(_0x8ede24){if(_0x8ede24){return[_0x8ede24,![]];}_0x7585b6[_0xb893('0xba')]=_0x13df62[_0xb893('0x5b')][_0xb893('0xba')];_0x7585b6[_0xb893('0xbc')]=_0x13df62[_0xb893('0x5b')][_0xb893('0xbc')];return db[_0xb893('0xbb')]['create'](_0x7585b6)[_0xb893('0x20')](function(_0x368e17){return[_0x368e17,!![]];});});}_0xf7a17d[_0xb893('0xbd')]=_0x38fe28['id'];if(_0x13df62['body'][_0xb893('0xbe')]&&_0x13df62['body']['interaction']['id']){_0xf7a17d['id']=_0x13df62[_0xb893('0x5b')][_0xb893('0xbe')]['id'];return db['ChatInteraction'][_0xb893('0x59')]({'where':_0xf7a17d})[_0xb893('0x20')](function(_0x56ee3b){if(_0x56ee3b){return[_0x56ee3b,![]];}return db[_0xb893('0xbb')][_0xb893('0x5a')](_0x7585b6)[_0xb893('0x20')](function(_0x3e9870){return[_0x3e9870,!![]];});});}return db[_0xb893('0xbb')]['create'](_0x7585b6)[_0xb893('0x20')](function(_0x2fef8e){return[_0x2fef8e,!![]];});}})['spread'](function(_0x273787,_0x23b12f){if(_0x273787){_0x14025d=_0x23b12f;if(!_0x23b12f){var _0x4e9686={'from':(_0x72ed5e[_0xb893('0xa9')][_0xb893('0xaf')]||'')+'\x20'+(_0x72ed5e[_0xb893('0xa9')]['lastName']||'')};if(_0x13df62[_0xb893('0x5b')][_0xb893('0xba')]&&_0x13df62[_0xb893('0x5b')][_0xb893('0xbf')]&&_0x13df62['body'][_0xb893('0xba')]!=_0x13df62['body'][_0xb893('0xbf')]){_0x4e9686[_0xb893('0xba')]=_0x13df62[_0xb893('0x5b')][_0xb893('0xbf')];}return _0x273787[_0xb893('0x64')](_0x4e9686);}else{return _0x273787;}}})[_0xb893('0x20')](function(_0x2fb3bd){_0x72ed5e[_0xb893('0xbe')]=_0x2fb3bd[_0xb893('0x5f')]({'plain':!![]});_0x72ed5e[_0xb893('0xbe')][_0xb893('0xc0')]=_0x14025d;if(_0x72ed5e[_0xb893('0xbe')][_0xb893('0xc0')]){if(_0x72ed5e[_0xb893('0xa5')][_0xb893('0xc1')]){_0x72ed5e[_0xb893('0xa6')][_0xb893('0xc2')]({'id':0x0,'priority':_0x72ed5e[_0xb893('0xa6')][_0xb893('0x47')]+0x1,'app':_0xb893('0xc3'),'appdata':_0xb893('0xc4'),'interval':_0xb893('0xc5')});}}return db[_0xb893('0xc6')][_0xb893('0x5a')]({'body':_0x13df62[_0xb893('0x5b')][_0xb893('0x5b')],'ChatWebsiteId':_0x13df62['params']['id'],'ChatInteractionId':_0x2fb3bd['id'],'direction':'in','ContactId':_0x72ed5e[_0xb893('0xa9')]['id'],'AttachmentId':_0x13df62['body'][_0xb893('0xc7')]});})[_0xb893('0x20')](function(_0x24d713){_0x72ed5e['message']=_0x24d713;if(_0x72ed5e[_0xb893('0xbe')][_0xb893('0xc8')]){return db['User'][_0xb893('0x59')]({'attributes':['id',_0xb893('0x3a')],'where':{'id':_0x72ed5e[_0xb893('0xbe')][_0xb893('0xc8')]}})[_0xb893('0x20')](function(_0x2ef188){if(_0x2ef188){_0x72ed5e[_0xb893('0xa6')][_0xb893('0xc9')]({'id':0x0,'priority':0x0,'app':_0xb893('0xca'),'appdata':_0x2ef188[_0xb893('0x3a')]+','+(_0x72ed5e['account'][_0xb893('0xcb')]||0xa),'interval':_0xb893('0xc5')});_0x72ed5e[_0xb893('0xcc')]=!![];}return respondWithRpcPromise(_0xb893('0xcd'),_0xb893('0xce'),_0x72ed5e);});}return respondWithRpcPromise(_0xb893('0xcd'),_0xb893('0xce'),_0x72ed5e);})[_0xb893('0x20')](function(_0x2b4746){respondWithRpcPromise(_0xb893('0xcf'),'EventManager',{'event':'notify','message':_0x2b4746},client9002);return _0x2b4746;})[_0xb893('0x20')](respondWithResult(_0x1ee659,null))[_0xb893('0x53')](handleError(_0x1ee659,null));};exports[_0xb893('0xd0')]=function(_0x30199b,_0x2319b6,_0x307d75){var _0x74bcd0,_0x1fff45,_0x2215c3;var _0x3d579e=[];var _0x1a2a88=[];var _0x4db40f={};return db[_0xb893('0xa8')][_0xb893('0x65')]()['then'](function(_0x5431c9){if(!_0x5431c9){throw new db[(_0xb893('0x93'))][(_0xb893('0x94'))]('no\x20available\x20attributes');}_0x1a2a88=_[_0xb893('0x96')](_[_0xb893('0x43')](_0x5431c9),[_0xb893('0x98'),_0xb893('0x97')]);_0x3d579e=_[_0xb893('0x96')](_[_0xb893('0x43')](_0x5431c9),['createdAt',_0xb893('0x97'),_0xb893('0x99'),_0xb893('0x9a')]);if(_0x30199b[_0xb893('0x5b')]['id']){delete _0x30199b[_0xb893('0x5b')]['id'];}if(_[_0xb893('0x86')](_0x30199b[_0xb893('0x5b')]['from'])){throw _0x2319b6[_0xb893('0x2b')](0x1f4)[_0xb893('0xd1')](new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0x9b')));}if(_[_0xb893('0x86')](_0x30199b[_0xb893('0x5b')]['body'])||_0x30199b[_0xb893('0x5b')]['body']===''){throw _0x2319b6['status'](0x1f4)[_0xb893('0xd1')](new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0xd2')));}if(_[_0xb893('0x86')](_0x30199b[_0xb893('0x5b')]['mapKeyOffline'])){throw _0x2319b6[_0xb893('0x2b')](0x1f4)[_0xb893('0xd1')](new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0xd3')+_0x3d579e));}if(!_[_0xb893('0x9d')](_0x3d579e,_0x30199b['body'][_0xb893('0xd4')])){throw _0x2319b6[_0xb893('0x2b')](0x1f4)[_0xb893('0xd1')](new db[(_0xb893('0x93'))][(_0xb893('0x94'))](_0xb893('0xd5')+_0x3d579e));}_0x4db40f[_0x30199b[_0xb893('0x5b')][_0xb893('0xd4')]]=_0x30199b[_0xb893('0x5b')][_0xb893('0xa0')];})[_0xb893('0x20')](function(){return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x30199b['params']['id']},'include':[{'model':db[_0xb893('0xd6')],'as':_0xb893('0xa1')}]});})['then'](handleEntityNotFound(_0x2319b6,null))['then'](function(_0x11e165){if(_0x11e165&&_0x11e165[_0xb893('0xa1')]){_0x1fff45=_0x11e165;var _0x1bccfa=_[_0xb893('0x18')](_0x30199b[_0xb893('0x5b')],{'firstName':_0x30199b[_0xb893('0x5b')][_0xb893('0xa0')],'phone':_0x30199b[_0xb893('0x5b')]['from'],'ListId':_0x11e165[_0xb893('0x9a')]});_0x1bccfa[_0x30199b[_0xb893('0x5b')]['mapKeyOffline']]=_0x30199b[_0xb893('0x5b')][_0xb893('0xa0')];return db[_0xb893('0xa8')][_0xb893('0xd7')]({'where':_0x4db40f,'defaults':_0x1bccfa});}})[_0xb893('0xd8')](function(_0x4ff453){if(_0x4ff453){_0x2215c3=_0x4ff453;var _0x6227f=fs[_0xb893('0xd9')](path['join'](config['root'],_0xb893('0xda')),_0xb893('0xdb'));var _0x4dc1d3=ejs[_0xb893('0xdc')](_0x6227f,{'body':_['toPairs'](_0x30199b['body']['body']),'bodyTitle':_0x1fff45[_0xb893('0xdd')]});return db[_0xb893('0xde')][_0xb893('0x5a')]({'body':_0x4dc1d3,'ContactId':_0x4ff453['id'],'ChatWebsiteId':_0x1fff45['id']});}})[_0xb893('0x20')](function(_0x32e203){if(_0x32e203){_0x74bcd0=_0x32e203;return db[_0xb893('0xdf')][_0xb893('0x70')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xb893('0xe0'),'raw':!![]}]});}})[_0xb893('0x20')](function(_0x122d66){if(_0x122d66&&_0x122d66[_0xb893('0xe0')]&&_0x1fff45['forwardOfflineAddress']){var _0x509f77={'tls':{'rejectUnauthorized':![]}};if(_0x122d66[_0xb893('0xe0')][_0xb893('0xe1')]){_0x509f77[_0xb893('0xe1')]=_0x122d66[_0xb893('0xe0')]['service'];}else{_0x509f77['host']=_0x122d66['Smtp'][_0xb893('0xe2')];_0x509f77['port']=_0x122d66[_0xb893('0xe0')][_0xb893('0xe3')];_0x509f77[_0xb893('0xe4')]=_0x122d66['Smtp'][_0xb893('0xe4')];}if(_0x122d66['Smtp'][_0xb893('0xe5')]){_0x509f77[_0xb893('0xe6')]={'user':_0x122d66[_0xb893('0xe0')][_0xb893('0x5c')],'pass':_0x122d66[_0xb893('0xe0')]['pass']};}return respondWithRpcPromise(_0xb893('0xe7'),_0xb893('0xe8'),{'account':_0x509f77,'message':{'from':util[_0xb893('0xb5')](_0xb893('0xe9'),_0x122d66[_0xb893('0x3a')],_0x122d66[_0xb893('0xea')]||_0x122d66[_0xb893('0xe0')][_0xb893('0x5c')]),'to':_0x1fff45['forwardOfflineAddress'],'subject':_0x1fff45[_0xb893('0xeb')],'text':_0x74bcd0[_0xb893('0x5b')]}},client9003)[_0xb893('0x20')](function(){return _0x74bcd0;})['catch'](function(_0x51bcc3){console[_0xb893('0x27')](_0x51bcc3);});}})[_0xb893('0x20')](function(){if(_0x74bcd0){return _0x74bcd0;}})[_0xb893('0x20')](respondWithResult(_0x2319b6,null))[_0xb893('0x53')](handleError(_0x2319b6,null));};exports[_0xb893('0xec')]=function(_0x4b2cfd,_0x281f59,_0xd706f5){return db['ChatInteraction']['find']({'where':{'id':_0x4b2cfd[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x281f59,null))[_0xb893('0x20')](function(_0x5e17ef){if(_0x5e17ef){return _0x5e17ef[_0xb893('0xec')](_0x4b2cfd[_0xb893('0x5b')]['ids'],_[_0xb893('0xed')](_0x4b2cfd[_0xb893('0x5b')],[_0xb893('0x6c'),'id'])||{});}})[_0xb893('0x20')](respondWithResult(_0x281f59,null))[_0xb893('0x53')](handleError(_0x281f59,null));};exports[_0xb893('0xee')]=function(_0x34a217,_0x3e6061,_0x4617c7){var _0x2c3ceb={'raw':![],'where':{}};var _0x4c9f75={};var _0x16cc4f={'count':0x0,'rows':[]};return db[_0xb893('0x3e')][_0xb893('0x70')]({'where':{'id':_0x34a217[_0xb893('0x55')]['id']}})['then'](handleEntityNotFound(_0x3e6061,null))['then'](function(_0x4609d3){if(_0x4609d3){_0x4c9f75[_0xb893('0x40')]=_['keys'](db[_0xb893('0xbb')][_0xb893('0x56')]);_0x4c9f75['query']=_['keys'](_0x34a217[_0xb893('0x42')]);_0x4c9f75[_0xb893('0x4c')]=_[_0xb893('0x44')](_0x4c9f75[_0xb893('0x40')],_0x4c9f75['query']);_0x2c3ceb[_0xb893('0x45')]=_[_0xb893('0x44')](_0x4c9f75[_0xb893('0x40')],qs['fields'](_0x34a217[_0xb893('0x42')][_0xb893('0x46')]));_0x2c3ceb['attributes']=_0x2c3ceb[_0xb893('0x45')][_0xb893('0x47')]?_0x2c3ceb['attributes']:_0x4c9f75['model'];if(!_0x34a217[_0xb893('0x42')][_0xb893('0x48')]('nolimit')){_0x2c3ceb[_0xb893('0x30')]=qs[_0xb893('0x30')](_0x34a217[_0xb893('0x42')][_0xb893('0x30')]);_0x2c3ceb[_0xb893('0x2f')]=qs[_0xb893('0x2f')](_0x34a217[_0xb893('0x42')][_0xb893('0x2f')]);}_0x2c3ceb[_0xb893('0x49')]=qs[_0xb893('0x4a')](_0x34a217['query']['sort']);_0x2c3ceb[_0xb893('0x4b')]=qs[_0xb893('0x4c')](_[_0xb893('0x4d')](_0x34a217[_0xb893('0x42')],_0x4c9f75['filters']));_0x2c3ceb[_0xb893('0x4b')]['ChatWebsiteId']=_0x4609d3['id'];if(_0x34a217[_0xb893('0x42')][_0xb893('0x4e')]){_0x2c3ceb[_0xb893('0x4b')]=_[_0xb893('0x50')](_0x2c3ceb['where'],{'$or':_[_0xb893('0x41')](_0x2c3ceb['attributes'],function(_0x5b2841){var _0x4c6f24={};_0x4c6f24[_0x5b2841]={'$like':'%'+_0x34a217[_0xb893('0x42')][_0xb893('0x4e')]+'%'};return _0x4c6f24;})});}_0x2c3ceb=_[_0xb893('0x50')]({},_0x2c3ceb,_0x34a217[_0xb893('0x58')]);return db[_0xb893('0xbb')][_0xb893('0x2e')]({'where':_0x2c3ceb[_0xb893('0x4b')]})['then'](function(_0x1ce41d){_0x16cc4f[_0xb893('0x2e')]=_0x1ce41d;if(_0x34a217[_0xb893('0x42')][_0xb893('0x51')]){_0x2c3ceb[_0xb893('0x57')]=[{'model':db[_0xb893('0xa8')],'as':_0xb893('0xef'),'required':![]},{'model':db[_0xb893('0xf0')],'as':'Owner','attributes':['name',_0xb893('0xf1'),'internal'],'required':![]},{'model':db[_0xb893('0xf2')],'as':_0xb893('0xf3'),'attributes':['id',_0xb893('0x3a'),_0xb893('0xf4')],'where':_0x34a217['query'][_0xb893('0xf5')]?{'id':_0x34a217[_0xb893('0x42')][_0xb893('0xf5')]}:undefined,'required':_0x34a217[_0xb893('0x42')][_0xb893('0xf5')]?!![]:![]}];}return db[_0xb893('0xbb')]['findAll'](_0x2c3ceb);})[_0xb893('0x20')](function(_0x38bb25){_0x16cc4f['rows']=_0x38bb25;return _0x16cc4f;});}})[_0xb893('0x20')](respondWithFilteredResult(_0x3e6061,_0x2c3ceb))[_0xb893('0x53')](handleError(_0x3e6061,null));};function iftimePromise(_0x18fe7e,_0x399f59){return respondWithRpcPromise('Command',_0xb893('0xf6'),{'command':_0x399f59['timezone']?util[_0xb893('0xb5')]('iftime\x20%s,%s',_0x18fe7e[_0xb893('0xf7')],_0x399f59['timezone']):util[_0xb893('0xb5')](_0xb893('0xf8'),_0x18fe7e['interval'])},client9002)[_0xb893('0x20')](function(_0x599aff){var _0xd38dfe=_0x599aff&&_0x599aff[_0xb893('0xf9')](_0xb893('0xfa'))>=0x0?!![]:![];logger['info'](_0xb893('0xfb'),_0x399f59['id'],_0x18fe7e['id'],_0x18fe7e[_0xb893('0xf7')],_0xd38dfe?_0xb893('0xfc'):_0xb893('0xfd'),_0x399f59[_0xb893('0xfe')]?_0x399f59[_0xb893('0xfe')]:_0xb893('0xff'));return _0xd38dfe;})[_0xb893('0x53')](function(_0x45f677){logger[_0xb893('0x27')](_0xb893('0xfb'),_0x399f59['id'],_0x18fe7e['id'],_0x18fe7e[_0xb893('0xf7')],util[_0xb893('0x100')](_0x45f677,{'showHidden':![],'depth':null}),_0x399f59[_0xb893('0xfe')]?_0x399f59[_0xb893('0xfe')]:'No\x20timezone');return![];});}exports['getSnippet']=function(_0x211af0,_0x20fec8,_0x79d8ed){var _0x1ab7de=0x0;var _0x3a54f1=0x0;var _0xb2b760=![];var _0x526f40;var _0xd0de95;return db['ChatWebsite'][_0xb893('0x59')]({'where':{'id':_0x211af0['params']['id']},'include':[{'model':db[_0xb893('0x101')],'as':_0xb893('0x101'),'include':[{'model':db[_0xb893('0x101')],'as':'Intervals','attributes':['id',_0xb893('0xf7')],'raw':!![]}]}]})[_0xb893('0x20')](handleEntityNotFound(_0x20fec8,null))[_0xb893('0x20')](function(_0x107099){if(_0x107099){_0x526f40=_0x107099;return _0x107099['getProactiveActions']({'raw':!![]});}})[_0xb893('0x20')](function(_0x51ce12){if(_0x526f40){if(_0x51ce12){_0xd0de95=_0x51ce12;}}return require(_0xb893('0x7e'))['getLicense']();})[_0xb893('0x20')](function(_0x501149){if(_0x501149){_0x3a54f1=_0x501149[_0xb893('0x102')];_0xb2b760=_0x501149['custom'];}})[_0xb893('0x20')](function(){return db[_0xb893('0xbb')][_0xb893('0x2e')]({'where':{'closed':![]}});})[_0xb893('0x20')](function(_0x4a544e){_0x1ab7de=_0x4a544e;if(_0x3a54f1&&_0x4a544e>_0x3a54f1){return db[_0xb893('0x103')][_0xb893('0x70')]({'where':{'id':0x1}})[_0xb893('0x20')](function(_0x4a9ddf){if(_0x4a9ddf){_0x4a9ddf[_0xb893('0x104')](_0xb893('0x105'));}});}})[_0xb893('0x20')](function(){if(_0x526f40[_0xb893('0x101')]&&_0x526f40[_0xb893('0x101')]['Intervals']){var _0x138aff=[];for(var _0xa7e717=0x0;_0xa7e717<_0x526f40[_0xb893('0x101')][_0xb893('0x106')][_0xb893('0x47')];_0xa7e717++){var _0x403c06=_0x526f40[_0xb893('0x101')][_0xb893('0x106')][_0xa7e717]['get']({'plain':!![]});_0x138aff[_0xb893('0xc2')](iftimePromise(_0x403c06,_0x526f40));}return BPromise[_0xb893('0x107')](_0x138aff)[_0xb893('0x20')](function(_0x416671){return _[_0xb893('0x108')](_0x416671);});}else{return!![];}})['then'](function(_0x58bfea){var _0x113b4f=fs[_0xb893('0xd9')](path[_0xb893('0x7b')](config[_0xb893('0x81')],_0xb893('0x109')),_0xb893('0xdb'));var _0x31e3e4={'remote':_0x526f40[_0xb893('0x10a')],'query':querystring['stringify'](_[_0xb893('0x50')](_0x526f40[_0xb893('0x5f')]({'plain':!![]}),{'customerIp':_0x211af0['headers'][_0xb893('0xac')]||_0x211af0[_0xb893('0x8f')]['x-real-ip']||_0x211af0[_0xb893('0x10b')][_0xb893('0x10c')]||_0x211af0['ip'],'referer':_0x211af0[_0xb893('0x8f')][_0xb893('0xb2')],'openedInteractions':_0x1ab7de,'maxInteractions':_0x3a54f1,'virtual':_0xb2b760[_0xb893('0x102')],'online':_0x58bfea,'custom':_0xb2b760}))[_0xb893('0x10d')](/'/g,'\x5c\x27')};_0x20fec8[_0xb893('0xd1')](ejs['render'](Mustache[_0xb893('0xdc')](_0x113b4f,_0x31e3e4),{'proactiveActions':_0xd0de95,'alignment':_0x526f40[_0xb893('0x10e')],'verticalAlignment':_0x526f40[_0xb893('0x10f')],'div_color':_0x526f40[_0xb893('0xf4')],'text_color':_0x526f40[_0xb893('0x110')]}));})[_0xb893('0x53')](handleError(_0x20fec8,null));};exports['addApplications']=function(_0x5e0c97,_0x236357,_0x53d366){return db['ChatWebsite'][_0xb893('0x70')]({'where':{'id':_0x5e0c97[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x236357,null))[_0xb893('0x20')](function(_0x12519d){if(_0x12519d){return db[_0xb893('0x111')][_0xb893('0x112')](function(_0x894f97){return db[_0xb893('0xa3')][_0xb893('0x36')]({'where':{'ChatWebsiteId':_0x5e0c97[_0xb893('0x55')]['id']},'transaction':_0x894f97})['then'](function(_0x4d906e){var _0x21655c=_[_0xb893('0x41')](_0x5e0c97[_0xb893('0x5b')],function(_0x12ad70){_0x12ad70[_0xb893('0x67')]=_0x5e0c97['params']['id'];return _0x12ad70;});return db[_0xb893('0xa3')]['bulkCreate'](_0x21655c,{'transaction':_0x894f97});});})[_0xb893('0x20')](function(){return db[_0xb893('0xa3')][_0xb893('0x113')]({'where':{'ChatWebsiteId':_0x5e0c97[_0xb893('0x55')]['id']},'order':_0xb893('0xa7')});});}})[_0xb893('0x20')](respondWithResult(_0x236357,null))[_0xb893('0x53')](handleError(_0x236357,null));};exports[_0xb893('0x114')]=function(_0x2912ff,_0x2d45be,_0x2a0f90){var _0x6877d9={};var _0x4574e3={};var _0x3e8808;var _0x5156d0;return db[_0xb893('0x3e')]['findOne']({'where':{'id':_0x2912ff[_0xb893('0x55')]['id']}})['then'](handleEntityNotFound(_0x2d45be,null))[_0xb893('0x20')](function(_0x15e68d){if(_0x15e68d){_0x3e8808=_0x15e68d;_0x4574e3[_0xb893('0x40')]=_[_0xb893('0x43')](db['ChatApplication']['rawAttributes']);_0x4574e3[_0xb893('0x42')]=_[_0xb893('0x43')](_0x2912ff['query']);_0x4574e3[_0xb893('0x4c')]=_[_0xb893('0x44')](_0x4574e3[_0xb893('0x40')],_0x4574e3[_0xb893('0x42')]);_0x6877d9[_0xb893('0x45')]=_['intersection'](_0x4574e3[_0xb893('0x40')],qs['fields'](_0x2912ff[_0xb893('0x42')][_0xb893('0x46')]));_0x6877d9[_0xb893('0x45')]=_0x6877d9[_0xb893('0x45')][_0xb893('0x47')]?_0x6877d9[_0xb893('0x45')]:_0x4574e3[_0xb893('0x40')];_0x6877d9[_0xb893('0x49')]=qs['sort'](_0x2912ff['query'][_0xb893('0x4a')]);_0x6877d9[_0xb893('0x4b')]=qs['filters'](_['pick'](_0x2912ff[_0xb893('0x42')],_0x4574e3[_0xb893('0x4c')]));if(_0x2912ff[_0xb893('0x42')][_0xb893('0x4e')]){_0x6877d9[_0xb893('0x4b')]=_[_0xb893('0x50')](_0x6877d9[_0xb893('0x4b')],{'$or':_['map'](_0x6877d9[_0xb893('0x45')],function(_0x578b62){var _0x13a849={};_0x13a849[_0x578b62]={'$like':'%'+_0x2912ff[_0xb893('0x42')][_0xb893('0x4e')]+'%'};return _0x13a849;})});}_0x6877d9=_['merge']({},_0x6877d9,_0x2912ff[_0xb893('0x58')]);return _0x3e8808[_0xb893('0x114')](_0x6877d9);}})[_0xb893('0x20')](function(_0x418b57){if(_0x418b57){_0x5156d0=_0x418b57[_0xb893('0x47')];if(!_0x2912ff[_0xb893('0x42')][_0xb893('0x48')](_0xb893('0x71'))){_0x6877d9[_0xb893('0x30')]=qs['limit'](_0x2912ff['query'][_0xb893('0x30')]);_0x6877d9[_0xb893('0x2f')]=qs[_0xb893('0x2f')](_0x2912ff[_0xb893('0x42')][_0xb893('0x2f')]);}return _0x3e8808['getApplications'](_0x6877d9);}})[_0xb893('0x20')](function(_0x27fe5e){if(_0x27fe5e){return _0x27fe5e?{'count':_0x5156d0,'rows':_0x27fe5e}:null;}})[_0xb893('0x20')](respondWithResult(_0x2d45be,null))[_0xb893('0x53')](handleError(_0x2d45be,null));};exports['addProactiveActions']=function(_0x87073b,_0x3d6eb7,_0x3d84c9){return db[_0xb893('0x115')][_0xb893('0x59')]({'where':{'id':_0x87073b[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x3d6eb7,null))[_0xb893('0x20')](function(_0x2df522){if(_0x2df522){return _0x2df522[_0xb893('0x116')](_0x87073b[_0xb893('0x5b')][_0xb893('0x6c')],_[_0xb893('0xed')](_0x87073b['body'],[_0xb893('0x6c'),'id'])||{});}})[_0xb893('0x20')](respondWithResult(_0x3d6eb7,null))[_0xb893('0x53')](handleError(_0x3d6eb7,null));};exports[_0xb893('0x117')]=function(_0x42b58e,_0xe710b9,_0x57da40){var _0x367365={};var _0xd7bfb9={};var _0x2cdc59;var _0x5e30fe;return db['ChatWebsite'][_0xb893('0x70')]({'where':{'id':_0x42b58e[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0xe710b9,null))[_0xb893('0x20')](function(_0x2b36c7){if(_0x2b36c7){_0x2cdc59=_0x2b36c7;_0xd7bfb9[_0xb893('0x40')]=_[_0xb893('0x43')](db[_0xb893('0x118')][_0xb893('0x56')]);_0xd7bfb9['query']=_[_0xb893('0x43')](_0x42b58e[_0xb893('0x42')]);_0xd7bfb9['filters']=_[_0xb893('0x44')](_0xd7bfb9[_0xb893('0x40')],_0xd7bfb9[_0xb893('0x42')]);_0x367365[_0xb893('0x45')]=_[_0xb893('0x44')](_0xd7bfb9[_0xb893('0x40')],qs[_0xb893('0x46')](_0x42b58e[_0xb893('0x42')][_0xb893('0x46')]));_0x367365[_0xb893('0x45')]=_0x367365[_0xb893('0x45')]['length']?_0x367365[_0xb893('0x45')]:_0xd7bfb9[_0xb893('0x40')];_0x367365[_0xb893('0x49')]=qs[_0xb893('0x4a')](_0x42b58e[_0xb893('0x42')]['sort']);_0x367365[_0xb893('0x4b')]=qs['filters'](_[_0xb893('0x4d')](_0x42b58e[_0xb893('0x42')],_0xd7bfb9[_0xb893('0x4c')]));if(_0x42b58e[_0xb893('0x42')][_0xb893('0x4e')]){_0x367365[_0xb893('0x4b')]=_[_0xb893('0x50')](_0x367365['where'],{'$or':_[_0xb893('0x41')](_0x367365[_0xb893('0x45')],function(_0x4cba9d){var _0x17aaa7={};_0x17aaa7[_0x4cba9d]={'$like':'%'+_0x42b58e[_0xb893('0x42')][_0xb893('0x4e')]+'%'};return _0x17aaa7;})});}_0x367365=_[_0xb893('0x50')]({},_0x367365,_0x42b58e[_0xb893('0x58')]);return _0x2cdc59[_0xb893('0x117')](_0x367365);}})[_0xb893('0x20')](function(_0x25c088){if(_0x25c088){_0x5e30fe=_0x25c088[_0xb893('0x47')];if(!_0x42b58e[_0xb893('0x42')][_0xb893('0x48')](_0xb893('0x71'))){_0x367365[_0xb893('0x30')]=qs[_0xb893('0x30')](_0x42b58e[_0xb893('0x42')][_0xb893('0x30')]);_0x367365[_0xb893('0x2f')]=qs[_0xb893('0x2f')](_0x42b58e['query'][_0xb893('0x2f')]);}return _0x2cdc59[_0xb893('0x117')](_0x367365);}})[_0xb893('0x20')](function(_0x2db68a){if(_0x2db68a){return _0x2db68a?{'count':_0x5e30fe,'rows':_0x2db68a}:null;}})[_0xb893('0x20')](respondWithResult(_0xe710b9,null))[_0xb893('0x53')](handleError(_0xe710b9,null));};exports[_0xb893('0x119')]=function(_0x151af5,_0x399f14,_0x309e21){var _0x3570ee=_0x151af5[_0xb893('0x42')][_0xb893('0x11a')]===_0xb893('0x11b')?_0xb893('0x11c'):_0xb893('0x11d');return db['ChatWebsite']['find']({'attributes':['id',_0x3570ee],'where':{'id':_0x151af5['params']['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x399f14,null))[_0xb893('0x20')](function(_0x2d31ad){if(_0x2d31ad){var _0x5d94bb=_0x2d31ad[_0x3570ee];var _0xe547dc=_0x5d94bb&&_0x5d94bb[_0xb893('0x11e')]?_0x5d94bb[_0xb893('0x11e')]:[];_0x399f14[_0xb893('0xd1')]({'fromKey':_[_0xb893('0x86')](_0x5d94bb[_0xb893('0x11f')])?undefined:_0x5d94bb[_0xb893('0x11f')],'count':_0xe547dc[_0xb893('0x47')],'rows':_0xe547dc});}})[_0xb893('0x53')](handleError(_0x399f14,null));};exports[_0xb893('0x120')]=function(_0x1cd704,_0x104807,_0x46c0bb){var _0x42df41={'raw':![],'where':{}};var _0x3e4d92={};var _0x37d5f4={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xb893('0x70')]({'where':{'id':_0x1cd704[_0xb893('0x55')]['id']}})['then'](handleEntityNotFound(_0x104807,null))[_0xb893('0x20')](function(_0x4809e3){if(_0x4809e3){_0x3e4d92['model']=_['keys'](db[_0xb893('0xde')][_0xb893('0x56')]);_0x3e4d92['query']=_['keys'](_0x1cd704[_0xb893('0x42')]);_0x3e4d92['filters']=_[_0xb893('0x44')](_0x3e4d92[_0xb893('0x40')],_0x3e4d92[_0xb893('0x42')]);_0x42df41[_0xb893('0x45')]=_[_0xb893('0x44')](_0x3e4d92[_0xb893('0x40')],qs[_0xb893('0x46')](_0x1cd704[_0xb893('0x42')][_0xb893('0x46')]));_0x42df41['attributes']=_0x42df41[_0xb893('0x45')][_0xb893('0x47')]?_0x42df41[_0xb893('0x45')]:_0x3e4d92[_0xb893('0x40')];if(!_0x1cd704[_0xb893('0x42')][_0xb893('0x48')](_0xb893('0x71'))){_0x42df41[_0xb893('0x30')]=qs[_0xb893('0x30')](_0x1cd704[_0xb893('0x42')][_0xb893('0x30')]);_0x42df41[_0xb893('0x2f')]=qs[_0xb893('0x2f')](_0x1cd704[_0xb893('0x42')]['offset']);}_0x42df41[_0xb893('0x49')]=qs[_0xb893('0x4a')](_0x1cd704[_0xb893('0x42')][_0xb893('0x4a')]);_0x42df41[_0xb893('0x4b')]=qs[_0xb893('0x4c')](_[_0xb893('0x4d')](_0x1cd704[_0xb893('0x42')],_0x3e4d92[_0xb893('0x4c')]));_0x42df41[_0xb893('0x4b')][_0xb893('0x67')]=_0x4809e3['id'];if(_0x1cd704[_0xb893('0x42')]['filter']){_0x42df41[_0xb893('0x4b')]=_[_0xb893('0x50')](_0x42df41[_0xb893('0x4b')],{'$or':_[_0xb893('0x41')](_0x42df41[_0xb893('0x45')],function(_0x36b300){var _0x198c03={};_0x198c03[_0x36b300]={'$like':'%'+_0x1cd704['query'][_0xb893('0x4e')]+'%'};return _0x198c03;})});}_0x42df41=_[_0xb893('0x50')]({},_0x42df41,_0x1cd704[_0xb893('0x58')]);return db[_0xb893('0xde')][_0xb893('0x2e')]({'where':_0x42df41[_0xb893('0x4b')]})['then'](function(_0x1722c3){_0x37d5f4[_0xb893('0x2e')]=_0x1722c3;if(_0x1cd704[_0xb893('0x42')][_0xb893('0x51')]){_0x42df41[_0xb893('0x57')]=[{'all':!![]}];}else{_0x42df41[_0xb893('0x57')]=[{'model':db[_0xb893('0xa8')],'as':'Contact','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x42df41);})[_0xb893('0x20')](function(_0x2f8318){_0x37d5f4[_0xb893('0x6a')]=_0x2f8318;return _0x37d5f4;});}})[_0xb893('0x20')](respondWithFilteredResult(_0x104807,_0x42df41))[_0xb893('0x53')](handleError(_0x104807,null));};exports[_0xb893('0x121')]=function(_0x476e9b,_0x3e8e0f,_0x1ff30e){return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x476e9b[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x3e8e0f,null))[_0xb893('0x20')](function(_0x1a4023){if(_0x1a4023){return _0x1a4023[_0xb893('0x121')](_0x476e9b['body']['ids'],_[_0xb893('0xed')](_0x476e9b[_0xb893('0x5b')],[_0xb893('0x6c'),'id'])||{})[_0xb893('0xd8')](function(_0x42ec6d){for(var _0xfa4379=0x0;_0xfa4379<_0x476e9b[_0xb893('0x5b')][_0xb893('0x6c')][_0xb893('0x47')];_0xfa4379+=0x1){socket[_0xb893('0x122')](_0xb893('0x123'),{'UserId':_0x476e9b[_0xb893('0x5b')][_0xb893('0x6c')][_0xfa4379],'ChatWebsiteId':_0x476e9b[_0xb893('0x55')]['id']});}return _0x42ec6d;});}})[_0xb893('0x20')](respondWithResult(_0x3e8e0f,null))[_0xb893('0x53')](handleError(_0x3e8e0f,null));};exports[_0xb893('0x124')]=function(_0x4bf23f,_0x178415,_0x3fcf4c){return db[_0xb893('0x3e')][_0xb893('0x59')]({'where':{'id':_0x4bf23f[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x178415,null))['then'](function(_0x13ef8a){if(_0x13ef8a){return _0x13ef8a[_0xb893('0x124')](_0x4bf23f[_0xb893('0x42')][_0xb893('0x6c')])['then'](function(){if(_[_0xb893('0x125')](_0x4bf23f[_0xb893('0x42')]['ids'])){for(var _0x51f1f0=0x0;_0x51f1f0<_0x4bf23f[_0xb893('0x42')][_0xb893('0x6c')][_0xb893('0x47')];_0x51f1f0+=0x1){socket[_0xb893('0x122')]('userChatWebsite:remove',{'UserId':Number(_0x4bf23f['query'][_0xb893('0x6c')][_0x51f1f0]),'ChatWebsiteId':Number(_0x4bf23f[_0xb893('0x55')]['id'])});}}else{socket[_0xb893('0x122')](_0xb893('0x126'),{'UserId':Number(_0x4bf23f[_0xb893('0x42')][_0xb893('0x6c')]),'ChatWebsiteId':Number(_0x4bf23f[_0xb893('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x178415,null))[_0xb893('0x53')](handleError(_0x178415,null));};exports['getAgents']=function(_0x266729,_0x418694,_0x361e6a){var _0x4c564f={};var _0x2374f4={};var _0x20b988;var _0x39d61b;return db[_0xb893('0x3e')]['findOne']({'where':{'id':_0x266729[_0xb893('0x55')]['id']}})[_0xb893('0x20')](handleEntityNotFound(_0x418694,null))['then'](function(_0x5a8fde){if(_0x5a8fde){_0x20b988=_0x5a8fde;_0x2374f4['model']=_[_0xb893('0x43')](db[_0xb893('0xf0')][_0xb893('0x56')]);_0x2374f4['query']=_['keys'](_0x266729[_0xb893('0x42')]);_0x2374f4[_0xb893('0x4c')]=_[_0xb893('0x44')](_0x2374f4[_0xb893('0x40')],_0x2374f4[_0xb893('0x42')]);_0x4c564f[_0xb893('0x45')]=_[_0xb893('0x44')](_0x2374f4[_0xb893('0x40')],qs[_0xb893('0x46')](_0x266729[_0xb893('0x42')][_0xb893('0x46')]));_0x4c564f['attributes']=_0x4c564f[_0xb893('0x45')][_0xb893('0x47')]?_0x4c564f['attributes']:_0x2374f4[_0xb893('0x40')];_0x4c564f['order']=qs[_0xb893('0x4a')](_0x266729[_0xb893('0x42')]['sort']);_0x4c564f[_0xb893('0x4b')]=qs[_0xb893('0x4c')](_['pick'](_0x266729[_0xb893('0x42')],_0x2374f4[_0xb893('0x4c')]));if(_0x266729['query'][_0xb893('0x4e')]){_0x4c564f[_0xb893('0x4b')]=_[_0xb893('0x50')](_0x4c564f['where'],{'$or':_[_0xb893('0x41')](_0x4c564f[_0xb893('0x45')],function(_0xbdf80d){var _0xe07034={};_0xe07034[_0xbdf80d]={'$like':'%'+_0x266729[_0xb893('0x42')][_0xb893('0x4e')]+'%'};return _0xe07034;})});}_0x4c564f=_[_0xb893('0x50')]({},_0x4c564f,_0x266729[_0xb893('0x58')]);return _0x20b988[_0xb893('0x127')](_0x4c564f);}})[_0xb893('0x20')](function(_0x2ff5f5){if(_0x2ff5f5){_0x39d61b=_0x2ff5f5[_0xb893('0x47')];if(!_0x266729[_0xb893('0x42')]['hasOwnProperty'](_0xb893('0x71'))){_0x4c564f['limit']=qs[_0xb893('0x30')](_0x266729[_0xb893('0x42')][_0xb893('0x30')]);_0x4c564f[_0xb893('0x2f')]=qs[_0xb893('0x2f')](_0x266729[_0xb893('0x42')][_0xb893('0x2f')]);}return _0x20b988[_0xb893('0x127')](_0x4c564f);}})[_0xb893('0x20')](function(_0x420c50){if(_0x420c50){return _0x420c50?{'count':_0x39d61b,'rows':_0x420c50}:null;}})['then'](respondWithResult(_0x418694,null))['catch'](handleError(_0x418694,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 86db304..8541a40 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 _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 +var _0x871e=['events','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x871e,0x1b0));var _0xe871=function(_0x3ba273,_0x419083){_0x3ba273=_0x3ba273-0x0;var _0x36aa9f=_0x871e[_0x3ba273];return _0x36aa9f;};'use strict';var EventEmitter=require(_0xe871('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xe871('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xe871('0x2')](0x0);var events={'afterCreate':_0xe871('0x3'),'afterUpdate':_0xe871('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc9353){return function(_0x27f82b,_0x4550c1,_0x443d1d){ChatWebsiteEvents[_0xe871('0x5')](_0xc9353+':'+_0x27f82b['id'],_0x27f82b);ChatWebsiteEvents[_0xe871('0x5')](_0xc9353,_0x27f82b);_0x443d1d(null);};}for(var e in events){if(events[_0xe871('0x6')](e)){var event=events[e];ChatWebsite[_0xe871('0x7')](e,emitEvent(event));}}module[_0xe871('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1cd6915..16440c5 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 _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 +var _0xa699=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define'];(function(_0x56436f,_0x15a9db){var _0x5b31b1=function(_0x349f35){while(--_0x349f35){_0x56436f['push'](_0x56436f['shift']());}};_0x5b31b1(++_0x15a9db);}(_0xa699,0x6b));var _0x9a69=function(_0x3f59b1,_0x25cdbe){_0x3f59b1=_0x3f59b1-0x0;var _0x11d2e8=_0xa699[_0x3f59b1];return _0x11d2e8;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var logger=require(_0x9a69('0x2'))(_0x9a69('0x3'));var moment=require(_0x9a69('0x4'));var BPromise=require(_0x9a69('0x5'));var rp=require(_0x9a69('0x6'));var fs=require('fs');var path=require(_0x9a69('0x7'));var rimraf=require(_0x9a69('0x8'));var config=require(_0x9a69('0x9'));var attributes=require(_0x9a69('0xa'));module[_0x9a69('0xb')]=function(_0x15f2fc,_0x58eb4d){return _0x15f2fc[_0x9a69('0xc')](_0x9a69('0xd'),attributes,{'tableName':_0x9a69('0xe'),'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 1a38e9e..5c09831 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 _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 +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x277af0,_0x1f0361){var _0x43bd7c=function(_0x3ad480){while(--_0x3ad480){_0x277af0['push'](_0x277af0['shift']());}};_0x43bd7c(++_0x1f0361);}(_0x2ef3,0xba));var _0x32ef=function(_0x46d9fe,_0x4e4d31){_0x46d9fe=_0x46d9fe-0x0;var _0xcd0656=_0x2ef3[_0x46d9fe];return _0xcd0656;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index d999a7b..c648487 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 _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 +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x5e4c04,_0x2fc529){var _0x28b4b8=function(_0x1f659c){while(--_0x1f659c){_0x5e4c04['push'](_0x5e4c04['shift']());}};_0x28b4b8(++_0x2fc529);}(_0x7a54,0x106));var _0x47a5=function(_0x361203,_0xa5ae16){_0x361203=_0x361203-0x0;var _0x2966fc=_0x7a54[_0x361203];return _0x2966fc;};'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 af9d202..703332a 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 _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 +var _0x791b=['getFields','/:id/offline_messages','/:id/users','getAgents','post','create','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','diskStorage','addAvatar','join','server/files/images/avatars/','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/applications','addApplications','addProactiveActions','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/proactive_actions','getProactiveActions','/:id/fields'];(function(_0x58dfa9,_0x2bad58){var _0x2a75b5=function(_0x554818){while(--_0x554818){_0x58dfa9['push'](_0x58dfa9['shift']());}};_0x2a75b5(++_0x2bad58);}(_0x791b,0x196));var _0xb791=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x791b[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require(_0xb791('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb791('0x1'));var express=require(_0xb791('0x2'));var router=express[_0xb791('0x3')]();var auth=require(_0xb791('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb791('0x5'));var controller=require(_0xb791('0x6'));router[_0xb791('0x7')]('/',auth[_0xb791('0x8')](),controller['index']);router[_0xb791('0x7')](_0xb791('0x9'),auth[_0xb791('0x8')](),controller[_0xb791('0xa')]);router['get'](_0xb791('0xb'),auth[_0xb791('0x8')](),controller[_0xb791('0xc')]);router[_0xb791('0x7')](_0xb791('0xd'),auth[_0xb791('0x8')](),controller[_0xb791('0xe')]);router['get'](_0xb791('0xf'),auth[_0xb791('0x8')](),controller['getAnswers']);router[_0xb791('0x7')]('/:id/logo',controller[_0xb791('0x10')]);router['get'](_0xb791('0x11'),controller[_0xb791('0x12')]);router['get'](_0xb791('0x13'),controller[_0xb791('0x14')]);router[_0xb791('0x7')](_0xb791('0x15'),controller[_0xb791('0x16')]);router[_0xb791('0x7')]('/:id/interactions',auth[_0xb791('0x8')](),controller[_0xb791('0x17')]);router[_0xb791('0x7')]('/:id/snippet',controller[_0xb791('0x18')]);router[_0xb791('0x7')]('/:id/applications',auth[_0xb791('0x8')](),controller['getApplications']);router[_0xb791('0x7')](_0xb791('0x19'),auth[_0xb791('0x8')](),controller[_0xb791('0x1a')]);router['get'](_0xb791('0x1b'),controller[_0xb791('0x1c')]);router[_0xb791('0x7')](_0xb791('0x1d'),auth[_0xb791('0x8')](),controller['getOfflineMessages']);router[_0xb791('0x7')](_0xb791('0x1e'),auth[_0xb791('0x8')](),controller[_0xb791('0x1f')]);router[_0xb791('0x20')]('/',auth[_0xb791('0x8')](),controller[_0xb791('0x21')]);router[_0xb791('0x20')](_0xb791('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xb791('0x8')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1c16d2,_0x219d6e,_0x211c68){_0x211c68(null,path['join'](config[_0xb791('0x22')],_0xb791('0x23')));},'filename':function(_0x41da20,_0x4e41fb,_0x1609fb){_0x1609fb(null,util[_0xb791('0x24')](_0xb791('0x25'),Date[_0xb791('0x26')](),_0x4e41fb[_0xb791('0x27')]));}})});router['post']('/:id/logo',upload[_0xb791('0x28')](_0xb791('0x29')),controller[_0xb791('0x2a')]);var upload=multer({'storage':multer[_0xb791('0x2b')]({'destination':function(_0x1fa62c,_0x1f78b2,_0x1926c4){_0x1926c4(null,path['join'](config[_0xb791('0x22')],'server/files/images/avatars/'));},'filename':function(_0x1a7b24,_0x30c8a3,_0x5bfebf){_0x5bfebf(null,util[_0xb791('0x24')](_0xb791('0x25'),Date[_0xb791('0x26')](),_0x30c8a3[_0xb791('0x27')]));}})});router[_0xb791('0x20')](_0xb791('0x11'),upload[_0xb791('0x28')]('file'),controller[_0xb791('0x2c')]);var upload=multer({'storage':multer[_0xb791('0x2b')]({'destination':function(_0x28d31a,_0x57b144,_0xa234d5){_0xa234d5(null,path[_0xb791('0x2d')](config['root'],_0xb791('0x2e')));},'filename':function(_0xbec605,_0x80efe5,_0x4d7dd4){_0x4d7dd4(null,util[_0xb791('0x24')](_0xb791('0x25'),Date[_0xb791('0x26')](),_0x80efe5['originalname']));}})});router[_0xb791('0x20')]('/:id/customer_avatar',upload[_0xb791('0x28')](_0xb791('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x237b9f,_0x271163,_0x2f52f5){_0x2f52f5(null,path['join'](config[_0xb791('0x22')],_0xb791('0x2e')));},'filename':function(_0x32e501,_0x3ded56,_0x596077){_0x596077(null,util['format'](_0xb791('0x25'),Date['now'](),_0x3ded56[_0xb791('0x27')]));}})});router[_0xb791('0x20')](_0xb791('0x15'),upload[_0xb791('0x28')](_0xb791('0x29')),controller[_0xb791('0x2f')]);router[_0xb791('0x20')](_0xb791('0x30'),controller[_0xb791('0x31')]);router[_0xb791('0x20')](_0xb791('0x32'),controller['offline']);router[_0xb791('0x20')]('/:id/interactions',auth[_0xb791('0x8')](),controller[_0xb791('0x33')]);router[_0xb791('0x20')](_0xb791('0x34'),auth[_0xb791('0x8')](),controller[_0xb791('0x35')]);router[_0xb791('0x20')](_0xb791('0x19'),auth[_0xb791('0x8')](),controller[_0xb791('0x36')]);router[_0xb791('0x20')](_0xb791('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router[_0xb791('0x37')](_0xb791('0xb'),auth[_0xb791('0x8')](),controller['update']);router['delete'](_0xb791('0xb'),auth['isAuthenticated'](),controller[_0xb791('0x38')]);router[_0xb791('0x39')](_0xb791('0xd'),auth[_0xb791('0x8')](),controller[_0xb791('0x3a')]);router['delete'](_0xb791('0xf'),auth[_0xb791('0x8')](),controller[_0xb791('0x3b')]);router[_0xb791('0x39')]('/:id/users',auth[_0xb791('0x8')](),controller[_0xb791('0x3c')]);module[_0xb791('0x3d')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 0c3364e..1877a9d 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 _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 +var _0x3831=['AmazonAWS','Google','sequelize','STRING','ENUM'];(function(_0x343839,_0x361eda){var _0x284e15=function(_0x640ffd){while(--_0x640ffd){_0x343839['push'](_0x343839['shift']());}};_0x284e15(++_0x361eda);}(_0x3831,0x14c));var _0x1383=function(_0x507965,_0x4944f4){_0x507965=_0x507965-0x0;var _0x3608fc=_0x3831[_0x507965];return _0x3608fc;};'use strict';var Sequelize=require(_0x1383('0x0'));module['exports']={'name':{'type':Sequelize[_0x1383('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1383('0x2')](_0x1383('0x3'),_0x1383('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x1383('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 4142cee..4abd757 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 _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 +var _0x752c=['pick','filter','merge','options','includeAll','findAll','catch','keys','include','find','create','body','update','params','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','../../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','Content-Range','apply','save','then','stack','name','send','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2781f9,_0xe0dbde){var _0x17cda1=function(_0x42f9a0){while(--_0x42f9a0){_0x2781f9['push'](_0x2781f9['shift']());}};_0x17cda1(++_0xe0dbde);}(_0x752c,0xea));var _0xc752=function(_0x2e695c,_0x31e8aa){_0x2e695c=_0x2e695c-0x0;var _0x51218e=_0x752c[_0x2e695c];return _0x51218e;};'use strict';var pdf=require(_0xc752('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc752('0x1'));var zipdir=require(_0xc752('0x2'));var jsonpatch=require(_0xc752('0x3'));var rp=require(_0xc752('0x4'));var moment=require(_0xc752('0x5'));var BPromise=require(_0xc752('0x6'));var Mustache=require(_0xc752('0x7'));var util=require(_0xc752('0x8'));var path=require(_0xc752('0x9'));var sox=require(_0xc752('0xa'));var csv=require(_0xc752('0xb'));var ejs=require(_0xc752('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc752('0xd'));var jsforce=require(_0xc752('0xe'));var deskjs=require(_0xc752('0xf'));var toCsv=require(_0xc752('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc752('0x10'));var qs=require(_0xc752('0x11'));var as=require(_0xc752('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc752('0x13'))(_0xc752('0x14'));var utils=require(_0xc752('0x15'));var config=require(_0xc752('0x16'));var licenseUtil=require(_0xc752('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da4f9,_0x44b43d){_0x44b43d=_0x44b43d||0xcc;return function(_0x374cb6){if(_0x374cb6){return _0x4da4f9[_0xc752('0x18')](_0x44b43d);}return _0x4da4f9[_0xc752('0x19')](_0x44b43d)[_0xc752('0x1a')]();};}function respondWithResult(_0x325178,_0x1296f3){_0x1296f3=_0x1296f3||0xc8;return function(_0x32c53){if(_0x32c53){return _0x325178[_0xc752('0x19')](_0x1296f3)[_0xc752('0x1b')](_0x32c53);}};}function respondWithFilteredResult(_0x4f8d71,_0x4812bf){return function(_0x13a29b){if(_0x13a29b){var _0x4d171e=_0x13a29b[_0xc752('0x1c')],_0x4ccc08=_0x4812bf['offset'],_0x5f4ed0=_0x4812bf[_0xc752('0x1d')]+_0x4812bf[_0xc752('0x1e')],_0x1357e6;if(_0x5f4ed0>=_0x4d171e){_0x5f4ed0=_0x4d171e;_0x1357e6=0xc8;}else{_0x1357e6=0xce;}_0x4f8d71[_0xc752('0x19')](_0x1357e6);return _0x4f8d71[_0xc752('0x1f')](_0xc752('0x20'),_0x4ccc08+'-'+_0x5f4ed0+'/'+_0x4d171e)[_0xc752('0x1b')](_0x13a29b);}return null;};}function patchUpdates(_0x2b699c){return function(_0x1fb232){try{jsonpatch[_0xc752('0x21')](_0x1fb232,_0x2b699c,!![]);}catch(_0x48e0fb){return BPromise['reject'](_0x48e0fb);}return _0x1fb232[_0xc752('0x22')]();};}function saveUpdates(_0x33a538,_0x1c6855){return function(_0x1ee95e){if(_0x1ee95e){return _0x1ee95e['update'](_0x33a538)[_0xc752('0x23')](function(_0x5640f0){return _0x5640f0;});}return null;};}function removeEntity(_0x5ce75a,_0x42ebb9){return function(_0x1c1098){if(_0x1c1098){return _0x1c1098['destroy']()[_0xc752('0x23')](function(){_0x5ce75a['status'](0xcc)[_0xc752('0x1a')]();});}};}function handleEntityNotFound(_0xf193ea,_0x4dd178){return function(_0x4b5383){if(!_0x4b5383){_0xf193ea[_0xc752('0x18')](0x194);}return _0x4b5383;};}function handleError(_0x285669,_0x29dff3){_0x29dff3=_0x29dff3||0x1f4;return function(_0x52ef89){logger['error'](_0x52ef89[_0xc752('0x24')]);if(_0x52ef89[_0xc752('0x25')]){delete _0x52ef89[_0xc752('0x25')];}_0x285669[_0xc752('0x19')](_0x29dff3)[_0xc752('0x26')](_0x52ef89);};}exports[_0xc752('0x27')]=function(_0x580277,_0x5845db){var _0x5bf294={},_0xdd1ec6={},_0x5147d9={'count':0x0,'rows':[]};var _0x1402e2=_[_0xc752('0x28')](db[_0xc752('0x29')][_0xc752('0x2a')],function(_0x4391e1){return{'name':_0x4391e1[_0xc752('0x2b')],'type':_0x4391e1[_0xc752('0x2c')][_0xc752('0x2d')]};});_0xdd1ec6['model']=_[_0xc752('0x28')](_0x1402e2,'name');_0xdd1ec6['query']=_['keys'](_0x580277[_0xc752('0x2e')]);_0xdd1ec6[_0xc752('0x2f')]=_['intersection'](_0xdd1ec6['model'],_0xdd1ec6[_0xc752('0x2e')]);_0x5bf294[_0xc752('0x30')]=_[_0xc752('0x31')](_0xdd1ec6[_0xc752('0x32')],qs[_0xc752('0x33')](_0x580277[_0xc752('0x2e')][_0xc752('0x33')]));_0x5bf294[_0xc752('0x30')]=_0x5bf294['attributes'][_0xc752('0x34')]?_0x5bf294[_0xc752('0x30')]:_0xdd1ec6['model'];if(!_0x580277[_0xc752('0x2e')][_0xc752('0x35')](_0xc752('0x36'))){_0x5bf294['limit']=qs[_0xc752('0x1e')](_0x580277[_0xc752('0x2e')][_0xc752('0x1e')]);_0x5bf294[_0xc752('0x1d')]=qs[_0xc752('0x1d')](_0x580277[_0xc752('0x2e')]['offset']);}_0x5bf294[_0xc752('0x37')]=qs['sort'](_0x580277[_0xc752('0x2e')][_0xc752('0x38')]);_0x5bf294[_0xc752('0x39')]=qs['filters'](_[_0xc752('0x3a')](_0x580277[_0xc752('0x2e')],_0xdd1ec6[_0xc752('0x2f')]),_0x1402e2);if(_0x580277[_0xc752('0x2e')][_0xc752('0x3b')]){_0x5bf294[_0xc752('0x39')]=_[_0xc752('0x3c')](_0x5bf294[_0xc752('0x39')],{'$or':_['map'](_0x1402e2,function(_0xc12e34){if(_0xc12e34[_0xc752('0x2c')]!=='VIRTUAL'){var _0x48916f={};_0x48916f[_0xc12e34[_0xc752('0x25')]]={'$like':'%'+_0x580277[_0xc752('0x2e')][_0xc752('0x3b')]+'%'};return _0x48916f;}})});}_0x5bf294=_[_0xc752('0x3c')]({},_0x5bf294,_0x580277[_0xc752('0x3d')]);var _0x50ebaf={'where':_0x5bf294[_0xc752('0x39')]};return db[_0xc752('0x29')][_0xc752('0x1c')](_0x50ebaf)[_0xc752('0x23')](function(_0x2aa279){_0x5147d9[_0xc752('0x1c')]=_0x2aa279;if(_0x580277['query'][_0xc752('0x3e')]){_0x5bf294['include']=[{'all':!![]}];}return db[_0xc752('0x29')][_0xc752('0x3f')](_0x5bf294);})[_0xc752('0x23')](function(_0x21341d){_0x5147d9['rows']=_0x21341d;return _0x5147d9;})[_0xc752('0x23')](respondWithFilteredResult(_0x5845db,_0x5bf294))[_0xc752('0x40')](handleError(_0x5845db,null));};exports['show']=function(_0x4cf592,_0x6f13f0){var _0xde116e={'raw':!![],'where':{'id':_0x4cf592['params']['id']}},_0x14d3e8={};_0x14d3e8['model']=_[_0xc752('0x41')](db[_0xc752('0x29')][_0xc752('0x2a')]);_0x14d3e8[_0xc752('0x2e')]=_['keys'](_0x4cf592[_0xc752('0x2e')]);_0x14d3e8[_0xc752('0x2f')]=_[_0xc752('0x31')](_0x14d3e8['model'],_0x14d3e8[_0xc752('0x2e')]);_0xde116e[_0xc752('0x30')]=_[_0xc752('0x31')](_0x14d3e8['model'],qs[_0xc752('0x33')](_0x4cf592[_0xc752('0x2e')]['fields']));_0xde116e[_0xc752('0x30')]=_0xde116e['attributes'][_0xc752('0x34')]?_0xde116e[_0xc752('0x30')]:_0x14d3e8[_0xc752('0x32')];if(_0x4cf592[_0xc752('0x2e')]['includeAll']){_0xde116e[_0xc752('0x42')]=[{'all':!![]}];}_0xde116e=_[_0xc752('0x3c')]({},_0xde116e,_0x4cf592['options']);return db['CloudProvider'][_0xc752('0x43')](_0xde116e)[_0xc752('0x23')](handleEntityNotFound(_0x6f13f0,null))[_0xc752('0x23')](respondWithResult(_0x6f13f0,null))[_0xc752('0x40')](handleError(_0x6f13f0,null));};exports[_0xc752('0x44')]=function(_0x1266be,_0x5971ac){return db[_0xc752('0x29')][_0xc752('0x44')](_0x1266be[_0xc752('0x45')],{})[_0xc752('0x23')](respondWithResult(_0x5971ac,0xc9))[_0xc752('0x40')](handleError(_0x5971ac,null));};exports[_0xc752('0x46')]=function(_0x5046fe,_0x20b9fe){if(_0x5046fe['body']['id']){delete _0x5046fe[_0xc752('0x45')]['id'];}return db[_0xc752('0x29')][_0xc752('0x43')]({'where':{'id':_0x5046fe[_0xc752('0x47')]['id']}})['then'](handleEntityNotFound(_0x20b9fe,null))['then'](saveUpdates(_0x5046fe[_0xc752('0x45')],null))[_0xc752('0x23')](respondWithResult(_0x20b9fe,null))[_0xc752('0x40')](handleError(_0x20b9fe,null));};exports[_0xc752('0x48')]=function(_0x2edcb3,_0x269ac8){return db[_0xc752('0x29')]['find']({'where':{'id':_0x2edcb3[_0xc752('0x47')]['id']}})['then'](handleEntityNotFound(_0x269ac8,null))[_0xc752('0x23')](removeEntity(_0x269ac8,null))[_0xc752('0x40')](handleError(_0x269ac8,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 05f45f5..c3c5246 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 _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 +var _0x53af=['./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3ba6ee,_0x1f7dc3){var _0x383f97=function(_0x115de0){while(--_0x115de0){_0x3ba6ee['push'](_0x3ba6ee['shift']());}};_0x383f97(++_0x1f7dc3);}(_0x53af,0x159));var _0xf53a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x53af[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf53a('0x0'));var util=require(_0xf53a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf53a('0x2'));var rp=require(_0xf53a('0x3'));var fs=require('fs');var path=require(_0xf53a('0x4'));var rimraf=require(_0xf53a('0x5'));var config=require(_0xf53a('0x6'));var attributes=require(_0xf53a('0x7'));module[_0xf53a('0x8')]=function(_0x4dd972,_0x10d9c1){return _0x4dd972['define'](_0xf53a('0x9'),attributes,{'tableName':_0xf53a('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 4fa0d71..501083c 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 _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 +var _0x3ff5=['http','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\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'];(function(_0x346089,_0x46af7a){var _0x1cc2d4=function(_0x227f19){while(--_0x227f19){_0x346089['push'](_0x346089['shift']());}};_0x1cc2d4(++_0x46af7a);}(_0x3ff5,0xe3));var _0x53ff=function(_0x4f563b,_0x3f73c2){_0x4f563b=_0x4f563b-0x0;var _0x33d243=_0x3ff5[_0x4f563b];return _0x33d243;};'use strict';var _=require(_0x53ff('0x0'));var util=require(_0x53ff('0x1'));var moment=require(_0x53ff('0x2'));var BPromise=require(_0x53ff('0x3'));var rs=require(_0x53ff('0x4'));var fs=require('fs');var Redis=require(_0x53ff('0x5'));var db=require(_0x53ff('0x6'))['db'];var utils=require(_0x53ff('0x7'));var logger=require(_0x53ff('0x8'))(_0x53ff('0x9'));var config=require(_0x53ff('0xa'));var jayson=require(_0x53ff('0xb'));var client=jayson[_0x53ff('0xc')][_0x53ff('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x46242f,_0x32afcc,_0x3bf046){return new BPromise(function(_0x3c2f27,_0x196d7a){return client[_0x53ff('0xe')](_0x46242f,_0x3bf046)[_0x53ff('0xf')](function(_0x45ba59){logger[_0x53ff('0x10')](_0x53ff('0x11'),_0x32afcc,'request\x20sent');logger['debug'](_0x53ff('0x12'),_0x32afcc,'request\x20sent',JSON['stringify'](_0x45ba59));if(_0x45ba59[_0x53ff('0x13')]){if(_0x45ba59[_0x53ff('0x13')][_0x53ff('0x14')]===0x1f4){logger[_0x53ff('0x13')]('CloudProvider,\x20%s,\x20%s',_0x32afcc,_0x45ba59['error']['message']);return _0x196d7a(_0x45ba59[_0x53ff('0x13')][_0x53ff('0x15')]);}logger[_0x53ff('0x13')](_0x53ff('0x11'),_0x32afcc,_0x45ba59[_0x53ff('0x13')][_0x53ff('0x15')]);return _0x3c2f27(_0x45ba59[_0x53ff('0x13')][_0x53ff('0x15')]);}else{logger[_0x53ff('0x10')]('CloudProvider,\x20%s,\x20%s',_0x32afcc,'request\x20sent');_0x3c2f27(_0x45ba59[_0x53ff('0x16')][_0x53ff('0x15')]);}})[_0x53ff('0x17')](function(_0x20215b){logger[_0x53ff('0x13')]('CloudProvider,\x20%s,\x20%s',_0x32afcc,_0x20215b);_0x196d7a(_0x20215b);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index acf7b62..1c5d0c9 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 _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 +var _0x3aad=['/:id','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','post','create'];(function(_0x34b9b5,_0x210762){var _0x3aa0f3=function(_0x13be0c){while(--_0x13be0c){_0x34b9b5['push'](_0x34b9b5['shift']());}};_0x3aa0f3(++_0x210762);}(_0x3aad,0x1a4));var _0xd3aa=function(_0x17d9fa,_0x2b2617){_0x17d9fa=_0x17d9fa-0x0;var _0x2dc8d6=_0x3aad[_0x17d9fa];return _0x2dc8d6;};'use strict';var multer=require(_0xd3aa('0x0'));var util=require(_0xd3aa('0x1'));var path=require(_0xd3aa('0x2'));var timeout=require(_0xd3aa('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xd3aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd3aa('0x5'));var controller=require('./cloudProvider.controller');router['get']('/',auth[_0xd3aa('0x6')](),controller[_0xd3aa('0x7')]);router[_0xd3aa('0x8')]('/:id',auth[_0xd3aa('0x6')](),controller[_0xd3aa('0x9')]);router[_0xd3aa('0xa')]('/',auth['isAuthenticated'](),controller[_0xd3aa('0xb')]);router['put'](_0xd3aa('0xc'),auth[_0xd3aa('0x6')](),controller[_0xd3aa('0xd')]);router['delete'](_0xd3aa('0xc'),auth[_0xd3aa('0x6')](),controller[_0xd3aa('0xe')]);module[_0xd3aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 7994eab..c0cfb3b 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 _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 +var _0x4a86=['exports','STRING','name','sequelize'];(function(_0x91e5da,_0x25ce34){var _0x5533f3=function(_0x15b980){while(--_0x15b980){_0x91e5da['push'](_0x91e5da['shift']());}};_0x5533f3(++_0x25ce34);}(_0x4a86,0x11b));var _0x64a8=function(_0x2f979b,_0x24b2e9){_0x2f979b=_0x2f979b-0x0;var _0x17a48e=_0x4a86[_0x2f979b];return _0x17a48e;};'use strict';var Sequelize=require(_0x64a8('0x0'));module[_0x64a8('0x1')]={'name':{'type':Sequelize[_0x64a8('0x2')],'unique':_0x64a8('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x64a8('0x2')]},'phone':{'type':Sequelize[_0x64a8('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x64a8('0x2')]},'street':{'type':Sequelize[_0x64a8('0x2')]},'postalCode':{'type':Sequelize[_0x64a8('0x2')]},'city':{'type':Sequelize[_0x64a8('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x64a8('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x64a8('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x64a8('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8a86075..308290a 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 _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 +var _0xc217=['describe','addContacts','CmContact','ids','omit','getContacts','findOne','order','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc217,0x113));var _0x7c21=function(_0x1ca29f,_0x318ac5){_0x1ca29f=_0x1ca29f-0x0;var _0x576c3b=_0xc217[_0x1ca29f];return _0x576c3b;};'use strict';var pdf=require(_0x7c21('0x0'));var emlformat=require(_0x7c21('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7c21('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c21('0x3'));var moment=require(_0x7c21('0x4'));var BPromise=require(_0x7c21('0x5'));var Mustache=require('mustache');var util=require(_0x7c21('0x6'));var path=require(_0x7c21('0x7'));var sox=require(_0x7c21('0x8'));var csv=require('to-csv');var ejs=require(_0x7c21('0x9'));var fs=require('fs');var _=require(_0x7c21('0xa'));var squel=require(_0x7c21('0xb'));var crypto=require('crypto');var jsforce=require(_0x7c21('0xc'));var deskjs=require(_0x7c21('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7c21('0xe'));var Papa=require(_0x7c21('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c21('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c21('0x11'));var logger=require(_0x7c21('0x12'))(_0x7c21('0x13'));var utils=require(_0x7c21('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x7c21('0x15'));var db=require(_0x7c21('0x16'))['db'];function respondWithStatusCode(_0x4f8d49,_0x1f52d2){_0x1f52d2=_0x1f52d2||0xcc;return function(_0x1721c2){if(_0x1721c2){return _0x4f8d49[_0x7c21('0x17')](_0x1f52d2);}return _0x4f8d49[_0x7c21('0x18')](_0x1f52d2)[_0x7c21('0x19')]();};}function respondWithResult(_0x155319,_0xbc93f5){_0xbc93f5=_0xbc93f5||0xc8;return function(_0x9e07f0){if(_0x9e07f0){return _0x155319[_0x7c21('0x18')](_0xbc93f5)[_0x7c21('0x1a')](_0x9e07f0);}};}function respondWithFilteredResult(_0x315a6f,_0x27a451){return function(_0x524d15){if(_0x524d15){var _0x2a7718=_0x524d15[_0x7c21('0x1b')],_0x28be1c=_0x27a451[_0x7c21('0x1c')],_0x1c28a0=_0x27a451[_0x7c21('0x1c')]+_0x27a451[_0x7c21('0x1d')],_0x26c370;if(_0x1c28a0>=_0x2a7718){_0x1c28a0=_0x2a7718;_0x26c370=0xc8;}else{_0x26c370=0xce;}_0x315a6f[_0x7c21('0x18')](_0x26c370);return _0x315a6f[_0x7c21('0x1e')](_0x7c21('0x1f'),_0x28be1c+'-'+_0x1c28a0+'/'+_0x2a7718)[_0x7c21('0x1a')](_0x524d15);}return null;};}function patchUpdates(_0x46cfaa){return function(_0x38ca52){try{jsonpatch[_0x7c21('0x20')](_0x38ca52,_0x46cfaa,!![]);}catch(_0x2353cb){return BPromise[_0x7c21('0x21')](_0x2353cb);}return _0x38ca52[_0x7c21('0x22')]();};}function saveUpdates(_0x37996e,_0xc9573){return function(_0x3813af){if(_0x3813af){return _0x3813af[_0x7c21('0x23')](_0x37996e)['then'](function(_0x272d3b){return _0x272d3b;});}return null;};}function removeEntity(_0x2c53d9,_0x55880b){return function(_0xeb6f3d){if(_0xeb6f3d){return _0xeb6f3d['destroy']()[_0x7c21('0x24')](function(){var _0x30b1ed=_0xeb6f3d[_0x7c21('0x25')]({'plain':!![]});var _0x2d41f4=_0x7c21('0x26');return db[_0x7c21('0x27')]['destroy']({'where':{'type':_0x2d41f4,'resourceId':_0x30b1ed['id']}})[_0x7c21('0x24')](function(){return _0xeb6f3d;});})[_0x7c21('0x24')](function(){_0x2c53d9[_0x7c21('0x18')](0xcc)[_0x7c21('0x19')]();});}};}function handleEntityNotFound(_0x563ac4,_0x23ab78){return function(_0x3c3844){if(!_0x3c3844){_0x563ac4['sendStatus'](0x194);}return _0x3c3844;};}function handleError(_0x3772f4,_0x54a2e5){_0x54a2e5=_0x54a2e5||0x1f4;return function(_0x1ff007){logger[_0x7c21('0x28')](_0x1ff007[_0x7c21('0x29')]);if(_0x1ff007[_0x7c21('0x2a')]){delete _0x1ff007[_0x7c21('0x2a')];}_0x3772f4[_0x7c21('0x18')](_0x54a2e5)[_0x7c21('0x2b')](_0x1ff007);};}exports[_0x7c21('0x2c')]=function(_0x4d241d,_0x31a497){var _0x141c2b={},_0x4619c8={},_0x2d58fe={'count':0x0,'rows':[]};return db[_0x7c21('0x2d')]['describe']()[_0x7c21('0x24')](function(_0x2cc8b7){_0x4619c8[_0x7c21('0x2e')]=_['keys'](_0x2cc8b7);_0x4619c8[_0x7c21('0x2f')]=_[_0x7c21('0x30')](_0x4d241d[_0x7c21('0x2f')]);_0x4619c8[_0x7c21('0x31')]=_[_0x7c21('0x32')](_0x4619c8['model'],_0x4619c8[_0x7c21('0x2f')]);_0x141c2b[_0x7c21('0x33')]=_[_0x7c21('0x32')](_0x4619c8[_0x7c21('0x2e')],qs['fields'](_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x34')]));_0x141c2b[_0x7c21('0x33')]=_0x141c2b[_0x7c21('0x33')]['length']?_0x141c2b[_0x7c21('0x33')]:_0x4619c8[_0x7c21('0x2e')];if(!_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x35')](_0x7c21('0x36'))){_0x141c2b[_0x7c21('0x1d')]=qs[_0x7c21('0x1d')](_0x4d241d['query'][_0x7c21('0x1d')]);_0x141c2b[_0x7c21('0x1c')]=qs[_0x7c21('0x1c')](_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x1c')]);}_0x141c2b['order']=qs[_0x7c21('0x37')](_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x37')]);_0x141c2b[_0x7c21('0x38')]=qs['filters'](_[_0x7c21('0x39')](_0x4d241d[_0x7c21('0x2f')],_0x4619c8[_0x7c21('0x31')]),_0x2cc8b7);if(_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x3a')]){_0x141c2b[_0x7c21('0x38')]=_[_0x7c21('0x3b')](_0x141c2b[_0x7c21('0x38')],{'$or':_[_0x7c21('0x3c')](_0x141c2b[_0x7c21('0x33')],function(_0x4c2c9f){var _0x2ba998={};_0x2ba998[_0x4c2c9f]={'$like':'%'+_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x3a')]+'%'};return _0x2ba998;})});}_0x141c2b=_[_0x7c21('0x3b')]({},_0x141c2b,_0x4d241d[_0x7c21('0x3d')]);var _0x5dded5={'where':_0x141c2b['where']};return db[_0x7c21('0x2d')][_0x7c21('0x1b')](_0x5dded5)['then'](function(_0x2ac784){_0x2d58fe[_0x7c21('0x1b')]=_0x2ac784;if(_0x4d241d[_0x7c21('0x2f')][_0x7c21('0x3e')]){_0x141c2b[_0x7c21('0x3f')]=[{'all':!![]}];}return db[_0x7c21('0x2d')][_0x7c21('0x40')](_0x141c2b);})[_0x7c21('0x24')](function(_0x4ceeb4){_0x2d58fe[_0x7c21('0x41')]=_0x4ceeb4;return _0x2d58fe;})[_0x7c21('0x24')](respondWithFilteredResult(_0x31a497,_0x141c2b))['catch'](handleError(_0x31a497,null));})[_0x7c21('0x42')](handleError(_0x31a497,null));};exports['show']=function(_0x210898,_0x258964){var _0x1be3df={'raw':![],'where':{'id':_0x210898[_0x7c21('0x43')]['id']}},_0x40f27b={};_0x40f27b[_0x7c21('0x2e')]=_['keys'](db[_0x7c21('0x2d')][_0x7c21('0x44')]);_0x40f27b[_0x7c21('0x2f')]=_['keys'](_0x210898[_0x7c21('0x2f')]);_0x40f27b[_0x7c21('0x31')]=_[_0x7c21('0x32')](_0x40f27b[_0x7c21('0x2e')],_0x40f27b[_0x7c21('0x2f')]);_0x1be3df[_0x7c21('0x33')]=_['intersection'](_0x40f27b[_0x7c21('0x2e')],qs[_0x7c21('0x34')](_0x210898[_0x7c21('0x2f')][_0x7c21('0x34')]));_0x1be3df['attributes']=_0x1be3df[_0x7c21('0x33')][_0x7c21('0x45')]?_0x1be3df[_0x7c21('0x33')]:_0x40f27b[_0x7c21('0x2e')];if(_0x210898[_0x7c21('0x2f')][_0x7c21('0x3e')]){_0x1be3df[_0x7c21('0x3f')]=[{'all':!![]}];}_0x1be3df=_[_0x7c21('0x3b')]({},_0x1be3df,_0x210898[_0x7c21('0x3d')]);return db[_0x7c21('0x2d')][_0x7c21('0x46')](_0x1be3df)[_0x7c21('0x24')](handleEntityNotFound(_0x258964,null))['then'](respondWithResult(_0x258964,null))[_0x7c21('0x42')](handleError(_0x258964,null));};exports[_0x7c21('0x47')]=function(_0xe71c06,_0x45051a){return db[_0x7c21('0x2d')][_0x7c21('0x47')](_0xe71c06['body'],{})[_0x7c21('0x24')](function(_0x50cac7){var _0x4ae3aa=_0xe71c06[_0x7c21('0x48')][_0x7c21('0x25')]({'plain':!![]});if(!_0x4ae3aa)throw new Error(_0x7c21('0x49'));if(_0x4ae3aa[_0x7c21('0x4a')]===_0x7c21('0x48')){var _0x51cb1c=_0x50cac7[_0x7c21('0x25')]({'plain':!![]});var _0x491f34=_0x7c21('0x26');return db[_0x7c21('0x4b')]['find']({'where':{'name':_0x491f34,'userProfileId':_0x4ae3aa[_0x7c21('0x4c')]},'raw':!![]})['then'](function(_0x104166){if(_0x104166&&_0x104166[_0x7c21('0x4d')]===0x0){return db[_0x7c21('0x27')][_0x7c21('0x47')]({'name':_0x51cb1c[_0x7c21('0x2a')],'resourceId':_0x51cb1c['id'],'type':_0x104166[_0x7c21('0x2a')],'sectionId':_0x104166['id']},{})['then'](function(){return _0x50cac7;});}else{return _0x50cac7;}})['catch'](function(_0xba669){logger[_0x7c21('0x28')](_0x7c21('0x4e'),_0xba669);throw _0xba669;});}return _0x50cac7;})[_0x7c21('0x24')](respondWithResult(_0x45051a,0xc9))['catch'](handleError(_0x45051a,null));};exports[_0x7c21('0x23')]=function(_0xf034e,_0x1eef92){if(_0xf034e[_0x7c21('0x4f')]['id']){delete _0xf034e[_0x7c21('0x4f')]['id'];}return db[_0x7c21('0x2d')][_0x7c21('0x46')]({'where':{'id':_0xf034e[_0x7c21('0x43')]['id']}})[_0x7c21('0x24')](handleEntityNotFound(_0x1eef92,null))[_0x7c21('0x24')](saveUpdates(_0xf034e['body'],null))[_0x7c21('0x24')](respondWithResult(_0x1eef92,null))[_0x7c21('0x42')](handleError(_0x1eef92,null));};exports[_0x7c21('0x50')]=function(_0x1ee3e5,_0x5a2c42){return db[_0x7c21('0x2d')][_0x7c21('0x46')]({'where':{'id':_0x1ee3e5[_0x7c21('0x43')]['id']}})[_0x7c21('0x24')](handleEntityNotFound(_0x5a2c42,null))['then'](removeEntity(_0x5a2c42,null))[_0x7c21('0x42')](handleError(_0x5a2c42,null));};exports['describe']=function(_0x46edcf,_0x37044f){return db[_0x7c21('0x2d')][_0x7c21('0x51')]()[_0x7c21('0x24')](respondWithResult(_0x37044f,null))[_0x7c21('0x42')](handleError(_0x37044f,null));};exports[_0x7c21('0x52')]=function(_0x95d82e,_0x21dad7,_0x3f4b65){return db[_0x7c21('0x53')][_0x7c21('0x46')]({'where':{'id':_0x95d82e[_0x7c21('0x43')]['id']}})[_0x7c21('0x24')](handleEntityNotFound(_0x21dad7,null))[_0x7c21('0x24')](function(_0x3b69df){if(_0x3b69df){return _0x3b69df[_0x7c21('0x52')](_0x95d82e[_0x7c21('0x4f')][_0x7c21('0x54')],_[_0x7c21('0x55')](_0x95d82e[_0x7c21('0x4f')],[_0x7c21('0x54'),'id'])||{});}})['then'](respondWithResult(_0x21dad7,null))[_0x7c21('0x42')](handleError(_0x21dad7,null));};exports[_0x7c21('0x56')]=function(_0x42f3d8,_0x1fb9c2,_0x529a5d){var _0x4614a9={};var _0xf907bc={};var _0x50bdbc;var _0x579aac;return db[_0x7c21('0x2d')][_0x7c21('0x57')]({'where':{'id':_0x42f3d8['params']['id']}})[_0x7c21('0x24')](handleEntityNotFound(_0x1fb9c2,null))[_0x7c21('0x24')](function(_0x564446){if(_0x564446){_0x50bdbc=_0x564446;_0xf907bc[_0x7c21('0x2e')]=_['keys'](db[_0x7c21('0x53')][_0x7c21('0x44')]);_0xf907bc['query']=_[_0x7c21('0x30')](_0x42f3d8[_0x7c21('0x2f')]);_0xf907bc[_0x7c21('0x31')]=_[_0x7c21('0x32')](_0xf907bc[_0x7c21('0x2e')],_0xf907bc[_0x7c21('0x2f')]);_0x4614a9['attributes']=_[_0x7c21('0x32')](_0xf907bc['model'],qs[_0x7c21('0x34')](_0x42f3d8[_0x7c21('0x2f')][_0x7c21('0x34')]));_0x4614a9[_0x7c21('0x33')]=_0x4614a9[_0x7c21('0x33')][_0x7c21('0x45')]?_0x4614a9[_0x7c21('0x33')]:_0xf907bc['model'];_0x4614a9[_0x7c21('0x58')]=qs['sort'](_0x42f3d8[_0x7c21('0x2f')][_0x7c21('0x37')]);_0x4614a9[_0x7c21('0x38')]=qs[_0x7c21('0x31')](_[_0x7c21('0x39')](_0x42f3d8['query'],_0xf907bc[_0x7c21('0x31')]));if(_0x42f3d8[_0x7c21('0x2f')][_0x7c21('0x3a')]){_0x4614a9['where']=_[_0x7c21('0x3b')](_0x4614a9[_0x7c21('0x38')],{'$or':_[_0x7c21('0x3c')](_0x4614a9[_0x7c21('0x33')],function(_0x318bdb){var _0x38b621={};_0x38b621[_0x318bdb]={'$like':'%'+_0x42f3d8[_0x7c21('0x2f')][_0x7c21('0x3a')]+'%'};return _0x38b621;})});}_0x4614a9=_[_0x7c21('0x3b')]({},_0x4614a9,_0x42f3d8[_0x7c21('0x3d')]);return _0x50bdbc['getContacts'](_0x4614a9);}})[_0x7c21('0x24')](function(_0x1fb2bc){if(_0x1fb2bc){_0x579aac=_0x1fb2bc[_0x7c21('0x45')];if(!_0x42f3d8['query']['hasOwnProperty'](_0x7c21('0x36'))){_0x4614a9[_0x7c21('0x1d')]=qs[_0x7c21('0x1d')](_0x42f3d8[_0x7c21('0x2f')]['limit']);_0x4614a9['offset']=qs[_0x7c21('0x1c')](_0x42f3d8[_0x7c21('0x2f')][_0x7c21('0x1c')]);}return _0x50bdbc[_0x7c21('0x56')](_0x4614a9);}})[_0x7c21('0x24')](function(_0x111f58){if(_0x111f58){return _0x111f58?{'count':_0x579aac,'rows':_0x111f58}:null;}})[_0x7c21('0x24')](respondWithResult(_0x1fb9c2,null))[_0x7c21('0x42')](handleError(_0x1fb9c2,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1cfb595..9dd8b0a 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 _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 +var _0x7250=['rimraf','./cmCompany.attributes','CmCompany','cm_companies','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7250,0x1b1));var _0x0725=function(_0x27f53e,_0x20535d){_0x27f53e=_0x27f53e-0x0;var _0x22696b=_0x7250[_0x27f53e];return _0x22696b;};'use strict';var _=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var moment=require(_0x0725('0x3'));var BPromise=require(_0x0725('0x4'));var rp=require(_0x0725('0x5'));var fs=require('fs');var path=require(_0x0725('0x6'));var rimraf=require(_0x0725('0x7'));var config=require('../../config/environment');var attributes=require(_0x0725('0x8'));module['exports']=function(_0x4e8c6c,_0xa32c3f){return _0x4e8c6c['define'](_0x0725('0x9'),attributes,{'tableName':_0x0725('0xa'),'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 f7051b7..d388991 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 _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 +var _0xf0dc=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0xf0dc,0x153));var _0xcf0d=function(_0x3af060,_0x1dd3dc){_0x3af060=_0x3af060-0x0;var _0x279b6d=_0xf0dc[_0x3af060];return _0x279b6d;};'use strict';var _=require(_0xcf0d('0x0'));var util=require(_0xcf0d('0x1'));var moment=require(_0xcf0d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf0d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf0d('0x4'));var logger=require(_0xcf0d('0x5'))(_0xcf0d('0x6'));var config=require(_0xcf0d('0x7'));var jayson=require(_0xcf0d('0x8'));var client=jayson[_0xcf0d('0x9')][_0xcf0d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5209b8,_0x23e1b7,_0x1e337a){return new BPromise(function(_0x542c22,_0xdd2c1b){return client[_0xcf0d('0xb')](_0x5209b8,_0x1e337a)[_0xcf0d('0xc')](function(_0x3a793d){logger[_0xcf0d('0xd')](_0xcf0d('0xe'),_0x23e1b7,'request\x20sent');logger[_0xcf0d('0xf')](_0xcf0d('0x10'),_0x23e1b7,_0xcf0d('0x11'),JSON[_0xcf0d('0x12')](_0x3a793d));if(_0x3a793d[_0xcf0d('0x13')]){if(_0x3a793d[_0xcf0d('0x13')]['code']===0x1f4){logger[_0xcf0d('0x13')](_0xcf0d('0xe'),_0x23e1b7,_0x3a793d[_0xcf0d('0x13')]['message']);return _0xdd2c1b(_0x3a793d[_0xcf0d('0x13')][_0xcf0d('0x14')]);}logger[_0xcf0d('0x13')](_0xcf0d('0xe'),_0x23e1b7,_0x3a793d['error'][_0xcf0d('0x14')]);return _0x542c22(_0x3a793d[_0xcf0d('0x13')][_0xcf0d('0x14')]);}else{logger[_0xcf0d('0xd')](_0xcf0d('0xe'),_0x23e1b7,_0xcf0d('0x11'));_0x542c22(_0x3a793d[_0xcf0d('0x15')]['message']);}})[_0xcf0d('0x16')](function(_0x565482){logger[_0xcf0d('0x13')](_0xcf0d('0xe'),_0x23e1b7,_0x565482);_0xdd2c1b(_0x565482);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 5ddae48..71a59c9 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 _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 +var _0x8e3f=['exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','update','delete','destroy'];(function(_0xd51d4b,_0x48bc70){var _0x2afbba=function(_0x9917a0){while(--_0x9917a0){_0xd51d4b['push'](_0xd51d4b['shift']());}};_0x2afbba(++_0x48bc70);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8e3f[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var path=require(_0xf8e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xf8e3('0x3'));var router=express[_0xf8e3('0x4')]();var auth=require(_0xf8e3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf8e3('0x6'));var controller=require(_0xf8e3('0x7'));router['get']('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x9')]);router[_0xf8e3('0xa')](_0xf8e3('0xb'),auth['isAuthenticated'](),controller[_0xf8e3('0xc')]);router[_0xf8e3('0xa')](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0xe')]);router[_0xf8e3('0xa')](_0xf8e3('0xf'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x10')]);router[_0xf8e3('0x11')]('/',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x12')]);router['post'](_0xf8e3('0xf'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x13')]);router['put'](_0xf8e3('0xd'),auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x14')]);router[_0xf8e3('0x15')]('/:id',auth[_0xf8e3('0x8')](),controller[_0xf8e3('0x16')]);module[_0xf8e3('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index d2f9117..4290b92 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 _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 +var _0xb889=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x5eca6f,_0x76ec15){var _0x4c34b7=function(_0x52cbe1){while(--_0x52cbe1){_0x5eca6f['push'](_0x5eca6f['shift']());}};_0x4c34b7(++_0x76ec15);}(_0xb889,0x16f));var _0x9b88=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb889[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0x9b88('0x0'));var Sequelize=require(_0x9b88('0x1'));module[_0x9b88('0x2')]={'firstName':{'type':Sequelize[_0x9b88('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x9b88('0x3')]},'postalCode':{'type':Sequelize[_0x9b88('0x3')]},'city':{'type':Sequelize[_0x9b88('0x3')]},'country':{'type':Sequelize[_0x9b88('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9b88('0x3')]},'description':{'type':Sequelize[_0x9b88('0x4')]},'phone':{'type':Sequelize[_0x9b88('0x3')]},'mobile':{'type':Sequelize[_0x9b88('0x3')]},'fax':{'type':Sequelize[_0x9b88('0x3')]},'email':{'type':Sequelize[_0x9b88('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x9b88('0x3')]},'fb_data':{'type':Sequelize[_0x9b88('0x3')]},'twitter':{'type':Sequelize[_0x9b88('0x3')]},'skype':{'type':Sequelize[_0x9b88('0x3')]},'teams':{'type':Sequelize[_0x9b88('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x9b88('0x3')]},'wechat':{'type':Sequelize[_0x9b88('0x3')]},'telegram':{'type':Sequelize[_0x9b88('0x3')]},'UserId':{'type':Sequelize[_0x9b88('0x5')]},'priority':{'type':Sequelize[_0x9b88('0x5')](0x2)[_0x9b88('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9b88('0x7')],'defaultValue':Sequelize[_0x9b88('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 09848e4..11bb71c 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 _0xb248=['Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','some','User','c.ListId\x20IS\x20NULL','agent','sequelize','toString','merge','c.firstName','c.lastName','c.phone','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','find','params','tags','columnName','displayName','findAll','values','catch','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappMessage','WhatsappQueueReport','bulkCreate','each','duplicates','$or','show','Tag','color','$and','omit','format','cf_%d','table','setFields','id\x20=\x20?','toParam','phone','getTags','rawAttributes','setTags','ids','getHoppers','nolimit','ContactId','options','includeAll','rows','CmHopperHistory','include','getHopperFinals','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_values','socket_timestamp','binding_keys','zipObject','firstName','root','server/files/tmp','file','filename','chmodSync','0777','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','import','binding','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','getJourney','chat','fax','voice','-createdAt','includes','channel','toLowerCase','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','alias','range','Account','closed','note','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','mail','substatus','openchannel','externalUrl','threadId','startCase','Interaction','flatten','sortBy','reverse','slice','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','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','../../config/license/util','../../mysqldb','redis','defaults','./cmContact.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','end','error','stack','name','send','index','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','length','fieldType','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','select','field','from','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','expr','search','sqlOperator','conditions','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','uc.UserId\x20=\x20?','dateOfBirth','datetime','DATE','buildExpression','text','start','filter'];(function(_0x2d8c1c,_0x41ae7f){var _0x58399b=function(_0x1ea0f1){while(--_0x1ea0f1){_0x2d8c1c['push'](_0x2d8c1c['shift']());}};_0x58399b(++_0x41ae7f);}(_0xb248,0xc6));var _0x8b24=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xb248[_0x279d37];return _0x530173;};'use strict';var pdf=require(_0x8b24('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8b24('0x1'));var zipdir=require(_0x8b24('0x2'));var jsonpatch=require(_0x8b24('0x3'));var rp=require(_0x8b24('0x4'));var moment=require('moment');var BPromise=require(_0x8b24('0x5'));var Mustache=require(_0x8b24('0x6'));var util=require('util');var path=require(_0x8b24('0x7'));var sox=require(_0x8b24('0x8'));var csv=require('to-csv');var ejs=require(_0x8b24('0x9'));var fs=require('fs');var _=require(_0x8b24('0xa'));var squel=require('squel');var crypto=require(_0x8b24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8b24('0xc'));var toCsv=require(_0x8b24('0xd'));var querystring=require(_0x8b24('0xe'));var Papa=require('papaparse');var Redis=require(_0x8b24('0xf'));var authService=require(_0x8b24('0x10'));var qs=require(_0x8b24('0x11'));var as=require(_0x8b24('0x12'));var hardwareService=require(_0x8b24('0x13'));var logger=require(_0x8b24('0x14'))(_0x8b24('0x15'));var utils=require(_0x8b24('0x16'));var config=require(_0x8b24('0x17'));var licenseUtil=require(_0x8b24('0x18'));var db=require(_0x8b24('0x19'))['db'];config[_0x8b24('0x1a')]=_[_0x8b24('0x1b')](config[_0x8b24('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b24('0x1a')]));require(_0x8b24('0x1c'))[_0x8b24('0x1d')](socket);function respondWithStatusCode(_0x32a451,_0x22a11e){_0x22a11e=_0x22a11e||0xcc;return function(_0x2ccaf2){if(_0x2ccaf2){return _0x32a451[_0x8b24('0x1e')](_0x22a11e);}return _0x32a451[_0x8b24('0x1f')](_0x22a11e)['end']();};}function respondWithResult(_0x5a5745,_0x552a28){_0x552a28=_0x552a28||0xc8;return function(_0xfe489b){if(_0xfe489b){return _0x5a5745['status'](_0x552a28)['json'](_0xfe489b);}};}function respondWithFilteredResult(_0xafc423,_0x1d7722){return function(_0x527af7){if(_0x527af7){var _0x1bafdf=_0x527af7[_0x8b24('0x20')],_0x5e3c52=_0x1d7722['offset'],_0x3b4805=_0x1d7722[_0x8b24('0x21')]+_0x1d7722[_0x8b24('0x22')],_0x56d424;if(_0x3b4805>=_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=_0x1067be){_0x4c5c6d=_0x1067be;_0x366690=0xc8;}else{_0x366690=0xce;}_0x14788d[_0x71cc('0x18')](_0x366690);return _0x14788d[_0x71cc('0x1d')](_0x71cc('0x1e'),_0x10da0a+'-'+_0x4c5c6d+'/'+_0x1067be)[_0x71cc('0x1a')](_0x1d1da8);}return null;};}function patchUpdates(_0xccbfb){return function(_0x363ecb){try{jsonpatch[_0x71cc('0x1f')](_0x363ecb,_0xccbfb,!![]);}catch(_0x4cfba0){return BPromise[_0x71cc('0x20')](_0x4cfba0);}return _0x363ecb[_0x71cc('0x21')]();};}function saveUpdates(_0x587a0b,_0x2bee90){return function(_0x20328f){if(_0x20328f){return _0x20328f[_0x71cc('0x22')](_0x587a0b)[_0x71cc('0x23')](function(_0x1bc67c){return _0x1bc67c;});}return null;};}function removeEntity(_0x887399,_0x4a0abc){return function(_0x4225af){if(_0x4225af){return _0x4225af[_0x71cc('0x24')]()[_0x71cc('0x23')](function(){_0x887399[_0x71cc('0x18')](0xcc)[_0x71cc('0x19')]();});}};}function handleEntityNotFound(_0x5fa323,_0x27b933){return function(_0x42e6ec){if(!_0x42e6ec){_0x5fa323[_0x71cc('0x17')](0x194);}return _0x42e6ec;};}function handleError(_0x4d4529,_0x26065a){_0x26065a=_0x26065a||0x1f4;return function(_0x43c155){logger[_0x71cc('0x25')](_0x43c155[_0x71cc('0x26')]);if(_0x43c155[_0x71cc('0x27')]){delete _0x43c155[_0x71cc('0x27')];}_0x4d4529[_0x71cc('0x18')](_0x26065a)[_0x71cc('0x28')](_0x43c155);};}exports[_0x71cc('0x29')]=function(_0x1fc046,_0x30f94d){var _0x35f723={},_0x1d5805={},_0x2db9c9={'count':0x0,'rows':[]};return db[_0x71cc('0x2a')][_0x71cc('0x2b')]()['then'](function(_0x3054ff){var _0x3b7451=[];for(var _0x34c6bc=0x0;_0x34c6bc0x1){_0x3d5c6b['or'](_0x71cc('0x66'),qs[_0x71cc('0x67')](_0x44b11f),null);}else{if(qs['isNumeric'](_0x44b11f)){_0x3d5c6b['or'](_0x71cc('0x68'),_0x44b11f+'%');_0x3d5c6b['or'](_0x71cc('0x69'),_0x44b11f+'%');_0x3d5c6b['or']('c.mobile\x20LIKE\x20?',_0x44b11f+'%');_0x3d5c6b['or']('c.fax\x20LIKE\x20?',_0x44b11f+'%');}else if(qs[_0x71cc('0x6a')](_0x44b11f)){_0x3d5c6b['or'](_0x71cc('0x6b'),_0x44b11f+'%');}else{_0x3d5c6b['or']('c.firstName\x20LIKE\x20?','%'+_0x44b11f+'%');_0x3d5c6b['or']('c.lastName\x20LIKE\x20?','%'+_0x44b11f+'%');_0x3d5c6b['or'](_0x71cc('0x6b'),'%'+_0x44b11f+'%');}}}}_0x22b226['where'](_0x3d5c6b);_0x22b226['group'](_0x71cc('0x6c'));var _0x3656c3={'type':db[_0x71cc('0x6d')]['QueryTypes'][_0x71cc('0x6e')],'raw':!![]};var _0xa5c203=_0x22b226[_0x71cc('0x6f')]()['field']('c.id');if(_0x35f723['order']){_0x35f723[_0x71cc('0x3c')][_0x71cc('0x52')](function(_0x4092f7){_0x22b226[_0x71cc('0x3c')]('c.'+_0x4092f7[0x0],_0x4092f7[0x1]===_0x71cc('0x70')?![]:!![]);});}if(!_[_0x71cc('0x71')](_0x3ed6b7)){_0x22b226['having'](_0x3add18);_0xa5c203['where'](_0x71cc('0x72'),_0x3ed6b7);}BPromise[_0x71cc('0x73')]()[_0x71cc('0x23')](function(){if(!_0x450408)return;if(_0x1fc046[_0x71cc('0x74')][_0x71cc('0x75')]!==_0x71cc('0x76'))return;if(!_[_0x71cc('0x77')](_0x450408[_0x71cc('0x4c')],[_0x71cc('0x40'),_0x71cc('0x55')])){return _0x1fc046['user']['getLists']({'attributes':['id'],'raw':!![]})[_0x71cc('0x23')](function(_0x3a86a0){if(_[_0x71cc('0x71')](_0x3a86a0)){_0xa5c203[_0x71cc('0x3e')](_0x71cc('0x78'));_0x22b226[_0x71cc('0x3e')](_0x71cc('0x78'));}else{_0xa5c203[_0x71cc('0x3e')](_0x71cc('0x62'),_['map'](_0x3a86a0,'id'));_0x22b226[_0x71cc('0x3e')](_0x71cc('0x62'),_[_0x71cc('0x51')](_0x3a86a0,'id'));}});}})[_0x71cc('0x23')](function(){if(_0x1fc046['user']['role']===_0x71cc('0x76')&&!_0x450408&&!_0x1fc046[_0x71cc('0x36')][_0x71cc('0x61')])return[];return db[_0x71cc('0x79')][_0x71cc('0x36')](_0xa5c203['toString'](),_0x3656c3);})['then'](function(_0x1e0885){_0x2db9c9[_0x71cc('0x1b')]=_0x1e0885['length'];if(_0x2db9c9[_0x71cc('0x1b')]===0x0)return[];return db[_0x71cc('0x79')][_0x71cc('0x36')](_0x12bf49[_0x71cc('0x7a')](),_0x3656c3)['then'](function(_0x5dc991){_0x2e7677=_['keyBy'](_0x5dc991,'id');_0x3656c3=_[_0x71cc('0x7b')](_0x3656c3,{'model':db[_0x71cc('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1fc046[_0x71cc('0x36')][_0x71cc('0x7c')]){_0x35f723[_0x71cc('0x39')][_0x71cc('0x52')](function(_0x361dae){_0x22b226[_0x71cc('0x40')]('c.'+_0x361dae);});}else{_0x22b226[_0x71cc('0x40')](_0x71cc('0x6c'));_0x22b226['field'](_0x71cc('0x7d'));_0x22b226[_0x71cc('0x40')](_0x71cc('0x7e'));_0x22b226[_0x71cc('0x40')]('c.phone');_0x22b226['field'](_0x71cc('0x7f'));_0x22b226[_0x71cc('0x40')](_0x71cc('0x80'));_0x22b226[_0x71cc('0x40')](_0x71cc('0x81'));_0x22b226[_0x71cc('0x40')]('c.ListId');_0x22b226[_0x71cc('0x40')](_0x71cc('0x82'));_0x22b226['field']('c.deletedAt');_0x22b226[_0x71cc('0x40')](_0x71cc('0x83'));_0x22b226[_0x71cc('0x40')](_0x71cc('0x84'),'TagIds');}if(_0x35f723['limit'])_0x22b226['limit'](_0x35f723[_0x71cc('0x1c')]);if(_0x35f723['offset'])_0x22b226[_0x71cc('0x3b')](_0x35f723[_0x71cc('0x3b')]);return db['sequelize']['query'](_0x22b226[_0x71cc('0x7a')](),_0x3656c3);});})[_0x71cc('0x23')](function(_0x2c93fb){_0x2c93fb[_0x71cc('0x52')](function(_0x38b66d){if(_0x38b66d[_0x71cc('0x85')]){_0x38b66d[_0x71cc('0x86')]=[];_0x38b66d[_0x71cc('0x85')][_0x71cc('0x50')](',')['forEach'](function(_0x4e0959){_0x38b66d[_0x71cc('0x86')][_0x71cc('0x30')](_0x2e7677[_0x4e0959]);});}delete _0x38b66d[_0x71cc('0x85')];});_0x2db9c9[_0x71cc('0x87')]=_0x2c93fb;return _0x2db9c9;})[_0x71cc('0x23')](respondWithFilteredResult(_0x30f94d,_0x35f723));})['catch'](handleError(_0x30f94d,null));};exports[_0x71cc('0x24')]=function(_0x11c006,_0x5c41ee){return db['CmContact'][_0x71cc('0x4d')]({'where':{'id':_0x11c006[_0x71cc('0x88')]['id']}})[_0x71cc('0x23')](handleEntityNotFound(_0x5c41ee,null))['then'](removeEntity(_0x5c41ee,null))[_0x71cc('0x89')](handleError(_0x5c41ee,null));};exports[_0x71cc('0x2b')]=function(_0x41be1c,_0x4b9980){return db[_0x71cc('0x2a')][_0x71cc('0x2b')]()['then'](function(_0x1db4c4){delete _0x1db4c4[_0x71cc('0x8a')];for(var _0x249b1a=0x0;_0x249b1a{}\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 +var _0xa45c=['/create_many','bulkCreate','setTags','diskStorage','join','root','server/files/tmp','originalname','replace','format','%s-%s%s','basename','now','extname','uploadCsv','single','/upload/:id','put','delete','destroy','exports','multer','util','express','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/journey','getJourney','post','/merge'];(function(_0x472046,_0x8f3201){var _0x46a434=function(_0x22be3a){while(--_0x22be3a){_0x472046['push'](_0x472046['shift']());}};_0x46a434(++_0x8f3201);}(_0xa45c,0x6d));var _0xca45=function(_0x405785,_0xbb56b5){_0x405785=_0x405785-0x0;var _0x478a13=_0xa45c[_0x405785];return _0x478a13;};'use strict';var multer=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xca45('0x2'));var router=express['Router']();var auth=require(_0xca45('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xca45('0x4'));var controller=require('./cmContact.controller');router['get']('/',auth[_0xca45('0x5')](),controller[_0xca45('0x6')]);router[_0xca45('0x7')](_0xca45('0x8'),auth['isAuthenticated'](),controller[_0xca45('0x9')]);router[_0xca45('0x7')](_0xca45('0xa'),auth[_0xca45('0x5')](),controller[_0xca45('0xb')]);router['get'](_0xca45('0xc'),auth[_0xca45('0x5')](),controller[_0xca45('0xd')]);router[_0xca45('0x7')](_0xca45('0xe'),auth[_0xca45('0x5')](),controller[_0xca45('0xf')]);router['get'](_0xca45('0x10'),auth[_0xca45('0x5')](),controller[_0xca45('0x11')]);router[_0xca45('0x7')]('/:id/hopper_finals',auth[_0xca45('0x5')](),controller[_0xca45('0x12')]);router[_0xca45('0x7')]('/:id/jscripty_sessions',auth[_0xca45('0x5')](),controller['getJscriptySessions']);router[_0xca45('0x7')](_0xca45('0x13'),auth[_0xca45('0x5')](),controller[_0xca45('0x14')]);router[_0xca45('0x15')](_0xca45('0x16'),auth[_0xca45('0x5')](),controller['merge']);router[_0xca45('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0xca45('0x15')](_0xca45('0x17'),auth['isAuthenticated'](),controller[_0xca45('0x18')]);router[_0xca45('0x15')]('/:id/tags',auth[_0xca45('0x5')](),controller[_0xca45('0x19')]);var upload=multer({'storage':multer[_0xca45('0x1a')]({'destination':function(_0x11cbf0,_0x5a231d,_0x3e396b){_0x3e396b(null,path[_0xca45('0x1b')](config[_0xca45('0x1c')],_0xca45('0x1d')));},'filename':function(_0x548d0c,_0x2c0a39,_0xb0fa27){_0x2c0a39[_0xca45('0x1e')]=_0x2c0a39[_0xca45('0x1e')][_0xca45('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb0fa27(null,util[_0xca45('0x20')](_0xca45('0x21'),path[_0xca45('0x22')](_0x2c0a39[_0xca45('0x1e')],path['extname'](_0x2c0a39[_0xca45('0x1e')])),Date[_0xca45('0x23')](),path[_0xca45('0x24')](_0x2c0a39[_0xca45('0x1e')])));}})});router[_0xca45('0x15')]('/csv',upload['single']('file'),controller[_0xca45('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5c36c7,_0x3547cd,_0x3e3b03){_0x3e3b03(null,path[_0xca45('0x1b')](config[_0xca45('0x1c')],_0xca45('0x1d')));},'filename':function(_0x59cb19,_0x27353b,_0x2a5cd4){_0x27353b[_0xca45('0x1e')]=_0x27353b['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2a5cd4(null,util['format'](_0xca45('0x21'),path[_0xca45('0x22')](_0x27353b['originalname'],path[_0xca45('0x24')](_0x27353b[_0xca45('0x1e')])),Date[_0xca45('0x23')](),path[_0xca45('0x24')](_0x27353b['originalname'])));}})});router['post']('/upload',upload[_0xca45('0x26')]('file'),controller['upload']);router['post'](_0xca45('0x27'),auth['isAuthenticated'](),controller['import']);router[_0xca45('0x28')](_0xca45('0xa'),auth[_0xca45('0x5')](),controller['update']);router[_0xca45('0x29')](_0xca45('0xa'),auth['isAuthenticated'](),controller[_0xca45('0x2a')]);module[_0xca45('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index caa2f05..c408407 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe574=['sequelize','INTEGER','STRING','PHONE'];(function(_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 +var _0x3c94=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x3c94,0xcd));var _0x43c9=function(_0x5e3665,_0x369ac8){_0x5e3665=_0x5e3665-0x0;var _0x187299=_0x3c94[_0x5e3665];return _0x187299;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'CmContactId':{'type':Sequelize[_0x43c9('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x43c9('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x43c9('0x3')],'defaultValue':_0x43c9('0x4')},'OrderBy':{'type':Sequelize[_0x43c9('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index ed8853e..028d86e 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 _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 +var _0x18e9=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','Content-Range','json','reject','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','html-pdf'];(function(_0xbc79f,_0x5a4c6d){var _0x5a48e0=function(_0x420f22){while(--_0x420f22){_0xbc79f['push'](_0xbc79f['shift']());}};_0x5a48e0(++_0x5a4c6d);}(_0x18e9,0x1e5));var _0x918e=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x18e9[_0x1f99a0];return _0x1e0849;};'use strict';var pdf=require(_0x918e('0x0'));var emlformat=require(_0x918e('0x1'));var rimraf=require(_0x918e('0x2'));var zipdir=require(_0x918e('0x3'));var jsonpatch=require(_0x918e('0x4'));var rp=require('request-promise');var moment=require(_0x918e('0x5'));var BPromise=require(_0x918e('0x6'));var Mustache=require('mustache');var util=require(_0x918e('0x7'));var path=require('path');var sox=require(_0x918e('0x8'));var csv=require(_0x918e('0x9'));var ejs=require(_0x918e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x918e('0xb'));var crypto=require(_0x918e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x918e('0xd'));var toCsv=require(_0x918e('0x9'));var querystring=require(_0x918e('0xe'));var Papa=require(_0x918e('0xf'));var Redis=require(_0x918e('0x10'));var authService=require(_0x918e('0x11'));var qs=require(_0x918e('0x12'));var as=require(_0x918e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x918e('0x14'))(_0x918e('0x15'));var utils=require('../../config/utils');var config=require(_0x918e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x918e('0x17'))['db'];function respondWithStatusCode(_0x1b7db0,_0x4e901f){_0x4e901f=_0x4e901f||0xcc;return function(_0x1d8865){if(_0x1d8865){return _0x1b7db0[_0x918e('0x18')](_0x4e901f);}return _0x1b7db0[_0x918e('0x19')](_0x4e901f)[_0x918e('0x1a')]();};}function respondWithResult(_0x35aeff,_0xf3b7ce){_0xf3b7ce=_0xf3b7ce||0xc8;return function(_0x4264f9){if(_0x4264f9){return _0x35aeff['status'](_0xf3b7ce)['json'](_0x4264f9);}};}function respondWithFilteredResult(_0x6abdad,_0x78b935){return function(_0x58ad71){if(_0x58ad71){var _0x5a4710=_0x58ad71['count'],_0x1201d8=_0x78b935[_0x918e('0x1b')],_0x3e8dd2=_0x78b935[_0x918e('0x1b')]+_0x78b935['limit'],_0xa31ee8;if(_0x3e8dd2>=_0x5a4710){_0x3e8dd2=_0x5a4710;_0xa31ee8=0xc8;}else{_0xa31ee8=0xce;}_0x6abdad[_0x918e('0x19')](_0xa31ee8);return _0x6abdad['set'](_0x918e('0x1c'),_0x1201d8+'-'+_0x3e8dd2+'/'+_0x5a4710)[_0x918e('0x1d')](_0x58ad71);}return null;};}function patchUpdates(_0x3b431c){return function(_0x1b8b81){try{jsonpatch['apply'](_0x1b8b81,_0x3b431c,!![]);}catch(_0x2aa152){return BPromise[_0x918e('0x1e')](_0x2aa152);}return _0x1b8b81[_0x918e('0x1f')]();};}function saveUpdates(_0x1d8777,_0x5c7e77){return function(_0x1deb55){if(_0x1deb55){return _0x1deb55[_0x918e('0x20')](_0x1d8777)[_0x918e('0x21')](function(_0x7bab22){return _0x7bab22;});}return null;};}function removeEntity(_0x34cbba,_0x37144c){return function(_0x41968e){if(_0x41968e){return _0x41968e[_0x918e('0x22')]()[_0x918e('0x21')](function(){var _0x4166b1=_0x41968e[_0x918e('0x23')]({'plain':!![]});var _0x2bde7e=_0x918e('0x24');return db[_0x918e('0x25')][_0x918e('0x22')]({'where':{'type':_0x2bde7e,'resourceId':_0x4166b1['id']}})[_0x918e('0x21')](function(){return _0x41968e;});})[_0x918e('0x21')](function(){_0x34cbba[_0x918e('0x19')](0xcc)[_0x918e('0x1a')]();});}};}function handleEntityNotFound(_0x544dd3,_0x56d046){return function(_0x1ded51){if(!_0x1ded51){_0x544dd3[_0x918e('0x18')](0x194);}return _0x1ded51;};}function handleError(_0x5ef4ed,_0x545d4a){_0x545d4a=_0x545d4a||0x1f4;return function(_0x47b44c){logger['error'](_0x47b44c[_0x918e('0x26')]);if(_0x47b44c[_0x918e('0x27')]){delete _0x47b44c['name'];}_0x5ef4ed['status'](_0x545d4a)[_0x918e('0x28')](_0x47b44c);};}exports['index']=function(_0x14edb2,_0x14741a){var _0x54fa7a={},_0x38335b={},_0x4b7314={'count':0x0,'rows':[]};var _0x378f5e=_[_0x918e('0x29')](db['CmContactHasItem'][_0x918e('0x2a')],function(_0x193688){return{'name':_0x193688[_0x918e('0x2b')],'type':_0x193688[_0x918e('0x2c')]['key']};});_0x38335b['model']=_[_0x918e('0x29')](_0x378f5e,'name');_0x38335b[_0x918e('0x2d')]=_[_0x918e('0x2e')](_0x14edb2['query']);_0x38335b[_0x918e('0x2f')]=_[_0x918e('0x30')](_0x38335b[_0x918e('0x31')],_0x38335b[_0x918e('0x2d')]);_0x54fa7a[_0x918e('0x32')]=_[_0x918e('0x30')](_0x38335b['model'],qs[_0x918e('0x33')](_0x14edb2[_0x918e('0x2d')][_0x918e('0x33')]));_0x54fa7a[_0x918e('0x32')]=_0x54fa7a['attributes'][_0x918e('0x34')]?_0x54fa7a[_0x918e('0x32')]:_0x38335b['model'];if(!_0x14edb2[_0x918e('0x2d')][_0x918e('0x35')](_0x918e('0x36'))){_0x54fa7a[_0x918e('0x37')]=qs['limit'](_0x14edb2[_0x918e('0x2d')][_0x918e('0x37')]);_0x54fa7a['offset']=qs[_0x918e('0x1b')](_0x14edb2[_0x918e('0x2d')]['offset']);}_0x54fa7a[_0x918e('0x38')]=qs[_0x918e('0x39')](_0x14edb2['query']['sort']);_0x54fa7a[_0x918e('0x3a')]=qs[_0x918e('0x2f')](_[_0x918e('0x3b')](_0x14edb2[_0x918e('0x2d')],_0x38335b[_0x918e('0x2f')]),_0x378f5e);if(_0x14edb2['query'][_0x918e('0x3c')]){_0x54fa7a['where']=_['merge'](_0x54fa7a[_0x918e('0x3a')],{'$or':_[_0x918e('0x29')](_0x378f5e,function(_0x71ac80){if(_0x71ac80[_0x918e('0x2c')]!==_0x918e('0x3d')){var _0x4252c0={};_0x4252c0[_0x71ac80[_0x918e('0x27')]]={'$like':'%'+_0x14edb2[_0x918e('0x2d')][_0x918e('0x3c')]+'%'};return _0x4252c0;}})});}_0x54fa7a=_[_0x918e('0x3e')]({},_0x54fa7a,_0x14edb2[_0x918e('0x3f')]);var _0x5276eb={'where':_0x54fa7a[_0x918e('0x3a')]};return db[_0x918e('0x40')]['count'](_0x5276eb)[_0x918e('0x21')](function(_0x573d48){_0x4b7314['count']=_0x573d48;if(_0x14edb2[_0x918e('0x2d')][_0x918e('0x41')]){_0x54fa7a[_0x918e('0x42')]=[{'all':!![]}];}return db[_0x918e('0x40')][_0x918e('0x43')](_0x54fa7a);})[_0x918e('0x21')](function(_0xecffeb){_0x4b7314[_0x918e('0x44')]=_0xecffeb;return _0x4b7314;})[_0x918e('0x21')](respondWithFilteredResult(_0x14741a,_0x54fa7a))[_0x918e('0x45')](handleError(_0x14741a,null));};exports[_0x918e('0x46')]=function(_0xbaf707,_0x3e816e){var _0x56b5cd={'raw':!![],'where':{'id':_0xbaf707[_0x918e('0x47')]['id']}},_0x379163={};_0x379163[_0x918e('0x31')]=_[_0x918e('0x2e')](db[_0x918e('0x40')][_0x918e('0x2a')]);_0x379163[_0x918e('0x2d')]=_[_0x918e('0x2e')](_0xbaf707[_0x918e('0x2d')]);_0x379163[_0x918e('0x2f')]=_['intersection'](_0x379163[_0x918e('0x31')],_0x379163[_0x918e('0x2d')]);_0x56b5cd[_0x918e('0x32')]=_[_0x918e('0x30')](_0x379163[_0x918e('0x31')],qs[_0x918e('0x33')](_0xbaf707[_0x918e('0x2d')]['fields']));_0x56b5cd[_0x918e('0x32')]=_0x56b5cd['attributes'][_0x918e('0x34')]?_0x56b5cd[_0x918e('0x32')]:_0x379163[_0x918e('0x31')];if(_0xbaf707['query'][_0x918e('0x41')]){_0x56b5cd[_0x918e('0x42')]=[{'all':!![]}];}_0x56b5cd=_[_0x918e('0x3e')]({},_0x56b5cd,_0xbaf707['options']);return db[_0x918e('0x40')][_0x918e('0x48')](_0x56b5cd)['then'](handleEntityNotFound(_0x3e816e,null))['then'](respondWithResult(_0x3e816e,null))[_0x918e('0x45')](handleError(_0x3e816e,null));};exports[_0x918e('0x49')]=function(_0x210c46,_0x48b14b){return db[_0x918e('0x40')][_0x918e('0x49')](_0x210c46[_0x918e('0x4a')],{})[_0x918e('0x21')](function(_0x3346de){var _0x646ea5=_0x210c46['user']['get']({'plain':!![]});if(!_0x646ea5)throw new Error(_0x918e('0x4b'));if(_0x646ea5[_0x918e('0x4c')]===_0x918e('0x4d')){var _0x4c42e5=_0x3346de[_0x918e('0x23')]({'plain':!![]});var _0x1c6887=_0x918e('0x24');return db['UserProfileSection'][_0x918e('0x48')]({'where':{'name':_0x1c6887,'userProfileId':_0x646ea5[_0x918e('0x4e')]},'raw':!![]})[_0x918e('0x21')](function(_0x2574c8){if(_0x2574c8&&_0x2574c8[_0x918e('0x4f')]===0x0){return db[_0x918e('0x25')][_0x918e('0x49')]({'name':_0x4c42e5[_0x918e('0x27')],'resourceId':_0x4c42e5['id'],'type':_0x2574c8[_0x918e('0x27')],'sectionId':_0x2574c8['id']},{})[_0x918e('0x21')](function(){return _0x3346de;});}else{return _0x3346de;}})['catch'](function(_0x4a2374){logger[_0x918e('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a2374);throw _0x4a2374;});}return _0x3346de;})['then'](respondWithResult(_0x48b14b,0xc9))[_0x918e('0x45')](handleError(_0x48b14b,null));};exports['update']=function(_0x201671,_0x1b029c){if(_0x201671[_0x918e('0x4a')]['id']){delete _0x201671[_0x918e('0x4a')]['id'];}return db[_0x918e('0x40')][_0x918e('0x48')]({'where':{'id':_0x201671[_0x918e('0x47')]['id']}})['then'](handleEntityNotFound(_0x1b029c,null))[_0x918e('0x21')](saveUpdates(_0x201671['body'],null))[_0x918e('0x21')](respondWithResult(_0x1b029c,null))[_0x918e('0x45')](handleError(_0x1b029c,null));};exports['destroy']=function(_0x4f69a6,_0xdeb33c){return db[_0x918e('0x40')][_0x918e('0x48')]({'where':{'id':_0x4f69a6[_0x918e('0x47')]['id']}})[_0x918e('0x21')](handleEntityNotFound(_0xdeb33c,null))[_0x918e('0x21')](removeEntity(_0xdeb33c,null))['catch'](handleError(_0xdeb33c,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 6e9d088..3d8fef3 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 _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 +var _0x6b8f=['exports','define','CmContactHasItem','cm_contact_has_items','util','api','request-promise','path','../../config/environment','./cmContactHasItem.attributes'];(function(_0x4e9562,_0x599d5d){var _0x3bfe31=function(_0x5c6556){while(--_0x5c6556){_0x4e9562['push'](_0x4e9562['shift']());}};_0x3bfe31(++_0x599d5d);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x4ae916,_0x4a25b3){_0x4ae916=_0x4ae916-0x0;var _0x5f1fdd=_0x6b8f[_0x4ae916];return _0x5f1fdd;};'use strict';var _=require('lodash');var util=require(_0xf6b8('0x0'));var logger=require('../../config/logger')(_0xf6b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6b8('0x2'));var fs=require('fs');var path=require(_0xf6b8('0x3'));var rimraf=require('rimraf');var config=require(_0xf6b8('0x4'));var attributes=require(_0xf6b8('0x5'));module[_0xf6b8('0x6')]=function(_0x549eac,_0x2d035e){return _0x549eac[_0xf6b8('0x7')](_0xf6b8('0x8'),attributes,{'tableName':_0xf6b8('0x9'),'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 898d168..007f03c 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 _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 +var _0xecd9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xecd9,0x13f));var _0x9ecd=function(_0x247293,_0x45bee0){_0x247293=_0x247293-0x0;var _0x4e73dd=_0xecd9[_0x247293];return _0x4e73dd;};'use strict';var _=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var moment=require(_0x9ecd('0x2'));var BPromise=require(_0x9ecd('0x3'));var rs=require(_0x9ecd('0x4'));var fs=require('fs');var Redis=require(_0x9ecd('0x5'));var db=require(_0x9ecd('0x6'))['db'];var utils=require(_0x9ecd('0x7'));var logger=require('../../config/logger')(_0x9ecd('0x8'));var config=require(_0x9ecd('0x9'));var jayson=require(_0x9ecd('0xa'));var client=jayson[_0x9ecd('0xb')][_0x9ecd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f0051,_0x887b47,_0xa24e58){return new BPromise(function(_0x387020,_0x3a2d40){return client[_0x9ecd('0xd')](_0x5f0051,_0xa24e58)[_0x9ecd('0xe')](function(_0x1e3084){logger[_0x9ecd('0xf')](_0x9ecd('0x10'),_0x887b47,_0x9ecd('0x11'));logger[_0x9ecd('0x12')](_0x9ecd('0x13'),_0x887b47,'request\x20sent',JSON['stringify'](_0x1e3084));if(_0x1e3084[_0x9ecd('0x14')]){if(_0x1e3084['error'][_0x9ecd('0x15')]===0x1f4){logger[_0x9ecd('0x14')](_0x9ecd('0x10'),_0x887b47,_0x1e3084[_0x9ecd('0x14')]['message']);return _0x3a2d40(_0x1e3084[_0x9ecd('0x14')][_0x9ecd('0x16')]);}logger[_0x9ecd('0x14')](_0x9ecd('0x10'),_0x887b47,_0x1e3084['error'][_0x9ecd('0x16')]);return _0x387020(_0x1e3084[_0x9ecd('0x14')][_0x9ecd('0x16')]);}else{logger['info'](_0x9ecd('0x10'),_0x887b47,_0x9ecd('0x11'));_0x387020(_0x1e3084[_0x9ecd('0x17')][_0x9ecd('0x16')]);}})[_0x9ecd('0x18')](function(_0x483fd3){logger[_0x9ecd('0x14')](_0x9ecd('0x10'),_0x887b47,_0x483fd3);_0x3a2d40(_0x483fd3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index b8ea4fd..114d7b0 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 _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 +var _0x630f=['./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4e9546,_0x53e9bb){var _0x5652e1=function(_0x140763){while(--_0x140763){_0x4e9546['push'](_0x4e9546['shift']());}};_0x5652e1(++_0x53e9bb);}(_0x630f,0x150));var _0xf630=function(_0x2bcd1b,_0x24d386){_0x2bcd1b=_0x2bcd1b-0x0;var _0x577799=_0x630f[_0x2bcd1b];return _0x577799;};'use strict';var multer=require(_0xf630('0x0'));var util=require(_0xf630('0x1'));var path=require(_0xf630('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf630('0x3')]();var auth=require(_0xf630('0x4'));var interaction=require(_0xf630('0x5'));var config=require('../../config/environment');var controller=require(_0xf630('0x6'));router[_0xf630('0x7')]('/',auth[_0xf630('0x8')](),controller[_0xf630('0x9')]);router['get'](_0xf630('0xa'),auth[_0xf630('0x8')](),controller[_0xf630('0xb')]);router[_0xf630('0xc')]('/',auth[_0xf630('0x8')](),controller[_0xf630('0xd')]);router[_0xf630('0xe')]('/:id',auth[_0xf630('0x8')](),controller[_0xf630('0xf')]);router[_0xf630('0x10')]('/:id',auth[_0xf630('0x8')](),controller[_0xf630('0x11')]);module[_0xf630('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js b/server/api/cmContactHasPhone/cmContactHasPhone.attributes.js index 85612ed..cc04a7c 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 _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 +var _0x883c=['sequelize','exports','INTEGER','STRING'];(function(_0x1f16de,_0x548eb9){var _0x36cd80=function(_0x4e1a45){while(--_0x4e1a45){_0x1f16de['push'](_0x1f16de['shift']());}};_0x36cd80(++_0x548eb9);}(_0x883c,0x164));var _0xc883=function(_0x66358e,_0x5c1c01){_0x66358e=_0x66358e-0x0;var _0x4f7700=_0x883c[_0x66358e];return _0x4f7700;};'use strict';var Sequelize=require(_0xc883('0x0'));module[_0xc883('0x1')]={'CmContactId':{'type':Sequelize[_0xc883('0x2')],'primaryKey':!![]},'phone':{'type':Sequelize[_0xc883('0x3')],'defaultValue':'','primaryKey':!![]}}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.controller.js b/server/api/cmContactHasPhone/cmContactHasPhone.controller.js index 5bc3b0c..260c74b 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 _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 +var _0xd4a2=['Content-Range','apply','reject','update','then','get','CmContactHasPhones','UserProfileResource','destroy','sendStatus','error','name','index','CmContactHasPhone','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','merge','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0xd4a2,0x128));var _0x2d4a=function(_0x935374,_0x3f46ae){_0x935374=_0x935374-0x0;var _0x370cfb=_0xd4a2[_0x935374];return _0x370cfb;};'use strict';var pdf=require(_0x2d4a('0x0'));var emlformat=require(_0x2d4a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2d4a('0x2'));var jsonpatch=require(_0x2d4a('0x3'));var rp=require(_0x2d4a('0x4'));var moment=require(_0x2d4a('0x5'));var BPromise=require(_0x2d4a('0x6'));var Mustache=require(_0x2d4a('0x7'));var util=require(_0x2d4a('0x8'));var path=require('path');var sox=require(_0x2d4a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0xd'));var querystring=require(_0x2d4a('0xe'));var Papa=require(_0x2d4a('0xf'));var Redis=require(_0x2d4a('0x10'));var authService=require(_0x2d4a('0x11'));var qs=require(_0x2d4a('0x12'));var as=require(_0x2d4a('0x13'));var hardwareService=require(_0x2d4a('0x14'));var logger=require('../../config/logger')(_0x2d4a('0x15'));var utils=require(_0x2d4a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x17'));var db=require(_0x2d4a('0x18'))['db'];function respondWithStatusCode(_0x169cc4,_0x4ab0d8){_0x4ab0d8=_0x4ab0d8||0xcc;return function(_0x22a6ac){if(_0x22a6ac){return _0x169cc4['sendStatus'](_0x4ab0d8);}return _0x169cc4[_0x2d4a('0x19')](_0x4ab0d8)[_0x2d4a('0x1a')]();};}function respondWithResult(_0x1a5a66,_0x3a76ea){_0x3a76ea=_0x3a76ea||0xc8;return function(_0x3948ce){if(_0x3948ce){return _0x1a5a66[_0x2d4a('0x19')](_0x3a76ea)[_0x2d4a('0x1b')](_0x3948ce);}};}function respondWithFilteredResult(_0x30b663,_0x484976){return function(_0x5a1c8c){if(_0x5a1c8c){var _0x5ba8ba=_0x5a1c8c[_0x2d4a('0x1c')],_0x2a8cb6=_0x484976[_0x2d4a('0x1d')],_0x26bf5e=_0x484976[_0x2d4a('0x1d')]+_0x484976[_0x2d4a('0x1e')],_0x1f27b0;if(_0x26bf5e>=_0x5ba8ba){_0x26bf5e=_0x5ba8ba;_0x1f27b0=0xc8;}else{_0x1f27b0=0xce;}_0x30b663[_0x2d4a('0x19')](_0x1f27b0);return _0x30b663[_0x2d4a('0x1f')](_0x2d4a('0x20'),_0x2a8cb6+'-'+_0x26bf5e+'/'+_0x5ba8ba)[_0x2d4a('0x1b')](_0x5a1c8c);}return null;};}function patchUpdates(_0x2f4ca2){return function(_0x4a249e){try{jsonpatch[_0x2d4a('0x21')](_0x4a249e,_0x2f4ca2,!![]);}catch(_0x1346d1){return BPromise[_0x2d4a('0x22')](_0x1346d1);}return _0x4a249e['save']();};}function saveUpdates(_0x17a441,_0x4f2bf9){return function(_0xf2f813){if(_0xf2f813){return _0xf2f813[_0x2d4a('0x23')](_0x17a441)[_0x2d4a('0x24')](function(_0x88f0e8){return _0x88f0e8;});}return null;};}function removeEntity(_0x5a02d3,_0x2d3b66){return function(_0x496404){if(_0x496404){return _0x496404['destroy']()[_0x2d4a('0x24')](function(){var _0x121772=_0x496404[_0x2d4a('0x25')]({'plain':!![]});var _0x36399d=_0x2d4a('0x26');return db[_0x2d4a('0x27')][_0x2d4a('0x28')]({'where':{'type':_0x36399d,'resourceId':_0x121772['id']}})[_0x2d4a('0x24')](function(){return _0x496404;});})[_0x2d4a('0x24')](function(){_0x5a02d3[_0x2d4a('0x19')](0xcc)[_0x2d4a('0x1a')]();});}};}function handleEntityNotFound(_0x40ae1f,_0x216145){return function(_0x23e2f1){if(!_0x23e2f1){_0x40ae1f[_0x2d4a('0x29')](0x194);}return _0x23e2f1;};}function handleError(_0x41a500,_0x5d60de){_0x5d60de=_0x5d60de||0x1f4;return function(_0x374d45){logger[_0x2d4a('0x2a')](_0x374d45['stack']);if(_0x374d45[_0x2d4a('0x2b')]){delete _0x374d45[_0x2d4a('0x2b')];}_0x41a500[_0x2d4a('0x19')](_0x5d60de)['send'](_0x374d45);};}exports[_0x2d4a('0x2c')]=function(_0x5294d3,_0x3c4929){var _0x452f79={},_0x2c45a0={},_0x31916c={'count':0x0,'rows':[]};var _0x1b988b=_['map'](db[_0x2d4a('0x2d')][_0x2d4a('0x2e')],function(_0x425e48){return{'name':_0x425e48[_0x2d4a('0x2f')],'type':_0x425e48['type'][_0x2d4a('0x30')]};});_0x2c45a0['model']=_['map'](_0x1b988b,'name');_0x2c45a0[_0x2d4a('0x31')]=_[_0x2d4a('0x32')](_0x5294d3['query']);_0x2c45a0[_0x2d4a('0x33')]=_[_0x2d4a('0x34')](_0x2c45a0[_0x2d4a('0x35')],_0x2c45a0[_0x2d4a('0x31')]);_0x452f79[_0x2d4a('0x36')]=_[_0x2d4a('0x34')](_0x2c45a0[_0x2d4a('0x35')],qs[_0x2d4a('0x37')](_0x5294d3['query'][_0x2d4a('0x37')]));_0x452f79[_0x2d4a('0x36')]=_0x452f79[_0x2d4a('0x36')][_0x2d4a('0x38')]?_0x452f79[_0x2d4a('0x36')]:_0x2c45a0[_0x2d4a('0x35')];if(!_0x5294d3['query']['hasOwnProperty'](_0x2d4a('0x39'))){_0x452f79[_0x2d4a('0x1e')]=qs[_0x2d4a('0x1e')](_0x5294d3[_0x2d4a('0x31')][_0x2d4a('0x1e')]);_0x452f79['offset']=qs[_0x2d4a('0x1d')](_0x5294d3[_0x2d4a('0x31')][_0x2d4a('0x1d')]);}_0x452f79['order']=qs[_0x2d4a('0x3a')](_0x5294d3[_0x2d4a('0x31')][_0x2d4a('0x3a')]);_0x452f79[_0x2d4a('0x3b')]=qs[_0x2d4a('0x33')](_[_0x2d4a('0x3c')](_0x5294d3[_0x2d4a('0x31')],_0x2c45a0['filters']),_0x1b988b);if(_0x5294d3[_0x2d4a('0x31')][_0x2d4a('0x3d')]){_0x452f79[_0x2d4a('0x3b')]=_['merge'](_0x452f79[_0x2d4a('0x3b')],{'$or':_[_0x2d4a('0x3e')](_0x1b988b,function(_0x1cde33){if(_0x1cde33[_0x2d4a('0x3f')]!==_0x2d4a('0x40')){var _0x47764f={};_0x47764f[_0x1cde33[_0x2d4a('0x2b')]]={'$like':'%'+_0x5294d3[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x47764f;}})});}_0x452f79=_['merge']({},_0x452f79,_0x5294d3[_0x2d4a('0x41')]);var _0x406ec4={'where':_0x452f79['where']};return db[_0x2d4a('0x2d')][_0x2d4a('0x1c')](_0x406ec4)['then'](function(_0x447dc5){_0x31916c[_0x2d4a('0x1c')]=_0x447dc5;if(_0x5294d3[_0x2d4a('0x31')][_0x2d4a('0x42')]){_0x452f79[_0x2d4a('0x43')]=[{'all':!![]}];}return db[_0x2d4a('0x2d')][_0x2d4a('0x44')](_0x452f79);})['then'](function(_0x4c8711){_0x31916c[_0x2d4a('0x45')]=_0x4c8711;return _0x31916c;})[_0x2d4a('0x24')](respondWithFilteredResult(_0x3c4929,_0x452f79))[_0x2d4a('0x46')](handleError(_0x3c4929,null));};exports['show']=function(_0x3686a8,_0xcbe8e4){var _0x1e150c={'raw':!![],'where':{'id':_0x3686a8[_0x2d4a('0x47')]['id']}},_0x37bf26={};_0x37bf26[_0x2d4a('0x35')]=_[_0x2d4a('0x32')](db[_0x2d4a('0x2d')]['rawAttributes']);_0x37bf26[_0x2d4a('0x31')]=_['keys'](_0x3686a8[_0x2d4a('0x31')]);_0x37bf26[_0x2d4a('0x33')]=_[_0x2d4a('0x34')](_0x37bf26[_0x2d4a('0x35')],_0x37bf26[_0x2d4a('0x31')]);_0x1e150c['attributes']=_[_0x2d4a('0x34')](_0x37bf26[_0x2d4a('0x35')],qs[_0x2d4a('0x37')](_0x3686a8['query'][_0x2d4a('0x37')]));_0x1e150c['attributes']=_0x1e150c[_0x2d4a('0x36')]['length']?_0x1e150c[_0x2d4a('0x36')]:_0x37bf26[_0x2d4a('0x35')];if(_0x3686a8[_0x2d4a('0x31')][_0x2d4a('0x42')]){_0x1e150c[_0x2d4a('0x43')]=[{'all':!![]}];}_0x1e150c=_[_0x2d4a('0x48')]({},_0x1e150c,_0x3686a8[_0x2d4a('0x41')]);return db[_0x2d4a('0x2d')][_0x2d4a('0x49')](_0x1e150c)['then'](handleEntityNotFound(_0xcbe8e4,null))[_0x2d4a('0x24')](respondWithResult(_0xcbe8e4,null))[_0x2d4a('0x46')](handleError(_0xcbe8e4,null));};exports['create']=function(_0x3a5d7a,_0x4f06cb){return db[_0x2d4a('0x2d')][_0x2d4a('0x4a')](_0x3a5d7a[_0x2d4a('0x4b')],{})[_0x2d4a('0x24')](function(_0x47791f){var _0xd58d9d=_0x3a5d7a[_0x2d4a('0x4c')]['get']({'plain':!![]});if(!_0xd58d9d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd58d9d[_0x2d4a('0x4d')]==='user'){var _0x1688d3=_0x47791f['get']({'plain':!![]});var _0x32f209=_0x2d4a('0x26');return db[_0x2d4a('0x4e')][_0x2d4a('0x49')]({'where':{'name':_0x32f209,'userProfileId':_0xd58d9d[_0x2d4a('0x4f')]},'raw':!![]})[_0x2d4a('0x24')](function(_0x4db7f8){if(_0x4db7f8&&_0x4db7f8[_0x2d4a('0x50')]===0x0){return db[_0x2d4a('0x27')][_0x2d4a('0x4a')]({'name':_0x1688d3['name'],'resourceId':_0x1688d3['id'],'type':_0x4db7f8[_0x2d4a('0x2b')],'sectionId':_0x4db7f8['id']},{})[_0x2d4a('0x24')](function(){return _0x47791f;});}else{return _0x47791f;}})[_0x2d4a('0x46')](function(_0x4eb37b){logger['error'](_0x2d4a('0x51'),_0x4eb37b);throw _0x4eb37b;});}return _0x47791f;})[_0x2d4a('0x24')](respondWithResult(_0x4f06cb,0xc9))[_0x2d4a('0x46')](handleError(_0x4f06cb,null));};exports[_0x2d4a('0x23')]=function(_0x4566da,_0x3aaeb3){if(_0x4566da[_0x2d4a('0x4b')]['id']){delete _0x4566da['body']['id'];}return db[_0x2d4a('0x2d')][_0x2d4a('0x49')]({'where':{'id':_0x4566da[_0x2d4a('0x47')]['id']}})[_0x2d4a('0x24')](handleEntityNotFound(_0x3aaeb3,null))[_0x2d4a('0x24')](saveUpdates(_0x4566da['body'],null))[_0x2d4a('0x24')](respondWithResult(_0x3aaeb3,null))[_0x2d4a('0x46')](handleError(_0x3aaeb3,null));};exports[_0x2d4a('0x28')]=function(_0x104f65,_0x4650b4){return db['CmContactHasPhone'][_0x2d4a('0x49')]({'where':{'id':_0x104f65['params']['id']}})['then'](handleEntityNotFound(_0x4650b4,null))[_0x2d4a('0x24')](removeEntity(_0x4650b4,null))['catch'](handleError(_0x4650b4,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasPhone/cmContactHasPhone.model.js b/server/api/cmContactHasPhone/cmContactHasPhone.model.js index 1194257..10d494d 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 _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 +var _0x9fba=['moment','request-promise','../../config/environment','./cmContactHasPhone.attributes','exports','define','CmContactHasPhone','lodash','../../config/logger','api'];(function(_0x327d68,_0x1791b2){var _0x508d38=function(_0x4b0ed6){while(--_0x4b0ed6){_0x327d68['push'](_0x327d68['shift']());}};_0x508d38(++_0x1791b2);}(_0x9fba,0x11f));var _0xa9fb=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9fba[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xa9fb('0x0'));var util=require('util');var logger=require(_0xa9fb('0x1'))(_0xa9fb('0x2'));var moment=require(_0xa9fb('0x3'));var BPromise=require('bluebird');var rp=require(_0xa9fb('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa9fb('0x5'));var attributes=require(_0xa9fb('0x6'));module[_0xa9fb('0x7')]=function(_0x3b4548,_0xb8df13){return _0x3b4548[_0xa9fb('0x8')](_0xa9fb('0x9'),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 870eb2f..439343c 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 _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 +var _0x5783=['CmContactHasPhone,\x20%s,\x20%s','debug','CmContactHasPhone,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','jayson/promise','http','request','then','info'];(function(_0x11c93a,_0x138505){var _0x57ec3f=function(_0x3eea68){while(--_0x3eea68){_0x11c93a['push'](_0x11c93a['shift']());}};_0x57ec3f(++_0x138505);}(_0x5783,0x14c));var _0x3578=function(_0x1cede9,_0x913a29){_0x1cede9=_0x1cede9-0x0;var _0x12a1f4=_0x5783[_0x1cede9];return _0x12a1f4;};'use strict';var _=require(_0x3578('0x0'));var util=require(_0x3578('0x1'));var moment=require('moment');var BPromise=require(_0x3578('0x2'));var rs=require(_0x3578('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3578('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3578('0x5'));var client=jayson['client'][_0x3578('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4b7479,_0x36642e,_0xa7bafd){return new BPromise(function(_0x3dba22,_0x565496){return client[_0x3578('0x7')](_0x4b7479,_0xa7bafd)[_0x3578('0x8')](function(_0x470487){logger[_0x3578('0x9')](_0x3578('0xa'),_0x36642e,'request\x20sent');logger[_0x3578('0xb')](_0x3578('0xc'),_0x36642e,_0x3578('0xd'),JSON['stringify'](_0x470487));if(_0x470487[_0x3578('0xe')]){if(_0x470487['error'][_0x3578('0xf')]===0x1f4){logger[_0x3578('0xe')](_0x3578('0xa'),_0x36642e,_0x470487[_0x3578('0xe')][_0x3578('0x10')]);return _0x565496(_0x470487['error']['message']);}logger[_0x3578('0xe')]('CmContactHasPhone,\x20%s,\x20%s',_0x36642e,_0x470487[_0x3578('0xe')][_0x3578('0x10')]);return _0x3dba22(_0x470487[_0x3578('0xe')]['message']);}else{logger[_0x3578('0x9')](_0x3578('0xa'),_0x36642e,'request\x20sent');_0x3dba22(_0x470487[_0x3578('0x11')][_0x3578('0x10')]);}})['catch'](function(_0x21f0d3){logger[_0x3578('0xe')](_0x3578('0xa'),_0x36642e,_0x21f0d3);_0x565496(_0x21f0d3);});});} \ No newline at end of file diff --git a/server/api/cmContactHasPhone/index.js b/server/api/cmContactHasPhone/index.js index e109604..32c6515 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 _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 +var _0xf5dd=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContactHasPhone.controller','get','isAuthenticated','index','/:id'];(function(_0x46cf08,_0x489118){var _0x46df90=function(_0x3ca0da){while(--_0x3ca0da){_0x46cf08['push'](_0x46cf08['shift']());}};_0x46df90(++_0x489118);}(_0xf5dd,0x110));var _0xdf5d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf5dd[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xdf5d('0x0'));var util=require(_0xdf5d('0x1'));var path=require(_0xdf5d('0x2'));var timeout=require(_0xdf5d('0x3'));var express=require(_0xdf5d('0x4'));var router=express[_0xdf5d('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf5d('0x6'));var config=require(_0xdf5d('0x7'));var controller=require(_0xdf5d('0x8'));router[_0xdf5d('0x9')]('/',auth[_0xdf5d('0xa')](),controller[_0xdf5d('0xb')]);router[_0xdf5d('0x9')](_0xdf5d('0xc'),auth[_0xdf5d('0xa')](),controller['show']);router[_0xdf5d('0xd')]('/',auth['isAuthenticated'](),controller[_0xdf5d('0xe')]);router[_0xdf5d('0xf')](_0xdf5d('0xc'),auth[_0xdf5d('0xa')](),controller[_0xdf5d('0x10')]);router[_0xdf5d('0x11')](_0xdf5d('0xc'),auth[_0xdf5d('0xa')](),controller[_0xdf5d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 08a874f..9b53883 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 _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 +var _0x7764=['STRING','setDataValue','name','long','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias'];(function(_0x4a5e03,_0x430c11){var _0x21307c=function(_0x3d18f9){while(--_0x3d18f9){_0x4a5e03['push'](_0x4a5e03['shift']());}};_0x21307c(++_0x430c11);}(_0x7764,0xa4));var _0x4776=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x7764[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x4776('0x0'));var _=require(_0x4776('0x1'));module[_0x4776('0x2')]={'name':{'type':Sequelize[_0x4776('0x3')],'get':function(_0x90273){return this[_0x4776('0x4')](_0x4776('0x5'));}},'alias':{'type':Sequelize[_0x4776('0x6')],'allowNull':![],'set':function(_0x3b28ba){this[_0x4776('0x7')]('alias',_0x3b28ba?_0x3b28ba:this['getDataValue'](_0x4776('0x8')));}},'type':{'type':Sequelize[_0x4776('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x4776('0x9')),'get':function(){if(this[_0x4776('0x4')]('type')==='select'){return JSON[_0x4776('0xa')](this['getDataValue'](_0x4776('0xb')));}else{return this[_0x4776('0x4')](_0x4776('0xb'));}},'set':function(_0x3baf2f){if(Array[_0x4776('0xc')](_0x3baf2f)){this[_0x4776('0x7')](_0x4776('0xb'),JSON[_0x4776('0xd')](_0x3baf2f));}else{this[_0x4776('0x7')](_0x4776('0xb'),_0x3baf2f);}}},'required':{'type':Sequelize[_0x4776('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4776('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4776('0xf')](_0x4776('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 436624c..d1e05eb 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 _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 +var _0x8734=['request-promise','bluebird','util','path','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','count','limit','set','Content-Range','json','reject','update','then','destroy','end','error','stack','name','index','map','CmCustomField','rawAttributes','type','key','differenceBy','keys','intersection','query','attributes','fields','model','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','find','catch','body','params','create','transaction','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%d','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x48fb7d,_0x5a561f){var _0x922c2c=function(_0xb29d2e){while(--_0xb29d2e){_0x48fb7d['push'](_0x48fb7d['shift']());}};_0x922c2c(++_0x5a561f);}(_0x8734,0x134));var _0x4873=function(_0x5d78f0,_0x3784f9){_0x5d78f0=_0x5d78f0-0x0;var _0x4d1012=_0x8734[_0x5d78f0];return _0x4d1012;};'use strict';var pdf=require(_0x4873('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4873('0x1'));var zipdir=require(_0x4873('0x2'));var jsonpatch=require(_0x4873('0x3'));var rp=require(_0x4873('0x4'));var moment=require('moment');var BPromise=require(_0x4873('0x5'));var Mustache=require('mustache');var util=require(_0x4873('0x6'));var path=require(_0x4873('0x7'));var sox=require('sox');var csv=require(_0x4873('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4873('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4873('0xa'));var toCsv=require(_0x4873('0x8'));var querystring=require(_0x4873('0xb'));var Papa=require(_0x4873('0xc'));var Redis=require(_0x4873('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4873('0xe'));var as=require(_0x4873('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4873('0x10'))('api');var utils=require(_0x4873('0x11'));var config=require(_0x4873('0x12'));var licenseUtil=require(_0x4873('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ed774,_0x55617e){_0x55617e=_0x55617e||0xcc;return function(_0x17ccfc){if(_0x17ccfc){return _0x1ed774[_0x4873('0x14')](_0x55617e);}return _0x1ed774[_0x4873('0x15')](_0x55617e)['end']();};}function respondWithResult(_0x11c5aa,_0xaa1a9f){_0xaa1a9f=_0xaa1a9f||0xc8;return function(_0x2eb563){if(_0x2eb563){return _0x11c5aa[_0x4873('0x15')](_0xaa1a9f)['json'](_0x2eb563);}};}function respondWithFilteredResult(_0x4f725d,_0x225bc0){return function(_0x175509){if(_0x175509){var _0x2e4459=_0x175509[_0x4873('0x16')],_0x24cca9=_0x225bc0['offset'],_0x5dd6bd=_0x225bc0['offset']+_0x225bc0[_0x4873('0x17')],_0x471eb3;if(_0x5dd6bd>=_0x2e4459){_0x5dd6bd=_0x2e4459;_0x471eb3=0xc8;}else{_0x471eb3=0xce;}_0x4f725d[_0x4873('0x15')](_0x471eb3);return _0x4f725d[_0x4873('0x18')](_0x4873('0x19'),_0x24cca9+'-'+_0x5dd6bd+'/'+_0x2e4459)[_0x4873('0x1a')](_0x175509);}return null;};}function patchUpdates(_0x1a4a3f){return function(_0x5808e4){try{jsonpatch['apply'](_0x5808e4,_0x1a4a3f,!![]);}catch(_0x132e28){return BPromise[_0x4873('0x1b')](_0x132e28);}return _0x5808e4['save']();};}function saveUpdates(_0x2009c4,_0x49f91d){return function(_0x316799){if(_0x316799){return _0x316799[_0x4873('0x1c')](_0x2009c4)[_0x4873('0x1d')](function(_0x35ac4e){return _0x35ac4e;});}return null;};}function removeEntity(_0x51d5cb,_0x7db8f8){return function(_0x28edfd){if(_0x28edfd){return _0x28edfd[_0x4873('0x1e')]()[_0x4873('0x1d')](function(){_0x51d5cb['status'](0xcc)[_0x4873('0x1f')]();});}};}function handleEntityNotFound(_0x3cc0cf,_0x50ccd6){return function(_0x2f2eac){if(!_0x2f2eac){_0x3cc0cf['sendStatus'](0x194);}return _0x2f2eac;};}function handleError(_0x3ffc31,_0x2320d4){_0x2320d4=_0x2320d4||0x1f4;return function(_0x437cc4){logger[_0x4873('0x20')](_0x437cc4[_0x4873('0x21')]);if(_0x437cc4[_0x4873('0x22')]){delete _0x437cc4[_0x4873('0x22')];}_0x3ffc31['status'](_0x2320d4)['send'](_0x437cc4);};}exports[_0x4873('0x23')]=function(_0x5208f6,_0xc1aae8){var _0x1cb289={},_0x128707={},_0x331a69={'count':0x0,'rows':[]};var _0x26e94d=_[_0x4873('0x24')](db[_0x4873('0x25')][_0x4873('0x26')],function(_0x3585a3){return{'name':_0x3585a3['fieldName'],'type':_0x3585a3[_0x4873('0x27')][_0x4873('0x28')]};});_0x128707['model']=_[_0x4873('0x29')](_[_0x4873('0x24')](_0x26e94d,_0x4873('0x22')),['name']);_0x128707['query']=_[_0x4873('0x2a')](_0x5208f6['query']);_0x128707['filters']=_[_0x4873('0x2b')](_0x128707['model'],_0x128707[_0x4873('0x2c')]);_0x1cb289[_0x4873('0x2d')]=_[_0x4873('0x2b')](_0x128707['model'],qs[_0x4873('0x2e')](_0x5208f6['query'][_0x4873('0x2e')]));_0x1cb289[_0x4873('0x2d')]=_0x1cb289[_0x4873('0x2d')]['length']?_0x1cb289[_0x4873('0x2d')]:_0x128707[_0x4873('0x2f')];if(!_0x5208f6[_0x4873('0x2c')][_0x4873('0x30')](_0x4873('0x31'))){_0x1cb289['limit']=qs[_0x4873('0x17')](_0x5208f6[_0x4873('0x2c')][_0x4873('0x17')]);_0x1cb289[_0x4873('0x32')]=qs[_0x4873('0x32')](_0x5208f6['query']['offset']);}_0x1cb289[_0x4873('0x33')]=qs[_0x4873('0x34')](_0x5208f6['query']['sort']);_0x1cb289[_0x4873('0x35')]=qs[_0x4873('0x36')](_[_0x4873('0x37')](_0x5208f6[_0x4873('0x2c')],_0x128707[_0x4873('0x36')]),_0x26e94d);if(_0x5208f6[_0x4873('0x2c')][_0x4873('0x38')]){_0x1cb289[_0x4873('0x35')]=_[_0x4873('0x39')](_0x1cb289[_0x4873('0x35')],{'$or':_[_0x4873('0x24')](_0x26e94d,function(_0x59146e){if(_0x59146e[_0x4873('0x27')]!=='VIRTUAL'){var _0x49ca3a={};_0x49ca3a[_0x59146e[_0x4873('0x22')]]={'$like':'%'+_0x5208f6[_0x4873('0x2c')][_0x4873('0x38')]+'%'};return _0x49ca3a;}})});}_0x1cb289=_['merge']({},_0x1cb289,_0x5208f6[_0x4873('0x3a')]);var _0x2aa0de={'where':_0x1cb289[_0x4873('0x35')]};return db['CmCustomField'][_0x4873('0x16')](_0x2aa0de)[_0x4873('0x1d')](function(_0x2fc5b4){_0x331a69[_0x4873('0x16')]=_0x2fc5b4;if(_0x5208f6[_0x4873('0x2c')]['includeAll']){_0x1cb289[_0x4873('0x3b')]=[{'all':!![]}];}return db['CmCustomField'][_0x4873('0x3c')](_0x1cb289);})[_0x4873('0x1d')](function(_0xd4b3d7){_0x331a69[_0x4873('0x3d')]=_0xd4b3d7;return _0x331a69;})['then'](respondWithFilteredResult(_0xc1aae8,_0x1cb289))['catch'](handleError(_0xc1aae8,null));};exports['show']=function(_0x3ca7da,_0x1a12ed){var _0x557a9f={'raw':!![],'where':{'id':_0x3ca7da['params']['id']}},_0x575124={};_0x575124['model']=_['keys'](db[_0x4873('0x25')][_0x4873('0x26')]);_0x575124[_0x4873('0x2c')]=_['keys'](_0x3ca7da[_0x4873('0x2c')]);_0x575124[_0x4873('0x36')]=_['intersection'](_0x575124[_0x4873('0x2f')],_0x575124[_0x4873('0x2c')]);_0x557a9f[_0x4873('0x2d')]=_[_0x4873('0x2b')](_0x575124[_0x4873('0x2f')],qs[_0x4873('0x2e')](_0x3ca7da['query'][_0x4873('0x2e')]));_0x557a9f['attributes']=_0x557a9f[_0x4873('0x2d')]['length']?_0x557a9f['attributes']:_0x575124['model'];if(_0x3ca7da['query']['includeAll']){_0x557a9f[_0x4873('0x3b')]=[{'all':!![]}];}_0x557a9f=_[_0x4873('0x39')]({},_0x557a9f,_0x3ca7da[_0x4873('0x3a')]);return db['CmCustomField'][_0x4873('0x3e')](_0x557a9f)['then'](handleEntityNotFound(_0x1a12ed,null))[_0x4873('0x1d')](respondWithResult(_0x1a12ed,null))[_0x4873('0x3f')](handleError(_0x1a12ed,null));};exports['update']=function(_0x3d8d13,_0x28ee0f){if(_0x3d8d13[_0x4873('0x40')]['id']){delete _0x3d8d13[_0x4873('0x40')]['id'];}return db[_0x4873('0x25')][_0x4873('0x3e')]({'where':{'id':_0x3d8d13[_0x4873('0x41')]['id']}})[_0x4873('0x1d')](handleEntityNotFound(_0x28ee0f,null))[_0x4873('0x1d')](saveUpdates(_0x3d8d13[_0x4873('0x40')],null))['then'](respondWithResult(_0x28ee0f,null))['catch'](handleError(_0x28ee0f,null));};exports[_0x4873('0x1e')]=function(_0x3d4dfa,_0x3820d5){return db[_0x4873('0x25')][_0x4873('0x3e')]({'where':{'id':_0x3d4dfa['params']['id']}})[_0x4873('0x1d')](handleEntityNotFound(_0x3820d5,null))[_0x4873('0x1d')](removeEntity(_0x3820d5,null))[_0x4873('0x3f')](handleError(_0x3820d5,null));};exports[_0x4873('0x42')]=function(_0x17b86d,_0x434de8){var _0xb24f3d;return db['sequelize'][_0x4873('0x43')](function(_0x2451a4){return db['CmCustomField'][_0x4873('0x42')](_0x17b86d[_0x4873('0x40')],{'transaction':_0x2451a4})[_0x4873('0x1d')](function(_0x35cc60){_0xb24f3d=_0x35cc60;var _0x30f871={'type':db[_0x4873('0x44')]['TEXT'],'transaction':_0x2451a4};switch(_0x17b86d[_0x4873('0x40')][_0x4873('0x27')]){case _0x4873('0x45'):_0x30f871[_0x4873('0x27')]=db[_0x4873('0x44')][_0x4873('0x46')];break;case _0x4873('0x47'):_0x30f871[_0x4873('0x27')]=db[_0x4873('0x44')][_0x4873('0x48')];break;case _0x4873('0x49'):_0x30f871[_0x4873('0x27')]=db[_0x4873('0x44')][_0x4873('0x4a')];_0x30f871['defaultValue']=![];break;default:}return db['sequelize'][_0x4873('0x4b')][_0x4873('0x4c')]('cm_contacts',util['format'](_0x4873('0x4d'),_0xb24f3d['id']),_0x30f871);})[_0x4873('0x1d')](function(){return _0xb24f3d;});})['then'](respondWithResult(_0x434de8,0xc9))[_0x4873('0x3f')](handleError(_0x434de8,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fa01f35..da30053 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 _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 +var _0x2453=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1b1c4f,_0x32eb9c){var _0x3f02c1=function(_0x180c82){while(--_0x180c82){_0x1b1c4f['push'](_0x1b1c4f['shift']());}};_0x3f02c1(++_0x32eb9c);}(_0x2453,0x6a));var _0x3245=function(_0x723ed6,_0x3cfba2){_0x723ed6=_0x723ed6-0x0;var _0x3bcf9b=_0x2453[_0x723ed6];return _0x3bcf9b;};'use strict';var _=require(_0x3245('0x0'));var util=require('util');var logger=require(_0x3245('0x1'))(_0x3245('0x2'));var moment=require(_0x3245('0x3'));var BPromise=require(_0x3245('0x4'));var rp=require(_0x3245('0x5'));var fs=require('fs');var path=require(_0x3245('0x6'));var rimraf=require(_0x3245('0x7'));var config=require(_0x3245('0x8'));var attributes=require(_0x3245('0x9'));module[_0x3245('0xa')]=function(_0x2b8658,_0x1f03d4){return _0x2b8658[_0x3245('0xb')](_0x3245('0xc'),attributes,{'tableName':_0x3245('0xd'),'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 7594631..f4ee27c 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 _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 +var _0xb469=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x49143c,_0x3f6ad1){var _0xfa7854=function(_0x158339){while(--_0x158339){_0x49143c['push'](_0x49143c['shift']());}};_0xfa7854(++_0x3f6ad1);}(_0xb469,0x13b));var _0x9b46=function(_0x5be8fe,_0x5d4f80){_0x5be8fe=_0x5be8fe-0x0;var _0x368b7c=_0xb469[_0x5be8fe];return _0x368b7c;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index d3d75c3..34061f0 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 _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 +var _0x7510=['/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7510,0xa9));var _0x0751=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x7510[_0x3947c9];return _0x2e7871;};'use strict';var multer=require('multer');var util=require(_0x0751('0x0'));var path=require('path');var timeout=require(_0x0751('0x1'));var express=require(_0x0751('0x2'));var router=express[_0x0751('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0751('0x4'));var config=require(_0x0751('0x5'));var controller=require(_0x0751('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0751('0x7'),auth['isAuthenticated'](),controller[_0x0751('0x8')]);router[_0x0751('0x9')]('/',auth[_0x0751('0xa')](),controller[_0x0751('0xb')]);router[_0x0751('0xc')](_0x0751('0x7'),auth[_0x0751('0xa')](),controller['update']);router[_0x0751('0xd')](_0x0751('0x7'),auth[_0x0751('0xa')](),controller[_0x0751('0xe')]);module[_0x0751('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 15cd4ef..2392129 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 _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 +var _0x98a8=['format','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x98a8,0x12c));var _0x898a=function(_0x1d0bd5,_0x18637d){_0x1d0bd5=_0x1d0bd5-0x0;var _0x44b21e=_0x98a8[_0x1d0bd5];return _0x44b21e;};'use strict';var moment=require(_0x898a('0x0'));var Sequelize=require(_0x898a('0x1'));module[_0x898a('0x2')]={'phone':{'type':Sequelize[_0x898a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x898a('0x5')],'defaultValue':moment()[_0x898a('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x898a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x898a('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x898a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x898a('0x8')},'ListId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'UserId':{'type':Sequelize[_0x898a('0x7')]},'VoiceQueueId':{'type':Sequelize[_0x898a('0x7')],'unique':_0x898a('0x8')},'CampaignId':{'type':Sequelize[_0x898a('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x898a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index cb17dbf..5c974d4 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 _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 +var _0x5242=['isNil','calleridname','firstName','finally','getPreview','getVoiceQueues','outbound','sequelize','transaction','direction','prev','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Company','List','Queue','dialActive','getOpenContacts','preview','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','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','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gte','$lt','$ne','$eq','$notBetween','$in','$notIn','$like','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','then','show','params','create','body','catch','describe','find','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','deletedat','format','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0x5242,0x148));var _0x2524=function(_0x51580e,_0x38f189){_0x51580e=_0x51580e-0x0;var _0x36e9e3=_0x5242[_0x51580e];return _0x36e9e3;};'use strict';var pdf=require(_0x2524('0x0'));var emlformat=require(_0x2524('0x1'));var rimraf=require(_0x2524('0x2'));var zipdir=require(_0x2524('0x3'));var jsonpatch=require(_0x2524('0x4'));var rp=require('request-promise');var moment=require(_0x2524('0x5'));var BPromise=require(_0x2524('0x6'));var Mustache=require(_0x2524('0x7'));var util=require(_0x2524('0x8'));var path=require(_0x2524('0x9'));var sox=require(_0x2524('0xa'));var csv=require(_0x2524('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2524('0xc'));var squel=require(_0x2524('0xd'));var crypto=require(_0x2524('0xe'));var jsforce=require(_0x2524('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2524('0x10'));var Papa=require(_0x2524('0x11'));var Redis=require(_0x2524('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x2524('0x13'));var as=require(_0x2524('0x14'));var hardwareService=require(_0x2524('0x15'));var logger=require(_0x2524('0x16'))(_0x2524('0x17'));var utils=require(_0x2524('0x18'));var config=require(_0x2524('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d626,_0x3ab81e){_0x3ab81e=_0x3ab81e||0xcc;return function(_0x3b3d6d){if(_0x3b3d6d){return _0x44d626[_0x2524('0x1a')](_0x3ab81e);}return _0x44d626[_0x2524('0x1b')](_0x3ab81e)[_0x2524('0x1c')]();};}function respondWithResult(_0x214443,_0x1dea4d){_0x1dea4d=_0x1dea4d||0xc8;return function(_0xa3caff){if(_0xa3caff){return _0x214443[_0x2524('0x1b')](_0x1dea4d)[_0x2524('0x1d')](_0xa3caff);}};}function respondWithFilteredResult(_0x364708,_0x19f481){return function(_0x59e767){if(_0x59e767){var _0x4dc476=_0x59e767[_0x2524('0x1e')],_0xa91f4e=_0x19f481['offset'],_0x18ef8a=_0x19f481[_0x2524('0x1f')]+_0x19f481[_0x2524('0x20')],_0x14c347;if(_0x18ef8a>=_0x4dc476){_0x18ef8a=_0x4dc476;_0x14c347=0xc8;}else{_0x14c347=0xce;}_0x364708[_0x2524('0x1b')](_0x14c347);return _0x364708[_0x2524('0x21')](_0x2524('0x22'),_0xa91f4e+'-'+_0x18ef8a+'/'+_0x4dc476)[_0x2524('0x1d')](_0x59e767);}return null;};}function patchUpdates(_0x3b42a2){return function(_0x3da9a2){try{jsonpatch[_0x2524('0x23')](_0x3da9a2,_0x3b42a2,!![]);}catch(_0x5f5243){return BPromise[_0x2524('0x24')](_0x5f5243);}return _0x3da9a2['save']();};}function saveUpdates(_0x33a5d0,_0x264cbd){return function(_0x122ecf){if(_0x122ecf){return _0x122ecf[_0x2524('0x25')](_0x33a5d0)['then'](function(_0x50e594){return _0x50e594;});}return null;};}function removeEntity(_0x29528f,_0x1a0d53){return function(_0xb7d116){if(_0xb7d116){return _0xb7d116[_0x2524('0x26')]()['then'](function(){_0x29528f['status'](0xcc)[_0x2524('0x1c')]();});}};}function handleEntityNotFound(_0x1cd4ca,_0x53ef2b){return function(_0x553fd9){if(!_0x553fd9){_0x1cd4ca[_0x2524('0x1a')](0x194);}return _0x553fd9;};}function handleError(_0x9026d7,_0x27d628){_0x27d628=_0x27d628||0x1f4;return function(_0x5be9bc){logger['error'](_0x5be9bc[_0x2524('0x27')]);if(_0x5be9bc[_0x2524('0x28')]){delete _0x5be9bc['name'];}_0x9026d7[_0x2524('0x1b')](_0x27d628)[_0x2524('0x29')](_0x5be9bc);};}exports['index']=function(_0x3be820,_0x2c5169){var _0x325b3f={},_0x420f07={},_0x45d058={'count':0x0,'rows':[]};var _0x243031=_[_0x2524('0x2a')](db[_0x2524('0x2b')][_0x2524('0x2c')],function(_0x141d91){return{'name':_0x141d91[_0x2524('0x2d')],'type':_0x141d91[_0x2524('0x2e')][_0x2524('0x2f')]};});_0x420f07[_0x2524('0x30')]=_[_0x2524('0x2a')](_0x243031,_0x2524('0x28'));_0x420f07[_0x2524('0x31')]=_[_0x2524('0x32')](_0x3be820['query']);_0x420f07[_0x2524('0x33')]=_[_0x2524('0x34')](_0x420f07[_0x2524('0x30')],_0x420f07[_0x2524('0x31')]);_0x420f07['filters']=_[_0x2524('0x35')](_0x420f07[_0x2524('0x33')],[_0x2524('0x36'),'$or','$gt',_0x2524('0x37'),_0x2524('0x38'),'$lte',_0x2524('0x39'),_0x2524('0x3a'),'$not','$between',_0x2524('0x3b'),_0x2524('0x3c'),_0x2524('0x3d'),_0x2524('0x3e'),'$notLike',_0x2524('0x3f'),_0x2524('0x40'),_0x2524('0x3e'),_0x2524('0x41'),_0x2524('0x42'),_0x2524('0x43'),_0x2524('0x44')]);_0x325b3f[_0x2524('0x45')]=_[_0x2524('0x34')](_0x420f07['model'],qs['fields'](_0x3be820[_0x2524('0x31')][_0x2524('0x46')]));_0x325b3f[_0x2524('0x45')]=_0x325b3f[_0x2524('0x45')][_0x2524('0x47')]?_0x325b3f[_0x2524('0x45')]:_0x420f07[_0x2524('0x30')];if(!_0x3be820[_0x2524('0x31')][_0x2524('0x48')](_0x2524('0x49'))){_0x325b3f['limit']=qs[_0x2524('0x20')](_0x3be820[_0x2524('0x31')][_0x2524('0x20')]);_0x325b3f[_0x2524('0x1f')]=qs[_0x2524('0x1f')](_0x3be820['query'][_0x2524('0x1f')]);}_0x325b3f[_0x2524('0x4a')]=qs[_0x2524('0x4b')](_0x3be820[_0x2524('0x31')][_0x2524('0x4b')]);_0x325b3f['where']=qs[_0x2524('0x33')](_[_0x2524('0x4c')](_0x3be820[_0x2524('0x31')],_0x420f07[_0x2524('0x33')]),_0x243031);if(_0x3be820[_0x2524('0x31')][_0x2524('0x4d')]){_0x325b3f[_0x2524('0x4e')]=_[_0x2524('0x4f')](_0x325b3f[_0x2524('0x4e')],{'$or':_['map'](_0x243031,function(_0x319da8){if(_0x319da8[_0x2524('0x2e')]!==_0x2524('0x50')){var _0x3ed87b={};_0x3ed87b[_0x319da8['name']]={'$like':'%'+_0x3be820[_0x2524('0x31')][_0x2524('0x4d')]+'%'};return _0x3ed87b;}})});}_0x325b3f=_[_0x2524('0x4f')]({},_0x325b3f,_0x3be820[_0x2524('0x51')]);var _0x2495c1={'where':_0x325b3f[_0x2524('0x4e')]};return db[_0x2524('0x2b')][_0x2524('0x1e')](_0x2495c1)['then'](function(_0x21aed3){_0x45d058[_0x2524('0x1e')]=_0x21aed3;if(_0x3be820[_0x2524('0x31')][_0x2524('0x52')]){_0x325b3f[_0x2524('0x53')]=[{'all':!![]}];}return db[_0x2524('0x2b')][_0x2524('0x54')](_0x325b3f);})['then'](function(_0x2a957c){_0x45d058[_0x2524('0x55')]=_0x2a957c;return _0x45d058;})[_0x2524('0x56')](respondWithFilteredResult(_0x2c5169,_0x325b3f))['catch'](handleError(_0x2c5169,null));};exports[_0x2524('0x57')]=function(_0x3925fe,_0x23d7b8){var _0x3933fc={'raw':!![],'where':{'id':_0x3925fe[_0x2524('0x58')]['id']}},_0x558283={};_0x558283[_0x2524('0x30')]=_[_0x2524('0x32')](db[_0x2524('0x2b')][_0x2524('0x2c')]);_0x558283[_0x2524('0x31')]=_[_0x2524('0x32')](_0x3925fe[_0x2524('0x31')]);_0x558283[_0x2524('0x33')]=_[_0x2524('0x34')](_0x558283[_0x2524('0x30')],_0x558283[_0x2524('0x31')]);_0x3933fc['attributes']=_[_0x2524('0x34')](_0x558283[_0x2524('0x30')],qs[_0x2524('0x46')](_0x3925fe[_0x2524('0x31')][_0x2524('0x46')]));_0x3933fc[_0x2524('0x45')]=_0x3933fc[_0x2524('0x45')][_0x2524('0x47')]?_0x3933fc[_0x2524('0x45')]:_0x558283[_0x2524('0x30')];if(_0x3925fe['query']['includeAll']){_0x3933fc[_0x2524('0x53')]=[{'all':!![]}];}_0x3933fc=_['merge']({},_0x3933fc,_0x3925fe['options']);return db[_0x2524('0x2b')]['find'](_0x3933fc)[_0x2524('0x56')](handleEntityNotFound(_0x23d7b8,null))[_0x2524('0x56')](respondWithResult(_0x23d7b8,null))['catch'](handleError(_0x23d7b8,null));};exports[_0x2524('0x59')]=function(_0x35c864,_0x5bac9c){return db[_0x2524('0x2b')][_0x2524('0x59')](_0x35c864[_0x2524('0x5a')],{})[_0x2524('0x56')](respondWithResult(_0x5bac9c,0xc9))[_0x2524('0x5b')](handleError(_0x5bac9c,null));};exports['update']=function(_0x39d713,_0xdf3b73){if(_0x39d713[_0x2524('0x5a')]['id']){delete _0x39d713[_0x2524('0x5a')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x39d713['params']['id']}})[_0x2524('0x56')](handleEntityNotFound(_0xdf3b73,null))[_0x2524('0x56')](saveUpdates(_0x39d713['body'],null))[_0x2524('0x56')](respondWithResult(_0xdf3b73,null))[_0x2524('0x5b')](handleError(_0xdf3b73,null));};exports[_0x2524('0x5c')]=function(_0x7e82ab,_0x9c4b82){return db[_0x2524('0x2b')]['describe']()['then'](respondWithResult(_0x9c4b82,null))['catch'](handleError(_0x9c4b82,null));};exports[_0x2524('0x26')]=function(_0x469062,_0x4869a0){var _0x5b039a;return db[_0x2524('0x2b')][_0x2524('0x5d')]({'where':{'id':_0x469062[_0x2524('0x58')]['id']}})['then'](handleEntityNotFound(_0x4869a0,null))[_0x2524('0x56')](function(_0x4d21e0){if(_0x4d21e0){return _0x4d21e0[_0x2524('0x26')]()[_0x2524('0x56')](function(_0x4a3593){return _0x4a3593;});}})['then'](function(_0x48caef){_0x5b039a=_0x48caef;if(_0x48caef){if(_0x48caef[_0x2524('0x5e')]||_0x48caef[_0x2524('0x5f')]){return db[_0x48caef['VoiceQueueId']?_0x2524('0x60'):_0x2524('0x61')]['find']({'where':{'id':_0x48caef[_0x2524('0x5e')]?_0x48caef[_0x2524('0x5e')]:_0x48caef[_0x2524('0x5f')]},'attributes':['id','name'],'raw':!![]});}}})[_0x2524('0x56')](function(_0x2fb1ad){var _0xc45d1b={};if(_0x2fb1ad){_[_0x2524('0x4f')](_0xc45d1b,_[_0x2524('0x62')](_0x5b039a[_0x2524('0x63')],[_0x2524('0x64'),_0x2524('0x65'),'id']));_0xc45d1b['state']=0x15;_0xc45d1b[_0x2524('0x66')]=_0x2524('0x67');_0xc45d1b[_0x2524('0x68')]=_0x2fb1ad[_0x2524('0x28')];_0xc45d1b[_0x2524('0x69')]=_0x469062[_0x2524('0x6a')][_0x2524('0x28')];_0xc45d1b['UserId']=_0x469062['user']['id'];_0xc45d1b['deleted']=!![];_0xc45d1b[_0x2524('0x6b')]=moment()[_0x2524('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0xc45d1b[_0x2524('0x6d')]=_0x5b039a[_0x2524('0x6e')];_0xc45d1b[_0x2524('0x6f')]=_0x5b039a[_0x2524('0x5e')]?_0x2524('0x70'):'ivr';return db[_0x2524('0x71')][_0x2524('0x5d')]({'where':{'id':_0xc45d1b[_0x2524('0x72')]},'attributes':['firstName',_0x2524('0x73')]})['then'](function(_0x9278af){if(!_[_0x2524('0x74')](_0x4869a0)&&!_['isNil'](_0x9278af['firstName'])){_0xc45d1b[_0x2524('0x75')]=_0x9278af[_0x2524('0x76')];if(!_[_0x2524('0x74')](_0x9278af[_0x2524('0x73')])){_0xc45d1b[_0x2524('0x75')]+='\x20'+_0x9278af[_0x2524('0x73')];}}})[_0x2524('0x77')](function(){return db['CmHopperFinal'][_0x2524('0x59')](_0xc45d1b);});}})[_0x2524('0x56')](function(){return _0x4869a0[_0x2524('0x1b')](0xcc)['end']();})['catch'](handleError(_0x4869a0,null));};exports[_0x2524('0x78')]=function(_0x2d92e6,_0xbd1bdb,_0x47a728){var _0x202765=[];return db[_0x2524('0x71')][_0x2524('0x5c')]()[_0x2524('0x56')](function(_0x182f1c){_0x202765=_['keys'](_0x182f1c);return _0x2d92e6[_0x2524('0x6a')][_0x2524('0x79')]({'where':{'type':_0x2524('0x7a'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x2524('0x56')](function(_0x1cf9e5){if(_0x1cf9e5&&_0x1cf9e5[_0x2524('0x47')]){return db[_0x2524('0x7b')][_0x2524('0x7c')](function(_0x28dda1){var _0x1fa843={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2524('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x2524('0x2a')](_0x1cf9e5,'id')},'$or':[{'UserId':null},{'UserId':_0x2d92e6['user']['id']}]};var _0x1274ec=[];if(_0x2d92e6['body']['direction']&&_0x2d92e6[_0x2524('0x5a')][_0x2524('0x7d')]===_0x2524('0x7e')){if(!_['isEmpty'](_0x2d92e6['body'][_0x2524('0x7f')])){_0x1fa843['id']={'$in':_0x2d92e6[_0x2524('0x5a')]['hopperIds']};}_0x1274ec=[[_0x2524('0x80'),_0x2524('0x81')],[_0x2524('0x82'),_0x1cf9e5[0x0][_0x2524('0x83')]===_0x2524('0x81')?_0x2524('0x84'):'ASC'],db['sequelize'][_0x2524('0x85')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_[_0x2524('0x86')](_0x2d92e6[_0x2524('0x5a')][_0x2524('0x7f')])){_0x1fa843['id']={'$notIn':_0x2d92e6[_0x2524('0x5a')][_0x2524('0x7f')]};}_0x1274ec=[[_0x2524('0x80'),_0x2524('0x84')],['scheduledAt',_0x1cf9e5[0x0]['dialOrderByScheduledAt']],db[_0x2524('0x7b')]['literal'](_0x2524('0x87')),['id',_0x2524('0x81')]];}return db['CmHopper']['findOne']({'attributes':['id',_0x2524('0x88')],'where':_0x1fa843,'order':_0x1274ec,'transaction':_0x28dda1,'lock':_0x28dda1[_0x2524('0x89')][_0x2524('0x8a')],'include':[{'model':db[_0x2524('0x71')],'as':'Contact','attributes':_0x202765,'include':[{'model':db['CmCompany'],'as':_0x2524('0x8b'),'attributes':['id',_0x2524('0x28')]}]},{'model':db['CmList'],'as':_0x2524('0x8c'),'attributes':['id',_0x2524('0x28')]},{'model':db[_0x2524('0x60')],'as':_0x2524('0x8d'),'attributes':['id',_0x2524('0x28'),_0x2524('0x8e')]}]})[_0x2524('0x56')](function(_0x36ee25){if(_0x36ee25){return _0x36ee25[_0x2524('0x25')]({'UserId':_0x2d92e6['user']['id']},{'transaction':_0x28dda1});}});});}})[_0x2524('0x56')](handleEntityNotFound(_0xbd1bdb,null))[_0x2524('0x56')](respondWithResult(_0xbd1bdb,null))[_0x2524('0x5b')](handleError(_0xbd1bdb,null));};exports[_0x2524('0x8f')]=function(_0x2cbbbd,_0x45d4f4,_0x38137b){return _0x2cbbbd[_0x2524('0x6a')][_0x2524('0x79')]({'where':{'type':_0x2524('0x7a'),'dialActive':!![],'dialMethod':_0x2524('0x90')},'attributes':['id'],'raw':!![]})['then'](function(_0x3de296){if(_0x3de296&&_0x3de296[_0x2524('0x47')]){return db[_0x2524('0x2b')][_0x2524('0x1e')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x2524('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x3de296,'id')},'$or':[{'UserId':null},{'UserId':_0x2cbbbd[_0x2524('0x6a')]['id']}]}});}return 0x0;})['then'](function(_0x49b9de){if(!_[_0x2524('0x74')](_0x49b9de)&&_[_0x2524('0x91')](_0x49b9de)){return _0x45d4f4[_0x2524('0x1b')](0xc8)[_0x2524('0x1d')]({'contacts':_0x49b9de});}else{logger[_0x2524('0x92')](_0x2524('0x93'),_0x2524('0x8f'),0x194,'entity\x20not\x20found');_0x45d4f4['sendStatus'](0x194);}})['catch'](handleError(_0x45d4f4,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index e2a2069..ae91669 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 _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 +var _0xaf37=['api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util'];(function(_0x1d5a02,_0xfcbb92){var _0x1dac7c=function(_0x56597b){while(--_0x56597b){_0x1d5a02['push'](_0x1d5a02['shift']());}};_0x1dac7c(++_0xfcbb92);}(_0xaf37,0x15e));var _0x7af3=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xaf37[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0x7af3('0x0'));var util=require(_0x7af3('0x1'));var logger=require('../../config/logger')(_0x7af3('0x2'));var moment=require(_0x7af3('0x3'));var BPromise=require(_0x7af3('0x4'));var rp=require(_0x7af3('0x5'));var fs=require('fs');var path=require(_0x7af3('0x6'));var rimraf=require(_0x7af3('0x7'));var config=require('../../config/environment');var attributes=require(_0x7af3('0x8'));module[_0x7af3('0x9')]=function(_0x313b05,_0x37a77e){return _0x313b05[_0x7af3('0xa')](_0x7af3('0xb'),attributes,{'tableName':_0x7af3('0xc'),'paranoid':![],'indexes':[{'name':_0x7af3('0xd'),'fields':[_0x7af3('0xd')]},{'name':_0x7af3('0xe'),'fields':[_0x7af3('0xe')]},{'name':_0x7af3('0xf'),'fields':[_0x7af3('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 206647b..0dcc534 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 _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 +var _0xaa19=['CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','CmContact','describe','findAll','order','LOCK','Contact','User','name','length','includes','UserId','push','all','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','update','GetCmHopperPreview','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCmHopper','CmHopper','options','attributes','limit','include','map','model','ShowCmHopper','raw','where'];(function(_0x150c2c,_0x1d9acc){var _0x3b9074=function(_0x1f5050){while(--_0x1f5050){_0x150c2c['push'](_0x150c2c['shift']());}};_0x3b9074(++_0x1d9acc);}(_0xaa19,0xe8));var _0x9aa1=function(_0x119e62,_0x5bb1a2){_0x119e62=_0x119e62-0x0;var _0x380f2=_0xaa19[_0x119e62];return _0x380f2;};'use strict';var _=require(_0x9aa1('0x0'));var util=require(_0x9aa1('0x1'));var moment=require('moment');var BPromise=require(_0x9aa1('0x2'));var rs=require(_0x9aa1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9aa1('0x4'));var logger=require(_0x9aa1('0x5'))(_0x9aa1('0x6'));var config=require(_0x9aa1('0x7'));var jayson=require(_0x9aa1('0x8'));var client=jayson['client'][_0x9aa1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59f2f3,_0x178a62,_0x3d7e6a){return new BPromise(function(_0x270878,_0x424726){return client['request'](_0x59f2f3,_0x3d7e6a)[_0x9aa1('0xa')](function(_0x2e2c71){logger[_0x9aa1('0xb')](_0x9aa1('0xc'),_0x178a62,_0x9aa1('0xd'));logger[_0x9aa1('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x178a62,'request\x20sent',JSON[_0x9aa1('0xf')](_0x2e2c71));if(_0x2e2c71[_0x9aa1('0x10')]){if(_0x2e2c71[_0x9aa1('0x10')][_0x9aa1('0x11')]===0x1f4){logger[_0x9aa1('0x10')](_0x9aa1('0xc'),_0x178a62,_0x2e2c71['error'][_0x9aa1('0x12')]);return _0x424726(_0x2e2c71[_0x9aa1('0x10')][_0x9aa1('0x12')]);}logger[_0x9aa1('0x10')](_0x9aa1('0xc'),_0x178a62,_0x2e2c71['error'][_0x9aa1('0x12')]);return _0x270878(_0x2e2c71[_0x9aa1('0x10')][_0x9aa1('0x12')]);}else{logger['info'](_0x9aa1('0xc'),_0x178a62,_0x9aa1('0xd'));_0x270878(_0x2e2c71[_0x9aa1('0x13')][_0x9aa1('0x12')]);}})[_0x9aa1('0x14')](function(_0x34fb7e){logger[_0x9aa1('0x10')](_0x9aa1('0xc'),_0x178a62,_0x34fb7e);_0x424726(_0x34fb7e);});});}exports[_0x9aa1('0x15')]=function(_0x3493ce){var _0x66073a=this;return new Promise(function(_0x2dddb9,_0x12f40f){return db[_0x9aa1('0x16')]['findAll']({'raw':_0x3493ce[_0x9aa1('0x17')]?_0x3493ce[_0x9aa1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3493ce['options']?_0x3493ce[_0x9aa1('0x17')]['where']||null:null,'attributes':_0x3493ce[_0x9aa1('0x17')]?_0x3493ce[_0x9aa1('0x17')][_0x9aa1('0x18')]||null:null,'limit':_0x3493ce[_0x9aa1('0x17')]?_0x3493ce[_0x9aa1('0x17')][_0x9aa1('0x19')]||null:null,'include':_0x3493ce[_0x9aa1('0x17')]?_0x3493ce[_0x9aa1('0x17')][_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x3493ce['options'][_0x9aa1('0x1a')],function(_0x4db805){return{'model':db[_0x4db805[_0x9aa1('0x1c')]],'as':_0x4db805['as'],'attributes':_0x4db805[_0x9aa1('0x18')],'include':_0x4db805[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x4db805[_0x9aa1('0x1a')],function(_0x6c952a){return{'model':db[_0x6c952a[_0x9aa1('0x1c')]],'as':_0x6c952a['as'],'attributes':_0x6c952a['attributes'],'include':_0x6c952a[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x6c952a[_0x9aa1('0x1a')],function(_0x595619){return{'model':db[_0x595619['model']],'as':_0x595619['as'],'attributes':_0x595619[_0x9aa1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9aa1('0xa')](function(_0x20025c){logger['info'](_0x9aa1('0x15'),_0x3493ce);logger[_0x9aa1('0xe')](_0x9aa1('0x15'),_0x3493ce,JSON[_0x9aa1('0xf')](_0x20025c));_0x2dddb9(_0x20025c);})[_0x9aa1('0x14')](function(_0x31a5aa){logger[_0x9aa1('0x10')]('GetCmHopper',_0x31a5aa[_0x9aa1('0x12')],_0x3493ce);_0x12f40f(_0x66073a[_0x9aa1('0x10')](0x1f4,_0x31a5aa['message']));});});};exports[_0x9aa1('0x1d')]=function(_0x50a6c4){var _0x370912=this;return new Promise(function(_0x25eb49,_0x2a0f29){return db[_0x9aa1('0x16')]['find']({'raw':_0x50a6c4[_0x9aa1('0x17')]?_0x50a6c4[_0x9aa1('0x17')][_0x9aa1('0x1e')]===undefined?!![]:![]:!![],'where':_0x50a6c4[_0x9aa1('0x17')]?_0x50a6c4[_0x9aa1('0x17')][_0x9aa1('0x1f')]||null:null,'attributes':_0x50a6c4['options']?_0x50a6c4[_0x9aa1('0x17')]['attributes']||null:null,'include':_0x50a6c4[_0x9aa1('0x17')]?_0x50a6c4[_0x9aa1('0x17')][_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x50a6c4[_0x9aa1('0x17')][_0x9aa1('0x1a')],function(_0x4d8354){return{'model':db[_0x4d8354[_0x9aa1('0x1c')]],'as':_0x4d8354['as'],'attributes':_0x4d8354[_0x9aa1('0x18')],'include':_0x4d8354[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x4d8354['include'],function(_0x26b52b){return{'model':db[_0x26b52b['model']],'as':_0x26b52b['as'],'attributes':_0x26b52b[_0x9aa1('0x18')],'include':_0x26b52b[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x26b52b[_0x9aa1('0x1a')],function(_0x1f1f59){return{'model':db[_0x1f1f59[_0x9aa1('0x1c')]],'as':_0x1f1f59['as'],'attributes':_0x1f1f59['attributes']};}):[]};}):[]};}):[]:[]})[_0x9aa1('0xa')](function(_0x55d199){logger[_0x9aa1('0xb')](_0x9aa1('0x1d'),_0x50a6c4);logger['debug']('ShowCmHopper',_0x50a6c4,JSON[_0x9aa1('0xf')](_0x55d199));_0x25eb49(_0x55d199);})[_0x9aa1('0x14')](function(_0x191460){logger[_0x9aa1('0x10')](_0x9aa1('0x1d'),_0x191460[_0x9aa1('0x12')],_0x50a6c4);_0x2a0f29(_0x370912[_0x9aa1('0x10')](0x1f4,_0x191460['message']));});});};exports[_0x9aa1('0x20')]=function(_0x42c64d){var _0x70f45a=this;return new Promise(function(_0x280e84,_0x24ea77){return db[_0x9aa1('0x16')][_0x9aa1('0x21')](_0x42c64d[_0x9aa1('0x22')],{'raw':_0x42c64d[_0x9aa1('0x17')]?_0x42c64d[_0x9aa1('0x17')][_0x9aa1('0x1e')]===undefined?!![]:![]:!![]})[_0x9aa1('0xa')](function(_0xf4c767){logger[_0x9aa1('0xb')](_0x9aa1('0x20'),_0x42c64d);logger['debug'](_0x9aa1('0x20'),_0x42c64d,JSON[_0x9aa1('0xf')](_0xf4c767));_0x280e84(_0xf4c767);})['catch'](function(_0xcab6ab){logger[_0x9aa1('0x10')](_0x9aa1('0x20'),_0xcab6ab['message'],_0x42c64d);_0x24ea77(_0x70f45a[_0x9aa1('0x10')](0x1f4,_0xcab6ab[_0x9aa1('0x12')]));});});};exports[_0x9aa1('0x23')]=function(_0x580e08){var _0x510613=this;return new Promise(function(_0x5a2650,_0x43fe4c){return db[_0x9aa1('0x16')]['update'](_0x580e08['body'],{'raw':_0x580e08[_0x9aa1('0x17')]?_0x580e08[_0x9aa1('0x17')][_0x9aa1('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580e08[_0x9aa1('0x17')]?_0x580e08[_0x9aa1('0x17')][_0x9aa1('0x1f')]||null:null,'attributes':_0x580e08[_0x9aa1('0x17')]?_0x580e08[_0x9aa1('0x17')]['attributes']||null:null,'limit':_0x580e08[_0x9aa1('0x17')]?_0x580e08[_0x9aa1('0x17')][_0x9aa1('0x19')]||null:null})[_0x9aa1('0xa')](function(_0xb6c90d){logger['info'](_0x9aa1('0x23'),_0x580e08);logger['debug'](_0x9aa1('0x23'),_0x580e08,JSON[_0x9aa1('0xf')](_0xb6c90d));_0x5a2650(_0xb6c90d);})['catch'](function(_0x53fd1d){logger[_0x9aa1('0x10')]('UpdateCmHopper',_0x53fd1d[_0x9aa1('0x12')],_0x580e08);_0x43fe4c(_0x510613[_0x9aa1('0x10')](0x1f4,_0x53fd1d[_0x9aa1('0x12')]));});});};exports['DestroyCmHopper']=function(_0x49da7b){var _0x30cb8a=this;return new Promise(function(_0x55883e,_0x166aac){return db[_0x9aa1('0x16')]['destroy']({'where':_0x49da7b['options']?_0x49da7b[_0x9aa1('0x17')]['where']||null:null})[_0x9aa1('0xa')](function(_0x1aabfb){logger[_0x9aa1('0xb')](_0x9aa1('0x24'),_0x49da7b);logger[_0x9aa1('0xe')](_0x9aa1('0x24'),_0x49da7b,JSON[_0x9aa1('0xf')](_0x1aabfb));_0x55883e(_0x1aabfb);})[_0x9aa1('0x14')](function(_0xfe2c2e){logger[_0x9aa1('0x10')](_0x9aa1('0x24'),_0xfe2c2e[_0x9aa1('0x12')],_0x49da7b);_0x166aac(_0x30cb8a[_0x9aa1('0x10')](0x1f4,_0xfe2c2e['message']));});});};exports['GetContactDialer']=function(_0x367a08){var _0x58f1b1=this;return new Promise(function(_0x538106,_0x1b9b3b){return db[_0x9aa1('0x25')][_0x9aa1('0x26')]()[_0x9aa1('0xa')](function(_0x113d89){return db['sequelize']['transaction'](function(_0x508c34){return db['CmHopper'][_0x9aa1('0x27')]({'where':_0x367a08[_0x9aa1('0x17')]?_0x367a08[_0x9aa1('0x17')]['where']||null:null,'attributes':_0x367a08[_0x9aa1('0x17')]?_0x367a08[_0x9aa1('0x17')]['attributes']||null:null,'limit':_0x367a08[_0x9aa1('0x17')]?_0x367a08[_0x9aa1('0x17')][_0x9aa1('0x19')]||null:null,'order':_0x367a08[_0x9aa1('0x17')]?_0x367a08[_0x9aa1('0x17')][_0x9aa1('0x28')]||null:null,'transaction':_0x508c34,'lock':_0x508c34[_0x9aa1('0x29')]['UPDATE'],'include':[{'model':db[_0x9aa1('0x25')],'as':_0x9aa1('0x2a'),'attributes':_['keys'](_0x113d89)},{'model':db[_0x9aa1('0x2b')],'as':'Agent','attributes':['id',_0x9aa1('0x2c'),'voicePause']}]})[_0x9aa1('0xa')](function(_0x1398ff){var _0x10d32c=[];var _0x571230=[];for(var _0x48c627=0x0;_0x48c627<_0x1398ff[_0x9aa1('0x2d')];_0x48c627+=0x1){if(!_0x571230[_0x9aa1('0x2e')](_0x1398ff[_0x48c627][_0x9aa1('0x2f')])){_0x571230['push'](_0x1398ff[_0x48c627]['UserId']);_0x10d32c[_0x9aa1('0x30')](_0x1398ff[_0x48c627]['update'](_0x367a08['body'],{'transaction':_0x508c34}));}}return BPromise[_0x9aa1('0x31')](_0x10d32c);});})[_0x9aa1('0xa')](function(_0x3161d0){logger[_0x9aa1('0xb')](_0x9aa1('0x32'),_0x367a08);logger[_0x9aa1('0xe')](_0x9aa1('0x32'),_0x367a08,JSON[_0x9aa1('0xf')](_0x3161d0));_0x538106(_0x3161d0);})[_0x9aa1('0x14')](function(_0x5b5cb0){logger[_0x9aa1('0x10')](_0x9aa1('0x32'),_0x5b5cb0[_0x9aa1('0x12')],_0x367a08);_0x1b9b3b(_0x58f1b1['error'](0x1f4,_0x5b5cb0['message']));});});});};exports[_0x9aa1('0x33')]=function(_0x1ec55f){var _0x3caa98=this;return new Promise(function(_0xebf545,_0x284438){return db[_0x9aa1('0x34')]['transaction'](function(_0x4b7cb1){return db[_0x9aa1('0x35')][_0x9aa1('0x21')](_0x1ec55f['body'],{'raw':_0x1ec55f[_0x9aa1('0x17')]?_0x1ec55f[_0x9aa1('0x17')][_0x9aa1('0x1e')]===undefined?!![]:![]:!![],'transaction':_0x4b7cb1})[_0x9aa1('0xa')](function(){return db[_0x9aa1('0x16')]['destroy']({'where':_0x1ec55f[_0x9aa1('0x17')]?_0x1ec55f[_0x9aa1('0x17')][_0x9aa1('0x1f')]||null:null,'transaction':_0x4b7cb1});});})[_0x9aa1('0xa')](function(_0x2fc0b2){logger[_0x9aa1('0xb')](_0x9aa1('0x33'),_0x1ec55f);logger[_0x9aa1('0xe')](_0x9aa1('0x33'),_0x1ec55f,JSON['stringify'](_0x2fc0b2));_0xebf545(_0x2fc0b2);})[_0x9aa1('0x14')](function(_0x62b7b4){logger[_0x9aa1('0x10')](_0x9aa1('0x33'),_0x62b7b4[_0x9aa1('0x12')],_0x1ec55f);_0x284438(_0x3caa98['error'](0x1f4,_0x62b7b4['message']));});});};exports[_0x9aa1('0x36')]=function(_0x13fe7e){var _0x452ffb=this;return new Promise(function(_0x21db3f,_0x36ea13){return db[_0x9aa1('0x16')]['findAll']({'raw':_0x13fe7e[_0x9aa1('0x17')]?_0x13fe7e[_0x9aa1('0x17')][_0x9aa1('0x1e')]===undefined?!![]:![]:!![],'where':_0x13fe7e['options']?_0x13fe7e[_0x9aa1('0x17')][_0x9aa1('0x1f')]||null:null,'attributes':[[db[_0x9aa1('0x34')]['fn'](_0x9aa1('0x37'),db[_0x9aa1('0x34')]['fn']('IF',db[_0x9aa1('0x34')][_0x9aa1('0x38')](_0x9aa1('0x39')+util['format']('\x22%s\x22',moment()[_0x9aa1('0x3a')](_0x9aa1('0x3b')))+_0x9aa1('0x3c')))),_0x9aa1('0x3d')]]})[_0x9aa1('0xa')](function(_0x160c7d){logger['info'](_0x9aa1('0x36'),_0x13fe7e);logger[_0x9aa1('0xe')](_0x9aa1('0x36'),_0x13fe7e,JSON['stringify'](_0x160c7d));_0x21db3f(_0x160c7d);})[_0x9aa1('0x14')](function(_0x2d6cff){logger[_0x9aa1('0x10')](_0x9aa1('0x36'),_0x2d6cff['message'],_0x13fe7e);_0x36ea13(_0x452ffb[_0x9aa1('0x10')](0x1f4,_0x2d6cff[_0x9aa1('0x12')]));});});};exports[_0x9aa1('0x3e')]=function(_0x32141a){var _0x3d8390=this;return new Promise(function(_0x1f4a8c,_0x3339d0){return db[_0x9aa1('0x25')][_0x9aa1('0x26')]()[_0x9aa1('0xa')](function(_0x26ed62){return db[_0x9aa1('0x34')]['transaction'](function(_0x147da5){return db[_0x9aa1('0x16')][_0x9aa1('0x27')]({'where':_0x32141a[_0x9aa1('0x17')]?_0x32141a[_0x9aa1('0x17')][_0x9aa1('0x1f')]||null:null,'attributes':_0x32141a[_0x9aa1('0x17')]?_0x32141a[_0x9aa1('0x17')]['attributes']||null:null,'limit':0x1,'order':_0x32141a[_0x9aa1('0x17')]?_0x32141a[_0x9aa1('0x17')]['order']||null:null,'group':db[_0x9aa1('0x16')]['UserId'],'transaction':_0x147da5,'lock':_0x147da5['LOCK'][_0x9aa1('0x3f')],'include':_0x32141a[_0x9aa1('0x17')]?_0x32141a[_0x9aa1('0x17')][_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x32141a['options']['include'],function(_0x2995bc){return{'model':db[_0x2995bc[_0x9aa1('0x1c')]],'as':_0x2995bc['as'],'attributes':_0x2995bc['attributes'],'include':_0x2995bc[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x2995bc[_0x9aa1('0x1a')],function(_0x30628c){return{'model':db[_0x30628c[_0x9aa1('0x1c')]],'as':_0x30628c['as'],'attributes':_0x30628c[_0x9aa1('0x18')],'include':_0x30628c[_0x9aa1('0x1a')]?_['map'](_0x30628c[_0x9aa1('0x1a')],function(_0x1e796b){return{'model':db[_0x1e796b[_0x9aa1('0x1c')]],'as':_0x1e796b['as'],'attributes':_0x1e796b[_0x9aa1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9aa1('0xa')](function(_0x527939){var _0x147f20=[];for(var _0x36b718=0x0;_0x36b718<_0x527939[_0x9aa1('0x2d')];_0x36b718+=0x1){_0x147f20['push'](_0x527939[_0x36b718][_0x9aa1('0x40')](_0x32141a[_0x9aa1('0x22')],{'transaction':_0x147da5}));}return BPromise[_0x9aa1('0x31')](_0x147f20);});})[_0x9aa1('0xa')](function(_0x4d7cf5){logger[_0x9aa1('0xb')]('GetContactRecallMe',_0x32141a);logger[_0x9aa1('0xe')](_0x9aa1('0x3e'),_0x32141a,JSON[_0x9aa1('0xf')](_0x4d7cf5));_0x1f4a8c(_0x4d7cf5);})[_0x9aa1('0x14')](function(_0x8f20d6){logger[_0x9aa1('0x10')](_0x9aa1('0x3e'),_0x8f20d6[_0x9aa1('0x12')],_0x32141a);_0x3339d0(_0x3d8390[_0x9aa1('0x10')](0x1f4,_0x8f20d6[_0x9aa1('0x12')]));});});});};exports[_0x9aa1('0x41')]=function(_0x184fc0){var _0x10f39d=this;return new Promise(function(_0x43e5c3,_0x2b2995){db[_0x9aa1('0x25')][_0x9aa1('0x26')]()['then'](function(_0x5a5f15){return db[_0x9aa1('0x16')][_0x9aa1('0x27')]({'raw':_0x184fc0[_0x9aa1('0x17')]?_0x184fc0['options']['raw']===undefined?!![]:![]:!![],'where':_0x184fc0[_0x9aa1('0x17')]?_0x184fc0['options'][_0x9aa1('0x1f')]||null:null,'attributes':_0x184fc0['options']?_0x184fc0[_0x9aa1('0x17')][_0x9aa1('0x18')]||null:null,'limit':_0x184fc0[_0x9aa1('0x17')]?_0x184fc0[_0x9aa1('0x17')][_0x9aa1('0x19')]||null:null,'include':_0x184fc0[_0x9aa1('0x17')]?_0x184fc0[_0x9aa1('0x17')][_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x184fc0['options'][_0x9aa1('0x1a')],function(_0x1aa94e){return{'model':db[_0x1aa94e[_0x9aa1('0x1c')]],'as':_0x1aa94e['as'],'attributes':_0x1aa94e['as']==='Contact'?_['keys'](_0x5a5f15):_0x1aa94e[_0x9aa1('0x18')],'include':_0x1aa94e[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x1aa94e['include'],function(_0x18ca97){return{'model':db[_0x18ca97[_0x9aa1('0x1c')]],'as':_0x18ca97['as'],'attributes':_0x18ca97[_0x9aa1('0x18')],'include':_0x18ca97[_0x9aa1('0x1a')]?_[_0x9aa1('0x1b')](_0x18ca97[_0x9aa1('0x1a')],function(_0x5c08ba){return{'model':db[_0x5c08ba[_0x9aa1('0x1c')]],'as':_0x5c08ba['as'],'attributes':_0x5c08ba[_0x9aa1('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x517403){logger['info'](_0x9aa1('0x15'),_0x184fc0);logger['debug'](_0x9aa1('0x15'),_0x184fc0,JSON['stringify'](_0x517403));_0x43e5c3(_0x517403);})[_0x9aa1('0x14')](function(_0x41a361){logger[_0x9aa1('0x10')](_0x9aa1('0x15'),_0x41a361[_0x9aa1('0x12')],_0x184fc0);_0x2b2995(_0x10f39d[_0x9aa1('0x10')](0x1f4,_0x41a361[_0x9aa1('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 62dfaef..c7be116 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 _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 +var _0xa848=['show','post','create','/preview','getPreview','put','/:id','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts'];(function(_0x55c76f,_0x13b7f4){var _0x1571ff=function(_0x4082ce){while(--_0x4082ce){_0x55c76f['push'](_0x55c76f['shift']());}};_0x1571ff(++_0x13b7f4);}(_0xa848,0x99));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var path=require(_0x8a84('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a84('0x3'));var router=express[_0x8a84('0x4')]();var auth=require(_0x8a84('0x5'));var interaction=require(_0x8a84('0x6'));var config=require(_0x8a84('0x7'));var controller=require(_0x8a84('0x8'));router[_0x8a84('0x9')]('/',auth[_0x8a84('0xa')](),controller[_0x8a84('0xb')]);router[_0x8a84('0x9')](_0x8a84('0xc'),auth[_0x8a84('0xa')](),controller[_0x8a84('0xd')]);router[_0x8a84('0x9')]('/opencontacts',auth[_0x8a84('0xa')](),controller[_0x8a84('0xe')]);router[_0x8a84('0x9')]('/:id',auth[_0x8a84('0xa')](),controller[_0x8a84('0xf')]);router[_0x8a84('0x10')]('/',auth[_0x8a84('0xa')](),controller[_0x8a84('0x11')]);router[_0x8a84('0x10')](_0x8a84('0x12'),auth[_0x8a84('0xa')](),controller[_0x8a84('0x13')]);router[_0x8a84('0x14')](_0x8a84('0x15'),auth[_0x8a84('0xa')](),controller['update']);router[_0x8a84('0x16')](_0x8a84('0x15'),auth[_0x8a84('0xa')](),controller['destroy']);module[_0x8a84('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 37cba8b..502dad7 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 _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 +var _0x1232=['exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x41f0e4,_0x190909){var _0x45417c=function(_0x29f6f1){while(--_0x29f6f1){_0x41f0e4['push'](_0x41f0e4['shift']());}};_0x45417c(++_0x190909);}(_0x1232,0x1b6));var _0x2123=function(_0x1c636a,_0x120b37){_0x1c636a=_0x1c636a-0x0;var _0x422d8c=_0x1232[_0x1c636a];return _0x422d8c;};'use strict';var moment=require(_0x2123('0x0'));var Sequelize=require(_0x2123('0x1'));module[_0x2123('0x2')]={'CmHopperId':{'type':Sequelize[_0x2123('0x3')]},'phone':{'type':Sequelize[_0x2123('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2123('0x5')],'defaultValue':moment()[_0x2123('0x6')](_0x2123('0x7'))},'countbusyretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2123('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x2123('0x3')],'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 693d962..a365102 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 _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 +var _0xd663=['fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xd663,0x1ed));var _0x3d66=function(_0x4c1c29,_0x20c344){_0x4c1c29=_0x4c1c29-0x0;var _0x3b57f9=_0xd663[_0x4c1c29];return _0x3b57f9;};'use strict';var pdf=require(_0x3d66('0x0'));var emlformat=require(_0x3d66('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3d66('0x2'));var jsonpatch=require(_0x3d66('0x3'));var rp=require(_0x3d66('0x4'));var moment=require(_0x3d66('0x5'));var BPromise=require(_0x3d66('0x6'));var Mustache=require('mustache');var util=require(_0x3d66('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3d66('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3d66('0x9'));var deskjs=require(_0x3d66('0xa'));var toCsv=require(_0x3d66('0xb'));var querystring=require(_0x3d66('0xc'));var Papa=require(_0x3d66('0xd'));var Redis=require(_0x3d66('0xe'));var authService=require(_0x3d66('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3d66('0x10'));var hardwareService=require(_0x3d66('0x11'));var logger=require(_0x3d66('0x12'))('api');var utils=require(_0x3d66('0x13'));var config=require(_0x3d66('0x14'));var licenseUtil=require(_0x3d66('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207712,_0x223de6){_0x223de6=_0x223de6||0xcc;return function(_0x288693){if(_0x288693){return _0x207712[_0x3d66('0x16')](_0x223de6);}return _0x207712['status'](_0x223de6)[_0x3d66('0x17')]();};}function respondWithResult(_0x5a940c,_0x15bba0){_0x15bba0=_0x15bba0||0xc8;return function(_0x290f29){if(_0x290f29){return _0x5a940c[_0x3d66('0x18')](_0x15bba0)[_0x3d66('0x19')](_0x290f29);}};}function respondWithFilteredResult(_0x30260d,_0x153b88){return function(_0x5628ae){if(_0x5628ae){var _0x5eba7e=_0x5628ae[_0x3d66('0x1a')],_0xe5bf8f=_0x153b88[_0x3d66('0x1b')],_0x4651b8=_0x153b88[_0x3d66('0x1b')]+_0x153b88[_0x3d66('0x1c')],_0x4bd10f;if(_0x4651b8>=_0x5eba7e){_0x4651b8=_0x5eba7e;_0x4bd10f=0xc8;}else{_0x4bd10f=0xce;}_0x30260d[_0x3d66('0x18')](_0x4bd10f);return _0x30260d[_0x3d66('0x1d')](_0x3d66('0x1e'),_0xe5bf8f+'-'+_0x4651b8+'/'+_0x5eba7e)[_0x3d66('0x19')](_0x5628ae);}return null;};}function patchUpdates(_0x1accfb){return function(_0x3902f1){try{jsonpatch[_0x3d66('0x1f')](_0x3902f1,_0x1accfb,!![]);}catch(_0x353c5f){return BPromise[_0x3d66('0x20')](_0x353c5f);}return _0x3902f1[_0x3d66('0x21')]();};}function saveUpdates(_0x21cfd7,_0x4c61ee){return function(_0xac3d17){if(_0xac3d17){return _0xac3d17['update'](_0x21cfd7)[_0x3d66('0x22')](function(_0x26b404){return _0x26b404;});}return null;};}function removeEntity(_0x4486f5,_0x37ed73){return function(_0x11be7f){if(_0x11be7f){return _0x11be7f[_0x3d66('0x23')]()[_0x3d66('0x22')](function(){var _0x1bfa81=_0x11be7f[_0x3d66('0x24')]({'plain':!![]});var _0x4e2c42=_0x3d66('0x25');return db[_0x3d66('0x26')][_0x3d66('0x23')]({'where':{'type':_0x4e2c42,'resourceId':_0x1bfa81['id']}})[_0x3d66('0x22')](function(){return _0x11be7f;});})['then'](function(){_0x4486f5[_0x3d66('0x18')](0xcc)[_0x3d66('0x17')]();});}};}function handleEntityNotFound(_0x4302ad,_0x29819d){return function(_0x4f0d9e){if(!_0x4f0d9e){_0x4302ad[_0x3d66('0x16')](0x194);}return _0x4f0d9e;};}function handleError(_0x3e6712,_0x402a18){_0x402a18=_0x402a18||0x1f4;return function(_0x7350d8){logger[_0x3d66('0x27')](_0x7350d8[_0x3d66('0x28')]);if(_0x7350d8[_0x3d66('0x29')]){delete _0x7350d8[_0x3d66('0x29')];}_0x3e6712[_0x3d66('0x18')](_0x402a18)[_0x3d66('0x2a')](_0x7350d8);};}exports['index']=function(_0x28466b,_0x1dff3b){var _0x197c5e={},_0xc128a7={},_0x2b837c={'count':0x0,'rows':[]};var _0x41bf36=_[_0x3d66('0x2b')](db[_0x3d66('0x2c')][_0x3d66('0x2d')],function(_0xab45d5){return{'name':_0xab45d5[_0x3d66('0x2e')],'type':_0xab45d5['type']['key']};});_0xc128a7[_0x3d66('0x2f')]=_[_0x3d66('0x2b')](_0x41bf36,_0x3d66('0x29'));_0xc128a7[_0x3d66('0x30')]=_[_0x3d66('0x31')](_0x28466b[_0x3d66('0x30')]);_0xc128a7[_0x3d66('0x32')]=_[_0x3d66('0x33')](_0xc128a7[_0x3d66('0x2f')],_0xc128a7[_0x3d66('0x30')]);_0x197c5e[_0x3d66('0x34')]=_[_0x3d66('0x33')](_0xc128a7[_0x3d66('0x2f')],qs[_0x3d66('0x35')](_0x28466b[_0x3d66('0x30')][_0x3d66('0x35')]));_0x197c5e[_0x3d66('0x34')]=_0x197c5e[_0x3d66('0x34')][_0x3d66('0x36')]?_0x197c5e[_0x3d66('0x34')]:_0xc128a7[_0x3d66('0x2f')];if(!_0x28466b[_0x3d66('0x30')][_0x3d66('0x37')]('nolimit')){_0x197c5e[_0x3d66('0x1c')]=qs[_0x3d66('0x1c')](_0x28466b[_0x3d66('0x30')]['limit']);_0x197c5e[_0x3d66('0x1b')]=qs['offset'](_0x28466b[_0x3d66('0x30')][_0x3d66('0x1b')]);}_0x197c5e['order']=qs[_0x3d66('0x38')](_0x28466b[_0x3d66('0x30')]['sort']);_0x197c5e[_0x3d66('0x39')]=qs[_0x3d66('0x32')](_['pick'](_0x28466b[_0x3d66('0x30')],_0xc128a7[_0x3d66('0x32')]),_0x41bf36);if(_0x28466b[_0x3d66('0x30')][_0x3d66('0x3a')]){_0x197c5e['where']=_[_0x3d66('0x3b')](_0x197c5e['where'],{'$or':_[_0x3d66('0x2b')](_0x41bf36,function(_0x533f23){if(_0x533f23[_0x3d66('0x3c')]!==_0x3d66('0x3d')){var _0x2f89b4={};_0x2f89b4[_0x533f23['name']]={'$like':'%'+_0x28466b[_0x3d66('0x30')][_0x3d66('0x3a')]+'%'};return _0x2f89b4;}})});}_0x197c5e=_[_0x3d66('0x3b')]({},_0x197c5e,_0x28466b[_0x3d66('0x3e')]);var _0x122cd4={'where':_0x197c5e[_0x3d66('0x39')]};return db[_0x3d66('0x2c')][_0x3d66('0x1a')](_0x122cd4)[_0x3d66('0x22')](function(_0xa1a5f2){_0x2b837c[_0x3d66('0x1a')]=_0xa1a5f2;if(_0x28466b[_0x3d66('0x30')][_0x3d66('0x3f')]){_0x197c5e['include']=[{'all':!![]}];}return db[_0x3d66('0x2c')][_0x3d66('0x40')](_0x197c5e);})[_0x3d66('0x22')](function(_0x4c980e){_0x2b837c['rows']=_0x4c980e;return _0x2b837c;})[_0x3d66('0x22')](respondWithFilteredResult(_0x1dff3b,_0x197c5e))[_0x3d66('0x41')](handleError(_0x1dff3b,null));};exports[_0x3d66('0x42')]=function(_0x26350b,_0x283395){var _0x37ac25={'raw':!![],'where':{'id':_0x26350b[_0x3d66('0x43')]['id']}},_0x389691={};_0x389691['model']=_[_0x3d66('0x31')](db[_0x3d66('0x2c')][_0x3d66('0x2d')]);_0x389691['query']=_['keys'](_0x26350b[_0x3d66('0x30')]);_0x389691[_0x3d66('0x32')]=_[_0x3d66('0x33')](_0x389691[_0x3d66('0x2f')],_0x389691[_0x3d66('0x30')]);_0x37ac25[_0x3d66('0x34')]=_[_0x3d66('0x33')](_0x389691[_0x3d66('0x2f')],qs['fields'](_0x26350b[_0x3d66('0x30')]['fields']));_0x37ac25[_0x3d66('0x34')]=_0x37ac25[_0x3d66('0x34')][_0x3d66('0x36')]?_0x37ac25['attributes']:_0x389691[_0x3d66('0x2f')];if(_0x26350b[_0x3d66('0x30')][_0x3d66('0x3f')]){_0x37ac25[_0x3d66('0x44')]=[{'all':!![]}];}_0x37ac25=_['merge']({},_0x37ac25,_0x26350b['options']);return db[_0x3d66('0x2c')]['find'](_0x37ac25)['then'](handleEntityNotFound(_0x283395,null))[_0x3d66('0x22')](respondWithResult(_0x283395,null))[_0x3d66('0x41')](handleError(_0x283395,null));};exports[_0x3d66('0x45')]=function(_0xa576e2,_0x1636f6){return db[_0x3d66('0x2c')][_0x3d66('0x45')](_0xa576e2['body'],{})[_0x3d66('0x22')](function(_0x2e05ce){var _0x22c447=_0xa576e2[_0x3d66('0x46')][_0x3d66('0x24')]({'plain':!![]});if(!_0x22c447)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22c447[_0x3d66('0x47')]===_0x3d66('0x46')){var _0xa67d58=_0x2e05ce[_0x3d66('0x24')]({'plain':!![]});var _0x4425ae=_0x3d66('0x25');return db[_0x3d66('0x48')]['find']({'where':{'name':_0x4425ae,'userProfileId':_0x22c447['userProfileId']},'raw':!![]})['then'](function(_0x3d2fed){if(_0x3d2fed&&_0x3d2fed[_0x3d66('0x49')]===0x0){return db['UserProfileResource'][_0x3d66('0x45')]({'name':_0xa67d58[_0x3d66('0x29')],'resourceId':_0xa67d58['id'],'type':_0x3d2fed[_0x3d66('0x29')],'sectionId':_0x3d2fed['id']},{})[_0x3d66('0x22')](function(){return _0x2e05ce;});}else{return _0x2e05ce;}})[_0x3d66('0x41')](function(_0x3c1b6d){logger[_0x3d66('0x27')](_0x3d66('0x4a'),_0x3c1b6d);throw _0x3c1b6d;});}return _0x2e05ce;})[_0x3d66('0x22')](respondWithResult(_0x1636f6,0xc9))['catch'](handleError(_0x1636f6,null));};exports['update']=function(_0x2012e2,_0x4ea803){if(_0x2012e2['body']['id']){delete _0x2012e2[_0x3d66('0x4b')]['id'];}return db[_0x3d66('0x2c')][_0x3d66('0x4c')]({'where':{'id':_0x2012e2[_0x3d66('0x43')]['id']}})[_0x3d66('0x22')](handleEntityNotFound(_0x4ea803,null))['then'](saveUpdates(_0x2012e2[_0x3d66('0x4b')],null))[_0x3d66('0x22')](respondWithResult(_0x4ea803,null))[_0x3d66('0x41')](handleError(_0x4ea803,null));};exports[_0x3d66('0x23')]=function(_0x5ac044,_0x312181){return db[_0x3d66('0x2c')][_0x3d66('0x4c')]({'where':{'id':_0x5ac044['params']['id']}})['then'](handleEntityNotFound(_0x312181,null))['then'](removeEntity(_0x312181,null))[_0x3d66('0x41')](handleError(_0x312181,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 774fb60..2546dbf 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 _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 +var _0x053b=['../../config/environment','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x59d29c,_0x38d9d1){var _0x32e076=function(_0x33fb33){while(--_0x33fb33){_0x59d29c['push'](_0x59d29c['shift']());}};_0x32e076(++_0x38d9d1);}(_0x053b,0xe1));var _0xb053=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x053b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb053('0x0'));var util=require(_0xb053('0x1'));var logger=require(_0xb053('0x2'))(_0xb053('0x3'));var moment=require(_0xb053('0x4'));var BPromise=require(_0xb053('0x5'));var rp=require(_0xb053('0x6'));var fs=require('fs');var path=require(_0xb053('0x7'));var rimraf=require(_0xb053('0x8'));var config=require(_0xb053('0x9'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x290e58,_0x27b21b){return _0x290e58[_0xb053('0xa')](_0xb053('0xb'),attributes,{'tableName':_0xb053('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 732250f..82e1b74 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 _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 +var _0xe281=['createdAt','updatedAt','hopperToAdd','additionalToHop','sequelize','transaction','update','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','VerifyAdditionalPhones','CmHopper','ContactId','body','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','findOne','countabandonedretry','catch','SwapAdditionalPhones','CmHopperAdditionalPhone','duration','waitTime','scheduledat','minutes','add','phone','isNil'];(function(_0x317dc2,_0x525102){var _0x522da6=function(_0x3d9d4e){while(--_0x3d9d4e){_0x317dc2['push'](_0x317dc2['shift']());}};_0x522da6(++_0x525102);}(_0xe281,0x130));var _0x1e28=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe281[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x1e28('0x0'));var moment=require(_0x1e28('0x1'));var BPromise=require(_0x1e28('0x2'));var rs=require(_0x1e28('0x3'));var fs=require('fs');var Redis=require(_0x1e28('0x4'));var db=require(_0x1e28('0x5'))['db'];var utils=require(_0x1e28('0x6'));var logger=require(_0x1e28('0x7'))(_0x1e28('0x8'));var config=require('../../config/environment');var jayson=require(_0x1e28('0x9'));var client=jayson[_0x1e28('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1931d7,_0x520041,_0x8b71c4){return new BPromise(function(_0x2acc99,_0x1295d2){return client[_0x1e28('0xb')](_0x1931d7,_0x8b71c4)[_0x1e28('0xc')](function(_0x1191bc){logger[_0x1e28('0xd')](_0x1e28('0xe'),_0x520041,_0x1e28('0xf'));logger['debug'](_0x1e28('0x10'),_0x520041,_0x1e28('0xf'),JSON['stringify'](_0x1191bc));if(_0x1191bc[_0x1e28('0x11')]){if(_0x1191bc[_0x1e28('0x11')][_0x1e28('0x12')]===0x1f4){logger[_0x1e28('0x11')](_0x1e28('0xe'),_0x520041,_0x1191bc['error'][_0x1e28('0x13')]);return _0x1295d2(_0x1191bc[_0x1e28('0x11')]['message']);}logger['error'](_0x1e28('0xe'),_0x520041,_0x1191bc[_0x1e28('0x11')][_0x1e28('0x13')]);return _0x2acc99(_0x1191bc[_0x1e28('0x11')][_0x1e28('0x13')]);}else{logger[_0x1e28('0xd')](_0x1e28('0xe'),_0x520041,_0x1e28('0xf'));_0x2acc99(_0x1191bc[_0x1e28('0x14')][_0x1e28('0x13')]);}})['catch'](function(_0x1eb137){logger[_0x1e28('0x11')](_0x1e28('0xe'),_0x520041,_0x1eb137);_0x1295d2(_0x1eb137);});});}exports[_0x1e28('0x15')]=function(_0xaf29f7){var _0x25a1ca=this;return new Promise(function(_0xb347b7,_0x595441){return db[_0x1e28('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0xaf29f7['body'][_0x1e28('0x17')],'ListId':_0xaf29f7[_0x1e28('0x18')][_0x1e28('0x19')],'VoiceQueueId':_0xaf29f7[_0x1e28('0x18')][_0x1e28('0x1a')]===undefined?null:_0xaf29f7[_0x1e28('0x18')][_0x1e28('0x1a')],'CampaignId':_0xaf29f7[_0x1e28('0x18')][_0x1e28('0x1b')]===undefined?null:_0xaf29f7[_0x1e28('0x18')]['CampaignId']}})[_0x1e28('0xc')](function(_0x322836){if(_0x322836!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x322836['id'],'OrderBy':{'$gt':_0x322836[_0x1e28('0x1c')]}},'order':[[_0x1e28('0x1c'),_0x1e28('0x1d')]]})[_0x1e28('0xc')](function(_0x422cc9){var _0x4baa56=0x0;if(_0x422cc9){if(_0x422cc9[_0x1e28('0x1e')]+_0x422cc9[_0x1e28('0x1f')]+_0x422cc9[_0x1e28('0x20')]+_0x422cc9[_0x1e28('0x21')]+_0x422cc9[_0x1e28('0x22')]+_0x422cc9['countabandonedretry']+_0x422cc9[_0x1e28('0x23')]+_0x422cc9[_0x1e28('0x24')]<_0xaf29f7['entity'][_0x1e28('0x25')])_0x4baa56=0x1;_0xb347b7({'additional':_0x4baa56});}else{return db['CmHopperAdditionalPhone'][_0x1e28('0x26')]({'raw':!![],'where':{'CmHopperId':_0x322836['id']},'order':[['OrderBy',_0x1e28('0x1d')]]})[_0x1e28('0xc')](function(_0x4c7431){var _0x58c47c=0x0;if(_0x4c7431){if(_0x4c7431['countbusyretry']+_0x4c7431['countcongestionretry']+_0x4c7431[_0x1e28('0x20')]+_0x4c7431[_0x1e28('0x21')]+_0x4c7431[_0x1e28('0x22')]+_0x4c7431[_0x1e28('0x27')]+_0x4c7431[_0x1e28('0x23')]+_0x4c7431[_0x1e28('0x24')]<_0xaf29f7['entity'][_0x1e28('0x25')])_0x58c47c=0x1;_0xb347b7({'additional':_0x58c47c});}else{_0xb347b7({'additional':0x0});}})[_0x1e28('0x28')](function(_0x5ece70){logger[_0x1e28('0x11')]('VerifyAdditionalPhones',_0x5ece70['message'],_0xaf29f7);_0x595441(_0x25a1ca[_0x1e28('0x11')](0x1f4,_0x5ece70[_0x1e28('0x13')]));});}})[_0x1e28('0x28')](function(_0x51ffa9){logger[_0x1e28('0x11')](_0x1e28('0x15'),_0x51ffa9[_0x1e28('0x13')],_0xaf29f7);_0x595441(_0x25a1ca[_0x1e28('0x11')](0x1f4,_0x51ffa9[_0x1e28('0x13')]));});}else _0xb347b7({'additional':0x0});});});};exports[_0x1e28('0x29')]=function(_0x30fc7b){var _0x53875a=this;return new Promise(function(_0xf94c9c,_0x563f9e){return db[_0x1e28('0x16')][_0x1e28('0x26')]({'raw':!![],'where':{'ContactId':_0x30fc7b[_0x1e28('0x18')][_0x1e28('0x17')],'ListId':_0x30fc7b[_0x1e28('0x18')]['ListId'],'VoiceQueueId':_0x30fc7b[_0x1e28('0x18')]['VoiceQueueId']===undefined?null:_0x30fc7b[_0x1e28('0x18')]['VoiceQueueId'],'CampaignId':_0x30fc7b[_0x1e28('0x18')][_0x1e28('0x1b')]===undefined?null:_0x30fc7b[_0x1e28('0x18')][_0x1e28('0x1b')]}})[_0x1e28('0xc')](function(_0x556298){if(_0x556298!=null){return db[_0x1e28('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x556298['id'],'OrderBy':{'$gt':_0x556298[_0x1e28('0x1c')]}},'order':[[_0x1e28('0x1c'),_0x1e28('0x1d')]]})[_0x1e28('0xc')](function(_0x7898db){if(_0x7898db)return activateAdditionalPhone(_0x556298,_0x30fc7b[_0x1e28('0x18')],_0x7898db,_0x30fc7b[_0x1e28('0x2b')],_0x30fc7b[_0x1e28('0x2c')])[_0x1e28('0xc')](function(_0x1ef699){_0xf94c9c(_0x1ef699);});else{return db[_0x1e28('0x2a')][_0x1e28('0x26')]({'raw':!![],'where':{'CmHopperId':_0x556298['id']},'order':[[_0x1e28('0x1c'),_0x1e28('0x1d')]]})[_0x1e28('0xc')](function(_0x44a22d){if(_0x44a22d)return activateAdditionalPhone(_0x556298,_0x30fc7b[_0x1e28('0x18')],_0x44a22d,_0x30fc7b['duration'],_0x30fc7b['waitTime'])[_0x1e28('0xc')](function(_0x2d9cd0){_0xf94c9c(_0x2d9cd0);});else{_0xf94c9c({'id':_0x556298['id'],'phone':''});}})[_0x1e28('0x28')](function(_0x308958){logger[_0x1e28('0x11')](_0x1e28('0x15'),_0x308958['message'],_0x30fc7b);_0x563f9e(_0x53875a['error'](0x1f4,_0x308958[_0x1e28('0x13')]));});}})['catch'](function(_0x17742e){logger[_0x1e28('0x11')](_0x1e28('0x15'),_0x17742e['message'],_0x30fc7b);_0x563f9e(_0x53875a['error'](0x1f4,_0x17742e['message']));});}else _0xf94c9c(0x1);});});};function activateAdditionalPhone(_0x40617d,_0x5c5597,_0x1f456a,_0x434259,_0x372753){return new Promise(function(_0x7d14b1,_0x18f28c){logger[_0x1e28('0xd')](_0x1e28('0x15'),_0x1f456a);var _0x3a9cc2;if(moment()>moment(_0x1f456a[_0x1e28('0x2d')])){_0x3a9cc2=moment()['add'](_0x372753||0x3,_0x1e28('0x2e'));}else{if(_0x1f456a['OrderBy']==0x0){_0x3a9cc2=moment(_0x1f456a[_0x1e28('0x2d')]);}else{_0x3a9cc2=moment()[_0x1e28('0x2f')](_0x372753||0x3,_0x1e28('0x2e'));}}var _0x45eba5={'phone':_0x40617d[_0x1e28('0x30')],'active':0x0,'OrderBy':_[_0x1e28('0x31')](_0x40617d[_0x1e28('0x1c')])?0x0:_0x40617d[_0x1e28('0x1c')],'scheduledat':moment()[_0x1e28('0x2f')](_0x434259||0x1,_0x1e28('0x2e')),'countbusyretry':_0x5c5597['countbusyretry'],'countcongestionretry':_0x5c5597[_0x1e28('0x1f')],'countnoanswerretry':_0x5c5597[_0x1e28('0x20')],'countnosuchnumberretry':_0x5c5597[_0x1e28('0x21')],'countdropretry':_0x5c5597[_0x1e28('0x22')],'countabandonedretry':_0x5c5597[_0x1e28('0x27')],'countmachineretry':_0x5c5597[_0x1e28('0x23')],'countagentrejectretry':_0x5c5597[_0x1e28('0x24')],'createdAt':_0x5c5597[_0x1e28('0x32')],'updatedAt':_0x5c5597[_0x1e28('0x33')]};var _0xdd34d9={'CmHopperId':_0x40617d['id'],'phone':_0x1f456a['phone'],'active':0x0,'OrderBy':_[_0x1e28('0x31')](_0x1f456a['OrderBy'])?0x0:_0x1f456a[_0x1e28('0x1c')],'scheduledat':_0x3a9cc2,'countbusyretry':_0x1f456a[_0x1e28('0x1e')],'countcongestionretry':_0x1f456a[_0x1e28('0x1f')],'countnoanswerretry':_0x1f456a[_0x1e28('0x20')],'countnosuchnumberretry':_0x5c5597[_0x1e28('0x21')],'countdropretry':_0x5c5597[_0x1e28('0x22')],'countabandonedretry':_0x5c5597[_0x1e28('0x27')],'countmachineretry':_0x5c5597[_0x1e28('0x23')],'countagentrejectretry':_0x5c5597[_0x1e28('0x24')],'createdAt':_0x1f456a[_0x1e28('0x32')],'updatedAt':_0x1f456a['updatedAt']};logger[_0x1e28('0xd')](_0x1e28('0x34'),_0x45eba5);logger[_0x1e28('0xd')](_0x1e28('0x35'),_0xdd34d9);return db[_0x1e28('0x36')][_0x1e28('0x37')](function(_0x156add){return db[_0x1e28('0x2a')]['update'](_0x45eba5,{'where':{'id':_0x1f456a['id']}},{'transaction':_0x156add})[_0x1e28('0xc')](function(){return db['CmHopper'][_0x1e28('0x38')](_0xdd34d9,{'where':{'id':_0x40617d['id']}},{'transaction':_0x156add});});})[_0x1e28('0xc')](function(_0x3f93ca){_0x7d14b1({'id':_0x40617d['id'],'phone':_0x1f456a[_0x1e28('0x30')]});})[_0x1e28('0x28')](function(_0x4ffbbc){logger[_0x1e28('0x11')](_0x1e28('0x15'),_0x4ffbbc[_0x1e28('0x13')],req);_0x18f28c(_this[_0x1e28('0x11')](0x1f4,_0x4ffbbc[_0x1e28('0x13')]));});});}exports[_0x1e28('0x39')]=function(_0x36dee9){var _0x2306f0=this;return new Promise(function(_0x229fba,_0x3e5ee9){return db[_0x1e28('0x16')]['update'](_0x36dee9['body'][_0x1e28('0x3a')],{'where':{'id':_0x36dee9[_0x1e28('0x18')]['id']}})[_0x1e28('0xc')](function(_0x426084){_0x229fba(_0x426084);})['catch'](function(_0xa66966){logger[_0x1e28('0x11')](_0x1e28('0x39'),_0xa66966[_0x1e28('0x13')],_0x36dee9);_0x3e5ee9(_0x2306f0[_0x1e28('0x11')](0x1f4,_0xa66966['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index eaecefe..44690b4 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 _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 +var _0x20e8=['../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3fef46,_0x5971cf){var _0x4e6e81=function(_0x22d0e3){while(--_0x22d0e3){_0x3fef46['push'](_0x3fef46['shift']());}};_0x4e6e81(++_0x5971cf);}(_0x20e8,0x6b));var _0x820e=function(_0xa2f3dd,_0x5b81f3){_0xa2f3dd=_0xa2f3dd-0x0;var _0x5471f1=_0x20e8[_0xa2f3dd];return _0x5471f1;};'use strict';var multer=require(_0x820e('0x0'));var util=require(_0x820e('0x1'));var path=require(_0x820e('0x2'));var timeout=require(_0x820e('0x3'));var express=require(_0x820e('0x4'));var router=express[_0x820e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x820e('0x6'));var config=require(_0x820e('0x7'));var controller=require(_0x820e('0x8'));router[_0x820e('0x9')]('/',auth[_0x820e('0xa')](),controller[_0x820e('0xb')]);router[_0x820e('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x820e('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x820e('0xd')]);router[_0x820e('0xe')](_0x820e('0xf'),auth[_0x820e('0xa')](),controller['update']);router[_0x820e('0x10')](_0x820e('0xf'),auth[_0x820e('0xa')](),controller[_0x820e('0x11')]);module[_0x820e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b63a49a..f42c4e5 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 _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 +var _0xf111=['moment','sequelize','contactListQueue','INTEGER'];(function(_0x4963a7,_0x18660d){var _0x30937e=function(_0x484ba8){while(--_0x484ba8){_0x4963a7['push'](_0x4963a7['shift']());}};_0x30937e(++_0x18660d);}(_0xf111,0x1e0));var _0x1f11=function(_0x46a3e8,_0x2e1b35){_0x46a3e8=_0x46a3e8-0x0;var _0xf1442e=_0xf111[_0x46a3e8];return _0xf1442e;};'use strict';var moment=require(_0x1f11('0x0'));var Sequelize=require(_0x1f11('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x1f11('0x2')},'ListId':{'type':Sequelize[_0x1f11('0x3')],'unique':_0x1f11('0x2')},'VoiceQueueId':{'type':Sequelize[_0x1f11('0x3')],'unique':_0x1f11('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index f1d2806..89b443e 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 _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 +var _0x5c93=['moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','json','count','offset','status','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','params','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch'];(function(_0x2e3724,_0x19c39a){var _0x384620=function(_0x52db9b){while(--_0x52db9b){_0x2e3724['push'](_0x2e3724['shift']());}};_0x384620(++_0x19c39a);}(_0x5c93,0x11c));var _0x35c9=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5c93[_0x580576];return _0x3f55a0;};'use strict';var pdf=require(_0x35c9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x35c9('0x1'));var zipdir=require(_0x35c9('0x2'));var jsonpatch=require(_0x35c9('0x3'));var rp=require('request-promise');var moment=require(_0x35c9('0x4'));var BPromise=require(_0x35c9('0x5'));var Mustache=require(_0x35c9('0x6'));var util=require('util');var path=require(_0x35c9('0x7'));var sox=require(_0x35c9('0x8'));var csv=require(_0x35c9('0x9'));var ejs=require(_0x35c9('0xa'));var fs=require('fs');var _=require(_0x35c9('0xb'));var squel=require(_0x35c9('0xc'));var crypto=require(_0x35c9('0xd'));var jsforce=require(_0x35c9('0xe'));var deskjs=require(_0x35c9('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x35c9('0x10'));var Redis=require(_0x35c9('0x11'));var authService=require(_0x35c9('0x12'));var qs=require(_0x35c9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35c9('0x14'));var logger=require(_0x35c9('0x15'))(_0x35c9('0x16'));var utils=require('../../config/utils');var config=require(_0x35c9('0x17'));var licenseUtil=require(_0x35c9('0x18'));var db=require(_0x35c9('0x19'))['db'];function respondWithStatusCode(_0x49faec,_0x7782df){_0x7782df=_0x7782df||0xcc;return function(_0xe1660){if(_0xe1660){return _0x49faec['sendStatus'](_0x7782df);}return _0x49faec['status'](_0x7782df)['end']();};}function respondWithResult(_0x398efc,_0x49f01d){_0x49f01d=_0x49f01d||0xc8;return function(_0x8f24de){if(_0x8f24de){return _0x398efc['status'](_0x49f01d)[_0x35c9('0x1a')](_0x8f24de);}};}function respondWithFilteredResult(_0x35d700,_0x3100c5){return function(_0x4df95f){if(_0x4df95f){var _0x268c06=_0x4df95f[_0x35c9('0x1b')],_0x4db6ab=_0x3100c5[_0x35c9('0x1c')],_0x479998=_0x3100c5['offset']+_0x3100c5['limit'],_0xb6a9fb;if(_0x479998>=_0x268c06){_0x479998=_0x268c06;_0xb6a9fb=0xc8;}else{_0xb6a9fb=0xce;}_0x35d700[_0x35c9('0x1d')](_0xb6a9fb);return _0x35d700[_0x35c9('0x1e')](_0x35c9('0x1f'),_0x4db6ab+'-'+_0x479998+'/'+_0x268c06)['json'](_0x4df95f);}return null;};}function patchUpdates(_0xc5975){return function(_0x52ea0a){try{jsonpatch[_0x35c9('0x20')](_0x52ea0a,_0xc5975,!![]);}catch(_0x885613){return BPromise['reject'](_0x885613);}return _0x52ea0a[_0x35c9('0x21')]();};}function saveUpdates(_0x1f6d8a,_0x16556c){return function(_0x4154bd){if(_0x4154bd){return _0x4154bd[_0x35c9('0x22')](_0x1f6d8a)[_0x35c9('0x23')](function(_0x3a7e03){return _0x3a7e03;});}return null;};}function removeEntity(_0x342230,_0x682cff){return function(_0xa60d){if(_0xa60d){return _0xa60d[_0x35c9('0x24')]()['then'](function(){_0x342230['status'](0xcc)[_0x35c9('0x25')]();});}};}function handleEntityNotFound(_0x3341d9,_0x2c798d){return function(_0xcc45c3){if(!_0xcc45c3){_0x3341d9[_0x35c9('0x26')](0x194);}return _0xcc45c3;};}function handleError(_0xc701e5,_0x3989a6){_0x3989a6=_0x3989a6||0x1f4;return function(_0x453898){logger['error'](_0x453898[_0x35c9('0x27')]);if(_0x453898['name']){delete _0x453898[_0x35c9('0x28')];}_0xc701e5[_0x35c9('0x1d')](_0x3989a6)['send'](_0x453898);};}exports['index']=function(_0x113eb5,_0x332ee6){var _0x20ef04={},_0x23c4d2={},_0x29b31b={'count':0x0,'rows':[]};var _0x47f94b=_[_0x35c9('0x29')](db[_0x35c9('0x2a')][_0x35c9('0x2b')],function(_0xcbe7e2){return{'name':_0xcbe7e2[_0x35c9('0x2c')],'type':_0xcbe7e2[_0x35c9('0x2d')][_0x35c9('0x2e')]};});_0x23c4d2[_0x35c9('0x2f')]=_[_0x35c9('0x29')](_0x47f94b,_0x35c9('0x28'));_0x23c4d2['query']=_[_0x35c9('0x30')](_0x113eb5['query']);_0x23c4d2[_0x35c9('0x31')]=_[_0x35c9('0x32')](_0x23c4d2[_0x35c9('0x2f')],_0x23c4d2['query']);_0x20ef04[_0x35c9('0x33')]=_[_0x35c9('0x32')](_0x23c4d2[_0x35c9('0x2f')],qs[_0x35c9('0x34')](_0x113eb5['query']['fields']));_0x20ef04['attributes']=_0x20ef04[_0x35c9('0x33')][_0x35c9('0x35')]?_0x20ef04['attributes']:_0x23c4d2['model'];if(!_0x113eb5[_0x35c9('0x36')][_0x35c9('0x37')](_0x35c9('0x38'))){_0x20ef04[_0x35c9('0x39')]=qs[_0x35c9('0x39')](_0x113eb5[_0x35c9('0x36')][_0x35c9('0x39')]);_0x20ef04[_0x35c9('0x1c')]=qs['offset'](_0x113eb5[_0x35c9('0x36')][_0x35c9('0x1c')]);}_0x20ef04[_0x35c9('0x3a')]=qs[_0x35c9('0x3b')](_0x113eb5[_0x35c9('0x36')][_0x35c9('0x3b')]);_0x20ef04[_0x35c9('0x3c')]=qs[_0x35c9('0x31')](_[_0x35c9('0x3d')](_0x113eb5['query'],_0x23c4d2[_0x35c9('0x31')]),_0x47f94b);if(_0x113eb5[_0x35c9('0x36')][_0x35c9('0x3e')]){_0x20ef04['where']=_[_0x35c9('0x3f')](_0x20ef04[_0x35c9('0x3c')],{'$or':_[_0x35c9('0x29')](_0x47f94b,function(_0x590d7a){if(_0x590d7a[_0x35c9('0x2d')]!=='VIRTUAL'){var _0x5c50de={};_0x5c50de[_0x590d7a[_0x35c9('0x28')]]={'$like':'%'+_0x113eb5[_0x35c9('0x36')]['filter']+'%'};return _0x5c50de;}})});}_0x20ef04=_[_0x35c9('0x3f')]({},_0x20ef04,_0x113eb5[_0x35c9('0x40')]);var _0x35e1ea={'where':_0x20ef04[_0x35c9('0x3c')]};return db[_0x35c9('0x2a')][_0x35c9('0x1b')](_0x35e1ea)[_0x35c9('0x23')](function(_0x47f7ab){_0x29b31b[_0x35c9('0x1b')]=_0x47f7ab;if(_0x113eb5[_0x35c9('0x36')][_0x35c9('0x41')]){_0x20ef04[_0x35c9('0x42')]=[{'all':!![]}];}return db[_0x35c9('0x2a')]['findAll'](_0x20ef04);})['then'](function(_0x50a5ed){_0x29b31b['rows']=_0x50a5ed;return _0x29b31b;})['then'](respondWithFilteredResult(_0x332ee6,_0x20ef04))[_0x35c9('0x43')](handleError(_0x332ee6,null));};exports['show']=function(_0x9f87ac,_0x338342){var _0x233f63={'raw':!![],'where':{'id':_0x9f87ac[_0x35c9('0x44')]['id']}},_0x2f1518={};_0x2f1518[_0x35c9('0x2f')]=_[_0x35c9('0x30')](db[_0x35c9('0x2a')]['rawAttributes']);_0x2f1518['query']=_[_0x35c9('0x30')](_0x9f87ac[_0x35c9('0x36')]);_0x2f1518['filters']=_[_0x35c9('0x32')](_0x2f1518[_0x35c9('0x2f')],_0x2f1518[_0x35c9('0x36')]);_0x233f63[_0x35c9('0x33')]=_[_0x35c9('0x32')](_0x2f1518[_0x35c9('0x2f')],qs[_0x35c9('0x34')](_0x9f87ac[_0x35c9('0x36')][_0x35c9('0x34')]));_0x233f63[_0x35c9('0x33')]=_0x233f63[_0x35c9('0x33')][_0x35c9('0x35')]?_0x233f63[_0x35c9('0x33')]:_0x2f1518[_0x35c9('0x2f')];if(_0x9f87ac['query'][_0x35c9('0x41')]){_0x233f63['include']=[{'all':!![]}];}_0x233f63=_[_0x35c9('0x3f')]({},_0x233f63,_0x9f87ac['options']);return db[_0x35c9('0x2a')]['find'](_0x233f63)[_0x35c9('0x23')](handleEntityNotFound(_0x338342,null))[_0x35c9('0x23')](respondWithResult(_0x338342,null))[_0x35c9('0x43')](handleError(_0x338342,null));};exports[_0x35c9('0x22')]=function(_0x218e8c,_0x116289){if(_0x218e8c[_0x35c9('0x45')]['id']){delete _0x218e8c[_0x35c9('0x45')]['id'];}return db[_0x35c9('0x2a')][_0x35c9('0x46')]({'where':{'id':_0x218e8c[_0x35c9('0x44')]['id']}})[_0x35c9('0x23')](handleEntityNotFound(_0x116289,null))[_0x35c9('0x23')](saveUpdates(_0x218e8c['body'],null))['then'](respondWithResult(_0x116289,null))[_0x35c9('0x43')](handleError(_0x116289,null));};exports[_0x35c9('0x24')]=function(_0x36e6ac,_0x19c356){return db[_0x35c9('0x2a')]['find']({'where':{'id':_0x36e6ac[_0x35c9('0x44')]['id']}})[_0x35c9('0x23')](handleEntityNotFound(_0x19c356,null))[_0x35c9('0x23')](removeEntity(_0x19c356,null))[_0x35c9('0x43')](handleError(_0x19c356,null));};exports['describe']=function(_0x3ae227,_0x1a19b7){return db[_0x35c9('0x2a')][_0x35c9('0x47')]()[_0x35c9('0x23')](respondWithResult(_0x1a19b7,null))[_0x35c9('0x43')](handleError(_0x1a19b7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 3bdffe9..d518001 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 _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 +var _0x3e41=['path','exports','define','cm_hopper_black','util','api','moment','bluebird','request-promise'];(function(_0x22b53f,_0xaa88ef){var _0x552c0a=function(_0x33c990){while(--_0x33c990){_0x22b53f['push'](_0x22b53f['shift']());}};_0x552c0a(++_0xaa88ef);}(_0x3e41,0xdc));var _0x13e4=function(_0x4f30ed,_0x1922af){_0x4f30ed=_0x4f30ed-0x0;var _0x47983f=_0x3e41[_0x4f30ed];return _0x47983f;};'use strict';var _=require('lodash');var util=require(_0x13e4('0x0'));var logger=require('../../config/logger')(_0x13e4('0x1'));var moment=require(_0x13e4('0x2'));var BPromise=require(_0x13e4('0x3'));var rp=require(_0x13e4('0x4'));var fs=require('fs');var path=require(_0x13e4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x13e4('0x6')]=function(_0x4151af,_0x4526a8){return _0x4151af[_0x13e4('0x7')]('CmHopperBlack',attributes,{'tableName':_0x13e4('0x8'),'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 c65e2dd..685541b 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 _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 +var _0x6cf9=['request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','catch','body','raw','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x16df8f,_0x3dbe15){var _0x56ffee=function(_0x23aa44){while(--_0x23aa44){_0x16df8f['push'](_0x16df8f['shift']());}};_0x56ffee(++_0x3dbe15);}(_0x6cf9,0x83));var _0x96cf=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0x6cf9[_0x5e1b91];return _0x59b52f;};'use strict';var _=require('lodash');var util=require(_0x96cf('0x0'));var moment=require(_0x96cf('0x1'));var BPromise=require(_0x96cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96cf('0x3'));var db=require(_0x96cf('0x4'))['db'];var utils=require(_0x96cf('0x5'));var logger=require('../../config/logger')(_0x96cf('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x96cf('0x7')][_0x96cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ab832,_0x50daee,_0x3ed1e4){return new BPromise(function(_0x2be6e7,_0x8b833f){return client[_0x96cf('0x9')](_0x1ab832,_0x3ed1e4)[_0x96cf('0xa')](function(_0x6f46d8){logger[_0x96cf('0xb')](_0x96cf('0xc'),_0x50daee,'request\x20sent');logger[_0x96cf('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x50daee,_0x96cf('0xe'),JSON[_0x96cf('0xf')](_0x6f46d8));if(_0x6f46d8[_0x96cf('0x10')]){if(_0x6f46d8[_0x96cf('0x10')][_0x96cf('0x11')]===0x1f4){logger[_0x96cf('0x10')](_0x96cf('0xc'),_0x50daee,_0x6f46d8[_0x96cf('0x10')]['message']);return _0x8b833f(_0x6f46d8[_0x96cf('0x10')][_0x96cf('0x12')]);}logger[_0x96cf('0x10')](_0x96cf('0xc'),_0x50daee,_0x6f46d8[_0x96cf('0x10')][_0x96cf('0x12')]);return _0x2be6e7(_0x6f46d8[_0x96cf('0x10')]['message']);}else{logger[_0x96cf('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x50daee,'request\x20sent');_0x2be6e7(_0x6f46d8[_0x96cf('0x13')][_0x96cf('0x12')]);}})['catch'](function(_0x59db0c){logger[_0x96cf('0x10')](_0x96cf('0xc'),_0x50daee,_0x59db0c);_0x8b833f(_0x59db0c);});});}exports[_0x96cf('0x14')]=function(_0x5d50e6){var _0x447497=this;return new Promise(function(_0x250afe,_0x2afd27){return db[_0x96cf('0x15')][_0x96cf('0x16')]({'raw':_0x5d50e6[_0x96cf('0x17')]?_0x5d50e6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5d50e6[_0x96cf('0x17')]?_0x5d50e6[_0x96cf('0x17')][_0x96cf('0x18')]||null:null,'attributes':_0x5d50e6[_0x96cf('0x17')]?_0x5d50e6[_0x96cf('0x17')][_0x96cf('0x19')]||null:null,'limit':_0x5d50e6[_0x96cf('0x17')]?_0x5d50e6[_0x96cf('0x17')][_0x96cf('0x1a')]||null:null,'include':_0x5d50e6[_0x96cf('0x17')]?_0x5d50e6[_0x96cf('0x17')]['include']?_['map'](_0x5d50e6[_0x96cf('0x17')][_0x96cf('0x1b')],function(_0x25c01c){return{'model':db[_0x25c01c[_0x96cf('0x1c')]],'as':_0x25c01c['as'],'attributes':_0x25c01c['attributes'],'include':_0x25c01c[_0x96cf('0x1b')]?_['map'](_0x25c01c[_0x96cf('0x1b')],function(_0x1ec508){return{'model':db[_0x1ec508[_0x96cf('0x1c')]],'as':_0x1ec508['as'],'attributes':_0x1ec508[_0x96cf('0x19')],'include':_0x1ec508[_0x96cf('0x1b')]?_[_0x96cf('0x1d')](_0x1ec508['include'],function(_0x283159){return{'model':db[_0x283159[_0x96cf('0x1c')]],'as':_0x283159['as'],'attributes':_0x283159['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x267c58){logger['info']('GetCmHopperBlack',_0x5d50e6);logger[_0x96cf('0xd')](_0x96cf('0x14'),_0x5d50e6,JSON[_0x96cf('0xf')](_0x267c58));_0x250afe(_0x267c58);})[_0x96cf('0x1e')](function(_0x2888f1){logger[_0x96cf('0x10')](_0x96cf('0x14'),_0x2888f1[_0x96cf('0x12')],_0x5d50e6);_0x2afd27(_0x447497[_0x96cf('0x10')](0x1f4,_0x2888f1['message']));});});};exports['UpdateCmHopperBlack']=function(_0x1382f3){var _0x10c249=this;return new Promise(function(_0x4193a4,_0x53c20a){return db[_0x96cf('0x15')]['update'](_0x1382f3[_0x96cf('0x1f')],{'raw':_0x1382f3[_0x96cf('0x17')]?_0x1382f3[_0x96cf('0x17')][_0x96cf('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1382f3[_0x96cf('0x17')]?_0x1382f3['options']['where']||null:null,'attributes':_0x1382f3[_0x96cf('0x17')]?_0x1382f3['options'][_0x96cf('0x19')]||null:null,'limit':_0x1382f3[_0x96cf('0x17')]?_0x1382f3[_0x96cf('0x17')][_0x96cf('0x1a')]||null:null})[_0x96cf('0xa')](function(_0x23392f){logger['info'](_0x96cf('0x21'),_0x1382f3);logger[_0x96cf('0xd')](_0x96cf('0x21'),_0x1382f3,JSON[_0x96cf('0xf')](_0x23392f));_0x4193a4(_0x23392f);})[_0x96cf('0x1e')](function(_0x501f41){logger[_0x96cf('0x10')](_0x96cf('0x21'),_0x501f41[_0x96cf('0x12')],_0x1382f3);_0x53c20a(_0x10c249[_0x96cf('0x10')](0x1f4,_0x501f41[_0x96cf('0x12')]));});});};exports[_0x96cf('0x22')]=function(_0x376d30){var _0x4cf462=this;return new Promise(function(_0x5339dc,_0x99f765){return db[_0x96cf('0x15')]['destroy']({'where':_0x376d30['options']?_0x376d30[_0x96cf('0x17')][_0x96cf('0x18')]||null:null})['then'](function(_0x4d5ced){logger['info'](_0x96cf('0x22'),_0x376d30);logger[_0x96cf('0xd')](_0x96cf('0x22'),_0x376d30,JSON[_0x96cf('0xf')](_0x4d5ced));_0x5339dc(_0x4d5ced);})[_0x96cf('0x1e')](function(_0x46c744){logger[_0x96cf('0x10')]('DestroyCmHopperBlack',_0x46c744['message'],_0x376d30);_0x99f765(_0x4cf462[_0x96cf('0x10')](0x1f4,_0x46c744[_0x96cf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 65c1edf..7aff8f9 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 _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 +var _0x5c12=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','/:id','isAuthenticated','show','put','update','delete','exports','util','path','express','Router'];(function(_0x30f8b6,_0x556904){var _0x272f96=function(_0x518a13){while(--_0x518a13){_0x30f8b6['push'](_0x30f8b6['shift']());}};_0x272f96(++_0x556904);}(_0x5c12,0x188));var _0x25c1=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x5c12[_0x30033a];return _0x5e3518;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var auth=require(_0x25c1('0x4'));var interaction=require(_0x25c1('0x5'));var config=require(_0x25c1('0x6'));var controller=require(_0x25c1('0x7'));router[_0x25c1('0x8')]('/',auth['isAuthenticated'](),controller[_0x25c1('0x9')]);router[_0x25c1('0x8')](_0x25c1('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x25c1('0x8')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xe')]('/:id',auth[_0x25c1('0xc')](),controller[_0x25c1('0xf')]);router[_0x25c1('0x10')](_0x25c1('0xb'),auth[_0x25c1('0xc')](),controller['destroy']);module[_0x25c1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 7728edb..46fe7ab 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 _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 +var _0x7326=['endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','exports','STRING','DATE','INTEGER','getDataValue'];(function(_0x3bd956,_0x22e9e2){var _0x59168a=function(_0x4871c9){while(--_0x4871c9){_0x3bd956['push'](_0x3bd956['shift']());}};_0x59168a(++_0x22e9e2);}(_0x7326,0xc7));var _0x6732=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x7326[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x6732('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6732('0x1')]},'scheduledat':{'type':Sequelize[_0x6732('0x2')]},'countbusyretry':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6732('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x6732('0x1')]},'originatecalleridname':{'type':Sequelize[_0x6732('0x1')]},'calleridnum':{'type':Sequelize[_0x6732('0x1')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6732('0x2')]},'responsetime':{'type':Sequelize[_0x6732('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6732('0x2')]},'endtime':{'type':Sequelize[_0x6732('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6732('0x1')]},'campaign':{'type':Sequelize[_0x6732('0x1')]},'campaigntype':{'type':Sequelize[_0x6732('0x1')]},'membername':{'type':Sequelize[_0x6732('0x1')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6732('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6732('0x1')]},'dispositionat':{'type':Sequelize[_0x6732('0x2')],'set':function(_0xd15927){var _0x53a6f8=this[_0x6732('0x4')](_0x6732('0x5'));if(_0x53a6f8&&_0xd15927){this[_0x6732('0x6')](_0x6732('0x7'),moment(_0xd15927)[_0x6732('0x8')](moment(_0x53a6f8),_0x6732('0x9')));}return this[_0x6732('0x6')](_0x6732('0xa'),_0xd15927);}},'amd':{'type':Sequelize[_0x6732('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6732('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6732('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x6732('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6732('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6732('0x2')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6732('0x2')]},'recallme':{'type':Sequelize[_0x6732('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6732('0x2')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6732('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 68bb382..6d315df 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 _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 +var _0x593e=['includeAll','rows','catch','params','include','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','findAll','moveContactsQueueCampaignHopperFinal','VoiceQueue','find','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(ListId)','CampaignId\x20=\x20?','select','CmHopper','findOne','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/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','send','index','map','CmHopperFinal','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then'];(function(_0x4a79fd,_0x429333){var _0xef2f88=function(_0x44178c){while(--_0x44178c){_0x4a79fd['push'](_0x4a79fd['shift']());}};_0xef2f88(++_0x429333);}(_0x593e,0xcb));var _0xe593=function(_0x16798f,_0x3ae793){_0x16798f=_0x16798f-0x0;var _0x1c82a7=_0x593e[_0x16798f];return _0x1c82a7;};'use strict';var pdf=require(_0xe593('0x0'));var emlformat=require(_0xe593('0x1'));var rimraf=require(_0xe593('0x2'));var zipdir=require(_0xe593('0x3'));var jsonpatch=require(_0xe593('0x4'));var rp=require(_0xe593('0x5'));var moment=require(_0xe593('0x6'));var BPromise=require(_0xe593('0x7'));var Mustache=require('mustache');var util=require(_0xe593('0x8'));var path=require(_0xe593('0x9'));var sox=require(_0xe593('0xa'));var csv=require(_0xe593('0xb'));var ejs=require(_0xe593('0xc'));var fs=require('fs');var _=require(_0xe593('0xd'));var squel=require(_0xe593('0xe'));var crypto=require(_0xe593('0xf'));var jsforce=require(_0xe593('0x10'));var deskjs=require(_0xe593('0x11'));var toCsv=require('to-csv');var querystring=require(_0xe593('0x12'));var Papa=require(_0xe593('0x13'));var Redis=require(_0xe593('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe593('0x15'));var hardwareService=require(_0xe593('0x16'));var logger=require(_0xe593('0x17'))('api');var utils=require(_0xe593('0x18'));var config=require(_0xe593('0x19'));var licenseUtil=require(_0xe593('0x1a'));var db=require(_0xe593('0x1b'))['db'];function respondWithStatusCode(_0x8ee313,_0x31dad0){_0x31dad0=_0x31dad0||0xcc;return function(_0x24c9fd){if(_0x24c9fd){return _0x8ee313[_0xe593('0x1c')](_0x31dad0);}return _0x8ee313[_0xe593('0x1d')](_0x31dad0)[_0xe593('0x1e')]();};}function respondWithResult(_0x499819,_0x2907e4){_0x2907e4=_0x2907e4||0xc8;return function(_0x1de391){if(_0x1de391){return _0x499819['status'](_0x2907e4)[_0xe593('0x1f')](_0x1de391);}};}function respondWithFilteredResult(_0x44837b,_0x5d4c6a){return function(_0x2ae9b6){if(_0x2ae9b6){var _0x40416c=_0x2ae9b6[_0xe593('0x20')],_0x1c6de3=_0x5d4c6a['offset'],_0x2d525c=_0x5d4c6a[_0xe593('0x21')]+_0x5d4c6a[_0xe593('0x22')],_0x3408ec;if(_0x2d525c>=_0x40416c){_0x2d525c=_0x40416c;_0x3408ec=0xc8;}else{_0x3408ec=0xce;}_0x44837b['status'](_0x3408ec);return _0x44837b[_0xe593('0x23')](_0xe593('0x24'),_0x1c6de3+'-'+_0x2d525c+'/'+_0x40416c)['json'](_0x2ae9b6);}return null;};}function patchUpdates(_0x1c94aa){return function(_0x3dba1b){try{jsonpatch[_0xe593('0x25')](_0x3dba1b,_0x1c94aa,!![]);}catch(_0x321115){return BPromise[_0xe593('0x26')](_0x321115);}return _0x3dba1b[_0xe593('0x27')]();};}function saveUpdates(_0x3d2a51,_0x4ea53f){return function(_0x4af4c8){if(_0x4af4c8){return _0x4af4c8[_0xe593('0x28')](_0x3d2a51)['then'](function(_0x56c23f){return _0x56c23f;});}return null;};}function removeEntity(_0x1bb8e8,_0x3c65b5){return function(_0x57379d){if(_0x57379d){return _0x57379d[_0xe593('0x29')]()['then'](function(){_0x1bb8e8[_0xe593('0x1d')](0xcc)[_0xe593('0x1e')]();});}};}function handleEntityNotFound(_0x185cea,_0x44d997){return function(_0x39103d){if(!_0x39103d){_0x185cea[_0xe593('0x1c')](0x194);}return _0x39103d;};}function handleError(_0x20a098,_0xb7636c){_0xb7636c=_0xb7636c||0x1f4;return function(_0x4fc483){logger[_0xe593('0x2a')](_0x4fc483[_0xe593('0x2b')]);if(_0x4fc483['name']){delete _0x4fc483['name'];}_0x20a098[_0xe593('0x1d')](_0xb7636c)[_0xe593('0x2c')](_0x4fc483);};}exports[_0xe593('0x2d')]=function(_0x43699d,_0x3b66bc){var _0x27a3d2={},_0x5918cd={},_0x350e2b={'count':0x0,'rows':[]};var _0x54e5e2=_[_0xe593('0x2e')](db[_0xe593('0x2f')]['rawAttributes'],function(_0x337ee0){return{'name':_0x337ee0['fieldName'],'type':_0x337ee0[_0xe593('0x30')][_0xe593('0x31')]};});_0x5918cd[_0xe593('0x32')]=_['map'](_0x54e5e2,_0xe593('0x33'));_0x5918cd[_0xe593('0x34')]=_[_0xe593('0x35')](_0x43699d[_0xe593('0x34')]);_0x5918cd[_0xe593('0x36')]=_[_0xe593('0x37')](_0x5918cd[_0xe593('0x32')],_0x5918cd['query']);_0x27a3d2[_0xe593('0x38')]=_[_0xe593('0x37')](_0x5918cd['model'],qs[_0xe593('0x39')](_0x43699d['query'][_0xe593('0x39')]));_0x27a3d2[_0xe593('0x38')]=_0x27a3d2[_0xe593('0x38')][_0xe593('0x3a')]?_0x27a3d2[_0xe593('0x38')]:_0x5918cd[_0xe593('0x32')];if(!_0x43699d[_0xe593('0x34')][_0xe593('0x3b')](_0xe593('0x3c'))){_0x27a3d2[_0xe593('0x22')]=qs['limit'](_0x43699d[_0xe593('0x34')][_0xe593('0x22')]);_0x27a3d2[_0xe593('0x21')]=qs['offset'](_0x43699d['query'][_0xe593('0x21')]);}_0x27a3d2['order']=qs[_0xe593('0x3d')](_0x43699d[_0xe593('0x34')][_0xe593('0x3d')]);_0x27a3d2[_0xe593('0x3e')]=qs[_0xe593('0x36')](_[_0xe593('0x3f')](_0x43699d[_0xe593('0x34')],_0x5918cd['filters']),_0x54e5e2);if(_0x43699d['query'][_0xe593('0x40')]){_0x27a3d2['where']=_[_0xe593('0x41')](_0x27a3d2['where'],{'$or':_[_0xe593('0x2e')](_0x54e5e2,function(_0x5b9589){if(_0x5b9589['type']!==_0xe593('0x42')){var _0x1c7912={};_0x1c7912[_0x5b9589[_0xe593('0x33')]]={'$like':'%'+_0x43699d['query']['filter']+'%'};return _0x1c7912;}})});}_0x27a3d2=_['merge']({},_0x27a3d2,_0x43699d[_0xe593('0x43')]);var _0x584945={'where':_0x27a3d2[_0xe593('0x3e')]};return db[_0xe593('0x2f')][_0xe593('0x20')](_0x584945)[_0xe593('0x44')](function(_0x50249e){_0x350e2b[_0xe593('0x20')]=_0x50249e;if(_0x43699d['query'][_0xe593('0x45')]){_0x27a3d2['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x27a3d2);})[_0xe593('0x44')](function(_0x5c2bd2){_0x350e2b[_0xe593('0x46')]=_0x5c2bd2;return _0x350e2b;})[_0xe593('0x44')](respondWithFilteredResult(_0x3b66bc,_0x27a3d2))[_0xe593('0x47')](handleError(_0x3b66bc,null));};exports['show']=function(_0x26f845,_0x3f9784){var _0x2cbcb3={'raw':!![],'where':{'id':_0x26f845[_0xe593('0x48')]['id']}},_0x4655dd={};_0x4655dd[_0xe593('0x32')]=_[_0xe593('0x35')](db[_0xe593('0x2f')]['rawAttributes']);_0x4655dd[_0xe593('0x34')]=_[_0xe593('0x35')](_0x26f845[_0xe593('0x34')]);_0x4655dd[_0xe593('0x36')]=_[_0xe593('0x37')](_0x4655dd['model'],_0x4655dd['query']);_0x2cbcb3[_0xe593('0x38')]=_[_0xe593('0x37')](_0x4655dd[_0xe593('0x32')],qs['fields'](_0x26f845[_0xe593('0x34')][_0xe593('0x39')]));_0x2cbcb3['attributes']=_0x2cbcb3['attributes'][_0xe593('0x3a')]?_0x2cbcb3[_0xe593('0x38')]:_0x4655dd[_0xe593('0x32')];if(_0x26f845['query'][_0xe593('0x45')]){_0x2cbcb3[_0xe593('0x49')]=[{'all':!![]}];}_0x2cbcb3=_[_0xe593('0x41')]({},_0x2cbcb3,_0x26f845[_0xe593('0x43')]);return db['CmHopperFinal']['find'](_0x2cbcb3)['then'](handleEntityNotFound(_0x3f9784,null))['then'](respondWithResult(_0x3f9784,null))[_0xe593('0x47')](handleError(_0x3f9784,null));};exports['describe']=function(_0x248944,_0xd016b3){return db[_0xe593('0x2f')][_0xe593('0x4a')]()[_0xe593('0x44')](respondWithResult(_0xd016b3,null))[_0xe593('0x47')](handleError(_0xd016b3,null));};exports[_0xe593('0x28')]=function(_0x297c3e,_0x4c4f61){if(_0x297c3e[_0xe593('0x4b')][_0xe593('0x4c')]){delete _0x297c3e[_0xe593('0x4b')]['uniqueid'];}return db[_0xe593('0x2f')]['find']({'where':{'uniqueid':_0x297c3e[_0xe593('0x48')]['id']}})[_0xe593('0x44')](handleEntityNotFound(_0x4c4f61,null))[_0xe593('0x44')](saveUpdates(_0x297c3e['body'],null))['then'](respondWithResult(_0x4c4f61,null))[_0xe593('0x47')](handleError(_0x4c4f61,null));};exports[_0xe593('0x4d')]=function(_0x53db18,_0x4f6e9c,_0x4c46fc){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x53db18[_0xe593('0x48')]['id']},'attributes':[[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x51')))),_0xe593('0x52')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x53')))),_0xe593('0x54')],[db[_0xe593('0x4e')]['fn']('COUNT',db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x55')))),_0xe593('0x56')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x57')))),_0xe593('0x58')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db['sequelize'][_0xe593('0x50')](_0xe593('0x59')))),_0xe593('0x5a')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db['sequelize']['fn']('IF',db['sequelize'][_0xe593('0x50')](_0xe593('0x5b')))),_0xe593('0x5c')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0xe593('0x5d')],[db[_0xe593('0x4e')]['fn']('COUNT',db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x5e')))),_0xe593('0x5f')]]})[_0xe593('0x44')](handleEntityNotFound(_0x4f6e9c,null))[_0xe593('0x44')](respondWithResult(_0x4f6e9c,null))[_0xe593('0x47')](handleError(_0x4f6e9c,null));};exports[_0xe593('0x60')]=function(_0x3316b8,_0x5b3fcc,_0x36f38e){return db[_0xe593('0x2f')][_0xe593('0x61')]({'raw':![],'where':{'CampaignId':_0x3316b8[_0xe593('0x48')]['id']},'attributes':[[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db['sequelize'][_0xe593('0x50')](_0xe593('0x51')))),_0xe593('0x52')],[db[_0xe593('0x4e')]['fn']('COUNT',db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x53')))),_0xe593('0x54')],[db['sequelize']['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x55')))),_0xe593('0x56')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db['sequelize']['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x57')))),_0xe593('0x58')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')](_0xe593('0x59')))),'dropContacts'],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db['sequelize'][_0xe593('0x50')](_0xe593('0x5b')))),_0xe593('0x5c')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db['sequelize']['fn']('IF',db[_0xe593('0x4e')][_0xe593('0x50')]('`state`\x20=\x2022,\x201,\x20null'))),_0xe593('0x5d')],[db[_0xe593('0x4e')]['fn'](_0xe593('0x4f'),db[_0xe593('0x4e')]['fn']('IF',db['sequelize'][_0xe593('0x50')](_0xe593('0x5e')))),_0xe593('0x5f')]]})['then'](handleEntityNotFound(_0x5b3fcc,null))[_0xe593('0x44')](respondWithResult(_0x5b3fcc,null))[_0xe593('0x47')](handleError(_0x5b3fcc,null));};exports[_0xe593('0x62')]=function(_0x5bbf3d,_0xb6846a,_0x11eae2){return db[_0xe593('0x63')][_0xe593('0x64')]({'where':{'id':_0x5bbf3d[_0xe593('0x48')]['id']}})['then'](handleEntityNotFound(_0xb6846a,null))[_0xe593('0x44')](function(_0x1e3b77){var _0x2ceda4;if(_0x1e3b77){_0x2ceda4=squel[_0xe593('0x65')]()[_0xe593('0x66')](_0xe593('0x67'))[_0xe593('0x68')]([_0xe593('0x69'),_0xe593('0x6a'),_0xe593('0x6b'),_0xe593('0x6c'),_0xe593('0x6d'),_0xe593('0x6e'),_0xe593('0x6f')],squel['select']()[_0xe593('0x70')](_0xe593('0x71'),_0xe593('0x69'))[_0xe593('0x70')](_0xe593('0x72'),_0xe593('0x6a'))[_0xe593('0x70')](_0xe593('0x73'),'ContactId')['field']('ANY_VALUE(ListId)',_0xe593('0x6c'))[_0xe593('0x70')](_0xe593('0x74'),'VoiceQueueId')['field'](_0xe593('0x72'),'createdAt')[_0xe593('0x70')](_0xe593('0x72'),_0xe593('0x6f'))['from'](_0xe593('0x75'))[_0xe593('0x3e')](_0xe593('0x76'),_0x5bbf3d[_0xe593('0x48')]['id'][_0xe593('0x77')]())[_0xe593('0x3e')](_0xe593('0x78'),_0x5bbf3d['body'][_0xe593('0x79')][_0xe593('0x77')]())['where'](_0xe593('0x7a'))[_0xe593('0x3e')](_0xe593('0x7b'),squel['select']()[_0xe593('0x70')](_0xe593('0x69'))[_0xe593('0x7c')](_0xe593('0x67'))[_0xe593('0x3e')](_0xe593('0x76'),_0x5bbf3d['params']['id']['toString']()))[_0xe593('0x3e')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0xe593('0x7d'))[_0xe593('0x7c')](_0xe593('0x75'))[_0xe593('0x3e')](_0xe593('0x76'),_0x5bbf3d['params']['id']['toString']())[_0xe593('0x3e')](_0xe593('0x7e')))[_0xe593('0x7f')](_0xe593('0x6b')))['toString']();return db[_0xe593('0x4e')][_0xe593('0x34')](_0x2ceda4);}return[];})[_0xe593('0x44')](respondWithResult(_0xb6846a,null))['catch'](handleError(_0xb6846a,null));};exports[_0xe593('0x80')]=function(_0x454479,_0x4dd704,_0xc0904c){return db[_0xe593('0x81')]['find']({'where':{'id':_0x454479['params']['id']}})['then'](handleEntityNotFound(_0x4dd704,null))['then'](function(_0x552869){var _0x58b6b3;if(_0x552869){_0x58b6b3=squel[_0xe593('0x65')]()['into'](_0xe593('0x67'))[_0xe593('0x68')]([_0xe593('0x69'),'scheduledAt','ContactId',_0xe593('0x6c'),_0xe593('0x82'),_0xe593('0x6e'),_0xe593('0x6f')],squel['select']()['field'](_0xe593('0x71'),_0xe593('0x69'))['field'](_0xe593('0x72'),_0xe593('0x6a'))[_0xe593('0x70')](_0xe593('0x73'),_0xe593('0x6b'))['field'](_0xe593('0x83'),'ListId')[_0xe593('0x70')]('ANY_VALUE(CampaignId)',_0xe593('0x82'))['field']('NOW()',_0xe593('0x6e'))[_0xe593('0x70')](_0xe593('0x72'),'updatedAt')[_0xe593('0x7c')](_0xe593('0x75'))[_0xe593('0x3e')]('CampaignId\x20=\x20?',_0x454479[_0xe593('0x48')]['id']['toString']())[_0xe593('0x3e')](_0xe593('0x78'),_0x454479['body'][_0xe593('0x79')][_0xe593('0x77')]())[_0xe593('0x3e')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0xe593('0x7b'),squel['select']()[_0xe593('0x70')](_0xe593('0x69'))['from']('cm_hopper')[_0xe593('0x3e')](_0xe593('0x84'),_0x454479[_0xe593('0x48')]['id']['toString']()))[_0xe593('0x3e')](_0xe593('0x7b'),squel[_0xe593('0x85')]()[_0xe593('0x70')](_0xe593('0x7d'))[_0xe593('0x7c')]('cm_hopper_final')[_0xe593('0x3e')](_0xe593('0x84'),_0x454479[_0xe593('0x48')]['id'][_0xe593('0x77')]())[_0xe593('0x3e')](_0xe593('0x7e')))[_0xe593('0x7f')]('ContactId'))[_0xe593('0x77')]();return db[_0xe593('0x4e')][_0xe593('0x34')](_0x58b6b3);}return[];})['then'](respondWithResult(_0x4dd704,null))['catch'](handleError(_0x4dd704,null));};exports['checkContactHopper']=function(_0x102a9e,_0x29664e,_0x4f9cc8){return db[_0xe593('0x86')][_0xe593('0x87')]({'where':{'VoiceQueueId':_0x102a9e['body'][_0xe593('0x6d')],'CampaignId':_0x102a9e['body']['CampaignId'],'ContactId':_0x102a9e[_0xe593('0x4b')][_0xe593('0x6b')]}})[_0xe593('0x44')](handleEntityNotFound(_0x29664e,null))[_0xe593('0x44')](function(_0x3c517b){if(_0x3c517b){return _0x3c517b;}return null;})['then'](respondWithResult(_0x29664e,null))[_0xe593('0x47')](handleError(_0x29664e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ea012bd..038d5c2 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 _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 +var _0xb7f2=['exports','define','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','api','moment','path','rimraf','./cmHopperFinal.attributes'];(function(_0xb0479d,_0x5f219e){var _0x2c19a0=function(_0x6547ed){while(--_0x6547ed){_0xb0479d['push'](_0xb0479d['shift']());}};_0x2c19a0(++_0x5f219e);}(_0xb7f2,0xe9));var _0x2b7f=function(_0x25e9fd,_0x51f2fe){_0x25e9fd=_0x25e9fd-0x0;var _0x4f364c=_0xb7f2[_0x25e9fd];return _0x4f364c;};'use strict';var _=require('lodash');var util=require(_0x2b7f('0x0'));var logger=require(_0x2b7f('0x1'))(_0x2b7f('0x2'));var moment=require(_0x2b7f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b7f('0x4'));var rimraf=require(_0x2b7f('0x5'));var config=require('../../config/environment');var attributes=require(_0x2b7f('0x6'));module[_0x2b7f('0x7')]=function(_0x3adf21,_0x54bf3e){return _0x3adf21[_0x2b7f('0x8')](_0x2b7f('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x2b7f('0xa'),'fields':[_0x2b7f('0xa')]},{'name':_0x2b7f('0xb'),'fields':[_0x2b7f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ebe2975..efb19f9 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 _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 +var _0xfff7=['message','result','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0xbc9322,_0x1efff6){var _0x5b28cd=function(_0xac1c34){while(--_0xac1c34){_0xbc9322['push'](_0xbc9322['shift']());}};_0x5b28cd(++_0x1efff6);}(_0xfff7,0xea));var _0x7fff=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfff7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7fff('0x0'));var util=require(_0x7fff('0x1'));var moment=require(_0x7fff('0x2'));var BPromise=require(_0x7fff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fff('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7fff('0x5'));var jayson=require(_0x7fff('0x6'));var client=jayson[_0x7fff('0x7')][_0x7fff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf3e60f,_0x2a3c33,_0x54094b){return new BPromise(function(_0x1c0632,_0x35be6e){return client[_0x7fff('0x9')](_0xf3e60f,_0x54094b)[_0x7fff('0xa')](function(_0x463ff7){logger[_0x7fff('0xb')](_0x7fff('0xc'),_0x2a3c33,_0x7fff('0xd'));logger['debug']('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x2a3c33,_0x7fff('0xd'),JSON['stringify'](_0x463ff7));if(_0x463ff7[_0x7fff('0xe')]){if(_0x463ff7[_0x7fff('0xe')][_0x7fff('0xf')]===0x1f4){logger[_0x7fff('0xe')](_0x7fff('0xc'),_0x2a3c33,_0x463ff7[_0x7fff('0xe')][_0x7fff('0x10')]);return _0x35be6e(_0x463ff7[_0x7fff('0xe')]['message']);}logger['error'](_0x7fff('0xc'),_0x2a3c33,_0x463ff7[_0x7fff('0xe')][_0x7fff('0x10')]);return _0x1c0632(_0x463ff7[_0x7fff('0xe')][_0x7fff('0x10')]);}else{logger[_0x7fff('0xb')](_0x7fff('0xc'),_0x2a3c33,_0x7fff('0xd'));_0x1c0632(_0x463ff7[_0x7fff('0x11')][_0x7fff('0x10')]);}})['catch'](function(_0x55b8f0){logger['error'](_0x7fff('0xc'),_0x2a3c33,_0x55b8f0);_0x35be6e(_0x55b8f0);});});}exports['CreateCmHopperFinal']=function(_0x4cc4eb){var _0x4e6089=this;return new Promise(function(_0x2b911f,_0x50b55a){return db[_0x7fff('0x12')][_0x7fff('0x13')](_0x4cc4eb[_0x7fff('0x14')],{'raw':_0x4cc4eb[_0x7fff('0x15')]?_0x4cc4eb[_0x7fff('0x15')][_0x7fff('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1bada2){logger[_0x7fff('0xb')](_0x7fff('0x17'),_0x4cc4eb);logger['debug'](_0x7fff('0x17'),_0x4cc4eb,JSON['stringify'](_0x1bada2));_0x2b911f(_0x1bada2);})[_0x7fff('0x18')](function(_0x2077fe){logger[_0x7fff('0xe')](_0x7fff('0x17'),_0x2077fe[_0x7fff('0x10')],_0x4cc4eb);_0x50b55a(_0x4e6089['error'](0x1f4,_0x2077fe[_0x7fff('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 2c00074..a90900b 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 _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 +var _0xb57b=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0xf306f9,_0x6b06a6){var _0x8a4ca4=function(_0x4330a3){while(--_0x4330a3){_0xf306f9['push'](_0xf306f9['shift']());}};_0x8a4ca4(++_0x6b06a6);}(_0xb57b,0x6f));var _0xbb57=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb57b[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbb57('0x0'));var timeout=require(_0xbb57('0x1'));var express=require(_0xbb57('0x2'));var router=express[_0xbb57('0x3')]();var auth=require(_0xbb57('0x4'));var interaction=require(_0xbb57('0x5'));var config=require('../../config/environment');var controller=require(_0xbb57('0x6'));router['get']('/',auth[_0xbb57('0x7')](),controller[_0xbb57('0x8')]);router[_0xbb57('0x9')](_0xbb57('0xa'),auth[_0xbb57('0x7')](),controller[_0xbb57('0xb')]);router[_0xbb57('0x9')](_0xbb57('0xc'),auth[_0xbb57('0x7')](),controller[_0xbb57('0xd')]);router[_0xbb57('0x9')](_0xbb57('0xe'),auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router[_0xbb57('0x9')](_0xbb57('0xf'),auth[_0xbb57('0x7')](),controller['countContactsIvrCampaignHopperFinal']);router['post'](_0xbb57('0x10'),auth['isAuthenticated'](),controller[_0xbb57('0x11')]);router[_0xbb57('0x12')](_0xbb57('0x13'),auth['isAuthenticated'](),controller[_0xbb57('0x14')]);router[_0xbb57('0x12')]('/checkContactHopper',auth[_0xbb57('0x7')](),controller[_0xbb57('0x15')]);router[_0xbb57('0x16')](_0xbb57('0xc'),auth[_0xbb57('0x7')](),controller[_0xbb57('0x17')]);module[_0xbb57('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index e4f7006..dc7bee0 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 _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 +var _0x668d=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0x668d,0x1ce));var _0xd668=function(_0x51ab14,_0x179182){_0x51ab14=_0x51ab14-0x0;var _0x52f807=_0x668d[_0x51ab14];return _0x52f807;};'use strict';var Sequelize=require(_0xd668('0x0'));module[_0xd668('0x1')]={'state':{'type':Sequelize[_0xd668('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xd668('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd668('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd668('0x3')]},'calleridname':{'type':Sequelize[_0xd668('0x3')]},'starttime':{'type':Sequelize[_0xd668('0x4')]},'responsetime':{'type':Sequelize[_0xd668('0x4')]},'answertime':{'type':Sequelize[_0xd668('0x4')]},'droptime':{'type':Sequelize[_0xd668('0x4')]},'endtime':{'type':Sequelize[_0xd668('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xd668('0x3')]},'campaigntype':{'type':Sequelize[_0xd668('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd668('0x3')]},'amd':{'type':Sequelize[_0xd668('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd668('0x4')]},'recallme':{'type':Sequelize[_0xd668('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xd668('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd668('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd668('0x2')],'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 c813769..c76cd2e 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 _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 +var _0x00b3=['where','filter','VIRTUAL','merge','include','CmHopperHistory','findAll','rows','catch','show','params','keys','includeAll','options','create','body','describe','uniqueid','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','index','map','rawAttributes','fieldName','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x00b3,0xf1));var _0x300b=function(_0x2a2d8f,_0x11e70c){_0x2a2d8f=_0x2a2d8f-0x0;var _0x89c89c=_0x00b3[_0x2a2d8f];return _0x89c89c;};'use strict';var pdf=require(_0x300b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x300b('0x1'));var zipdir=require(_0x300b('0x2'));var jsonpatch=require(_0x300b('0x3'));var rp=require(_0x300b('0x4'));var moment=require(_0x300b('0x5'));var BPromise=require(_0x300b('0x6'));var Mustache=require(_0x300b('0x7'));var util=require(_0x300b('0x8'));var path=require(_0x300b('0x9'));var sox=require(_0x300b('0xa'));var csv=require(_0x300b('0xb'));var ejs=require(_0x300b('0xc'));var fs=require('fs');var _=require(_0x300b('0xd'));var squel=require(_0x300b('0xe'));var crypto=require('crypto');var jsforce=require(_0x300b('0xf'));var deskjs=require(_0x300b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x300b('0x11'));var Papa=require('papaparse');var Redis=require(_0x300b('0x12'));var authService=require(_0x300b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x300b('0x14'));var logger=require(_0x300b('0x15'))(_0x300b('0x16'));var utils=require(_0x300b('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x300b('0x18'))['db'];function respondWithStatusCode(_0xccf143,_0x387963){_0x387963=_0x387963||0xcc;return function(_0x3ae9a7){if(_0x3ae9a7){return _0xccf143[_0x300b('0x19')](_0x387963);}return _0xccf143[_0x300b('0x1a')](_0x387963)['end']();};}function respondWithResult(_0x5a9c30,_0x57c5e2){_0x57c5e2=_0x57c5e2||0xc8;return function(_0x18dd9f){if(_0x18dd9f){return _0x5a9c30[_0x300b('0x1a')](_0x57c5e2)[_0x300b('0x1b')](_0x18dd9f);}};}function respondWithFilteredResult(_0x166389,_0x43877e){return function(_0x1c8a7f){if(_0x1c8a7f){var _0xe92b85=_0x1c8a7f[_0x300b('0x1c')],_0x41aaf8=_0x43877e[_0x300b('0x1d')],_0x5af407=_0x43877e[_0x300b('0x1d')]+_0x43877e[_0x300b('0x1e')],_0x46bc3e;if(_0x5af407>=_0xe92b85){_0x5af407=_0xe92b85;_0x46bc3e=0xc8;}else{_0x46bc3e=0xce;}_0x166389[_0x300b('0x1a')](_0x46bc3e);return _0x166389['set'](_0x300b('0x1f'),_0x41aaf8+'-'+_0x5af407+'/'+_0xe92b85)['json'](_0x1c8a7f);}return null;};}function patchUpdates(_0x47d69f){return function(_0x41fc4a){try{jsonpatch[_0x300b('0x20')](_0x41fc4a,_0x47d69f,!![]);}catch(_0x4e3af8){return BPromise[_0x300b('0x21')](_0x4e3af8);}return _0x41fc4a[_0x300b('0x22')]();};}function saveUpdates(_0x1ac4cb,_0x516d4c){return function(_0x55ca35){if(_0x55ca35){return _0x55ca35[_0x300b('0x23')](_0x1ac4cb)['then'](function(_0x4b12bf){return _0x4b12bf;});}return null;};}function removeEntity(_0x178e3e,_0x21d607){return function(_0x4cae8c){if(_0x4cae8c){return _0x4cae8c[_0x300b('0x24')]()[_0x300b('0x25')](function(){_0x178e3e[_0x300b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cbd42,_0x1665ea){return function(_0x343cef){if(!_0x343cef){_0x4cbd42['sendStatus'](0x194);}return _0x343cef;};}function handleError(_0x49ba94,_0x354f47){_0x354f47=_0x354f47||0x1f4;return function(_0x12fbef){logger[_0x300b('0x26')](_0x12fbef['stack']);if(_0x12fbef['name']){delete _0x12fbef['name'];}_0x49ba94[_0x300b('0x1a')](_0x354f47)['send'](_0x12fbef);};}exports[_0x300b('0x27')]=function(_0x441558,_0x1cbe16){var _0x5c9edd={},_0x152afb={},_0xf7cdb3={'count':0x0,'rows':[]};var _0x4daa23=_[_0x300b('0x28')](db['CmHopperHistory'][_0x300b('0x29')],function(_0xb713f4){return{'name':_0xb713f4[_0x300b('0x2a')],'type':_0xb713f4['type']['key']};});_0x152afb['model']=_['map'](_0x4daa23,_0x300b('0x2b'));_0x152afb[_0x300b('0x2c')]=_['keys'](_0x441558[_0x300b('0x2c')]);_0x152afb[_0x300b('0x2d')]=_[_0x300b('0x2e')](_0x152afb['model'],_0x152afb[_0x300b('0x2c')]);_0x5c9edd[_0x300b('0x2f')]=_[_0x300b('0x2e')](_0x152afb[_0x300b('0x30')],qs[_0x300b('0x31')](_0x441558['query'][_0x300b('0x31')]));_0x5c9edd[_0x300b('0x2f')]=_0x5c9edd[_0x300b('0x2f')][_0x300b('0x32')]?_0x5c9edd[_0x300b('0x2f')]:_0x152afb['model'];if(!_0x441558[_0x300b('0x2c')][_0x300b('0x33')](_0x300b('0x34'))){_0x5c9edd['limit']=qs['limit'](_0x441558[_0x300b('0x2c')]['limit']);_0x5c9edd[_0x300b('0x1d')]=qs['offset'](_0x441558[_0x300b('0x2c')]['offset']);}_0x5c9edd[_0x300b('0x35')]=qs[_0x300b('0x36')](_0x441558['query'][_0x300b('0x36')]);_0x5c9edd[_0x300b('0x37')]=qs[_0x300b('0x2d')](_['pick'](_0x441558[_0x300b('0x2c')],_0x152afb[_0x300b('0x2d')]),_0x4daa23);if(_0x441558[_0x300b('0x2c')][_0x300b('0x38')]){_0x5c9edd[_0x300b('0x37')]=_['merge'](_0x5c9edd[_0x300b('0x37')],{'$or':_[_0x300b('0x28')](_0x4daa23,function(_0x59c848){if(_0x59c848['type']!==_0x300b('0x39')){var _0xeebf29={};_0xeebf29[_0x59c848[_0x300b('0x2b')]]={'$like':'%'+_0x441558[_0x300b('0x2c')][_0x300b('0x38')]+'%'};return _0xeebf29;}})});}_0x5c9edd=_[_0x300b('0x3a')]({},_0x5c9edd,_0x441558['options']);var _0x2ff766={'where':_0x5c9edd[_0x300b('0x37')]};return db['CmHopperHistory'][_0x300b('0x1c')](_0x2ff766)[_0x300b('0x25')](function(_0x4afa53){_0xf7cdb3[_0x300b('0x1c')]=_0x4afa53;if(_0x441558[_0x300b('0x2c')]['includeAll']){_0x5c9edd[_0x300b('0x3b')]=[{'all':!![]}];}return db[_0x300b('0x3c')][_0x300b('0x3d')](_0x5c9edd);})[_0x300b('0x25')](function(_0x455764){_0xf7cdb3[_0x300b('0x3e')]=_0x455764;return _0xf7cdb3;})[_0x300b('0x25')](respondWithFilteredResult(_0x1cbe16,_0x5c9edd))[_0x300b('0x3f')](handleError(_0x1cbe16,null));};exports[_0x300b('0x40')]=function(_0x32a7d6,_0x309df0){var _0x12655e={'raw':!![],'where':{'id':_0x32a7d6[_0x300b('0x41')]['id']}},_0x1bd683={};_0x1bd683[_0x300b('0x30')]=_[_0x300b('0x42')](db['CmHopperHistory'][_0x300b('0x29')]);_0x1bd683['query']=_[_0x300b('0x42')](_0x32a7d6[_0x300b('0x2c')]);_0x1bd683[_0x300b('0x2d')]=_[_0x300b('0x2e')](_0x1bd683[_0x300b('0x30')],_0x1bd683['query']);_0x12655e[_0x300b('0x2f')]=_[_0x300b('0x2e')](_0x1bd683[_0x300b('0x30')],qs['fields'](_0x32a7d6[_0x300b('0x2c')][_0x300b('0x31')]));_0x12655e['attributes']=_0x12655e['attributes'][_0x300b('0x32')]?_0x12655e['attributes']:_0x1bd683[_0x300b('0x30')];if(_0x32a7d6[_0x300b('0x2c')][_0x300b('0x43')]){_0x12655e[_0x300b('0x3b')]=[{'all':!![]}];}_0x12655e=_[_0x300b('0x3a')]({},_0x12655e,_0x32a7d6[_0x300b('0x44')]);return db['CmHopperHistory']['find'](_0x12655e)[_0x300b('0x25')](handleEntityNotFound(_0x309df0,null))[_0x300b('0x25')](respondWithResult(_0x309df0,null))[_0x300b('0x3f')](handleError(_0x309df0,null));};exports[_0x300b('0x45')]=function(_0x1776e0,_0xd8e2c5){return db[_0x300b('0x3c')][_0x300b('0x45')](_0x1776e0[_0x300b('0x46')],{})[_0x300b('0x25')](respondWithResult(_0xd8e2c5,0xc9))['catch'](handleError(_0xd8e2c5,null));};exports[_0x300b('0x47')]=function(_0x4d23cc,_0x4bae2e){return db[_0x300b('0x3c')][_0x300b('0x47')]()['then'](respondWithResult(_0x4bae2e,null))['catch'](handleError(_0x4bae2e,null));};exports[_0x300b('0x23')]=function(_0x81f16c,_0x5ea0ac){if(_0x81f16c[_0x300b('0x46')]['uniqueid']){delete _0x81f16c[_0x300b('0x46')][_0x300b('0x48')];}return db[_0x300b('0x3c')][_0x300b('0x49')]({'where':{'uniqueid':_0x81f16c[_0x300b('0x41')]['id']}})[_0x300b('0x25')](handleEntityNotFound(_0x5ea0ac,null))[_0x300b('0x25')](saveUpdates(_0x81f16c['body'],null))['then'](respondWithResult(_0x5ea0ac,null))[_0x300b('0x3f')](handleError(_0x5ea0ac,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 02af0b4..1160068 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 _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 +var _0x5e69=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime'];(function(_0x54d52,_0x2473ba){var _0x968345=function(_0x3fcd06){while(--_0x3fcd06){_0x54d52['push'](_0x54d52['shift']());}};_0x968345(++_0x2473ba);}(_0x5e69,0x141));var _0x95e6=function(_0x9ae07c,_0x4cba11){_0x9ae07c=_0x9ae07c-0x0;var _0x837b1f=_0x5e69[_0x9ae07c];return _0x837b1f;};'use strict';var _=require(_0x95e6('0x0'));var util=require(_0x95e6('0x1'));var logger=require(_0x95e6('0x2'))(_0x95e6('0x3'));var moment=require(_0x95e6('0x4'));var BPromise=require(_0x95e6('0x5'));var rp=require(_0x95e6('0x6'));var fs=require('fs');var path=require(_0x95e6('0x7'));var rimraf=require(_0x95e6('0x8'));var config=require(_0x95e6('0x9'));var attributes=require(_0x95e6('0xa'));module['exports']=function(_0x33fc86,_0x41db33){return _0x33fc86[_0x95e6('0xb')](_0x95e6('0xc'),attributes,{'tableName':_0x95e6('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x95e6('0xe')]},{'name':_0x95e6('0xf'),'fields':[_0x95e6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 3b74c9b..b8cffc2 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 _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 +var _0x0fa9=['`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','where','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','catch','AvgHandleTime','findAll','raw','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null'];(function(_0x1e7ef8,_0x2bd7db){var _0x23f1b5=function(_0x1b81bd){while(--_0x1b81bd){_0x1e7ef8['push'](_0x1e7ef8['shift']());}};_0x23f1b5(++_0x2bd7db);}(_0x0fa9,0x18c));var _0x90fa=function(_0x5d2ac6,_0x329381){_0x5d2ac6=_0x5d2ac6-0x0;var _0x728dd4=_0x0fa9[_0x5d2ac6];return _0x728dd4;};'use strict';var _=require(_0x90fa('0x0'));var util=require(_0x90fa('0x1'));var moment=require(_0x90fa('0x2'));var BPromise=require(_0x90fa('0x3'));var rs=require(_0x90fa('0x4'));var fs=require('fs');var Redis=require(_0x90fa('0x5'));var db=require(_0x90fa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x90fa('0x7'))(_0x90fa('0x8'));var config=require(_0x90fa('0x9'));var jayson=require(_0x90fa('0xa'));var client=jayson[_0x90fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x566a6b,_0x365f49,_0x3408f0){return new BPromise(function(_0x886ece,_0x39cde9){return client[_0x90fa('0xc')](_0x566a6b,_0x3408f0)[_0x90fa('0xd')](function(_0x4ea1d2){logger[_0x90fa('0xe')](_0x90fa('0xf'),_0x365f49,_0x90fa('0x10'));logger[_0x90fa('0x11')](_0x90fa('0x12'),_0x365f49,_0x90fa('0x10'),JSON[_0x90fa('0x13')](_0x4ea1d2));if(_0x4ea1d2[_0x90fa('0x14')]){if(_0x4ea1d2['error']['code']===0x1f4){logger[_0x90fa('0x14')](_0x90fa('0xf'),_0x365f49,_0x4ea1d2[_0x90fa('0x14')]['message']);return _0x39cde9(_0x4ea1d2[_0x90fa('0x14')][_0x90fa('0x15')]);}logger[_0x90fa('0x14')](_0x90fa('0xf'),_0x365f49,_0x4ea1d2[_0x90fa('0x14')][_0x90fa('0x15')]);return _0x886ece(_0x4ea1d2[_0x90fa('0x14')][_0x90fa('0x15')]);}else{logger[_0x90fa('0xe')](_0x90fa('0xf'),_0x365f49,_0x90fa('0x10'));_0x886ece(_0x4ea1d2['result'][_0x90fa('0x15')]);}})['catch'](function(_0x18adea){logger[_0x90fa('0x14')](_0x90fa('0xf'),_0x365f49,_0x18adea);_0x39cde9(_0x18adea);});});}exports[_0x90fa('0x16')]=function(_0x24c1fe){var _0x56826c=this;return new Promise(function(_0x1ef03c,_0xc92faa){return db[_0x90fa('0x17')][_0x90fa('0x18')](_0x24c1fe[_0x90fa('0x19')],{'raw':_0x24c1fe[_0x90fa('0x1a')]?_0x24c1fe[_0x90fa('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x90fa('0xd')](function(_0x3e3cd4){logger[_0x90fa('0xe')](_0x90fa('0x16'),_0x24c1fe);logger[_0x90fa('0x11')](_0x90fa('0x16'),_0x24c1fe,JSON[_0x90fa('0x13')](_0x3e3cd4));_0x1ef03c(_0x3e3cd4);})[_0x90fa('0x1b')](function(_0x5bc781){logger[_0x90fa('0x14')]('CreateCmHopperHistory',_0x5bc781['message'],_0x24c1fe);_0xc92faa(_0x56826c[_0x90fa('0x14')](0x1f4,_0x5bc781['message']));});});};exports[_0x90fa('0x1c')]=function(_0x4239a4){var _0x5ef86a=this;return new Promise(function(_0x49e7ad,_0x1eaa07){return db[_0x90fa('0x17')][_0x90fa('0x1d')]({'raw':_0x4239a4[_0x90fa('0x1a')]?_0x4239a4[_0x90fa('0x1a')][_0x90fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x4239a4[_0x90fa('0x1a')]?_0x4239a4[_0x90fa('0x1a')]['where']||null:null,'attributes':[[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')][_0x90fa('0x21')]('id')),_0x90fa('0x22')],[db['sequelize']['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x24')))),'predictiveIntervalAnsweredCalls'],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db['sequelize']['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x25')))),_0x90fa('0x26')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db['sequelize']['fn'](_0x90fa('0x28'),db['sequelize']['fn']('IF',db[_0x90fa('0x1f')]['literal'](_0x90fa('0x29')))),'predictiveIntervalAvgHoldtime'],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x28'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x2a')))),_0x90fa('0x2b')]]})[_0x90fa('0xd')](function(_0x284d59){logger['info'](_0x90fa('0x1c'),_0x4239a4);logger[_0x90fa('0x11')](_0x90fa('0x1c'),_0x4239a4,JSON[_0x90fa('0x13')](_0x284d59));_0x49e7ad(_0x284d59);})[_0x90fa('0x1b')](function(_0x238a41){logger[_0x90fa('0x14')]('AvgHandleTime',_0x238a41['message'],_0x4239a4);_0x1eaa07(_0x5ef86a['error'](0x1f4,_0x238a41[_0x90fa('0x15')]));});});};exports[_0x90fa('0x2c')]=function(_0x2a48b6){var _0x5c3ea=this;return new Promise(function(_0x469d49,_0x25b5d3){return db['CmHopperHistory']['findAll']({'raw':_0x2a48b6[_0x90fa('0x1a')]?_0x2a48b6[_0x90fa('0x1a')][_0x90fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x2a48b6['options']?_0x2a48b6[_0x90fa('0x1a')]['where']||null:null,'attributes':[['campaign',_0x90fa('0x2d')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x2e')))),_0x90fa('0x2f')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db['sequelize']['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x30')))),_0x90fa('0x31')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db['sequelize'][_0x90fa('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x90fa('0x32')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x33')))),_0x90fa('0x34')],[db['sequelize']['fn']('COUNT',db[_0x90fa('0x1f')]['fn']('IF',db['sequelize'][_0x90fa('0x23')](_0x90fa('0x35')))),_0x90fa('0x36')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db['sequelize'][_0x90fa('0x23')](_0x90fa('0x37')))),_0x90fa('0x38')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x90fa('0x39')],[db['sequelize']['fn']('COUNT',db[_0x90fa('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x90fa('0x3a')))),_0x90fa('0x3b')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x3c')))),_0x90fa('0x3d')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x3e')))),'outboundOriginateFailureCallsDay'],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0x90fa('0x23')](_0x90fa('0x3f')))),_0x90fa('0x40')],[db[_0x90fa('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x41')))),_0x90fa('0x42')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')](_0x90fa('0x43')))),_0x90fa('0x40')],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db['sequelize'][_0x90fa('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x90fa('0x44')]],'group':[_0x90fa('0x45')]})[_0x90fa('0xd')](function(_0x2d7c91){logger['info'](_0x90fa('0x2c'),_0x2a48b6);logger[_0x90fa('0x11')](_0x90fa('0x2c'),_0x2a48b6,JSON[_0x90fa('0x13')](_0x2d7c91));_0x469d49(_0x2d7c91);})[_0x90fa('0x1b')](function(_0x416ff1){logger[_0x90fa('0x14')](_0x90fa('0x2c'),_0x416ff1[_0x90fa('0x15')],_0x2a48b6);_0x25b5d3(_0x5c3ea[_0x90fa('0x14')](0x1f4,_0x416ff1[_0x90fa('0x15')]));});});};exports['GetCampaignHopperHistory']=function(_0x288980){var _0xb6c436=this;return new Promise(function(_0xf91b95,_0x5b779f){return db[_0x90fa('0x17')][_0x90fa('0x1d')]({'raw':_0x288980['options']?_0x288980[_0x90fa('0x1a')][_0x90fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x288980['options']?_0x288980['options'][_0x90fa('0x46')]||null:null,'attributes':[['campaign','name'],[db['sequelize']['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')][_0x90fa('0x21')]('id')),'ivrTotalCallsDays'],[db[_0x90fa('0x1f')]['fn'](_0x90fa('0x20'),db[_0x90fa('0x1f')]['fn']('IF',db[_0x90fa('0x1f')][_0x90fa('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x90fa('0x47')]],'group':[_0x90fa('0x45')]})['then'](function(_0x2debc9){logger['info']('GetCampaignHopperHistory',_0x288980);logger['debug'](_0x90fa('0x48'),_0x288980,JSON[_0x90fa('0x13')](_0x2debc9));_0xf91b95(_0x2debc9);})[_0x90fa('0x1b')](function(_0x28063c){logger[_0x90fa('0x14')](_0x90fa('0x48'),_0x28063c[_0x90fa('0x15')],_0x288980);_0x5b779f(_0xb6c436[_0x90fa('0x14')](0x1f4,_0x28063c[_0x90fa('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0ba6822..48e2d22 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 _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 +var _0xdf78=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','exports','multer'];(function(_0x3ceab8,_0x30486f){var _0x3e9fe3=function(_0x33bd73){while(--_0x33bd73){_0x3ceab8['push'](_0x3ceab8['shift']());}};_0x3e9fe3(++_0x30486f);}(_0xdf78,0x143));var _0x8df7=function(_0xb5e0dc,_0x4077b9){_0xb5e0dc=_0xb5e0dc-0x0;var _0x4653f7=_0xdf78[_0xb5e0dc];return _0x4653f7;};'use strict';var multer=require(_0x8df7('0x0'));var util=require(_0x8df7('0x1'));var path=require(_0x8df7('0x2'));var timeout=require(_0x8df7('0x3'));var express=require('express');var router=express[_0x8df7('0x4')]();var auth=require(_0x8df7('0x5'));var interaction=require(_0x8df7('0x6'));var config=require('../../config/environment');var controller=require(_0x8df7('0x7'));router[_0x8df7('0x8')]('/',auth[_0x8df7('0x9')](),controller[_0x8df7('0xa')]);router['get'](_0x8df7('0xb'),auth[_0x8df7('0x9')](),controller[_0x8df7('0xc')]);router['get'](_0x8df7('0xd'),auth['isAuthenticated'](),controller[_0x8df7('0xe')]);router[_0x8df7('0xf')]('/',auth[_0x8df7('0x9')](),controller[_0x8df7('0x10')]);router['put'](_0x8df7('0xd'),auth[_0x8df7('0x9')](),controller['update']);module[_0x8df7('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 0489ca8..711f978 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 _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 +var _0x2fe3=['STRING'];(function(_0x4522be,_0x275c0a){var _0x2eb717=function(_0x184231){while(--_0x184231){_0x4522be['push'](_0x4522be['shift']());}};_0x2eb717(++_0x275c0a);}(_0x2fe3,0x1aa));var _0x32fe=function(_0x44a2a1,_0x5645cc){_0x44a2a1=_0x44a2a1-0x0;var _0x23f91a=_0x2fe3[_0x44a2a1];return _0x23f91a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x32fe('0x0')]},'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 32457b4..e62c648 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(_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 +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(_0x595bb4,_0x36a3dd){var _0x235c88=function(_0x222c5b){while(--_0x222c5b){_0x595bb4['push'](_0x595bb4['shift']());}};_0x235c88(++_0x36a3dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);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 fea30da..af99a32 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 _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 +var _0xbc10=['../../mysqldb','CmList','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbc10,0x6b));var _0x0bc1=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0xbc10[_0xdc37a1];return _0x99b4fe;};'use strict';var EventEmitter=require(_0x0bc1('0x0'));var CmList=require(_0x0bc1('0x1'))['db'][_0x0bc1('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0bc1('0x3'),'afterUpdate':_0x0bc1('0x4'),'afterDestroy':_0x0bc1('0x5')};function emitEvent(_0x377570){return function(_0x4a8bfc,_0x4ae9ab,_0x5dadf2){CmListEvents[_0x0bc1('0x6')](_0x377570+':'+_0x4a8bfc['id'],_0x4a8bfc);CmListEvents[_0x0bc1('0x6')](_0x377570,_0x4a8bfc);_0x5dadf2(null);};}for(var e in events){if(events[_0x0bc1('0x7')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x0bc1('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 0bcab57..da4e29d 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 _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 +var _0x7480=['exports','define','cm_lists','lodash','util','../../config/logger','api','moment','path','rimraf','./cmList.attributes'];(function(_0x3fc4a6,_0x162174){var _0x3456f5=function(_0x379f42){while(--_0x379f42){_0x3fc4a6['push'](_0x3fc4a6['shift']());}};_0x3456f5(++_0x162174);}(_0x7480,0xc9));var _0x0748=function(_0x3b86c4,_0x1187c5){_0x3b86c4=_0x3b86c4-0x0;var _0x21bd24=_0x7480[_0x3b86c4];return _0x21bd24;};'use strict';var _=require(_0x0748('0x0'));var util=require(_0x0748('0x1'));var logger=require(_0x0748('0x2'))(_0x0748('0x3'));var moment=require(_0x0748('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0748('0x5'));var rimraf=require(_0x0748('0x6'));var config=require('../../config/environment');var attributes=require(_0x0748('0x7'));module[_0x0748('0x8')]=function(_0x51e15f,_0x40338d){return _0x51e15f[_0x0748('0x9')]('CmList',attributes,{'tableName':_0x0748('0xa'),'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 5042e48..a9be9b9 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 _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 +var _0xf722=['CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','debug'];(function(_0x2f9e08,_0x4f503c){var _0x1d973a=function(_0x135442){while(--_0x135442){_0x2f9e08['push'](_0x2f9e08['shift']());}};_0x1d973a(++_0x4f503c);}(_0xf722,0x197));var _0x2f72=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf722[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x2f72('0x0'));var moment=require(_0x2f72('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f72('0x2'));var fs=require('fs');var Redis=require(_0x2f72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2f72('0x4'));var logger=require(_0x2f72('0x5'))('rpc');var config=require(_0x2f72('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2f72('0x7')]({'port':0x232a});config[_0x2f72('0x8')]=_[_0x2f72('0x9')](config[_0x2f72('0x8')],{'host':_0x2f72('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2f72('0xb'))[_0x2f72('0xc')](socket);function respondWithRpcPromise(_0x5a5e96,_0x155bac,_0x20ae22){return new BPromise(function(_0x6290c1,_0x58ee6a){return client[_0x2f72('0xd')](_0x5a5e96,_0x20ae22)[_0x2f72('0xe')](function(_0x3cbcf9){logger[_0x2f72('0xf')](_0x2f72('0x10'),_0x155bac,'request\x20sent');logger[_0x2f72('0x11')](_0x2f72('0x12'),_0x155bac,_0x2f72('0x13'),JSON['stringify'](_0x3cbcf9));if(_0x3cbcf9[_0x2f72('0x14')]){if(_0x3cbcf9[_0x2f72('0x14')][_0x2f72('0x15')]===0x1f4){logger[_0x2f72('0x14')](_0x2f72('0x10'),_0x155bac,_0x3cbcf9[_0x2f72('0x14')]['message']);return _0x58ee6a(_0x3cbcf9['error']['message']);}logger[_0x2f72('0x14')](_0x2f72('0x10'),_0x155bac,_0x3cbcf9[_0x2f72('0x14')]['message']);return _0x6290c1(_0x3cbcf9[_0x2f72('0x14')][_0x2f72('0x16')]);}else{logger[_0x2f72('0xf')](_0x2f72('0x10'),_0x155bac,_0x2f72('0x13'));_0x6290c1(_0x3cbcf9[_0x2f72('0x17')][_0x2f72('0x16')]);}})[_0x2f72('0x18')](function(_0x329cee){logger[_0x2f72('0x14')](_0x2f72('0x10'),_0x155bac,_0x329cee);_0x58ee6a(_0x329cee);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7f2ee5b..4a424f6 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 _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 +var _0xe4b8=['save','remove','update','removeListener','register','length','./cmList.events'];(function(_0x2caa19,_0x4d8b3d){var _0x4652ea=function(_0x37021d){while(--_0x37021d){_0x2caa19['push'](_0x2caa19['shift']());}};_0x4652ea(++_0x4d8b3d);}(_0xe4b8,0x179));var _0x8e4b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe4b8[_0x36ed48];return _0x51c63a;};'use strict';var CmListEvents=require(_0x8e4b('0x0'));var events=[_0x8e4b('0x1'),_0x8e4b('0x2'),_0x8e4b('0x3')];function createListener(_0x42c835,_0x365269){return function(_0x1161a8){_0x365269['emit'](_0x42c835,_0x1161a8);};}function removeListener(_0x4fa340,_0x35e679){return function(){CmListEvents[_0x8e4b('0x4')](_0x4fa340,_0x35e679);};}exports[_0x8e4b('0x5')]=function(_0x47e630){for(var _0x2796f8=0x0,_0x4d0472=events[_0x8e4b('0x6')];_0x2796f8<_0x4d0472;_0x2796f8++){var _0x5642a3=events[_0x2796f8];var _0x4e0535=createListener('cmList:'+_0x5642a3,_0x47e630);CmListEvents['on'](_0x5642a3,_0x4e0535);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 32dc3b9..67135d7 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(_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 +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 bc62e2b..3734682 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_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 +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x4aedd4,_0x95f0f8){var _0x2eecee=function(_0x580199){while(--_0x580199){_0x4aedd4['push'](_0x4aedd4['shift']());}};_0x2eecee(++_0x95f0f8);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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 01504de..728309c 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 _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 +var _0x056e=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','body','Condition','find','params','catch','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','status'];(function(_0x310dae,_0x43fc81){var _0x1a1a57=function(_0x2d84a4){while(--_0x2d84a4){_0x310dae['push'](_0x310dae['shift']());}};_0x1a1a57(++_0x43fc81);}(_0x056e,0x166));var _0xe056=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x056e[_0x5447aa];return _0xb21e53;};'use strict';var pdf=require(_0xe056('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe056('0x1'));var zipdir=require(_0xe056('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe056('0x3'));var moment=require(_0xe056('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe056('0x5'));var util=require(_0xe056('0x6'));var path=require(_0xe056('0x7'));var sox=require(_0xe056('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe056('0x9'));var crypto=require('crypto');var jsforce=require(_0xe056('0xa'));var deskjs=require(_0xe056('0xb'));var toCsv=require(_0xe056('0xc'));var querystring=require('querystring');var Papa=require(_0xe056('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe056('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe056('0xf'));var logger=require(_0xe056('0x10'))(_0xe056('0x11'));var utils=require('../../config/utils');var config=require(_0xe056('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x248244,_0x2661f7){_0x2661f7=_0x2661f7||0xcc;return function(_0x2c4208){if(_0x2c4208){return _0x248244['sendStatus'](_0x2661f7);}return _0x248244[_0xe056('0x13')](_0x2661f7)['end']();};}function respondWithResult(_0x3452df,_0x3dfd98){_0x3dfd98=_0x3dfd98||0xc8;return function(_0x4f84cc){if(_0x4f84cc){return _0x3452df[_0xe056('0x13')](_0x3dfd98)[_0xe056('0x14')](_0x4f84cc);}};}function respondWithFilteredResult(_0x4157b7,_0x22138f){return function(_0xd4f886){if(_0xd4f886){var _0x4ac020=_0xd4f886[_0xe056('0x15')],_0x47379b=_0x22138f[_0xe056('0x16')],_0x1e0b79=_0x22138f['offset']+_0x22138f[_0xe056('0x17')],_0x283bf1;if(_0x1e0b79>=_0x4ac020){_0x1e0b79=_0x4ac020;_0x283bf1=0xc8;}else{_0x283bf1=0xce;}_0x4157b7['status'](_0x283bf1);return _0x4157b7[_0xe056('0x18')](_0xe056('0x19'),_0x47379b+'-'+_0x1e0b79+'/'+_0x4ac020)[_0xe056('0x14')](_0xd4f886);}return null;};}function patchUpdates(_0xc1caa9){return function(_0x5c258d){try{jsonpatch[_0xe056('0x1a')](_0x5c258d,_0xc1caa9,!![]);}catch(_0x1fbb19){return BPromise[_0xe056('0x1b')](_0x1fbb19);}return _0x5c258d[_0xe056('0x1c')]();};}function saveUpdates(_0x4fa46a,_0x5122cc){return function(_0x1e22bd){if(_0x1e22bd){return _0x1e22bd[_0xe056('0x1d')](_0x4fa46a)['then'](function(_0x333c69){return _0x333c69;});}return null;};}function removeEntity(_0x4f1c48,_0xa973b){return function(_0x4d65da){if(_0x4d65da){return _0x4d65da[_0xe056('0x1e')]()[_0xe056('0x1f')](function(){_0x4f1c48[_0xe056('0x13')](0xcc)[_0xe056('0x20')]();});}};}function handleEntityNotFound(_0x5277e3,_0x4448a9){return function(_0x377309){if(!_0x377309){_0x5277e3[_0xe056('0x21')](0x194);}return _0x377309;};}function handleError(_0x48de9c,_0x1df9ce){_0x1df9ce=_0x1df9ce||0x1f4;return function(_0x44235d){logger[_0xe056('0x22')](_0x44235d['stack']);if(_0x44235d[_0xe056('0x23')]){delete _0x44235d[_0xe056('0x23')];}_0x48de9c[_0xe056('0x13')](_0x1df9ce)[_0xe056('0x24')](_0x44235d);};}exports[_0xe056('0x1d')]=function(_0x3a03bf,_0x1c6253){if(_0x3a03bf[_0xe056('0x25')]['id']){delete _0x3a03bf['body']['id'];}return db[_0xe056('0x26')][_0xe056('0x27')]({'where':{'id':_0x3a03bf[_0xe056('0x28')]['id']}})[_0xe056('0x1f')](handleEntityNotFound(_0x1c6253,null))['then'](saveUpdates(_0x3a03bf[_0xe056('0x25')],null))[_0xe056('0x1f')](respondWithResult(_0x1c6253,null))[_0xe056('0x29')](handleError(_0x1c6253,null));};exports[_0xe056('0x1e')]=function(_0x13e3af,_0x2fb3e2){return db[_0xe056('0x26')][_0xe056('0x27')]({'where':{'id':_0x13e3af[_0xe056('0x28')]['id']}})[_0xe056('0x1f')](handleEntityNotFound(_0x2fb3e2,null))[_0xe056('0x1f')](removeEntity(_0x2fb3e2,null))[_0xe056('0x29')](handleError(_0x2fb3e2,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 56a7d25..04db2f7 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 _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 +var _0x3fb9=['Condition','tools_conditions','lodash','util','../../config/logger','bluebird','request-promise','path','./condition.attributes','exports','define'];(function(_0x5461c9,_0x4f8c19){var _0x1a6e68=function(_0x5cba0e){while(--_0x5cba0e){_0x5461c9['push'](_0x5461c9['shift']());}};_0x1a6e68(++_0x4f8c19);}(_0x3fb9,0x120));var _0x93fb=function(_0x51f47f,_0x335f0a){_0x51f47f=_0x51f47f-0x0;var _0x54e2c7=_0x3fb9[_0x51f47f];return _0x54e2c7;};'use strict';var _=require(_0x93fb('0x0'));var util=require(_0x93fb('0x1'));var logger=require(_0x93fb('0x2'))('api');var moment=require('moment');var BPromise=require(_0x93fb('0x3'));var rp=require(_0x93fb('0x4'));var fs=require('fs');var path=require(_0x93fb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x93fb('0x6'));module[_0x93fb('0x7')]=function(_0x59cc1b,_0x5540f8){return _0x59cc1b[_0x93fb('0x8')](_0x93fb('0x9'),attributes,{'tableName':_0x93fb('0xa'),'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 9e06d43..e6449ce 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 _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 +var _0x622c=['stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent'];(function(_0x5c5252,_0x377a2d){var _0x3b8dd2=function(_0x4f79d5){while(--_0x4f79d5){_0x5c5252['push'](_0x5c5252['shift']());}};_0x3b8dd2(++_0x377a2d);}(_0x622c,0xdf));var _0xc622=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x622c[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0xc622('0x0'));var util=require(_0xc622('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc622('0x2'));var fs=require('fs');var Redis=require(_0xc622('0x3'));var db=require(_0xc622('0x4'))['db'];var utils=require(_0xc622('0x5'));var logger=require(_0xc622('0x6'))(_0xc622('0x7'));var config=require(_0xc622('0x8'));var jayson=require(_0xc622('0x9'));var client=jayson[_0xc622('0xa')][_0xc622('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3af1f4,_0x169945,_0x4b1e8a){return new BPromise(function(_0x28f675,_0x1e077c){return client[_0xc622('0xc')](_0x3af1f4,_0x4b1e8a)[_0xc622('0xd')](function(_0x580f1a){logger[_0xc622('0xe')]('Condition,\x20%s,\x20%s',_0x169945,'request\x20sent');logger[_0xc622('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x169945,_0xc622('0x10'),JSON[_0xc622('0x11')](_0x580f1a));if(_0x580f1a[_0xc622('0x12')]){if(_0x580f1a[_0xc622('0x12')][_0xc622('0x13')]===0x1f4){logger[_0xc622('0x12')](_0xc622('0x14'),_0x169945,_0x580f1a[_0xc622('0x12')][_0xc622('0x15')]);return _0x1e077c(_0x580f1a['error'][_0xc622('0x15')]);}logger['error']('Condition,\x20%s,\x20%s',_0x169945,_0x580f1a[_0xc622('0x12')][_0xc622('0x15')]);return _0x28f675(_0x580f1a[_0xc622('0x12')][_0xc622('0x15')]);}else{logger[_0xc622('0xe')]('Condition,\x20%s,\x20%s',_0x169945,_0xc622('0x10'));_0x28f675(_0x580f1a[_0xc622('0x16')]['message']);}})[_0xc622('0x17')](function(_0x23a3eb){logger[_0xc622('0x12')](_0xc622('0x14'),_0x169945,_0x23a3eb);_0x1e077c(_0x23a3eb);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bbd5a8d..b413f42 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 _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 +var _0x1f35=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f35,0xd9));var _0x51f3=function(_0x46b4b1,_0x4943b0){_0x46b4b1=_0x46b4b1-0x0;var _0x5cb1c2=_0x1f35[_0x46b4b1];return _0x5cb1c2;};'use strict';var multer=require(_0x51f3('0x0'));var util=require(_0x51f3('0x1'));var path=require('path');var timeout=require(_0x51f3('0x2'));var express=require('express');var router=express[_0x51f3('0x3')]();var auth=require(_0x51f3('0x4'));var interaction=require(_0x51f3('0x5'));var config=require(_0x51f3('0x6'));var controller=require(_0x51f3('0x7'));router[_0x51f3('0x8')]('/:id',auth[_0x51f3('0x9')](),controller['update']);router[_0x51f3('0xa')]('/:id',auth[_0x51f3('0x9')](),controller['destroy']);module[_0x51f3('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 94e845f..143984f 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 _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 +var _0xf7f3=['STRING','name','INTEGER','sequelize','exports'];(function(_0x5a4ee1,_0x2454de){var _0x5406e7=function(_0x1c653c){while(--_0x1c653c){_0x5a4ee1['push'](_0x5a4ee1['shift']());}};_0x5406e7(++_0x2454de);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x41e581,_0x42de07){_0x41e581=_0x41e581-0x0;var _0x51e485=_0xf7f3[_0x41e581];return _0x51e485;};'use strict';var Sequelize=require(_0x3f7f('0x0'));module[_0x3f7f('0x1')]={'name':{'type':Sequelize[_0x3f7f('0x2')],'allowNull':![],'unique':_0x3f7f('0x3')},'OrderBy':{'type':Sequelize[_0x3f7f('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x3f7f('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 43f96e0..01d374e 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 _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 +var _0xbd18=['sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','html-pdf','eml-format','rimraf','fast-json-patch','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','UserProfileResource','error','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xbd18,0x195));var _0x8bd1=function(_0x29a434,_0x52548b){_0x29a434=_0x29a434-0x0;var _0x3a12ce=_0xbd18[_0x29a434];return _0x3a12ce;};'use strict';var pdf=require(_0x8bd1('0x0'));var emlformat=require(_0x8bd1('0x1'));var rimraf=require(_0x8bd1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bd1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8bd1('0x4'));var util=require(_0x8bd1('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x8bd1('0x6'));var ejs=require(_0x8bd1('0x7'));var fs=require('fs');var _=require(_0x8bd1('0x8'));var squel=require(_0x8bd1('0x9'));var crypto=require('crypto');var jsforce=require(_0x8bd1('0xa'));var deskjs=require(_0x8bd1('0xb'));var toCsv=require(_0x8bd1('0x6'));var querystring=require('querystring');var Papa=require(_0x8bd1('0xc'));var Redis=require(_0x8bd1('0xd'));var authService=require(_0x8bd1('0xe'));var qs=require(_0x8bd1('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8bd1('0x10'));var logger=require('../../config/logger')(_0x8bd1('0x11'));var utils=require(_0x8bd1('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8bd1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x186943,_0x37639b){_0x37639b=_0x37639b||0xcc;return function(_0x11d80a){if(_0x11d80a){return _0x186943[_0x8bd1('0x14')](_0x37639b);}return _0x186943[_0x8bd1('0x15')](_0x37639b)[_0x8bd1('0x16')]();};}function respondWithResult(_0x194812,_0x322d06){_0x322d06=_0x322d06||0xc8;return function(_0x44a6cd){if(_0x44a6cd){return _0x194812['status'](_0x322d06)[_0x8bd1('0x17')](_0x44a6cd);}};}function respondWithFilteredResult(_0x1d446d,_0x65d556){return function(_0x41b595){if(_0x41b595){var _0x63b01a=_0x41b595[_0x8bd1('0x18')],_0x222183=_0x65d556[_0x8bd1('0x19')],_0x5ba928=_0x65d556['offset']+_0x65d556['limit'],_0x3c4841;if(_0x5ba928>=_0x63b01a){_0x5ba928=_0x63b01a;_0x3c4841=0xc8;}else{_0x3c4841=0xce;}_0x1d446d[_0x8bd1('0x15')](_0x3c4841);return _0x1d446d[_0x8bd1('0x1a')](_0x8bd1('0x1b'),_0x222183+'-'+_0x5ba928+'/'+_0x63b01a)[_0x8bd1('0x17')](_0x41b595);}return null;};}function patchUpdates(_0x8c476){return function(_0x2d7217){try{jsonpatch[_0x8bd1('0x1c')](_0x2d7217,_0x8c476,!![]);}catch(_0x4731f3){return BPromise[_0x8bd1('0x1d')](_0x4731f3);}return _0x2d7217[_0x8bd1('0x1e')]();};}function saveUpdates(_0x58d428,_0x24a4c9){return function(_0x7e6619){if(_0x7e6619){return _0x7e6619[_0x8bd1('0x1f')](_0x58d428)[_0x8bd1('0x20')](function(_0x441975){return _0x441975;});}return null;};}function removeEntity(_0x3d51fb,_0x460f09){return function(_0x407a49){if(_0x407a49){return _0x407a49[_0x8bd1('0x21')]()[_0x8bd1('0x20')](function(){var _0x22dd62=_0x407a49[_0x8bd1('0x22')]({'plain':!![]});var _0x59f54e=_0x8bd1('0x23');return db[_0x8bd1('0x24')]['destroy']({'where':{'type':_0x59f54e,'resourceId':_0x22dd62['id']}})[_0x8bd1('0x20')](function(){return _0x407a49;});})[_0x8bd1('0x20')](function(){_0x3d51fb['status'](0xcc)[_0x8bd1('0x16')]();});}};}function handleEntityNotFound(_0x2394c5,_0x42e511){return function(_0x553a9c){if(!_0x553a9c){_0x2394c5[_0x8bd1('0x14')](0x194);}return _0x553a9c;};}function handleError(_0x1963dc,_0x4fbba6){_0x4fbba6=_0x4fbba6||0x1f4;return function(_0x5dfd09){logger[_0x8bd1('0x25')](_0x5dfd09['stack']);if(_0x5dfd09[_0x8bd1('0x26')]){delete _0x5dfd09['name'];}_0x1963dc['status'](_0x4fbba6)[_0x8bd1('0x27')](_0x5dfd09);};}exports[_0x8bd1('0x28')]=function(_0x34401e,_0x38d8a0){var _0x15b332={},_0xdf3834={},_0x4c0115={'count':0x0,'rows':[]};var _0x277723=_[_0x8bd1('0x29')](db[_0x8bd1('0x2a')][_0x8bd1('0x2b')],function(_0xa1ea8d){return{'name':_0xa1ea8d[_0x8bd1('0x2c')],'type':_0xa1ea8d[_0x8bd1('0x2d')][_0x8bd1('0x2e')]};});_0xdf3834['model']=_[_0x8bd1('0x29')](_0x277723,_0x8bd1('0x26'));_0xdf3834['query']=_[_0x8bd1('0x2f')](_0x34401e[_0x8bd1('0x30')]);_0xdf3834[_0x8bd1('0x31')]=_[_0x8bd1('0x32')](_0xdf3834[_0x8bd1('0x33')],_0xdf3834['query']);_0x15b332[_0x8bd1('0x34')]=_['intersection'](_0xdf3834['model'],qs[_0x8bd1('0x35')](_0x34401e[_0x8bd1('0x30')]['fields']));_0x15b332[_0x8bd1('0x34')]=_0x15b332['attributes'][_0x8bd1('0x36')]?_0x15b332[_0x8bd1('0x34')]:_0xdf3834[_0x8bd1('0x33')];if(!_0x34401e['query']['hasOwnProperty'](_0x8bd1('0x37'))){_0x15b332[_0x8bd1('0x38')]=qs[_0x8bd1('0x38')](_0x34401e[_0x8bd1('0x30')][_0x8bd1('0x38')]);_0x15b332[_0x8bd1('0x19')]=qs[_0x8bd1('0x19')](_0x34401e[_0x8bd1('0x30')][_0x8bd1('0x19')]);}_0x15b332['order']=qs['sort'](_0x34401e[_0x8bd1('0x30')][_0x8bd1('0x39')]);_0x15b332[_0x8bd1('0x3a')]=qs[_0x8bd1('0x31')](_[_0x8bd1('0x3b')](_0x34401e[_0x8bd1('0x30')],_0xdf3834[_0x8bd1('0x31')]),_0x277723);if(_0x34401e[_0x8bd1('0x30')][_0x8bd1('0x3c')]){_0x15b332['where']=_[_0x8bd1('0x3d')](_0x15b332[_0x8bd1('0x3a')],{'$or':_[_0x8bd1('0x29')](_0x277723,function(_0x7486fb){if(_0x7486fb['type']!=='VIRTUAL'){var _0x355fcd={};_0x355fcd[_0x7486fb[_0x8bd1('0x26')]]={'$like':'%'+_0x34401e['query']['filter']+'%'};return _0x355fcd;}})});}_0x15b332=_[_0x8bd1('0x3d')]({},_0x15b332,_0x34401e[_0x8bd1('0x3e')]);var _0x2a6ee0={'where':_0x15b332['where']};return db[_0x8bd1('0x2a')][_0x8bd1('0x18')](_0x2a6ee0)['then'](function(_0x16541f){_0x4c0115[_0x8bd1('0x18')]=_0x16541f;if(_0x34401e[_0x8bd1('0x30')][_0x8bd1('0x3f')]){_0x15b332[_0x8bd1('0x40')]=[{'all':!![]}];}return db['ContactItemType'][_0x8bd1('0x41')](_0x15b332);})[_0x8bd1('0x20')](function(_0xf755a0){_0x4c0115['rows']=_0xf755a0;return _0x4c0115;})[_0x8bd1('0x20')](respondWithFilteredResult(_0x38d8a0,_0x15b332))[_0x8bd1('0x42')](handleError(_0x38d8a0,null));};exports[_0x8bd1('0x43')]=function(_0x48a808,_0x3d6628){var _0x2a8914={'raw':!![],'where':{'id':_0x48a808['params']['id']}},_0x43c72e={};_0x43c72e[_0x8bd1('0x33')]=_[_0x8bd1('0x2f')](db[_0x8bd1('0x2a')]['rawAttributes']);_0x43c72e[_0x8bd1('0x30')]=_[_0x8bd1('0x2f')](_0x48a808[_0x8bd1('0x30')]);_0x43c72e['filters']=_[_0x8bd1('0x32')](_0x43c72e[_0x8bd1('0x33')],_0x43c72e[_0x8bd1('0x30')]);_0x2a8914[_0x8bd1('0x34')]=_[_0x8bd1('0x32')](_0x43c72e['model'],qs['fields'](_0x48a808['query'][_0x8bd1('0x35')]));_0x2a8914[_0x8bd1('0x34')]=_0x2a8914[_0x8bd1('0x34')][_0x8bd1('0x36')]?_0x2a8914[_0x8bd1('0x34')]:_0x43c72e['model'];if(_0x48a808['query'][_0x8bd1('0x3f')]){_0x2a8914[_0x8bd1('0x40')]=[{'all':!![]}];}_0x2a8914=_[_0x8bd1('0x3d')]({},_0x2a8914,_0x48a808[_0x8bd1('0x3e')]);return db[_0x8bd1('0x2a')][_0x8bd1('0x44')](_0x2a8914)[_0x8bd1('0x20')](handleEntityNotFound(_0x3d6628,null))[_0x8bd1('0x20')](respondWithResult(_0x3d6628,null))[_0x8bd1('0x42')](handleError(_0x3d6628,null));};exports[_0x8bd1('0x45')]=function(_0x1ff2e2,_0x26967a){return db[_0x8bd1('0x2a')][_0x8bd1('0x45')](_0x1ff2e2['body'],{})[_0x8bd1('0x20')](function(_0x4983e4){var _0x354a63=_0x1ff2e2[_0x8bd1('0x46')][_0x8bd1('0x22')]({'plain':!![]});if(!_0x354a63)throw new Error(_0x8bd1('0x47'));if(_0x354a63['role']===_0x8bd1('0x46')){var _0x48c715=_0x4983e4[_0x8bd1('0x22')]({'plain':!![]});var _0x1883f1=_0x8bd1('0x23');return db[_0x8bd1('0x48')][_0x8bd1('0x44')]({'where':{'name':_0x1883f1,'userProfileId':_0x354a63['userProfileId']},'raw':!![]})['then'](function(_0x441fcf){if(_0x441fcf&&_0x441fcf[_0x8bd1('0x49')]===0x0){return db[_0x8bd1('0x24')]['create']({'name':_0x48c715[_0x8bd1('0x26')],'resourceId':_0x48c715['id'],'type':_0x441fcf[_0x8bd1('0x26')],'sectionId':_0x441fcf['id']},{})[_0x8bd1('0x20')](function(){return _0x4983e4;});}else{return _0x4983e4;}})[_0x8bd1('0x42')](function(_0x239ef2){logger['error'](_0x8bd1('0x4a'),_0x239ef2);throw _0x239ef2;});}return _0x4983e4;})[_0x8bd1('0x20')](respondWithResult(_0x26967a,0xc9))['catch'](handleError(_0x26967a,null));};exports[_0x8bd1('0x1f')]=function(_0x466ae5,_0x48bcfb){if(_0x466ae5[_0x8bd1('0x4b')]['id']){delete _0x466ae5[_0x8bd1('0x4b')]['id'];}return db[_0x8bd1('0x2a')][_0x8bd1('0x44')]({'where':{'id':_0x466ae5[_0x8bd1('0x4c')]['id']}})[_0x8bd1('0x20')](handleEntityNotFound(_0x48bcfb,null))['then'](saveUpdates(_0x466ae5[_0x8bd1('0x4b')],null))['then'](respondWithResult(_0x48bcfb,null))['catch'](handleError(_0x48bcfb,null));};exports[_0x8bd1('0x21')]=function(_0x27424d,_0x232595){return db[_0x8bd1('0x2a')]['find']({'where':{'id':_0x27424d[_0x8bd1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x232595,null))[_0x8bd1('0x20')](removeEntity(_0x232595,null))[_0x8bd1('0x42')](handleError(_0x232595,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 2f74673..1868536 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 _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 +var _0x6bac=['../../config/environment','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird'];(function(_0x25f846,_0x392830){var _0x41318b=function(_0x3192eb){while(--_0x3192eb){_0x25f846['push'](_0x25f846['shift']());}};_0x41318b(++_0x392830);}(_0x6bac,0xa5));var _0xc6ba=function(_0x3c546f,_0x277f67){_0x3c546f=_0x3c546f-0x0;var _0x505714=_0x6bac[_0x3c546f];return _0x505714;};'use strict';var _=require(_0xc6ba('0x0'));var util=require('util');var logger=require(_0xc6ba('0x1'))(_0xc6ba('0x2'));var moment=require(_0xc6ba('0x3'));var BPromise=require(_0xc6ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc6ba('0x5'));var attributes=require(_0xc6ba('0x6'));module['exports']=function(_0x222f20,_0x2a16af){return _0x222f20[_0xc6ba('0x7')](_0xc6ba('0x8'),attributes,{'tableName':_0xc6ba('0x9'),'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 6217553..3a2c0af 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 _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 +var _0x780f=['ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x551f9e,_0x16cc2b){var _0x379fbb=function(_0x54214f){while(--_0x54214f){_0x551f9e['push'](_0x551f9e['shift']());}};_0x379fbb(++_0x16cc2b);}(_0x780f,0x6c));var _0xf780=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x780f[_0x1dd82f];return _0x353ca4;};'use strict';var _=require(_0xf780('0x0'));var util=require(_0xf780('0x1'));var moment=require(_0xf780('0x2'));var BPromise=require(_0xf780('0x3'));var rs=require(_0xf780('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf780('0x5'));var logger=require(_0xf780('0x6'))(_0xf780('0x7'));var config=require(_0xf780('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf780('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1bd856,_0x93539d,_0x1c3fdc){return new BPromise(function(_0xa12d00,_0x44f14c){return client[_0xf780('0xa')](_0x1bd856,_0x1c3fdc)['then'](function(_0x2c8221){logger[_0xf780('0xb')](_0xf780('0xc'),_0x93539d,_0xf780('0xd'));logger[_0xf780('0xe')](_0xf780('0xf'),_0x93539d,_0xf780('0xd'),JSON['stringify'](_0x2c8221));if(_0x2c8221['error']){if(_0x2c8221[_0xf780('0x10')][_0xf780('0x11')]===0x1f4){logger[_0xf780('0x10')](_0xf780('0xc'),_0x93539d,_0x2c8221['error'][_0xf780('0x12')]);return _0x44f14c(_0x2c8221[_0xf780('0x10')][_0xf780('0x12')]);}logger[_0xf780('0x10')]('ContactItemType,\x20%s,\x20%s',_0x93539d,_0x2c8221[_0xf780('0x10')]['message']);return _0xa12d00(_0x2c8221[_0xf780('0x10')][_0xf780('0x12')]);}else{logger[_0xf780('0xb')](_0xf780('0xc'),_0x93539d,_0xf780('0xd'));_0xa12d00(_0x2c8221[_0xf780('0x13')][_0xf780('0x12')]);}})['catch'](function(_0x450198){logger[_0xf780('0x10')](_0xf780('0xc'),_0x93539d,_0x450198);_0x44f14c(_0x450198);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 3c89e0d..f22436b 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 _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 +var _0x2126=['multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x2126,0x90));var _0x6212=function(_0x5e06af,_0x4cfd75){_0x5e06af=_0x5e06af-0x0;var _0x31c5c0=_0x2126[_0x5e06af];return _0x31c5c0;};'use strict';var multer=require(_0x6212('0x0'));var util=require(_0x6212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6212('0x2')]();var auth=require(_0x6212('0x3'));var interaction=require(_0x6212('0x4'));var config=require(_0x6212('0x5'));var controller=require(_0x6212('0x6'));router[_0x6212('0x7')]('/',auth[_0x6212('0x8')](),controller['index']);router[_0x6212('0x7')](_0x6212('0x9'),auth['isAuthenticated'](),controller[_0x6212('0xa')]);router[_0x6212('0xb')]('/',auth[_0x6212('0x8')](),controller[_0x6212('0xc')]);router[_0x6212('0xd')](_0x6212('0x9'),auth[_0x6212('0x8')](),controller[_0x6212('0xe')]);router[_0x6212('0xf')]('/:id',auth[_0x6212('0x8')](),controller[_0x6212('0x10')]);module[_0x6212('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 0f88755..ea40657 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 _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 +var _0xee3c=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee3c,0x14a));var _0xcee3=function(_0x2ef6b5,_0x1a54b1){_0x2ef6b5=_0x2ef6b5-0x0;var _0xce9b84=_0xee3c[_0x2ef6b5];return _0xce9b84;};'use strict';var Sequelize=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'name':{'type':Sequelize[_0xcee3('0x2')],'allowNull':![],'unique':_0xcee3('0x3')},'description':{'type':Sequelize[_0xcee3('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index ad9ecd7..3d23580 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 _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 +var _0x5998=['attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','CustomDashboards','end','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','attrUrl','attrs','https://','attrPath','value','attrHourFormat','HH:mm:ss','0.00'];(function(_0x5410c7,_0x36e6cc){var _0x236d4a=function(_0x54a028){while(--_0x54a028){_0x5410c7['push'](_0x5410c7['shift']());}};_0x236d4a(++_0x36e6cc);}(_0x5998,0xfd));var _0x8599=function(_0x2fe898,_0x41c211){_0x2fe898=_0x2fe898-0x0;var _0x17a825=_0x5998[_0x2fe898];return _0x17a825;};'use strict';var pdf=require(_0x8599('0x0'));var emlformat=require(_0x8599('0x1'));var rimraf=require(_0x8599('0x2'));var zipdir=require(_0x8599('0x3'));var jsonpatch=require(_0x8599('0x4'));var rp=require(_0x8599('0x5'));var moment=require(_0x8599('0x6'));var BPromise=require(_0x8599('0x7'));var Mustache=require(_0x8599('0x8'));var util=require(_0x8599('0x9'));var path=require('path');var sox=require(_0x8599('0xa'));var csv=require(_0x8599('0xb'));var ejs=require(_0x8599('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8599('0xd'));var crypto=require('crypto');var jsforce=require(_0x8599('0xe'));var deskjs=require(_0x8599('0xf'));var toCsv=require(_0x8599('0xb'));var querystring=require(_0x8599('0x10'));var Papa=require(_0x8599('0x11'));var Redis=require(_0x8599('0x12'));var authService=require(_0x8599('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8599('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8599('0x15'))(_0x8599('0x16'));var utils=require(_0x8599('0x17'));var config=require(_0x8599('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8599('0x19'))['db'];config[_0x8599('0x1a')]=_['defaults'](config[_0x8599('0x1a')],{'host':_0x8599('0x1b'),'port':0x18eb});var socket=require(_0x8599('0x1c'))(new Redis(config[_0x8599('0x1a')]));require(_0x8599('0x1d'))['register'](socket);function respondWithStatusCode(_0x18115b,_0x439242){_0x439242=_0x439242||0xcc;return function(_0x30fd83){if(_0x30fd83){return _0x18115b[_0x8599('0x1e')](_0x439242);}return _0x18115b[_0x8599('0x1f')](_0x439242)['end']();};}function respondWithResult(_0x5933cd,_0x246e4c){_0x246e4c=_0x246e4c||0xc8;return function(_0x45f243){if(_0x45f243){return _0x5933cd['status'](_0x246e4c)[_0x8599('0x20')](_0x45f243);}};}function respondWithFilteredResult(_0x179029,_0x56a7a5){return function(_0x141589){if(_0x141589){var _0x139c25=_0x141589[_0x8599('0x21')],_0x5bc85b=_0x56a7a5[_0x8599('0x22')],_0x242750=_0x56a7a5[_0x8599('0x22')]+_0x56a7a5[_0x8599('0x23')],_0xf4fed7;if(_0x242750>=_0x139c25){_0x242750=_0x139c25;_0xf4fed7=0xc8;}else{_0xf4fed7=0xce;}_0x179029['status'](_0xf4fed7);return _0x179029[_0x8599('0x24')](_0x8599('0x25'),_0x5bc85b+'-'+_0x242750+'/'+_0x139c25)['json'](_0x141589);}return null;};}function patchUpdates(_0x41a069){return function(_0x341961){try{jsonpatch[_0x8599('0x26')](_0x341961,_0x41a069,!![]);}catch(_0x4baef4){return BPromise['reject'](_0x4baef4);}return _0x341961[_0x8599('0x27')]();};}function saveUpdates(_0x5dde41,_0x1f17f6){return function(_0x3e1360){if(_0x3e1360){return _0x3e1360[_0x8599('0x28')](_0x5dde41)[_0x8599('0x29')](function(_0x1c4e16){return _0x1c4e16;});}return null;};}function removeEntity(_0x16bf93,_0x43a90a){return function(_0x3b350f){if(_0x3b350f){return _0x3b350f[_0x8599('0x2a')]()[_0x8599('0x29')](function(){var _0x424b38=_0x3b350f[_0x8599('0x2b')]({'plain':!![]});var _0x5e36c2=_0x8599('0x2c');return db['UserProfileResource'][_0x8599('0x2a')]({'where':{'type':_0x5e36c2,'resourceId':_0x424b38['id']}})['then'](function(){return _0x3b350f;});})['then'](function(){_0x16bf93[_0x8599('0x1f')](0xcc)[_0x8599('0x2d')]();});}};}function handleEntityNotFound(_0x27767c,_0x50cc72){return function(_0x2b8e0f){if(!_0x2b8e0f){_0x27767c['sendStatus'](0x194);}return _0x2b8e0f;};}function handleError(_0x48ba92,_0x37aa27){_0x37aa27=_0x37aa27||0x1f4;return function(_0x48c6b4){logger['error'](_0x48c6b4['stack']);if(_0x48c6b4['name']){delete _0x48c6b4[_0x8599('0x2e')];}_0x48ba92['status'](_0x37aa27)['send'](_0x48c6b4);};}exports[_0x8599('0x2f')]=function(_0x363999,_0x19c61c){var _0x192339={},_0x158f3d={},_0x37c857={'count':0x0,'rows':[]};var _0x1c8ddf=_[_0x8599('0x30')](db[_0x8599('0x31')][_0x8599('0x32')],function(_0x4e2728){return{'name':_0x4e2728[_0x8599('0x33')],'type':_0x4e2728[_0x8599('0x34')][_0x8599('0x35')]};});_0x158f3d[_0x8599('0x36')]=_['map'](_0x1c8ddf,_0x8599('0x2e'));_0x158f3d[_0x8599('0x37')]=_[_0x8599('0x38')](_0x363999[_0x8599('0x37')]);_0x158f3d[_0x8599('0x39')]=_[_0x8599('0x3a')](_0x158f3d['model'],_0x158f3d[_0x8599('0x37')]);_0x192339[_0x8599('0x3b')]=_['intersection'](_0x158f3d[_0x8599('0x36')],qs[_0x8599('0x3c')](_0x363999[_0x8599('0x37')]['fields']));_0x192339[_0x8599('0x3b')]=_0x192339[_0x8599('0x3b')][_0x8599('0x3d')]?_0x192339[_0x8599('0x3b')]:_0x158f3d[_0x8599('0x36')];if(!_0x363999['query']['hasOwnProperty'](_0x8599('0x3e'))){_0x192339[_0x8599('0x23')]=qs[_0x8599('0x23')](_0x363999['query'][_0x8599('0x23')]);_0x192339['offset']=qs[_0x8599('0x22')](_0x363999[_0x8599('0x37')]['offset']);}_0x192339[_0x8599('0x3f')]=qs[_0x8599('0x40')](_0x363999['query']['sort']);_0x192339[_0x8599('0x41')]=qs['filters'](_[_0x8599('0x42')](_0x363999[_0x8599('0x37')],_0x158f3d['filters']),_0x1c8ddf);if(_0x363999[_0x8599('0x37')][_0x8599('0x43')]){_0x192339[_0x8599('0x41')]=_[_0x8599('0x44')](_0x192339[_0x8599('0x41')],{'$or':_['map'](_0x1c8ddf,function(_0x50c0c6){if(_0x50c0c6[_0x8599('0x34')]!=='VIRTUAL'){var _0x2ce7e3={};_0x2ce7e3[_0x50c0c6[_0x8599('0x2e')]]={'$like':'%'+_0x363999['query'][_0x8599('0x43')]+'%'};return _0x2ce7e3;}})});}_0x192339=_[_0x8599('0x44')]({},_0x192339,_0x363999[_0x8599('0x45')]);var _0xd395f8={'where':_0x192339[_0x8599('0x41')]};return db['Dashboard'][_0x8599('0x21')](_0xd395f8)[_0x8599('0x29')](function(_0x361c27){_0x37c857[_0x8599('0x21')]=_0x361c27;if(_0x363999[_0x8599('0x37')][_0x8599('0x46')]){_0x192339[_0x8599('0x47')]=[{'all':!![]}];}return db['Dashboard'][_0x8599('0x48')](_0x192339);})[_0x8599('0x29')](function(_0x401a13){_0x37c857[_0x8599('0x49')]=_0x401a13;return _0x37c857;})[_0x8599('0x29')](respondWithFilteredResult(_0x19c61c,_0x192339))[_0x8599('0x4a')](handleError(_0x19c61c,null));};exports[_0x8599('0x4b')]=function(_0x2521b3,_0x2e52e7){var _0x245de5={'raw':![],'where':{'id':_0x2521b3[_0x8599('0x4c')]['id']}},_0x44f90c={};_0x44f90c[_0x8599('0x36')]=_[_0x8599('0x38')](db[_0x8599('0x31')]['rawAttributes']);_0x44f90c[_0x8599('0x37')]=_['keys'](_0x2521b3[_0x8599('0x37')]);_0x44f90c[_0x8599('0x39')]=_[_0x8599('0x3a')](_0x44f90c[_0x8599('0x36')],_0x44f90c[_0x8599('0x37')]);_0x245de5[_0x8599('0x3b')]=_['intersection'](_0x44f90c['model'],qs[_0x8599('0x3c')](_0x2521b3[_0x8599('0x37')][_0x8599('0x3c')]));_0x245de5[_0x8599('0x3b')]=_0x245de5[_0x8599('0x3b')][_0x8599('0x3d')]?_0x245de5[_0x8599('0x3b')]:_0x44f90c[_0x8599('0x36')];if(_0x2521b3[_0x8599('0x37')][_0x8599('0x46')]){_0x245de5[_0x8599('0x47')]=[{'all':!![]}];}_0x245de5=_[_0x8599('0x44')]({},_0x245de5,_0x2521b3[_0x8599('0x45')]);return db[_0x8599('0x31')]['find'](_0x245de5)[_0x8599('0x29')](handleEntityNotFound(_0x2e52e7,null))['then'](respondWithResult(_0x2e52e7,null))[_0x8599('0x4a')](handleError(_0x2e52e7,null));};exports['create']=function(_0x2ddc50,_0x56ed51){return db[_0x8599('0x31')]['create'](_0x2ddc50[_0x8599('0x4d')],{})[_0x8599('0x29')](function(_0x2ed1dd){var _0x11d446=_0x2ddc50['user'][_0x8599('0x2b')]({'plain':!![]});if(!_0x11d446)throw new Error(_0x8599('0x4e'));if(_0x11d446[_0x8599('0x4f')]===_0x8599('0x50')){var _0x53aa8f=_0x2ed1dd[_0x8599('0x2b')]({'plain':!![]});var _0x511d63='CustomDashboards';return db[_0x8599('0x51')][_0x8599('0x52')]({'where':{'name':_0x511d63,'userProfileId':_0x11d446['userProfileId']},'raw':!![]})[_0x8599('0x29')](function(_0x3b391c){if(_0x3b391c&&_0x3b391c[_0x8599('0x53')]===0x0){return db[_0x8599('0x54')][_0x8599('0x55')]({'name':_0x53aa8f[_0x8599('0x2e')],'resourceId':_0x53aa8f['id'],'type':_0x3b391c[_0x8599('0x2e')],'sectionId':_0x3b391c['id']},{})['then'](function(){return _0x2ed1dd;});}else{return _0x2ed1dd;}})[_0x8599('0x4a')](function(_0x2107c8){logger[_0x8599('0x56')](_0x8599('0x57'),_0x2107c8);throw _0x2107c8;});}return _0x2ed1dd;})[_0x8599('0x29')](respondWithResult(_0x56ed51,0xc9))[_0x8599('0x4a')](handleError(_0x56ed51,null));};exports[_0x8599('0x58')]=function(_0x3cf797,_0x4a3190){var _0x4896ac={'where':{'id':_0x3cf797[_0x8599('0x4c')]['id']}},_0x2857a2={};_0x2857a2[_0x8599('0x36')]=_[_0x8599('0x38')](db[_0x8599('0x31')][_0x8599('0x32')]);_0x4896ac[_0x8599('0x3b')]=_[_0x8599('0x3a')](_0x2857a2[_0x8599('0x36')],qs[_0x8599('0x3c')](_0x3cf797[_0x8599('0x37')]['fields']));_0x4896ac[_0x8599('0x3b')]=_0x4896ac[_0x8599('0x3b')][_0x8599('0x3d')]?_0x4896ac['attributes']:_0x2857a2[_0x8599('0x36')];if(_0x3cf797[_0x8599('0x37')]['includeAll']){_0x4896ac['include']=[{'all':!![]}];}_0x4896ac=_['merge']({},_0x4896ac,_0x3cf797['options']);return db['Dashboard'][_0x8599('0x52')](_0x4896ac)['then'](handleEntityNotFound(_0x4a3190,null))[_0x8599('0x29')](function(_0xd61064){if(_0xd61064){var _0x2726de=_0xd61064[_0x8599('0x2b')]({'plain':!![]});_0x2726de=qs['omit'](_0x2726de,['id','createdAt',_0x8599('0x59')]);_0x3cf797[_0x8599('0x4d')]=_['omit'](_0x3cf797['body'],['id','createdAt',_0x8599('0x59')]);return db[_0x8599('0x31')][_0x8599('0x55')](_[_0x8599('0x44')](_0x2726de,_0x3cf797[_0x8599('0x4d')]),{'include':_0x3cf797[_0x8599('0x37')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x5d7f4f){var _0x2b075d=_0x3cf797['user'][_0x8599('0x2b')]({'plain':!![]});if(!_0x2b075d)throw new Error(_0x8599('0x4e'));if(_0x2b075d[_0x8599('0x4f')]===_0x8599('0x50')){var _0x3fbc23=_0x5d7f4f[_0x8599('0x2b')]({'plain':!![]});var _0x2e91c2=_0x8599('0x2c');return db[_0x8599('0x51')]['find']({'where':{'name':_0x2e91c2,'userProfileId':_0x2b075d['userProfileId']},'raw':!![]})[_0x8599('0x29')](function(_0x4a2860){if(_0x4a2860&&_0x4a2860['autoAssociation']===0x0){return db[_0x8599('0x54')]['create']({'name':_0x3fbc23[_0x8599('0x2e')],'resourceId':_0x3fbc23['id'],'type':_0x4a2860[_0x8599('0x2e')],'sectionId':_0x4a2860['id']},{})[_0x8599('0x29')](function(){return _0x5d7f4f;});}else{return _0x5d7f4f;}})[_0x8599('0x4a')](function(_0x526c10){logger[_0x8599('0x56')](_0x8599('0x57'),_0x526c10);throw _0x526c10;});}return _0x5d7f4f;});}})[_0x8599('0x29')](respondWithResult(_0x4a3190,0xc9))[_0x8599('0x4a')](handleError(_0x4a3190,null));};exports['update']=function(_0x2ea24a,_0x26daec){if(_0x2ea24a[_0x8599('0x4d')]['id']){delete _0x2ea24a[_0x8599('0x4d')]['id'];}return db[_0x8599('0x31')][_0x8599('0x52')]({'where':{'id':_0x2ea24a[_0x8599('0x4c')]['id']}})[_0x8599('0x29')](handleEntityNotFound(_0x26daec,null))[_0x8599('0x29')](saveUpdates(_0x2ea24a[_0x8599('0x4d')],null))[_0x8599('0x29')](respondWithResult(_0x26daec,null))[_0x8599('0x4a')](handleError(_0x26daec,null));};exports['destroy']=function(_0x52efd7,_0x84ddf8){return db[_0x8599('0x31')]['find']({'where':{'id':_0x52efd7['params']['id']}})[_0x8599('0x29')](handleEntityNotFound(_0x84ddf8,null))[_0x8599('0x29')](removeEntity(_0x84ddf8,null))[_0x8599('0x4a')](handleError(_0x84ddf8,null));};function widgetAttributes(_0xa95c68){try{switch(_0xa95c68[_0x8599('0x34')]){case'iframe':return[{'name':_0x8599('0x5a'),'value':_0xa95c68[_0x8599('0x5a')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68['attrs'][0x0]?_0xa95c68['attrs'][0x0]['value']:undefined)||_0x8599('0x5c')}];case'custom':return[{'name':_0x8599('0x5d'),'value':_0xa95c68['attrPath']||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68[_0x8599('0x5b')][0x0]?_0xa95c68[_0x8599('0x5b')][0x0][_0x8599('0x5e')]:undefined)||''}];case'clock':return[{'name':_0x8599('0x5f'),'value':_0xa95c68[_0x8599('0x5f')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68[_0x8599('0x5b')][0x0]?_0xa95c68['attrs'][0x0]['value']:undefined)||_0x8599('0x60')},{'name':'attrTimezone','value':_0xa95c68['attrTimezone']||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68['attrs'][0x1]?_0xa95c68['attrs'][0x1][_0x8599('0x5e')]:undefined)||_0x8599('0x61')},{'name':'attrFontSize','value':_0xa95c68[_0x8599('0x62')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68['attrs'][0x2]?_0xa95c68[_0x8599('0x5b')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x8599('0x63'),'value':_0xa95c68['attrMetric']||(_0xa95c68['attrs']&&_0xa95c68[_0x8599('0x5b')][0x0]?_0xa95c68[_0x8599('0x5b')][0x0][_0x8599('0x5e')]:undefined)||_0x8599('0x64')},{'name':_0x8599('0x65'),'value':_0xa95c68[_0x8599('0x65')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68[_0x8599('0x5b')][0x1]?_0xa95c68[_0x8599('0x5b')][0x1][_0x8599('0x5e')]:undefined)||[]},{'name':_0x8599('0x62'),'value':_0xa95c68[_0x8599('0x62')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68['attrs'][0x2]?_0xa95c68[_0x8599('0x5b')][0x2][_0x8599('0x5e')]:undefined)||0x14}];case _0x8599('0x66'):case _0x8599('0x67'):return[{'name':'attrSerie1','value':_0xa95c68[_0x8599('0x68')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68[_0x8599('0x5b')][0x0]?_0xa95c68[_0x8599('0x5b')][0x0][_0x8599('0x5e')]:undefined)||'total'},{'name':_0x8599('0x69'),'value':_0xa95c68['attrSerie2']||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68['attrs'][0x1]?_0xa95c68[_0x8599('0x5b')][0x1][_0x8599('0x5e')]:undefined)||null},{'name':_0x8599('0x6a'),'value':_0xa95c68[_0x8599('0x6a')]||(_0xa95c68['attrs']&&_0xa95c68['attrs'][0x2]?_0xa95c68[_0x8599('0x5b')][0x2]['value']:undefined)||null},{'name':_0x8599('0x65'),'value':_0xa95c68['attrVoiceQueues']||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68[_0x8599('0x5b')][0x3]?_0xa95c68[_0x8599('0x5b')][0x3][_0x8599('0x5e')]:undefined)||[]}];case'web-report':return[{'name':'attrReport','type':_0xa95c68[_0x8599('0x6b')]||(_0xa95c68['attrs']&&_0xa95c68['attrs'][0x0]?_0xa95c68[_0x8599('0x5b')][0x0][_0x8599('0x34')]:undefined)||null,'value':_0xa95c68[_0x8599('0x6c')]||(_0xa95c68[_0x8599('0x5b')]&&_0xa95c68[_0x8599('0x5b')][0x0]?_0xa95c68['attrs'][0x0][_0x8599('0x5e')]:undefined)||null},{'name':_0x8599('0x6d'),'value':_0xa95c68[_0x8599('0x6d')]||(_0xa95c68['attrs']&&_0xa95c68[_0x8599('0x5b')][0x1]?_0xa95c68[_0x8599('0x5b')][0x1][_0x8599('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x5f5d1f){logger[_0x8599('0x56')](_0x8599('0x6e'),JSON[_0x8599('0x6f')](_0x5f5d1f));return[];}}exports[_0x8599('0x70')]=function(_0x50dc68,_0x168db8,_0x18c4e5){if(_0x50dc68[_0x8599('0x4d')]['id']){delete _0x50dc68[_0x8599('0x4d')]['id'];}return db[_0x8599('0x31')]['find']({'where':{'id':_0x50dc68[_0x8599('0x4c')]['id']}})[_0x8599('0x29')](handleEntityNotFound(_0x168db8,null))[_0x8599('0x29')](function(_0x1122b9){if(_0x1122b9){_0x50dc68[_0x8599('0x4d')]['DashboardId']=_0x1122b9['id'];_0x50dc68['body']['attrs']=widgetAttributes(_0x50dc68[_0x8599('0x4d')]);return db[_0x8599('0x71')][_0x8599('0x55')](_0x50dc68[_0x8599('0x4d')]);}})[_0x8599('0x29')](respondWithResult(_0x168db8,null))[_0x8599('0x4a')](handleError(_0x168db8,null));};exports[_0x8599('0x72')]=function(_0x512c7f,_0xd4ca0e,_0x2e44a1){var _0x548f27={};var _0x1c8b7a={};var _0x484615;var _0x1ff599;return db[_0x8599('0x31')][_0x8599('0x73')]({'where':{'id':_0x512c7f['params']['id']}})['then'](handleEntityNotFound(_0xd4ca0e,null))[_0x8599('0x29')](function(_0xea4647){if(_0xea4647){_0x484615=_0xea4647;_0x1c8b7a[_0x8599('0x36')]=_[_0x8599('0x38')](db[_0x8599('0x71')][_0x8599('0x32')]);_0x1c8b7a['query']=_[_0x8599('0x38')](_0x512c7f['query']);_0x1c8b7a[_0x8599('0x39')]=_[_0x8599('0x3a')](_0x1c8b7a[_0x8599('0x36')],_0x1c8b7a[_0x8599('0x37')]);_0x548f27['attributes']=_[_0x8599('0x3a')](_0x1c8b7a[_0x8599('0x36')],qs['fields'](_0x512c7f[_0x8599('0x37')]['fields']));_0x548f27[_0x8599('0x3b')]=_0x548f27[_0x8599('0x3b')][_0x8599('0x3d')]?_0x548f27[_0x8599('0x3b')]:_0x1c8b7a[_0x8599('0x36')];_0x548f27[_0x8599('0x3f')]=qs[_0x8599('0x40')](_0x512c7f[_0x8599('0x37')][_0x8599('0x40')]);_0x548f27[_0x8599('0x41')]=qs['filters'](_['pick'](_0x512c7f[_0x8599('0x37')],_0x1c8b7a[_0x8599('0x39')]));if(_0x512c7f[_0x8599('0x37')][_0x8599('0x43')]){_0x548f27[_0x8599('0x41')]=_[_0x8599('0x44')](_0x548f27[_0x8599('0x41')],{'$or':_['map'](_0x548f27[_0x8599('0x3b')],function(_0x300d5a){var _0x35e8d1={};_0x35e8d1[_0x300d5a]={'$like':'%'+_0x512c7f['query']['filter']+'%'};return _0x35e8d1;})});}_0x548f27=_[_0x8599('0x44')]({},_0x548f27,_0x512c7f[_0x8599('0x45')]);return _0x484615['getItems'](_0x548f27);}})['then'](function(_0x355854){if(_0x355854){_0x1ff599=_0x355854['length'];if(!_0x512c7f[_0x8599('0x37')][_0x8599('0x74')](_0x8599('0x3e'))){_0x548f27[_0x8599('0x23')]=qs[_0x8599('0x23')](_0x512c7f[_0x8599('0x37')]['limit']);_0x548f27[_0x8599('0x22')]=qs[_0x8599('0x22')](_0x512c7f['query'][_0x8599('0x22')]);}return _0x484615['getItems'](_0x548f27);}})[_0x8599('0x29')](function(_0x142849){if(_0x142849){return _0x142849?{'count':_0x1ff599,'rows':_0x142849}:null;}})[_0x8599('0x29')](respondWithResult(_0xd4ca0e,null))[_0x8599('0x4a')](handleError(_0xd4ca0e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 416e50f..7a35138 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 _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 +var _0xe991=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','save','remove'];(function(_0x2c4d22,_0x4ca120){var _0x1f0537=function(_0x2374a9){while(--_0x2374a9){_0x2c4d22['push'](_0x2c4d22['shift']());}};_0x1f0537(++_0x4ca120);}(_0xe991,0x1d0));var _0x1e99=function(_0x56c928,_0x4ed031){_0x56c928=_0x56c928-0x0;var _0x51483b=_0xe991[_0x56c928];return _0x51483b;};'use strict';var EventEmitter=require(_0x1e99('0x0'));var Dashboard=require(_0x1e99('0x1'))['db'][_0x1e99('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x1e99('0x3')](0x0);var events={'afterCreate':_0x1e99('0x4'),'afterUpdate':'update','afterDestroy':_0x1e99('0x5')};function emitEvent(_0x4c34d5){return function(_0x3253cc,_0x3fb101,_0x7e5ad7){DashboardEvents[_0x1e99('0x6')](_0x4c34d5+':'+_0x3253cc['id'],_0x3253cc);DashboardEvents[_0x1e99('0x6')](_0x4c34d5,_0x3253cc);_0x7e5ad7(null);};}for(var e in events){if(events[_0x1e99('0x7')](e)){var event=events[e];Dashboard[_0x1e99('0x8')](e,emitEvent(event));}}module[_0x1e99('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fdeda75..9d0914b 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 _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 +var _0xae73=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xae73,0x93));var _0x3ae7=function(_0x3ba938,_0x27414d){_0x3ba938=_0x3ba938-0x0;var _0x2aabff=_0xae73[_0x3ba938];return _0x2aabff;};'use strict';var _=require(_0x3ae7('0x0'));var util=require(_0x3ae7('0x1'));var logger=require(_0x3ae7('0x2'))(_0x3ae7('0x3'));var moment=require(_0x3ae7('0x4'));var BPromise=require(_0x3ae7('0x5'));var rp=require(_0x3ae7('0x6'));var fs=require('fs');var path=require(_0x3ae7('0x7'));var rimraf=require(_0x3ae7('0x8'));var config=require(_0x3ae7('0x9'));var attributes=require(_0x3ae7('0xa'));module[_0x3ae7('0xb')]=function(_0x517bd6,_0x2bf351){return _0x517bd6[_0x3ae7('0xc')](_0x3ae7('0xd'),attributes,{'tableName':_0x3ae7('0xe'),'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 afecd89..6fda981 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 _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 +var _0x965f=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x115353,_0xaf8666){var _0x70b1f0=function(_0x53791e){while(--_0x53791e){_0x115353['push'](_0x115353['shift']());}};_0x70b1f0(++_0xaf8666);}(_0x965f,0x139));var _0xf965=function(_0x3058b5,_0x23f184){_0x3058b5=_0x3058b5-0x0;var _0x132ba9=_0x965f[_0x3058b5];return _0x132ba9;};'use strict';var _=require(_0xf965('0x0'));var util=require(_0xf965('0x1'));var moment=require(_0xf965('0x2'));var BPromise=require(_0xf965('0x3'));var rs=require(_0xf965('0x4'));var fs=require('fs');var Redis=require(_0xf965('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf965('0x6'));var logger=require(_0xf965('0x7'))(_0xf965('0x8'));var config=require(_0xf965('0x9'));var jayson=require(_0xf965('0xa'));var client=jayson[_0xf965('0xb')][_0xf965('0xc')]({'port':0x232a});config['redis']=_[_0xf965('0xd')](config[_0xf965('0xe')],{'host':_0xf965('0xf'),'port':0x18eb});var socket=require(_0xf965('0x10'))(new Redis(config[_0xf965('0xe')]));require(_0xf965('0x11'))[_0xf965('0x12')](socket);function respondWithRpcPromise(_0x226779,_0xbab328,_0xd9c6a){return new BPromise(function(_0x480b9e,_0x46de1e){return client['request'](_0x226779,_0xd9c6a)[_0xf965('0x13')](function(_0x419294){logger[_0xf965('0x14')](_0xf965('0x15'),_0xbab328,_0xf965('0x16'));logger[_0xf965('0x17')](_0xf965('0x18'),_0xbab328,'request\x20sent',JSON[_0xf965('0x19')](_0x419294));if(_0x419294[_0xf965('0x1a')]){if(_0x419294['error']['code']===0x1f4){logger[_0xf965('0x1a')](_0xf965('0x15'),_0xbab328,_0x419294[_0xf965('0x1a')][_0xf965('0x1b')]);return _0x46de1e(_0x419294[_0xf965('0x1a')]['message']);}logger[_0xf965('0x1a')](_0xf965('0x15'),_0xbab328,_0x419294[_0xf965('0x1a')][_0xf965('0x1b')]);return _0x480b9e(_0x419294['error'][_0xf965('0x1b')]);}else{logger[_0xf965('0x14')](_0xf965('0x15'),_0xbab328,_0xf965('0x16'));_0x480b9e(_0x419294['result'][_0xf965('0x1b')]);}})[_0xf965('0x1c')](function(_0x98a755){logger[_0xf965('0x1a')]('Dashboard,\x20%s,\x20%s',_0xbab328,_0x98a755);_0x46de1e(_0x98a755);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 3572bf7..936f2f5 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 _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 +var _0xbf65=['./dashboard.events','save','remove','update','emit','removeListener','register','length','dashboard:'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xbf65,0x1b9));var _0x5bf6=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xbf65[_0x2d2c16];return _0x53f2fb;};'use strict';var DashboardEvents=require(_0x5bf6('0x0'));var events=[_0x5bf6('0x1'),_0x5bf6('0x2'),_0x5bf6('0x3')];function createListener(_0x36d566,_0x5d0533){return function(_0x24d9be){_0x5d0533[_0x5bf6('0x4')](_0x36d566,_0x24d9be);};}function removeListener(_0x1e6991,_0x5c453b){return function(){DashboardEvents[_0x5bf6('0x5')](_0x1e6991,_0x5c453b);};}exports[_0x5bf6('0x6')]=function(_0x137db2){for(var _0x551114=0x0,_0x4fc33f=events[_0x5bf6('0x7')];_0x551114<_0x4fc33f;_0x551114++){var _0x158e20=events[_0x551114];var _0x2434d3=createListener(_0x5bf6('0x8')+_0x158e20,_0x137db2);DashboardEvents['on'](_0x158e20,_0x2434d3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index c62eb99..c0a9d91 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 _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 +var _0x9c44=['express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/items','getItems','post','/:id/clone','clone','addItem','put','update','destroy','exports','path','connect-timeout'];(function(_0x46a57f,_0x3d1904){var _0x4d5140=function(_0x46d0af){while(--_0x46d0af){_0x46a57f['push'](_0x46a57f['shift']());}};_0x4d5140(++_0x3d1904);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['get'](_0x49c4('0xb'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xc')]);router[_0x49c4('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49c4('0xd')](_0x49c4('0xe'),auth['isAuthenticated'](),controller[_0x49c4('0xf')]);router[_0x49c4('0xd')]('/:id/items',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0x11')]('/:id',auth[_0x49c4('0x9')](),controller[_0x49c4('0x12')]);router['delete'](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0x13')]);module[_0x49c4('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4a20e34..0d83dfe 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 _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 +var _0x7afe=['setDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','sequelize','lodash','exports','STRING','TEXT','long','parse','getDataValue'];(function(_0x454589,_0x3e852e){var _0x468c5c=function(_0xa5b1f5){while(--_0xa5b1f5){_0x454589['push'](_0x454589['shift']());}};_0x468c5c(++_0x3e852e);}(_0x7afe,0xe6));var _0xe7af=function(_0x5a44f0,_0x38817e){_0x5a44f0=_0x5a44f0-0x0;var _0x16bad2=_0x7afe[_0x5a44f0];return _0x16bad2;};'use strict';var Sequelize=require(_0xe7af('0x0'));var squel=require('squel');var _=require(_0xe7af('0x1'));module[_0xe7af('0x2')]={'title':{'type':Sequelize[_0xe7af('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe7af('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xe7af('0x4')](_0xe7af('0x5')),'get':function(){try{return JSON[_0xe7af('0x6')](this[_0xe7af('0x7')]('attrs'));}catch(_0x3cae8f){return[];}},'set':function(_0x3ae31c){try{this[_0xe7af('0x8')](_0xe7af('0x9'),JSON[_0xe7af('0xa')](_0x3ae31c));}catch(_0x55f9c4){this['setDataValue']('attrs',JSON[_0xe7af('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xe7af('0xb')]},'background':{'type':Sequelize[_0xe7af('0x3')],'allowNull':![],'defaultValue':_0xe7af('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe7af('0x3')],'allowNull':![],'defaultValue':_0xe7af('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe7af('0x3')]},'titleFontSize':{'type':Sequelize[_0xe7af('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 51820c0..df2d4bc 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 _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 +var _0x27b0=['moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','params','model','keys','DashboardItem','rawAttributes','query','intersection','fields','attributes','length','includeAll','find','catch','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','type','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','body','create','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x304bd6,_0x6432b5){var _0xc57fac=function(_0x1b5ca9){while(--_0x1b5ca9){_0x304bd6['push'](_0x304bd6['shift']());}};_0xc57fac(++_0x6432b5);}(_0x27b0,0x153));var _0x027b=function(_0x331b08,_0x2c5937){_0x331b08=_0x331b08-0x0;var _0x5034d9=_0x27b0[_0x331b08];return _0x5034d9;};'use strict';var pdf=require(_0x027b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x027b('0x1'));var zipdir=require(_0x027b('0x2'));var jsonpatch=require(_0x027b('0x3'));var rp=require(_0x027b('0x4'));var moment=require(_0x027b('0x5'));var BPromise=require(_0x027b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x027b('0x7'));var sox=require(_0x027b('0x8'));var csv=require(_0x027b('0x9'));var ejs=require(_0x027b('0xa'));var fs=require('fs');var _=require(_0x027b('0xb'));var squel=require(_0x027b('0xc'));var crypto=require(_0x027b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x027b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x027b('0xf'));var Papa=require(_0x027b('0x10'));var Redis=require('ioredis');var authService=require(_0x027b('0x11'));var qs=require(_0x027b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x027b('0x13'));var logger=require(_0x027b('0x14'))(_0x027b('0x15'));var utils=require(_0x027b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x027b('0x17')]=_['defaults'](config['redis'],{'host':_0x027b('0x18'),'port':0x18eb});var socket=require(_0x027b('0x19'))(new Redis(config['redis']));require(_0x027b('0x1a'))[_0x027b('0x1b')](socket);function respondWithStatusCode(_0x1c0cae,_0x40ced5){_0x40ced5=_0x40ced5||0xcc;return function(_0x531069){if(_0x531069){return _0x1c0cae['sendStatus'](_0x40ced5);}return _0x1c0cae[_0x027b('0x1c')](_0x40ced5)[_0x027b('0x1d')]();};}function respondWithResult(_0x316c17,_0x1a1fab){_0x1a1fab=_0x1a1fab||0xc8;return function(_0x319639){if(_0x319639){return _0x316c17['status'](_0x1a1fab)['json'](_0x319639);}};}function respondWithFilteredResult(_0x253e56,_0x13b386){return function(_0x3c7824){if(_0x3c7824){var _0x1ac2fd=_0x3c7824[_0x027b('0x1e')],_0x3e1f41=_0x13b386['offset'],_0x36dea5=_0x13b386[_0x027b('0x1f')]+_0x13b386[_0x027b('0x20')],_0x577132;if(_0x36dea5>=_0x1ac2fd){_0x36dea5=_0x1ac2fd;_0x577132=0xc8;}else{_0x577132=0xce;}_0x253e56[_0x027b('0x1c')](_0x577132);return _0x253e56[_0x027b('0x21')](_0x027b('0x22'),_0x3e1f41+'-'+_0x36dea5+'/'+_0x1ac2fd)['json'](_0x3c7824);}return null;};}function patchUpdates(_0x11c752){return function(_0x26e7a8){try{jsonpatch[_0x027b('0x23')](_0x26e7a8,_0x11c752,!![]);}catch(_0x3c9e89){return BPromise[_0x027b('0x24')](_0x3c9e89);}return _0x26e7a8[_0x027b('0x25')]();};}function saveUpdates(_0x2fa012,_0x17b4b6){return function(_0x15cacd){if(_0x15cacd){return _0x15cacd[_0x027b('0x26')](_0x2fa012)[_0x027b('0x27')](function(_0xd4b709){return _0xd4b709;});}return null;};}function removeEntity(_0x2654a7,_0x5089d6){return function(_0x4b7efc){if(_0x4b7efc){return _0x4b7efc['destroy']()['then'](function(){_0x2654a7[_0x027b('0x1c')](0xcc)[_0x027b('0x1d')]();});}};}function handleEntityNotFound(_0x22e95f,_0x51805a){return function(_0xcb78bf){if(!_0xcb78bf){_0x22e95f[_0x027b('0x28')](0x194);}return _0xcb78bf;};}function handleError(_0x2ef200,_0x516470){_0x516470=_0x516470||0x1f4;return function(_0x4510c5){logger[_0x027b('0x29')](_0x4510c5['stack']);if(_0x4510c5['name']){delete _0x4510c5[_0x027b('0x2a')];}_0x2ef200[_0x027b('0x1c')](_0x516470)['send'](_0x4510c5);};}exports['show']=function(_0x4c5894,_0x5bb727){var _0x27bfb7={'raw':![],'where':{'id':_0x4c5894[_0x027b('0x2b')]['id']}},_0x23aa8b={};_0x23aa8b[_0x027b('0x2c')]=_[_0x027b('0x2d')](db[_0x027b('0x2e')][_0x027b('0x2f')]);_0x23aa8b[_0x027b('0x30')]=_['keys'](_0x4c5894[_0x027b('0x30')]);_0x23aa8b['filters']=_[_0x027b('0x31')](_0x23aa8b[_0x027b('0x2c')],_0x23aa8b['query']);_0x27bfb7['attributes']=_[_0x027b('0x31')](_0x23aa8b[_0x027b('0x2c')],qs[_0x027b('0x32')](_0x4c5894[_0x027b('0x30')][_0x027b('0x32')]));_0x27bfb7[_0x027b('0x33')]=_0x27bfb7[_0x027b('0x33')][_0x027b('0x34')]?_0x27bfb7['attributes']:_0x23aa8b['model'];if(_0x4c5894[_0x027b('0x30')][_0x027b('0x35')]){_0x27bfb7['include']=[{'all':!![]}];}_0x27bfb7=_['merge']({},_0x27bfb7,_0x4c5894['options']);return db[_0x027b('0x2e')][_0x027b('0x36')](_0x27bfb7)[_0x027b('0x27')](handleEntityNotFound(_0x5bb727,null))['then'](respondWithResult(_0x5bb727,null))[_0x027b('0x37')](handleError(_0x5bb727,null));};exports[_0x027b('0x38')]=function(_0x932c88,_0x22201b){return db[_0x027b('0x2e')]['find']({'where':{'id':_0x932c88['params']['id']}})[_0x027b('0x27')](handleEntityNotFound(_0x22201b,null))['then'](removeEntity(_0x22201b,null))[_0x027b('0x37')](handleError(_0x22201b,null));};function widgetAttributes(_0x1313f1){try{switch(_0x1313f1['type']){case _0x027b('0x39'):return[{'name':_0x027b('0x3a'),'value':_0x1313f1[_0x027b('0x3a')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1['attrs'][0x0]?_0x1313f1[_0x027b('0x3b')][0x0][_0x027b('0x3c')]:undefined)||'https://'}];case _0x027b('0x3d'):return[{'name':_0x027b('0x3e'),'value':_0x1313f1[_0x027b('0x3e')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x0]?_0x1313f1[_0x027b('0x3b')][0x0][_0x027b('0x3c')]:undefined)||''}];case _0x027b('0x3f'):return[{'name':'attrHourFormat','value':_0x1313f1['attrHourFormat']||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x0]?_0x1313f1['attrs'][0x0][_0x027b('0x3c')]:undefined)||_0x027b('0x40')},{'name':_0x027b('0x41'),'value':_0x1313f1['attrTimezone']||(_0x1313f1['attrs']&&_0x1313f1[_0x027b('0x3b')][0x1]?_0x1313f1[_0x027b('0x3b')][0x1][_0x027b('0x3c')]:undefined)||_0x027b('0x42')},{'name':_0x027b('0x43'),'value':_0x1313f1[_0x027b('0x43')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x2]?_0x1313f1[_0x027b('0x3b')][0x2][_0x027b('0x3c')]:undefined)||0xc}];case _0x027b('0x44'):return[{'name':_0x027b('0x45'),'value':_0x1313f1[_0x027b('0x45')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x0]?_0x1313f1[_0x027b('0x3b')][0x0]['value']:undefined)||_0x027b('0x46')},{'name':_0x027b('0x47'),'value':_0x1313f1[_0x027b('0x47')]||(_0x1313f1['attrs']&&_0x1313f1[_0x027b('0x3b')][0x1]?_0x1313f1[_0x027b('0x3b')][0x1][_0x027b('0x3c')]:undefined)||[]},{'name':_0x027b('0x43'),'value':_0x1313f1[_0x027b('0x43')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x2]?_0x1313f1['attrs'][0x2][_0x027b('0x3c')]:undefined)||0x14}];case _0x027b('0x48'):case _0x027b('0x49'):return[{'name':_0x027b('0x4a'),'value':_0x1313f1[_0x027b('0x4a')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x0]?_0x1313f1[_0x027b('0x3b')][0x0]['value']:undefined)||_0x027b('0x46')},{'name':'attrSerie2','value':_0x1313f1[_0x027b('0x4b')]||(_0x1313f1['attrs']&&_0x1313f1[_0x027b('0x3b')][0x1]?_0x1313f1[_0x027b('0x3b')][0x1][_0x027b('0x3c')]:undefined)||null},{'name':'attrSerie3','value':_0x1313f1[_0x027b('0x4c')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x2]?_0x1313f1[_0x027b('0x3b')][0x2][_0x027b('0x3c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1313f1[_0x027b('0x47')]||(_0x1313f1['attrs']&&_0x1313f1[_0x027b('0x3b')][0x3]?_0x1313f1[_0x027b('0x3b')][0x3]['value']:undefined)||[]}];case _0x027b('0x4d'):return[{'name':'attrReport','type':_0x1313f1[_0x027b('0x4e')]||(_0x1313f1[_0x027b('0x3b')]&&_0x1313f1[_0x027b('0x3b')][0x0]?_0x1313f1[_0x027b('0x3b')][0x0][_0x027b('0x4f')]:undefined)||null,'value':_0x1313f1[_0x027b('0x50')]||(_0x1313f1['attrs']&&_0x1313f1[_0x027b('0x3b')][0x0]?_0x1313f1[_0x027b('0x3b')][0x0][_0x027b('0x3c')]:undefined)||null},{'name':_0x027b('0x51'),'value':_0x1313f1[_0x027b('0x51')]||(_0x1313f1['attrs']&&_0x1313f1[_0x027b('0x3b')][0x1]?_0x1313f1[_0x027b('0x3b')][0x1][_0x027b('0x3c')]:undefined)||0x0}];default:return[];}}catch(_0x337f59){logger[_0x027b('0x29')](_0x027b('0x52'),JSON[_0x027b('0x53')](_0x337f59));return[];}}exports['create']=function(_0x50bc89,_0x53adf3){if(_0x50bc89[_0x027b('0x54')]){_0x50bc89['body']['attrs']=widgetAttributes(_0x50bc89[_0x027b('0x54')]);}return db['DashboardItem'][_0x027b('0x55')](_0x50bc89[_0x027b('0x54')],{})['then'](respondWithResult(_0x53adf3,0xc9))['catch'](handleError(_0x53adf3,null));};exports[_0x027b('0x26')]=function(_0x424f7b,_0x1362f0){if(_0x424f7b[_0x027b('0x54')]['id']){delete _0x424f7b['body']['id'];}_0x424f7b[_0x027b('0x54')][_0x027b('0x3b')]=widgetAttributes(_0x424f7b[_0x027b('0x54')]);return db[_0x027b('0x2e')][_0x027b('0x36')]({'where':{'id':_0x424f7b['params']['id']}})[_0x027b('0x27')](handleEntityNotFound(_0x1362f0,null))[_0x027b('0x27')](saveUpdates(_0x424f7b[_0x027b('0x54')],null))[_0x027b('0x27')](respondWithResult(_0x1362f0,null))['catch'](handleError(_0x1362f0,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index bd08810..b610769 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 _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 +var _0x4ce6=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1909f9,_0x1795ef){var _0x4fc488=function(_0x4fb79a){while(--_0x4fb79a){_0x1909f9['push'](_0x1909f9['shift']());}};_0x4fc488(++_0x1795ef);}(_0x4ce6,0x1eb));var _0x64ce=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x4ce6[_0x1ae31c];return _0x19519d;};'use strict';var EventEmitter=require(_0x64ce('0x0'));var DashboardItem=require(_0x64ce('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x64ce('0x2')](0x0);var events={'afterCreate':_0x64ce('0x3'),'afterUpdate':_0x64ce('0x4'),'afterDestroy':_0x64ce('0x5')};function emitEvent(_0xe302e3){return function(_0x208599,_0x2b04a1,_0x1abe43){DashboardItemEvents[_0x64ce('0x6')](_0xe302e3+':'+_0x208599['id'],_0x208599);DashboardItemEvents['emit'](_0xe302e3,_0x208599);_0x1abe43(null);};}for(var e in events){if(events[_0x64ce('0x7')](e)){var event=events[e];DashboardItem[_0x64ce('0x8')](e,emitEvent(event));}}module[_0x64ce('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index f264b9b..64a68b9 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 _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 +var _0x216c=['./dashboardItem.attributes','exports','define','dashboard_items','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x351b40,_0x36e08b){var _0x206e94=function(_0x13697a){while(--_0x13697a){_0x351b40['push'](_0x351b40['shift']());}};_0x206e94(++_0x36e08b);}(_0x216c,0xb4));var _0xc216=function(_0x21353a,_0xd8d9ce){_0x21353a=_0x21353a-0x0;var _0x29a565=_0x216c[_0x21353a];return _0x29a565;};'use strict';var _=require('lodash');var util=require(_0xc216('0x0'));var logger=require(_0xc216('0x1'))('api');var moment=require(_0xc216('0x2'));var BPromise=require('bluebird');var rp=require(_0xc216('0x3'));var fs=require('fs');var path=require(_0xc216('0x4'));var rimraf=require(_0xc216('0x5'));var config=require(_0xc216('0x6'));var attributes=require(_0xc216('0x7'));module[_0xc216('0x8')]=function(_0x36abd8,_0x248b21){return _0x36abd8[_0xc216('0x9')]('DashboardItem',attributes,{'tableName':_0xc216('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index cb41da0..51cc576 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 _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 +var _0xa0f4=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','socket.io-emitter','./dashboardItem.socket','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0f4,0x15f));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a0f('0x0'));var util=require('util');var moment=require(_0x4a0f('0x1'));var BPromise=require(_0x4a0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a0f('0x3'));var db=require(_0x4a0f('0x4'))['db'];var utils=require(_0x4a0f('0x5'));var logger=require(_0x4a0f('0x6'))(_0x4a0f('0x7'));var config=require(_0x4a0f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4a0f('0x9')]=_['defaults'](config[_0x4a0f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a0f('0xa'))(new Redis(config['redis']));require(_0x4a0f('0xb'))['register'](socket);function respondWithRpcPromise(_0x555a46,_0x45910f,_0x1aa4a3){return new BPromise(function(_0x592a6a,_0x3fcc2b){return client['request'](_0x555a46,_0x1aa4a3)[_0x4a0f('0xc')](function(_0x5d2945){logger[_0x4a0f('0xd')](_0x4a0f('0xe'),_0x45910f,_0x4a0f('0xf'));logger[_0x4a0f('0x10')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x45910f,_0x4a0f('0xf'),JSON[_0x4a0f('0x11')](_0x5d2945));if(_0x5d2945[_0x4a0f('0x12')]){if(_0x5d2945[_0x4a0f('0x12')]['code']===0x1f4){logger[_0x4a0f('0x12')]('DashboardItem,\x20%s,\x20%s',_0x45910f,_0x5d2945[_0x4a0f('0x12')][_0x4a0f('0x13')]);return _0x3fcc2b(_0x5d2945[_0x4a0f('0x12')]['message']);}logger[_0x4a0f('0x12')](_0x4a0f('0xe'),_0x45910f,_0x5d2945[_0x4a0f('0x12')][_0x4a0f('0x13')]);return _0x592a6a(_0x5d2945['error'][_0x4a0f('0x13')]);}else{logger[_0x4a0f('0xd')](_0x4a0f('0xe'),_0x45910f,_0x4a0f('0xf'));_0x592a6a(_0x5d2945[_0x4a0f('0x14')][_0x4a0f('0x13')]);}})[_0x4a0f('0x15')](function(_0x2409c7){logger[_0x4a0f('0x12')](_0x4a0f('0xe'),_0x45910f,_0x2409c7);_0x3fcc2b(_0x2409c7);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 77a47ed..c8ef6dc 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 _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 +var _0x7c5b=['save','remove','update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x3bed55,_0x2de3e8){var _0x2be57f=function(_0x559879){while(--_0x559879){_0x3bed55['push'](_0x3bed55['shift']());}};_0x2be57f(++_0x2de3e8);}(_0x7c5b,0x155));var _0xb7c5=function(_0xccbb2,_0x534810){_0xccbb2=_0xccbb2-0x0;var _0x15f259=_0x7c5b[_0xccbb2];return _0x15f259;};'use strict';var DashboardItemEvents=require(_0xb7c5('0x0'));var events=[_0xb7c5('0x1'),_0xb7c5('0x2'),_0xb7c5('0x3')];function createListener(_0x2a6fc7,_0x51efff){return function(_0x53d88b){_0x51efff[_0xb7c5('0x4')](_0x2a6fc7,_0x53d88b);};}function removeListener(_0xf89f9,_0x55b3dd){return function(){DashboardItemEvents[_0xb7c5('0x5')](_0xf89f9,_0x55b3dd);};}exports[_0xb7c5('0x6')]=function(_0x44b515){for(var _0x524076=0x0,_0x14ec07=events[_0xb7c5('0x7')];_0x524076<_0x14ec07;_0x524076++){var _0x24211c=events[_0x524076];var _0x3a9243=createListener(_0xb7c5('0x8')+_0x24211c,_0x44b515);DashboardItemEvents['on'](_0x24211c,_0x3a9243);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5db3b50..499cfa4 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 _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 +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(_0x44ffe6,_0x491e5f){var _0x43464d=function(_0x5d3cbb){while(--_0x5d3cbb){_0x44ffe6['push'](_0x44ffe6['shift']());}};_0x43464d(++_0x491e5f);}(_0x814b,0x1a2));var _0xb814=function(_0x3108d9,_0xf08d6){_0x3108d9=_0x3108d9-0x0;var _0x1455e6=_0x814b[_0x3108d9];return _0x1455e6;};'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 diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 5be200c..8aad827 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 _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 +var _0xaa1c=['STRING','ENUM','first','sequelize','exports'];(function(_0x20b9d5,_0xa6a6cd){var _0x4d7464=function(_0x46ee1c){while(--_0x46ee1c){_0x20b9d5['push'](_0x20b9d5['shift']());}};_0x4d7464(++_0xa6a6cd);}(_0xaa1c,0x80));var _0xcaa1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaa1c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcaa1('0x0'));module[_0xcaa1('0x1')]={'name':{'type':Sequelize[_0xcaa1('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xcaa1('0x3')]('first','second','third'),'allowNull':![],'defaultValue':_0xcaa1('0x4')},'description':{'type':Sequelize[_0xcaa1('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0073484..937215b 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 _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 +var _0x93f6=['path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','stack','name','index','Disposition','rawAttributes','key','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x2e1324,_0x10ac5f){var _0x2e2878=function(_0x1587b1){while(--_0x1587b1){_0x2e1324['push'](_0x2e1324['shift']());}};_0x2e2878(++_0x10ac5f);}(_0x93f6,0x140));var _0x693f=function(_0x371bb3,_0xb8afdc){_0x371bb3=_0x371bb3-0x0;var _0x379f91=_0x93f6[_0x371bb3];return _0x379f91;};'use strict';var pdf=require(_0x693f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x693f('0x1'));var jsonpatch=require(_0x693f('0x2'));var rp=require(_0x693f('0x3'));var moment=require(_0x693f('0x4'));var BPromise=require(_0x693f('0x5'));var Mustache=require(_0x693f('0x6'));var util=require(_0x693f('0x7'));var path=require(_0x693f('0x8'));var sox=require(_0x693f('0x9'));var csv=require(_0x693f('0xa'));var ejs=require(_0x693f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x693f('0xc'));var crypto=require(_0x693f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x693f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x693f('0xf'));var Papa=require(_0x693f('0x10'));var Redis=require('ioredis');var authService=require(_0x693f('0x11'));var qs=require(_0x693f('0x12'));var as=require(_0x693f('0x13'));var hardwareService=require(_0x693f('0x14'));var logger=require(_0x693f('0x15'))(_0x693f('0x16'));var utils=require(_0x693f('0x17'));var config=require(_0x693f('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24d2b1,_0x1ae893){_0x1ae893=_0x1ae893||0xcc;return function(_0x2ee8cb){if(_0x2ee8cb){return _0x24d2b1[_0x693f('0x19')](_0x1ae893);}return _0x24d2b1[_0x693f('0x1a')](_0x1ae893)[_0x693f('0x1b')]();};}function respondWithResult(_0x4a52c6,_0x678f7e){_0x678f7e=_0x678f7e||0xc8;return function(_0x21ac44){if(_0x21ac44){return _0x4a52c6['status'](_0x678f7e)[_0x693f('0x1c')](_0x21ac44);}};}function respondWithFilteredResult(_0x10968e,_0x3e8b3b){return function(_0x1647eb){if(_0x1647eb){var _0x641dc4=_0x1647eb[_0x693f('0x1d')],_0x4c614f=_0x3e8b3b[_0x693f('0x1e')],_0x144e6c=_0x3e8b3b[_0x693f('0x1e')]+_0x3e8b3b[_0x693f('0x1f')],_0x57515b;if(_0x144e6c>=_0x641dc4){_0x144e6c=_0x641dc4;_0x57515b=0xc8;}else{_0x57515b=0xce;}_0x10968e[_0x693f('0x1a')](_0x57515b);return _0x10968e[_0x693f('0x20')](_0x693f('0x21'),_0x4c614f+'-'+_0x144e6c+'/'+_0x641dc4)['json'](_0x1647eb);}return null;};}function patchUpdates(_0x10535f){return function(_0x2b52ec){try{jsonpatch['apply'](_0x2b52ec,_0x10535f,!![]);}catch(_0x225b10){return BPromise[_0x693f('0x22')](_0x225b10);}return _0x2b52ec[_0x693f('0x23')]();};}function saveUpdates(_0x5e723f,_0x48e2c0){return function(_0x36962a){if(_0x36962a){return _0x36962a[_0x693f('0x24')](_0x5e723f)[_0x693f('0x25')](function(_0x2fce37){return _0x2fce37;});}return null;};}function removeEntity(_0xe8f544,_0x1ab46b){return function(_0x1d687a){if(_0x1d687a){return _0x1d687a[_0x693f('0x26')]()[_0x693f('0x25')](function(){var _0x37b1b9=_0x1d687a[_0x693f('0x27')]({'plain':!![]});var _0x3a58bc=_0x693f('0x28');return db[_0x693f('0x29')][_0x693f('0x26')]({'where':{'type':_0x3a58bc,'resourceId':_0x37b1b9['id']}})[_0x693f('0x25')](function(){return _0x1d687a;});})['then'](function(){_0xe8f544[_0x693f('0x1a')](0xcc)[_0x693f('0x1b')]();});}};}function handleEntityNotFound(_0x345185,_0x3665e4){return function(_0x4eb6bf){if(!_0x4eb6bf){_0x345185['sendStatus'](0x194);}return _0x4eb6bf;};}function handleError(_0x2b2487,_0x2b8a0b){_0x2b8a0b=_0x2b8a0b||0x1f4;return function(_0x148786){logger['error'](_0x148786[_0x693f('0x2a')]);if(_0x148786['name']){delete _0x148786[_0x693f('0x2b')];}_0x2b2487[_0x693f('0x1a')](_0x2b8a0b)['send'](_0x148786);};}exports[_0x693f('0x2c')]=function(_0x1be568,_0x54d271){var _0x243368={},_0x3a3d63={},_0x2ed807={'count':0x0,'rows':[]};var _0x5afe1b=_['map'](db[_0x693f('0x2d')][_0x693f('0x2e')],function(_0x51bb9c){return{'name':_0x51bb9c['fieldName'],'type':_0x51bb9c['type'][_0x693f('0x2f')]};});_0x3a3d63['model']=_[_0x693f('0x30')](_0x5afe1b,_0x693f('0x2b'));_0x3a3d63[_0x693f('0x31')]=_[_0x693f('0x32')](_0x1be568[_0x693f('0x31')]);_0x3a3d63[_0x693f('0x33')]=_[_0x693f('0x34')](_0x3a3d63[_0x693f('0x35')],_0x3a3d63[_0x693f('0x31')]);_0x243368[_0x693f('0x36')]=_['intersection'](_0x3a3d63[_0x693f('0x35')],qs['fields'](_0x1be568[_0x693f('0x31')][_0x693f('0x37')]));_0x243368[_0x693f('0x36')]=_0x243368['attributes'][_0x693f('0x38')]?_0x243368[_0x693f('0x36')]:_0x3a3d63[_0x693f('0x35')];if(!_0x1be568[_0x693f('0x31')]['hasOwnProperty'](_0x693f('0x39'))){_0x243368[_0x693f('0x1f')]=qs['limit'](_0x1be568[_0x693f('0x31')][_0x693f('0x1f')]);_0x243368[_0x693f('0x1e')]=qs[_0x693f('0x1e')](_0x1be568['query'][_0x693f('0x1e')]);}_0x243368[_0x693f('0x3a')]=qs[_0x693f('0x3b')](_0x1be568[_0x693f('0x31')]['sort']);_0x243368['where']=qs[_0x693f('0x33')](_[_0x693f('0x3c')](_0x1be568[_0x693f('0x31')],_0x3a3d63[_0x693f('0x33')]),_0x5afe1b);if(_0x1be568['query'][_0x693f('0x3d')]){_0x243368[_0x693f('0x3e')]=_[_0x693f('0x3f')](_0x243368[_0x693f('0x3e')],{'$or':_[_0x693f('0x30')](_0x5afe1b,function(_0x204404){if(_0x204404['type']!==_0x693f('0x40')){var _0x211b9e={};_0x211b9e[_0x204404[_0x693f('0x2b')]]={'$like':'%'+_0x1be568[_0x693f('0x31')][_0x693f('0x3d')]+'%'};return _0x211b9e;}})});}_0x243368=_['merge']({},_0x243368,_0x1be568[_0x693f('0x41')]);var _0x50f21e={'where':_0x243368[_0x693f('0x3e')]};return db[_0x693f('0x2d')][_0x693f('0x1d')](_0x50f21e)[_0x693f('0x25')](function(_0x5eaefd){_0x2ed807[_0x693f('0x1d')]=_0x5eaefd;if(_0x1be568[_0x693f('0x31')]['includeAll']){_0x243368['include']=[{'all':!![]}];}return db[_0x693f('0x2d')][_0x693f('0x42')](_0x243368);})[_0x693f('0x25')](function(_0x42d609){_0x2ed807[_0x693f('0x43')]=_0x42d609;return _0x2ed807;})['then'](respondWithFilteredResult(_0x54d271,_0x243368))[_0x693f('0x44')](handleError(_0x54d271,null));};exports[_0x693f('0x45')]=function(_0x5cfdc9,_0x5b8160){var _0x31b2d7={'raw':!![],'where':{'id':_0x5cfdc9['params']['id']}},_0x1086b2={};_0x1086b2[_0x693f('0x35')]=_['keys'](db[_0x693f('0x2d')][_0x693f('0x2e')]);_0x1086b2['query']=_[_0x693f('0x32')](_0x5cfdc9[_0x693f('0x31')]);_0x1086b2[_0x693f('0x33')]=_[_0x693f('0x34')](_0x1086b2['model'],_0x1086b2[_0x693f('0x31')]);_0x31b2d7[_0x693f('0x36')]=_[_0x693f('0x34')](_0x1086b2[_0x693f('0x35')],qs[_0x693f('0x37')](_0x5cfdc9[_0x693f('0x31')]['fields']));_0x31b2d7[_0x693f('0x36')]=_0x31b2d7['attributes'][_0x693f('0x38')]?_0x31b2d7[_0x693f('0x36')]:_0x1086b2[_0x693f('0x35')];if(_0x5cfdc9[_0x693f('0x31')][_0x693f('0x46')]){_0x31b2d7[_0x693f('0x47')]=[{'all':!![]}];}_0x31b2d7=_[_0x693f('0x3f')]({},_0x31b2d7,_0x5cfdc9[_0x693f('0x41')]);return db['Disposition'][_0x693f('0x48')](_0x31b2d7)[_0x693f('0x25')](handleEntityNotFound(_0x5b8160,null))[_0x693f('0x25')](respondWithResult(_0x5b8160,null))[_0x693f('0x44')](handleError(_0x5b8160,null));};exports['create']=function(_0xcab54d,_0x5dc7df){return db[_0x693f('0x2d')][_0x693f('0x49')](_0xcab54d[_0x693f('0x4a')],{})[_0x693f('0x25')](function(_0x30585b){var _0x286838=_0xcab54d['user']['get']({'plain':!![]});if(!_0x286838)throw new Error(_0x693f('0x4b'));if(_0x286838[_0x693f('0x4c')]===_0x693f('0x4d')){var _0x42b786=_0x30585b[_0x693f('0x27')]({'plain':!![]});var _0x5e96ec='Dispositions';return db[_0x693f('0x4e')]['find']({'where':{'name':_0x5e96ec,'userProfileId':_0x286838['userProfileId']},'raw':!![]})[_0x693f('0x25')](function(_0x3fe193){if(_0x3fe193&&_0x3fe193['autoAssociation']===0x0){return db[_0x693f('0x29')][_0x693f('0x49')]({'name':_0x42b786['name'],'resourceId':_0x42b786['id'],'type':_0x3fe193[_0x693f('0x2b')],'sectionId':_0x3fe193['id']},{})[_0x693f('0x25')](function(){return _0x30585b;});}else{return _0x30585b;}})[_0x693f('0x44')](function(_0x4be3eb){logger[_0x693f('0x4f')](_0x693f('0x50'),_0x4be3eb);throw _0x4be3eb;});}return _0x30585b;})[_0x693f('0x25')](respondWithResult(_0x5dc7df,0xc9))[_0x693f('0x44')](handleError(_0x5dc7df,null));};exports[_0x693f('0x24')]=function(_0xaac925,_0x5965b3){if(_0xaac925[_0x693f('0x4a')]['id']){delete _0xaac925[_0x693f('0x4a')]['id'];}return db[_0x693f('0x2d')][_0x693f('0x48')]({'where':{'id':_0xaac925['params']['id']}})[_0x693f('0x25')](handleEntityNotFound(_0x5965b3,null))[_0x693f('0x25')](saveUpdates(_0xaac925[_0x693f('0x4a')],null))[_0x693f('0x25')](respondWithResult(_0x5965b3,null))[_0x693f('0x44')](handleError(_0x5965b3,null));};exports[_0x693f('0x26')]=function(_0xcabfd3,_0x5aadc6){return db[_0x693f('0x2d')][_0x693f('0x48')]({'where':{'id':_0xcabfd3[_0x693f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5aadc6,null))[_0x693f('0x25')](removeEntity(_0x5aadc6,null))[_0x693f('0x44')](handleError(_0x5aadc6,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4f47745..62fd4fa 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 _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 +var _0x27a0=['SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','./disposition.attributes','exports','define','Disposition','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x15ad1a,_0x154bc8){var _0x5a068c=function(_0x4b3f8b){while(--_0x4b3f8b){_0x15ad1a['push'](_0x15ad1a['shift']());}};_0x5a068c(++_0x154bc8);}(_0x27a0,0xbf));var _0x027a=function(_0x2c3d1a,_0x4a51b1){_0x2c3d1a=_0x2c3d1a-0x0;var _0x733027=_0x27a0[_0x2c3d1a];return _0x733027;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var logger=require(_0x027a('0x1'))(_0x027a('0x2'));var moment=require(_0x027a('0x3'));var BPromise=require(_0x027a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x027a('0x5'));module[_0x027a('0x6')]=function(_0x137b09,_0x639bec){return _0x137b09[_0x027a('0x7')](_0x027a('0x8'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x027a('0x9'),'fields':[_0x027a('0xa'),_0x027a('0xb')]},{'unique':!![],'name':'name_chat','fields':[_0x027a('0xa'),_0x027a('0xc')]},{'unique':!![],'name':_0x027a('0xd'),'fields':['name',_0x027a('0xe')]},{'unique':!![],'name':_0x027a('0xf'),'fields':[_0x027a('0xa'),_0x027a('0x10')]},{'unique':!![],'name':_0x027a('0x11'),'fields':[_0x027a('0xa'),_0x027a('0x12')]},{'unique':!![],'name':_0x027a('0x13'),'fields':[_0x027a('0xa'),_0x027a('0x14')]},{'unique':!![],'name':_0x027a('0x15'),'fields':['name',_0x027a('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 42280c8..ef703e1 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 _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 +var _0xb6a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird'];(function(_0x126fb9,_0x122c59){var _0xc8a3b1=function(_0x355744){while(--_0x355744){_0x126fb9['push'](_0x126fb9['shift']());}};_0xc8a3b1(++_0x122c59);}(_0xb6a8,0x14d));var _0x8b6a=function(_0x238d81,_0x325d1e){_0x238d81=_0x238d81-0x0;var _0x421072=_0xb6a8[_0x238d81];return _0x421072;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var moment=require('moment');var BPromise=require(_0x8b6a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b6a('0x3'));var db=require(_0x8b6a('0x4'))['db'];var utils=require(_0x8b6a('0x5'));var logger=require(_0x8b6a('0x6'))(_0x8b6a('0x7'));var config=require(_0x8b6a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8b6a('0x9')][_0x8b6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b6c48,_0x2cec22,_0x119577){return new BPromise(function(_0x41a3b6,_0x213abf){return client[_0x8b6a('0xb')](_0x5b6c48,_0x119577)[_0x8b6a('0xc')](function(_0x6a81b8){logger[_0x8b6a('0xd')](_0x8b6a('0xe'),_0x2cec22,_0x8b6a('0xf'));logger[_0x8b6a('0x10')]('Disposition,\x20%s,\x20%s,\x20%s',_0x2cec22,_0x8b6a('0xf'),JSON[_0x8b6a('0x11')](_0x6a81b8));if(_0x6a81b8['error']){if(_0x6a81b8[_0x8b6a('0x12')]['code']===0x1f4){logger[_0x8b6a('0x12')](_0x8b6a('0xe'),_0x2cec22,_0x6a81b8[_0x8b6a('0x12')][_0x8b6a('0x13')]);return _0x213abf(_0x6a81b8[_0x8b6a('0x12')]['message']);}logger['error']('Disposition,\x20%s,\x20%s',_0x2cec22,_0x6a81b8['error'][_0x8b6a('0x13')]);return _0x41a3b6(_0x6a81b8['error'][_0x8b6a('0x13')]);}else{logger[_0x8b6a('0xd')]('Disposition,\x20%s,\x20%s',_0x2cec22,_0x8b6a('0xf'));_0x41a3b6(_0x6a81b8[_0x8b6a('0x14')][_0x8b6a('0x13')]);}})['catch'](function(_0x38cc0a){logger[_0x8b6a('0x12')]('Disposition,\x20%s,\x20%s',_0x2cec22,_0x38cc0a);_0x213abf(_0x38cc0a);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index d43ea20..e53a0b8 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 _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 +var _0xd8e3=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x507385,_0x31d543){var _0x4ac4ac=function(_0x5c5668){while(--_0x5c5668){_0x507385['push'](_0x507385['shift']());}};_0x4ac4ac(++_0x31d543);}(_0xd8e3,0x91));var _0x3d8e=function(_0x574d48,_0x35c683){_0x574d48=_0x574d48-0x0;var _0x1e34f3=_0xd8e3[_0x574d48];return _0x1e34f3;};'use strict';var multer=require(_0x3d8e('0x0'));var util=require(_0x3d8e('0x1'));var path=require(_0x3d8e('0x2'));var timeout=require(_0x3d8e('0x3'));var express=require(_0x3d8e('0x4'));var router=express[_0x3d8e('0x5')]();var auth=require(_0x3d8e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d8e('0x7'));router[_0x3d8e('0x8')]('/',auth[_0x3d8e('0x9')](),controller[_0x3d8e('0xa')]);router[_0x3d8e('0x8')](_0x3d8e('0xb'),auth[_0x3d8e('0x9')](),controller[_0x3d8e('0xc')]);router[_0x3d8e('0xd')]('/',auth[_0x3d8e('0x9')](),controller[_0x3d8e('0xe')]);router[_0x3d8e('0xf')](_0x3d8e('0xb'),auth[_0x3d8e('0x9')](),controller[_0x3d8e('0x10')]);router[_0x3d8e('0x11')]('/:id',auth[_0x3d8e('0x9')](),controller[_0x3d8e('0x12')]);module[_0x3d8e('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8447db7..48ef0a5 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 _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 +var _0xbc81=['IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','7200','12000','14400','2400','4800','9600','v17,v27,v29','INTEGER','SIP'];(function(_0x35f3a3,_0x2b977c){var _0x3025d3=function(_0x12216f){while(--_0x12216f){_0x35f3a3['push'](_0x35f3a3['shift']());}};_0x3025d3(++_0x2b977c);}(_0xbc81,0x128));var _0x1bc8=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xbc81[_0x242a4f];return _0x122117;};'use strict';var Sequelize=require(_0x1bc8('0x0'));module[_0x1bc8('0x1')]={'name':{'type':Sequelize[_0x1bc8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1bc8('0x2')]},'ecm':{'type':Sequelize[_0x1bc8('0x3')](_0x1bc8('0x4'),'no'),'defaultValue':_0x1bc8('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x1bc8('0x5')},'localstationid':{'type':Sequelize[_0x1bc8('0x2')],'unique':_0x1bc8('0x6')},'minrate':{'type':Sequelize[_0x1bc8('0x3')]('2400','4800',_0x1bc8('0x7'),'9600',_0x1bc8('0x8'),_0x1bc8('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x1bc8('0xa'),_0x1bc8('0xb'),_0x1bc8('0x7'),_0x1bc8('0xc'),'12000',_0x1bc8('0x9')),'defaultValue':_0x1bc8('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x1bc8('0xd')},'gateway':{'type':Sequelize[_0x1bc8('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1bc8('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1bc8('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1bc8('0x3')](_0x1bc8('0xf'),_0x1bc8('0x10'),_0x1bc8('0x11'),_0x1bc8('0x12')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x1bc8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1bc8('0x13')],'defaultValue':function(){return _0x1bc8('0x14');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1bc8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1bc8('0x15')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1bc8('0x15')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1bc8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1bc8('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x1bc8('0x16')},'mandatoryDisposition':{'type':Sequelize[_0x1bc8('0x15')],'defaultValue':![],'comment':_0x1bc8('0x17'),'set':function(_0x23bb13){if(!_0x23bb13)this[_0x1bc8('0x18')](_0x1bc8('0x19'),null);this[_0x1bc8('0x18')]('mandatoryDisposition',_0x23bb13);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 0e00b84..9507e94 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 _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 +var _0xf3cc=['Tag','Tags','color','tag','addApplications','transaction','FaxApplication','findAndCountAll','priority','getApplications','app','system','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','localstationid','headerinfo','maxrate','minrate','modem','t38timeout','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','addAccountApplications','sequelize','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','createdAt','updatedAt','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','ListId','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','params','length','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','Disposition','rawAttributes','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','internal'];(function(_0x37de50,_0x27f82a){var _0x2c37dc=function(_0x325186){while(--_0x325186){_0x37de50['push'](_0x37de50['shift']());}};_0x2c37dc(++_0x27f82a);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x51f593,_0x38d2ec){_0x51f593=_0x51f593-0x0;var _0x4ccfbf=_0xf3cc[_0x51f593];return _0x4ccfbf;};'use strict';var pdf=require(_0xcf3c('0x0'));var emlformat=require(_0xcf3c('0x1'));var rimraf=require(_0xcf3c('0x2'));var zipdir=require(_0xcf3c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf3c('0x4'));var moment=require(_0xcf3c('0x5'));var BPromise=require(_0xcf3c('0x6'));var Mustache=require('mustache');var util=require(_0xcf3c('0x7'));var path=require(_0xcf3c('0x8'));var sox=require('sox');var csv=require(_0xcf3c('0x9'));var ejs=require(_0xcf3c('0xa'));var fs=require('fs');var _=require(_0xcf3c('0xb'));var squel=require(_0xcf3c('0xc'));var crypto=require(_0xcf3c('0xd'));var jsforce=require(_0xcf3c('0xe'));var deskjs=require(_0xcf3c('0xf'));var toCsv=require(_0xcf3c('0x9'));var querystring=require(_0xcf3c('0x10'));var Papa=require(_0xcf3c('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf3c('0x12'));var as=require(_0xcf3c('0x13'));var hardwareService=require(_0xcf3c('0x14'));var logger=require(_0xcf3c('0x15'))(_0xcf3c('0x16'));var utils=require(_0xcf3c('0x17'));var config=require(_0xcf3c('0x18'));var licenseUtil=require(_0xcf3c('0x19'));var db=require('../../mysqldb')['db'];config[_0xcf3c('0x1a')]=_[_0xcf3c('0x1b')](config['redis'],{'host':_0xcf3c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xcf3c('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcf3c('0x1e')][_0xcf3c('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xcf3c('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x540046,_0x30d023,_0x1db425,_0x146f3a){return new BPromise(function(_0x5157d8,_0xd4d472){var _0x190c8c=_0x146f3a||client;return _0x190c8c[_0xcf3c('0x20')](_0x540046,_0x1db425)[_0xcf3c('0x21')](function(_0x548dec){logger[_0xcf3c('0x22')](_0xcf3c('0x23'),_0x30d023,_0xcf3c('0x24'));logger[_0xcf3c('0x25')](_0xcf3c('0x26'),_0x30d023,_0xcf3c('0x24'),JSON[_0xcf3c('0x27')](_0x548dec));if(_0x548dec[_0xcf3c('0x28')]){if(_0x548dec[_0xcf3c('0x28')][_0xcf3c('0x29')]===0x1f4){logger[_0xcf3c('0x28')](_0xcf3c('0x23'),_0x30d023,_0x548dec['error'][_0xcf3c('0x2a')]);return _0xd4d472(_0x548dec['error'][_0xcf3c('0x2a')]);}logger[_0xcf3c('0x28')]('FaxAccount,\x20%s,\x20%s',_0x30d023,_0x548dec[_0xcf3c('0x28')][_0xcf3c('0x2a')]);return _0x5157d8(_0x548dec[_0xcf3c('0x28')][_0xcf3c('0x2a')]);}else{logger[_0xcf3c('0x22')](_0xcf3c('0x23'),_0x30d023,_0xcf3c('0x24'));_0x5157d8(_0x548dec[_0xcf3c('0x2b')]['message']);}})[_0xcf3c('0x2c')](function(_0x4ce43c){logger[_0xcf3c('0x28')](_0xcf3c('0x23'),_0x30d023,_0x4ce43c);_0xd4d472(_0x4ce43c);});});}function respondWithStatusCode(_0x42ce14,_0x35e546){_0x35e546=_0x35e546||0xcc;return function(_0x181c90){if(_0x181c90){return _0x42ce14[_0xcf3c('0x2d')](_0x35e546);}return _0x42ce14['status'](_0x35e546)[_0xcf3c('0x2e')]();};}function respondWithResult(_0x4e06b5,_0x47d619){_0x47d619=_0x47d619||0xc8;return function(_0x3b9b48){if(_0x3b9b48){return _0x4e06b5[_0xcf3c('0x2f')](_0x47d619)['json'](_0x3b9b48);}};}function respondWithFilteredResult(_0x397996,_0x54174a){return function(_0x1d8223){if(_0x1d8223){var _0xe22e99=_0x1d8223[_0xcf3c('0x30')],_0x21a329=_0x54174a[_0xcf3c('0x31')],_0x5bdae3=_0x54174a[_0xcf3c('0x31')]+_0x54174a[_0xcf3c('0x32')],_0x5835b2;if(_0x5bdae3>=_0xe22e99){_0x5bdae3=_0xe22e99;_0x5835b2=0xc8;}else{_0x5835b2=0xce;}_0x397996['status'](_0x5835b2);return _0x397996[_0xcf3c('0x33')](_0xcf3c('0x34'),_0x21a329+'-'+_0x5bdae3+'/'+_0xe22e99)[_0xcf3c('0x35')](_0x1d8223);}return null;};}function patchUpdates(_0x5b6193){return function(_0x3a5880){try{jsonpatch[_0xcf3c('0x36')](_0x3a5880,_0x5b6193,!![]);}catch(_0x196b02){return BPromise['reject'](_0x196b02);}return _0x3a5880[_0xcf3c('0x37')]();};}function saveUpdates(_0x179d2b,_0x45a611){return function(_0x2e7b19){if(_0x2e7b19){return _0x2e7b19[_0xcf3c('0x38')](_0x179d2b)['then'](function(_0x2aced6){return _0x2aced6;});}return null;};}function removeEntity(_0x549fb4,_0x9d445d){return function(_0x57d644){if(_0x57d644){return _0x57d644[_0xcf3c('0x39')]()[_0xcf3c('0x21')](function(){var _0x32b41d=_0x57d644[_0xcf3c('0x3a')]({'plain':!![]});var _0x2a014a=_0xcf3c('0x3b');return db[_0xcf3c('0x3c')][_0xcf3c('0x39')]({'where':{'type':_0x2a014a,'resourceId':_0x32b41d['id']}})['then'](function(){return _0x57d644;});})[_0xcf3c('0x21')](function(){_0x549fb4[_0xcf3c('0x2f')](0xcc)[_0xcf3c('0x2e')]();});}};}function handleEntityNotFound(_0x7c323d,_0x34ea9f){return function(_0x161ef9){if(!_0x161ef9){_0x7c323d[_0xcf3c('0x2d')](0x194);}return _0x161ef9;};}function handleError(_0xff382e,_0x16f81d){_0x16f81d=_0x16f81d||0x1f4;return function(_0x22fed3){logger['error'](_0x22fed3[_0xcf3c('0x3d')]);if(_0x22fed3['name']){delete _0x22fed3['name'];}_0xff382e['status'](_0x16f81d)[_0xcf3c('0x3e')](_0x22fed3);};}exports[_0xcf3c('0x3f')]=function(_0xa5cc73,_0x982133){var _0x5dda95={'include':[{'model':db[_0xcf3c('0x40')],'as':_0xcf3c('0x41')}]},_0x54ca05={},_0x27e186={'count':0x0,'rows':[]};var _0x9c753f=_[_0xcf3c('0x42')](db[_0xcf3c('0x43')]['rawAttributes'],function(_0x292f15){return{'name':_0x292f15[_0xcf3c('0x44')],'type':_0x292f15[_0xcf3c('0x45')]['key']};});_0x54ca05[_0xcf3c('0x46')]=_['map'](_0x9c753f,'name');_0x54ca05[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0xa5cc73[_0xcf3c('0x47')]);_0x54ca05[_0xcf3c('0x49')]=_[_0xcf3c('0x4a')](_0x54ca05[_0xcf3c('0x46')],_0x54ca05[_0xcf3c('0x47')]);_0x5dda95[_0xcf3c('0x4b')]=_[_0xcf3c('0x4a')](_0x54ca05['model'],qs['fields'](_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x4c')]));_0x5dda95['attributes']=_0x5dda95[_0xcf3c('0x4b')]['length']?_0x5dda95[_0xcf3c('0x4b')]:_0x54ca05[_0xcf3c('0x46')];if(!_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x4d')](_0xcf3c('0x4e'))){_0x5dda95[_0xcf3c('0x32')]=qs[_0xcf3c('0x32')](_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x32')]);_0x5dda95[_0xcf3c('0x31')]=qs[_0xcf3c('0x31')](_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x31')]);}_0x5dda95[_0xcf3c('0x4f')]=qs[_0xcf3c('0x50')](_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x50')]);_0x5dda95[_0xcf3c('0x51')]=qs['filters'](_['pick'](_0xa5cc73[_0xcf3c('0x47')],_0x54ca05['filters']),_0x9c753f);if(_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x52')]){_0x5dda95[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x5dda95[_0xcf3c('0x51')],{'$or':_['map'](_0x9c753f,function(_0x5b6802){if(_0x5b6802['type']!==_0xcf3c('0x54')){var _0x1eb439={};_0x1eb439[_0x5b6802['name']]={'$like':'%'+_0xa5cc73[_0xcf3c('0x47')][_0xcf3c('0x52')]+'%'};return _0x1eb439;}})});}_0x5dda95=_[_0xcf3c('0x53')]({},_0x5dda95,_0xa5cc73[_0xcf3c('0x55')]);var _0x391976={'where':_0x5dda95[_0xcf3c('0x51')]};return db[_0xcf3c('0x43')][_0xcf3c('0x30')](_0x391976)[_0xcf3c('0x21')](function(_0x2c8234){_0x27e186[_0xcf3c('0x30')]=_0x2c8234;if(_0xa5cc73[_0xcf3c('0x47')]['includeAll']){_0x5dda95[_0xcf3c('0x56')]=[{'all':!![]}];}return db[_0xcf3c('0x43')][_0xcf3c('0x57')](_0x5dda95);})[_0xcf3c('0x21')](function(_0x4d0be6){_0x27e186[_0xcf3c('0x58')]=_0x4d0be6;return _0x27e186;})['then'](respondWithFilteredResult(_0x982133,_0x5dda95))[_0xcf3c('0x2c')](handleError(_0x982133,null));};exports['show']=function(_0x524fde,_0x4bba35){var _0x5e3abc={'raw':![],'where':{'id':_0x524fde[_0xcf3c('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xcf3c('0x41')}]},_0x1ee0f7={};_0x1ee0f7[_0xcf3c('0x46')]=_[_0xcf3c('0x48')](db['FaxAccount']['rawAttributes']);_0x1ee0f7[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0x524fde['query']);_0x1ee0f7['filters']=_['intersection'](_0x1ee0f7[_0xcf3c('0x46')],_0x1ee0f7['query']);_0x5e3abc[_0xcf3c('0x4b')]=_['intersection'](_0x1ee0f7[_0xcf3c('0x46')],qs[_0xcf3c('0x4c')](_0x524fde[_0xcf3c('0x47')][_0xcf3c('0x4c')]));_0x5e3abc[_0xcf3c('0x4b')]=_0x5e3abc['attributes'][_0xcf3c('0x5a')]?_0x5e3abc[_0xcf3c('0x4b')]:_0x1ee0f7[_0xcf3c('0x46')];if(_0x524fde[_0xcf3c('0x47')][_0xcf3c('0x5b')]){_0x5e3abc[_0xcf3c('0x56')]=[{'all':!![]}];}_0x5e3abc=_[_0xcf3c('0x53')]({},_0x5e3abc,_0x524fde['options']);return db['FaxAccount']['find'](_0x5e3abc)[_0xcf3c('0x21')](handleEntityNotFound(_0x4bba35,null))['then'](respondWithResult(_0x4bba35,null))['catch'](handleError(_0x4bba35,null));};exports[_0xcf3c('0x5c')]=function(_0x15db17,_0xf4f3ba){return db['FaxAccount'][_0xcf3c('0x5c')](_0x15db17['body'],{})[_0xcf3c('0x21')](function(_0x14f8e4){var _0x26c221=_0x15db17[_0xcf3c('0x5d')][_0xcf3c('0x3a')]({'plain':!![]});if(!_0x26c221)throw new Error(_0xcf3c('0x5e'));if(_0x26c221[_0xcf3c('0x5f')]===_0xcf3c('0x5d')){var _0xaacb84=_0x14f8e4[_0xcf3c('0x3a')]({'plain':!![]});var _0x437a6c='FaxAccounts';return db[_0xcf3c('0x60')][_0xcf3c('0x61')]({'where':{'name':_0x437a6c,'userProfileId':_0x26c221[_0xcf3c('0x62')]},'raw':!![]})[_0xcf3c('0x21')](function(_0x127856){if(_0x127856&&_0x127856[_0xcf3c('0x63')]===0x0){return db['UserProfileResource'][_0xcf3c('0x5c')]({'name':_0xaacb84['name'],'resourceId':_0xaacb84['id'],'type':_0x127856[_0xcf3c('0x64')],'sectionId':_0x127856['id']},{})['then'](function(){return _0x14f8e4;});}else{return _0x14f8e4;}})['catch'](function(_0x50fd2d){logger[_0xcf3c('0x28')](_0xcf3c('0x65'),_0x50fd2d);throw _0x50fd2d;});}return _0x14f8e4;})['then'](respondWithResult(_0xf4f3ba,0xc9))[_0xcf3c('0x2c')](handleError(_0xf4f3ba,null));};exports[_0xcf3c('0x38')]=function(_0x1b1e4a,_0x4084ac){if(_0x1b1e4a[_0xcf3c('0x66')]['id']){delete _0x1b1e4a[_0xcf3c('0x66')]['id'];}return db['FaxAccount'][_0xcf3c('0x61')]({'where':{'id':_0x1b1e4a[_0xcf3c('0x59')]['id']},'include':[{'model':db[_0xcf3c('0x40')],'as':_0xcf3c('0x41')}]})[_0xcf3c('0x21')](handleEntityNotFound(_0x4084ac,null))[_0xcf3c('0x21')](saveUpdates(_0x1b1e4a[_0xcf3c('0x66')],null))[_0xcf3c('0x21')](respondWithResult(_0x4084ac,null))[_0xcf3c('0x2c')](handleError(_0x4084ac,null));};exports[_0xcf3c('0x39')]=function(_0x1adca9,_0x46fc82){return db[_0xcf3c('0x43')][_0xcf3c('0x61')]({'where':{'id':_0x1adca9[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x46fc82,null))[_0xcf3c('0x21')](removeEntity(_0x46fc82,null))[_0xcf3c('0x2c')](handleError(_0x46fc82,null));};exports['describe']=function(_0x19680d,_0x221bf4){return db[_0xcf3c('0x43')][_0xcf3c('0x67')]()[_0xcf3c('0x21')](respondWithResult(_0x221bf4,null))[_0xcf3c('0x2c')](handleError(_0x221bf4,null));};exports[_0xcf3c('0x68')]=function(_0x1c9e26,_0x2ddec1,_0x5b786e){if(_0x1c9e26[_0xcf3c('0x66')]['id']){delete _0x1c9e26['body']['id'];}return db[_0xcf3c('0x43')][_0xcf3c('0x61')]({'where':{'id':_0x1c9e26[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x2ddec1,null))[_0xcf3c('0x21')](function(_0x482717){if(_0x482717){_0x1c9e26['body'][_0xcf3c('0x69')]=_0x482717['id'];return db['Disposition']['create'](_0x1c9e26['body']);}})[_0xcf3c('0x21')](respondWithResult(_0x2ddec1,null))[_0xcf3c('0x2c')](handleError(_0x2ddec1,null));};exports[_0xcf3c('0x6a')]=function(_0x327692,_0x5d5664,_0x3c3f15){var _0x4fa83d={'raw':![],'where':{}};var _0xd2b503={};var _0x258a4a={'count':0x0,'rows':[]};return db[_0xcf3c('0x43')]['findOne']({'where':{'id':_0x327692[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x5d5664,null))[_0xcf3c('0x21')](function(_0x95ce18){if(_0x95ce18){_0xd2b503[_0xcf3c('0x46')]=_[_0xcf3c('0x48')](db[_0xcf3c('0x6b')][_0xcf3c('0x6c')]);_0xd2b503[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0x327692[_0xcf3c('0x47')]);_0xd2b503[_0xcf3c('0x49')]=_[_0xcf3c('0x4a')](_0xd2b503[_0xcf3c('0x46')],_0xd2b503[_0xcf3c('0x47')]);_0x4fa83d[_0xcf3c('0x4b')]=_['intersection'](_0xd2b503[_0xcf3c('0x46')],qs[_0xcf3c('0x4c')](_0x327692[_0xcf3c('0x47')]['fields']));_0x4fa83d[_0xcf3c('0x4b')]=_0x4fa83d[_0xcf3c('0x4b')][_0xcf3c('0x5a')]?_0x4fa83d[_0xcf3c('0x4b')]:_0xd2b503[_0xcf3c('0x46')];if(!_0x327692[_0xcf3c('0x47')][_0xcf3c('0x4d')](_0xcf3c('0x4e'))){_0x4fa83d['limit']=qs[_0xcf3c('0x32')](_0x327692[_0xcf3c('0x47')]['limit']);_0x4fa83d[_0xcf3c('0x31')]=qs['offset'](_0x327692[_0xcf3c('0x47')][_0xcf3c('0x31')]);}_0x4fa83d[_0xcf3c('0x4f')]=qs[_0xcf3c('0x50')](_0x327692['query'][_0xcf3c('0x50')]);_0x4fa83d[_0xcf3c('0x51')]=qs['filters'](_[_0xcf3c('0x6d')](_0x327692[_0xcf3c('0x47')],_0xd2b503[_0xcf3c('0x49')]));_0x4fa83d[_0xcf3c('0x51')][_0xcf3c('0x69')]=_0x95ce18['id'];if(_0x327692['query'][_0xcf3c('0x52')]){_0x4fa83d[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x4fa83d[_0xcf3c('0x51')],{'$or':_[_0xcf3c('0x42')](_0x4fa83d[_0xcf3c('0x4b')],function(_0x2ef478){var _0x43763c={};_0x43763c[_0x2ef478]={'$like':'%'+_0x327692['query'][_0xcf3c('0x52')]+'%'};return _0x43763c;})});}_0x4fa83d=_[_0xcf3c('0x53')]({},_0x4fa83d,_0x327692[_0xcf3c('0x55')]);return db[_0xcf3c('0x6b')][_0xcf3c('0x30')]({'where':_0x4fa83d['where']})[_0xcf3c('0x21')](function(_0x235263){_0x258a4a['count']=_0x235263;if(_0x327692['query'][_0xcf3c('0x5b')]){_0x4fa83d[_0xcf3c('0x56')]=[{'all':!![]}];}return db[_0xcf3c('0x6b')][_0xcf3c('0x57')](_0x4fa83d);})[_0xcf3c('0x21')](function(_0x16a973){_0x258a4a['rows']=_0x16a973;return _0x258a4a;});}})[_0xcf3c('0x21')](respondWithFilteredResult(_0x5d5664,_0x4fa83d))['catch'](handleError(_0x5d5664,null));};exports['removeDispositions']=function(_0x4bb1a5,_0x573288,_0x51bbce){return db['FaxAccount']['find']({'where':{'id':_0x4bb1a5[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x573288,null))[_0xcf3c('0x21')](function(_0x509239){if(_0x509239){return _0x509239[_0xcf3c('0x6e')](_0x4bb1a5[_0xcf3c('0x47')][_0xcf3c('0x6f')]);}})[_0xcf3c('0x21')](respondWithStatusCode(_0x573288,null))[_0xcf3c('0x2c')](handleError(_0x573288,null));};exports[_0xcf3c('0x70')]=function(_0x4994d9,_0x79c19,_0x1b2ee1){if(_0x4994d9['body']['id']){delete _0x4994d9[_0xcf3c('0x66')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4994d9[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x79c19,null))[_0xcf3c('0x21')](function(_0x2cba2d){if(_0x2cba2d){_0x4994d9[_0xcf3c('0x66')][_0xcf3c('0x69')]=_0x2cba2d['id'];return db[_0xcf3c('0x71')][_0xcf3c('0x5c')](_0x4994d9[_0xcf3c('0x66')]);}})[_0xcf3c('0x21')](respondWithResult(_0x79c19,null))[_0xcf3c('0x2c')](handleError(_0x79c19,null));};exports[_0xcf3c('0x72')]=function(_0x3e93ad,_0x55a568,_0x3ad2ac){var _0x479c09={'raw':![],'where':{}};var _0x49ec92={};var _0x3edb68={'count':0x0,'rows':[]};return db[_0xcf3c('0x43')][_0xcf3c('0x73')]({'where':{'id':_0x3e93ad[_0xcf3c('0x59')]['id']}})['then'](handleEntityNotFound(_0x55a568,null))[_0xcf3c('0x21')](function(_0x17d364){if(_0x17d364){_0x49ec92[_0xcf3c('0x46')]=_[_0xcf3c('0x48')](db[_0xcf3c('0x71')][_0xcf3c('0x6c')]);_0x49ec92[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0x3e93ad[_0xcf3c('0x47')]);_0x49ec92[_0xcf3c('0x49')]=_[_0xcf3c('0x4a')](_0x49ec92[_0xcf3c('0x46')],_0x49ec92[_0xcf3c('0x47')]);_0x479c09[_0xcf3c('0x4b')]=_[_0xcf3c('0x4a')](_0x49ec92[_0xcf3c('0x46')],qs[_0xcf3c('0x4c')](_0x3e93ad['query'][_0xcf3c('0x4c')]));_0x479c09[_0xcf3c('0x4b')]=_0x479c09['attributes'][_0xcf3c('0x5a')]?_0x479c09['attributes']:_0x49ec92[_0xcf3c('0x46')];if(!_0x3e93ad['query'][_0xcf3c('0x4d')](_0xcf3c('0x4e'))){_0x479c09[_0xcf3c('0x32')]=qs[_0xcf3c('0x32')](_0x3e93ad['query'][_0xcf3c('0x32')]);_0x479c09[_0xcf3c('0x31')]=qs[_0xcf3c('0x31')](_0x3e93ad[_0xcf3c('0x47')][_0xcf3c('0x31')]);}_0x479c09[_0xcf3c('0x4f')]=qs['sort'](_0x3e93ad['query'][_0xcf3c('0x50')]);_0x479c09[_0xcf3c('0x51')]=qs[_0xcf3c('0x49')](_[_0xcf3c('0x6d')](_0x3e93ad[_0xcf3c('0x47')],_0x49ec92[_0xcf3c('0x49')]));_0x479c09[_0xcf3c('0x51')]['FaxAccountId']=_0x17d364['id'];if(_0x3e93ad[_0xcf3c('0x47')][_0xcf3c('0x52')]){_0x479c09[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x479c09[_0xcf3c('0x51')],{'$or':_[_0xcf3c('0x42')](_0x479c09['attributes'],function(_0x5a29ac){var _0x10e9f9={};_0x10e9f9[_0x5a29ac]={'$like':'%'+_0x3e93ad['query'][_0xcf3c('0x52')]+'%'};return _0x10e9f9;})});}_0x479c09=_[_0xcf3c('0x53')]({},_0x479c09,_0x3e93ad['options']);return db[_0xcf3c('0x71')][_0xcf3c('0x30')]({'where':_0x479c09['where']})[_0xcf3c('0x21')](function(_0x255bb4){_0x3edb68[_0xcf3c('0x30')]=_0x255bb4;if(_0x3e93ad[_0xcf3c('0x47')]['includeAll']){_0x479c09[_0xcf3c('0x56')]=[{'all':!![]}];}return db[_0xcf3c('0x71')]['findAll'](_0x479c09);})[_0xcf3c('0x21')](function(_0x59ae75){_0x3edb68[_0xcf3c('0x58')]=_0x59ae75;return _0x3edb68;});}})[_0xcf3c('0x21')](respondWithFilteredResult(_0x55a568,_0x479c09))['catch'](handleError(_0x55a568,null));};exports[_0xcf3c('0x74')]=function(_0x36c5ef,_0x3433d3,_0x36d9eb){return db[_0xcf3c('0x43')][_0xcf3c('0x61')]({'where':{'id':_0x36c5ef['params']['id']}})['then'](handleEntityNotFound(_0x3433d3,null))[_0xcf3c('0x21')](function(_0x36ab71){if(_0x36ab71){return _0x36ab71[_0xcf3c('0x74')](_0x36c5ef[_0xcf3c('0x47')]['ids']);}})[_0xcf3c('0x21')](respondWithStatusCode(_0x3433d3,null))['catch'](handleError(_0x3433d3,null));};exports[_0xcf3c('0x75')]=function(_0x12a882,_0x379e3b,_0x216c1e){return db['FaxInteraction'][_0xcf3c('0x61')]({'where':{'id':_0x12a882[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x379e3b,null))[_0xcf3c('0x21')](function(_0x34cbf8){if(_0x34cbf8){return _0x34cbf8['addInteraction'](_0x12a882[_0xcf3c('0x66')]['ids'],_[_0xcf3c('0x76')](_0x12a882['body'],[_0xcf3c('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x379e3b,null))[_0xcf3c('0x2c')](handleError(_0x379e3b,null));};exports[_0xcf3c('0x77')]=function(_0x26640b,_0xc477a2,_0x3f95fd){var _0x27d5a6={'raw':![],'where':{}};var _0x12a9bf={};var _0x5236b9={'count':0x0,'rows':[]};return db[_0xcf3c('0x43')][_0xcf3c('0x73')]({'where':{'id':_0x26640b['params']['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0xc477a2,null))[_0xcf3c('0x21')](function(_0x1a486f){if(_0x1a486f){_0x12a9bf[_0xcf3c('0x46')]=_[_0xcf3c('0x48')](db[_0xcf3c('0x78')][_0xcf3c('0x6c')]);_0x12a9bf[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0x26640b[_0xcf3c('0x47')]);_0x12a9bf[_0xcf3c('0x49')]=_[_0xcf3c('0x4a')](_0x12a9bf[_0xcf3c('0x46')],_0x12a9bf[_0xcf3c('0x47')]);_0x27d5a6[_0xcf3c('0x4b')]=_[_0xcf3c('0x4a')](_0x12a9bf[_0xcf3c('0x46')],qs['fields'](_0x26640b[_0xcf3c('0x47')]['fields']));_0x27d5a6[_0xcf3c('0x4b')]=_0x27d5a6[_0xcf3c('0x4b')][_0xcf3c('0x5a')]?_0x27d5a6[_0xcf3c('0x4b')]:_0x12a9bf[_0xcf3c('0x46')];if(!_0x26640b[_0xcf3c('0x47')]['hasOwnProperty'](_0xcf3c('0x4e'))){_0x27d5a6['limit']=qs[_0xcf3c('0x32')](_0x26640b[_0xcf3c('0x47')][_0xcf3c('0x32')]);_0x27d5a6[_0xcf3c('0x31')]=qs[_0xcf3c('0x31')](_0x26640b[_0xcf3c('0x47')][_0xcf3c('0x31')]);}_0x27d5a6['order']=qs[_0xcf3c('0x50')](_0x26640b[_0xcf3c('0x47')]['sort']);_0x27d5a6['where']=qs[_0xcf3c('0x49')](_[_0xcf3c('0x6d')](_0x26640b[_0xcf3c('0x47')],_0x12a9bf['filters']));_0x27d5a6[_0xcf3c('0x51')][_0xcf3c('0x69')]=_0x1a486f['id'];if(_0x26640b[_0xcf3c('0x47')][_0xcf3c('0x52')]){_0x27d5a6[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x27d5a6['where'],{'$or':_[_0xcf3c('0x42')](_0x27d5a6[_0xcf3c('0x4b')],function(_0x18404f){var _0x25ec48={};_0x25ec48[_0x18404f]={'$like':'%'+_0x26640b[_0xcf3c('0x47')][_0xcf3c('0x52')]+'%'};return _0x25ec48;})});}_0x27d5a6=_[_0xcf3c('0x53')]({},_0x27d5a6,_0x26640b[_0xcf3c('0x55')]);return db[_0xcf3c('0x78')][_0xcf3c('0x30')]({'where':_0x27d5a6['where']})['then'](function(_0x3c044d){_0x5236b9['count']=_0x3c044d;if(_0x26640b[_0xcf3c('0x47')]['includeAll']){_0x27d5a6['include']=[{'model':db[_0xcf3c('0x79')],'as':_0xcf3c('0x7a'),'required':![]},{'model':db[_0xcf3c('0x7b')],'as':'Owner','attributes':['name','fullname',_0xcf3c('0x7c')],'required':![]},{'model':db[_0xcf3c('0x7d')],'as':_0xcf3c('0x7e'),'attributes':['id','name',_0xcf3c('0x7f')],'where':_0x26640b[_0xcf3c('0x47')][_0xcf3c('0x80')]?{'id':_0x26640b[_0xcf3c('0x47')]['tag']}:undefined,'required':_0x26640b[_0xcf3c('0x47')][_0xcf3c('0x80')]?!![]:![]}];}return db['FaxInteraction'][_0xcf3c('0x57')](_0x27d5a6);})['then'](function(_0x232640){_0x5236b9['rows']=_0x232640;return _0x5236b9;});}})[_0xcf3c('0x21')](respondWithFilteredResult(_0xc477a2,_0x27d5a6))['catch'](handleError(_0xc477a2,null));};exports[_0xcf3c('0x81')]=function(_0xf12f1c,_0x142db7,_0x17c35f){return db[_0xcf3c('0x43')]['findOne']({'where':{'id':_0xf12f1c[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x142db7,null))[_0xcf3c('0x21')](function(_0x4919fd){if(_0x4919fd){return db['sequelize'][_0xcf3c('0x82')](function(_0x18a7f8){return db['FaxApplication'][_0xcf3c('0x39')]({'where':{'FaxAccountId':_0xf12f1c[_0xcf3c('0x59')]['id']},'transaction':_0x18a7f8})[_0xcf3c('0x21')](function(_0x2abd8c){var _0x21a78c=_[_0xcf3c('0x42')](_0xf12f1c[_0xcf3c('0x66')],function(_0x5e7f36){_0x5e7f36[_0xcf3c('0x69')]=_0xf12f1c[_0xcf3c('0x59')]['id'];return _0x5e7f36;});return db['FaxApplication']['bulkCreate'](_0x21a78c,{'transaction':_0x18a7f8});});})['then'](function(){return db[_0xcf3c('0x83')][_0xcf3c('0x84')]({'where':{'FaxAccountId':_0xf12f1c[_0xcf3c('0x59')]['id']},'order':_0xcf3c('0x85')});});}})['then'](respondWithResult(_0x142db7,null))[_0xcf3c('0x2c')](handleError(_0x142db7,null));};exports[_0xcf3c('0x86')]=function(_0x1c4fba,_0x367f5b,_0x1ef2f8){var _0x23553b={};var _0x26b1b3={};var _0xc304f3;var _0x1d80cd;return db[_0xcf3c('0x43')][_0xcf3c('0x73')]({'where':{'id':_0x1c4fba[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x367f5b,null))[_0xcf3c('0x21')](function(_0x11a129){if(_0x11a129){_0xc304f3=_0x11a129;_0x26b1b3['model']=_['keys'](db['FaxApplication']['rawAttributes']);_0x26b1b3[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0x1c4fba[_0xcf3c('0x47')]);_0x26b1b3[_0xcf3c('0x49')]=_['intersection'](_0x26b1b3[_0xcf3c('0x46')],_0x26b1b3[_0xcf3c('0x47')]);_0x23553b[_0xcf3c('0x4b')]=_['intersection'](_0x26b1b3[_0xcf3c('0x46')],qs[_0xcf3c('0x4c')](_0x1c4fba[_0xcf3c('0x47')][_0xcf3c('0x4c')]));_0x23553b['attributes']=_0x23553b[_0xcf3c('0x4b')][_0xcf3c('0x5a')]?_0x23553b[_0xcf3c('0x4b')]:_0x26b1b3[_0xcf3c('0x46')];_0x23553b[_0xcf3c('0x4f')]=qs[_0xcf3c('0x50')](_0x1c4fba[_0xcf3c('0x47')][_0xcf3c('0x50')]);_0x23553b[_0xcf3c('0x51')]=qs['filters'](_['pick'](_0x1c4fba[_0xcf3c('0x47')],_0x26b1b3[_0xcf3c('0x49')]));if(_0x1c4fba[_0xcf3c('0x47')]['filter']){_0x23553b[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x23553b[_0xcf3c('0x51')],{'$or':_['map'](_0x23553b[_0xcf3c('0x4b')],function(_0x18123e){var _0x3c8f36={};_0x3c8f36[_0x18123e]={'$like':'%'+_0x1c4fba['query'][_0xcf3c('0x52')]+'%'};return _0x3c8f36;})});}_0x23553b=_[_0xcf3c('0x53')]({},_0x23553b,_0x1c4fba['options']);return _0xc304f3[_0xcf3c('0x86')](_0x23553b);}})[_0xcf3c('0x21')](function(_0x4c8fe6){if(_0x4c8fe6){_0x1d80cd=_0x4c8fe6['length'];if(!_0x1c4fba[_0xcf3c('0x47')]['hasOwnProperty']('nolimit')){_0x23553b[_0xcf3c('0x32')]=qs[_0xcf3c('0x32')](_0x1c4fba[_0xcf3c('0x47')][_0xcf3c('0x32')]);_0x23553b['offset']=qs[_0xcf3c('0x31')](_0x1c4fba[_0xcf3c('0x47')][_0xcf3c('0x31')]);}return _0xc304f3[_0xcf3c('0x86')](_0x23553b);}})[_0xcf3c('0x21')](function(_0xfa6f49){if(_0xfa6f49){return _0xfa6f49?{'count':_0x1d80cd,'rows':_0xfa6f49}:null;}})[_0xcf3c('0x21')](respondWithResult(_0x367f5b,null))[_0xcf3c('0x2c')](handleError(_0x367f5b,null));};function Extension(_0x315333,_0x1639ad,_0x5a987b,_0x2aef16){this['context']='from-voip-provider';this['exten']=_0x315333['localstationid'];this[_0xcf3c('0x87')]=_0x2aef16;this[_0xcf3c('0x45')]=_0xcf3c('0x88');this['description']='Fax\x20Extension';this[_0xcf3c('0x69')]=_0x315333['id'];this['priority']=_0x1639ad;this[_0xcf3c('0x89')]=_0x5a987b;}function createExtensionsReciveFax(_0x5db512){var _0x5339f6=0x1;var _0x1a2b6e=[];_0x1a2b6e[_0xcf3c('0x8a')](new Extension(_0x5db512,_0x5339f6,'',_0xcf3c('0x8b')));_0x5339f6+=0x1;_0x1a2b6e['push'](new Extension(_0x5db512,_0x5339f6,_0xcf3c('0x8c'),_0xcf3c('0x8d')));_0x5339f6+=0x1;for(var _0x13b57e in _0x5db512){if(_0x5db512[_0xcf3c('0x4d')](_0x13b57e)&&(_0x13b57e===_0xcf3c('0x8e')||_0x13b57e===_0xcf3c('0x8f')||_0x13b57e==='gateway'||_0x13b57e==='faxdetect'||_0x13b57e===_0xcf3c('0x90')||_0x13b57e===_0xcf3c('0x91')||_0x13b57e===_0xcf3c('0x92')||_0x13b57e===_0xcf3c('0x93')||_0x13b57e===_0xcf3c('0x94'))){_0x1a2b6e[_0xcf3c('0x8a')](new Extension(_0x5db512,_0x5339f6,_0xcf3c('0x95')+_0x13b57e+')='+_0x5db512[_0x13b57e],'Set'));_0x5339f6+=0x1;}}_0x1a2b6e[_0xcf3c('0x8a')](new Extension(_0x5db512,_0x5339f6,'6',_0xcf3c('0x96')));_0x5339f6+=0x1;_0x1a2b6e['push'](new Extension(_0x5db512,_0x5339f6,_0xcf3c('0x97'),'ReceiveFax'));_0x5339f6=0x0;return _0x1a2b6e;}exports[_0xcf3c('0x98')]=function(_0x69ff63,_0x156743,_0x33917a){var _0x3fd48e;return db[_0xcf3c('0x99')][_0xcf3c('0x82')](function(_0x188d9b){return db[_0xcf3c('0x43')]['create'](_0x69ff63[_0xcf3c('0x66')],{'transaction':_0x188d9b})[_0xcf3c('0x21')](function(_0x354eb9){_0x3fd48e=_0x354eb9['get']({'plain':!![]});return db[_0xcf3c('0x9a')][_0xcf3c('0x9b')](createExtensionsReciveFax(_0x3fd48e),{'transaction':_0x188d9b});});})[_0xcf3c('0x21')](function(){return _0x3fd48e;})[_0xcf3c('0x21')](respondWithResult(_0x156743,null))[_0xcf3c('0x2c')](handleError(_0x156743,null));};exports[_0xcf3c('0x9c')]=function(_0x114abe,_0x133a01,_0x5c2734){var _0x10bb7b;return db['sequelize'][_0xcf3c('0x82')](function(_0x251738){return db[_0xcf3c('0x43')][_0xcf3c('0x38')](_0x114abe[_0xcf3c('0x66')],{'where':{'id':_0x114abe[_0xcf3c('0x66')]['id']},'transaction':_0x251738})[_0xcf3c('0x21')](function(_0x18dbe6){return db[_0xcf3c('0x9a')][_0xcf3c('0x39')]({'where':{'FaxAccountId':_0x114abe[_0xcf3c('0x66')]['id']},'transaction':_0x251738})[_0xcf3c('0x21')](function(_0x25bbc8){return db['VoiceExtension'][_0xcf3c('0x9b')](createExtensionsReciveFax(_['omit'](_0x114abe[_0xcf3c('0x66')],[_0xcf3c('0x9d'),_0xcf3c('0x9e'),_0xcf3c('0x9f'),_0xcf3c('0xa0'),'TrunkId','ListId'])),{'transaction':_0x251738});});});})[_0xcf3c('0x21')](function(){return db[_0xcf3c('0x43')]['findById'](_0x114abe[_0xcf3c('0x66')]['id']);})['then'](respondWithResult(_0x133a01,null))['catch'](handleError(_0x133a01,null));};exports['getMessages']=function(_0x4f1e20,_0x4fe25d,_0x76d442){var _0x14ebf0={'raw':!![],'where':{}};var _0x384bd4={};var _0x2a3004={'count':0x0,'rows':[]};return db[_0xcf3c('0x43')][_0xcf3c('0x73')]({'where':{'id':_0x4f1e20[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x4fe25d,null))[_0xcf3c('0x21')](function(_0x5f459f){if(_0x5f459f){_0x384bd4[_0xcf3c('0x46')]=_['keys'](db[_0xcf3c('0xa1')][_0xcf3c('0x6c')]);_0x384bd4['query']=_['keys'](_0x4f1e20['query']);_0x384bd4[_0xcf3c('0x49')]=_[_0xcf3c('0x4a')](_0x384bd4['model'],_0x384bd4[_0xcf3c('0x47')]);_0x14ebf0['attributes']=_[_0xcf3c('0x4a')](_0x384bd4[_0xcf3c('0x46')],qs[_0xcf3c('0x4c')](_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0x4c')]));_0x14ebf0[_0xcf3c('0x4b')]=_0x14ebf0['attributes'][_0xcf3c('0x5a')]?_0x14ebf0['attributes']:_0x384bd4[_0xcf3c('0x46')];if(!_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0x4d')](_0xcf3c('0x4e'))){_0x14ebf0[_0xcf3c('0x32')]=qs[_0xcf3c('0x32')](_0x4f1e20['query'][_0xcf3c('0x32')]);_0x14ebf0[_0xcf3c('0x31')]=qs[_0xcf3c('0x31')](_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0x31')]);}_0x14ebf0[_0xcf3c('0x4f')]=qs[_0xcf3c('0x50')](_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0x50')]);_0x14ebf0[_0xcf3c('0x51')]=qs[_0xcf3c('0x49')](_[_0xcf3c('0x6d')](_0x4f1e20['query'],_0x384bd4[_0xcf3c('0x49')]));_0x14ebf0['where'][_0xcf3c('0x69')]=_0x5f459f['id'];if(_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0x52')]){_0x14ebf0[_0xcf3c('0x51')]=_['merge'](_0x14ebf0[_0xcf3c('0x51')],{'$or':_['map'](_0x14ebf0[_0xcf3c('0x4b')],function(_0x43a142){var _0x1636c8={};_0x1636c8[_0x43a142]={'$like':'%'+_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0x52')]+'%'};return _0x1636c8;})});}if(_0x4f1e20[_0xcf3c('0x47')][_0xcf3c('0xa2')]){var _0x243386=_0x4f1e20[_0xcf3c('0x47')]['$gte'][_0xcf3c('0xa3')](',');var _0x12a7c6={};_0x12a7c6[_0x243386[0x0]]={'$gte':moment(_0x243386[0x1])[_0xcf3c('0xa4')](_0xcf3c('0xa5'))};_0x14ebf0[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x14ebf0['where'],_0x12a7c6);}_0x14ebf0=_[_0xcf3c('0x53')]({},_0x14ebf0,_0x4f1e20[_0xcf3c('0x55')]);return db[_0xcf3c('0xa1')][_0xcf3c('0x30')]({'where':_0x14ebf0[_0xcf3c('0x51')]})[_0xcf3c('0x21')](function(_0x462aeb){_0x2a3004['count']=_0x462aeb;if(_0x4f1e20['query']['includeAll']){_0x14ebf0[_0xcf3c('0x56')]=[{'all':!![]}];}return db[_0xcf3c('0xa1')][_0xcf3c('0x57')](_0x14ebf0);})[_0xcf3c('0x21')](function(_0x189db4){_0x2a3004[_0xcf3c('0x58')]=_0x189db4;return _0x2a3004;});}})[_0xcf3c('0x21')](respondWithFilteredResult(_0x4fe25d,_0x14ebf0))['catch'](handleError(_0x4fe25d,null));};exports['send']=function(_0x2037f0,_0x282ae4,_0xafb3d){var _0x23cb3b,_0x2f9e20={},_0xb41ebe;if(_0x2037f0[_0xcf3c('0x66')]['to']){_0xb41ebe=_0x2037f0['body']['to'][0x0];}return db[_0xcf3c('0x43')][_0xcf3c('0x61')]({'where':{'id':_0x2037f0['params']['id']},'include':[{'model':db[_0xcf3c('0xa6')],'as':_0xcf3c('0xa7'),'include':[{'model':db[_0xcf3c('0x79')],'as':_0xcf3c('0xa8'),'where':{'fax':_0xb41ebe},'limit':0x1,'order':[[_0xcf3c('0xa0'),_0xcf3c('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x282ae4,null))[_0xcf3c('0x21')](function(_0x586048){_0x23cb3b=_0x586048;if(_0x2037f0['body'][_0xcf3c('0xaa')]&&_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')]['length']){for(var _0x5443b3=0x0;_0x5443b3<_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][_0xcf3c('0x5a')];_0x5443b3+=0x1){_0x2037f0[_0xcf3c('0x66')]['attachments'][_0x5443b3]={'filename':_0x2037f0['body'][_0xcf3c('0xaa')][_0x5443b3][_0xcf3c('0x64')],'id':_0x2037f0['body']['attachments'][_0x5443b3]['id'],'path':path[_0xcf3c('0xab')](config[_0xcf3c('0xac')],_0xcf3c('0xad'),_0x2037f0['body']['attachments'][_0x5443b3][_0xcf3c('0xae')])};}}return respondWithRpcPromise(_0xcf3c('0xaf'),_0xcf3c('0xaf'),{'FaxAccountId':_[_0xcf3c('0xb0')](_0x2037f0[_0xcf3c('0x59')]['id'])?undefined:_0x2037f0[_0xcf3c('0x59')]['id'],'path':_['isNil'](_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][0x0]['path'])?undefined:_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][0x0][_0xcf3c('0x8')],'fax':_[_0xcf3c('0xb0')](_0x2037f0[_0xcf3c('0x66')]['to'][0x0])?undefined:_0x2037f0[_0xcf3c('0x66')]['to'][0x0]},client9002);})[_0xcf3c('0x21')](function(){if(_0x23cb3b){if(_[_0xcf3c('0xb0')](_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xb1')])){_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xb1')]=util['format'](_0xcf3c('0xb2'),_0x23cb3b[_0xcf3c('0x64')],_0x23cb3b['fax']);}if(_0x23cb3b[_0xcf3c('0xa7')]){if(_0x23cb3b[_0xcf3c('0xa7')][_0xcf3c('0xa8')][_0xcf3c('0x5a')]){return _0x23cb3b[_0xcf3c('0xa7')]['Contacts'][0x0];}else{return db[_0xcf3c('0x79')][_0xcf3c('0x5c')](_[_0xcf3c('0x1b')](_0x2037f0[_0xcf3c('0x66')],{'firstName':_0x2037f0[_0xcf3c('0x66')]['to'][0x0],'phone':_0x2037f0[_0xcf3c('0x66')]['to'][0x0],'fax':_0x2037f0['body']['to'][0x0],'ListId':_0x23cb3b[_0xcf3c('0xb3')]}));}}else{throw new Error(_0xcf3c('0xb4'));}}else{throw new Error(_0xcf3c('0xb5'));}})['then'](function(_0x25ff0c){if(_0x25ff0c){return db[_0xcf3c('0x78')]['find']({'where':{'ContactId':_0x25ff0c['id'],'closed':![],'FaxAccountId':_0x23cb3b['id']}})['then'](function(_0xfc4dde){if(_0xfc4dde){return[_0xfc4dde,![]];}return db[_0xcf3c('0x78')][_0xcf3c('0x5c')]({'UserId':_0x2037f0['user']['id'],'ContactId':_0x25ff0c['id'],'FaxAccountId':_0x23cb3b['id'],'fax':_0x2037f0[_0xcf3c('0x66')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x2037f0[_0xcf3c('0x66')],{'read':![],'body':_0x2037f0['body'][_0xcf3c('0xaa')][0x0][_0xcf3c('0xb6')],'FaxAccountId':_0x23cb3b['id'],'UserId':_0x2037f0[_0xcf3c('0x5d')]['id'],'ContactId':_0x25ff0c['id'],'AttachmentId':_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xcf3c('0xa1')],'as':_0xcf3c('0xb7')}]})['then'](function(_0x1e84be){return[_0x1e84be,!![]];});});}else{throw new Error(_0xcf3c('0xb8'));}})[_0xcf3c('0xb9')](function(_0x242f38,_0x4e256e){if(_0x4e256e){return _0x242f38;}return db['FaxMessage'][_0xcf3c('0x5c')]({'direction':_0xcf3c('0xba'),'read':![],'body':_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][0x0][_0xcf3c('0xb6')],'FaxAccountId':_0x23cb3b['id'],'FaxInteractionId':_0x242f38['id'],'UserId':_0x2037f0[_0xcf3c('0x5d')]['id'],'ContactId':_0x242f38[_0xcf3c('0xbb')],'AttachmentId':_0x2037f0['body']['attachments'][0x0]['id']})[_0xcf3c('0x21')](function(_0x796d3e){_0x242f38['dataValues'][_0xcf3c('0xb7')]=[];_0x242f38['dataValues']['Messages'][_0xcf3c('0x8a')](_0x796d3e[_0xcf3c('0xbc')]);return _0x242f38;});})[_0xcf3c('0x21')](function(_0x8dd19c){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0xcf3c('0xb0')](_0x2037f0[_0xcf3c('0x59')]['id'])?undefined:_0x2037f0[_0xcf3c('0x59')]['id'],'path':_[_0xcf3c('0xb0')](_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][0x0][_0xcf3c('0x8')])?undefined:_0x2037f0['body'][_0xcf3c('0xaa')][0x0][_0xcf3c('0x8')],'fax':_['isNil'](_0x2037f0['body']['to'][0x0])?undefined:_0x2037f0[_0xcf3c('0x66')]['to'][0x0],'AttachmentId':_0x2037f0[_0xcf3c('0x66')][_0xcf3c('0xaa')][0x0]['id']},client9002)[_0xcf3c('0x21')](function(_0x1114cb){logger[_0xcf3c('0x22')](_0xcf3c('0xbd'),_0x1114cb);})[_0xcf3c('0x2c')](function(_0x2b3a63){logger[_0xcf3c('0x22')](_0xcf3c('0xbd'),_0x2b3a63);});return _0x8dd19c;})['then'](respondWithResult(_0x282ae4,null))[_0xcf3c('0x2c')](handleError(_0x282ae4,null));};exports[_0xcf3c('0xbe')]=function(_0x1028f6,_0x4e2396,_0x339ef1){return db[_0xcf3c('0x43')]['find']({'where':{'id':_0x1028f6[_0xcf3c('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e2396,null))[_0xcf3c('0x21')](function(_0x21622f){if(_0x21622f){return _0x21622f[_0xcf3c('0xbe')](_0x1028f6['body'][_0xcf3c('0x6f')],_[_0xcf3c('0x76')](_0x1028f6[_0xcf3c('0x66')],[_0xcf3c('0x6f'),'id'])||{})[_0xcf3c('0xb9')](function(_0x3ada57){for(var _0x3aaae4=0x0;_0x3aaae4<_0x1028f6[_0xcf3c('0x66')][_0xcf3c('0x6f')][_0xcf3c('0x5a')];_0x3aaae4+=0x1){socket[_0xcf3c('0xbf')](_0xcf3c('0xc0'),{'UserId':_0x1028f6[_0xcf3c('0x66')][_0xcf3c('0x6f')][_0x3aaae4],'FaxAccountId':_0x1028f6[_0xcf3c('0x59')]['id']});}return _0x3ada57;});}})['then'](respondWithResult(_0x4e2396,null))[_0xcf3c('0x2c')](handleError(_0x4e2396,null));};exports[_0xcf3c('0xc1')]=function(_0x1d5246,_0x17f3c7,_0x5e4122){return db[_0xcf3c('0x43')]['find']({'where':{'id':_0x1d5246[_0xcf3c('0x59')]['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x17f3c7,null))[_0xcf3c('0x21')](function(_0x2e91bf){if(_0x2e91bf){return _0x2e91bf['removeAgents'](_0x1d5246[_0xcf3c('0x47')]['ids'])[_0xcf3c('0x21')](function(){if(_[_0xcf3c('0xc2')](_0x1d5246[_0xcf3c('0x47')][_0xcf3c('0x6f')])){for(var _0x43588a=0x0;_0x43588a<_0x1d5246[_0xcf3c('0x47')][_0xcf3c('0x6f')][_0xcf3c('0x5a')];_0x43588a+=0x1){socket[_0xcf3c('0xbf')](_0xcf3c('0xc3'),{'UserId':Number(_0x1d5246[_0xcf3c('0x47')][_0xcf3c('0x6f')][_0x43588a]),'FaxAccountId':Number(_0x1d5246[_0xcf3c('0x59')]['id'])});}}else{socket[_0xcf3c('0xbf')](_0xcf3c('0xc3'),{'UserId':Number(_0x1d5246['query'][_0xcf3c('0x6f')]),'FaxAccountId':Number(_0x1d5246[_0xcf3c('0x59')]['id'])});}});}})[_0xcf3c('0x21')](respondWithStatusCode(_0x17f3c7,null))[_0xcf3c('0x2c')](handleError(_0x17f3c7,null));};exports['getAgents']=function(_0x4fe540,_0x4343fc,_0x248a48){var _0x2b9ae2={};var _0x25ee08={};var _0x581784;var _0x327479;return db[_0xcf3c('0x43')][_0xcf3c('0x73')]({'where':{'id':_0x4fe540['params']['id']}})[_0xcf3c('0x21')](handleEntityNotFound(_0x4343fc,null))[_0xcf3c('0x21')](function(_0x125d28){if(_0x125d28){_0x581784=_0x125d28;_0x25ee08[_0xcf3c('0x46')]=_[_0xcf3c('0x48')](db['User']['rawAttributes']);_0x25ee08[_0xcf3c('0x47')]=_[_0xcf3c('0x48')](_0x4fe540[_0xcf3c('0x47')]);_0x25ee08[_0xcf3c('0x49')]=_['intersection'](_0x25ee08[_0xcf3c('0x46')],_0x25ee08['query']);_0x2b9ae2[_0xcf3c('0x4b')]=_[_0xcf3c('0x4a')](_0x25ee08['model'],qs[_0xcf3c('0x4c')](_0x4fe540[_0xcf3c('0x47')]['fields']));_0x2b9ae2[_0xcf3c('0x4b')]=_0x2b9ae2['attributes'][_0xcf3c('0x5a')]?_0x2b9ae2['attributes']:_0x25ee08['model'];_0x2b9ae2[_0xcf3c('0x4f')]=qs[_0xcf3c('0x50')](_0x4fe540[_0xcf3c('0x47')][_0xcf3c('0x50')]);_0x2b9ae2['where']=qs['filters'](_[_0xcf3c('0x6d')](_0x4fe540['query'],_0x25ee08[_0xcf3c('0x49')]));if(_0x4fe540[_0xcf3c('0x47')][_0xcf3c('0x52')]){_0x2b9ae2[_0xcf3c('0x51')]=_[_0xcf3c('0x53')](_0x2b9ae2[_0xcf3c('0x51')],{'$or':_[_0xcf3c('0x42')](_0x2b9ae2[_0xcf3c('0x4b')],function(_0x309b65){var _0x567f98={};_0x567f98[_0x309b65]={'$like':'%'+_0x4fe540[_0xcf3c('0x47')]['filter']+'%'};return _0x567f98;})});}_0x2b9ae2=_[_0xcf3c('0x53')]({},_0x2b9ae2,_0x4fe540[_0xcf3c('0x55')]);return _0x581784[_0xcf3c('0xc4')](_0x2b9ae2);}})[_0xcf3c('0x21')](function(_0x215a9a){if(_0x215a9a){_0x327479=_0x215a9a[_0xcf3c('0x5a')];if(!_0x4fe540[_0xcf3c('0x47')][_0xcf3c('0x4d')](_0xcf3c('0x4e'))){_0x2b9ae2[_0xcf3c('0x32')]=qs[_0xcf3c('0x32')](_0x4fe540[_0xcf3c('0x47')][_0xcf3c('0x32')]);_0x2b9ae2[_0xcf3c('0x31')]=qs['offset'](_0x4fe540[_0xcf3c('0x47')][_0xcf3c('0x31')]);}return _0x581784['getAgents'](_0x2b9ae2);}})[_0xcf3c('0x21')](function(_0x19d805){if(_0x19d805){return _0x19d805?{'count':_0x327479,'rows':_0x19d805}:null;}})[_0xcf3c('0x21')](respondWithResult(_0x4343fc,null))[_0xcf3c('0x2c')](handleError(_0x4343fc,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 97be36a..fb12a41 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 _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 +var _0xacec=['hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x237699,_0x5708e7){var _0x517f90=function(_0x4841cd){while(--_0x4841cd){_0x237699['push'](_0x237699['shift']());}};_0x517f90(++_0x5708e7);}(_0xacec,0xf2));var _0xcace=function(_0x482914,_0x3fe08e){_0x482914=_0x482914-0x0;var _0x151f6a=_0xacec[_0x482914];return _0x151f6a;};'use strict';var EventEmitter=require(_0xcace('0x0'));var FaxAccount=require(_0xcace('0x1'))['db'][_0xcace('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcace('0x3')](0x0);var events={'afterCreate':_0xcace('0x4'),'afterUpdate':_0xcace('0x5'),'afterDestroy':_0xcace('0x6')};function emitEvent(_0x18ad3b){return function(_0x4bc411,_0xa3428,_0x55a8f6){FaxAccountEvents['emit'](_0x18ad3b+':'+_0x4bc411['id'],_0x4bc411);FaxAccountEvents['emit'](_0x18ad3b,_0x4bc411);_0x55a8f6(null);};}for(var e in events){if(events[_0xcace('0x7')](e)){var event=events[e];FaxAccount[_0xcace('0x8')](e,emitEvent(event));}}module[_0xcace('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 02c52a5..18aa211 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 _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 +var _0x2874=['./faxAccount.attributes','exports','define','fax_accounts','lodash','util','../../config/logger','moment','rimraf','../../config/environment'];(function(_0xdf3db6,_0x2a1952){var _0x4b7a65=function(_0x2953be){while(--_0x2953be){_0xdf3db6['push'](_0xdf3db6['shift']());}};_0x4b7a65(++_0x2a1952);}(_0x2874,0x90));var _0x4287=function(_0x40cdc3,_0x76825d){_0x40cdc3=_0x40cdc3-0x0;var _0x5bda2b=_0x2874[_0x40cdc3];return _0x5bda2b;};'use strict';var _=require(_0x4287('0x0'));var util=require(_0x4287('0x1'));var logger=require(_0x4287('0x2'))('api');var moment=require(_0x4287('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4287('0x4'));var config=require(_0x4287('0x5'));var attributes=require(_0x4287('0x6'));module[_0x4287('0x7')]=function(_0x24a24f,_0x1e4e8b){return _0x24a24f[_0x4287('0x8')]('FaxAccount',attributes,{'tableName':_0x4287('0x9'),'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 5692da3..0d1ecf7 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 _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 +var _0x6eef=['startRouting','Start','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxAccount','NotifyFaxAccount','fax','CmContact','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','length','contact','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','name','agent'];(function(_0x2e5e3a,_0x5836f){var _0x4e9797=function(_0x56bc2a){while(--_0x56bc2a){_0x2e5e3a['push'](_0x2e5e3a['shift']());}};_0x4e9797(++_0x5836f);}(_0x6eef,0x16e));var _0xf6ee=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6eef[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf6ee('0x0'));var util=require(_0xf6ee('0x1'));var moment=require(_0xf6ee('0x2'));var BPromise=require(_0xf6ee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6ee('0x4'))['db'];var utils=require(_0xf6ee('0x5'));var logger=require(_0xf6ee('0x6'))(_0xf6ee('0x7'));var config=require(_0xf6ee('0x8'));var jayson=require(_0xf6ee('0x9'));var client=jayson[_0xf6ee('0xa')][_0xf6ee('0xb')]({'port':0x232c});config[_0xf6ee('0xc')]=_[_0xf6ee('0xd')](config[_0xf6ee('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6ee('0xe'))(new Redis(config[_0xf6ee('0xc')]));require(_0xf6ee('0xf'))['register'](socket);function respondWithRpcPromise(_0x23dd21,_0xeb1503,_0x2b5c06){return new BPromise(function(_0x36ecaa,_0x11eb64){return client[_0xf6ee('0x10')](_0x23dd21,_0x2b5c06)[_0xf6ee('0x11')](function(_0x8d2dda){logger[_0xf6ee('0x12')](_0xf6ee('0x13'),_0xeb1503,_0xf6ee('0x14'));logger[_0xf6ee('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xeb1503,_0xf6ee('0x14'),JSON[_0xf6ee('0x16')](_0x8d2dda));if(_0x8d2dda[_0xf6ee('0x17')]){if(_0x8d2dda[_0xf6ee('0x17')]['code']===0x1f4){logger['error'](_0xf6ee('0x13'),_0xeb1503,_0x8d2dda[_0xf6ee('0x17')][_0xf6ee('0x18')]);return _0x11eb64(_0x8d2dda[_0xf6ee('0x17')][_0xf6ee('0x18')]);}logger[_0xf6ee('0x17')](_0xf6ee('0x13'),_0xeb1503,_0x8d2dda[_0xf6ee('0x17')][_0xf6ee('0x18')]);return _0x36ecaa(_0x8d2dda[_0xf6ee('0x17')][_0xf6ee('0x18')]);}else{logger[_0xf6ee('0x12')](_0xf6ee('0x13'),_0xeb1503,_0xf6ee('0x14'));_0x36ecaa(_0x8d2dda[_0xf6ee('0x19')][_0xf6ee('0x18')]);}})[_0xf6ee('0x1a')](function(_0x3240ab){logger[_0xf6ee('0x17')](_0xf6ee('0x13'),_0xeb1503,_0x3240ab);_0x11eb64(_0x3240ab);});});}exports['GetFaxAccount']=function(_0x36979f){var _0x15ad10=this;return new Promise(function(_0x34357c,_0x54200c){return db[_0xf6ee('0x1b')][_0xf6ee('0x1c')]({'raw':_0x36979f[_0xf6ee('0x1d')]?_0x36979f[_0xf6ee('0x1d')][_0xf6ee('0x1e')]===undefined?!![]:![]:!![],'where':_0x36979f[_0xf6ee('0x1d')]?_0x36979f['options'][_0xf6ee('0x1f')]||null:null,'attributes':_0x36979f[_0xf6ee('0x1d')]?_0x36979f[_0xf6ee('0x1d')][_0xf6ee('0x20')]||null:null,'limit':_0x36979f['options']?_0x36979f[_0xf6ee('0x1d')][_0xf6ee('0x21')]||null:null,'include':_0x36979f[_0xf6ee('0x1d')]?_0x36979f['options'][_0xf6ee('0x22')]?_[_0xf6ee('0x23')](_0x36979f[_0xf6ee('0x1d')]['include'],function(_0x4fc271){return{'model':db[_0x4fc271[_0xf6ee('0x24')]],'as':_0x4fc271['as'],'attributes':_0x4fc271[_0xf6ee('0x20')],'include':_0x4fc271[_0xf6ee('0x22')]?_[_0xf6ee('0x23')](_0x4fc271[_0xf6ee('0x22')],function(_0x58f764){return{'model':db[_0x58f764[_0xf6ee('0x24')]],'as':_0x58f764['as'],'attributes':_0x58f764[_0xf6ee('0x20')],'include':_0x58f764[_0xf6ee('0x22')]?_[_0xf6ee('0x23')](_0x58f764['include'],function(_0x6366fa){return{'model':db[_0x6366fa[_0xf6ee('0x24')]],'as':_0x6366fa['as'],'attributes':_0x6366fa[_0xf6ee('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf6ee('0x11')](function(_0x2bbbb2){logger[_0xf6ee('0x12')](_0xf6ee('0x25'),_0x36979f);logger[_0xf6ee('0x15')](_0xf6ee('0x25'),_0x36979f,JSON[_0xf6ee('0x16')](_0x2bbbb2));_0x34357c(_0x2bbbb2);})[_0xf6ee('0x1a')](function(_0x3441b5){logger[_0xf6ee('0x17')](_0xf6ee('0x25'),_0x3441b5[_0xf6ee('0x18')],_0x36979f);_0x54200c(_0x15ad10[_0xf6ee('0x17')](0x1f4,_0x3441b5[_0xf6ee('0x18')]));});});};exports[_0xf6ee('0x26')]=function(_0x2dd03a,_0x1e08a6,_0x37826d){var _0x4b0d1e=this;return new Promise(function(_0x19370f,_0x15d4fa){var _0x4f5d9f={'body':_0x2dd03a['body'],'channel':_0xf6ee('0x27')};var _0x3a0fe4=[];var _0x569f14=[];var _0x4ddcbc={};return db[_0xf6ee('0x28')]['describe']()[_0xf6ee('0x11')](function(_0x1f1ae1){if(!_0x1f1ae1){throw new db[(_0xf6ee('0x29'))][(_0xf6ee('0x2a'))]('no\x20available\x20attributes');}_0x3a0fe4=_[_0xf6ee('0x2b')](_[_0xf6ee('0x2c')](_0x1f1ae1),[_0xf6ee('0x2d'),_0xf6ee('0x2e')]);_0x569f14=_[_0xf6ee('0x2b')](_[_0xf6ee('0x2c')](_0x1f1ae1),[_0xf6ee('0x2d'),_0xf6ee('0x2e'),_0xf6ee('0x2f'),_0xf6ee('0x30')]);if(_0x2dd03a[_0xf6ee('0x31')]['id']){delete _0x2dd03a[_0xf6ee('0x31')]['id'];}if(_[_0xf6ee('0x32')](_0x2dd03a['body'][_0xf6ee('0x33')])){throw new db['Sequelize']['ValidationError'](_0xf6ee('0x34'));}if(_[_0xf6ee('0x32')](_0x2dd03a[_0xf6ee('0x31')][_0xf6ee('0x31')])||_0x2dd03a[_0xf6ee('0x31')]['body']===''){throw new db[(_0xf6ee('0x29'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf6ee('0x32')](_0x2dd03a['body']['mapKey'])){throw new db[(_0xf6ee('0x29'))][(_0xf6ee('0x2a'))](_0xf6ee('0x35')+_0x569f14);}if(!_[_0xf6ee('0x36')](_0x569f14,_0x2dd03a[_0xf6ee('0x31')]['mapKey'])){throw new db[(_0xf6ee('0x29'))][(_0xf6ee('0x2a'))](_0xf6ee('0x37')+_0x569f14);}_0x4ddcbc[_0x2dd03a[_0xf6ee('0x31')]['mapKey']]=_0x2dd03a['body'][_0xf6ee('0x33')];})[_0xf6ee('0x11')](function(){return db[_0xf6ee('0x1b')][_0xf6ee('0x38')]({'where':{'id':_0x2dd03a[_0xf6ee('0x39')]['id']},'include':[{'model':db[_0xf6ee('0x3a')],'as':_0xf6ee('0x3b'),'include':[{'model':db[_0xf6ee('0x28')],'as':_0xf6ee('0x3c'),'where':_0x4ddcbc,'limit':0x1,'order':[[_0xf6ee('0x2e'),_0xf6ee('0x3d')]]}]},{'model':db[_0xf6ee('0x3e')],'as':_0xf6ee('0x3f')}]});})['then'](function(_0x91791){if(_0x91791&&_0x91791[_0xf6ee('0x3b')]){var _0x194f6f=_0x91791[_0xf6ee('0x40')]({'plain':!![]});_0x4f5d9f['account']=_0x194f6f;_0x4f5d9f[_0xf6ee('0x41')]=_0x194f6f[_0xf6ee('0x3f')];_0x4f5d9f[_0xf6ee('0x42')]=_0x194f6f['List'];_0x4f5d9f[_0xf6ee('0x41')]=_[_0xf6ee('0x43')](_0x4f5d9f[_0xf6ee('0x41')],[_0xf6ee('0x44')],[_0xf6ee('0x45')]);if(_0x4f5d9f[_0xf6ee('0x39')]['Applications']){delete _0x4f5d9f[_0xf6ee('0x39')][_0xf6ee('0x3f')];}if(_0x4f5d9f[_0xf6ee('0x39')][_0xf6ee('0x3b')]&&_0x4f5d9f[_0xf6ee('0x39')]['List'][_0xf6ee('0x3c')][_0xf6ee('0x46')]){return _0x4f5d9f[_0xf6ee('0x39')][_0xf6ee('0x3b')][_0xf6ee('0x3c')][0x0];}var _0x49112b=_[_0xf6ee('0xd')](_0x2dd03a[_0xf6ee('0x31')],{'firstName':_0x2dd03a['body'][_0xf6ee('0x33')],'ListId':_0x194f6f['ListId']});_0x49112b[_0x2dd03a[_0xf6ee('0x31')]['mapKey']]=_0x2dd03a[_0xf6ee('0x31')]['from'];return db[_0xf6ee('0x28')]['create'](_0x49112b,{'fields':_0x3a0fe4,'raw':!![]});}})[_0xf6ee('0x11')](function(_0x96bbc4){_0x4f5d9f[_0xf6ee('0x47')]=_0x96bbc4;if(_0x96bbc4){var _0x59ea46={'ContactId':_0x96bbc4['id'],'FaxAccountId':_0x2dd03a['account']['id'],'fax':_0x96bbc4[_0xf6ee('0x27')]};return db['FaxInteraction'][_0xf6ee('0x38')]({'where':{'ContactId':_0x96bbc4['id'],'closed':![],'FaxAccountId':_0x2dd03a[_0xf6ee('0x39')]['id']}})['then'](function(_0x5ccfe0){if(_0x5ccfe0){return[_0x5ccfe0,![]];}return db[_0xf6ee('0x48')][_0xf6ee('0x49')](_0x59ea46)[_0xf6ee('0x11')](function(_0x4c9403){return[_0x4c9403,!![]];});});}else{throw new Error(_0xf6ee('0x4a'));}})[_0xf6ee('0x4b')](function(_0x461692,_0x412aec){var _0x308fa1=_0x461692['get']({'plain':!![]});if(_0x412aec){if(_0x4f5d9f[_0xf6ee('0x39')][_0xf6ee('0x4c')]){_0x4f5d9f[_0xf6ee('0x41')][_0xf6ee('0x4d')]({'id':0x0,'priority':_0x4f5d9f['applications'][_0xf6ee('0x46')]+0x1,'app':'close','appdata':_0xf6ee('0x4e'),'interval':_0xf6ee('0x4f')});}_0x308fa1[_0xf6ee('0x50')]=!![];}else{_0x308fa1[_0xf6ee('0x50')]=![];}_0x4f5d9f['interaction']=_0x308fa1;return db[_0xf6ee('0x51')][_0xf6ee('0x49')]({'body':_0x2dd03a[_0xf6ee('0x31')][_0xf6ee('0x31')],'FaxAccountId':_0x2dd03a[_0xf6ee('0x39')]['id'],'FaxInteractionId':_0x461692['id'],'direction':'in','ContactId':_0x461692[_0xf6ee('0x52')],'AttachmentId':_0x2dd03a[_0xf6ee('0x31')][_0xf6ee('0x53')]});})[_0xf6ee('0x11')](function(_0x3c798b){_0x4f5d9f[_0xf6ee('0x18')]=_0x3c798b;if(_0x4f5d9f[_0xf6ee('0x54')][_0xf6ee('0x55')]){return db[_0xf6ee('0x56')][_0xf6ee('0x38')]({'attributes':['id',_0xf6ee('0x57')],'where':{'id':_0x4f5d9f[_0xf6ee('0x54')][_0xf6ee('0x55')]}})['then'](function(_0x27e9f7){if(_0x27e9f7){_0x4f5d9f[_0xf6ee('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf6ee('0x58'),'appdata':_0x27e9f7[_0xf6ee('0x57')]+','+(_0x4f5d9f[_0xf6ee('0x39')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xf6ee('0x59'),_0x4f5d9f);});}return respondWithRpcPromise(_0xf6ee('0x5a'),_0xf6ee('0x59'),_0x4f5d9f);})[_0xf6ee('0x11')](function(_0x229680){_0x19370f(_0x229680);})[_0xf6ee('0x1a')](function(_0x564c1f){_0x15d4fa(_0x4b0d1e[_0xf6ee('0x17')](0x1f4,_0x564c1f[_0xf6ee('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0becf36..6b84150 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 _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 +var _0xcaf2=['./faxAccount.events','remove','update','removeListener','register','length'];(function(_0x1cc301,_0x5985bc){var _0x597919=function(_0x2eea4f){while(--_0x2eea4f){_0x1cc301['push'](_0x1cc301['shift']());}};_0x597919(++_0x5985bc);}(_0xcaf2,0x8a));var _0x2caf=function(_0x5d0d1b,_0x44b391){_0x5d0d1b=_0x5d0d1b-0x0;var _0x196810=_0xcaf2[_0x5d0d1b];return _0x196810;};'use strict';var FaxAccountEvents=require(_0x2caf('0x0'));var events=['save',_0x2caf('0x1'),_0x2caf('0x2')];function createListener(_0x47b94f,_0x416629){return function(_0x3207fc){_0x416629['emit'](_0x47b94f,_0x3207fc);};}function removeListener(_0xb4fae,_0x4d046b){return function(){FaxAccountEvents[_0x2caf('0x3')](_0xb4fae,_0x4d046b);};}exports[_0x2caf('0x4')]=function(_0x249a4b){for(var _0x599ce7=0x0,_0xc44e4e=events[_0x2caf('0x5')];_0x599ce7<_0xc44e4e;_0x599ce7++){var _0x4667c6=events[_0x599ce7];var _0x34e792=createListener('faxAccount:'+_0x4667c6,_0x249a4b);FaxAccountEvents['on'](_0x4667c6,_0x34e792);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8089a1c..defffdd 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 _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 +var _0x95ee=['Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','index','/describe','isAuthenticated','describe','get','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/users','getAgents','post','addAnswer','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','addAgents','put','/:id','delete','destroy','removeDispositions','removeAnswers','exports','multer','path','connect-timeout'];(function(_0x5a3ccc,_0x80d35f){var _0x4aebd9=function(_0x56d753){while(--_0x56d753){_0x5a3ccc['push'](_0x5a3ccc['shift']());}};_0x4aebd9(++_0x80d35f);}(_0x95ee,0x14a));var _0xe95e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x95ee[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xe95e('0x0'));var util=require('util');var path=require(_0xe95e('0x1'));var timeout=require(_0xe95e('0x2'));var express=require('express');var router=express[_0xe95e('0x3')]();var auth=require(_0xe95e('0x4'));var interaction=require(_0xe95e('0x5'));var config=require('../../config/environment');var controller=require(_0xe95e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xe95e('0x7')]);router['get'](_0xe95e('0x8'),auth[_0xe95e('0x9')](),controller[_0xe95e('0xa')]);router[_0xe95e('0xb')]('/:id',auth[_0xe95e('0x9')](),controller['show']);router[_0xe95e('0xb')](_0xe95e('0xc'),auth[_0xe95e('0x9')](),controller[_0xe95e('0xd')]);router[_0xe95e('0xb')](_0xe95e('0xe'),auth[_0xe95e('0x9')](),controller['getAnswers']);router[_0xe95e('0xb')](_0xe95e('0xf'),auth['isAuthenticated'](),controller[_0xe95e('0x10')]);router[_0xe95e('0xb')](_0xe95e('0x11'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x12')]);router[_0xe95e('0xb')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe95e('0x13')]);router[_0xe95e('0xb')](_0xe95e('0x14'),auth['isAuthenticated'](),controller[_0xe95e('0x15')]);router['post']('/',auth[_0xe95e('0x9')](),controller['create']);router[_0xe95e('0x16')]('/:id/dispositions',auth[_0xe95e('0x9')](),controller['addDisposition']);router[_0xe95e('0x16')](_0xe95e('0xe'),auth['isAuthenticated'](),controller[_0xe95e('0x17')]);router[_0xe95e('0x16')](_0xe95e('0xf'),auth[_0xe95e('0x9')](),controller['addInteraction']);router[_0xe95e('0x16')](_0xe95e('0x11'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x18')]);router[_0xe95e('0x16')](_0xe95e('0x19'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x1a')]);router[_0xe95e('0x16')](_0xe95e('0x1b'),auth[_0xe95e('0x9')](),controller['updateAccountApplications']);router[_0xe95e('0x16')](_0xe95e('0x1c'),auth[_0xe95e('0x9')](),controller['send']);router[_0xe95e('0x16')](_0xe95e('0x14'),auth['isAuthenticated'](),controller[_0xe95e('0x1d')]);router[_0xe95e('0x1e')](_0xe95e('0x1f'),auth[_0xe95e('0x9')](),controller['update']);router[_0xe95e('0x20')](_0xe95e('0x1f'),auth['isAuthenticated'](),controller[_0xe95e('0x21')]);router[_0xe95e('0x20')](_0xe95e('0xc'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x22')]);router[_0xe95e('0x20')](_0xe95e('0xe'),auth['isAuthenticated'](),controller[_0xe95e('0x23')]);router[_0xe95e('0x20')](_0xe95e('0x14'),auth[_0xe95e('0x9')](),controller['removeAgents']);module[_0xe95e('0x24')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index aaa41fa..628a2a6 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 _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 +var _0x782b=['STRING','*,*,*,*','INTEGER','noop','TEXT'];(function(_0x4130e4,_0x1b17cb){var _0x4b17a7=function(_0x23aa91){while(--_0x23aa91){_0x4130e4['push'](_0x4130e4['shift']());}};_0x4b17a7(++_0x1b17cb);}(_0x782b,0x89));var _0xb782=function(_0x235642,_0x54a0f4){_0x235642=_0x235642-0x0;var _0x4cc890=_0x782b[_0x235642];return _0x4cc890;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb782('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb782('0x1')},'appdata':{'type':Sequelize[_0xb782('0x2')]()},'description':{'type':Sequelize[_0xb782('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb782('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 81ccaab..e60bf5a 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 _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 +var _0x6568=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxApplication','findAll','rows','catch','show','keys','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x4ae1b6,_0x3c0f3e){var _0x199ecc=function(_0xab920c){while(--_0xab920c){_0x4ae1b6['push'](_0x4ae1b6['shift']());}};_0x199ecc(++_0x3c0f3e);}(_0x6568,0x1c5));var _0x8656=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x6568[_0x160c73];return _0xd9302;};'use strict';var pdf=require(_0x8656('0x0'));var emlformat=require(_0x8656('0x1'));var rimraf=require(_0x8656('0x2'));var zipdir=require(_0x8656('0x3'));var jsonpatch=require(_0x8656('0x4'));var rp=require('request-promise');var moment=require(_0x8656('0x5'));var BPromise=require(_0x8656('0x6'));var Mustache=require(_0x8656('0x7'));var util=require(_0x8656('0x8'));var path=require(_0x8656('0x9'));var sox=require('sox');var csv=require(_0x8656('0xa'));var ejs=require(_0x8656('0xb'));var fs=require('fs');var _=require(_0x8656('0xc'));var squel=require('squel');var crypto=require(_0x8656('0xd'));var jsforce=require(_0x8656('0xe'));var deskjs=require(_0x8656('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8656('0x10'));var Redis=require(_0x8656('0x11'));var authService=require(_0x8656('0x12'));var qs=require(_0x8656('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8656('0x14'));var logger=require(_0x8656('0x15'))(_0x8656('0x16'));var utils=require(_0x8656('0x17'));var config=require(_0x8656('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8656('0x19'))['db'];function respondWithStatusCode(_0x56a6ad,_0xd3a0a6){_0xd3a0a6=_0xd3a0a6||0xcc;return function(_0x26880d){if(_0x26880d){return _0x56a6ad[_0x8656('0x1a')](_0xd3a0a6);}return _0x56a6ad[_0x8656('0x1b')](_0xd3a0a6)['end']();};}function respondWithResult(_0x418942,_0x388e2e){_0x388e2e=_0x388e2e||0xc8;return function(_0x2d9e74){if(_0x2d9e74){return _0x418942['status'](_0x388e2e)[_0x8656('0x1c')](_0x2d9e74);}};}function respondWithFilteredResult(_0x3732e9,_0xb4f6c9){return function(_0x40f2fb){if(_0x40f2fb){var _0x4eb747=_0x40f2fb[_0x8656('0x1d')],_0x20f7fd=_0xb4f6c9[_0x8656('0x1e')],_0x206f95=_0xb4f6c9[_0x8656('0x1e')]+_0xb4f6c9[_0x8656('0x1f')],_0x5b41fe;if(_0x206f95>=_0x4eb747){_0x206f95=_0x4eb747;_0x5b41fe=0xc8;}else{_0x5b41fe=0xce;}_0x3732e9[_0x8656('0x1b')](_0x5b41fe);return _0x3732e9[_0x8656('0x20')](_0x8656('0x21'),_0x20f7fd+'-'+_0x206f95+'/'+_0x4eb747)[_0x8656('0x1c')](_0x40f2fb);}return null;};}function patchUpdates(_0x5a6024){return function(_0x5ac21d){try{jsonpatch[_0x8656('0x22')](_0x5ac21d,_0x5a6024,!![]);}catch(_0x74d779){return BPromise[_0x8656('0x23')](_0x74d779);}return _0x5ac21d[_0x8656('0x24')]();};}function saveUpdates(_0xf143fe,_0x5c0b34){return function(_0x2ab3f3){if(_0x2ab3f3){return _0x2ab3f3['update'](_0xf143fe)['then'](function(_0x56fc72){return _0x56fc72;});}return null;};}function removeEntity(_0x3ef488,_0x1ecff9){return function(_0x27a8e5){if(_0x27a8e5){return _0x27a8e5[_0x8656('0x25')]()[_0x8656('0x26')](function(){_0x3ef488['status'](0xcc)[_0x8656('0x27')]();});}};}function handleEntityNotFound(_0x21b248,_0x350b33){return function(_0x4eac0f){if(!_0x4eac0f){_0x21b248['sendStatus'](0x194);}return _0x4eac0f;};}function handleError(_0x5a7120,_0x2c69ab){_0x2c69ab=_0x2c69ab||0x1f4;return function(_0x102d14){logger[_0x8656('0x28')](_0x102d14[_0x8656('0x29')]);if(_0x102d14[_0x8656('0x2a')]){delete _0x102d14[_0x8656('0x2a')];}_0x5a7120[_0x8656('0x1b')](_0x2c69ab)[_0x8656('0x2b')](_0x102d14);};}exports[_0x8656('0x2c')]=function(_0x568997,_0xb2616){var _0x49947b={},_0x350e8e={},_0xb8f2e5={'count':0x0,'rows':[]};var _0x34fde1=_[_0x8656('0x2d')](db['FaxApplication'][_0x8656('0x2e')],function(_0x31197b){return{'name':_0x31197b[_0x8656('0x2f')],'type':_0x31197b[_0x8656('0x30')][_0x8656('0x31')]};});_0x350e8e[_0x8656('0x32')]=_[_0x8656('0x2d')](_0x34fde1,_0x8656('0x2a'));_0x350e8e[_0x8656('0x33')]=_['keys'](_0x568997[_0x8656('0x33')]);_0x350e8e['filters']=_[_0x8656('0x34')](_0x350e8e[_0x8656('0x32')],_0x350e8e[_0x8656('0x33')]);_0x49947b['attributes']=_[_0x8656('0x34')](_0x350e8e[_0x8656('0x32')],qs[_0x8656('0x35')](_0x568997['query'][_0x8656('0x35')]));_0x49947b[_0x8656('0x36')]=_0x49947b[_0x8656('0x36')][_0x8656('0x37')]?_0x49947b[_0x8656('0x36')]:_0x350e8e['model'];if(!_0x568997[_0x8656('0x33')][_0x8656('0x38')]('nolimit')){_0x49947b[_0x8656('0x1f')]=qs[_0x8656('0x1f')](_0x568997[_0x8656('0x33')][_0x8656('0x1f')]);_0x49947b['offset']=qs[_0x8656('0x1e')](_0x568997[_0x8656('0x33')][_0x8656('0x1e')]);}_0x49947b[_0x8656('0x39')]=qs[_0x8656('0x3a')](_0x568997[_0x8656('0x33')][_0x8656('0x3a')]);_0x49947b[_0x8656('0x3b')]=qs[_0x8656('0x3c')](_[_0x8656('0x3d')](_0x568997[_0x8656('0x33')],_0x350e8e['filters']),_0x34fde1);if(_0x568997[_0x8656('0x33')][_0x8656('0x3e')]){_0x49947b[_0x8656('0x3b')]=_[_0x8656('0x3f')](_0x49947b[_0x8656('0x3b')],{'$or':_[_0x8656('0x2d')](_0x34fde1,function(_0x154252){if(_0x154252['type']!==_0x8656('0x40')){var _0x41ffd7={};_0x41ffd7[_0x154252[_0x8656('0x2a')]]={'$like':'%'+_0x568997[_0x8656('0x33')][_0x8656('0x3e')]+'%'};return _0x41ffd7;}})});}_0x49947b=_[_0x8656('0x3f')]({},_0x49947b,_0x568997[_0x8656('0x41')]);var _0x4c6ae9={'where':_0x49947b['where']};return db['FaxApplication'][_0x8656('0x1d')](_0x4c6ae9)[_0x8656('0x26')](function(_0x2bcc20){_0xb8f2e5[_0x8656('0x1d')]=_0x2bcc20;if(_0x568997[_0x8656('0x33')][_0x8656('0x42')]){_0x49947b[_0x8656('0x43')]=[{'all':!![]}];}return db[_0x8656('0x44')][_0x8656('0x45')](_0x49947b);})[_0x8656('0x26')](function(_0x4e0ec3){_0xb8f2e5[_0x8656('0x46')]=_0x4e0ec3;return _0xb8f2e5;})[_0x8656('0x26')](respondWithFilteredResult(_0xb2616,_0x49947b))[_0x8656('0x47')](handleError(_0xb2616,null));};exports[_0x8656('0x48')]=function(_0x284be1,_0x27b4b0){var _0x43231a={'raw':!![],'where':{'id':_0x284be1['params']['id']}},_0x2191a3={};_0x2191a3[_0x8656('0x32')]=_[_0x8656('0x49')](db[_0x8656('0x44')][_0x8656('0x2e')]);_0x2191a3[_0x8656('0x33')]=_['keys'](_0x284be1[_0x8656('0x33')]);_0x2191a3['filters']=_[_0x8656('0x34')](_0x2191a3[_0x8656('0x32')],_0x2191a3[_0x8656('0x33')]);_0x43231a[_0x8656('0x36')]=_[_0x8656('0x34')](_0x2191a3[_0x8656('0x32')],qs[_0x8656('0x35')](_0x284be1[_0x8656('0x33')]['fields']));_0x43231a[_0x8656('0x36')]=_0x43231a[_0x8656('0x36')][_0x8656('0x37')]?_0x43231a[_0x8656('0x36')]:_0x2191a3[_0x8656('0x32')];if(_0x284be1[_0x8656('0x33')][_0x8656('0x42')]){_0x43231a[_0x8656('0x43')]=[{'all':!![]}];}_0x43231a=_[_0x8656('0x3f')]({},_0x43231a,_0x284be1[_0x8656('0x41')]);return db[_0x8656('0x44')][_0x8656('0x4a')](_0x43231a)[_0x8656('0x26')](handleEntityNotFound(_0x27b4b0,null))['then'](respondWithResult(_0x27b4b0,null))['catch'](handleError(_0x27b4b0,null));};exports[_0x8656('0x4b')]=function(_0x3c73ff,_0x571ace){return db[_0x8656('0x44')][_0x8656('0x4b')](_0x3c73ff[_0x8656('0x4c')],{})[_0x8656('0x26')](respondWithResult(_0x571ace,0xc9))[_0x8656('0x47')](handleError(_0x571ace,null));};exports['update']=function(_0x244922,_0x35f52e){if(_0x244922[_0x8656('0x4c')]['id']){delete _0x244922[_0x8656('0x4c')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x244922['params']['id']}})[_0x8656('0x26')](handleEntityNotFound(_0x35f52e,null))[_0x8656('0x26')](saveUpdates(_0x244922['body'],null))[_0x8656('0x26')](respondWithResult(_0x35f52e,null))[_0x8656('0x47')](handleError(_0x35f52e,null));};exports[_0x8656('0x25')]=function(_0x1e7f9c,_0x198c97){return db[_0x8656('0x44')][_0x8656('0x4a')]({'where':{'id':_0x1e7f9c[_0x8656('0x4d')]['id']}})[_0x8656('0x26')](handleEntityNotFound(_0x198c97,null))[_0x8656('0x26')](removeEntity(_0x198c97,null))[_0x8656('0x47')](handleError(_0x198c97,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index e4a804b..a5f1bee 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 _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 +var _0x007d=['fax_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','FaxApplication'];(function(_0x379544,_0x14c538){var _0x547b5a=function(_0x513342){while(--_0x513342){_0x379544['push'](_0x379544['shift']());}};_0x547b5a(++_0x14c538);}(_0x007d,0x9c));var _0xd007=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x007d[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xd007('0x0'));var util=require('util');var logger=require(_0xd007('0x1'))(_0xd007('0x2'));var moment=require(_0xd007('0x3'));var BPromise=require(_0xd007('0x4'));var rp=require(_0xd007('0x5'));var fs=require('fs');var path=require(_0xd007('0x6'));var rimraf=require(_0xd007('0x7'));var config=require(_0xd007('0x8'));var attributes=require(_0xd007('0x9'));module[_0xd007('0xa')]=function(_0x466d1b,_0x26eb12){return _0x466d1b['define'](_0xd007('0xb'),attributes,{'tableName':_0xd007('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd007('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 7add9f3..c5b56ac 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 _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 +var _0x370c=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','limit','stringify','util','bluebird','randomstring','ioredis'];(function(_0x5898b2,_0x2f7007){var _0x5d1c3e=function(_0x27ff55){while(--_0x27ff55){_0x5898b2['push'](_0x5898b2['shift']());}};_0x5d1c3e(++_0x2f7007);}(_0x370c,0x6c));var _0xc370=function(_0x5901de,_0x15acad){_0x5901de=_0x5901de-0x0;var _0x13eb83=_0x370c[_0x5901de];return _0x13eb83;};'use strict';var _=require('lodash');var util=require(_0xc370('0x0'));var moment=require('moment');var BPromise=require(_0xc370('0x1'));var rs=require(_0xc370('0x2'));var fs=require('fs');var Redis=require(_0xc370('0x3'));var db=require(_0xc370('0x4'))['db'];var utils=require(_0xc370('0x5'));var logger=require(_0xc370('0x6'))(_0xc370('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc370('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1578aa,_0x219d7d,_0xb73bf8){return new BPromise(function(_0x4da8f4,_0x27e444){return client['request'](_0x1578aa,_0xb73bf8)[_0xc370('0x9')](function(_0x39cb3c){logger[_0xc370('0xa')](_0xc370('0xb'),_0x219d7d,_0xc370('0xc'));logger[_0xc370('0xd')](_0xc370('0xe'),_0x219d7d,_0xc370('0xc'),JSON['stringify'](_0x39cb3c));if(_0x39cb3c[_0xc370('0xf')]){if(_0x39cb3c['error'][_0xc370('0x10')]===0x1f4){logger[_0xc370('0xf')](_0xc370('0xb'),_0x219d7d,_0x39cb3c[_0xc370('0xf')][_0xc370('0x11')]);return _0x27e444(_0x39cb3c[_0xc370('0xf')][_0xc370('0x11')]);}logger[_0xc370('0xf')](_0xc370('0xb'),_0x219d7d,_0x39cb3c[_0xc370('0xf')][_0xc370('0x11')]);return _0x4da8f4(_0x39cb3c['error'][_0xc370('0x11')]);}else{logger[_0xc370('0xa')](_0xc370('0xb'),_0x219d7d,_0xc370('0xc'));_0x4da8f4(_0x39cb3c[_0xc370('0x12')][_0xc370('0x11')]);}})[_0xc370('0x13')](function(_0x1e0a66){logger[_0xc370('0xf')](_0xc370('0xb'),_0x219d7d,_0x1e0a66);_0x27e444(_0x1e0a66);});});}exports[_0xc370('0x14')]=function(_0x14afd6){var _0x2c1824=this;return new Promise(function(_0x3d5759,_0x3a17fb){return db[_0xc370('0x15')]['update'](_0x14afd6[_0xc370('0x16')],{'raw':_0x14afd6['options']?_0x14afd6[_0xc370('0x17')][_0xc370('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14afd6['options']?_0x14afd6[_0xc370('0x17')][_0xc370('0x19')]||null:null,'attributes':_0x14afd6[_0xc370('0x17')]?_0x14afd6[_0xc370('0x17')]['attributes']||null:null,'limit':_0x14afd6[_0xc370('0x17')]?_0x14afd6['options'][_0xc370('0x1a')]||null:null})[_0xc370('0x9')](function(_0x266d6e){logger[_0xc370('0xa')](_0xc370('0x14'),_0x14afd6);logger['debug']('UpdateFaxApplication',_0x14afd6,JSON[_0xc370('0x1b')](_0x266d6e));_0x3d5759(_0x266d6e);})[_0xc370('0x13')](function(_0x4f67a8){logger['error']('UpdateFaxApplication',_0x4f67a8[_0xc370('0x11')],_0x14afd6);_0x3a17fb(_0x2c1824[_0xc370('0xf')](0x1f4,_0x4f67a8[_0xc370('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8d35f48..dec7f76 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 _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 +var _0xeda8=['isAuthenticated','index','/:id','show','post','create','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x41bcf8,_0x54373c){var _0x3cff1a=function(_0x20c40a){while(--_0x20c40a){_0x41bcf8['push'](_0x41bcf8['shift']());}};_0x3cff1a(++_0x54373c);}(_0xeda8,0x104));var _0x8eda=function(_0x14d7b5,_0x894c9e){_0x14d7b5=_0x14d7b5-0x0;var _0x42fdb2=_0xeda8[_0x14d7b5];return _0x42fdb2;};'use strict';var multer=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var path=require('path');var timeout=require(_0x8eda('0x2'));var express=require(_0x8eda('0x3'));var router=express[_0x8eda('0x4')]();var auth=require(_0x8eda('0x5'));var interaction=require(_0x8eda('0x6'));var config=require(_0x8eda('0x7'));var controller=require(_0x8eda('0x8'));router[_0x8eda('0x9')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xb')]);router[_0x8eda('0x9')](_0x8eda('0xc'),auth['isAuthenticated'](),controller[_0x8eda('0xd')]);router[_0x8eda('0xe')]('/',auth[_0x8eda('0xa')](),controller[_0x8eda('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8eda('0x10')](_0x8eda('0xc'),auth[_0x8eda('0xa')](),controller['destroy']);module[_0x8eda('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index b222dfa..faa3638 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 _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 +var _0xc999=['BOOLEAN','DATE','ENUM','out','exports'];(function(_0x379bb2,_0x5ad606){var _0x1b164d=function(_0x2b3ac8){while(--_0x2b3ac8){_0x379bb2['push'](_0x379bb2['shift']());}};_0x1b164d(++_0x5ad606);}(_0xc999,0x176));var _0x9c99=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0xc999[_0x3725ee];return _0x399c71;};'use strict';var Sequelize=require('sequelize');module[_0x9c99('0x0')]={'closed':{'type':Sequelize[_0x9c99('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9c99('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9c99('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x9c99('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9c99('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9c99('0x3')]('in',_0x9c99('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 338ef9f..96fdbcb 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 _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 +var _0x8649=['fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','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','parseSearch','conditions','find','unreadMessages','value','`\x20=\x200','Contact','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','body','some','compact','isEmpty','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','having','isArray','tag','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','merge','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','params','rawAttributes','include','options','create','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','$gte','format','includeAll','findAll','addTags','setTags','spread','Tag','faxInteractionTags:save','removeTags','download','server','files','tmp','join','root','attachments','transcript-%d-%s.zip','Messages','createdAt','Attachment','basename','existsSync','createReadStream','pipe','resolve','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','save','update','then','error','name','send','map','TagIds','Tags','split','forEach','push','catch','index','FaxInteraction','fieldName','type','key','model','keys','filters','query','intersection','fields','attributes','length','nolimit','order','sort','pick','field','color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','left_join','users'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0x8649,0x83));var _0x9864=function(_0x3073fa,_0x1b0e7c){_0x3073fa=_0x3073fa-0x0;var _0x40e76f=_0x8649[_0x3073fa];return _0x40e76f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9864('0x0'));var rimraf=require(_0x9864('0x1'));var zipdir=require(_0x9864('0x2'));var jsonpatch=require(_0x9864('0x3'));var rp=require(_0x9864('0x4'));var moment=require(_0x9864('0x5'));var BPromise=require(_0x9864('0x6'));var Mustache=require(_0x9864('0x7'));var util=require(_0x9864('0x8'));var path=require(_0x9864('0x9'));var sox=require(_0x9864('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9864('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9864('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9864('0xd'));var Papa=require(_0x9864('0xe'));var Redis=require(_0x9864('0xf'));var authService=require(_0x9864('0x10'));var qs=require(_0x9864('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9864('0x12'));var logger=require(_0x9864('0x13'))('api');var utils=require(_0x9864('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9864('0x15'));var db=require(_0x9864('0x16'))['db'];config[_0x9864('0x17')]=_[_0x9864('0x18')](config[_0x9864('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x9864('0x19'))(new Redis(config[_0x9864('0x17')]));require(_0x9864('0x1a'))['register'](socket);function respondWithStatusCode(_0x46244d,_0x420c93){_0x420c93=_0x420c93||0xcc;return function(_0x344b25){if(_0x344b25){return _0x46244d[_0x9864('0x1b')](_0x420c93);}return _0x46244d['status'](_0x420c93)[_0x9864('0x1c')]();};}function respondWithResult(_0x2572bc,_0x174d66){_0x174d66=_0x174d66||0xc8;return function(_0x20fce7){if(_0x20fce7){return _0x2572bc[_0x9864('0x1d')](_0x174d66)['json'](_0x20fce7);}};}function respondWithFilteredResult(_0x55a3f9,_0x206556){return function(_0x38142c){if(_0x38142c){var _0x205472=_0x38142c[_0x9864('0x1e')],_0x2f23f1=_0x206556['offset'],_0x1b464d=_0x206556[_0x9864('0x1f')]+_0x206556[_0x9864('0x20')],_0x274cda;if(_0x1b464d>=_0x205472){_0x1b464d=_0x205472;_0x274cda=0xc8;}else{_0x274cda=0xce;}_0x55a3f9[_0x9864('0x1d')](_0x274cda);return _0x55a3f9[_0x9864('0x21')](_0x9864('0x22'),_0x2f23f1+'-'+_0x1b464d+'/'+_0x205472)[_0x9864('0x23')](_0x38142c);}return null;};}function patchUpdates(_0x320baa){return function(_0x7a1943){try{jsonpatch['apply'](_0x7a1943,_0x320baa,!![]);}catch(_0x377949){return BPromise['reject'](_0x377949);}return _0x7a1943[_0x9864('0x24')]();};}function saveUpdates(_0x529204,_0x1efe82){return function(_0x481385){if(_0x481385){return _0x481385[_0x9864('0x25')](_0x529204)[_0x9864('0x26')](function(_0x30a2f7){return _0x30a2f7;});}return null;};}function removeEntity(_0x552e0e,_0xcbc363){return function(_0x1c3920){if(_0x1c3920){return _0x1c3920['destroy']()[_0x9864('0x26')](function(){_0x552e0e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2652a6,_0x20c6df){return function(_0x24c9e2){if(!_0x24c9e2){_0x2652a6[_0x9864('0x1b')](0x194);}return _0x24c9e2;};}function handleError(_0x5c7701,_0x444df0){_0x444df0=_0x444df0||0x1f4;return function(_0x26a065){logger[_0x9864('0x27')](_0x26a065['stack']);if(_0x26a065[_0x9864('0x28')]){delete _0x26a065[_0x9864('0x28')];}_0x5c7701[_0x9864('0x1d')](_0x444df0)[_0x9864('0x29')](_0x26a065);};}function getInteractionUsers(_0x50b57c,_0x410b19){return new BPromise(function(_0x490c4a,_0x15c9de){try{if(_0x410b19[_0x50b57c['id']]){_0x50b57c['Users']=_[_0x9864('0x2a')](_0x410b19[_0x50b57c['id']],function(_0x81fb01){return{'id':_0x81fb01['id'],'fullname':_0x81fb01['fullname']};});}}catch(_0x4972ca){_0x15c9de(_0x4972ca);}_0x490c4a(_0x50b57c);});}function getInteractionTags(_0x11ebdc,_0xc31dbb){return new BPromise(function(_0x42694c,_0xf954b2){try{if(_0x11ebdc[_0x9864('0x2b')]){_0x11ebdc[_0x9864('0x2c')]=[];_0x11ebdc[_0x9864('0x2b')][_0x9864('0x2d')](',')[_0x9864('0x2e')](function(_0x56e276){_0x11ebdc[_0x9864('0x2c')][_0x9864('0x2f')](_0xc31dbb[_0x56e276]);});}delete _0x11ebdc['TagIds'];}catch(_0x15ecea){_0xf954b2(_0x15ecea);}_0x42694c(_0x11ebdc);});}function updateFaxInteraction(_0x28529f,_0x41d082,_0x4346c2){return new BPromise(function(_0xcd8e4c,_0x15eba0){return getInteractionUsers(_0x28529f,_0x4346c2)[_0x9864('0x26')](function(_0x5918f2){return getInteractionTags(_0x5918f2,_0x41d082);})[_0x9864('0x26')](function(_0x51e84e){_0xcd8e4c(_0x51e84e);})[_0x9864('0x30')](function(_0x52df22){_0x15eba0(_0x52df22);});});}exports[_0x9864('0x31')]=function(_0x106b78,_0x37b7c6){var _0x199694={},_0x3b646f={},_0x1ac311={'count':0x0,'rows':[]};var _0x396b29=_[_0x9864('0x2a')](db[_0x9864('0x32')]['rawAttributes'],function(_0x4452f6){return{'name':_0x4452f6[_0x9864('0x33')],'type':_0x4452f6[_0x9864('0x34')][_0x9864('0x35')]};});_0x3b646f[_0x9864('0x36')]=_['map'](_0x396b29,_0x9864('0x28'));_0x3b646f['query']=_[_0x9864('0x37')](_0x106b78['query']);_0x3b646f[_0x9864('0x38')]=_['intersection'](_0x3b646f[_0x9864('0x36')],_0x3b646f[_0x9864('0x39')]);_0x199694['attributes']=_[_0x9864('0x3a')](_0x3b646f[_0x9864('0x36')],qs[_0x9864('0x3b')](_0x106b78[_0x9864('0x39')][_0x9864('0x3b')]));_0x199694[_0x9864('0x3c')]=_0x199694['attributes'][_0x9864('0x3d')]?_0x199694[_0x9864('0x3c')]:_0x3b646f[_0x9864('0x36')];if(!_0x106b78[_0x9864('0x39')]['hasOwnProperty'](_0x9864('0x3e'))){_0x199694['limit']=qs['limit'](_0x106b78[_0x9864('0x39')][_0x9864('0x20')]);_0x199694[_0x9864('0x1f')]=qs[_0x9864('0x1f')](_0x106b78[_0x9864('0x39')]['offset']);}_0x199694[_0x9864('0x3f')]=qs[_0x9864('0x40')](_0x106b78[_0x9864('0x39')]['sort']);_0x199694['where']=qs[_0x9864('0x38')](_[_0x9864('0x41')](_0x106b78[_0x9864('0x39')],_0x3b646f[_0x9864('0x38')]),_0x396b29);var _0x31c314=[];var _0x274880=squel['select']()[_0x9864('0x42')]('id')[_0x9864('0x42')](_0x9864('0x28'))[_0x9864('0x42')](_0x9864('0x43'))[_0x9864('0x44')](_0x9864('0x45'));var _0x4e6591=squel[_0x9864('0x46')]()[_0x9864('0x42')]('u.id')[_0x9864('0x42')](_0x9864('0x47'))[_0x9864('0x42')](_0x9864('0x48'))[_0x9864('0x44')]('user_has_fax_interactions','ui')[_0x9864('0x49')](_0x9864('0x4a'),'u','u.id\x20=\x20ui.UserId');var _0x204c6a=squel[_0x9864('0x46')]()[_0x9864('0x44')](_0x9864('0x4b'),'i')[_0x9864('0x49')](_0x9864('0x4c'),'c',_0x9864('0x4d'))[_0x9864('0x49')](_0x9864('0x4a'),'o',_0x9864('0x4e'))[_0x9864('0x49')](_0x9864('0x4f'),'a',_0x9864('0x50'))[_0x9864('0x49')](_0x9864('0x51'),'me',_0x9864('0x52'))[_0x9864('0x49')](_0x9864('0x53'),'it',_0x9864('0x54'))[_0x9864('0x49')]('tools_tags','t',_0x9864('0x55'));var _0x10ce82=squel['expr']();var _0x29ae30=[];var _0x512465=squel[_0x9864('0x56')]();var _0x35b759;if(_0x106b78[_0x9864('0x39')][_0x9864('0x57')]){_0x35b759=as[_0x9864('0x58')](_0x106b78['query'][_0x9864('0x57')]);var _0x8e451d=_0x35b759['sqlOperator'];for(var _0x18e5dc=0x0;_0x18e5dc<_0x35b759[_0x9864('0x59')]['length'];_0x18e5dc++){var _0x4838ed=_0x35b759[_0x9864('0x59')][_0x18e5dc];var _0x52fcff='i';var _0x4f2367=_[_0x9864('0x5a')](_0x396b29,['name',_0x4838ed[_0x9864('0x42')]]);if(!_0x4f2367){switch(_0x4838ed[_0x9864('0x42')]){case _0x9864('0x5b'):if(_0x4838ed[_0x9864('0x5c')]==0x1){_0x204c6a['having']('`'+_0x4838ed[_0x9864('0x42')]+_0x9864('0x5d'));}else{_0x204c6a['having']('`'+_0x4838ed[_0x9864('0x42')]+'`\x20>\x200');}break;case _0x9864('0x5e'):if(_0x4838ed['operator']==='$substring'){if(_0x4838ed[_0x9864('0x5c')]['split']('\x20')[_0x9864('0x3d')]>0x1){_0x10ce82[_0x8e451d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x4838ed[_0x9864('0x5c')]),null);}else{var _0x9a1b3d='%'+_0x4838ed[_0x9864('0x5c')]+'%';_0x10ce82[_0x8e451d](_0x9864('0x5f'),_0x9a1b3d,_0x9a1b3d,_0x9a1b3d);}}else{_0x4f2367=_[_0x9864('0x5a')](_0x396b29,[_0x9864('0x28'),_0x9864('0x60')]);_0x4838ed['field']=_0x9864('0x60');_0x36cdec=as[_0x9864('0x61')](_0x52fcff,_0x4f2367[_0x9864('0x34')],_0x4838ed);_0x10ce82[_0x8e451d](_0x36cdec[_0x9864('0x62')],_0x36cdec[_0x9864('0x5c')][_0x9864('0x63')],_0x36cdec[_0x9864('0x5c')][_0x9864('0x1c')]);}break;case'Tag':var _0x102be9=_0x4838ed[_0x9864('0x5c')][_0x9864('0x2d')](',')[_0x9864('0x2a')](function(_0x1b593b){return Number(_0x1b593b);});_0x102be9[_0x9864('0x2e')](function(_0x5d873b){_0x512465['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5d873b+',%');});_0x29ae30=_[_0x9864('0x64')](_0x29ae30,_0x102be9);break;case _0x9864('0x65'):if(_0x4838ed[_0x9864('0x66')]==='$substring'){_0x10ce82[_0x8e451d](_0x9864('0x67'),'%'+_0x4838ed[_0x9864('0x5c')]+'%',null);}else{_0x4f2367=_['find'](_0x396b29,[_0x9864('0x28'),_0x9864('0x68')]);_0x4838ed[_0x9864('0x42')]=_0x9864('0x68');_0x36cdec=as[_0x9864('0x61')](_0x52fcff,_0x4f2367[_0x9864('0x34')],_0x4838ed);_0x10ce82[_0x8e451d](_0x36cdec[_0x9864('0x62')],_0x36cdec[_0x9864('0x5c')][_0x9864('0x63')],_0x36cdec[_0x9864('0x5c')][_0x9864('0x1c')]);}break;case _0x9864('0x69'):_0x36cdec=as['buildExpression']('me',null,_0x4838ed);_0x10ce82[_0x8e451d](_0x36cdec[_0x9864('0x62')],_0x36cdec[_0x9864('0x5c')][_0x9864('0x63')],_0x36cdec[_0x9864('0x5c')][_0x9864('0x1c')]);break;}}else{var _0x36cdec=as[_0x9864('0x61')](_0x52fcff,_0x4f2367[_0x9864('0x34')],_0x4838ed);_0x10ce82[_0x8e451d](_0x36cdec[_0x9864('0x62')],_0x36cdec[_0x9864('0x5c')]['start'],_0x36cdec[_0x9864('0x5c')][_0x9864('0x1c')]);}}}else{var _0x255fc3=_(_0x106b78[_0x9864('0x39')])[_0x9864('0x37')]()[_0x9864('0x2a')](function(_0x446820){return _[_0x9864('0x6a')](_0x396b29,['name',_0x446820])?_0x446820:undefined;})[_0x9864('0x6b')]()[_0x9864('0x5c')]();if(!_[_0x9864('0x6c')](_0x255fc3)){_0x255fc3[_0x9864('0x2e')](function(_0x27cb07){if(_0x27cb07===_0x9864('0x6d')){_0x204c6a[_0x9864('0x6e')](_0x9864('0x6f'),[][_0x9864('0x70')](_0x106b78['query'][_0x27cb07]));}else if(_0x27cb07==='createdAt'){var _0x3bd02a=JSON[_0x9864('0x71')](_0x106b78[_0x9864('0x39')][_0x27cb07])['$gte'];var _0x49ca68=JSON[_0x9864('0x71')](_0x106b78[_0x9864('0x39')][_0x27cb07])['$lte'];_0x204c6a[_0x9864('0x6e')](_0x9864('0x72'),_0x3bd02a,_0x49ca68);}else{if(_0x106b78[_0x9864('0x39')][_0x27cb07]===_0x9864('0x73')){_0x204c6a['where']('i.'+_0x27cb07+'\x20IS\x20NULL');}else{_0x204c6a[_0x9864('0x6e')]('i.'+_0x27cb07+_0x9864('0x74'),_0x106b78[_0x9864('0x39')][_0x27cb07]);}}});}if(_0x106b78[_0x9864('0x39')][_0x9864('0x75')]){if(_0x106b78[_0x9864('0x39')][_0x9864('0x75')]==0x1){_0x204c6a[_0x9864('0x76')]('`unreadMessages`\x20=\x200');}else{_0x204c6a[_0x9864('0x76')]('`unreadMessages`\x20>\x200');}}if(_0x106b78['query']['tag']){_0x29ae30=_[_0x9864('0x77')](_0x106b78['query'][_0x9864('0x78')])?_0x106b78[_0x9864('0x39')]['tag']:new Array(_0x106b78['query'][_0x9864('0x78')]);_0x29ae30[_0x9864('0x2e')](function(_0x3ff5cc){_0x512465['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3ff5cc+',%');});}if(_0x106b78[_0x9864('0x39')][_0x9864('0x79')]){var _0x4337ad=_0x106b78[_0x9864('0x39')][_0x9864('0x79')][_0x9864('0x7a')]('\x5c','\x5c\x5c')[_0x9864('0x7a')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x4337ad)){_0x10ce82['or']('i.id\x20LIKE\x20?',_0x4337ad+'%')['or']('i.fax\x20LIKE\x20?',_0x4337ad+'%');}_0x10ce82['or'](_0x9864('0x7b'),_0x4337ad+'%');}}_0x204c6a[_0x9864('0x6e')](_0x10ce82);_0x204c6a['group'](_0x9864('0x7c'));var _0x16b8bb={'type':db[_0x9864('0x7d')][_0x9864('0x7e')][_0x9864('0x7f')],'raw':!![]};var _0x21f72d=_0x204c6a[_0x9864('0x80')]();_0x21f72d['field'](_0x9864('0x7c'));_0x21f72d[_0x9864('0x42')](_0x9864('0x81'),_0x9864('0x5b'));if(_0x199694['order']){_0x199694[_0x9864('0x3f')]['forEach'](function(_0x10b8da){var _0x35e42a=_0x10b8da[0x0]===_0x9864('0x82')?_0x10b8da[0x0]:'i.'+_0x10b8da[0x0];_0x204c6a[_0x9864('0x3f')](_0x35e42a,_0x10b8da[0x1]===_0x9864('0x83')?![]:!![]);});}if(!_['isEmpty'](_0x29ae30)){_0x204c6a['having'](_0x512465);_0x21f72d['where'](_0x9864('0x84'),_0x29ae30);}BPromise['resolve']()[_0x9864('0x26')](function(){if(!_0x35b759){if(_0x106b78[_0x9864('0x39')][_0x9864('0x6d')])return;_0x21f72d[_0x9864('0x6e')](_0x9864('0x85'));_0x204c6a[_0x9864('0x6e')](_0x9864('0x85'));return;}if(_0x106b78[_0x9864('0x86')]['role']!==_0x9864('0x87'))return;return _0x106b78[_0x9864('0x86')][_0x9864('0x88')]({'attributes':['id'],'raw':!![]})[_0x9864('0x26')](function(_0x420616){if(_[_0x9864('0x6c')](_0x420616)){_0x21f72d[_0x9864('0x6e')](_0x9864('0x89'));_0x204c6a[_0x9864('0x6e')](_0x9864('0x89'));}else{_0x21f72d['where'](_0x9864('0x6f'),_[_0x9864('0x2a')](_0x420616,'id'));_0x204c6a['where'](_0x9864('0x6f'),_['map'](_0x420616,'id'));}});})[_0x9864('0x26')](function(){if(_0x106b78[_0x9864('0x86')][_0x9864('0x8a')]==='agent'&&!_0x35b759&&!_0x106b78[_0x9864('0x39')][_0x9864('0x6d')])return[];return db[_0x9864('0x8b')][_0x9864('0x39')](_0x21f72d[_0x9864('0x8c')](),_0x16b8bb);})[_0x9864('0x26')](function(_0x27b11b){_0x1ac311[_0x9864('0x1e')]=_0x27b11b[_0x9864('0x3d')];if(_0x1ac311['count']===0x0)return[];return db['sequelize'][_0x9864('0x39')](_0x274880[_0x9864('0x8c')](),_0x16b8bb)[_0x9864('0x26')](function(_0x2c48be){_0x31c314=_[_0x9864('0x8d')](_0x2c48be,'id');_0x16b8bb=_[_0x9864('0x8e')](_0x16b8bb,{'model':db[_0x9864('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x106b78[_0x9864('0x39')][_0x9864('0x3b')]){_0x199694[_0x9864('0x3c')][_0x9864('0x2e')](function(_0xfff176){_0x204c6a['field']('i.'+_0xfff176);});}else{_0x204c6a[_0x9864('0x42')](_0x9864('0x81'),_0x9864('0x5b'));_0x204c6a['field']('a.key',_0x9864('0x8f'));_0x204c6a['field']('a.mandatoryDisposition',_0x9864('0x90'));_0x204c6a[_0x9864('0x42')](_0x9864('0x91'),_0x9864('0x82'));_0x204c6a['field'](_0x9864('0x92'));_0x204c6a[_0x9864('0x42')](_0x9864('0x93'),_0x9864('0x94'));_0x204c6a[_0x9864('0x42')](_0x9864('0x95'),_0x9864('0x96'));_0x204c6a[_0x9864('0x42')]('c.email',_0x9864('0x97'));_0x204c6a[_0x9864('0x42')](_0x9864('0x98'),'Contact.phone');_0x204c6a['field'](_0x9864('0x99'),_0x9864('0x9a'));_0x204c6a[_0x9864('0x42')](_0x9864('0x9b'),_0x9864('0x9c'));_0x204c6a[_0x9864('0x42')](_0x9864('0x9d'),_0x9864('0x9e'));_0x204c6a[_0x9864('0x42')](_0x9864('0x9f'),'Owner.internal');_0x204c6a['field'](_0x9864('0xa0'),'TagIds');}if(_0x199694[_0x9864('0x20')])_0x204c6a[_0x9864('0x20')](_0x199694[_0x9864('0x20')]);if(_0x199694['offset'])_0x204c6a['offset'](_0x199694[_0x9864('0x1f')]);return db['sequelize'][_0x9864('0x39')](_0x204c6a[_0x9864('0x8c')](),_0x16b8bb);})['then'](function(_0x54e2d4){_0x4e6591[_0x9864('0x6e')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x54e2d4,'id'));return db[_0x9864('0x8b')][_0x9864('0x39')](_0x4e6591[_0x9864('0x8c')](),_0x16b8bb)[_0x9864('0x26')](function(_0x5c85ef){var _0x215d74=_[_0x9864('0xa1')](_0x5c85ef,_0x9864('0xa2'));var _0x56b652=[];_0x54e2d4[_0x9864('0x2e')](function(_0xd7864d){_0x56b652[_0x9864('0x2f')](updateFaxInteraction(_0xd7864d,_0x31c314,_0x215d74));});return BPromise[_0x9864('0xa3')](_0x56b652);});});})['then'](function(_0x5997a9){_0x1ac311[_0x9864('0xa4')]=_0x5997a9;return _0x1ac311;})['then'](respondWithFilteredResult(_0x37b7c6,_0x199694))[_0x9864('0x30')](handleError(_0x37b7c6,null));};exports['show']=function(_0x5eb87c,_0x57af85){var _0x485eb3={'raw':![],'where':{'id':_0x5eb87c[_0x9864('0xa5')]['id']}},_0x2b904b={};_0x2b904b['model']=_[_0x9864('0x37')](db[_0x9864('0x32')][_0x9864('0xa6')]);_0x2b904b['query']=_[_0x9864('0x37')](_0x5eb87c[_0x9864('0x39')]);_0x2b904b['filters']=_[_0x9864('0x3a')](_0x2b904b[_0x9864('0x36')],_0x2b904b[_0x9864('0x39')]);_0x485eb3[_0x9864('0x3c')]=_['intersection'](_0x2b904b['model'],qs['fields'](_0x5eb87c[_0x9864('0x39')][_0x9864('0x3b')]));_0x485eb3[_0x9864('0x3c')]=_0x485eb3[_0x9864('0x3c')][_0x9864('0x3d')]?_0x485eb3[_0x9864('0x3c')]:_0x2b904b['model'];if(_0x5eb87c[_0x9864('0x39')]['includeAll']){_0x485eb3[_0x9864('0xa7')]=[{'all':!![]}];}_0x485eb3=_[_0x9864('0x8e')]({},_0x485eb3,_0x5eb87c[_0x9864('0xa8')]);return db[_0x9864('0x32')][_0x9864('0x5a')](_0x485eb3)[_0x9864('0x26')](handleEntityNotFound(_0x57af85,null))[_0x9864('0x26')](respondWithResult(_0x57af85,null))[_0x9864('0x30')](handleError(_0x57af85,null));};exports[_0x9864('0xa9')]=function(_0x37e79e,_0x1fcb55){return db[_0x9864('0x32')]['create'](_0x37e79e[_0x9864('0x69')],{})[_0x9864('0x26')](respondWithResult(_0x1fcb55,0xc9))['catch'](handleError(_0x1fcb55,null));};exports['update']=function(_0x162482,_0x36d015){if(_0x162482['body']['id']){delete _0x162482[_0x9864('0x69')]['id'];}return db[_0x9864('0x32')][_0x9864('0x5a')]({'where':{'id':_0x162482[_0x9864('0xa5')]['id']}})[_0x9864('0x26')](handleEntityNotFound(_0x36d015,null))[_0x9864('0x26')](saveUpdates(_0x162482[_0x9864('0x69')],null))['then'](respondWithResult(_0x36d015,null))[_0x9864('0x30')](handleError(_0x36d015,null));};exports[_0x9864('0xaa')]=function(_0x21a17e,_0x34c41d){return db['FaxInteraction'][_0x9864('0x5a')]({'where':{'id':_0x21a17e[_0x9864('0xa5')]['id']}})['then'](handleEntityNotFound(_0x34c41d,null))[_0x9864('0x26')](removeEntity(_0x34c41d,null))['catch'](handleError(_0x34c41d,null));};exports[_0x9864('0xab')]=function(_0x7c63e0,_0x315423){return db['FaxInteraction'][_0x9864('0xab')]()[_0x9864('0x26')](respondWithResult(_0x315423,null))['catch'](handleError(_0x315423,null));};exports[_0x9864('0xac')]=function(_0x393c22,_0x3d5552,_0x5e4f4f){return db[_0x9864('0xad')]['find']({'where':{'id':_0x393c22[_0x9864('0xa5')]['id']}})['then'](handleEntityNotFound(_0x3d5552,null))['then'](function(_0x1e3d60){if(_0x1e3d60){return _0x1e3d60[_0x9864('0xac')](_0x393c22['body'][_0x9864('0xae')],_[_0x9864('0xaf')](_0x393c22[_0x9864('0x69')],['ids','id'])||{});}})['then'](respondWithResult(_0x3d5552,null))[_0x9864('0x30')](handleError(_0x3d5552,null));};exports[_0x9864('0xb0')]=function(_0x2f721e,_0x1b2564,_0x1a3f0a){var _0x426c36={'raw':![],'where':{}};var _0xb85f8a={};var _0x3ebb24={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x2f721e['params']['id']}})[_0x9864('0x26')](handleEntityNotFound(_0x1b2564,null))[_0x9864('0x26')](function(_0x2d06fa){if(_0x2d06fa){_0xb85f8a['model']=_[_0x9864('0x37')](db['FaxMessage'][_0x9864('0xa6')]);_0xb85f8a[_0x9864('0x39')]=_[_0x9864('0x37')](_0x2f721e[_0x9864('0x39')]);_0xb85f8a[_0x9864('0x38')]=_['intersection'](_0xb85f8a[_0x9864('0x36')],_0xb85f8a['query']);_0x426c36[_0x9864('0x3c')]=_[_0x9864('0x3a')](_0xb85f8a[_0x9864('0x36')],qs[_0x9864('0x3b')](_0x2f721e['query']['fields']));_0x426c36[_0x9864('0x3c')]=_0x426c36['attributes']['length']?_0x426c36['attributes']:_0xb85f8a['model'];if(!_0x2f721e[_0x9864('0x39')]['hasOwnProperty']('nolimit')){_0x426c36['limit']=qs[_0x9864('0x20')](_0x2f721e['query'][_0x9864('0x20')]);_0x426c36[_0x9864('0x1f')]=qs[_0x9864('0x1f')](_0x2f721e[_0x9864('0x39')][_0x9864('0x1f')]);}_0x426c36[_0x9864('0x3f')]=qs[_0x9864('0x40')](_0x2f721e[_0x9864('0x39')][_0x9864('0x40')]);_0x426c36[_0x9864('0x6e')]=qs['filters'](_['pick'](_0x2f721e[_0x9864('0x39')],_0xb85f8a['filters']));_0x426c36['where']['FaxInteractionId']=_0x2d06fa['id'];if(_0x2f721e[_0x9864('0x39')][_0x9864('0x79')]){_0x426c36['where']=_['merge'](_0x426c36[_0x9864('0x6e')],{'$or':_[_0x9864('0x2a')](_0x426c36['attributes'],function(_0x3ffc0a){var _0x361335={};_0x361335[_0x3ffc0a]={'$like':'%'+_0x2f721e[_0x9864('0x39')][_0x9864('0x79')]+'%'};return _0x361335;})});}if(_0x2f721e[_0x9864('0x39')][_0x9864('0xb1')]){var _0x782c68=_0x2f721e[_0x9864('0x39')][_0x9864('0xb1')][_0x9864('0x2d')](',');var _0xc5a622={};_0xc5a622[_0x782c68[0x0]]={'$gte':moment(_0x782c68[0x1])[_0x9864('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')};_0x426c36[_0x9864('0x6e')]=_[_0x9864('0x8e')](_0x426c36[_0x9864('0x6e')],_0xc5a622);}_0x426c36=_[_0x9864('0x8e')]({},_0x426c36,_0x2f721e[_0x9864('0xa8')]);return db[_0x9864('0xad')]['count']({'where':_0x426c36['where']})['then'](function(_0x4ac0c3){_0x3ebb24[_0x9864('0x1e')]=_0x4ac0c3;if(_0x2f721e[_0x9864('0x39')][_0x9864('0xb3')]){_0x426c36[_0x9864('0xa7')]=[{'all':!![]}];}return db[_0x9864('0xad')][_0x9864('0xb4')](_0x426c36);})['then'](function(_0x149d34){_0x3ebb24['rows']=_0x149d34;return _0x3ebb24;});}})[_0x9864('0x26')](respondWithFilteredResult(_0x1b2564,_0x426c36))[_0x9864('0x30')](handleError(_0x1b2564,null));};exports[_0x9864('0xb5')]=function(_0x205da9,_0x47b15d,_0xa5e4d5){return db[_0x9864('0x32')][_0x9864('0x5a')]({'where':{'id':_0x205da9[_0x9864('0xa5')]['id']}})[_0x9864('0x26')](handleEntityNotFound(_0x47b15d,null))[_0x9864('0x26')](function(_0x48717d){if(_0x48717d){return _0x48717d[_0x9864('0xb6')](_0x205da9[_0x9864('0x69')]['ids'],_[_0x9864('0xaf')](_0x205da9['body'],[_0x9864('0xae'),'id'])||{})[_0x9864('0xb7')](function(){return db[_0x9864('0xb8')][_0x9864('0xb4')]({'attributes':['id',_0x9864('0x28'),'color'],'where':{'id':_0x205da9[_0x9864('0x69')]['ids']}});})[_0x9864('0x26')](function(_0x646da5){socket['emit'](_0x9864('0xb9'),{'id':Number(_0x205da9[_0x9864('0xa5')]['id']),'tags':_0x646da5||[]});return{'id':Number(_0x205da9[_0x9864('0xa5')]['id']),'tags':_0x646da5||[]};});}})[_0x9864('0x26')](respondWithResult(_0x47b15d,null))['catch'](handleError(_0x47b15d,null));};exports[_0x9864('0xba')]=function(_0x3c2fde,_0x1fa513,_0x279eab){return db['FaxInteraction'][_0x9864('0x5a')]({'where':{'id':_0x3c2fde['params']['id']}})[_0x9864('0x26')](handleEntityNotFound(_0x1fa513,null))[_0x9864('0x26')](function(_0x30ed6c){if(_0x30ed6c){return _0x30ed6c[_0x9864('0xba')](_0x3c2fde[_0x9864('0x39')][_0x9864('0xae')]);}})[_0x9864('0x26')](respondWithStatusCode(_0x1fa513,null))['catch'](handleError(_0x1fa513,null));};exports[_0x9864('0xbb')]=function(_0x3d8d9f,_0x132a82){var _0x279751=moment()['unix']()[_0x9864('0x8c')]();var _0x2c032c=path['join'](config['root'],_0x9864('0xbc'),_0x9864('0xbd'),_0x9864('0xbe'));var _0x5b4ddc=path[_0x9864('0xbf')](config[_0x9864('0xc0')],_0x9864('0xbc'),'files',_0x9864('0xc1'));var _0x167e68=path[_0x9864('0xbf')](_0x2c032c,_0x279751);var _0xdbcbdf=util['format'](_0x9864('0xc2'),_0x3d8d9f[_0x9864('0xa5')]['id'],_0x279751);var _0x4ba5be=path[_0x9864('0xbf')](_0x2c032c,_0xdbcbdf);var _0x44c615=[];_0x44c615[_0x9864('0x2f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0xeeb07c=[{'model':db[_0x9864('0xad')],'as':_0x9864('0xc3'),'attributes':['id',_0x9864('0x69'),_0x9864('0xc4')],'include':_0x44c615}];return db[_0x9864('0x32')]['find']({'where':{'id':_0x3d8d9f[_0x9864('0xa5')]['id']},'include':_0xeeb07c})[_0x9864('0x26')](handleEntityNotFound(_0x132a82,null))[_0x9864('0x26')](function(_0x31a195){if(_0x31a195&&_0x31a195[_0x9864('0xc3')]){var _0x185170=_0x31a195['get']({'plain':!![]});fs['mkdirSync'](_0x167e68);for(var _0x2c49a0=0x0;_0x2c49a0<_0x185170[_0x9864('0xc3')][_0x9864('0x3d')];_0x2c49a0++){var _0x29a4b3=_0x185170[_0x9864('0xc3')][_0x2c49a0][_0x9864('0xc5')];if(_0x29a4b3){var _0x109e61=path[_0x9864('0xbf')](_0x5b4ddc,_0x29a4b3[_0x9864('0xc6')]);if(fs[_0x9864('0xc7')](_0x109e61)){fs[_0x9864('0xc8')](_0x109e61)[_0x9864('0xc9')](fs['createWriteStream'](path[_0x9864('0xbf')](_0x167e68,_0x29a4b3[_0x9864('0xc6')])));}}}return BPromise[_0x9864('0xca')]()[_0x9864('0x26')](function(){return new BPromise(function(_0x3c28c4,_0x1135a3){zipdir(_0x167e68,{'saveTo':_0x4ba5be},function(_0x155b01,_0x2f42cf){if(_0x155b01)return _0x1135a3(_0x155b01);return _0x3c28c4(_0x2f42cf);});})[_0x9864('0x26')](function(){return new BPromise(function(_0x55d270,_0x2a78fb){rimraf(_0x167e68,function(_0x107070){if(_0x107070)_0x2a78fb(_0x107070);return _0x55d270();});});})[_0x9864('0x26')](function(){return _0x132a82[_0x9864('0xbb')](_0x4ba5be,_0xdbcbdf,function(_0x286b63){if(_0x286b63){console[_0x9864('0xcb')](_0x9864('0xcc'),_0x286b63);}else{fs[_0x9864('0xcd')](_0x4ba5be);}});});});}else{return _0x132a82['sendStatus'](0xc8);}})[_0x9864('0x30')](handleError(_0x132a82,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index c91ceff..79d5e24 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(_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 +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x2e1b36,_0x4d40ab){var _0x439dbe=function(_0x292f96){while(--_0x292f96){_0x2e1b36['push'](_0x2e1b36['shift']());}};_0x439dbe(++_0x4d40ab);}(_0x7a54,0x106));var _0x47a5=function(_0x11cec6,_0x1325c4){_0x11cec6=_0x11cec6-0x0;var _0x3b44f3=_0x7a54[_0x11cec6];return _0x3b44f3;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 3ae4d0a..6ba94ef 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 _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 +var _0x172f=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closedAt'];(function(_0x3fd8ba,_0x1e42ee){var _0x2596bf=function(_0x60cfed){while(--_0x60cfed){_0x3fd8ba['push'](_0x3fd8ba['shift']());}};_0x2596bf(++_0x1e42ee);}(_0x172f,0x128));var _0xf172=function(_0x2da885,_0x505296){_0x2da885=_0x2da885-0x0;var _0x11b8b8=_0x172f[_0x2da885];return _0x11b8b8;};'use strict';var _=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf172('0x2'));var BPromise=require(_0xf172('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf172('0x4'));var rimraf=require(_0xf172('0x5'));var config=require('../../config/environment');var attributes=require(_0xf172('0x6'));module[_0xf172('0x7')]=function(_0x5c7d2d,_0x457069){return _0x5c7d2d[_0xf172('0x8')](_0xf172('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3c31e2,_0x44fe47,_0x9c22f5){if(_0x3c31e2[_0xf172('0xa')]('closed')){_0x3c31e2[_0xf172('0xb')]=moment()[_0xf172('0xc')](_0xf172('0xd'));}_0x9c22f5(null,_0x3c31e2);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index cd8cf0a..ea53e9e 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 _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 +var _0x024f=['then','UpdateFaxInteraction','stringify','catch','AddTagsToFaxInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','message','result','FaxInteraction','update','body','options','where','attributes','limit'];(function(_0x215732,_0x22baba){var _0x176f26=function(_0x53b68){while(--_0x53b68){_0x215732['push'](_0x215732['shift']());}};_0x176f26(++_0x22baba);}(_0x024f,0x128));var _0xf024=function(_0x3a1da8,_0x5efaf9){_0x3a1da8=_0x3a1da8-0x0;var _0x337f8d=_0x024f[_0x3a1da8];return _0x337f8d;};'use strict';var _=require(_0xf024('0x0'));var util=require(_0xf024('0x1'));var moment=require('moment');var BPromise=require(_0xf024('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf024('0x3'));var db=require(_0xf024('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf024('0x5'))(_0xf024('0x6'));var config=require(_0xf024('0x7'));var jayson=require(_0xf024('0x8'));var client=jayson[_0xf024('0x9')][_0xf024('0xa')]({'port':0x232a});config[_0xf024('0xb')]=_[_0xf024('0xc')](config[_0xf024('0xb')],{'host':_0xf024('0xd'),'port':0x18eb});var socket=require(_0xf024('0xe'))(new Redis(config[_0xf024('0xb')]));require(_0xf024('0xf'))[_0xf024('0x10')](socket);function respondWithRpcPromise(_0x183546,_0x5d8283,_0x2e3d83){return new BPromise(function(_0x332456,_0x235532){return client['request'](_0x183546,_0x2e3d83)['then'](function(_0xba8200){logger[_0xf024('0x11')](_0xf024('0x12'),_0x5d8283,_0xf024('0x13'));logger[_0xf024('0x14')](_0xf024('0x15'),_0x5d8283,_0xf024('0x13'),JSON['stringify'](_0xba8200));if(_0xba8200[_0xf024('0x16')]){if(_0xba8200[_0xf024('0x16')]['code']===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x5d8283,_0xba8200[_0xf024('0x16')][_0xf024('0x17')]);return _0x235532(_0xba8200[_0xf024('0x16')]['message']);}logger[_0xf024('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x5d8283,_0xba8200[_0xf024('0x16')][_0xf024('0x17')]);return _0x332456(_0xba8200[_0xf024('0x16')]['message']);}else{logger['info'](_0xf024('0x12'),_0x5d8283,_0xf024('0x13'));_0x332456(_0xba8200[_0xf024('0x18')][_0xf024('0x17')]);}})['catch'](function(_0x475c05){logger[_0xf024('0x16')](_0xf024('0x12'),_0x5d8283,_0x475c05);_0x235532(_0x475c05);});});}exports['UpdateFaxInteraction']=function(_0x3b4e5c){var _0x5ac607=this;return new Promise(function(_0x112d75,_0x2a56cc){return db[_0xf024('0x19')][_0xf024('0x1a')](_0x3b4e5c[_0xf024('0x1b')],{'raw':_0x3b4e5c[_0xf024('0x1c')]?_0x3b4e5c[_0xf024('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4e5c['options']?_0x3b4e5c[_0xf024('0x1c')][_0xf024('0x1d')]||null:null,'attributes':_0x3b4e5c[_0xf024('0x1c')]?_0x3b4e5c['options'][_0xf024('0x1e')]||null:null,'limit':_0x3b4e5c[_0xf024('0x1c')]?_0x3b4e5c[_0xf024('0x1c')][_0xf024('0x1f')]||null:null})[_0xf024('0x20')](function(_0x57c906){logger[_0xf024('0x11')](_0xf024('0x21'),_0x3b4e5c);logger[_0xf024('0x14')](_0xf024('0x21'),_0x3b4e5c,JSON[_0xf024('0x22')](_0x57c906));_0x112d75(_0x57c906);})[_0xf024('0x23')](function(_0x52c8b8){logger[_0xf024('0x16')](_0xf024('0x21'),_0x52c8b8[_0xf024('0x17')],_0x3b4e5c);_0x2a56cc(_0x5ac607['error'](0x1f4,_0x52c8b8[_0xf024('0x17')]));});});};exports[_0xf024('0x24')]=function(_0x224117){return new Promise(function(_0x157710,_0x21840b){return db[_0xf024('0x19')]['find']({'where':_0x224117[_0xf024('0x1c')]?_0x224117[_0xf024('0x1c')][_0xf024('0x1d')]||null:null})[_0xf024('0x20')](function(_0x5eb49d){if(_0x5eb49d){return _0x5eb49d[_0xf024('0x25')](_0x224117['body'][_0xf024('0x26')],_[_0xf024('0x27')](_0x224117[_0xf024('0x1b')],[_0xf024('0x26'),'id'])||{});}})['spread'](function(_0x5b9a13){logger[_0xf024('0x11')](_0xf024('0x28'),_0x224117);logger[_0xf024('0x14')](_0xf024('0x28'),_0x224117,JSON[_0xf024('0x22')](_0x5b9a13));_0x157710(_0x5b9a13);})[_0xf024('0x23')](function(_0x478092){logger[_0xf024('0x16')](_0xf024('0x28'),_0x478092[_0xf024('0x17')],_0x224117);_0x21840b(_this[_0xf024('0x16')](0x1f4,_0x478092['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d1c6a60..0653542 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 _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 +var _0x92e4=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x4bb0f7,_0xb630dc){var _0x2b4fac=function(_0x55ecae){while(--_0x55ecae){_0x4bb0f7['push'](_0x4bb0f7['shift']());}};_0x2b4fac(++_0xb630dc);}(_0x92e4,0xa4));var _0x492e=function(_0x2670a7,_0x117566){_0x2670a7=_0x2670a7-0x0;var _0x33bfda=_0x92e4[_0x2670a7];return _0x33bfda;};'use strict';var FaxInteractionEvents=require(_0x492e('0x0'));var events=[_0x492e('0x1'),_0x492e('0x2'),_0x492e('0x3')];function createListener(_0x5c1f64,_0xa116f9){return function(_0x506263){_0xa116f9['emit'](_0x5c1f64,_0x506263);};}function removeListener(_0x447006,_0x3ca91a){return function(){FaxInteractionEvents[_0x492e('0x4')](_0x447006,_0x3ca91a);};}exports[_0x492e('0x5')]=function(_0x4008e6){for(var _0x1c64ae=0x0,_0x1d019e=events[_0x492e('0x6')];_0x1c64ae<_0x1d019e;_0x1c64ae++){var _0x54b380=events[_0x1c64ae];var _0x50a599=createListener(_0x492e('0x7')+_0x54b380,_0x4008e6);FaxInteractionEvents['on'](_0x54b380,_0x50a599);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1f1284e..1c0ee2c 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 _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 +var _0xb7e7=['/:id/messages','/:id/download','download','post','create','addMessage','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','tracked','fax','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','/:id','show'];(function(_0x4afd1e,_0x413bd4){var _0x3c4388=function(_0x665d8){while(--_0x665d8){_0x4afd1e['push'](_0x4afd1e['shift']());}};_0x3c4388(++_0x413bd4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb7e7[_0x4243a3];return _0x1b2a33;};'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['getMessages']);router[_0x7b7e('0x6')](_0x7b7e('0xc'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),auth['isAuthenticated'](),controller[_0x7b7e('0x10')]);router[_0x7b7e('0xe')]('/:id/tags',auth[_0x7b7e('0x8')](),interaction['tracked']('fax',_0x7b7e('0x11')),controller[_0x7b7e('0x12')]);router[_0x7b7e('0x13')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),interaction['tracked']('fax',_0x7b7e('0x14')),controller[_0x7b7e('0x15')]);router[_0x7b7e('0x16')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),interaction[_0x7b7e('0x17')](_0x7b7e('0x18'),_0x7b7e('0x19')),controller[_0x7b7e('0x1a')]);router[_0x7b7e('0x16')](_0x7b7e('0x1b'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0x1c')]);module[_0x7b7e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 7e304fa..3453d73 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 _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 +var _0xc675=['medium','BOOLEAN','out','sequelize','exports','TEXT'];(function(_0xf7bd2e,_0x19e43a){var _0x2c1c36=function(_0x2b60bc){while(--_0x2b60bc){_0xf7bd2e['push'](_0xf7bd2e['shift']());}};_0x2c1c36(++_0x19e43a);}(_0xc675,0xbd));var _0x5c67=function(_0x4406e2,_0x356aed){_0x4406e2=_0x4406e2-0x0;var _0x1e18aa=_0xc675[_0x4406e2];return _0x1e18aa;};'use strict';var Sequelize=require(_0x5c67('0x0'));module[_0x5c67('0x1')]={'body':{'type':Sequelize[_0x5c67('0x2')](_0x5c67('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5c67('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5c67('0x5')),'defaultValue':_0x5c67('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x5c67('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 6bf2d61..32f8aa8 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 _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 +var _0xb9be=['key','query','keys','intersection','model','attributes','fields','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','find','body','describe','../../config/logger','accept','fax','read','readAt','UserId','user','CmContact','Contact','get','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','manual','interface','format','channel','event','EventManager','acceptmessage','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','create','ContactId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','attachments','Attachment','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','type'];(function(_0x58cfb2,_0x51f78b){var _0x12f5f8=function(_0x4534db){while(--_0x4534db){_0x58cfb2['push'](_0x58cfb2['shift']());}};_0x12f5f8(++_0x51f78b);}(_0xb9be,0xc5));var _0xeb9b=function(_0x1b1e76,_0x31695b){_0x1b1e76=_0x1b1e76-0x0;var _0x3d743a=_0xb9be[_0x1b1e76];return _0x3d743a;};'use strict';var pdf=require(_0xeb9b('0x0'));var emlformat=require(_0xeb9b('0x1'));var rimraf=require(_0xeb9b('0x2'));var zipdir=require(_0xeb9b('0x3'));var jsonpatch=require(_0xeb9b('0x4'));var rp=require(_0xeb9b('0x5'));var moment=require(_0xeb9b('0x6'));var BPromise=require(_0xeb9b('0x7'));var Mustache=require(_0xeb9b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xeb9b('0x9'));var csv=require(_0xeb9b('0xa'));var ejs=require(_0xeb9b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0xa'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xeb9b('0x17'));var db=require(_0xeb9b('0x18'))['db'];config[_0xeb9b('0x19')]=_[_0xeb9b('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb9b('0x19')]));require(_0xeb9b('0x1b'))[_0xeb9b('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xeb9b('0x1d')][_0xeb9b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x406afd,_0x3fa308,_0x2c9aa6,_0x10da6e){return new BPromise(function(_0x239ccf,_0x5b5cda){var _0x2e8645=_0x10da6e||client;return _0x2e8645[_0xeb9b('0x1f')](_0x406afd,_0x2c9aa6)[_0xeb9b('0x20')](function(_0x3a11e3){logger[_0xeb9b('0x21')](_0xeb9b('0x22'),_0x3fa308,_0xeb9b('0x23'));logger[_0xeb9b('0x24')](_0xeb9b('0x25'),_0x3fa308,_0xeb9b('0x23'),JSON['stringify'](_0x3a11e3));if(_0x3a11e3[_0xeb9b('0x26')]){if(_0x3a11e3['error']['code']===0x1f4){logger[_0xeb9b('0x26')](_0xeb9b('0x22'),_0x3fa308,_0x3a11e3['error'][_0xeb9b('0x27')]);return _0x5b5cda(_0x3a11e3[_0xeb9b('0x26')][_0xeb9b('0x27')]);}logger[_0xeb9b('0x26')](_0xeb9b('0x22'),_0x3fa308,_0x3a11e3[_0xeb9b('0x26')][_0xeb9b('0x27')]);return _0x239ccf(_0x3a11e3[_0xeb9b('0x26')][_0xeb9b('0x27')]);}else{logger[_0xeb9b('0x21')](_0xeb9b('0x22'),_0x3fa308,_0xeb9b('0x23'));_0x239ccf(_0x3a11e3[_0xeb9b('0x28')][_0xeb9b('0x27')]);}})[_0xeb9b('0x29')](function(_0x434461){logger['error'](_0xeb9b('0x22'),_0x3fa308,_0x434461);_0x5b5cda(_0x434461);});});}function respondWithStatusCode(_0x4ed960,_0x66a567){_0x66a567=_0x66a567||0xcc;return function(_0x5d6846){if(_0x5d6846){return _0x4ed960[_0xeb9b('0x2a')](_0x66a567);}return _0x4ed960[_0xeb9b('0x2b')](_0x66a567)[_0xeb9b('0x2c')]();};}function respondWithResult(_0xe3eda5,_0x52f6c1){_0x52f6c1=_0x52f6c1||0xc8;return function(_0x33f73a){if(_0x33f73a){return _0xe3eda5[_0xeb9b('0x2b')](_0x52f6c1)['json'](_0x33f73a);}};}function respondWithFilteredResult(_0x35ff07,_0x33bb1d){return function(_0x5ce745){if(_0x5ce745){var _0x2a4b51=_0x5ce745[_0xeb9b('0x2d')],_0x2ea20f=_0x33bb1d['offset'],_0x4188d5=_0x33bb1d[_0xeb9b('0x2e')]+_0x33bb1d['limit'],_0x48c5f4;if(_0x4188d5>=_0x2a4b51){_0x4188d5=_0x2a4b51;_0x48c5f4=0xc8;}else{_0x48c5f4=0xce;}_0x35ff07[_0xeb9b('0x2b')](_0x48c5f4);return _0x35ff07['set'](_0xeb9b('0x2f'),_0x2ea20f+'-'+_0x4188d5+'/'+_0x2a4b51)['json'](_0x5ce745);}return null;};}function patchUpdates(_0x1c62e6){return function(_0x4c8e4c){try{jsonpatch[_0xeb9b('0x30')](_0x4c8e4c,_0x1c62e6,!![]);}catch(_0x370dbe){return BPromise[_0xeb9b('0x31')](_0x370dbe);}return _0x4c8e4c[_0xeb9b('0x32')]();};}function saveUpdates(_0x112129,_0x2cef18){return function(_0x9efe80){if(_0x9efe80){return _0x9efe80[_0xeb9b('0x33')](_0x112129)[_0xeb9b('0x20')](function(_0x3f51ad){return _0x3f51ad;});}return null;};}function removeEntity(_0x5b01c1,_0x215bfa){return function(_0x25dc3f){if(_0x25dc3f){return _0x25dc3f[_0xeb9b('0x34')]()[_0xeb9b('0x20')](function(){_0x5b01c1[_0xeb9b('0x2b')](0xcc)[_0xeb9b('0x2c')]();});}};}function handleEntityNotFound(_0x179cd9,_0x5e2215){return function(_0x4283e8){if(!_0x4283e8){_0x179cd9[_0xeb9b('0x2a')](0x194);}return _0x4283e8;};}function handleError(_0x39a9d2,_0x487783){_0x487783=_0x487783||0x1f4;return function(_0x236e69){logger[_0xeb9b('0x26')](_0x236e69[_0xeb9b('0x35')]);if(_0x236e69[_0xeb9b('0x36')]){delete _0x236e69[_0xeb9b('0x36')];}_0x39a9d2[_0xeb9b('0x2b')](_0x487783)['send'](_0x236e69);};}exports[_0xeb9b('0x37')]=function(_0x2226c2,_0x55983e){var _0x1c5f5a={},_0x31005f={},_0x401392={'count':0x0,'rows':[]};var _0x395b6b=_[_0xeb9b('0x38')](db[_0xeb9b('0x39')][_0xeb9b('0x3a')],function(_0x555ab7){return{'name':_0x555ab7[_0xeb9b('0x3b')],'type':_0x555ab7[_0xeb9b('0x3c')][_0xeb9b('0x3d')]};});_0x31005f['model']=_['map'](_0x395b6b,'name');_0x31005f[_0xeb9b('0x3e')]=_[_0xeb9b('0x3f')](_0x2226c2[_0xeb9b('0x3e')]);_0x31005f['filters']=_[_0xeb9b('0x40')](_0x31005f[_0xeb9b('0x41')],_0x31005f[_0xeb9b('0x3e')]);_0x1c5f5a[_0xeb9b('0x42')]=_[_0xeb9b('0x40')](_0x31005f[_0xeb9b('0x41')],qs[_0xeb9b('0x43')](_0x2226c2['query'][_0xeb9b('0x43')]));_0x1c5f5a[_0xeb9b('0x42')]=_0x1c5f5a[_0xeb9b('0x42')]['length']?_0x1c5f5a['attributes']:_0x31005f[_0xeb9b('0x41')];if(!_0x2226c2[_0xeb9b('0x3e')]['hasOwnProperty'](_0xeb9b('0x44'))){_0x1c5f5a['limit']=qs[_0xeb9b('0x45')](_0x2226c2[_0xeb9b('0x3e')][_0xeb9b('0x45')]);_0x1c5f5a[_0xeb9b('0x2e')]=qs[_0xeb9b('0x2e')](_0x2226c2[_0xeb9b('0x3e')][_0xeb9b('0x2e')]);}_0x1c5f5a[_0xeb9b('0x46')]=qs[_0xeb9b('0x47')](_0x2226c2[_0xeb9b('0x3e')][_0xeb9b('0x47')]);_0x1c5f5a[_0xeb9b('0x48')]=qs['filters'](_['pick'](_0x2226c2[_0xeb9b('0x3e')],_0x31005f['filters']),_0x395b6b);if(_0x2226c2[_0xeb9b('0x3e')][_0xeb9b('0x49')]){_0x1c5f5a[_0xeb9b('0x48')]=_['merge'](_0x1c5f5a[_0xeb9b('0x48')],{'$or':_[_0xeb9b('0x38')](_0x395b6b,function(_0x53c7f0){if(_0x53c7f0[_0xeb9b('0x3c')]!==_0xeb9b('0x4a')){var _0x389c56={};_0x389c56[_0x53c7f0[_0xeb9b('0x36')]]={'$like':'%'+_0x2226c2[_0xeb9b('0x3e')][_0xeb9b('0x49')]+'%'};return _0x389c56;}})});}_0x1c5f5a=_[_0xeb9b('0x4b')]({},_0x1c5f5a,_0x2226c2[_0xeb9b('0x4c')]);var _0x4ded8f={'where':_0x1c5f5a['where']};return db[_0xeb9b('0x39')]['count'](_0x4ded8f)['then'](function(_0x23a2b3){_0x401392[_0xeb9b('0x2d')]=_0x23a2b3;if(_0x2226c2[_0xeb9b('0x3e')][_0xeb9b('0x4d')]){_0x1c5f5a[_0xeb9b('0x4e')]=[{'all':!![]}];}return db[_0xeb9b('0x39')]['findAll'](_0x1c5f5a);})['then'](function(_0x51a053){_0x401392[_0xeb9b('0x4f')]=_0x51a053;return _0x401392;})['then'](respondWithFilteredResult(_0x55983e,_0x1c5f5a))[_0xeb9b('0x29')](handleError(_0x55983e,null));};exports[_0xeb9b('0x50')]=function(_0x2ae9bf,_0x31d8d3){var _0x1383f1={'raw':!![],'where':{'id':_0x2ae9bf[_0xeb9b('0x51')]['id']}},_0xe4a817={};_0xe4a817[_0xeb9b('0x41')]=_[_0xeb9b('0x3f')](db[_0xeb9b('0x39')]['rawAttributes']);_0xe4a817['query']=_[_0xeb9b('0x3f')](_0x2ae9bf[_0xeb9b('0x3e')]);_0xe4a817['filters']=_[_0xeb9b('0x40')](_0xe4a817['model'],_0xe4a817[_0xeb9b('0x3e')]);_0x1383f1[_0xeb9b('0x42')]=_['intersection'](_0xe4a817['model'],qs['fields'](_0x2ae9bf[_0xeb9b('0x3e')][_0xeb9b('0x43')]));_0x1383f1[_0xeb9b('0x42')]=_0x1383f1['attributes']['length']?_0x1383f1[_0xeb9b('0x42')]:_0xe4a817[_0xeb9b('0x41')];if(_0x2ae9bf[_0xeb9b('0x3e')][_0xeb9b('0x4d')]){_0x1383f1[_0xeb9b('0x4e')]=[{'all':!![]}];}_0x1383f1=_[_0xeb9b('0x4b')]({},_0x1383f1,_0x2ae9bf['options']);return db[_0xeb9b('0x39')][_0xeb9b('0x52')](_0x1383f1)['then'](handleEntityNotFound(_0x31d8d3,null))[_0xeb9b('0x20')](respondWithResult(_0x31d8d3,null))['catch'](handleError(_0x31d8d3,null));};exports[_0xeb9b('0x33')]=function(_0x12f8d6,_0x5e3b36){if(_0x12f8d6[_0xeb9b('0x53')]['id']){delete _0x12f8d6['body']['id'];}return db[_0xeb9b('0x39')][_0xeb9b('0x52')]({'where':{'id':_0x12f8d6[_0xeb9b('0x51')]['id']}})[_0xeb9b('0x20')](handleEntityNotFound(_0x5e3b36,null))[_0xeb9b('0x20')](saveUpdates(_0x12f8d6['body'],null))[_0xeb9b('0x20')](respondWithResult(_0x5e3b36,null))[_0xeb9b('0x29')](handleError(_0x5e3b36,null));};exports[_0xeb9b('0x34')]=function(_0x520792,_0x3126d9){return db[_0xeb9b('0x39')][_0xeb9b('0x52')]({'where':{'id':_0x520792[_0xeb9b('0x51')]['id']}})[_0xeb9b('0x20')](handleEntityNotFound(_0x3126d9,null))[_0xeb9b('0x20')](removeEntity(_0x3126d9,null))[_0xeb9b('0x29')](handleError(_0x3126d9,null));};exports[_0xeb9b('0x54')]=function(_0x2f8b0f,_0x339918){return db[_0xeb9b('0x39')]['describe']()['then'](respondWithResult(_0x339918,null))['catch'](handleError(_0x339918,null));};var interaction_log=require(_0xeb9b('0x55'))('fax-interactions');exports[_0xeb9b('0x56')]=function(_0x32cb68,_0x1ec9e4,_0x52c74f){var _0x27deea={'agent':{},'channel':_0xeb9b('0x57')};if(_0x32cb68[_0xeb9b('0x53')]['id']){delete _0x32cb68[_0xeb9b('0x53')]['id'];}_0x32cb68[_0xeb9b('0x53')][_0xeb9b('0x58')]=!![];_0x32cb68[_0xeb9b('0x53')][_0xeb9b('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x32cb68[_0xeb9b('0x53')][_0xeb9b('0x5a')]=_0x32cb68[_0xeb9b('0x53')]['UserId']||_0x32cb68[_0xeb9b('0x5b')]['id'];_0x27deea['agent']['id']=_0x32cb68[_0xeb9b('0x53')]['UserId'];return db[_0xeb9b('0x39')][_0xeb9b('0x52')]({'where':{'id':_0x32cb68[_0xeb9b('0x51')]['id'],'UserId':null},'include':[{'model':db[_0xeb9b('0x5c')],'as':_0xeb9b('0x5d')}]})['then'](handleEntityNotFound(_0x1ec9e4,null))[_0xeb9b('0x20')](saveUpdates(_0x32cb68[_0xeb9b('0x53')],null))['then'](function(_0x5a690a){if(_0x5a690a){_0x27deea[_0xeb9b('0x27')]=_0x5a690a[_0xeb9b('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0xeb9b('0x52')]({'where':{'id':_0x5a690a['FaxInteractionId']}});}return null;})[_0xeb9b('0x20')](handleEntityNotFound(_0x1ec9e4,null))['then'](function(_0x36376f){if(_0x36376f){return _0x36376f[_0xeb9b('0x33')]({'UserId':_0x32cb68[_0xeb9b('0x53')][_0xeb9b('0x5a')],'read1stAt':_[_0xeb9b('0x5f')](_0x36376f[_0xeb9b('0x60')])?moment()['format'](_0xeb9b('0x61')):undefined});}return null;})[_0xeb9b('0x20')](function(_0x5b670b){if(_0x5b670b){_0x27deea[_0xeb9b('0x62')]=_0x5b670b[_0xeb9b('0x5e')]({'plain':!![]});interaction_log[_0xeb9b('0x21')](_0xeb9b('0x63'),_0x32cb68['user']['id'],_0x32cb68[_0xeb9b('0x5b')][_0xeb9b('0x36')],_0x32cb68['user'][_0xeb9b('0x64')],_0x27deea[_0xeb9b('0x62')]['id'],_0x32cb68[_0xeb9b('0x53')]?JSON[_0xeb9b('0x65')](_0x32cb68[_0xeb9b('0x53')]):_0xeb9b('0x66'));return respondWithRpcPromise(_0xeb9b('0x67'),'acceptMessage',_0x27deea);}return null;})[_0xeb9b('0x20')](function(_0x1024d7){if(_0x1024d7){if(_0x32cb68['body'][_0xeb9b('0x68')]){_0x27deea[_0xeb9b('0x27')][_0xeb9b('0x69')]=util[_0xeb9b('0x6a')]('SIP/%s',_0x32cb68[_0xeb9b('0x5b')][_0xeb9b('0x36')]);_0x27deea[_0xeb9b('0x27')][_0xeb9b('0x6b')]=_0x27deea[_0xeb9b('0x6b')];_0x27deea[_0xeb9b('0x27')][_0xeb9b('0x6c')]=_0xeb9b('0x56');return respondWithRpcPromise(_0xeb9b('0x6d'),_0xeb9b('0x6d'),{'event':_0xeb9b('0x6e'),'message':_0x27deea[_0xeb9b('0x27')]},client9002)[_0xeb9b('0x20')](function(){return _0x27deea;});}return _0x27deea;}return null;})[_0xeb9b('0x20')](respondWithResult(_0x1ec9e4,null))[_0xeb9b('0x29')](handleError(_0x1ec9e4,null));};var interaction_log=require(_0xeb9b('0x55'))('fax-interactions');exports[_0xeb9b('0x31')]=function(_0x3e4ef2,_0x32be3f,_0x524dad){var _0x541729={'agent':{},'channel':_0xeb9b('0x57')};if(_0x3e4ef2['body']['id']){delete _0x3e4ef2[_0xeb9b('0x53')]['id'];}_0x3e4ef2[_0xeb9b('0x53')][_0xeb9b('0x5a')]=_0x3e4ef2[_0xeb9b('0x53')][_0xeb9b('0x5a')]||_0x3e4ef2[_0xeb9b('0x5b')]['id'];_0x541729[_0xeb9b('0x6f')]['id']=_0x3e4ef2[_0xeb9b('0x53')][_0xeb9b('0x5a')];return db[_0xeb9b('0x39')][_0xeb9b('0x52')]({'where':{'id':_0x3e4ef2[_0xeb9b('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32be3f,null))['then'](function(_0x2a47e1){if(_0x2a47e1){_0x541729['message']=_0x2a47e1['get']({'plain':!![]});return db[_0xeb9b('0x70')]['find']({'where':{'id':_0x2a47e1['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x32be3f,null))[_0xeb9b('0x20')](function(_0x3147bc){if(_0x3147bc){_0x541729[_0xeb9b('0x62')]=_0x3147bc[_0xeb9b('0x5e')]({'plain':!![]});interaction_log['info'](_0xeb9b('0x71'),_0x3e4ef2[_0xeb9b('0x5b')]['id'],_0x3e4ef2[_0xeb9b('0x5b')]['name'],_0x3e4ef2['user'][_0xeb9b('0x64')],_0x541729['interaction']['id'],_0x3e4ef2[_0xeb9b('0x53')]?JSON['stringify'](_0x3e4ef2['body']):_0xeb9b('0x66'));return respondWithRpcPromise('RejectMessage',_0xeb9b('0x72'),_0x541729);}return null;})['then'](function(_0x5a3819){if(_0x5a3819){_0x5a3819[_0xeb9b('0x27')][_0xeb9b('0x69')]=util[_0xeb9b('0x6a')](_0xeb9b('0x73'),_0x3e4ef2['user'][_0xeb9b('0x36')]);_0x5a3819[_0xeb9b('0x27')][_0xeb9b('0x6b')]=_0x541729[_0xeb9b('0x6b')];_0x5a3819[_0xeb9b('0x27')][_0xeb9b('0x6c')]='reject';respondWithRpcPromise(_0xeb9b('0x6d'),'EventManager',{'event':_0xeb9b('0x74'),'message':_0x5a3819[_0xeb9b('0x27')]},client9002);return _0x541729;}return null;})['then'](respondWithResult(_0x32be3f,null))[_0xeb9b('0x29')](handleError(_0x32be3f,null));};exports['create']=function(_0x16a04c,_0x58e761){var _0x36f89f;return db[_0xeb9b('0x39')][_0xeb9b('0x75')](_0x16a04c[_0xeb9b('0x53')],{})[_0xeb9b('0x20')](function(_0x24bac5){_0x36f89f=_0x24bac5;return db[_0xeb9b('0x5c')]['findOne']({'where':{'id':_0x36f89f[_0xeb9b('0x76')]}});})[_0xeb9b('0x20')](function(_0x5617b5){if(_[_0xeb9b('0x5f')](_0x5617b5)){return;}else{_0x36f89f[_0xeb9b('0x57')]=_0x5617b5[_0xeb9b('0x57')];return db['Attachment']['findOne']({'where':{'id':_0x36f89f['AttachmentId']}});}})[_0xeb9b('0x20')](function(_0x393775){return respondWithRpcPromise('SendFax',_0xeb9b('0x77'),{'FaxAccountId':_[_0xeb9b('0x5f')](_0x16a04c[_0xeb9b('0x53')])?undefined:_0x16a04c[_0xeb9b('0x53')][_0xeb9b('0x78')],'path':_[_0xeb9b('0x5f')](_0x393775)?undefined:util['format'](_0xeb9b('0x79'),_0x393775[_0xeb9b('0x7a')]),'fax':_[_0xeb9b('0x5f')](_0x36f89f[_0xeb9b('0x57')])?undefined:_0x36f89f[_0xeb9b('0x57')],'AttachmentId':_0x36f89f[_0xeb9b('0x7b')]},client9002);})[_0xeb9b('0x20')](respondWithResult(_0x58e761,0xc9))[_0xeb9b('0x29')](handleError(_0x58e761,null));};exports[_0xeb9b('0x7c')]=function(_0x1ca7f4,_0x469401){var _0x4b5e90=path[_0xeb9b('0x7d')](config[_0xeb9b('0x7e')],'server','files',_0xeb9b('0x7f'));return db[_0xeb9b('0x39')]['find']({'where':{'id':_0x1ca7f4[_0xeb9b('0x51')]['id']},'include':[{'model':db[_0xeb9b('0x80')],'as':_0xeb9b('0x80')}]})[_0xeb9b('0x20')](handleEntityNotFound(_0x469401,null))[_0xeb9b('0x20')](function(_0xcf0b2){if(_0xcf0b2){return _0x469401[_0xeb9b('0x7c')](path[_0xeb9b('0x7d')](_0x4b5e90,_0xcf0b2[_0xeb9b('0x80')]['basename']));}})[_0xeb9b('0x29')](handleError(_0x469401,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 78b84aa..fd13553 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 _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 +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x28b115,_0x2de018){var _0x389b5c=function(_0x243482){while(--_0x243482){_0x28b115['push'](_0x28b115['shift']());}};_0x389b5c(++_0x2de018);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index f91a887..81ea565 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 _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 +var _0xeb46=['../../config/logger','api','moment','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','fti_fax_messages','body','get','direction','toLowerCase','secret','UserId','FaxInteraction','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeb46,0x1da));var _0x6eb4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeb46[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6eb4('0x0'));var util=require(_0x6eb4('0x1'));var logger=require(_0x6eb4('0x2'))(_0x6eb4('0x3'));var moment=require(_0x6eb4('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6eb4('0x5'));var rimraf=require(_0x6eb4('0x6'));var config=require(_0x6eb4('0x7'));var attributes=require(_0x6eb4('0x8'));module['exports']=function(_0x1a832d,_0x1a8a5f){return _0x1a832d[_0x6eb4('0x9')](_0x6eb4('0xa'),attributes,{'tableName':_0x6eb4('0xb'),'paranoid':![],'indexes':[{'name':_0x6eb4('0xc'),'fields':[_0x6eb4('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x410a1a,_0x17b09a,_0xc28060){var _0x2960ea=_0x1a832d['models'];var _0x3d0e9b=_0x410a1a[_0x6eb4('0xe')]({'plain':!![]});if(_0x3d0e9b[_0x6eb4('0xf')][_0x6eb4('0x10')]()==='in'||_0x3d0e9b[_0x6eb4('0xf')][_0x6eb4('0x10')]()==='out'&&!_0x3d0e9b[_0x6eb4('0x11')]&&!_['isNil'](_0x3d0e9b[_0x6eb4('0x12')])){_0x2960ea[_0x6eb4('0x13')][_0x6eb4('0x14')]({'where':{'id':_0x3d0e9b[_0x6eb4('0x15')]}})['then'](function(_0x2fe991){if(_0x2fe991){_0x2fe991[_0x6eb4('0x16')]({'lastMsgAt':_0x3d0e9b[_0x6eb4('0x17')],'lastMsgDirection':_0x3d0e9b[_0x6eb4('0xf')]['toLowerCase']()});}})[_0x6eb4('0x18')](function(_0x523758){console[_0x6eb4('0x19')](_0x523758);});}_0xc28060();}},'charset':_0x6eb4('0x1a'),'collate':_0x6eb4('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 2cf96da..5313e2d 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 _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 +var _0x10cb=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxMessage','FaxMessage','options','raw','UpdateFaxMessage','update','lodash','moment','randomstring'];(function(_0x7b383b,_0x2876f7){var _0x54765c=function(_0x4dfe29){while(--_0x4dfe29){_0x7b383b['push'](_0x7b383b['shift']());}};_0x54765c(++_0x2876f7);}(_0x10cb,0xeb));var _0xb10c=function(_0x89c994,_0x48078f){_0x89c994=_0x89c994-0x0;var _0x31ef0b=_0x10cb[_0x89c994];return _0x31ef0b;};'use strict';var _=require(_0xb10c('0x0'));var util=require('util');var moment=require(_0xb10c('0x1'));var BPromise=require('bluebird');var rs=require(_0xb10c('0x2'));var fs=require('fs');var Redis=require(_0xb10c('0x3'));var db=require(_0xb10c('0x4'))['db'];var utils=require(_0xb10c('0x5'));var logger=require('../../config/logger')(_0xb10c('0x6'));var config=require(_0xb10c('0x7'));var jayson=require(_0xb10c('0x8'));var client=jayson[_0xb10c('0x9')][_0xb10c('0xa')]({'port':0x232a});config[_0xb10c('0xb')]=_[_0xb10c('0xc')](config['redis'],{'host':_0xb10c('0xd'),'port':0x18eb});var socket=require(_0xb10c('0xe'))(new Redis(config['redis']));require(_0xb10c('0xf'))['register'](socket);function respondWithRpcPromise(_0x3453ec,_0x3cfb8b,_0x6131e8){return new BPromise(function(_0x160f7f,_0x27d085){return client['request'](_0x3453ec,_0x6131e8)[_0xb10c('0x10')](function(_0x344108){logger[_0xb10c('0x11')](_0xb10c('0x12'),_0x3cfb8b,_0xb10c('0x13'));logger[_0xb10c('0x14')](_0xb10c('0x15'),_0x3cfb8b,_0xb10c('0x13'),JSON[_0xb10c('0x16')](_0x344108));if(_0x344108['error']){if(_0x344108[_0xb10c('0x17')][_0xb10c('0x18')]===0x1f4){logger[_0xb10c('0x17')](_0xb10c('0x12'),_0x3cfb8b,_0x344108[_0xb10c('0x17')][_0xb10c('0x19')]);return _0x27d085(_0x344108['error'][_0xb10c('0x19')]);}logger[_0xb10c('0x17')](_0xb10c('0x12'),_0x3cfb8b,_0x344108[_0xb10c('0x17')][_0xb10c('0x19')]);return _0x160f7f(_0x344108[_0xb10c('0x17')][_0xb10c('0x19')]);}else{logger[_0xb10c('0x11')](_0xb10c('0x12'),_0x3cfb8b,_0xb10c('0x13'));_0x160f7f(_0x344108[_0xb10c('0x1a')][_0xb10c('0x19')]);}})[_0xb10c('0x1b')](function(_0x26204f){logger[_0xb10c('0x17')](_0xb10c('0x12'),_0x3cfb8b,_0x26204f);_0x27d085(_0x26204f);});});}exports[_0xb10c('0x1c')]=function(_0x5224c5){var _0x44671a=this;return new Promise(function(_0x302895,_0x1c9b26){return db[_0xb10c('0x1d')]['create'](_0x5224c5['body'],{'raw':_0x5224c5[_0xb10c('0x1e')]?_0x5224c5[_0xb10c('0x1e')][_0xb10c('0x1f')]===undefined?!![]:![]:!![]})[_0xb10c('0x10')](function(_0x3f6ffb){logger[_0xb10c('0x11')](_0xb10c('0x1c'),_0x5224c5);logger['debug']('CreateFaxMessage',_0x5224c5,JSON[_0xb10c('0x16')](_0x3f6ffb));_0x302895(_0x3f6ffb);})[_0xb10c('0x1b')](function(_0x3c6e59){logger[_0xb10c('0x17')](_0xb10c('0x1c'),_0x3c6e59[_0xb10c('0x19')],_0x5224c5);_0x1c9b26(_0x44671a[_0xb10c('0x17')](0x1f4,_0x3c6e59[_0xb10c('0x19')]));});});};exports[_0xb10c('0x20')]=function(_0x1ab6ce){var _0x48b55d=this;return new Promise(function(_0x2f484a,_0xd42016){return db[_0xb10c('0x1d')][_0xb10c('0x21')](_0x1ab6ce['body'],{'raw':_0x1ab6ce[_0xb10c('0x1e')]?_0x1ab6ce[_0xb10c('0x1e')][_0xb10c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ab6ce[_0xb10c('0x1e')]?_0x1ab6ce[_0xb10c('0x1e')]['where']||null:null,'attributes':_0x1ab6ce['options']?_0x1ab6ce[_0xb10c('0x1e')]['attributes']||null:null,'limit':_0x1ab6ce[_0xb10c('0x1e')]?_0x1ab6ce[_0xb10c('0x1e')]['limit']||null:null})[_0xb10c('0x10')](function(_0x281090){logger['info'](_0xb10c('0x20'),_0x1ab6ce);logger['debug'](_0xb10c('0x20'),_0x1ab6ce,JSON[_0xb10c('0x16')](_0x281090));_0x2f484a(_0x281090);})['catch'](function(_0x3e9e3d){logger[_0xb10c('0x17')]('UpdateFaxMessage',_0x3e9e3d[_0xb10c('0x19')],_0x1ab6ce);_0xd42016(_0x48b55d[_0xb10c('0x17')](0x1f4,_0x3e9e3d[_0xb10c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3c1d045..67d4d83 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_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 +var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 fd214a4..0391a00 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 _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 +var _0x63c6=['accept','/:id/reject','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','download','post','tracked','fax','faxmessage:create','/:id','put','/:id/accept'];(function(_0x4824c1,_0x2657fa){var _0x7cd05a=function(_0x6c3aa9){while(--_0x6c3aa9){_0x4824c1['push'](_0x4824c1['shift']());}};_0x7cd05a(++_0x2657fa);}(_0x63c6,0xbb));var _0x663c=function(_0xce88fb,_0x47ff46){_0xce88fb=_0xce88fb-0x0;var _0x319a1e=_0x63c6[_0xce88fb];return _0x319a1e;};'use strict';var multer=require(_0x663c('0x0'));var util=require(_0x663c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x663c('0x2'));var router=express[_0x663c('0x3')]();var auth=require(_0x663c('0x4'));var interaction=require(_0x663c('0x5'));var config=require(_0x663c('0x6'));var controller=require(_0x663c('0x7'));router[_0x663c('0x8')]('/',auth[_0x663c('0x9')](),controller[_0x663c('0xa')]);router['get'](_0x663c('0xb'),auth[_0x663c('0x9')](),controller[_0x663c('0xc')]);router[_0x663c('0x8')]('/:id',auth[_0x663c('0x9')](),controller['show']);router[_0x663c('0x8')]('/:id/download',auth[_0x663c('0x9')](),controller[_0x663c('0xd')]);router[_0x663c('0xe')]('/',auth[_0x663c('0x9')](),interaction[_0x663c('0xf')](_0x663c('0x10'),_0x663c('0x11')),controller['create']);router['put'](_0x663c('0x12'),auth[_0x663c('0x9')](),controller['update']);router[_0x663c('0x13')](_0x663c('0x14'),auth[_0x663c('0x9')](),controller[_0x663c('0x15')]);router['put'](_0x663c('0x16'),auth[_0x663c('0x9')](),controller['reject']);router[_0x663c('0x17')]('/:id',auth[_0x663c('0x9')](),controller[_0x663c('0x18')]);module[_0x663c('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 18f2aa7..cc95bd1 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 _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 +var _0xbb35=['ENUM','rrmemory','beepall','exports','STRING','name','INTEGER'];(function(_0x49a1a1,_0x7e5d27){var _0x151fe2=function(_0x40382e){while(--_0x40382e){_0x49a1a1['push'](_0x49a1a1['shift']());}};_0x151fe2(++_0x7e5d27);}(_0xbb35,0x88));var _0x5bb3=function(_0x428167,_0x2bdfa1){_0x428167=_0x428167-0x0;var _0x57bc25=_0xbb35[_0x428167];return _0x57bc25;};'use strict';var Sequelize=require('sequelize');module[_0x5bb3('0x0')]={'name':{'type':Sequelize[_0x5bb3('0x1')],'unique':_0x5bb3('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bb3('0x1')]},'timeout':{'type':Sequelize[_0x5bb3('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5bb3('0x4')](_0x5bb3('0x5'),_0x5bb3('0x6'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5bb3('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 30962d0..14d20d4 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 _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 +var _0x9d88=['from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','includes','all','union','compact','value','removeAgents','emit','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','defaults','redis','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','reject','save','update','then','FaxQueues','UserProfileResource','destroy','sendStatus','stack','name','index','FaxQueue','rawAttributes','type','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','order','User','findAndCountAll','UserId','agent','faxPause','format','%s/%s','SIP','createdAt','updatedAt','Team','getTeams','addTeams','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','field'];(function(_0x3e5cd3,_0x17c4b2){var _0x1e8bd0=function(_0x3e2290){while(--_0x3e2290){_0x3e5cd3['push'](_0x3e5cd3['shift']());}};_0x1e8bd0(++_0x17c4b2);}(_0x9d88,0x1a6));var _0x89d8=function(_0x41cba1,_0x37a357){_0x41cba1=_0x41cba1-0x0;var _0x17f2e6=_0x9d88[_0x41cba1];return _0x17f2e6;};'use strict';var pdf=require(_0x89d8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x89d8('0x1'));var zipdir=require(_0x89d8('0x2'));var jsonpatch=require(_0x89d8('0x3'));var rp=require(_0x89d8('0x4'));var moment=require(_0x89d8('0x5'));var BPromise=require(_0x89d8('0x6'));var Mustache=require(_0x89d8('0x7'));var util=require('util');var path=require(_0x89d8('0x8'));var sox=require('sox');var csv=require(_0x89d8('0x9'));var ejs=require(_0x89d8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x89d8('0xb'));var crypto=require(_0x89d8('0xc'));var jsforce=require(_0x89d8('0xd'));var deskjs=require(_0x89d8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x89d8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x89d8('0x10'));var qs=require(_0x89d8('0x11'));var as=require(_0x89d8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x89d8('0x13'))(_0x89d8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x89d8('0x15')](config[_0x89d8('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x89d8('0x17'))(new Redis(config[_0x89d8('0x16')]));require(_0x89d8('0x18'))[_0x89d8('0x19')](socket);function respondWithStatusCode(_0x379d8e,_0x3e7148){_0x3e7148=_0x3e7148||0xcc;return function(_0x23c924){if(_0x23c924){return _0x379d8e['sendStatus'](_0x3e7148);}return _0x379d8e[_0x89d8('0x1a')](_0x3e7148)[_0x89d8('0x1b')]();};}function respondWithResult(_0x18014e,_0x191314){_0x191314=_0x191314||0xc8;return function(_0x572eec){if(_0x572eec){return _0x18014e[_0x89d8('0x1a')](_0x191314)[_0x89d8('0x1c')](_0x572eec);}};}function respondWithFilteredResult(_0x5ad967,_0x48bba8){return function(_0x2df70c){if(_0x2df70c){var _0x58abf1=_0x2df70c['count'],_0x485bfc=_0x48bba8[_0x89d8('0x1d')],_0x477393=_0x48bba8[_0x89d8('0x1d')]+_0x48bba8['limit'],_0xb94895;if(_0x477393>=_0x58abf1){_0x477393=_0x58abf1;_0xb94895=0xc8;}else{_0xb94895=0xce;}_0x5ad967[_0x89d8('0x1a')](_0xb94895);return _0x5ad967['set']('Content-Range',_0x485bfc+'-'+_0x477393+'/'+_0x58abf1)['json'](_0x2df70c);}return null;};}function patchUpdates(_0x4cb8fb){return function(_0x4564b6){try{jsonpatch['apply'](_0x4564b6,_0x4cb8fb,!![]);}catch(_0x351507){return BPromise[_0x89d8('0x1e')](_0x351507);}return _0x4564b6[_0x89d8('0x1f')]();};}function saveUpdates(_0x1c5004,_0x52dc1d){return function(_0x5ec29c){if(_0x5ec29c){return _0x5ec29c[_0x89d8('0x20')](_0x1c5004)[_0x89d8('0x21')](function(_0x48ff43){return _0x48ff43;});}return null;};}function removeEntity(_0x2a9263,_0x4ac73e){return function(_0x56bd8a){if(_0x56bd8a){return _0x56bd8a['destroy']()['then'](function(){var _0x1fa0c6=_0x56bd8a['get']({'plain':!![]});var _0x47dfec=_0x89d8('0x22');return db[_0x89d8('0x23')][_0x89d8('0x24')]({'where':{'type':_0x47dfec,'resourceId':_0x1fa0c6['id']}})[_0x89d8('0x21')](function(){return _0x56bd8a;});})[_0x89d8('0x21')](function(){_0x2a9263[_0x89d8('0x1a')](0xcc)[_0x89d8('0x1b')]();});}};}function handleEntityNotFound(_0x559f83,_0x3ca854){return function(_0x53fa54){if(!_0x53fa54){_0x559f83[_0x89d8('0x25')](0x194);}return _0x53fa54;};}function handleError(_0x326fed,_0x572ea3){_0x572ea3=_0x572ea3||0x1f4;return function(_0x45f79c){logger['error'](_0x45f79c[_0x89d8('0x26')]);if(_0x45f79c[_0x89d8('0x27')]){delete _0x45f79c[_0x89d8('0x27')];}_0x326fed[_0x89d8('0x1a')](_0x572ea3)['send'](_0x45f79c);};}exports[_0x89d8('0x28')]=function(_0x103216,_0x368036){var _0x2bd3b2={},_0x122e70={},_0x414baf={'count':0x0,'rows':[]};var _0x5bf68d=_['map'](db[_0x89d8('0x29')][_0x89d8('0x2a')],function(_0x18c735){return{'name':_0x18c735['fieldName'],'type':_0x18c735[_0x89d8('0x2b')]['key']};});_0x122e70['model']=_[_0x89d8('0x2c')](_0x5bf68d,_0x89d8('0x27'));_0x122e70[_0x89d8('0x2d')]=_['keys'](_0x103216[_0x89d8('0x2d')]);_0x122e70['filters']=_[_0x89d8('0x2e')](_0x122e70['model'],_0x122e70[_0x89d8('0x2d')]);_0x2bd3b2[_0x89d8('0x2f')]=_[_0x89d8('0x2e')](_0x122e70[_0x89d8('0x30')],qs[_0x89d8('0x31')](_0x103216[_0x89d8('0x2d')][_0x89d8('0x31')]));_0x2bd3b2['attributes']=_0x2bd3b2[_0x89d8('0x2f')][_0x89d8('0x32')]?_0x2bd3b2[_0x89d8('0x2f')]:_0x122e70[_0x89d8('0x30')];if(!_0x103216[_0x89d8('0x2d')][_0x89d8('0x33')](_0x89d8('0x34'))){_0x2bd3b2[_0x89d8('0x35')]=qs[_0x89d8('0x35')](_0x103216[_0x89d8('0x2d')][_0x89d8('0x35')]);_0x2bd3b2['offset']=qs[_0x89d8('0x1d')](_0x103216[_0x89d8('0x2d')]['offset']);}_0x2bd3b2['order']=qs[_0x89d8('0x36')](_0x103216[_0x89d8('0x2d')][_0x89d8('0x36')]);_0x2bd3b2[_0x89d8('0x37')]=qs[_0x89d8('0x38')](_[_0x89d8('0x39')](_0x103216[_0x89d8('0x2d')],_0x122e70['filters']),_0x5bf68d);if(_0x103216[_0x89d8('0x2d')][_0x89d8('0x3a')]){_0x2bd3b2[_0x89d8('0x37')]=_[_0x89d8('0x3b')](_0x2bd3b2[_0x89d8('0x37')],{'$or':_[_0x89d8('0x2c')](_0x5bf68d,function(_0x24e0de){if(_0x24e0de[_0x89d8('0x2b')]!==_0x89d8('0x3c')){var _0x2369ed={};_0x2369ed[_0x24e0de[_0x89d8('0x27')]]={'$like':'%'+_0x103216['query']['filter']+'%'};return _0x2369ed;}})});}_0x2bd3b2=_[_0x89d8('0x3b')]({},_0x2bd3b2,_0x103216[_0x89d8('0x3d')]);var _0x4fcee8={'where':_0x2bd3b2['where']};return db[_0x89d8('0x29')][_0x89d8('0x3e')](_0x4fcee8)[_0x89d8('0x21')](function(_0x4a75a1){_0x414baf[_0x89d8('0x3e')]=_0x4a75a1;if(_0x103216[_0x89d8('0x2d')][_0x89d8('0x3f')]){_0x2bd3b2[_0x89d8('0x40')]=[{'all':!![]}];}return db[_0x89d8('0x29')][_0x89d8('0x41')](_0x2bd3b2);})[_0x89d8('0x21')](function(_0x4b2ba6){_0x414baf[_0x89d8('0x42')]=_0x4b2ba6;return _0x414baf;})['then'](respondWithFilteredResult(_0x368036,_0x2bd3b2))[_0x89d8('0x43')](handleError(_0x368036,null));};exports['show']=function(_0xb07839,_0x5738d8){var _0x2adc8b={'raw':!![],'where':{'id':_0xb07839[_0x89d8('0x44')]['id']}},_0x34f7a1={};_0x34f7a1['model']=_[_0x89d8('0x45')](db[_0x89d8('0x29')][_0x89d8('0x2a')]);_0x34f7a1[_0x89d8('0x2d')]=_[_0x89d8('0x45')](_0xb07839[_0x89d8('0x2d')]);_0x34f7a1[_0x89d8('0x38')]=_[_0x89d8('0x2e')](_0x34f7a1[_0x89d8('0x30')],_0x34f7a1['query']);_0x2adc8b['attributes']=_[_0x89d8('0x2e')](_0x34f7a1[_0x89d8('0x30')],qs[_0x89d8('0x31')](_0xb07839['query']['fields']));_0x2adc8b[_0x89d8('0x2f')]=_0x2adc8b[_0x89d8('0x2f')]['length']?_0x2adc8b['attributes']:_0x34f7a1[_0x89d8('0x30')];if(_0xb07839[_0x89d8('0x2d')][_0x89d8('0x3f')]){_0x2adc8b[_0x89d8('0x40')]=[{'all':!![]}];}_0x2adc8b=_[_0x89d8('0x3b')]({},_0x2adc8b,_0xb07839[_0x89d8('0x3d')]);return db[_0x89d8('0x29')]['find'](_0x2adc8b)[_0x89d8('0x21')](handleEntityNotFound(_0x5738d8,null))[_0x89d8('0x21')](respondWithResult(_0x5738d8,null))[_0x89d8('0x43')](handleError(_0x5738d8,null));};exports['create']=function(_0x25474f,_0x3e1cad){return db[_0x89d8('0x29')][_0x89d8('0x46')](_0x25474f[_0x89d8('0x47')],{})[_0x89d8('0x21')](function(_0x482ced){var _0x2d6f67=_0x25474f['user']['get']({'plain':!![]});if(!_0x2d6f67)throw new Error(_0x89d8('0x48'));if(_0x2d6f67[_0x89d8('0x49')]==='user'){var _0x21b2e4=_0x482ced[_0x89d8('0x4a')]({'plain':!![]});var _0x47a4d6=_0x89d8('0x22');return db['UserProfileSection'][_0x89d8('0x4b')]({'where':{'name':_0x47a4d6,'userProfileId':_0x2d6f67[_0x89d8('0x4c')]},'raw':!![]})[_0x89d8('0x21')](function(_0x2e1014){if(_0x2e1014&&_0x2e1014[_0x89d8('0x4d')]===0x0){return db[_0x89d8('0x23')][_0x89d8('0x46')]({'name':_0x21b2e4['name'],'resourceId':_0x21b2e4['id'],'type':_0x2e1014[_0x89d8('0x27')],'sectionId':_0x2e1014['id']},{})['then'](function(){return _0x482ced;});}else{return _0x482ced;}})[_0x89d8('0x43')](function(_0x2691cf){logger['error'](_0x89d8('0x4e'),_0x2691cf);throw _0x2691cf;});}return _0x482ced;})[_0x89d8('0x21')](respondWithResult(_0x3e1cad,0xc9))[_0x89d8('0x43')](handleError(_0x3e1cad,null));};exports['update']=function(_0x28eabb,_0x566649){if(_0x28eabb[_0x89d8('0x47')]['id']){delete _0x28eabb[_0x89d8('0x47')]['id'];}return db[_0x89d8('0x29')][_0x89d8('0x4b')]({'where':{'id':_0x28eabb['params']['id']}})[_0x89d8('0x21')](handleEntityNotFound(_0x566649,null))[_0x89d8('0x21')](saveUpdates(_0x28eabb[_0x89d8('0x47')],null))['then'](respondWithResult(_0x566649,null))['catch'](handleError(_0x566649,null));};exports[_0x89d8('0x24')]=function(_0x221b9c,_0x17107a){return db['FaxQueue'][_0x89d8('0x4b')]({'where':{'id':_0x221b9c[_0x89d8('0x44')]['id']}})[_0x89d8('0x21')](handleEntityNotFound(_0x17107a,null))[_0x89d8('0x21')](removeEntity(_0x17107a,null))[_0x89d8('0x43')](handleError(_0x17107a,null));};exports['describe']=function(_0x59aa9c,_0x49e043){return db[_0x89d8('0x29')][_0x89d8('0x4f')]()[_0x89d8('0x21')](respondWithResult(_0x49e043,null))[_0x89d8('0x43')](handleError(_0x49e043,null));};exports[_0x89d8('0x50')]=function(_0x2ebd67,_0x3ea636,_0x21410b){var _0x4ff91d={'raw':!![],'where':{}},_0x22557f={},_0x1607b3;return db['FaxQueue'][_0x89d8('0x51')]({'where':{'id':_0x2ebd67['params']['id']}})[_0x89d8('0x21')](handleEntityNotFound(_0x3ea636,null))[_0x89d8('0x21')](function(_0x3e9271){if(_0x3e9271){_0x1607b3=_0x3e9271[_0x89d8('0x4a')]({'plain':!![]});_0x22557f[_0x89d8('0x30')]=_[_0x89d8('0x45')](db[_0x89d8('0x52')][_0x89d8('0x2a')]);_0x22557f['query']=_[_0x89d8('0x45')](_0x2ebd67[_0x89d8('0x2d')]);_0x22557f[_0x89d8('0x38')]=_[_0x89d8('0x2e')](_0x22557f['model'],_0x22557f[_0x89d8('0x2d')]);_0x4ff91d[_0x89d8('0x2f')]=_['intersection'](_0x22557f[_0x89d8('0x30')],qs[_0x89d8('0x31')](_0x2ebd67[_0x89d8('0x2d')][_0x89d8('0x31')]));_0x4ff91d[_0x89d8('0x2f')]=_0x4ff91d[_0x89d8('0x2f')][_0x89d8('0x32')]?_0x4ff91d[_0x89d8('0x2f')]:_0x22557f[_0x89d8('0x30')];if(!_0x2ebd67['query'][_0x89d8('0x33')]('nolimit')){_0x4ff91d[_0x89d8('0x35')]=qs[_0x89d8('0x35')](_0x2ebd67['query']['limit']);_0x4ff91d[_0x89d8('0x1d')]=qs['offset'](_0x2ebd67['query']['offset']);}_0x4ff91d[_0x89d8('0x53')]=qs[_0x89d8('0x36')](_0x2ebd67[_0x89d8('0x2d')][_0x89d8('0x36')]);_0x4ff91d[_0x89d8('0x37')]=qs[_0x89d8('0x38')](_[_0x89d8('0x39')](_0x2ebd67[_0x89d8('0x2d')],_0x22557f[_0x89d8('0x38')]));_0x4ff91d[_0x89d8('0x37')]['FaxQueueId']=_0x3e9271['id'];if(_0x2ebd67[_0x89d8('0x2d')]['filter']){_0x4ff91d[_0x89d8('0x37')]=_[_0x89d8('0x3b')](_0x4ff91d['where'],{'$or':_['map'](_0x4ff91d[_0x89d8('0x2f')],function(_0x25c6b7){var _0x2faa89={};_0x2faa89[_0x25c6b7]={'$like':'%'+_0x2ebd67[_0x89d8('0x2d')]['filter']+'%'};return _0x2faa89;})});}_0x4ff91d=_['merge']({},_0x4ff91d,_0x2ebd67['options']);return db[_0x89d8('0x52')][_0x89d8('0x41')](_0x4ff91d);}})[_0x89d8('0x21')](function(_0x273014){if(_0x273014){return db[_0x89d8('0x54')][_0x89d8('0x55')]({'where':{'id':_[_0x89d8('0x2c')](_0x273014,_0x89d8('0x56')),'role':_0x89d8('0x57')},'attributes':['id',_0x89d8('0x27'),_0x89d8('0x58'),'updatedAt','createdAt']});}})['then'](function(_0x3a76e1){if(_0x3a76e1){return{'count':_0x3a76e1[_0x89d8('0x3e')],'rows':_['map'](_0x3a76e1[_0x89d8('0x42')],function(_0x377190){return{'membername':_0x377190[_0x89d8('0x27')],'UserId':_0x377190['id'],'queue_name':_0x1607b3[_0x89d8('0x27')],'FaxQueueId':_0x1607b3['id'],'interface':util[_0x89d8('0x59')](_0x89d8('0x5a'),_0x89d8('0x5b'),_0x377190[_0x89d8('0x27')]),'penalty':0x0,'paused':_0x377190['faxPause'],'createdAt':_0x377190[_0x89d8('0x5c')],'updatedAt':_0x377190[_0x89d8('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x89d8('0x21')](respondWithFilteredResult(_0x3ea636,_0x4ff91d))[_0x89d8('0x43')](handleError(_0x3ea636,null));};exports['getTeams']=function(_0x584371,_0xc76287,_0x3e4bbb){var _0x532895={};var _0x3ecaf7={};var _0x4e7f55;var _0x1511d9;return db[_0x89d8('0x29')][_0x89d8('0x51')]({'where':{'id':_0x584371[_0x89d8('0x44')]['id']}})[_0x89d8('0x21')](handleEntityNotFound(_0xc76287,null))['then'](function(_0x3dfe13){if(_0x3dfe13){_0x4e7f55=_0x3dfe13;_0x3ecaf7['model']=_[_0x89d8('0x45')](db[_0x89d8('0x5e')][_0x89d8('0x2a')]);_0x3ecaf7[_0x89d8('0x2d')]=_['keys'](_0x584371['query']);_0x3ecaf7[_0x89d8('0x38')]=_[_0x89d8('0x2e')](_0x3ecaf7[_0x89d8('0x30')],_0x3ecaf7[_0x89d8('0x2d')]);_0x532895[_0x89d8('0x2f')]=_[_0x89d8('0x2e')](_0x3ecaf7['model'],qs[_0x89d8('0x31')](_0x584371[_0x89d8('0x2d')]['fields']));_0x532895[_0x89d8('0x2f')]=_0x532895[_0x89d8('0x2f')][_0x89d8('0x32')]?_0x532895[_0x89d8('0x2f')]:_0x3ecaf7[_0x89d8('0x30')];_0x532895['order']=qs['sort'](_0x584371['query'][_0x89d8('0x36')]);_0x532895[_0x89d8('0x37')]=qs['filters'](_['pick'](_0x584371[_0x89d8('0x2d')],_0x3ecaf7[_0x89d8('0x38')]));if(_0x584371[_0x89d8('0x2d')]['filter']){_0x532895[_0x89d8('0x37')]=_['merge'](_0x532895[_0x89d8('0x37')],{'$or':_['map'](_0x532895[_0x89d8('0x2f')],function(_0x5eebdb){var _0x4895a2={};_0x4895a2[_0x5eebdb]={'$like':'%'+_0x584371[_0x89d8('0x2d')][_0x89d8('0x3a')]+'%'};return _0x4895a2;})});}_0x532895=_['merge']({},_0x532895,_0x584371[_0x89d8('0x3d')]);return _0x4e7f55[_0x89d8('0x5f')](_0x532895);}})['then'](function(_0x43396e){if(_0x43396e){_0x1511d9=_0x43396e[_0x89d8('0x32')];if(!_0x584371[_0x89d8('0x2d')][_0x89d8('0x33')](_0x89d8('0x34'))){_0x532895[_0x89d8('0x35')]=qs['limit'](_0x584371[_0x89d8('0x2d')][_0x89d8('0x35')]);_0x532895[_0x89d8('0x1d')]=qs[_0x89d8('0x1d')](_0x584371[_0x89d8('0x2d')][_0x89d8('0x1d')]);}return _0x4e7f55[_0x89d8('0x5f')](_0x532895);}})[_0x89d8('0x21')](function(_0x193545){if(_0x193545){return _0x193545?{'count':_0x1511d9,'rows':_0x193545}:null;}})['then'](respondWithResult(_0xc76287,null))['catch'](handleError(_0xc76287,null));};exports[_0x89d8('0x60')]=function(_0x483adc,_0x4f6291,_0x4a42fd){var _0x11a1e4=_0x483adc[_0x89d8('0x47')]['ids'];return db[_0x89d8('0x5e')][_0x89d8('0x41')]({'where':{'id':_0x11a1e4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x89d8('0x61'),'attributes':['id',_0x89d8('0x27'),_0x89d8('0x62'),'voicePause','interface'],'raw':!![]}]})[_0x89d8('0x21')](function(_0x2d43a1){if(_0x2d43a1){var _0x2e9e40=_[_0x89d8('0x63')](_0x2d43a1,function(_0x3eb538){var _0x612b4e=_0x3eb538[_0x89d8('0x4a')]({'plain':!![]});return _0x612b4e[_0x89d8('0x61')];});return db['FaxQueue'][_0x89d8('0x4b')]({'where':{'id':_0x483adc['params']['id']}})[_0x89d8('0x21')](function(_0x1ed781){return db[_0x89d8('0x64')][_0x89d8('0x65')](function(_0x5a4c46){return _0x1ed781[_0x89d8('0x60')](_0x11a1e4,{'transaction':_0x5a4c46})[_0x89d8('0x21')](function(){return BPromise[_0x89d8('0x66')](_0x2e9e40,function(_0x23769a){return db[_0x89d8('0x52')][_0x89d8('0x67')]({'where':{'UserId':_0x23769a['id'],'FaxQueueId':_0x483adc[_0x89d8('0x44')]['id']},'transaction':_0x5a4c46});});})[_0x89d8('0x21')](function(){_0x2e9e40[_0x89d8('0x68')](function(_0x13208d){socket['emit'](_0x89d8('0x69'),{'UserId':_0x13208d['id'],'FaxQueueId':_0x1ed781['id']});});});});});}})[_0x89d8('0x21')](respondWithStatusCode(_0x4f6291,null))[_0x89d8('0x43')](handleError(_0x4f6291,null));};exports[_0x89d8('0x6a')]=function(_0x13298b,_0x30ac27,_0x1f83db){return db[_0x89d8('0x5e')]['findAll']({'where':{'id':_0x13298b['query'][_0x89d8('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x89d8('0x54')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30ac27,null))[_0x89d8('0x21')](function(_0x446826){var _0x5c585b=_[_0x89d8('0x2c')](_0x446826,'id');var _0x20bd4e=[];var _0x9c7cca=[];var _0x5495a4=squel[_0x89d8('0x6c')]();_0x5495a4[_0x89d8('0x6d')]('tq.TeamId')[_0x89d8('0x6e')](_0x89d8('0x6f'),'tq')[_0x89d8('0x70')](_0x89d8('0x71'),'ut',_0x89d8('0x72'))[_0x89d8('0x37')]('FaxQueueId\x20=\x20?',_0x13298b[_0x89d8('0x44')]['id']);for(var _0x169464=0x0;_0x169464<_0x446826['length'];_0x169464+=0x1){let _0x435bbe=_0x446826[_0x169464];for(var _0x3e89c5=0x0;_0x3e89c5<_0x435bbe[_0x89d8('0x61')][_0x89d8('0x32')];_0x3e89c5+=0x1){let _0x3e095d=_0x435bbe['Agents'][_0x3e89c5];var _0x4df4b7=_0x5495a4['clone']();_0x4df4b7['where'](_0x89d8('0x73'),_0x3e095d['id']);_0x9c7cca[_0x89d8('0x74')](db[_0x89d8('0x64')][_0x89d8('0x2d')](_0x4df4b7[_0x89d8('0x75')](),{'type':db[_0x89d8('0x64')][_0x89d8('0x76')]['SELECT']})[_0x89d8('0x21')](function(_0x491a1e){if(_0x491a1e[_0x89d8('0x32')]===0x1){return _0x3e095d['id'];}else{var _0x4a5c7b=_['every'](_[_0x89d8('0x2c')](_0x491a1e,_0x89d8('0x77')),function(_0x4e189f){return _[_0x89d8('0x78')](_0x5c585b,_0x4e189f);});if(_0x4a5c7b){return _0x3e095d['id'];}}}));}}return BPromise[_0x89d8('0x79')](_0x9c7cca)[_0x89d8('0x21')](function(_0x1e3da1){_0x20bd4e=_(_0x20bd4e)[_0x89d8('0x7a')](_0x1e3da1)[_0x89d8('0x7b')]()[_0x89d8('0x7c')]();return db['FaxQueue'][_0x89d8('0x4b')]({'where':{'id':_0x13298b['params']['id']}})[_0x89d8('0x21')](function(_0x41fc1e){return db['sequelize']['transaction'](function(_0xf54529){return _0x41fc1e['removeTeams'](_0x13298b[_0x89d8('0x2d')][_0x89d8('0x6b')],{'transaction':_0xf54529})[_0x89d8('0x21')](function(){if(!_['isEmpty'](_0x20bd4e)){return _0x41fc1e[_0x89d8('0x7d')](_0x20bd4e,{'transaction':_0xf54529});}})[_0x89d8('0x21')](function(){_0x20bd4e[_0x89d8('0x68')](function(_0x292c43){socket[_0x89d8('0x7e')]('userFaxQueue:remove',{'UserId':_0x292c43,'FaxQueueId':_0x41fc1e['id']});});});});});});})['then'](respondWithStatusCode(_0x30ac27,null))['catch'](handleError(_0x30ac27,null));};exports['addAgents']=function(_0x1b3fe0,_0x261eda,_0x1e317b){return db[_0x89d8('0x29')]['find']({'where':{'id':_0x1b3fe0[_0x89d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x261eda,null))[_0x89d8('0x21')](function(_0x1d257f){if(_0x1d257f){return _0x1d257f[_0x89d8('0x7f')](_0x1b3fe0[_0x89d8('0x47')][_0x89d8('0x6b')],_[_0x89d8('0x80')](_0x1b3fe0[_0x89d8('0x47')],[_0x89d8('0x6b'),'id'])||{})[_0x89d8('0x81')](function(_0x35105b){for(var _0x99a068=0x0;_0x99a068<_0x1b3fe0[_0x89d8('0x47')]['ids'][_0x89d8('0x32')];_0x99a068+=0x1){socket[_0x89d8('0x7e')](_0x89d8('0x69'),{'UserId':_0x1b3fe0[_0x89d8('0x47')][_0x89d8('0x6b')][_0x99a068],'FaxQueueId':_0x1b3fe0['params']['id']});}return _0x35105b;});}})['then'](respondWithResult(_0x261eda,null))[_0x89d8('0x43')](handleError(_0x261eda,null));};exports['removeAgents']=function(_0x7f0579,_0x1179c4,_0xe63a03){return db[_0x89d8('0x29')]['find']({'where':{'id':_0x7f0579[_0x89d8('0x44')]['id']}})['then'](handleEntityNotFound(_0x1179c4,null))[_0x89d8('0x21')](function(_0x3f65ed){if(_0x3f65ed){return _0x3f65ed[_0x89d8('0x7d')](_0x7f0579[_0x89d8('0x2d')][_0x89d8('0x6b')])['then'](function(){if(_[_0x89d8('0x82')](_0x7f0579[_0x89d8('0x2d')]['ids'])){for(var _0x54cc51=0x0;_0x54cc51<_0x7f0579[_0x89d8('0x2d')][_0x89d8('0x6b')][_0x89d8('0x32')];_0x54cc51+=0x1){socket['emit'](_0x89d8('0x83'),{'UserId':Number(_0x7f0579[_0x89d8('0x2d')][_0x89d8('0x6b')][_0x54cc51]),'FaxQueueId':Number(_0x7f0579['params']['id'])});}}else{socket[_0x89d8('0x7e')](_0x89d8('0x83'),{'UserId':Number(_0x7f0579['query'][_0x89d8('0x6b')]),'FaxQueueId':Number(_0x7f0579[_0x89d8('0x44')]['id'])});}});}})[_0x89d8('0x21')](respondWithStatusCode(_0x1179c4,null))[_0x89d8('0x43')](handleError(_0x1179c4,null));};exports[_0x89d8('0x84')]=function(_0x3b8c68,_0x4d1492,_0x3de9e0){var _0x183135={};var _0x2c2795={};var _0x3d572b;var _0x2fd370;return db['FaxQueue'][_0x89d8('0x51')]({'where':{'id':_0x3b8c68['params']['id']}})[_0x89d8('0x21')](handleEntityNotFound(_0x4d1492,null))[_0x89d8('0x21')](function(_0x5845f){if(_0x5845f){_0x3d572b=_0x5845f;_0x2c2795[_0x89d8('0x30')]=_[_0x89d8('0x45')](db[_0x89d8('0x54')]['rawAttributes']);_0x2c2795[_0x89d8('0x2d')]=_['keys'](_0x3b8c68[_0x89d8('0x2d')]);_0x2c2795[_0x89d8('0x38')]=_['intersection'](_0x2c2795[_0x89d8('0x30')],_0x2c2795[_0x89d8('0x2d')]);_0x183135[_0x89d8('0x2f')]=_[_0x89d8('0x2e')](_0x2c2795[_0x89d8('0x30')],qs[_0x89d8('0x31')](_0x3b8c68[_0x89d8('0x2d')][_0x89d8('0x31')]));_0x183135[_0x89d8('0x2f')]=_0x183135[_0x89d8('0x2f')][_0x89d8('0x32')]?_0x183135[_0x89d8('0x2f')]:_0x2c2795[_0x89d8('0x30')];_0x183135[_0x89d8('0x53')]=qs[_0x89d8('0x36')](_0x3b8c68[_0x89d8('0x2d')]['sort']);_0x183135[_0x89d8('0x37')]=qs['filters'](_[_0x89d8('0x39')](_0x3b8c68[_0x89d8('0x2d')],_0x2c2795[_0x89d8('0x38')]));if(_0x3b8c68[_0x89d8('0x2d')]['filter']){_0x183135[_0x89d8('0x37')]=_['merge'](_0x183135[_0x89d8('0x37')],{'$or':_[_0x89d8('0x2c')](_0x183135['attributes'],function(_0xbcf8e3){var _0x126456={};_0x126456[_0xbcf8e3]={'$like':'%'+_0x3b8c68['query'][_0x89d8('0x3a')]+'%'};return _0x126456;})});}_0x183135=_[_0x89d8('0x3b')]({},_0x183135,_0x3b8c68['options']);return _0x3d572b[_0x89d8('0x84')](_0x183135);}})[_0x89d8('0x21')](function(_0x4ed8c7){if(_0x4ed8c7){_0x2fd370=_0x4ed8c7[_0x89d8('0x32')];if(!_0x3b8c68[_0x89d8('0x2d')][_0x89d8('0x33')](_0x89d8('0x34'))){_0x183135[_0x89d8('0x35')]=qs[_0x89d8('0x35')](_0x3b8c68[_0x89d8('0x2d')][_0x89d8('0x35')]);_0x183135[_0x89d8('0x1d')]=qs[_0x89d8('0x1d')](_0x3b8c68['query'][_0x89d8('0x1d')]);}return _0x3d572b[_0x89d8('0x84')](_0x183135);}})['then'](function(_0x7be107){if(_0x7be107){return _0x7be107?{'count':_0x2fd370,'rows':_0x7be107}:null;}})[_0x89d8('0x21')](respondWithResult(_0x4d1492,null))[_0x89d8('0x43')](handleError(_0x4d1492,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 7f462d6..1eb1d1a 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 _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 +var _0xb16d=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','exports'];(function(_0x4c9bfd,_0x48b00f){var _0x1ce276=function(_0x13268e){while(--_0x13268e){_0x4c9bfd['push'](_0x4c9bfd['shift']());}};_0x1ce276(++_0x48b00f);}(_0xb16d,0x8c));var _0xdb16=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb16d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xdb16('0x0'))['db'][_0xdb16('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xdb16('0x2')](0x0);var events={'afterCreate':_0xdb16('0x3'),'afterUpdate':_0xdb16('0x4'),'afterDestroy':_0xdb16('0x5')};function emitEvent(_0x4e3477){return function(_0x4f063f,_0x3a913c,_0x583ade){FaxQueueEvents['emit'](_0x4e3477+':'+_0x4f063f['id'],_0x4f063f);FaxQueueEvents['emit'](_0x4e3477,_0x4f063f);_0x583ade(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xdb16('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4ad1637..b7c89cd 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 _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 +var _0xccc6=['FaxQueue','lodash','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0xccc6,0x199));var _0x6ccc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xccc6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6ccc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ccc('0x1'));var moment=require(_0x6ccc('0x2'));var BPromise=require(_0x6ccc('0x3'));var rp=require(_0x6ccc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6ccc('0x5'));var attributes=require('./faxQueue.attributes');module[_0x6ccc('0x6')]=function(_0xd9ac50,_0xecb180){return _0xd9ac50['define'](_0x6ccc('0x7'),attributes,{'tableName':'fax_queues','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 9f3ac0c..8cd2f9f 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 _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 +var _0x3e53=['options','raw','where','limit','include','model','attributes','map','ShowFaxQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','debug','request\x20sent','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','catch','GetFaxQueue','FaxQueue','findAll'];(function(_0xfe8780,_0x3cd99d){var _0x185976=function(_0x22295f){while(--_0x22295f){_0xfe8780['push'](_0xfe8780['shift']());}};_0x185976(++_0x3cd99d);}(_0x3e53,0x7e));var _0x33e5=function(_0x490a87,_0xa0e6c2){_0x490a87=_0x490a87-0x0;var _0x3953f0=_0x3e53[_0x490a87];return _0x3953f0;};'use strict';var _=require('lodash');var util=require(_0x33e5('0x0'));var moment=require(_0x33e5('0x1'));var BPromise=require(_0x33e5('0x2'));var rs=require(_0x33e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x33e5('0x4'));var logger=require(_0x33e5('0x5'))(_0x33e5('0x6'));var config=require(_0x33e5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x33e5('0x8')][_0x33e5('0x9')]({'port':0x232a});config[_0x33e5('0xa')]=_[_0x33e5('0xb')](config[_0x33e5('0xa')],{'host':_0x33e5('0xc'),'port':0x18eb});var socket=require(_0x33e5('0xd'))(new Redis(config['redis']));require(_0x33e5('0xe'))[_0x33e5('0xf')](socket);function respondWithRpcPromise(_0x4c6644,_0x5c73f9,_0x42d370){return new BPromise(function(_0x107993,_0x56ac42){return client[_0x33e5('0x10')](_0x4c6644,_0x42d370)[_0x33e5('0x11')](function(_0x336840){logger['info']('FaxQueue,\x20%s,\x20%s',_0x5c73f9,'request\x20sent');logger[_0x33e5('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x5c73f9,_0x33e5('0x13'),JSON[_0x33e5('0x14')](_0x336840));if(_0x336840['error']){if(_0x336840[_0x33e5('0x15')][_0x33e5('0x16')]===0x1f4){logger[_0x33e5('0x15')](_0x33e5('0x17'),_0x5c73f9,_0x336840[_0x33e5('0x15')]['message']);return _0x56ac42(_0x336840['error']['message']);}logger[_0x33e5('0x15')]('FaxQueue,\x20%s,\x20%s',_0x5c73f9,_0x336840[_0x33e5('0x15')][_0x33e5('0x18')]);return _0x107993(_0x336840[_0x33e5('0x15')]['message']);}else{logger[_0x33e5('0x19')]('FaxQueue,\x20%s,\x20%s',_0x5c73f9,_0x33e5('0x13'));_0x107993(_0x336840['result'][_0x33e5('0x18')]);}})[_0x33e5('0x1a')](function(_0x29959f){logger[_0x33e5('0x15')](_0x33e5('0x17'),_0x5c73f9,_0x29959f);_0x56ac42(_0x29959f);});});}exports[_0x33e5('0x1b')]=function(_0x100c5e){var _0x1a515c=this;return new Promise(function(_0x545639,_0x166b0f){return db[_0x33e5('0x1c')][_0x33e5('0x1d')]({'raw':_0x100c5e[_0x33e5('0x1e')]?_0x100c5e['options'][_0x33e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x100c5e[_0x33e5('0x1e')]?_0x100c5e['options'][_0x33e5('0x20')]||null:null,'attributes':_0x100c5e[_0x33e5('0x1e')]?_0x100c5e['options']['attributes']||null:null,'limit':_0x100c5e['options']?_0x100c5e[_0x33e5('0x1e')][_0x33e5('0x21')]||null:null,'include':_0x100c5e[_0x33e5('0x1e')]?_0x100c5e['options'][_0x33e5('0x22')]?_['map'](_0x100c5e[_0x33e5('0x1e')][_0x33e5('0x22')],function(_0x2e8505){return{'model':db[_0x2e8505[_0x33e5('0x23')]],'as':_0x2e8505['as'],'attributes':_0x2e8505[_0x33e5('0x24')],'include':_0x2e8505[_0x33e5('0x22')]?_[_0x33e5('0x25')](_0x2e8505[_0x33e5('0x22')],function(_0x356633){return{'model':db[_0x356633[_0x33e5('0x23')]],'as':_0x356633['as'],'attributes':_0x356633['attributes'],'include':_0x356633[_0x33e5('0x22')]?_[_0x33e5('0x25')](_0x356633['include'],function(_0x1d42cf){return{'model':db[_0x1d42cf[_0x33e5('0x23')]],'as':_0x1d42cf['as'],'attributes':_0x1d42cf[_0x33e5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x33e5('0x11')](function(_0x4d7d1b){logger['info']('GetFaxQueue',_0x100c5e);logger[_0x33e5('0x12')](_0x33e5('0x1b'),_0x100c5e,JSON[_0x33e5('0x14')](_0x4d7d1b));_0x545639(_0x4d7d1b);})[_0x33e5('0x1a')](function(_0xb7e38a){logger[_0x33e5('0x15')](_0x33e5('0x1b'),_0xb7e38a['message'],_0x100c5e);_0x166b0f(_0x1a515c[_0x33e5('0x15')](0x1f4,_0xb7e38a[_0x33e5('0x18')]));});});};exports[_0x33e5('0x26')]=function(_0x293428){var _0x4dcbe4=this;return new Promise(function(_0x395e43,_0x5b4e24){return db[_0x33e5('0x1c')]['find']({'raw':_0x293428[_0x33e5('0x1e')]?_0x293428[_0x33e5('0x1e')][_0x33e5('0x1f')]===undefined?!![]:![]:!![],'where':_0x293428['options']?_0x293428['options'][_0x33e5('0x20')]||null:null,'attributes':_0x293428['options']?_0x293428[_0x33e5('0x1e')]['attributes']||null:null,'include':_0x293428[_0x33e5('0x1e')]?_0x293428['options'][_0x33e5('0x22')]?_[_0x33e5('0x25')](_0x293428[_0x33e5('0x1e')][_0x33e5('0x22')],function(_0x30f933){return{'model':db[_0x30f933[_0x33e5('0x23')]],'as':_0x30f933['as'],'attributes':_0x30f933[_0x33e5('0x24')],'include':_0x30f933[_0x33e5('0x22')]?_[_0x33e5('0x25')](_0x30f933[_0x33e5('0x22')],function(_0x5a58a2){return{'model':db[_0x5a58a2[_0x33e5('0x23')]],'as':_0x5a58a2['as'],'attributes':_0x5a58a2[_0x33e5('0x24')],'include':_0x5a58a2[_0x33e5('0x22')]?_[_0x33e5('0x25')](_0x5a58a2[_0x33e5('0x22')],function(_0x2e1744){return{'model':db[_0x2e1744[_0x33e5('0x23')]],'as':_0x2e1744['as'],'attributes':_0x2e1744[_0x33e5('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40e6e9){logger['info'](_0x33e5('0x26'),_0x293428);logger[_0x33e5('0x12')](_0x33e5('0x26'),_0x293428,JSON['stringify'](_0x40e6e9));_0x395e43(_0x40e6e9);})[_0x33e5('0x1a')](function(_0x49233b){logger[_0x33e5('0x15')](_0x33e5('0x26'),_0x49233b[_0x33e5('0x18')],_0x293428);_0x5b4e24(_0x4dcbe4['error'](0x1f4,_0x49233b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 5c7b3be..761bc5e 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 _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 +var _0xb1ae=['length','save','remove','update','emit','removeListener','register'];(function(_0xe9a121,_0x1badac){var _0x276967=function(_0x3d8bc6){while(--_0x3d8bc6){_0xe9a121['push'](_0xe9a121['shift']());}};_0x276967(++_0x1badac);}(_0xb1ae,0x190));var _0xeb1a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb1ae[_0x20a584];return _0x4b41a8;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xeb1a('0x0'),_0xeb1a('0x1'),_0xeb1a('0x2')];function createListener(_0x6ff101,_0x41b8e6){return function(_0x24bb73){_0x41b8e6[_0xeb1a('0x3')](_0x6ff101,_0x24bb73);};}function removeListener(_0x4e25dd,_0xeb52d7){return function(){FaxQueueEvents[_0xeb1a('0x4')](_0x4e25dd,_0xeb52d7);};}exports[_0xeb1a('0x5')]=function(_0x52b385){for(var _0x155066=0x0,_0x9af02e=events[_0xeb1a('0x6')];_0x155066<_0x9af02e;_0x155066++){var _0x63c254=events[_0x155066];var _0x1cb17a=createListener('faxQueue:'+_0x63c254,_0x52b385);FaxQueueEvents['on'](_0x63c254,_0x1cb17a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 374510e..c1f3cc7 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_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 +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(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x0b0e,0x187));var _0xe0b0=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x0b0e[_0x456fb1];return _0x4083d6;};'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 bd8340e..ec46b7e 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 _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 +var _0x711d=['exports','STRING','DATE','moment','sequelize'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0x711d,0xa8));var _0xd711=function(_0x4a0b48,_0x2e8241){_0x4a0b48=_0x4a0b48-0x0;var _0xb75ae6=_0x711d[_0x4a0b48];return _0xb75ae6;};'use strict';var moment=require(_0xd711('0x0'));var Sequelize=require(_0xd711('0x1'));module[_0xd711('0x2')]={'uniqueid':{'type':Sequelize[_0xd711('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd711('0x4')]},'leaveAt':{'type':Sequelize[_0xd711('0x4')]},'acceptAt':{'type':Sequelize[_0xd711('0x4')]},'exitAt':{'type':Sequelize[_0xd711('0x4')]},'reason':{'type':Sequelize[_0xd711('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 84a8c05..c489567 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 _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 +var _0x5740=['update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','count','includeAll','include','findAll','show','params','length','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5740,0x114));var _0x0574=function(_0x5264c6,_0x5100e6){_0x5264c6=_0x5264c6-0x0;var _0x24230d=_0x5740[_0x5264c6];return _0x24230d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0574('0x0'));var rimraf=require(_0x0574('0x1'));var zipdir=require(_0x0574('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0574('0x3'));var moment=require(_0x0574('0x4'));var BPromise=require(_0x0574('0x5'));var Mustache=require(_0x0574('0x6'));var util=require('util');var path=require(_0x0574('0x7'));var sox=require(_0x0574('0x8'));var csv=require(_0x0574('0x9'));var ejs=require(_0x0574('0xa'));var fs=require('fs');var _=require(_0x0574('0xb'));var squel=require(_0x0574('0xc'));var crypto=require(_0x0574('0xd'));var jsforce=require(_0x0574('0xe'));var deskjs=require(_0x0574('0xf'));var toCsv=require(_0x0574('0x9'));var querystring=require(_0x0574('0x10'));var Papa=require(_0x0574('0x11'));var Redis=require(_0x0574('0x12'));var authService=require(_0x0574('0x13'));var qs=require(_0x0574('0x14'));var as=require(_0x0574('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0574('0x16'))('api');var utils=require(_0x0574('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0574('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428d6a,_0x27d910){_0x27d910=_0x27d910||0xcc;return function(_0x58ba2f){if(_0x58ba2f){return _0x428d6a[_0x0574('0x19')](_0x27d910);}return _0x428d6a[_0x0574('0x1a')](_0x27d910)[_0x0574('0x1b')]();};}function respondWithResult(_0x2a380a,_0x5e6069){_0x5e6069=_0x5e6069||0xc8;return function(_0x394e73){if(_0x394e73){return _0x2a380a['status'](_0x5e6069)[_0x0574('0x1c')](_0x394e73);}};}function respondWithFilteredResult(_0x2a6e4d,_0x20aafc){return function(_0x257f86){if(_0x257f86){var _0x18937d=_0x257f86['count'],_0x24bcf3=_0x20aafc[_0x0574('0x1d')],_0x3824b2=_0x20aafc[_0x0574('0x1d')]+_0x20aafc[_0x0574('0x1e')],_0x59637c;if(_0x3824b2>=_0x18937d){_0x3824b2=_0x18937d;_0x59637c=0xc8;}else{_0x59637c=0xce;}_0x2a6e4d['status'](_0x59637c);return _0x2a6e4d[_0x0574('0x1f')](_0x0574('0x20'),_0x24bcf3+'-'+_0x3824b2+'/'+_0x18937d)['json'](_0x257f86);}return null;};}function patchUpdates(_0x45a694){return function(_0x5d97e8){try{jsonpatch[_0x0574('0x21')](_0x5d97e8,_0x45a694,!![]);}catch(_0x1025b5){return BPromise[_0x0574('0x22')](_0x1025b5);}return _0x5d97e8[_0x0574('0x23')]();};}function saveUpdates(_0x48f5e4,_0x307cd8){return function(_0x51cb6f){if(_0x51cb6f){return _0x51cb6f[_0x0574('0x24')](_0x48f5e4)[_0x0574('0x25')](function(_0x323d3a){return _0x323d3a;});}return null;};}function removeEntity(_0x4caf98,_0x23f724){return function(_0x4161f3){if(_0x4161f3){return _0x4161f3['destroy']()[_0x0574('0x25')](function(){_0x4caf98[_0x0574('0x1a')](0xcc)[_0x0574('0x1b')]();});}};}function handleEntityNotFound(_0x388367,_0x22964a){return function(_0x29c20d){if(!_0x29c20d){_0x388367['sendStatus'](0x194);}return _0x29c20d;};}function handleError(_0x155d37,_0x4dfe3a){_0x4dfe3a=_0x4dfe3a||0x1f4;return function(_0x12e0be){logger[_0x0574('0x26')](_0x12e0be[_0x0574('0x27')]);if(_0x12e0be[_0x0574('0x28')]){delete _0x12e0be[_0x0574('0x28')];}_0x155d37[_0x0574('0x1a')](_0x4dfe3a)[_0x0574('0x29')](_0x12e0be);};}exports[_0x0574('0x2a')]=function(_0x4d67fb,_0x25c064){var _0x4819df={},_0x6a4b18={},_0x38419a={'count':0x0,'rows':[]};var _0xcd3c48=_[_0x0574('0x2b')](db['FaxQueueReport'][_0x0574('0x2c')],function(_0x394902){return{'name':_0x394902[_0x0574('0x2d')],'type':_0x394902[_0x0574('0x2e')][_0x0574('0x2f')]};});_0x6a4b18[_0x0574('0x30')]=_[_0x0574('0x2b')](_0xcd3c48,'name');_0x6a4b18[_0x0574('0x31')]=_[_0x0574('0x32')](_0x4d67fb[_0x0574('0x31')]);_0x6a4b18[_0x0574('0x33')]=_[_0x0574('0x34')](_0x6a4b18['model'],_0x6a4b18[_0x0574('0x31')]);_0x4819df['attributes']=_[_0x0574('0x34')](_0x6a4b18['model'],qs[_0x0574('0x35')](_0x4d67fb[_0x0574('0x31')][_0x0574('0x35')]));_0x4819df[_0x0574('0x36')]=_0x4819df[_0x0574('0x36')]['length']?_0x4819df['attributes']:_0x6a4b18['model'];if(!_0x4d67fb[_0x0574('0x31')][_0x0574('0x37')]('nolimit')){_0x4819df[_0x0574('0x1e')]=qs[_0x0574('0x1e')](_0x4d67fb['query'][_0x0574('0x1e')]);_0x4819df['offset']=qs[_0x0574('0x1d')](_0x4d67fb['query'][_0x0574('0x1d')]);}_0x4819df[_0x0574('0x38')]=qs[_0x0574('0x39')](_0x4d67fb[_0x0574('0x31')]['sort']);_0x4819df[_0x0574('0x3a')]=qs[_0x0574('0x33')](_[_0x0574('0x3b')](_0x4d67fb[_0x0574('0x31')],_0x6a4b18['filters']),_0xcd3c48);if(_0x4d67fb['query'][_0x0574('0x3c')]){_0x4819df[_0x0574('0x3a')]=_[_0x0574('0x3d')](_0x4819df[_0x0574('0x3a')],{'$or':_['map'](_0xcd3c48,function(_0x44778e){if(_0x44778e['type']!==_0x0574('0x3e')){var _0x14aa65={};_0x14aa65[_0x44778e[_0x0574('0x28')]]={'$like':'%'+_0x4d67fb[_0x0574('0x31')][_0x0574('0x3c')]+'%'};return _0x14aa65;}})});}_0x4819df=_['merge']({},_0x4819df,_0x4d67fb[_0x0574('0x3f')]);var _0xe1538d={'where':_0x4819df['where']};return db[_0x0574('0x40')]['count'](_0xe1538d)['then'](function(_0x2afa98){_0x38419a[_0x0574('0x41')]=_0x2afa98;if(_0x4d67fb['query'][_0x0574('0x42')]){_0x4819df[_0x0574('0x43')]=[{'all':!![]}];}return db[_0x0574('0x40')][_0x0574('0x44')](_0x4819df);})[_0x0574('0x25')](function(_0x16927b){_0x38419a['rows']=_0x16927b;return _0x38419a;})[_0x0574('0x25')](respondWithFilteredResult(_0x25c064,_0x4819df))['catch'](handleError(_0x25c064,null));};exports[_0x0574('0x45')]=function(_0x25467a,_0x4e3be4){var _0x310bb7={'raw':!![],'where':{'id':_0x25467a[_0x0574('0x46')]['id']}},_0x48a8f0={};_0x48a8f0[_0x0574('0x30')]=_['keys'](db[_0x0574('0x40')][_0x0574('0x2c')]);_0x48a8f0[_0x0574('0x31')]=_['keys'](_0x25467a[_0x0574('0x31')]);_0x48a8f0[_0x0574('0x33')]=_[_0x0574('0x34')](_0x48a8f0[_0x0574('0x30')],_0x48a8f0[_0x0574('0x31')]);_0x310bb7[_0x0574('0x36')]=_['intersection'](_0x48a8f0['model'],qs[_0x0574('0x35')](_0x25467a[_0x0574('0x31')][_0x0574('0x35')]));_0x310bb7[_0x0574('0x36')]=_0x310bb7[_0x0574('0x36')][_0x0574('0x47')]?_0x310bb7[_0x0574('0x36')]:_0x48a8f0[_0x0574('0x30')];if(_0x25467a[_0x0574('0x31')][_0x0574('0x42')]){_0x310bb7[_0x0574('0x43')]=[{'all':!![]}];}_0x310bb7=_[_0x0574('0x3d')]({},_0x310bb7,_0x25467a[_0x0574('0x3f')]);return db[_0x0574('0x40')][_0x0574('0x48')](_0x310bb7)['then'](handleEntityNotFound(_0x4e3be4,null))[_0x0574('0x25')](respondWithResult(_0x4e3be4,null))[_0x0574('0x49')](handleError(_0x4e3be4,null));};exports[_0x0574('0x4a')]=function(_0x1fe0bd,_0x56c83d){return db['FaxQueueReport']['create'](_0x1fe0bd['body'],{})[_0x0574('0x25')](respondWithResult(_0x56c83d,0xc9))[_0x0574('0x49')](handleError(_0x56c83d,null));};exports['update']=function(_0xb9c08b,_0x47499f){if(_0xb9c08b[_0x0574('0x4b')]['id']){delete _0xb9c08b[_0x0574('0x4b')]['id'];}return db[_0x0574('0x40')][_0x0574('0x48')]({'where':{'id':_0xb9c08b[_0x0574('0x46')]['id']}})['then'](handleEntityNotFound(_0x47499f,null))['then'](saveUpdates(_0xb9c08b['body'],null))['then'](respondWithResult(_0x47499f,null))['catch'](handleError(_0x47499f,null));};exports[_0x0574('0x4c')]=function(_0x3556d6,_0x570bc8){return db[_0x0574('0x40')][_0x0574('0x48')]({'where':{'id':_0x3556d6['params']['id']}})[_0x0574('0x25')](handleEntityNotFound(_0x570bc8,null))[_0x0574('0x25')](removeEntity(_0x570bc8,null))[_0x0574('0x49')](handleError(_0x570bc8,null));};exports['describe']=function(_0x5671c8,_0xfda5f8){return db[_0x0574('0x40')][_0x0574('0x4d')]()[_0x0574('0x25')](respondWithResult(_0xfda5f8,null))[_0x0574('0x49')](handleError(_0xfda5f8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index db27440..89cdd8c 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 _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 +var _0x3d4f=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','define','uniqueid','util'];(function(_0x3d6d3c,_0x1b87be){var _0x308d7f=function(_0x400c14){while(--_0x400c14){_0x3d6d3c['push'](_0x3d6d3c['shift']());}};_0x308d7f(++_0x1b87be);}(_0x3d4f,0x167));var _0xf3d4=function(_0x3f9029,_0x5c86a6){_0x3f9029=_0x3f9029-0x0;var _0xd3b70d=_0x3d4f[_0x3f9029];return _0xd3b70d;};'use strict';var _=require('lodash');var util=require(_0xf3d4('0x0'));var logger=require(_0xf3d4('0x1'))(_0xf3d4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf3d4('0x3'));var fs=require('fs');var path=require(_0xf3d4('0x4'));var rimraf=require(_0xf3d4('0x5'));var config=require(_0xf3d4('0x6'));var attributes=require(_0xf3d4('0x7'));module['exports']=function(_0x225271,_0x2418e0){return _0x225271[_0xf3d4('0x8')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf3d4('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 12e8395..9108c92 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 _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 +var _0x5ed1=['update','raw','where','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','debug','UpdateFaxQueueReport'];(function(_0x250f68,_0x271a44){var _0x14b1e0=function(_0xfe23cb){while(--_0xfe23cb){_0x250f68['push'](_0x250f68['shift']());}};_0x14b1e0(++_0x271a44);}(_0x5ed1,0x158));var _0x15ed=function(_0x42ca15,_0x193ccb){_0x42ca15=_0x42ca15-0x0;var _0x1c6ded=_0x5ed1[_0x42ca15];return _0x1c6ded;};'use strict';var _=require('lodash');var util=require(_0x15ed('0x0'));var moment=require(_0x15ed('0x1'));var BPromise=require(_0x15ed('0x2'));var rs=require(_0x15ed('0x3'));var fs=require('fs');var Redis=require(_0x15ed('0x4'));var db=require(_0x15ed('0x5'))['db'];var utils=require(_0x15ed('0x6'));var logger=require(_0x15ed('0x7'))(_0x15ed('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x15ed('0x9')][_0x15ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f7ade,_0x3846b0,_0x393c0a){return new BPromise(function(_0x34086e,_0x49bd4f){return client[_0x15ed('0xb')](_0x1f7ade,_0x393c0a)[_0x15ed('0xc')](function(_0x3385ed){logger[_0x15ed('0xd')](_0x15ed('0xe'),_0x3846b0,_0x15ed('0xf'));logger['debug'](_0x15ed('0x10'),_0x3846b0,_0x15ed('0xf'),JSON[_0x15ed('0x11')](_0x3385ed));if(_0x3385ed['error']){if(_0x3385ed[_0x15ed('0x12')][_0x15ed('0x13')]===0x1f4){logger[_0x15ed('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x3846b0,_0x3385ed[_0x15ed('0x12')]['message']);return _0x49bd4f(_0x3385ed[_0x15ed('0x12')][_0x15ed('0x14')]);}logger[_0x15ed('0x12')](_0x15ed('0xe'),_0x3846b0,_0x3385ed['error'][_0x15ed('0x14')]);return _0x34086e(_0x3385ed['error']['message']);}else{logger[_0x15ed('0xd')](_0x15ed('0xe'),_0x3846b0,_0x15ed('0xf'));_0x34086e(_0x3385ed[_0x15ed('0x15')][_0x15ed('0x14')]);}})[_0x15ed('0x16')](function(_0x1b663a){logger[_0x15ed('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x3846b0,_0x1b663a);_0x49bd4f(_0x1b663a);});});}exports[_0x15ed('0x17')]=function(_0x442b5a){var _0x5c30d0=this;return new Promise(function(_0x42b20d,_0x208201){return db[_0x15ed('0x18')][_0x15ed('0x19')](_0x442b5a[_0x15ed('0x1a')],{'raw':_0x442b5a['options']?_0x442b5a[_0x15ed('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x15ed('0xc')](function(_0x1c91de){logger[_0x15ed('0xd')](_0x15ed('0x17'),_0x442b5a);logger[_0x15ed('0x1c')]('CreateFaxQueueReport',_0x442b5a,JSON[_0x15ed('0x11')](_0x1c91de));_0x42b20d(_0x1c91de);})[_0x15ed('0x16')](function(_0xc33542){logger[_0x15ed('0x12')](_0x15ed('0x17'),_0xc33542[_0x15ed('0x14')],_0x442b5a);_0x208201(_0x5c30d0[_0x15ed('0x12')](0x1f4,_0xc33542[_0x15ed('0x14')]));});});};exports[_0x15ed('0x1d')]=function(_0x3b7eb3){var _0x30cc21=this;return new Promise(function(_0x7137ee,_0x1a1b45){return db['FaxQueueReport'][_0x15ed('0x1e')](_0x3b7eb3[_0x15ed('0x1a')],{'raw':_0x3b7eb3[_0x15ed('0x1b')]?_0x3b7eb3[_0x15ed('0x1b')][_0x15ed('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b7eb3['options']?_0x3b7eb3['options'][_0x15ed('0x20')]||null:null,'attributes':_0x3b7eb3[_0x15ed('0x1b')]?_0x3b7eb3['options']['attributes']||null:null,'limit':_0x3b7eb3[_0x15ed('0x1b')]?_0x3b7eb3[_0x15ed('0x1b')][_0x15ed('0x21')]||null:null})[_0x15ed('0xc')](function(_0x22f503){logger[_0x15ed('0xd')](_0x15ed('0x1d'),_0x3b7eb3);logger[_0x15ed('0x1c')](_0x15ed('0x1d'),_0x3b7eb3,JSON[_0x15ed('0x11')](_0x22f503));_0x7137ee(_0x22f503);})[_0x15ed('0x16')](function(_0xc201c1){logger[_0x15ed('0x12')]('UpdateFaxQueueReport',_0xc201c1[_0x15ed('0x14')],_0x3b7eb3);_0x1a1b45(_0x30cc21['error'](0x1f4,_0xc201c1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index a257770..e2413e1 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 _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 +var _0x4310=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x31e94f,_0x42ecd6){var _0x1b8494=function(_0x5da15c){while(--_0x5da15c){_0x31e94f['push'](_0x31e94f['shift']());}};_0x1b8494(++_0x42ecd6);}(_0x4310,0xf4));var _0x0431=function(_0x572dd3,_0x56be84){_0x572dd3=_0x572dd3-0x0;var _0x32c62c=_0x4310[_0x572dd3];return _0x32c62c;};'use strict';var multer=require(_0x0431('0x0'));var util=require(_0x0431('0x1'));var path=require(_0x0431('0x2'));var timeout=require(_0x0431('0x3'));var express=require(_0x0431('0x4'));var router=express[_0x0431('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0431('0x6'));var config=require('../../config/environment');var controller=require(_0x0431('0x7'));router[_0x0431('0x8')]('/',auth[_0x0431('0x9')](),controller[_0x0431('0xa')]);router['get']('/describe',auth[_0x0431('0x9')](),controller[_0x0431('0xb')]);router[_0x0431('0x8')](_0x0431('0xc'),auth[_0x0431('0x9')](),controller[_0x0431('0xd')]);router[_0x0431('0xe')]('/',auth[_0x0431('0x9')](),controller[_0x0431('0xf')]);router[_0x0431('0x10')](_0x0431('0xc'),auth[_0x0431('0x9')](),controller[_0x0431('0x11')]);router[_0x0431('0x12')](_0x0431('0xc'),auth[_0x0431('0x9')](),controller[_0x0431('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 86c3456..e43fbbd 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 _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 +var _0x478a=['sequelize','exports','STRING','account','agent','DATE','moment'];(function(_0x367bad,_0x1eea19){var _0x3a99d3=function(_0x403c33){while(--_0x403c33){_0x367bad['push'](_0x367bad['shift']());}};_0x3a99d3(++_0x1eea19);}(_0x478a,0x1c6));var _0xa478=function(_0x5228d7,_0x16257e){_0x5228d7=_0x5228d7-0x0;var _0x149dc1=_0x478a[_0x5228d7];return _0x149dc1;};'use strict';var moment=require(_0xa478('0x0'));var Sequelize=require(_0xa478('0x1'));module[_0xa478('0x2')]={'uniqueid':{'type':Sequelize[_0xa478('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa478('0x4'),_0xa478('0x5'),'queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xa478('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b34d0d7..765c2ab 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 _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 +var _0x7579=['rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x1d3fb4,_0xb0874d){var _0x45666c=function(_0x410658){while(--_0x410658){_0x1d3fb4['push'](_0x1d3fb4['shift']());}};_0x45666c(++_0xb0874d);}(_0x7579,0x1e2));var _0x9757=function(_0x39916f,_0x552305){_0x39916f=_0x39916f-0x0;var _0x2ab4f1=_0x7579[_0x39916f];return _0x2ab4f1;};'use strict';var pdf=require(_0x9757('0x0'));var emlformat=require(_0x9757('0x1'));var rimraf=require(_0x9757('0x2'));var zipdir=require(_0x9757('0x3'));var jsonpatch=require(_0x9757('0x4'));var rp=require(_0x9757('0x5'));var moment=require('moment');var BPromise=require(_0x9757('0x6'));var Mustache=require(_0x9757('0x7'));var util=require(_0x9757('0x8'));var path=require(_0x9757('0x9'));var sox=require('sox');var csv=require(_0x9757('0xa'));var ejs=require(_0x9757('0xb'));var fs=require('fs');var _=require(_0x9757('0xc'));var squel=require('squel');var crypto=require(_0x9757('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9757('0xe'));var toCsv=require(_0x9757('0xa'));var querystring=require(_0x9757('0xf'));var Papa=require('papaparse');var Redis=require(_0x9757('0x10'));var authService=require(_0x9757('0x11'));var qs=require(_0x9757('0x12'));var as=require(_0x9757('0x13'));var hardwareService=require(_0x9757('0x14'));var logger=require(_0x9757('0x15'))(_0x9757('0x16'));var utils=require(_0x9757('0x17'));var config=require(_0x9757('0x18'));var licenseUtil=require(_0x9757('0x19'));var db=require(_0x9757('0x1a'))['db'];function respondWithStatusCode(_0x5c19c9,_0x2f2200){_0x2f2200=_0x2f2200||0xcc;return function(_0x1d32ee){if(_0x1d32ee){return _0x5c19c9[_0x9757('0x1b')](_0x2f2200);}return _0x5c19c9['status'](_0x2f2200)[_0x9757('0x1c')]();};}function respondWithResult(_0x39fa5c,_0x413d55){_0x413d55=_0x413d55||0xc8;return function(_0x14f67c){if(_0x14f67c){return _0x39fa5c[_0x9757('0x1d')](_0x413d55)[_0x9757('0x1e')](_0x14f67c);}};}function respondWithFilteredResult(_0x105e56,_0x4b994d){return function(_0x1fd6f6){if(_0x1fd6f6){var _0x55ded7=_0x1fd6f6[_0x9757('0x1f')],_0x17ab45=_0x4b994d[_0x9757('0x20')],_0xcc8f94=_0x4b994d[_0x9757('0x20')]+_0x4b994d['limit'],_0xad2a22;if(_0xcc8f94>=_0x55ded7){_0xcc8f94=_0x55ded7;_0xad2a22=0xc8;}else{_0xad2a22=0xce;}_0x105e56[_0x9757('0x1d')](_0xad2a22);return _0x105e56[_0x9757('0x21')](_0x9757('0x22'),_0x17ab45+'-'+_0xcc8f94+'/'+_0x55ded7)[_0x9757('0x1e')](_0x1fd6f6);}return null;};}function patchUpdates(_0x3716de){return function(_0xd2306b){try{jsonpatch[_0x9757('0x23')](_0xd2306b,_0x3716de,!![]);}catch(_0x593e43){return BPromise[_0x9757('0x24')](_0x593e43);}return _0xd2306b['save']();};}function saveUpdates(_0x517504,_0x37c889){return function(_0x1e2869){if(_0x1e2869){return _0x1e2869[_0x9757('0x25')](_0x517504)[_0x9757('0x26')](function(_0x559135){return _0x559135;});}return null;};}function removeEntity(_0x4ef000,_0x53d21c){return function(_0x73dac4){if(_0x73dac4){return _0x73dac4[_0x9757('0x27')]()[_0x9757('0x26')](function(){_0x4ef000[_0x9757('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f5ac,_0x160108){return function(_0x5d6554){if(!_0x5d6554){_0x11f5ac[_0x9757('0x1b')](0x194);}return _0x5d6554;};}function handleError(_0x956048,_0x58caa8){_0x58caa8=_0x58caa8||0x1f4;return function(_0x2b6915){logger[_0x9757('0x28')](_0x2b6915[_0x9757('0x29')]);if(_0x2b6915[_0x9757('0x2a')]){delete _0x2b6915[_0x9757('0x2a')];}_0x956048[_0x9757('0x1d')](_0x58caa8)['send'](_0x2b6915);};}exports[_0x9757('0x2b')]=function(_0x57c770,_0x2f2fe7){var _0x398c48={},_0x58ae5e={},_0x490e10={'count':0x0,'rows':[]};var _0x2f0ae8=_[_0x9757('0x2c')](db[_0x9757('0x2d')][_0x9757('0x2e')],function(_0x4ebdb6){return{'name':_0x4ebdb6[_0x9757('0x2f')],'type':_0x4ebdb6[_0x9757('0x30')][_0x9757('0x31')]};});_0x58ae5e[_0x9757('0x32')]=_[_0x9757('0x2c')](_0x2f0ae8,_0x9757('0x2a'));_0x58ae5e['query']=_[_0x9757('0x33')](_0x57c770[_0x9757('0x34')]);_0x58ae5e[_0x9757('0x35')]=_[_0x9757('0x36')](_0x58ae5e[_0x9757('0x32')],_0x58ae5e[_0x9757('0x34')]);_0x398c48[_0x9757('0x37')]=_['intersection'](_0x58ae5e[_0x9757('0x32')],qs[_0x9757('0x38')](_0x57c770[_0x9757('0x34')][_0x9757('0x38')]));_0x398c48[_0x9757('0x37')]=_0x398c48[_0x9757('0x37')][_0x9757('0x39')]?_0x398c48[_0x9757('0x37')]:_0x58ae5e['model'];if(!_0x57c770[_0x9757('0x34')]['hasOwnProperty'](_0x9757('0x3a'))){_0x398c48[_0x9757('0x3b')]=qs['limit'](_0x57c770[_0x9757('0x34')][_0x9757('0x3b')]);_0x398c48[_0x9757('0x20')]=qs[_0x9757('0x20')](_0x57c770[_0x9757('0x34')][_0x9757('0x20')]);}_0x398c48[_0x9757('0x3c')]=qs[_0x9757('0x3d')](_0x57c770[_0x9757('0x34')][_0x9757('0x3d')]);_0x398c48['where']=qs[_0x9757('0x35')](_[_0x9757('0x3e')](_0x57c770[_0x9757('0x34')],_0x58ae5e['filters']),_0x2f0ae8);if(_0x57c770[_0x9757('0x34')][_0x9757('0x3f')]){_0x398c48[_0x9757('0x40')]=_[_0x9757('0x41')](_0x398c48[_0x9757('0x40')],{'$or':_[_0x9757('0x2c')](_0x2f0ae8,function(_0x241a81){if(_0x241a81[_0x9757('0x30')]!==_0x9757('0x42')){var _0x478c3c={};_0x478c3c[_0x241a81['name']]={'$like':'%'+_0x57c770[_0x9757('0x34')][_0x9757('0x3f')]+'%'};return _0x478c3c;}})});}_0x398c48=_[_0x9757('0x41')]({},_0x398c48,_0x57c770[_0x9757('0x43')]);var _0x4f779b={'where':_0x398c48[_0x9757('0x40')]};return db['FaxTransferReport'][_0x9757('0x1f')](_0x4f779b)[_0x9757('0x26')](function(_0x2df1a8){_0x490e10['count']=_0x2df1a8;if(_0x57c770[_0x9757('0x34')][_0x9757('0x44')]){_0x398c48[_0x9757('0x45')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x9757('0x46')](_0x398c48);})['then'](function(_0x50f0e4){_0x490e10[_0x9757('0x47')]=_0x50f0e4;return _0x490e10;})[_0x9757('0x26')](respondWithFilteredResult(_0x2f2fe7,_0x398c48))[_0x9757('0x48')](handleError(_0x2f2fe7,null));};exports[_0x9757('0x49')]=function(_0xb90596,_0x4f30db){var _0x49429a={'raw':!![],'where':{'id':_0xb90596[_0x9757('0x4a')]['id']}},_0x4f1cdd={};_0x4f1cdd[_0x9757('0x32')]=_[_0x9757('0x33')](db['FaxTransferReport'][_0x9757('0x2e')]);_0x4f1cdd[_0x9757('0x34')]=_['keys'](_0xb90596[_0x9757('0x34')]);_0x4f1cdd[_0x9757('0x35')]=_[_0x9757('0x36')](_0x4f1cdd[_0x9757('0x32')],_0x4f1cdd['query']);_0x49429a[_0x9757('0x37')]=_[_0x9757('0x36')](_0x4f1cdd[_0x9757('0x32')],qs[_0x9757('0x38')](_0xb90596[_0x9757('0x34')][_0x9757('0x38')]));_0x49429a[_0x9757('0x37')]=_0x49429a[_0x9757('0x37')][_0x9757('0x39')]?_0x49429a['attributes']:_0x4f1cdd['model'];if(_0xb90596[_0x9757('0x34')][_0x9757('0x44')]){_0x49429a[_0x9757('0x45')]=[{'all':!![]}];}_0x49429a=_['merge']({},_0x49429a,_0xb90596[_0x9757('0x43')]);return db[_0x9757('0x2d')][_0x9757('0x4b')](_0x49429a)['then'](handleEntityNotFound(_0x4f30db,null))[_0x9757('0x26')](respondWithResult(_0x4f30db,null))[_0x9757('0x48')](handleError(_0x4f30db,null));};exports['create']=function(_0x4c5597,_0x4e613d){return db[_0x9757('0x2d')][_0x9757('0x4c')](_0x4c5597[_0x9757('0x4d')],{})['then'](respondWithResult(_0x4e613d,0xc9))[_0x9757('0x48')](handleError(_0x4e613d,null));};exports['update']=function(_0xf2f0dc,_0x173f0f){if(_0xf2f0dc['body']['id']){delete _0xf2f0dc[_0x9757('0x4d')]['id'];}return db[_0x9757('0x2d')][_0x9757('0x4b')]({'where':{'id':_0xf2f0dc[_0x9757('0x4a')]['id']}})[_0x9757('0x26')](handleEntityNotFound(_0x173f0f,null))['then'](saveUpdates(_0xf2f0dc[_0x9757('0x4d')],null))[_0x9757('0x26')](respondWithResult(_0x173f0f,null))[_0x9757('0x48')](handleError(_0x173f0f,null));};exports[_0x9757('0x27')]=function(_0x3bff1d,_0x3c4f7d){return db[_0x9757('0x2d')]['find']({'where':{'id':_0x3bff1d['params']['id']}})[_0x9757('0x26')](handleEntityNotFound(_0x3c4f7d,null))['then'](removeEntity(_0x3c4f7d,null))['catch'](handleError(_0x3c4f7d,null));};exports[_0x9757('0x4e')]=function(_0x59fed4,_0x410177){return db[_0x9757('0x2d')]['describe']()['then'](respondWithResult(_0x410177,null))[_0x9757('0x48')](handleError(_0x410177,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 42439cb..27e1954 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 _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 +var _0xba6f=['define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xfdc0e8,_0x3bab0a){var _0x47c00a=function(_0x51620a){while(--_0x51620a){_0xfdc0e8['push'](_0xfdc0e8['shift']());}};_0x47c00a(++_0x3bab0a);}(_0xba6f,0x90));var _0xfba6=function(_0x7ad6cb,_0xffee6c){_0x7ad6cb=_0x7ad6cb-0x0;var _0x22a0ba=_0xba6f[_0x7ad6cb];return _0x22a0ba;};'use strict';var _=require('lodash');var util=require(_0xfba6('0x0'));var logger=require(_0xfba6('0x1'))(_0xfba6('0x2'));var moment=require(_0xfba6('0x3'));var BPromise=require(_0xfba6('0x4'));var rp=require(_0xfba6('0x5'));var fs=require('fs');var path=require(_0xfba6('0x6'));var rimraf=require(_0xfba6('0x7'));var config=require(_0xfba6('0x8'));var attributes=require('./faxTransferReport.attributes');module[_0xfba6('0x9')]=function(_0x4d6629,_0x299ca8){return _0x4d6629[_0xfba6('0xa')](_0xfba6('0xb'),attributes,{'tableName':_0xfba6('0xc'),'paranoid':![],'indexes':[{'name':_0xfba6('0xd'),'fields':[_0xfba6('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 23d7065..214dda5 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 _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 +var _0xd6c7=['util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd6c7,0x158));var _0x7d6c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd6c7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7d6c('0x0'));var util=require(_0x7d6c('0x1'));var moment=require(_0x7d6c('0x2'));var BPromise=require('bluebird');var rs=require(_0x7d6c('0x3'));var fs=require('fs');var Redis=require(_0x7d6c('0x4'));var db=require(_0x7d6c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7d6c('0x6'))(_0x7d6c('0x7'));var config=require(_0x7d6c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7d6c('0x9')][_0x7d6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x531ce8,_0x25f85c,_0xbf1d6e){return new BPromise(function(_0x52045d,_0x11ed56){return client[_0x7d6c('0xb')](_0x531ce8,_0xbf1d6e)[_0x7d6c('0xc')](function(_0x2ef9db){logger['info'](_0x7d6c('0xd'),_0x25f85c,_0x7d6c('0xe'));logger[_0x7d6c('0xf')](_0x7d6c('0x10'),_0x25f85c,_0x7d6c('0xe'),JSON[_0x7d6c('0x11')](_0x2ef9db));if(_0x2ef9db[_0x7d6c('0x12')]){if(_0x2ef9db[_0x7d6c('0x12')][_0x7d6c('0x13')]===0x1f4){logger[_0x7d6c('0x12')](_0x7d6c('0xd'),_0x25f85c,_0x2ef9db[_0x7d6c('0x12')][_0x7d6c('0x14')]);return _0x11ed56(_0x2ef9db[_0x7d6c('0x12')]['message']);}logger[_0x7d6c('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x25f85c,_0x2ef9db[_0x7d6c('0x12')][_0x7d6c('0x14')]);return _0x52045d(_0x2ef9db['error']['message']);}else{logger[_0x7d6c('0x15')](_0x7d6c('0xd'),_0x25f85c,_0x7d6c('0xe'));_0x52045d(_0x2ef9db['result'][_0x7d6c('0x14')]);}})[_0x7d6c('0x16')](function(_0xdbc2bd){logger[_0x7d6c('0x12')](_0x7d6c('0xd'),_0x25f85c,_0xdbc2bd);_0x11ed56(_0xdbc2bd);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2a32d0d..74a0fb4 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 _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 +var _0x3a5d=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','/describe','describe','/:id'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x3a5d,0x1d2));var _0xd3a5=function(_0xb2e44e,_0x23da21){_0xb2e44e=_0xb2e44e-0x0;var _0x2b6ac1=_0x3a5d[_0xb2e44e];return _0x2b6ac1;};'use strict';var multer=require(_0xd3a5('0x0'));var util=require(_0xd3a5('0x1'));var path=require(_0xd3a5('0x2'));var timeout=require(_0xd3a5('0x3'));var express=require(_0xd3a5('0x4'));var router=express['Router']();var auth=require(_0xd3a5('0x5'));var interaction=require(_0xd3a5('0x6'));var config=require(_0xd3a5('0x7'));var controller=require(_0xd3a5('0x8'));router['get']('/',auth[_0xd3a5('0x9')](),controller[_0xd3a5('0xa')]);router['get'](_0xd3a5('0xb'),auth[_0xd3a5('0x9')](),controller[_0xd3a5('0xc')]);router['get'](_0xd3a5('0xd'),auth[_0xd3a5('0x9')](),controller[_0xd3a5('0xe')]);router['post']('/',auth[_0xd3a5('0x9')](),controller['create']);router[_0xd3a5('0xf')](_0xd3a5('0xd'),auth[_0xd3a5('0x9')](),controller[_0xd3a5('0x10')]);router[_0xd3a5('0x11')](_0xd3a5('0xd'),auth['isAuthenticated'](),controller[_0xd3a5('0x12')]);module[_0xd3a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c51dc74..6e4c153 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 _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 +var _0x968f=['create','addConfiguration','put','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x1c71a6,_0x56a804){var _0x263ee8=function(_0xecddc2){while(--_0xecddc2){_0x1c71a6['push'](_0x1c71a6['shift']());}};_0x263ee8(++_0x56a804);}(_0x968f,0x1be));var _0xf968=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x968f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xf968('0x0'));var path=require(_0xf968('0x1'));var timeout=require(_0xf968('0x2'));var express=require(_0xf968('0x3'));var router=express[_0xf968('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf968('0x5'));var controller=require('./intDeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf968('0x6')]);router[_0xf968('0x7')](_0xf968('0x8'),auth[_0xf968('0x9')](),controller[_0xf968('0xa')]);router[_0xf968('0x7')](_0xf968('0xb'),auth[_0xf968('0x9')](),controller[_0xf968('0xc')]);router['get'](_0xf968('0xd'),auth[_0xf968('0x9')](),controller[_0xf968('0xe')]);router[_0xf968('0xf')]('/',auth[_0xf968('0x9')](),controller[_0xf968('0x10')]);router['post'](_0xf968('0xb'),auth[_0xf968('0x9')](),controller[_0xf968('0x11')]);router[_0xf968('0x12')](_0xf968('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xf968('0x13')]('/:id',auth[_0xf968('0x9')](),controller[_0xf968('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 8837b1d..a898d0d 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 _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 +var _0x0b0e=['integrationTab','sequelize','STRING','ENUM','basic','newTab'];(function(_0x12fd8c,_0x23b70c){var _0x4dec07=function(_0x5f4a70){while(--_0x5f4a70){_0x12fd8c['push'](_0x12fd8c['shift']());}};_0x4dec07(++_0x23b70c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x0b0e[_0x2bfe52];return _0x1cf649;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0b0('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe0b0('0x1')]},'remoteUri':{'type':Sequelize[_0xe0b0('0x1')]},'authType':{'type':Sequelize[_0xe0b0('0x2')](_0xe0b0('0x3')),'defaultValue':_0xe0b0('0x3')},'password':{'type':Sequelize[_0xe0b0('0x1')]},'consumerKey':{'type':Sequelize[_0xe0b0('0x1')]},'consumerSecret':{'type':Sequelize[_0xe0b0('0x1')]},'token':{'type':Sequelize[_0xe0b0('0x1')]},'tokenSecret':{'type':Sequelize[_0xe0b0('0x1')]},'serverUrl':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xe0b0('0x4')),'defaultValue':_0xe0b0('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9d343d0..e542b01 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 _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 +var _0x1088=['channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','status','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','fields','attributes','model','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','keys','length','include','find','create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects'];(function(_0x43fd7d,_0x3102c4){var _0x53f8ec=function(_0x3feebe){while(--_0x3feebe){_0x43fd7d['push'](_0x43fd7d['shift']());}};_0x53f8ec(++_0x3102c4);}(_0x1088,0x98));var _0x8108=function(_0x5cb6aa,_0x3bbea9){_0x5cb6aa=_0x5cb6aa-0x0;var _0x5daad1=_0x1088[_0x5cb6aa];return _0x5daad1;};'use strict';var pdf=require(_0x8108('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8108('0x1'));var jsonpatch=require(_0x8108('0x2'));var rp=require(_0x8108('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8108('0x4'));var path=require(_0x8108('0x5'));var sox=require('sox');var csv=require(_0x8108('0x6'));var ejs=require(_0x8108('0x7'));var fs=require('fs');var _=require(_0x8108('0x8'));var squel=require('squel');var crypto=require(_0x8108('0x9'));var jsforce=require(_0x8108('0xa'));var deskjs=require(_0x8108('0xb'));var toCsv=require('to-csv');var querystring=require(_0x8108('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8108('0xd'));var qs=require(_0x8108('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8108('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8108('0x10'));var db=require(_0x8108('0x11'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x8108('0x12'));var client=jayson[_0x8108('0x13')][_0x8108('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x4aa44a,_0x282daa,_0x4bac52,_0x975ffd){return new BPromise(function(_0x6c68ab,_0x503490){var _0x45cd83=_0x975ffd||client;return _0x45cd83['request'](_0x4aa44a,_0x4bac52)[_0x8108('0x15')](function(_0x17dd9b){logger[_0x8108('0x16')](_0x8108('0x17'),_0x282daa,_0x8108('0x18'));logger[_0x8108('0x19')](_0x8108('0x1a'),_0x282daa,'request\x20sent',JSON[_0x8108('0x1b')](_0x17dd9b));if(_0x17dd9b[_0x8108('0x1c')]){if(_0x17dd9b[_0x8108('0x1c')]['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x282daa,_0x17dd9b[_0x8108('0x1c')]['message']);return _0x503490(_0x17dd9b[_0x8108('0x1c')][_0x8108('0x1d')]);}logger[_0x8108('0x1c')](_0x8108('0x17'),_0x282daa,_0x17dd9b['error']['message']);return _0x6c68ab(_0x17dd9b[_0x8108('0x1c')][_0x8108('0x1d')]);}else{logger[_0x8108('0x16')](_0x8108('0x17'),_0x282daa,_0x8108('0x18'));_0x6c68ab(_0x17dd9b[_0x8108('0x1e')][_0x8108('0x1d')]);}})[_0x8108('0x1f')](function(_0x3e4102){logger['error'](_0x8108('0x17'),_0x282daa,_0x3e4102);_0x503490(_0x3e4102);});});}function respondWithStatusCode(_0x57a099,_0x4cdbff){_0x4cdbff=_0x4cdbff||0xcc;return function(_0x34db27){if(_0x34db27){return _0x57a099[_0x8108('0x20')](_0x4cdbff);}return _0x57a099['status'](_0x4cdbff)[_0x8108('0x21')]();};}function respondWithResult(_0x42f718,_0x9d680d){_0x9d680d=_0x9d680d||0xc8;return function(_0x127b3b){if(_0x127b3b){return _0x42f718['status'](_0x9d680d)[_0x8108('0x22')](_0x127b3b);}};}function respondWithFilteredResult(_0x469f53,_0x26a699){return function(_0x531ffb){if(_0x531ffb){var _0x23b08c=_0x531ffb[_0x8108('0x23')],_0x4db4cb=_0x26a699[_0x8108('0x24')],_0xfb4a3=_0x26a699[_0x8108('0x24')]+_0x26a699[_0x8108('0x25')],_0x10b3af;if(_0xfb4a3>=_0x23b08c){_0xfb4a3=_0x23b08c;_0x10b3af=0xc8;}else{_0x10b3af=0xce;}_0x469f53['status'](_0x10b3af);return _0x469f53['set'](_0x8108('0x26'),_0x4db4cb+'-'+_0xfb4a3+'/'+_0x23b08c)[_0x8108('0x22')](_0x531ffb);}return null;};}function patchUpdates(_0x512c58){return function(_0x4e85c7){try{jsonpatch[_0x8108('0x27')](_0x4e85c7,_0x512c58,!![]);}catch(_0x5e45ed){return BPromise[_0x8108('0x28')](_0x5e45ed);}return _0x4e85c7[_0x8108('0x29')]();};}function saveUpdates(_0x11956c,_0x2e1eed){return function(_0x2e4d3b){if(_0x2e4d3b){return _0x2e4d3b[_0x8108('0x2a')](_0x11956c)[_0x8108('0x15')](function(_0x12e4bf){return _0x12e4bf;});}return null;};}function removeEntity(_0x4af731,_0x32c151){return function(_0x7e33f4){if(_0x7e33f4){return _0x7e33f4[_0x8108('0x2b')]()[_0x8108('0x15')](function(){_0x4af731[_0x8108('0x2c')](0xcc)[_0x8108('0x21')]();});}};}function handleEntityNotFound(_0x42c785,_0x2fb0b2){return function(_0x557a94){if(!_0x557a94){_0x42c785[_0x8108('0x20')](0x194);}return _0x557a94;};}function handleError(_0x2c3643,_0x4e4a94){_0x4e4a94=_0x4e4a94||0x1f4;return function(_0x3339a3){logger['error'](_0x3339a3['stack']);if(_0x3339a3['name']){delete _0x3339a3[_0x8108('0x2d')];}_0x2c3643[_0x8108('0x2c')](_0x4e4a94)[_0x8108('0x2e')](_0x3339a3);};}exports[_0x8108('0x2f')]=function(_0xf537db,_0x2c3696){var _0x4f9095={},_0x3938d0={},_0x50259c={'count':0x0,'rows':[]};var _0x1ef009=_[_0x8108('0x30')](db[_0x8108('0x31')][_0x8108('0x32')],function(_0x72b4a5){return{'name':_0x72b4a5[_0x8108('0x33')],'type':_0x72b4a5[_0x8108('0x34')][_0x8108('0x35')]};});_0x3938d0['model']=_[_0x8108('0x30')](_0x1ef009,_0x8108('0x2d'));_0x3938d0[_0x8108('0x36')]=_['keys'](_0xf537db[_0x8108('0x36')]);_0x3938d0[_0x8108('0x37')]=_[_0x8108('0x38')](_0x3938d0['model'],_0x3938d0[_0x8108('0x36')]);_0x4f9095['attributes']=_[_0x8108('0x38')](_0x3938d0['model'],qs[_0x8108('0x39')](_0xf537db[_0x8108('0x36')][_0x8108('0x39')]));_0x4f9095['attributes']=_0x4f9095[_0x8108('0x3a')]['length']?_0x4f9095[_0x8108('0x3a')]:_0x3938d0[_0x8108('0x3b')];if(!_0xf537db[_0x8108('0x36')]['hasOwnProperty'](_0x8108('0x3c'))){_0x4f9095['limit']=qs[_0x8108('0x25')](_0xf537db[_0x8108('0x36')]['limit']);_0x4f9095[_0x8108('0x24')]=qs['offset'](_0xf537db[_0x8108('0x36')][_0x8108('0x24')]);}_0x4f9095[_0x8108('0x3d')]=qs[_0x8108('0x3e')](_0xf537db[_0x8108('0x36')][_0x8108('0x3e')]);_0x4f9095[_0x8108('0x3f')]=qs['filters'](_[_0x8108('0x40')](_0xf537db[_0x8108('0x36')],_0x3938d0['filters']),_0x1ef009);if(_0xf537db[_0x8108('0x36')][_0x8108('0x41')]){_0x4f9095[_0x8108('0x3f')]=_[_0x8108('0x42')](_0x4f9095[_0x8108('0x3f')],{'$or':_[_0x8108('0x30')](_0x1ef009,function(_0x2a542c){if(_0x2a542c[_0x8108('0x34')]!==_0x8108('0x43')){var _0x27f8f5={};_0x27f8f5[_0x2a542c[_0x8108('0x2d')]]={'$like':'%'+_0xf537db[_0x8108('0x36')][_0x8108('0x41')]+'%'};return _0x27f8f5;}})});}_0x4f9095=_[_0x8108('0x42')]({},_0x4f9095,_0xf537db[_0x8108('0x44')]);var _0x2874ed={'where':_0x4f9095[_0x8108('0x3f')]};return db['DeskAccount'][_0x8108('0x23')](_0x2874ed)[_0x8108('0x15')](function(_0x3521a6){_0x50259c['count']=_0x3521a6;if(_0xf537db[_0x8108('0x36')][_0x8108('0x45')]){_0x4f9095['include']=[{'all':!![]}];}return db[_0x8108('0x31')]['findAll'](_0x4f9095);})[_0x8108('0x15')](function(_0x124c16){_0x50259c[_0x8108('0x46')]=_0x124c16;return _0x50259c;})[_0x8108('0x15')](respondWithFilteredResult(_0x2c3696,_0x4f9095))[_0x8108('0x1f')](handleError(_0x2c3696,null));};exports[_0x8108('0x47')]=function(_0x10d668,_0x5a4ec9){var _0x45bebc={'raw':![],'where':{'id':_0x10d668[_0x8108('0x48')]['id']}},_0x26d69c={};_0x26d69c[_0x8108('0x3b')]=_[_0x8108('0x49')](db[_0x8108('0x31')][_0x8108('0x32')]);_0x26d69c[_0x8108('0x36')]=_[_0x8108('0x49')](_0x10d668['query']);_0x26d69c[_0x8108('0x37')]=_[_0x8108('0x38')](_0x26d69c[_0x8108('0x3b')],_0x26d69c[_0x8108('0x36')]);_0x45bebc[_0x8108('0x3a')]=_[_0x8108('0x38')](_0x26d69c['model'],qs[_0x8108('0x39')](_0x10d668[_0x8108('0x36')][_0x8108('0x39')]));_0x45bebc[_0x8108('0x3a')]=_0x45bebc[_0x8108('0x3a')][_0x8108('0x4a')]?_0x45bebc[_0x8108('0x3a')]:_0x26d69c[_0x8108('0x3b')];if(_0x10d668[_0x8108('0x36')][_0x8108('0x45')]){_0x45bebc[_0x8108('0x4b')]=[{'all':!![]}];}_0x45bebc=_[_0x8108('0x42')]({},_0x45bebc,_0x10d668['options']);return db[_0x8108('0x31')][_0x8108('0x4c')](_0x45bebc)[_0x8108('0x15')](handleEntityNotFound(_0x5a4ec9,null))[_0x8108('0x15')](respondWithResult(_0x5a4ec9,null))['catch'](handleError(_0x5a4ec9,null));};exports[_0x8108('0x4d')]=function(_0x2cc8b0,_0x5d4cca){return db['DeskAccount'][_0x8108('0x4d')](_0x2cc8b0[_0x8108('0x4e')],{})[_0x8108('0x15')](respondWithResult(_0x5d4cca,0xc9))[_0x8108('0x1f')](handleError(_0x5d4cca,null));};exports[_0x8108('0x2a')]=function(_0x4899cc,_0xb0dc7){if(_0x4899cc[_0x8108('0x4e')]['id']){delete _0x4899cc['body']['id'];}return db['DeskAccount'][_0x8108('0x4c')]({'where':{'id':_0x4899cc[_0x8108('0x48')]['id']}})[_0x8108('0x15')](handleEntityNotFound(_0xb0dc7,null))[_0x8108('0x15')](saveUpdates(_0x4899cc['body'],null))[_0x8108('0x15')](respondWithResult(_0xb0dc7,null))[_0x8108('0x1f')](handleError(_0xb0dc7,null));};exports[_0x8108('0x2b')]=function(_0x25ef5a,_0x409cf9){return db[_0x8108('0x31')][_0x8108('0x4c')]({'where':{'id':_0x25ef5a[_0x8108('0x48')]['id']}})[_0x8108('0x15')](handleEntityNotFound(_0x409cf9,null))['then'](removeEntity(_0x409cf9,null))[_0x8108('0x1f')](handleError(_0x409cf9,null));};exports[_0x8108('0x4f')]=function(_0x45f8eb,_0x364171,_0x1cd94e){var _0x32f59d={};var _0x26bd1b={};var _0x43a265;var _0x2a737d;return db[_0x8108('0x31')][_0x8108('0x50')]({'where':{'id':_0x45f8eb[_0x8108('0x48')]['id']}})[_0x8108('0x15')](handleEntityNotFound(_0x364171,null))['then'](function(_0xec85d1){if(_0xec85d1){_0x43a265=_0xec85d1;_0x26bd1b[_0x8108('0x3b')]=_[_0x8108('0x49')](db[_0x8108('0x51')]['rawAttributes']);_0x26bd1b[_0x8108('0x36')]=_[_0x8108('0x49')](_0x45f8eb[_0x8108('0x36')]);_0x26bd1b[_0x8108('0x37')]=_[_0x8108('0x38')](_0x26bd1b['model'],_0x26bd1b[_0x8108('0x36')]);_0x32f59d[_0x8108('0x3a')]=_[_0x8108('0x38')](_0x26bd1b[_0x8108('0x3b')],qs['fields'](_0x45f8eb[_0x8108('0x36')][_0x8108('0x39')]));_0x32f59d[_0x8108('0x3a')]=_0x32f59d['attributes'][_0x8108('0x4a')]?_0x32f59d[_0x8108('0x3a')]:_0x26bd1b['model'];_0x32f59d[_0x8108('0x3d')]=qs[_0x8108('0x3e')](_0x45f8eb['query'][_0x8108('0x3e')]);_0x32f59d[_0x8108('0x3f')]=qs['filters'](_[_0x8108('0x40')](_0x45f8eb[_0x8108('0x36')],_0x26bd1b[_0x8108('0x37')]));if(_0x45f8eb[_0x8108('0x36')][_0x8108('0x41')]){_0x32f59d[_0x8108('0x3f')]=_[_0x8108('0x42')](_0x32f59d[_0x8108('0x3f')],{'$or':_['map'](_0x32f59d[_0x8108('0x3a')],function(_0xce5d55){var _0x5bbede={};_0x5bbede[_0xce5d55]={'$like':'%'+_0x45f8eb[_0x8108('0x36')][_0x8108('0x41')]+'%'};return _0x5bbede;})});}_0x32f59d=_['merge']({},_0x32f59d,_0x45f8eb[_0x8108('0x44')]);return _0x43a265['getConfigurations'](_0x32f59d);}})[_0x8108('0x15')](function(_0x1987c2){if(_0x1987c2){_0x2a737d=_0x1987c2[_0x8108('0x4a')];if(!_0x45f8eb[_0x8108('0x36')][_0x8108('0x52')](_0x8108('0x3c'))){_0x32f59d[_0x8108('0x25')]=qs[_0x8108('0x25')](_0x45f8eb[_0x8108('0x36')][_0x8108('0x25')]);_0x32f59d[_0x8108('0x24')]=qs['offset'](_0x45f8eb[_0x8108('0x36')][_0x8108('0x24')]);}return _0x43a265[_0x8108('0x4f')](_0x32f59d);}})[_0x8108('0x15')](function(_0x907c7d){if(_0x907c7d){return _0x907c7d?{'count':_0x2a737d,'rows':_0x907c7d}:null;}})['then'](respondWithResult(_0x364171,null))[_0x8108('0x1f')](handleError(_0x364171,null));};exports['addConfiguration']=function(_0x2d4c03,_0x1dbfd0,_0x247702){if(_0x2d4c03['body']['id']){delete _0x2d4c03[_0x8108('0x4e')]['id'];}return db['DeskAccount'][_0x8108('0x50')]({'where':{'id':_0x2d4c03[_0x8108('0x48')]['id']}})[_0x8108('0x15')](handleEntityNotFound(_0x1dbfd0,null))[_0x8108('0x15')](function(_0x1362a5){if(_0x1362a5){_0x2d4c03['body'][_0x8108('0x53')]=_0x1362a5['id'];_0x2d4c03[_0x8108('0x4e')][_0x8108('0x54')]=integrations[_0x8108('0x55')](_0x2d4c03[_0x8108('0x4e')][_0x8108('0x56')],_0x2d4c03[_0x8108('0x4e')][_0x8108('0x34')]);_0x2d4c03[_0x8108('0x4e')][_0x8108('0x57')]=integrations[_0x8108('0x58')](_0x2d4c03[_0x8108('0x4e')][_0x8108('0x56')],_0x2d4c03[_0x8108('0x4e')][_0x8108('0x34')]);return db[_0x8108('0x51')][_0x8108('0x4d')](_0x2d4c03[_0x8108('0x4e')],{'include':[{'model':db[_0x8108('0x59')],'as':_0x8108('0x54')},{'model':db[_0x8108('0x59')],'as':_0x8108('0x57')}]});}return null;})[_0x8108('0x15')](respondWithResult(_0x1dbfd0,null))[_0x8108('0x1f')](handleError(_0x1dbfd0,null));};exports[_0x8108('0x5a')]=function(_0xd59140,_0x15a524,_0x1e60c3){var _0x550dea=[{'name':'priority','label':_0x8108('0x5b'),'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 _0x12f35f='';return db[_0x8108('0x31')]['findOne']({'where':{'id':_0xd59140[_0x8108('0x48')]['id']},'attributes':['id',_0x8108('0x5c'),_0x8108('0x5d'),_0x8108('0x5e'),_0x8108('0x5f'),_0x8108('0x60'),_0x8108('0x61'),_0x8108('0x62'),'tokenSecret']})[_0x8108('0x15')](handleEntityNotFound(_0x15a524,null))[_0x8108('0x15')](function(_0x13b09e){if(_0x13b09e){_0x12f35f=_0x13b09e[_0x8108('0x5c')];var _0x479979=_0x12f35f['slice'](-0x1);if(_0x479979==='/'){_0x12f35f=_0x12f35f[_0x8108('0x63')](0x0,_0x12f35f[_0x8108('0x64')](_0x479979));}var _0x5e5a4f={'method':_0x8108('0x65'),'uri':util[_0x8108('0x66')](_0x8108('0x67'),_0x12f35f),'headers':{'Content-Type':_0x8108('0x68'),'Accept':_0x8108('0x68')},'json':!![]};if(_0x13b09e[_0x8108('0x5d')]===_0x8108('0x69')){_0x5e5a4f['headers'][_0x8108('0x6a')]=util['format'](_0x8108('0x6b'),new Buffer(util['format'](_0x8108('0x6c'),_0x13b09e[_0x8108('0x5e')],_0x13b09e['password']))[_0x8108('0x6d')](_0x8108('0x6e')));}return rp(_0x5e5a4f)[_0x8108('0x15')](function(_0x33311e){return _0x550dea[_0x8108('0x6f')](_[_0x8108('0x30')](_0x33311e['_embedded'][_0x8108('0x70')],function(_0xd987e1){return{'id':_0xd987e1[_0x8108('0x2d')],'name':_0xd987e1['name'],'type':_0xd987e1[_0x8108('0x34')],'active':_0xd987e1[_0x8108('0x71')],'label':_0xd987e1[_0x8108('0x72')],'custom':!![]};}));});}})[_0x8108('0x15')](function(_0x29585d){return{'count':_0x29585d[_0x8108('0x4a')],'rows':_0x29585d};})[_0x8108('0x15')](respondWithResult(_0x15a524,null))['catch'](function(_0x182213){var _0x6726cb=_0xd59140[_0x8108('0x36')][_0x8108('0x73')]?0x1f4:_0x182213[_0x8108('0x74')]||0x1f4;logger[_0x8108('0x1c')](_0x8108('0x75'),'getFields',_0x6726cb,JSON[_0x8108('0x1b')](_0x182213));delete _0x182213[_0x8108('0x2d')];if(_0x6726cb===0x191){_0x6726cb=0x190;}_0x15a524['status'](_0x6726cb)[_0x8108('0x2e')](_0xd59140[_0x8108('0x36')][_0x8108('0x73')]?{'message':_0x8108('0x76'),'statusCode':_0x182213[_0x8108('0x74')]}:_0x182213);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 1536d86..ba7ac4b 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 _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 +var _0x5a7a=['request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','util','bluebird'];(function(_0x14880a,_0x887207){var _0x2cefc3=function(_0x4827f4){while(--_0x4827f4){_0x14880a['push'](_0x14880a['shift']());}};_0x2cefc3(++_0x887207);}(_0x5a7a,0x14d));var _0xa5a7=function(_0x344e06,_0x161183){_0x344e06=_0x344e06-0x0;var _0x60846a=_0x5a7a[_0x344e06];return _0x60846a;};'use strict';var _=require(_0xa5a7('0x0'));var util=require(_0xa5a7('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa5a7('0x2'));var rp=require(_0xa5a7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5a7('0x4'));var config=require(_0xa5a7('0x5'));var attributes=require(_0xa5a7('0x6'));var integrations=require(_0xa5a7('0x7'));module[_0xa5a7('0x8')]=function(_0x3f5d20,_0x427646){return _0x3f5d20[_0xa5a7('0x9')](_0xa5a7('0xa'),attributes,{'tableName':_0xa5a7('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 807bf2b..7921c9d 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 _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 +var _0x1d5a=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','model','map','debug','find','ShowDeskAccount','lodash','moment','bluebird'];(function(_0x3d6b4a,_0x3607f2){var _0x522316=function(_0x434d1c){while(--_0x434d1c){_0x3d6b4a['push'](_0x3d6b4a['shift']());}};_0x522316(++_0x3607f2);}(_0x1d5a,0x173));var _0xa1d5=function(_0x1cb094,_0x5da9e2){_0x1cb094=_0x1cb094-0x0;var _0x1f521b=_0x1d5a[_0x1cb094];return _0x1f521b;};'use strict';var _=require(_0xa1d5('0x0'));var util=require('util');var moment=require(_0xa1d5('0x1'));var BPromise=require(_0xa1d5('0x2'));var rs=require(_0xa1d5('0x3'));var fs=require('fs');var Redis=require(_0xa1d5('0x4'));var db=require(_0xa1d5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa1d5('0x6'));var config=require(_0xa1d5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa1d5('0x8')][_0xa1d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fcc8a,_0x52928d,_0x17342a){return new BPromise(function(_0x5e802f,_0x1b6714){return client[_0xa1d5('0xa')](_0x1fcc8a,_0x17342a)[_0xa1d5('0xb')](function(_0x1e0c8a){logger['info'](_0xa1d5('0xc'),_0x52928d,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x52928d,_0xa1d5('0xd'),JSON[_0xa1d5('0xe')](_0x1e0c8a));if(_0x1e0c8a['error']){if(_0x1e0c8a[_0xa1d5('0xf')][_0xa1d5('0x10')]===0x1f4){logger[_0xa1d5('0xf')](_0xa1d5('0xc'),_0x52928d,_0x1e0c8a['error'][_0xa1d5('0x11')]);return _0x1b6714(_0x1e0c8a[_0xa1d5('0xf')]['message']);}logger[_0xa1d5('0xf')](_0xa1d5('0xc'),_0x52928d,_0x1e0c8a[_0xa1d5('0xf')][_0xa1d5('0x11')]);return _0x5e802f(_0x1e0c8a[_0xa1d5('0xf')][_0xa1d5('0x11')]);}else{logger[_0xa1d5('0x12')](_0xa1d5('0xc'),_0x52928d,_0xa1d5('0xd'));_0x5e802f(_0x1e0c8a[_0xa1d5('0x13')][_0xa1d5('0x11')]);}})[_0xa1d5('0x14')](function(_0x1ba92c){logger[_0xa1d5('0xf')](_0xa1d5('0xc'),_0x52928d,_0x1ba92c);_0x1b6714(_0x1ba92c);});});}exports[_0xa1d5('0x15')]=function(_0x1d98e8){var _0x49512f=this;return new Promise(function(_0x3341cb,_0x55cd69){return db[_0xa1d5('0x16')]['findAll']({'raw':_0x1d98e8['options']?_0x1d98e8[_0xa1d5('0x17')][_0xa1d5('0x18')]===undefined?!![]:![]:!![],'where':_0x1d98e8[_0xa1d5('0x17')]?_0x1d98e8[_0xa1d5('0x17')][_0xa1d5('0x19')]||null:null,'attributes':_0x1d98e8[_0xa1d5('0x17')]?_0x1d98e8[_0xa1d5('0x17')][_0xa1d5('0x1a')]||null:null,'limit':_0x1d98e8[_0xa1d5('0x17')]?_0x1d98e8[_0xa1d5('0x17')][_0xa1d5('0x1b')]||null:null,'include':_0x1d98e8['options']?_0x1d98e8[_0xa1d5('0x17')]['include']?_['map'](_0x1d98e8[_0xa1d5('0x17')][_0xa1d5('0x1c')],function(_0x4ffc67){return{'model':db[_0x4ffc67[_0xa1d5('0x1d')]],'as':_0x4ffc67['as'],'attributes':_0x4ffc67[_0xa1d5('0x1a')],'include':_0x4ffc67['include']?_[_0xa1d5('0x1e')](_0x4ffc67[_0xa1d5('0x1c')],function(_0x109fae){return{'model':db[_0x109fae['model']],'as':_0x109fae['as'],'attributes':_0x109fae[_0xa1d5('0x1a')],'include':_0x109fae['include']?_['map'](_0x109fae['include'],function(_0x1c52cd){return{'model':db[_0x1c52cd['model']],'as':_0x1c52cd['as'],'attributes':_0x1c52cd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x38273f){logger['info'](_0xa1d5('0x15'),_0x1d98e8);logger[_0xa1d5('0x1f')](_0xa1d5('0x15'),_0x1d98e8,JSON[_0xa1d5('0xe')](_0x38273f));_0x3341cb(_0x38273f);})[_0xa1d5('0x14')](function(_0x2ad0b1){logger['error']('GetDeskAccount',_0x2ad0b1[_0xa1d5('0x11')],_0x1d98e8);_0x55cd69(_0x49512f[_0xa1d5('0xf')](0x1f4,_0x2ad0b1[_0xa1d5('0x11')]));});});};exports['ShowDeskAccount']=function(_0x1a1e40){var _0x46e733=this;return new Promise(function(_0x11b9c6,_0x31f064){return db[_0xa1d5('0x16')][_0xa1d5('0x20')]({'raw':_0x1a1e40[_0xa1d5('0x17')]?_0x1a1e40[_0xa1d5('0x17')][_0xa1d5('0x18')]===undefined?!![]:![]:!![],'where':_0x1a1e40['options']?_0x1a1e40[_0xa1d5('0x17')][_0xa1d5('0x19')]||null:null,'attributes':_0x1a1e40[_0xa1d5('0x17')]?_0x1a1e40[_0xa1d5('0x17')][_0xa1d5('0x1a')]||null:null,'include':_0x1a1e40[_0xa1d5('0x17')]?_0x1a1e40[_0xa1d5('0x17')][_0xa1d5('0x1c')]?_[_0xa1d5('0x1e')](_0x1a1e40['options'][_0xa1d5('0x1c')],function(_0x3b6ae5){return{'model':db[_0x3b6ae5[_0xa1d5('0x1d')]],'as':_0x3b6ae5['as'],'attributes':_0x3b6ae5['attributes'],'include':_0x3b6ae5['include']?_['map'](_0x3b6ae5[_0xa1d5('0x1c')],function(_0x3fec96){return{'model':db[_0x3fec96[_0xa1d5('0x1d')]],'as':_0x3fec96['as'],'attributes':_0x3fec96[_0xa1d5('0x1a')],'include':_0x3fec96['include']?_[_0xa1d5('0x1e')](_0x3fec96[_0xa1d5('0x1c')],function(_0x461818){return{'model':db[_0x461818['model']],'as':_0x461818['as'],'attributes':_0x461818[_0xa1d5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1d5('0xb')](function(_0x3b5067){logger[_0xa1d5('0x12')]('ShowDeskAccount',_0x1a1e40);logger['debug'](_0xa1d5('0x21'),_0x1a1e40,JSON[_0xa1d5('0xe')](_0x3b5067));_0x11b9c6(_0x3b5067);})[_0xa1d5('0x14')](function(_0x55851d){logger[_0xa1d5('0xf')](_0xa1d5('0x21'),_0x55851d[_0xa1d5('0x11')],_0x1a1e40);_0x31f064(_0x46e733[_0xa1d5('0xf')](0x1f4,_0x55851d[_0xa1d5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index ab94dce..7262a7d 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 _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 +var _0xac6a=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','setTags'];(function(_0x124601,_0x3b187b){var _0x2b20fb=function(_0x2ba7cb){while(--_0x2ba7cb){_0x124601['push'](_0x124601['shift']());}};_0x2b20fb(++_0x3b187b);}(_0xac6a,0xc2));var _0xaac6=function(_0x46701e,_0xb13c13){_0x46701e=_0x46701e-0x0;var _0x5a7890=_0xac6a[_0x46701e];return _0x5a7890;};'use strict';var multer=require(_0xaac6('0x0'));var util=require(_0xaac6('0x1'));var path=require(_0xaac6('0x2'));var timeout=require(_0xaac6('0x3'));var express=require(_0xaac6('0x4'));var router=express['Router']();var auth=require(_0xaac6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xaac6('0x6'));var controller=require(_0xaac6('0x7'));router[_0xaac6('0x8')]('/',auth[_0xaac6('0x9')](),controller[_0xaac6('0xa')]);router[_0xaac6('0x8')](_0xaac6('0xb'),auth[_0xaac6('0x9')](),controller[_0xaac6('0xc')]);router[_0xaac6('0x8')](_0xaac6('0xd'),auth[_0xaac6('0x9')](),controller['getFields']);router[_0xaac6('0x8')](_0xaac6('0xe'),auth[_0xaac6('0x9')](),controller[_0xaac6('0xf')]);router[_0xaac6('0x8')](_0xaac6('0x10'),auth['isAuthenticated'](),controller[_0xaac6('0x11')]);router[_0xaac6('0x8')](_0xaac6('0x12'),auth[_0xaac6('0x9')](),controller[_0xaac6('0x13')]);router['post']('/',auth[_0xaac6('0x9')](),controller[_0xaac6('0x14')]);router['post']('/:id/tags',auth[_0xaac6('0x9')](),controller[_0xaac6('0x15')]);router[_0xaac6('0x16')](_0xaac6('0xb'),auth[_0xaac6('0x9')](),controller[_0xaac6('0x17')]);router[_0xaac6('0x18')](_0xaac6('0xb'),auth[_0xaac6('0x9')](),controller[_0xaac6('0x19')]);module[_0xaac6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index f8a4925..3857dc2 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 _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 +var _0x4906=['exports','STRING','sequelize'];(function(_0x5f55b8,_0x521528){var _0x8ffd4e=function(_0x1bb87b){while(--_0x1bb87b){_0x5f55b8['push'](_0x5f55b8['shift']());}};_0x8ffd4e(++_0x521528);}(_0x4906,0x12b));var _0x6490=function(_0x1aed94,_0x59ca41){_0x1aed94=_0x1aed94-0x0;var _0x1c91f6=_0x4906[_0x1aed94];return _0x1c91f6;};'use strict';var Sequelize=require(_0x6490('0x0'));module[_0x6490('0x1')]={'name':{'type':Sequelize[_0x6490('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 592403d..ffeb83c 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 _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 +var _0x3f03=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','include','catch','show','params','keys','includeAll','find','create','body','findOne','pick','getFields','getSubjects','DeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3f03,0x160));var _0x33f0=function(_0x4c9bbf,_0x2c48db){_0x4c9bbf=_0x4c9bbf-0x0;var _0x16129b=_0x3f03[_0x4c9bbf];return _0x16129b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x33f0('0x0'));var rimraf=require(_0x33f0('0x1'));var zipdir=require(_0x33f0('0x2'));var jsonpatch=require(_0x33f0('0x3'));var rp=require(_0x33f0('0x4'));var moment=require('moment');var BPromise=require(_0x33f0('0x5'));var Mustache=require(_0x33f0('0x6'));var util=require(_0x33f0('0x7'));var path=require(_0x33f0('0x8'));var sox=require('sox');var csv=require(_0x33f0('0x9'));var ejs=require(_0x33f0('0xa'));var fs=require('fs');var _=require(_0x33f0('0xb'));var squel=require(_0x33f0('0xc'));var crypto=require(_0x33f0('0xd'));var jsforce=require(_0x33f0('0xe'));var deskjs=require(_0x33f0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x33f0('0x10'));var Papa=require('papaparse');var Redis=require(_0x33f0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x33f0('0x12'));var as=require(_0x33f0('0x13'));var hardwareService=require(_0x33f0('0x14'));var logger=require(_0x33f0('0x15'))(_0x33f0('0x16'));var utils=require(_0x33f0('0x17'));var config=require(_0x33f0('0x18'));var licenseUtil=require(_0x33f0('0x19'));var db=require(_0x33f0('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x33f0('0x1b')][_0x33f0('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x4c239a,_0x3f7396,_0x2d9640,_0x20441c){return new BPromise(function(_0x2deb0d,_0x95212a){var _0xa31ace=_0x20441c||client;return _0xa31ace[_0x33f0('0x1d')](_0x4c239a,_0x2d9640)[_0x33f0('0x1e')](function(_0x579744){logger[_0x33f0('0x1f')](_0x33f0('0x20'),_0x3f7396,'request\x20sent');logger[_0x33f0('0x21')](_0x33f0('0x22'),_0x3f7396,'request\x20sent',JSON[_0x33f0('0x23')](_0x579744));if(_0x579744[_0x33f0('0x24')]){if(_0x579744[_0x33f0('0x24')]['code']===0x1f4){logger[_0x33f0('0x24')](_0x33f0('0x20'),_0x3f7396,_0x579744[_0x33f0('0x24')]['message']);return _0x95212a(_0x579744[_0x33f0('0x24')][_0x33f0('0x25')]);}logger[_0x33f0('0x24')](_0x33f0('0x20'),_0x3f7396,_0x579744[_0x33f0('0x24')][_0x33f0('0x25')]);return _0x2deb0d(_0x579744[_0x33f0('0x24')][_0x33f0('0x25')]);}else{logger[_0x33f0('0x1f')]('DeskConfiguration,\x20%s,\x20%s',_0x3f7396,'request\x20sent');_0x2deb0d(_0x579744[_0x33f0('0x26')][_0x33f0('0x25')]);}})['catch'](function(_0x429b60){logger[_0x33f0('0x24')](_0x33f0('0x20'),_0x3f7396,_0x429b60);_0x95212a(_0x429b60);});});}function respondWithStatusCode(_0x44d297,_0x18d781){_0x18d781=_0x18d781||0xcc;return function(_0x400915){if(_0x400915){return _0x44d297[_0x33f0('0x27')](_0x18d781);}return _0x44d297[_0x33f0('0x28')](_0x18d781)[_0x33f0('0x29')]();};}function respondWithResult(_0x2700ec,_0x851542){_0x851542=_0x851542||0xc8;return function(_0x134388){if(_0x134388){return _0x2700ec[_0x33f0('0x28')](_0x851542)[_0x33f0('0x2a')](_0x134388);}};}function respondWithFilteredResult(_0x1ef6e3,_0x15bef3){return function(_0x7ead65){if(_0x7ead65){var _0x551085=_0x7ead65[_0x33f0('0x2b')],_0x42eebd=_0x15bef3[_0x33f0('0x2c')],_0x234457=_0x15bef3[_0x33f0('0x2c')]+_0x15bef3[_0x33f0('0x2d')],_0x1a9b47;if(_0x234457>=_0x551085){_0x234457=_0x551085;_0x1a9b47=0xc8;}else{_0x1a9b47=0xce;}_0x1ef6e3[_0x33f0('0x28')](_0x1a9b47);return _0x1ef6e3[_0x33f0('0x2e')](_0x33f0('0x2f'),_0x42eebd+'-'+_0x234457+'/'+_0x551085)['json'](_0x7ead65);}return null;};}function patchUpdates(_0x525c09){return function(_0x5d3431){try{jsonpatch[_0x33f0('0x30')](_0x5d3431,_0x525c09,!![]);}catch(_0xc81c7){return BPromise[_0x33f0('0x31')](_0xc81c7);}return _0x5d3431['save']();};}function saveUpdates(_0x54532c,_0x1d528b){return function(_0x112fd8){if(_0x112fd8){return _0x112fd8[_0x33f0('0x32')](_0x54532c)[_0x33f0('0x1e')](function(_0x44427f){return _0x44427f;});}return null;};}function removeEntity(_0x56077c,_0x574ca8){return function(_0x2c1edf){if(_0x2c1edf){return _0x2c1edf[_0x33f0('0x33')]()[_0x33f0('0x1e')](function(){_0x56077c['status'](0xcc)[_0x33f0('0x29')]();});}};}function handleEntityNotFound(_0x48c05a,_0x266b45){return function(_0x4cf779){if(!_0x4cf779){_0x48c05a[_0x33f0('0x27')](0x194);}return _0x4cf779;};}function handleError(_0x49b49a,_0x40cf48){_0x40cf48=_0x40cf48||0x1f4;return function(_0x444c38){logger['error'](_0x444c38[_0x33f0('0x34')]);if(_0x444c38['name']){delete _0x444c38['name'];}_0x49b49a[_0x33f0('0x28')](_0x40cf48)[_0x33f0('0x35')](_0x444c38);};}exports['index']=function(_0x16ac5d,_0x378575){var _0x1b2c1b={},_0x5f40d8={},_0x3dddf8={'count':0x0,'rows':[]};var _0x48c4f6=_['map'](db[_0x33f0('0x36')][_0x33f0('0x37')],function(_0x53695d){return{'name':_0x53695d[_0x33f0('0x38')],'type':_0x53695d[_0x33f0('0x39')]['key']};});_0x5f40d8[_0x33f0('0x3a')]=_[_0x33f0('0x3b')](_0x48c4f6,_0x33f0('0x3c'));_0x5f40d8['query']=_['keys'](_0x16ac5d[_0x33f0('0x3d')]);_0x5f40d8[_0x33f0('0x3e')]=_[_0x33f0('0x3f')](_0x5f40d8['model'],_0x5f40d8[_0x33f0('0x3d')]);_0x1b2c1b[_0x33f0('0x40')]=_[_0x33f0('0x3f')](_0x5f40d8[_0x33f0('0x3a')],qs[_0x33f0('0x41')](_0x16ac5d['query'][_0x33f0('0x41')]));_0x1b2c1b[_0x33f0('0x40')]=_0x1b2c1b['attributes'][_0x33f0('0x42')]?_0x1b2c1b[_0x33f0('0x40')]:_0x5f40d8[_0x33f0('0x3a')];if(!_0x16ac5d[_0x33f0('0x3d')][_0x33f0('0x43')](_0x33f0('0x44'))){_0x1b2c1b[_0x33f0('0x2d')]=qs['limit'](_0x16ac5d[_0x33f0('0x3d')][_0x33f0('0x2d')]);_0x1b2c1b[_0x33f0('0x2c')]=qs[_0x33f0('0x2c')](_0x16ac5d[_0x33f0('0x3d')]['offset']);}_0x1b2c1b[_0x33f0('0x45')]=qs['sort'](_0x16ac5d['query'][_0x33f0('0x46')]);_0x1b2c1b['where']=qs[_0x33f0('0x3e')](_['pick'](_0x16ac5d[_0x33f0('0x3d')],_0x5f40d8['filters']),_0x48c4f6);if(_0x16ac5d[_0x33f0('0x3d')][_0x33f0('0x47')]){_0x1b2c1b['where']=_[_0x33f0('0x48')](_0x1b2c1b[_0x33f0('0x49')],{'$or':_[_0x33f0('0x3b')](_0x48c4f6,function(_0x1e17d7){if(_0x1e17d7[_0x33f0('0x39')]!==_0x33f0('0x4a')){var _0x26a2d9={};_0x26a2d9[_0x1e17d7['name']]={'$like':'%'+_0x16ac5d[_0x33f0('0x3d')][_0x33f0('0x47')]+'%'};return _0x26a2d9;}})});}_0x1b2c1b=_[_0x33f0('0x48')]({},_0x1b2c1b,_0x16ac5d[_0x33f0('0x4b')]);var _0x4dfaf2={'where':_0x1b2c1b[_0x33f0('0x49')]};return db[_0x33f0('0x36')][_0x33f0('0x2b')](_0x4dfaf2)[_0x33f0('0x1e')](function(_0x47f98a){_0x3dddf8['count']=_0x47f98a;if(_0x16ac5d[_0x33f0('0x3d')]['includeAll']){_0x1b2c1b[_0x33f0('0x4c')]=[{'all':!![]}];}return db[_0x33f0('0x36')]['findAll'](_0x1b2c1b);})[_0x33f0('0x1e')](function(_0x2bfc8e){_0x3dddf8['rows']=_0x2bfc8e;return _0x3dddf8;})['then'](respondWithFilteredResult(_0x378575,_0x1b2c1b))[_0x33f0('0x4d')](handleError(_0x378575,null));};exports[_0x33f0('0x4e')]=function(_0x4faa56,_0x5e7522){var _0x33fe13={'raw':![],'where':{'id':_0x4faa56[_0x33f0('0x4f')]['id']}},_0x51074e={};_0x51074e[_0x33f0('0x3a')]=_['keys'](db[_0x33f0('0x36')][_0x33f0('0x37')]);_0x51074e[_0x33f0('0x3d')]=_[_0x33f0('0x50')](_0x4faa56[_0x33f0('0x3d')]);_0x51074e[_0x33f0('0x3e')]=_['intersection'](_0x51074e['model'],_0x51074e['query']);_0x33fe13[_0x33f0('0x40')]=_['intersection'](_0x51074e[_0x33f0('0x3a')],qs['fields'](_0x4faa56['query']['fields']));_0x33fe13[_0x33f0('0x40')]=_0x33fe13['attributes'][_0x33f0('0x42')]?_0x33fe13[_0x33f0('0x40')]:_0x51074e[_0x33f0('0x3a')];if(_0x4faa56['query'][_0x33f0('0x51')]){_0x33fe13[_0x33f0('0x4c')]=[{'all':!![]}];}_0x33fe13=_['merge']({},_0x33fe13,_0x4faa56[_0x33f0('0x4b')]);return db['DeskConfiguration'][_0x33f0('0x52')](_0x33fe13)[_0x33f0('0x1e')](handleEntityNotFound(_0x5e7522,null))[_0x33f0('0x1e')](respondWithResult(_0x5e7522,null))['catch'](handleError(_0x5e7522,null));};exports['create']=function(_0x25a478,_0xec1176){return db[_0x33f0('0x36')][_0x33f0('0x53')](_0x25a478[_0x33f0('0x54')],{})[_0x33f0('0x1e')](respondWithResult(_0xec1176,0xc9))[_0x33f0('0x4d')](handleError(_0xec1176,null));};exports[_0x33f0('0x32')]=function(_0x367443,_0x37bec0){if(_0x367443[_0x33f0('0x54')]['id']){delete _0x367443[_0x33f0('0x54')]['id'];}return db[_0x33f0('0x36')][_0x33f0('0x52')]({'where':{'id':_0x367443[_0x33f0('0x4f')]['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x37bec0,null))[_0x33f0('0x1e')](saveUpdates(_0x367443[_0x33f0('0x54')],null))['then'](respondWithResult(_0x37bec0,null))[_0x33f0('0x4d')](handleError(_0x37bec0,null));};exports[_0x33f0('0x33')]=function(_0x59cdd3,_0x396338){return db[_0x33f0('0x36')][_0x33f0('0x52')]({'where':{'id':_0x59cdd3[_0x33f0('0x4f')]['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x396338,null))[_0x33f0('0x1e')](removeEntity(_0x396338,null))['catch'](handleError(_0x396338,null));};exports['getFields']=function(_0x4b2ad7,_0x507f95,_0x93285e){var _0x55ba73={};var _0x3a3dde={};var _0x147653;var _0x431ed4;return db[_0x33f0('0x36')][_0x33f0('0x55')]({'where':{'id':_0x4b2ad7[_0x33f0('0x4f')]['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x507f95,null))['then'](function(_0xa948c5){if(_0xa948c5){_0x147653=_0xa948c5;_0x3a3dde[_0x33f0('0x3a')]=_[_0x33f0('0x50')](db['DeskField'][_0x33f0('0x37')]);_0x3a3dde['query']=_[_0x33f0('0x50')](_0x4b2ad7[_0x33f0('0x3d')]);_0x3a3dde[_0x33f0('0x3e')]=_[_0x33f0('0x3f')](_0x3a3dde[_0x33f0('0x3a')],_0x3a3dde[_0x33f0('0x3d')]);_0x55ba73[_0x33f0('0x40')]=_[_0x33f0('0x3f')](_0x3a3dde[_0x33f0('0x3a')],qs[_0x33f0('0x41')](_0x4b2ad7[_0x33f0('0x3d')][_0x33f0('0x41')]));_0x55ba73[_0x33f0('0x40')]=_0x55ba73[_0x33f0('0x40')][_0x33f0('0x42')]?_0x55ba73['attributes']:_0x3a3dde[_0x33f0('0x3a')];_0x55ba73['order']=qs[_0x33f0('0x46')](_0x4b2ad7[_0x33f0('0x3d')][_0x33f0('0x46')]);_0x55ba73['where']=qs['filters'](_[_0x33f0('0x56')](_0x4b2ad7['query'],_0x3a3dde[_0x33f0('0x3e')]));if(_0x4b2ad7[_0x33f0('0x3d')][_0x33f0('0x47')]){_0x55ba73['where']=_[_0x33f0('0x48')](_0x55ba73[_0x33f0('0x49')],{'$or':_['map'](_0x55ba73[_0x33f0('0x40')],function(_0x432583){var _0x480a17={};_0x480a17[_0x432583]={'$like':'%'+_0x4b2ad7[_0x33f0('0x3d')]['filter']+'%'};return _0x480a17;})});}_0x55ba73=_['merge']({},_0x55ba73,_0x4b2ad7[_0x33f0('0x4b')]);return _0x147653['getFields'](_0x55ba73);}})[_0x33f0('0x1e')](function(_0x21c917){if(_0x21c917){_0x431ed4=_0x21c917[_0x33f0('0x42')];if(!_0x4b2ad7['query'][_0x33f0('0x43')](_0x33f0('0x44'))){_0x55ba73[_0x33f0('0x2d')]=qs[_0x33f0('0x2d')](_0x4b2ad7[_0x33f0('0x3d')][_0x33f0('0x2d')]);_0x55ba73['offset']=qs[_0x33f0('0x2c')](_0x4b2ad7[_0x33f0('0x3d')][_0x33f0('0x2c')]);}return _0x147653[_0x33f0('0x57')](_0x55ba73);}})[_0x33f0('0x1e')](function(_0x137829){if(_0x137829){return _0x137829?{'count':_0x431ed4,'rows':_0x137829}:null;}})[_0x33f0('0x1e')](respondWithResult(_0x507f95,null))[_0x33f0('0x4d')](handleError(_0x507f95,null));};exports[_0x33f0('0x58')]=function(_0x7320d4,_0x131275,_0x20f844){var _0x246fe0={};var _0x4aa686={};var _0x5d783e;var _0x7db2be;return db[_0x33f0('0x36')][_0x33f0('0x55')]({'where':{'id':_0x7320d4['params']['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x131275,null))[_0x33f0('0x1e')](function(_0x320d4f){if(_0x320d4f){_0x5d783e=_0x320d4f;_0x4aa686[_0x33f0('0x3a')]=_[_0x33f0('0x50')](db['DeskField'][_0x33f0('0x37')]);_0x4aa686[_0x33f0('0x3d')]=_[_0x33f0('0x50')](_0x7320d4[_0x33f0('0x3d')]);_0x4aa686[_0x33f0('0x3e')]=_[_0x33f0('0x3f')](_0x4aa686[_0x33f0('0x3a')],_0x4aa686[_0x33f0('0x3d')]);_0x246fe0['attributes']=_['intersection'](_0x4aa686[_0x33f0('0x3a')],qs['fields'](_0x7320d4[_0x33f0('0x3d')][_0x33f0('0x41')]));_0x246fe0[_0x33f0('0x40')]=_0x246fe0['attributes'][_0x33f0('0x42')]?_0x246fe0[_0x33f0('0x40')]:_0x4aa686[_0x33f0('0x3a')];_0x246fe0[_0x33f0('0x45')]=qs[_0x33f0('0x46')](_0x7320d4[_0x33f0('0x3d')][_0x33f0('0x46')]);_0x246fe0[_0x33f0('0x49')]=qs['filters'](_[_0x33f0('0x56')](_0x7320d4[_0x33f0('0x3d')],_0x4aa686['filters']));if(_0x7320d4[_0x33f0('0x3d')][_0x33f0('0x47')]){_0x246fe0[_0x33f0('0x49')]=_[_0x33f0('0x48')](_0x246fe0[_0x33f0('0x49')],{'$or':_[_0x33f0('0x3b')](_0x246fe0[_0x33f0('0x40')],function(_0x4ded68){var _0x3840cd={};_0x3840cd[_0x4ded68]={'$like':'%'+_0x7320d4[_0x33f0('0x3d')][_0x33f0('0x47')]+'%'};return _0x3840cd;})});}_0x246fe0=_[_0x33f0('0x48')]({},_0x246fe0,_0x7320d4['options']);return _0x5d783e['getSubjects'](_0x246fe0);}})[_0x33f0('0x1e')](function(_0x30c966){if(_0x30c966){_0x7db2be=_0x30c966[_0x33f0('0x42')];if(!_0x7320d4['query']['hasOwnProperty'](_0x33f0('0x44'))){_0x246fe0[_0x33f0('0x2d')]=qs['limit'](_0x7320d4[_0x33f0('0x3d')][_0x33f0('0x2d')]);_0x246fe0['offset']=qs['offset'](_0x7320d4[_0x33f0('0x3d')][_0x33f0('0x2c')]);}return _0x5d783e[_0x33f0('0x58')](_0x246fe0);}})['then'](function(_0x191e48){if(_0x191e48){return _0x191e48?{'count':_0x7db2be,'rows':_0x191e48}:null;}})[_0x33f0('0x1e')](respondWithResult(_0x131275,null))['catch'](handleError(_0x131275,null));};exports['getDescriptions']=function(_0x37920e,_0x5af280,_0x4ec9be){var _0x7054d7={};var _0x172db3={};var _0x17555b;var _0x5f3f99;return db[_0x33f0('0x36')]['findOne']({'where':{'id':_0x37920e[_0x33f0('0x4f')]['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x5af280,null))[_0x33f0('0x1e')](function(_0x2d0cbe){if(_0x2d0cbe){_0x17555b=_0x2d0cbe;_0x172db3[_0x33f0('0x3a')]=_[_0x33f0('0x50')](db[_0x33f0('0x59')][_0x33f0('0x37')]);_0x172db3[_0x33f0('0x3d')]=_['keys'](_0x37920e[_0x33f0('0x3d')]);_0x172db3[_0x33f0('0x3e')]=_[_0x33f0('0x3f')](_0x172db3['model'],_0x172db3[_0x33f0('0x3d')]);_0x7054d7[_0x33f0('0x40')]=_['intersection'](_0x172db3['model'],qs[_0x33f0('0x41')](_0x37920e[_0x33f0('0x3d')][_0x33f0('0x41')]));_0x7054d7[_0x33f0('0x40')]=_0x7054d7[_0x33f0('0x40')][_0x33f0('0x42')]?_0x7054d7[_0x33f0('0x40')]:_0x172db3[_0x33f0('0x3a')];_0x7054d7[_0x33f0('0x45')]=qs[_0x33f0('0x46')](_0x37920e[_0x33f0('0x3d')][_0x33f0('0x46')]);_0x7054d7[_0x33f0('0x49')]=qs[_0x33f0('0x3e')](_[_0x33f0('0x56')](_0x37920e[_0x33f0('0x3d')],_0x172db3['filters']));if(_0x37920e[_0x33f0('0x3d')]['filter']){_0x7054d7[_0x33f0('0x49')]=_[_0x33f0('0x48')](_0x7054d7[_0x33f0('0x49')],{'$or':_['map'](_0x7054d7[_0x33f0('0x40')],function(_0x2f7b6b){var _0x15fc9d={};_0x15fc9d[_0x2f7b6b]={'$like':'%'+_0x37920e[_0x33f0('0x3d')][_0x33f0('0x47')]+'%'};return _0x15fc9d;})});}_0x7054d7=_[_0x33f0('0x48')]({},_0x7054d7,_0x37920e['options']);return _0x17555b[_0x33f0('0x5a')](_0x7054d7);}})[_0x33f0('0x1e')](function(_0x596513){if(_0x596513){_0x5f3f99=_0x596513[_0x33f0('0x42')];if(!_0x37920e[_0x33f0('0x3d')][_0x33f0('0x43')](_0x33f0('0x44'))){_0x7054d7[_0x33f0('0x2d')]=qs[_0x33f0('0x2d')](_0x37920e[_0x33f0('0x3d')][_0x33f0('0x2d')]);_0x7054d7[_0x33f0('0x2c')]=qs['offset'](_0x37920e['query']['offset']);}return _0x17555b[_0x33f0('0x5a')](_0x7054d7);}})[_0x33f0('0x1e')](function(_0x3b48ad){if(_0x3b48ad){return _0x3b48ad?{'count':_0x5f3f99,'rows':_0x3b48ad}:null;}})[_0x33f0('0x1e')](respondWithResult(_0x5af280,null))[_0x33f0('0x4d')](handleError(_0x5af280,null));};exports[_0x33f0('0x5b')]=function(_0x491081,_0x3e156c,_0x46a887){var _0xbd9896={};var _0x1f5de9={};var _0x1f7ec1;var _0x5f411d;return db['DeskConfiguration'][_0x33f0('0x55')]({'where':{'id':_0x491081[_0x33f0('0x4f')]['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x3e156c,null))['then'](function(_0x33bd0c){if(_0x33bd0c){_0x1f7ec1=_0x33bd0c;_0x1f5de9['model']=_['keys'](db[_0x33f0('0x5c')][_0x33f0('0x37')]);_0x1f5de9[_0x33f0('0x3d')]=_['keys'](_0x491081[_0x33f0('0x3d')]);_0x1f5de9[_0x33f0('0x3e')]=_[_0x33f0('0x3f')](_0x1f5de9[_0x33f0('0x3a')],_0x1f5de9[_0x33f0('0x3d')]);_0xbd9896[_0x33f0('0x40')]=_[_0x33f0('0x3f')](_0x1f5de9[_0x33f0('0x3a')],qs['fields'](_0x491081[_0x33f0('0x3d')][_0x33f0('0x41')]));_0xbd9896[_0x33f0('0x40')]=_0xbd9896['attributes'][_0x33f0('0x42')]?_0xbd9896[_0x33f0('0x40')]:_0x1f5de9['model'];_0xbd9896[_0x33f0('0x45')]=qs[_0x33f0('0x46')](_0x491081[_0x33f0('0x3d')]['sort']);_0xbd9896['where']=qs[_0x33f0('0x3e')](_[_0x33f0('0x56')](_0x491081[_0x33f0('0x3d')],_0x1f5de9['filters']));if(_0x491081[_0x33f0('0x3d')][_0x33f0('0x47')]){_0xbd9896['where']=_[_0x33f0('0x48')](_0xbd9896[_0x33f0('0x49')],{'$or':_[_0x33f0('0x3b')](_0xbd9896['attributes'],function(_0x5c2180){var _0x12444e={};_0x12444e[_0x5c2180]={'$like':'%'+_0x491081[_0x33f0('0x3d')][_0x33f0('0x47')]+'%'};return _0x12444e;})});}_0xbd9896=_[_0x33f0('0x48')]({},_0xbd9896,_0x491081[_0x33f0('0x4b')]);return _0x1f7ec1[_0x33f0('0x5b')](_0xbd9896);}})[_0x33f0('0x1e')](function(_0x5b2b09){if(_0x5b2b09){_0x5f411d=_0x5b2b09['length'];if(!_0x491081[_0x33f0('0x3d')][_0x33f0('0x43')]('nolimit')){_0xbd9896[_0x33f0('0x2d')]=qs[_0x33f0('0x2d')](_0x491081[_0x33f0('0x3d')][_0x33f0('0x2d')]);_0xbd9896[_0x33f0('0x2c')]=qs[_0x33f0('0x2c')](_0x491081['query']['offset']);}return _0x1f7ec1[_0x33f0('0x5b')](_0xbd9896);}})[_0x33f0('0x1e')](function(_0x1b69bb){if(_0x1b69bb){return _0x1b69bb?{'count':_0x5f411d,'rows':_0x1b69bb}:null;}})[_0x33f0('0x1e')](respondWithResult(_0x3e156c,null))['catch'](handleError(_0x3e156c,null));};exports[_0x33f0('0x5d')]=function(_0x5e6792,_0x417ff0,_0x544076){if(_0x5e6792['body']['id']){delete _0x5e6792[_0x33f0('0x54')]['id'];}return db['DeskConfiguration'][_0x33f0('0x55')]({'where':{'id':_0x5e6792[_0x33f0('0x4f')]['id']}})[_0x33f0('0x1e')](handleEntityNotFound(_0x417ff0,null))[_0x33f0('0x1e')](function(_0x598a76){if(_0x598a76){return _0x598a76[_0x33f0('0x5d')](_0x5e6792[_0x33f0('0x54')][_0x33f0('0x5e')]||[]);}return null;})[_0x33f0('0x1e')](respondWithResult(_0x417ff0,null))[_0x33f0('0x4d')](handleError(_0x417ff0,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c8d39a4..020d467 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 _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 +var _0xe36c=['moment','bluebird','request-promise','path','../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api'];(function(_0x3febee,_0x5d0d8a){var _0x407c7a=function(_0x46c90b){while(--_0x46c90b){_0x3febee['push'](_0x3febee['shift']());}};_0x407c7a(++_0x5d0d8a);}(_0xe36c,0xef));var _0xce36=function(_0x15a6ed,_0x456457){_0x15a6ed=_0x15a6ed-0x0;var _0x5f37a5=_0xe36c[_0x15a6ed];return _0x5f37a5;};'use strict';var _=require(_0xce36('0x0'));var util=require('util');var logger=require(_0xce36('0x1'))(_0xce36('0x2'));var moment=require(_0xce36('0x3'));var BPromise=require(_0xce36('0x4'));var rp=require(_0xce36('0x5'));var fs=require('fs');var path=require(_0xce36('0x6'));var rimraf=require('rimraf');var config=require(_0xce36('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0xce36('0x8')]=function(_0x58e76b,_0x368892){return _0x58e76b['define'](_0xce36('0x9'),attributes,{'tableName':_0xce36('0xa'),'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 de59379..5d0d97f 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 _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 +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0xe5b5[_0x999b85];return _0x1d7124;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index b5c3cbf..194497a 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 _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 +var _0x6654=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','post','/:id','update','delete','multer','path','connect-timeout'];(function(_0x4135a9,_0x6ae774){var _0x450d5e=function(_0x10df5e){while(--_0x10df5e){_0x4135a9['push'](_0x4135a9['shift']());}};_0x450d5e(++_0x6ae774);}(_0x6654,0x138));var _0x4665=function(_0xf5dfc9,_0x486450){_0xf5dfc9=_0xf5dfc9-0x0;var _0xe938a6=_0x6654[_0xf5dfc9];return _0xe938a6;};'use strict';var multer=require(_0x4665('0x0'));var util=require('util');var path=require(_0x4665('0x1'));var timeout=require(_0x4665('0x2'));var express=require(_0x4665('0x3'));var router=express['Router']();var auth=require(_0x4665('0x4'));var interaction=require(_0x4665('0x5'));var config=require(_0x4665('0x6'));var controller=require(_0x4665('0x7'));router[_0x4665('0x8')]('/',auth[_0x4665('0x9')](),controller[_0x4665('0xa')]);router[_0x4665('0x8')]('/:id',auth[_0x4665('0x9')](),controller['show']);router[_0x4665('0xb')]('/',auth[_0x4665('0x9')](),controller['create']);router['put'](_0x4665('0xc'),auth['isAuthenticated'](),controller[_0x4665('0xd')]);router[_0x4665('0xe')](_0x4665('0xc'),auth[_0x4665('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 2b45c48..8dbeac3 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 _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 +var _0xe44d=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','string'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xe44d,0x11a));var _0xde44=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xe44d[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0xde44('0x0'));module[_0xde44('0x1')]={'type':{'type':Sequelize[_0xde44('0x2')]('string',_0xde44('0x3'),'customVariable',_0xde44('0x4')),'defaultValue':_0xde44('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xde44('0x6')]},'keyType':{'type':Sequelize[_0xde44('0x2')](_0xde44('0x5'),_0xde44('0x3'),_0xde44('0x7'))},'keyContent':{'type':Sequelize[_0xde44('0x6')]},'idField':{'type':Sequelize[_0xde44('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xde44('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xde44('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index efb6dd3..e6c8c0f 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 _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 +var _0x2046=['model','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','options','count','include','findAll','params','includeAll','find','catch','create','body','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','DeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection'];(function(_0x5651e8,_0xea822){var _0x49bf83=function(_0x4b0e3d){while(--_0x4b0e3d){_0x5651e8['push'](_0x5651e8['shift']());}};_0x49bf83(++_0xea822);}(_0x2046,0x138));var _0x6204=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2046[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x6204('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6204('0x1'));var jsonpatch=require(_0x6204('0x2'));var rp=require(_0x6204('0x3'));var moment=require(_0x6204('0x4'));var BPromise=require(_0x6204('0x5'));var Mustache=require(_0x6204('0x6'));var util=require('util');var path=require(_0x6204('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6204('0x8'));var fs=require('fs');var _=require(_0x6204('0x9'));var squel=require(_0x6204('0xa'));var crypto=require(_0x6204('0xb'));var jsforce=require(_0x6204('0xc'));var deskjs=require(_0x6204('0xd'));var toCsv=require(_0x6204('0xe'));var querystring=require(_0x6204('0xf'));var Papa=require(_0x6204('0x10'));var Redis=require(_0x6204('0x11'));var authService=require(_0x6204('0x12'));var qs=require(_0x6204('0x13'));var as=require(_0x6204('0x14'));var hardwareService=require(_0x6204('0x15'));var logger=require(_0x6204('0x16'))(_0x6204('0x17'));var utils=require(_0x6204('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6204('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x319b5b,_0x3ecfb2){_0x3ecfb2=_0x3ecfb2||0xcc;return function(_0x3df094){if(_0x3df094){return _0x319b5b[_0x6204('0x1a')](_0x3ecfb2);}return _0x319b5b[_0x6204('0x1b')](_0x3ecfb2)[_0x6204('0x1c')]();};}function respondWithResult(_0x4c7bde,_0x3bda6c){_0x3bda6c=_0x3bda6c||0xc8;return function(_0x3e9ef2){if(_0x3e9ef2){return _0x4c7bde[_0x6204('0x1b')](_0x3bda6c)[_0x6204('0x1d')](_0x3e9ef2);}};}function respondWithFilteredResult(_0xd88911,_0x350423){return function(_0x2e5998){if(_0x2e5998){var _0xe7b998=_0x2e5998['count'],_0x242c30=_0x350423['offset'],_0x220c54=_0x350423[_0x6204('0x1e')]+_0x350423[_0x6204('0x1f')],_0x56ff71;if(_0x220c54>=_0xe7b998){_0x220c54=_0xe7b998;_0x56ff71=0xc8;}else{_0x56ff71=0xce;}_0xd88911['status'](_0x56ff71);return _0xd88911[_0x6204('0x20')](_0x6204('0x21'),_0x242c30+'-'+_0x220c54+'/'+_0xe7b998)[_0x6204('0x1d')](_0x2e5998);}return null;};}function patchUpdates(_0x116f2b){return function(_0x230c95){try{jsonpatch[_0x6204('0x22')](_0x230c95,_0x116f2b,!![]);}catch(_0x10357b){return BPromise[_0x6204('0x23')](_0x10357b);}return _0x230c95[_0x6204('0x24')]();};}function saveUpdates(_0x4b3186,_0x30e223){return function(_0x3fcfb0){if(_0x3fcfb0){return _0x3fcfb0[_0x6204('0x25')](_0x4b3186)[_0x6204('0x26')](function(_0x2a8eba){return _0x2a8eba;});}return null;};}function removeEntity(_0x2a2d75,_0xe48929){return function(_0x26ba64){if(_0x26ba64){return _0x26ba64[_0x6204('0x27')]()[_0x6204('0x26')](function(){_0x2a2d75[_0x6204('0x1b')](0xcc)[_0x6204('0x1c')]();});}};}function handleEntityNotFound(_0x5ba6c6,_0x2d9ace){return function(_0x1df977){if(!_0x1df977){_0x5ba6c6[_0x6204('0x1a')](0x194);}return _0x1df977;};}function handleError(_0x4a3ba9,_0x3360de){_0x3360de=_0x3360de||0x1f4;return function(_0xb60fb8){logger[_0x6204('0x28')](_0xb60fb8['stack']);if(_0xb60fb8[_0x6204('0x29')]){delete _0xb60fb8[_0x6204('0x29')];}_0x4a3ba9[_0x6204('0x1b')](_0x3360de)['send'](_0xb60fb8);};}exports[_0x6204('0x2a')]=function(_0x4cb5aa,_0x25a5fa){var _0x127282={},_0x3226fd={},_0x55cd90={'count':0x0,'rows':[]};var _0x5f0c4a=_[_0x6204('0x2b')](db[_0x6204('0x2c')][_0x6204('0x2d')],function(_0x227f97){return{'name':_0x227f97[_0x6204('0x2e')],'type':_0x227f97[_0x6204('0x2f')][_0x6204('0x30')]};});_0x3226fd['model']=_[_0x6204('0x2b')](_0x5f0c4a,_0x6204('0x29'));_0x3226fd[_0x6204('0x31')]=_[_0x6204('0x32')](_0x4cb5aa[_0x6204('0x31')]);_0x3226fd[_0x6204('0x33')]=_[_0x6204('0x34')](_0x3226fd['model'],_0x3226fd[_0x6204('0x31')]);_0x127282['attributes']=_[_0x6204('0x34')](_0x3226fd[_0x6204('0x35')],qs[_0x6204('0x36')](_0x4cb5aa[_0x6204('0x31')]['fields']));_0x127282[_0x6204('0x37')]=_0x127282[_0x6204('0x37')][_0x6204('0x38')]?_0x127282[_0x6204('0x37')]:_0x3226fd[_0x6204('0x35')];if(!_0x4cb5aa['query'][_0x6204('0x39')]('nolimit')){_0x127282['limit']=qs[_0x6204('0x1f')](_0x4cb5aa['query'][_0x6204('0x1f')]);_0x127282[_0x6204('0x1e')]=qs[_0x6204('0x1e')](_0x4cb5aa[_0x6204('0x31')][_0x6204('0x1e')]);}_0x127282[_0x6204('0x3a')]=qs['sort'](_0x4cb5aa['query'][_0x6204('0x3b')]);_0x127282[_0x6204('0x3c')]=qs[_0x6204('0x33')](_['pick'](_0x4cb5aa[_0x6204('0x31')],_0x3226fd[_0x6204('0x33')]),_0x5f0c4a);if(_0x4cb5aa['query'][_0x6204('0x3d')]){_0x127282['where']=_[_0x6204('0x3e')](_0x127282[_0x6204('0x3c')],{'$or':_[_0x6204('0x2b')](_0x5f0c4a,function(_0x1631ca){if(_0x1631ca[_0x6204('0x2f')]!=='VIRTUAL'){var _0x175054={};_0x175054[_0x1631ca[_0x6204('0x29')]]={'$like':'%'+_0x4cb5aa[_0x6204('0x31')]['filter']+'%'};return _0x175054;}})});}_0x127282=_[_0x6204('0x3e')]({},_0x127282,_0x4cb5aa[_0x6204('0x3f')]);var _0x408ec1={'where':_0x127282[_0x6204('0x3c')]};return db[_0x6204('0x2c')][_0x6204('0x40')](_0x408ec1)[_0x6204('0x26')](function(_0x3fb98e){_0x55cd90[_0x6204('0x40')]=_0x3fb98e;if(_0x4cb5aa[_0x6204('0x31')]['includeAll']){_0x127282[_0x6204('0x41')]=[{'all':!![]}];}return db['DeskField'][_0x6204('0x42')](_0x127282);})[_0x6204('0x26')](function(_0x4c3224){_0x55cd90['rows']=_0x4c3224;return _0x55cd90;})[_0x6204('0x26')](respondWithFilteredResult(_0x25a5fa,_0x127282))['catch'](handleError(_0x25a5fa,null));};exports['show']=function(_0x30f90a,_0x5ee2da){var _0x4c9542={'raw':!![],'where':{'id':_0x30f90a[_0x6204('0x43')]['id']}},_0x47ca4d={};_0x47ca4d[_0x6204('0x35')]=_['keys'](db[_0x6204('0x2c')]['rawAttributes']);_0x47ca4d[_0x6204('0x31')]=_[_0x6204('0x32')](_0x30f90a[_0x6204('0x31')]);_0x47ca4d[_0x6204('0x33')]=_[_0x6204('0x34')](_0x47ca4d[_0x6204('0x35')],_0x47ca4d['query']);_0x4c9542[_0x6204('0x37')]=_[_0x6204('0x34')](_0x47ca4d[_0x6204('0x35')],qs['fields'](_0x30f90a[_0x6204('0x31')][_0x6204('0x36')]));_0x4c9542[_0x6204('0x37')]=_0x4c9542[_0x6204('0x37')][_0x6204('0x38')]?_0x4c9542['attributes']:_0x47ca4d[_0x6204('0x35')];if(_0x30f90a[_0x6204('0x31')][_0x6204('0x44')]){_0x4c9542['include']=[{'all':!![]}];}_0x4c9542=_[_0x6204('0x3e')]({},_0x4c9542,_0x30f90a[_0x6204('0x3f')]);return db['DeskField'][_0x6204('0x45')](_0x4c9542)[_0x6204('0x26')](handleEntityNotFound(_0x5ee2da,null))[_0x6204('0x26')](respondWithResult(_0x5ee2da,null))[_0x6204('0x46')](handleError(_0x5ee2da,null));};exports[_0x6204('0x47')]=function(_0x322705,_0x57e318){return db[_0x6204('0x2c')][_0x6204('0x47')](_0x322705['body'],{})[_0x6204('0x26')](respondWithResult(_0x57e318,0xc9))['catch'](handleError(_0x57e318,null));};exports['update']=function(_0x896a8c,_0x22afd5){if(_0x896a8c[_0x6204('0x48')]['id']){delete _0x896a8c[_0x6204('0x48')]['id'];}return db['DeskField'][_0x6204('0x45')]({'where':{'id':_0x896a8c['params']['id']}})['then'](handleEntityNotFound(_0x22afd5,null))[_0x6204('0x26')](saveUpdates(_0x896a8c[_0x6204('0x48')],null))['then'](respondWithResult(_0x22afd5,null))[_0x6204('0x46')](handleError(_0x22afd5,null));};exports[_0x6204('0x27')]=function(_0x5e46ee,_0x4fcc4b){return db['DeskField'][_0x6204('0x45')]({'where':{'id':_0x5e46ee[_0x6204('0x43')]['id']}})['then'](handleEntityNotFound(_0x4fcc4b,null))[_0x6204('0x26')](removeEntity(_0x4fcc4b,null))[_0x6204('0x46')](handleError(_0x4fcc4b,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7c6ed30..124e710 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 _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 +var _0xe12d=['FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','int_desk_fields'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe12d,0x109));var _0xde12=function(_0x155062,_0x34f072){_0x155062=_0x155062-0x0;var _0x448920=_0xe12d[_0x155062];return _0x448920;};'use strict';var _=require('lodash');var util=require(_0xde12('0x0'));var logger=require('../../config/logger')(_0xde12('0x1'));var moment=require(_0xde12('0x2'));var BPromise=require(_0xde12('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xde12('0x4'));var rimraf=require(_0xde12('0x5'));var config=require(_0xde12('0x6'));var attributes=require(_0xde12('0x7'));module['exports']=function(_0x51cfcf,_0x13a6c9){return _0x51cfcf[_0xde12('0x8')]('DeskField',attributes,{'tableName':_0xde12('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':['idField',_0xde12('0xa')],'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 1971e99..bdf4710 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 _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 +var _0xab26=['rpc','../../config/environment','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3727ae,_0x165f88){var _0x1c3f01=function(_0x5cd5a5){while(--_0x5cd5a5){_0x3727ae['push'](_0x3727ae['shift']());}};_0x1c3f01(++_0x165f88);}(_0xab26,0xec));var _0x6ab2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xab26[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x6ab2('0x0'));var util=require(_0x6ab2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ab2('0x2'));var fs=require('fs');var Redis=require(_0x6ab2('0x3'));var db=require(_0x6ab2('0x4'))['db'];var utils=require(_0x6ab2('0x5'));var logger=require('../../config/logger')(_0x6ab2('0x6'));var config=require(_0x6ab2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6ab2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42cd81,_0x4a9c06,_0xd9016e){return new BPromise(function(_0x33fa43,_0x4d9c65){return client[_0x6ab2('0x9')](_0x42cd81,_0xd9016e)[_0x6ab2('0xa')](function(_0xeee5ab){logger[_0x6ab2('0xb')](_0x6ab2('0xc'),_0x4a9c06,_0x6ab2('0xd'));logger[_0x6ab2('0xe')](_0x6ab2('0xf'),_0x4a9c06,_0x6ab2('0xd'),JSON[_0x6ab2('0x10')](_0xeee5ab));if(_0xeee5ab[_0x6ab2('0x11')]){if(_0xeee5ab[_0x6ab2('0x11')][_0x6ab2('0x12')]===0x1f4){logger['error'](_0x6ab2('0xc'),_0x4a9c06,_0xeee5ab[_0x6ab2('0x11')][_0x6ab2('0x13')]);return _0x4d9c65(_0xeee5ab[_0x6ab2('0x11')][_0x6ab2('0x13')]);}logger[_0x6ab2('0x11')](_0x6ab2('0xc'),_0x4a9c06,_0xeee5ab['error']['message']);return _0x33fa43(_0xeee5ab[_0x6ab2('0x11')][_0x6ab2('0x13')]);}else{logger[_0x6ab2('0xb')](_0x6ab2('0xc'),_0x4a9c06,_0x6ab2('0xd'));_0x33fa43(_0xeee5ab[_0x6ab2('0x14')]['message']);}})[_0x6ab2('0x15')](function(_0x43d3d4){logger[_0x6ab2('0x11')](_0x6ab2('0xc'),_0x4a9c06,_0x43d3d4);_0x4d9c65(_0x43d3d4);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 1bc9311..0befa1a 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 _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 +var _0x2032=['put','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration'];(function(_0x5ecac1,_0x2d7338){var _0x1fe487=function(_0x94c196){while(--_0x94c196){_0x5ecac1['push'](_0x5ecac1['shift']());}};_0x1fe487(++_0x2d7338);}(_0x2032,0xd9));var _0x2203=function(_0x37853c,_0x4dbc93){_0x37853c=_0x37853c-0x0;var _0x22ea96=_0x2032[_0x37853c];return _0x22ea96;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x2203('0x7')]('/:id/fields',auth[_0x2203('0x8')](),controller[_0x2203('0xd')]);router[_0x2203('0xe')]('/',auth['isAuthenticated'](),controller[_0x2203('0xf')]);router['post'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router[_0x2203('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2203('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 139551f..c8d073e 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 _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 +var _0x8395=['exports','STRING','sequelize'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8395,0x1f1));var _0x5839=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x8395[_0x5416db];return _0x243e35;};'use strict';var Sequelize=require(_0x5839('0x0'));module[_0x5839('0x1')]={'name':{'type':Sequelize[_0x5839('0x2')]},'username':{'type':Sequelize[_0x5839('0x2')]},'password':{'type':Sequelize[_0x5839('0x2')]},'remoteUri':{'type':Sequelize[_0x5839('0x2')]},'tenantId':{'type':Sequelize[_0x5839('0x2')]},'clientId':{'type':Sequelize[_0x5839('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5839('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 8a0ca50..6bb0e00 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 _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 +var _0xabce=['remoteUri','slice','substring','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','Attributes','includes','LogicalName','forEach','@odata.type','push','all','lastIndexOf','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info','debug','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','Dynamics365Account','fieldName','type','map','query','model','attributes','intersection','fields','length','nolimit','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','getConfigurations','findOne','Dynamics365Configuration','order','Subjects','getDescriptions','channel','Dynamics365Field','Descriptions','getFields','ticketType','Incident','PhoneCall','title','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdon','createdonbehalfbyname','customeridname','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','tenantId','clientId','clientSecret'];(function(_0x21e66b,_0x18119f){var _0x518965=function(_0x514133){while(--_0x514133){_0x21e66b['push'](_0x21e66b['shift']());}};_0x518965(++_0x18119f);}(_0xabce,0x103));var _0xeabc=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xabce[_0x25bea7];return _0x175952;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var integrations=require(_0xeabc('0x1a'));var jayson=require(_0xeabc('0x1b'));var client=jayson[_0xeabc('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x235c2d,_0x1319f3,_0x3251c6,_0x55f0de){return new BPromise(function(_0x5f4ee8,_0x3170ea){var _0x3ae954=_0x55f0de||client;return _0x3ae954[_0xeabc('0x1d')](_0x235c2d,_0x3251c6)['then'](function(_0xf913d7){logger[_0xeabc('0x1e')]('Dynamics365Account,\x20%s,\x20%s',_0x1319f3,'request\x20sent');logger[_0xeabc('0x1f')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1319f3,_0xeabc('0x20'),JSON[_0xeabc('0x21')](_0xf913d7));if(_0xf913d7[_0xeabc('0x22')]){if(_0xf913d7[_0xeabc('0x22')][_0xeabc('0x23')]===0x1f4){logger[_0xeabc('0x22')](_0xeabc('0x24'),_0x1319f3,_0xf913d7[_0xeabc('0x22')]['message']);return _0x3170ea(_0xf913d7[_0xeabc('0x22')]['message']);}logger[_0xeabc('0x22')](_0xeabc('0x24'),_0x1319f3,_0xf913d7['error'][_0xeabc('0x25')]);return _0x5f4ee8(_0xf913d7[_0xeabc('0x22')][_0xeabc('0x25')]);}else{logger[_0xeabc('0x1e')](_0xeabc('0x24'),_0x1319f3,'request\x20sent');_0x5f4ee8(_0xf913d7[_0xeabc('0x26')][_0xeabc('0x25')]);}})[_0xeabc('0x27')](function(_0x5bdd57){logger[_0xeabc('0x22')](_0xeabc('0x24'),_0x1319f3,_0x5bdd57);_0x3170ea(_0x5bdd57);});});}function respondWithStatusCode(_0x214953,_0x319119){_0x319119=_0x319119||0xcc;return function(_0x5b8838){if(_0x5b8838){return _0x214953[_0xeabc('0x28')](_0x319119);}return _0x214953['status'](_0x319119)[_0xeabc('0x29')]();};}function respondWithResult(_0x4d4e29,_0x811f0d){_0x811f0d=_0x811f0d||0xc8;return function(_0x12acbd){if(_0x12acbd){return _0x4d4e29[_0xeabc('0x2a')](_0x811f0d)[_0xeabc('0x2b')](_0x12acbd);}};}function respondWithFilteredResult(_0x3a1a04,_0x137293){return function(_0x131722){if(_0x131722){var _0x4c2693=_0x131722[_0xeabc('0x2c')],_0x5b2934=_0x137293[_0xeabc('0x2d')],_0x459c8a=_0x137293['offset']+_0x137293[_0xeabc('0x2e')],_0x5bf8f2;if(_0x459c8a>=_0x4c2693){_0x459c8a=_0x4c2693;_0x5bf8f2=0xc8;}else{_0x5bf8f2=0xce;}_0x3a1a04[_0xeabc('0x2a')](_0x5bf8f2);return _0x3a1a04[_0xeabc('0x2f')](_0xeabc('0x30'),_0x5b2934+'-'+_0x459c8a+'/'+_0x4c2693)[_0xeabc('0x2b')](_0x131722);}return null;};}function patchUpdates(_0x481ee1){return function(_0x2c62fe){try{jsonpatch[_0xeabc('0x31')](_0x2c62fe,_0x481ee1,!![]);}catch(_0x2915c1){return BPromise['reject'](_0x2915c1);}return _0x2c62fe[_0xeabc('0x32')]();};}function saveUpdates(_0x5bb1f1,_0x2f03e8){return function(_0x2d027e){if(_0x2d027e){return _0x2d027e[_0xeabc('0x33')](_0x5bb1f1)[_0xeabc('0x34')](function(_0x73c8d4){return _0x73c8d4;});}return null;};}function removeEntity(_0x368b8a,_0x61c0af){return function(_0x545d7f){if(_0x545d7f){return _0x545d7f[_0xeabc('0x35')]()[_0xeabc('0x34')](function(){_0x368b8a[_0xeabc('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e74ca,_0x3777c1){return function(_0x4492fd){if(!_0x4492fd){_0x1e74ca['sendStatus'](0x194);}return _0x4492fd;};}function handleError(_0xc0a5b0,_0x36cc2f){_0x36cc2f=_0x36cc2f||0x1f4;return function(_0x1f910d){logger['error'](_0x1f910d[_0xeabc('0x36')]);if(_0x1f910d[_0xeabc('0x37')]){delete _0x1f910d['name'];}_0xc0a5b0['status'](_0x36cc2f)[_0xeabc('0x38')](_0x1f910d);};}exports[_0xeabc('0x39')]=function(_0x4fc60c,_0x43df50){var _0x81976d={},_0x3edee7={},_0x10434e={'count':0x0,'rows':[]};var _0x34057c=_['map'](db[_0xeabc('0x3a')]['rawAttributes'],function(_0x31ee7a){return{'name':_0x31ee7a[_0xeabc('0x3b')],'type':_0x31ee7a[_0xeabc('0x3c')]['key']};});_0x3edee7['model']=_[_0xeabc('0x3d')](_0x34057c,'name');_0x3edee7[_0xeabc('0x3e')]=_['keys'](_0x4fc60c['query']);_0x3edee7['filters']=_['intersection'](_0x3edee7[_0xeabc('0x3f')],_0x3edee7['query']);_0x81976d[_0xeabc('0x40')]=_[_0xeabc('0x41')](_0x3edee7['model'],qs[_0xeabc('0x42')](_0x4fc60c['query'][_0xeabc('0x42')]));_0x81976d['attributes']=_0x81976d[_0xeabc('0x40')][_0xeabc('0x43')]?_0x81976d[_0xeabc('0x40')]:_0x3edee7['model'];if(!_0x4fc60c['query']['hasOwnProperty'](_0xeabc('0x44'))){_0x81976d[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x4fc60c['query']['limit']);_0x81976d[_0xeabc('0x2d')]=qs[_0xeabc('0x2d')](_0x4fc60c['query'][_0xeabc('0x2d')]);}_0x81976d['order']=qs[_0xeabc('0x45')](_0x4fc60c['query']['sort']);_0x81976d['where']=qs[_0xeabc('0x46')](_[_0xeabc('0x47')](_0x4fc60c[_0xeabc('0x3e')],_0x3edee7[_0xeabc('0x46')]),_0x34057c);if(_0x4fc60c['query'][_0xeabc('0x48')]){_0x81976d['where']=_[_0xeabc('0x49')](_0x81976d[_0xeabc('0x4a')],{'$or':_[_0xeabc('0x3d')](_0x34057c,function(_0x17a0df){if(_0x17a0df[_0xeabc('0x3c')]!=='VIRTUAL'){var _0x482971={};_0x482971[_0x17a0df[_0xeabc('0x37')]]={'$like':'%'+_0x4fc60c['query'][_0xeabc('0x48')]+'%'};return _0x482971;}})});}_0x81976d=_[_0xeabc('0x49')]({},_0x81976d,_0x4fc60c['options']);var _0x14276d={'where':_0x81976d[_0xeabc('0x4a')]};return db[_0xeabc('0x3a')][_0xeabc('0x2c')](_0x14276d)[_0xeabc('0x34')](function(_0xcaa5b9){_0x10434e[_0xeabc('0x2c')]=_0xcaa5b9;if(_0x4fc60c['query'][_0xeabc('0x4b')]){_0x81976d[_0xeabc('0x4c')]=[{'all':!![]}];}return db[_0xeabc('0x3a')][_0xeabc('0x4d')](_0x81976d);})[_0xeabc('0x34')](function(_0x3fbc97){_0x10434e[_0xeabc('0x4e')]=_0x3fbc97;return _0x10434e;})[_0xeabc('0x34')](respondWithFilteredResult(_0x43df50,_0x81976d))[_0xeabc('0x27')](handleError(_0x43df50,null));};exports[_0xeabc('0x4f')]=function(_0x5689fc,_0x38356c){var _0x2e6efb={'raw':![],'where':{'id':_0x5689fc[_0xeabc('0x50')]['id']}},_0x41f5d7={};_0x41f5d7[_0xeabc('0x3f')]=_[_0xeabc('0x51')](db[_0xeabc('0x3a')]['rawAttributes']);_0x41f5d7[_0xeabc('0x3e')]=_[_0xeabc('0x51')](_0x5689fc[_0xeabc('0x3e')]);_0x41f5d7[_0xeabc('0x46')]=_[_0xeabc('0x41')](_0x41f5d7['model'],_0x41f5d7[_0xeabc('0x3e')]);_0x2e6efb[_0xeabc('0x40')]=_[_0xeabc('0x41')](_0x41f5d7[_0xeabc('0x3f')],qs['fields'](_0x5689fc[_0xeabc('0x3e')][_0xeabc('0x42')]));_0x2e6efb['attributes']=_0x2e6efb[_0xeabc('0x40')]['length']?_0x2e6efb[_0xeabc('0x40')]:_0x41f5d7['model'];if(_0x5689fc[_0xeabc('0x3e')][_0xeabc('0x4b')]){_0x2e6efb[_0xeabc('0x4c')]=[{'all':!![]}];}_0x2e6efb=_[_0xeabc('0x49')]({},_0x2e6efb,_0x5689fc[_0xeabc('0x52')]);return db[_0xeabc('0x3a')][_0xeabc('0x53')](_0x2e6efb)[_0xeabc('0x34')](handleEntityNotFound(_0x38356c,null))[_0xeabc('0x34')](respondWithResult(_0x38356c,null))[_0xeabc('0x27')](handleError(_0x38356c,null));};exports['create']=function(_0x180a14,_0x2537ab){return db[_0xeabc('0x3a')][_0xeabc('0x54')](_0x180a14['body'],{})[_0xeabc('0x34')](respondWithResult(_0x2537ab,0xc9))[_0xeabc('0x27')](handleError(_0x2537ab,null));};exports[_0xeabc('0x33')]=function(_0x21f972,_0x5f2d2f){if(_0x21f972[_0xeabc('0x55')]['id']){delete _0x21f972[_0xeabc('0x55')]['id'];}return db[_0xeabc('0x3a')][_0xeabc('0x53')]({'where':{'id':_0x21f972[_0xeabc('0x50')]['id']}})[_0xeabc('0x34')](handleEntityNotFound(_0x5f2d2f,null))[_0xeabc('0x34')](saveUpdates(_0x21f972[_0xeabc('0x55')],null))[_0xeabc('0x34')](respondWithResult(_0x5f2d2f,null))['catch'](handleError(_0x5f2d2f,null));};exports[_0xeabc('0x35')]=function(_0x4cdb05,_0x5e09fc){return db['Dynamics365Account'][_0xeabc('0x53')]({'where':{'id':_0x4cdb05[_0xeabc('0x50')]['id']}})[_0xeabc('0x34')](handleEntityNotFound(_0x5e09fc,null))[_0xeabc('0x34')](removeEntity(_0x5e09fc,null))[_0xeabc('0x27')](handleError(_0x5e09fc,null));};exports[_0xeabc('0x56')]=function(_0x4a2ad6,_0x4358d7,_0x25fd83){var _0x19f61e={};var _0x104c1e={};var _0x2ddc53;var _0x2c7b4e;return db[_0xeabc('0x3a')][_0xeabc('0x57')]({'where':{'id':_0x4a2ad6['params']['id']}})['then'](handleEntityNotFound(_0x4358d7,null))[_0xeabc('0x34')](function(_0x340520){if(_0x340520){_0x2ddc53=_0x340520;_0x104c1e[_0xeabc('0x3f')]=_['keys'](db[_0xeabc('0x58')]['rawAttributes']);_0x104c1e['query']=_[_0xeabc('0x51')](_0x4a2ad6[_0xeabc('0x3e')]);_0x104c1e[_0xeabc('0x46')]=_[_0xeabc('0x41')](_0x104c1e[_0xeabc('0x3f')],_0x104c1e[_0xeabc('0x3e')]);_0x19f61e['attributes']=_[_0xeabc('0x41')](_0x104c1e[_0xeabc('0x3f')],qs[_0xeabc('0x42')](_0x4a2ad6[_0xeabc('0x3e')][_0xeabc('0x42')]));_0x19f61e[_0xeabc('0x40')]=_0x19f61e['attributes'][_0xeabc('0x43')]?_0x19f61e[_0xeabc('0x40')]:_0x104c1e[_0xeabc('0x3f')];_0x19f61e[_0xeabc('0x59')]=qs[_0xeabc('0x45')](_0x4a2ad6[_0xeabc('0x3e')][_0xeabc('0x45')]);_0x19f61e[_0xeabc('0x4a')]=qs[_0xeabc('0x46')](_['pick'](_0x4a2ad6[_0xeabc('0x3e')],_0x104c1e['filters']));if(_0x4a2ad6[_0xeabc('0x3e')][_0xeabc('0x48')]){_0x19f61e[_0xeabc('0x4a')]=_[_0xeabc('0x49')](_0x19f61e[_0xeabc('0x4a')],{'$or':_[_0xeabc('0x3d')](_0x19f61e[_0xeabc('0x40')],function(_0xb59a2a){var _0x5d4bc2={};_0x5d4bc2[_0xb59a2a]={'$like':'%'+_0x4a2ad6[_0xeabc('0x3e')]['filter']+'%'};return _0x5d4bc2;})});}_0x19f61e=_[_0xeabc('0x49')]({},_0x19f61e,_0x4a2ad6[_0xeabc('0x52')]);return _0x2ddc53[_0xeabc('0x56')](_0x19f61e);}})[_0xeabc('0x34')](function(_0x5b4430){if(_0x5b4430){_0x2c7b4e=_0x5b4430[_0xeabc('0x43')];if(!_0x4a2ad6['query']['hasOwnProperty'](_0xeabc('0x44'))){_0x19f61e[_0xeabc('0x2e')]=qs[_0xeabc('0x2e')](_0x4a2ad6[_0xeabc('0x3e')]['limit']);_0x19f61e['offset']=qs[_0xeabc('0x2d')](_0x4a2ad6['query']['offset']);}return _0x2ddc53[_0xeabc('0x56')](_0x19f61e);}})['then'](function(_0x4afc8e){if(_0x4afc8e){return _0x4afc8e?{'count':_0x2c7b4e,'rows':_0x4afc8e}:null;}})[_0xeabc('0x34')](respondWithResult(_0x4358d7,null))[_0xeabc('0x27')](handleError(_0x4358d7,null));};exports['addConfiguration']=function(_0x48cccc,_0xd866c0,_0x5d183a){if(_0x48cccc[_0xeabc('0x55')]['id']){delete _0x48cccc[_0xeabc('0x55')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x48cccc[_0xeabc('0x50')]['id']}})[_0xeabc('0x34')](handleEntityNotFound(_0xd866c0,null))[_0xeabc('0x34')](function(_0x471cb6){if(_0x471cb6){_0x48cccc[_0xeabc('0x55')]['AccountId']=_0x471cb6['id'];_0x48cccc['body'][_0xeabc('0x5a')]=integrations['getSubjects'](_0x48cccc[_0xeabc('0x55')]['channel'],_0x48cccc[_0xeabc('0x55')]['type']);_0x48cccc[_0xeabc('0x55')]['Descriptions']=integrations[_0xeabc('0x5b')](_0x48cccc[_0xeabc('0x55')][_0xeabc('0x5c')],_0x48cccc[_0xeabc('0x55')]['type']);return db[_0xeabc('0x58')]['create'](_0x48cccc[_0xeabc('0x55')],{'include':[{'model':db[_0xeabc('0x5d')],'as':_0xeabc('0x5a')},{'model':db[_0xeabc('0x5d')],'as':_0xeabc('0x5e')}]});}return null;})['then'](respondWithResult(_0xd866c0,null))[_0xeabc('0x27')](handleError(_0xd866c0,null));};exports[_0xeabc('0x5f')]=function(_0x4b9614,_0x2509a4,_0x5427c8){var _0x1559dc=_0x4b9614[_0xeabc('0x3e')][_0xeabc('0x60')];var _0x76efdf=_0x1559dc==='incident'?_0xeabc('0x61'):_0xeabc('0x62');var _0x287f88='';var _0x460520='';var _0x485040='';var _0x56b7d0='';var _0x30e9eb='';var _0x4f406b='';var _0x5ea2e3='';var _0x3271b6='';var _0x460f07=[_0xeabc('0x63'),'description',_0xeabc('0x64'),_0xeabc('0x65'),'caseorigincode',_0xeabc('0x66'),_0xeabc('0x67'),_0xeabc('0x68'),_0xeabc('0x69'),_0xeabc('0x6a')];var _0x4bf9d8=[_0xeabc('0x6b'),'accountidyominame','actualserviceunits','billedserviceunits',_0xeabc('0x6c'),_0xeabc('0x6d'),_0xeabc('0x6e'),_0xeabc('0x6f'),_0xeabc('0x70'),'createdbyexternalpartyyominame',_0xeabc('0x71'),'createdbyyominame',_0xeabc('0x72'),_0xeabc('0x73'),'createdonbehalfbyyominame',_0xeabc('0x74'),'customeridtype','customeridyominame',_0xeabc('0x75'),_0xeabc('0x76'),_0xeabc('0x77'),_0xeabc('0x78'),_0xeabc('0x79'),'exchangerate',_0xeabc('0x7a'),_0xeabc('0x7b'),_0xeabc('0x7c'),_0xeabc('0x7d'),_0xeabc('0x7e'),_0xeabc('0x7f'),_0xeabc('0x80'),_0xeabc('0x81'),_0xeabc('0x82'),_0xeabc('0x83'),'modifiedbyyominame',_0xeabc('0x84'),_0xeabc('0x85'),_0xeabc('0x86'),'msdyn_incidenttypename','msdyn_iotalertname',_0xeabc('0x87'),_0xeabc('0x88'),_0xeabc('0x89'),_0xeabc('0x8a'),_0xeabc('0x8b'),'owneridyominame',_0xeabc('0x8c'),'primarycontactidname','primarycontactidyominame',_0xeabc('0x8d'),_0xeabc('0x8e'),'productserialnumber',_0xeabc('0x8f'),_0xeabc('0x90'),_0xeabc('0x91'),_0xeabc('0x92'),_0xeabc('0x93'),_0xeabc('0x94'),_0xeabc('0x95'),_0xeabc('0x96'),_0xeabc('0x97'),_0xeabc('0x98'),_0xeabc('0x99'),'subjectidname',_0xeabc('0x9a'),'timezoneruleversionnumber',_0xeabc('0x9b'),_0xeabc('0x9c'),_0xeabc('0x9d'),_0xeabc('0x9e')];var _0x62cb8e=_0x460f07[_0xeabc('0x9f')](_0x4bf9d8);return db[_0xeabc('0x3a')][_0xeabc('0x57')]({'where':{'id':_0x4b9614[_0xeabc('0x50')]['id']},'attributes':['id',_0xeabc('0xa0'),_0xeabc('0xa1'),'remoteUri',_0xeabc('0xa2'),_0xeabc('0xa3'),_0xeabc('0xa4')]})[_0xeabc('0x34')](handleEntityNotFound(_0x2509a4,null))['then'](function(_0x26c595){if(_0x26c595){_0x3271b6=_0x26c595[_0xeabc('0xa5')];var _0x580661=_0x3271b6[_0xeabc('0xa6')](-0x1);if(_0x580661==='/'){_0x3271b6=_0x3271b6[_0xeabc('0xa7')](0x0,_0x3271b6['lastIndexOf'](_0x580661));}_0x5ea2e3=util['format']('%s/api/data/v9.0/',_0x3271b6);var _0x5f28dc={'method':_0xeabc('0xa8'),'uri':_0xeabc('0xa9')+_0x26c595[_0xeabc('0xa2')]+_0xeabc('0xaa'),'form':{'client_id':_0x26c595[_0xeabc('0xa3')],'resource':_0x3271b6,'username':_0x26c595[_0xeabc('0xa0')],'password':_0x26c595[_0xeabc('0xa1')],'grant_type':_0xeabc('0xa1'),'client_secret':_0x26c595[_0xeabc('0xa4')]},'json':!![]};return rp(_0x5f28dc);}})[_0xeabc('0x34')](function(_0x5421b9){_0x4f406b=_0x5421b9[_0xeabc('0xab')];var _0x37f3be={'method':'GET','uri':encodeURI(_0x5ea2e3+_0xeabc('0xac')+_0x76efdf+'\x27'),'headers':{'Authorization':_0xeabc('0xad')+_0x4f406b,'If-None-Match':null,'OData-Version':_0xeabc('0xae')},'json':!![]};return rp(_0x37f3be);})['then'](function(_0x1f3198){var _0x488120=_0x1f3198[_0xeabc('0xaf')][0x0];var _0x1b1095=_0x488120[_0xeabc('0xb0')];var _0xd9a156={'method':_0xeabc('0xb1'),'uri':_0x5ea2e3+'EntityDefinitions('+_0x1b1095+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x4f406b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd9a156);})[_0xeabc('0x34')](function(_0x3c2725){_0x287f88=_0x3c2725;_0x460520=_0x287f88[_0xeabc('0xb2')];_0x460520=_['remove'](_0x460520,function(_0x12f83f){return!_0x62cb8e[_0xeabc('0xb3')](_0x12f83f[_0xeabc('0xb4')]);});var _0x36cc30=[];var _0x39964d=[];_0x460520[_0xeabc('0xb5')](function(_0xdd956){if(_0xdd956[_0xeabc('0xb6')]){var _0x33446c=_0xdd956[_0xeabc('0xb6')][_0xeabc('0xa7')](_0xdd956[_0xeabc('0xb6')]['lastIndexOf']('.')+0x1);if(_0x33446c==='PicklistAttributeMetadata'){_0x36cc30[_0xeabc('0xb7')](getSelectList(_0x5ea2e3,_0x1559dc,_0x39964d,_0x287f88['MetadataId'],_0xdd956[_0xeabc('0xb0')],_0x4f406b));}}});return Promise[_0xeabc('0xb8')](_0x36cc30);})[_0xeabc('0x34')](function(_0x56f622){_0x485040=_0x56f622[0x0];var _0x38ccd5=[];var _0x5ae6b0=[];_0x460520[_0xeabc('0xb5')](function(_0x53ef31){if(!_['isNil'](_0x53ef31[_0xeabc('0xb6')])){var _0x2d5005=_0x53ef31[_0xeabc('0xb6')][_0xeabc('0xa7')](_0x53ef31[_0xeabc('0xb6')][_0xeabc('0xb9')]('.')+0x1);if(_0x2d5005==='BooleanAttributeMetadata'){_0x38ccd5['push'](getBooleanList(_0x5ea2e3,_0x1559dc,_0x5ae6b0,_0x287f88[_0xeabc('0xb0')],_0x53ef31[_0xeabc('0xb0')],_0x4f406b));}}});return Promise[_0xeabc('0xb8')](_0x38ccd5);})[_0xeabc('0x34')](function(_0x5f054d){_0x56b7d0=_0x5f054d[0x0];var _0x5e97b5=[];var _0x4bf689=[];_0x460520[_0xeabc('0xb5')](function(_0x57ce9b){if(_0x57ce9b[_0xeabc('0xb6')]){var _0x5016e2=_0x57ce9b[_0xeabc('0xb6')]['substring'](_0x57ce9b[_0xeabc('0xb6')][_0xeabc('0xb9')]('.')+0x1);if(_0x5016e2===_0xeabc('0xba')||_0x5016e2===_0xeabc('0xbb')||_0x5016e2===_0xeabc('0xbc')||_0x5016e2==='IntegerAttributeMetadata'||_0x5016e2===_0xeabc('0xbd')||_0x5016e2===_0xeabc('0xbe')||_0x5016e2===_0xeabc('0xbf')||_0x5016e2==='EntityNameAttributeMetadata'||_0x5016e2===_0xeabc('0xc0')||_0x5016e2===_0xeabc('0xc1')){_0x5e97b5[_0xeabc('0xb7')](getInputList(_0x5ea2e3,_0x1559dc,_0x5016e2,_0x4bf689,_0x287f88[_0xeabc('0xb0')],_0x57ce9b[_0xeabc('0xb0')],_0x4f406b));}}});return Promise['all'](_0x5e97b5);})[_0xeabc('0x34')](function(_0x418728){_0x30e9eb=_0x418728[0x0];var _0x4d6267=_0x485040[_0xeabc('0x9f')](_0x56b7d0)[_0xeabc('0x9f')](_0x30e9eb);var _0x4e820b={'count':_0x4d6267[_0xeabc('0x43')],'rows':_0x4d6267};return _0x4e820b;})[_0xeabc('0x34')](respondWithResult(_0x2509a4,null))[_0xeabc('0x27')](function(_0x307d26){var _0xfcc0=_0x4b9614[_0xeabc('0x3e')][_0xeabc('0xc2')]?0x1f4:_0x307d26[_0xeabc('0xc3')]||0x1f4;logger[_0xeabc('0x22')](_0x307d26[_0xeabc('0x36')]);delete _0x307d26[_0xeabc('0x37')];if(_0xfcc0===0x191){_0xfcc0=0x190;}_0x2509a4[_0xeabc('0x2a')](_0xfcc0)[_0xeabc('0x38')](_0x4b9614['query']['test']?{'message':_0xeabc('0xc4'),'statusCode':_0x307d26[_0xeabc('0xc3')]}:_0x307d26);});};function getSelectList(_0x2006ba,_0x2d4ca9,_0x5805c9,_0x1cc278,_0x510021,_0x49fba2){var _0x5b26a6={'method':'GET','uri':_0x2006ba+'EntityDefinitions('+_0x1cc278+')/Attributes('+_0x510021+_0xeabc('0xc5')+_0xeabc('0xc6'),'headers':{'Authorization':_0xeabc('0xad')+_0x49fba2,'If-None-Match':null,'OData-Version':_0xeabc('0xae')},'json':!![]};return rp(_0x5b26a6)[_0xeabc('0x34')](function(_0xe27492){var _0x152d99=[];var _0x3eaedf=_0xe27492[_0xeabc('0xc7')]['Options'];_0x3eaedf[_0xeabc('0xb5')](function(_0x10b35b){_0x152d99[_0xeabc('0xb7')]({'name':_0x10b35b[_0xeabc('0xc8')][_0xeabc('0xc9')][_0xeabc('0xc8')],'value':String(_0x10b35b[_0xeabc('0xca')])});});var _0x5bb5d6={'id':_0x2d4ca9+'_'+_0xe27492[_0xeabc('0xb4')],'name':_0xe27492['DisplayName'][_0xeabc('0xc9')][_0xeabc('0xc8')],'custom':![],'options':_0x152d99};_0x5805c9['push'](_0x5bb5d6);return _0x5805c9;});}function getBooleanList(_0x1b8782,_0x4c8bf3,_0x23529f,_0x241ead,_0x8f9cb6,_0x11ec16){var _0x45145c={'method':_0xeabc('0xb1'),'uri':_0x1b8782+_0xeabc('0xcb')+_0x241ead+_0xeabc('0xcc')+_0x8f9cb6+_0xeabc('0xcd'),'headers':{'Authorization':'Bearer\x20'+_0x11ec16,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x45145c)[_0xeabc('0x34')](function(_0x44e6be){var _0x5f1e61=[];_0x5f1e61[_0xeabc('0xb7')]({'name':_0x44e6be['OptionSet'][_0xeabc('0xce')][_0xeabc('0xc8')][_0xeabc('0xc9')][_0xeabc('0xc8')],'value':_0xeabc('0xcf')},{'name':_0x44e6be[_0xeabc('0xc7')]['FalseOption'][_0xeabc('0xc8')]['UserLocalizedLabel'][_0xeabc('0xc8')],'value':_0xeabc('0xd0')});var _0x1fa464={'id':_0x4c8bf3+'_'+_0x44e6be[_0xeabc('0xb4')],'name':_0x44e6be['DisplayName'][_0xeabc('0xc9')][_0xeabc('0xc8')],'custom':![],'options':_0x5f1e61};_0x23529f[_0xeabc('0xb7')](_0x1fa464);return _0x23529f;});}function getInputList(_0x47b513,_0x13601f,_0x40f9a9,_0xf4ebc4,_0x53dd5c,_0x4d8faa,_0x584783){var _0x49b434={'method':_0xeabc('0xb1'),'uri':_0x47b513+_0xeabc('0xcb')+_0x53dd5c+')/Attributes('+_0x4d8faa+_0xeabc('0xd1')+_0x40f9a9+_0xeabc('0xd2'),'headers':{'Authorization':_0xeabc('0xad')+_0x584783,'If-None-Match':null,'OData-Version':_0xeabc('0xae')},'json':!![]};return rp(_0x49b434)[_0xeabc('0x34')](function(_0x17fe7a){var _0x26917c={'id':_0x13601f+'_'+_0x17fe7a[_0xeabc('0xb4')],'name':_0x17fe7a[_0xeabc('0xd3')]['UserLocalizedLabel']?_0x17fe7a[_0xeabc('0xd3')]['UserLocalizedLabel'][_0xeabc('0xc8')]:_0x17fe7a[_0xeabc('0xb4')],'custom':![],'options':[]};_0xf4ebc4[_0xeabc('0xb7')](_0x26917c);return _0xf4ebc4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 39b47c2..812113a 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 _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 +var _0x14fb=['../../config/logger','../../components/integrations/configuration','exports','Dynamics365Account','int_dynamics365_accounts','util'];(function(_0x1248ea,_0x1b3406){var _0x3c7144=function(_0x2a14cb){while(--_0x2a14cb){_0x1248ea['push'](_0x1248ea['shift']());}};_0x3c7144(++_0x1b3406);}(_0x14fb,0x107));var _0xb14f=function(_0x2066f8,_0x1cc690){_0x2066f8=_0x2066f8-0x0;var _0x48245a=_0x14fb[_0x2066f8];return _0x48245a;};'use strict';var _=require('lodash');var util=require(_0xb14f('0x0'));var logger=require(_0xb14f('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xb14f('0x2'));module[_0xb14f('0x3')]=function(_0x5cd12d,_0x3e3416){return _0x5cd12d['define'](_0xb14f('0x4'),attributes,{'tableName':_0xb14f('0x5'),'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 6dbdf3b..3c3192b 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 _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 +var _0x3a6d=['client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','where','attributes','limit','include','model','map','debug','ShowDynamics365Account','find','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x390840,_0x132155){var _0x144914=function(_0x375bc1){while(--_0x375bc1){_0x390840['push'](_0x390840['shift']());}};_0x144914(++_0x132155);}(_0x3a6d,0x143));var _0xd3a6=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x3a6d[_0x209941];return _0x1e8729;};'use strict';var _=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var rs=require(_0xd3a6('0x3'));var fs=require('fs');var Redis=require(_0xd3a6('0x4'));var db=require(_0xd3a6('0x5'))['db'];var utils=require(_0xd3a6('0x6'));var logger=require('../../config/logger')(_0xd3a6('0x7'));var config=require(_0xd3a6('0x8'));var jayson=require(_0xd3a6('0x9'));var client=jayson[_0xd3a6('0xa')][_0xd3a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x282cb1,_0x58d83a,_0x121bd2){return new BPromise(function(_0x134dd3,_0x16858){return client[_0xd3a6('0xc')](_0x282cb1,_0x121bd2)[_0xd3a6('0xd')](function(_0xa67661){logger[_0xd3a6('0xe')](_0xd3a6('0xf'),_0x58d83a,_0xd3a6('0x10'));logger['debug'](_0xd3a6('0x11'),_0x58d83a,_0xd3a6('0x10'),JSON[_0xd3a6('0x12')](_0xa67661));if(_0xa67661[_0xd3a6('0x13')]){if(_0xa67661[_0xd3a6('0x13')]['code']===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x58d83a,_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);return _0x16858(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}logger[_0xd3a6('0x13')](_0xd3a6('0xf'),_0x58d83a,_0xa67661[_0xd3a6('0x13')]['message']);return _0x134dd3(_0xa67661[_0xd3a6('0x13')][_0xd3a6('0x14')]);}else{logger[_0xd3a6('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x58d83a,_0xd3a6('0x10'));_0x134dd3(_0xa67661[_0xd3a6('0x15')][_0xd3a6('0x14')]);}})['catch'](function(_0x3498d5){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x58d83a,_0x3498d5);_0x16858(_0x3498d5);});});}exports[_0xd3a6('0x16')]=function(_0x8d1286){var _0x32683f=this;return new Promise(function(_0xbe58b4,_0x22fb05){return db[_0xd3a6('0x17')][_0xd3a6('0x18')]({'raw':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1a')]||null:null,'attributes':_0x8d1286[_0xd3a6('0x19')]?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'limit':_0x8d1286['options']?_0x8d1286[_0xd3a6('0x19')][_0xd3a6('0x1c')]||null:null,'include':_0x8d1286['options']?_0x8d1286['options']['include']?_['map'](_0x8d1286['options'][_0xd3a6('0x1d')],function(_0x400982){return{'model':db[_0x400982[_0xd3a6('0x1e')]],'as':_0x400982['as'],'attributes':_0x400982['attributes'],'include':_0x400982[_0xd3a6('0x1d')]?_['map'](_0x400982[_0xd3a6('0x1d')],function(_0x16afc8){return{'model':db[_0x16afc8[_0xd3a6('0x1e')]],'as':_0x16afc8['as'],'attributes':_0x16afc8['attributes'],'include':_0x16afc8[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x16afc8[_0xd3a6('0x1d')],function(_0x219e32){return{'model':db[_0x219e32[_0xd3a6('0x1e')]],'as':_0x219e32['as'],'attributes':_0x219e32[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30df90){logger[_0xd3a6('0xe')](_0xd3a6('0x16'),_0x8d1286);logger[_0xd3a6('0x20')](_0xd3a6('0x16'),_0x8d1286,JSON[_0xd3a6('0x12')](_0x30df90));_0xbe58b4(_0x30df90);})['catch'](function(_0x535bd4){logger[_0xd3a6('0x13')](_0xd3a6('0x16'),_0x535bd4[_0xd3a6('0x14')],_0x8d1286);_0x22fb05(_0x32683f[_0xd3a6('0x13')](0x1f4,_0x535bd4['message']));});});};exports[_0xd3a6('0x21')]=function(_0xa4efd){var _0x4d322a=this;return new Promise(function(_0x14381c,_0x5d9867){return db[_0xd3a6('0x17')][_0xd3a6('0x22')]({'raw':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x23')]===undefined?!![]:![]:!![],'where':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd[_0xd3a6('0x19')]['where']||null:null,'attributes':_0xa4efd['options']?_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1b')]||null:null,'include':_0xa4efd[_0xd3a6('0x19')]?_0xa4efd['options'][_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0xa4efd[_0xd3a6('0x19')][_0xd3a6('0x1d')],function(_0x3ebd0d){return{'model':db[_0x3ebd0d[_0xd3a6('0x1e')]],'as':_0x3ebd0d['as'],'attributes':_0x3ebd0d[_0xd3a6('0x1b')],'include':_0x3ebd0d[_0xd3a6('0x1d')]?_['map'](_0x3ebd0d[_0xd3a6('0x1d')],function(_0x41981c){return{'model':db[_0x41981c[_0xd3a6('0x1e')]],'as':_0x41981c['as'],'attributes':_0x41981c[_0xd3a6('0x1b')],'include':_0x41981c[_0xd3a6('0x1d')]?_[_0xd3a6('0x1f')](_0x41981c['include'],function(_0x16a30a){return{'model':db[_0x16a30a['model']],'as':_0x16a30a['as'],'attributes':_0x16a30a[_0xd3a6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd3a6('0xd')](function(_0x180bb9){logger[_0xd3a6('0xe')]('ShowDynamics365Account',_0xa4efd);logger['debug'](_0xd3a6('0x21'),_0xa4efd,JSON[_0xd3a6('0x12')](_0x180bb9));_0x14381c(_0x180bb9);})[_0xd3a6('0x24')](function(_0x5188e1){logger[_0xd3a6('0x13')](_0xd3a6('0x21'),_0x5188e1['message'],_0xa4efd);_0x5d9867(_0x4d322a[_0xd3a6('0x13')](0x1f4,_0x5188e1['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 54d68e3..1b71fc3 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 _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 +var _0xc647=['destroy','exports','connect-timeout','express','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x1e777f,_0x1b0acd){var _0x524b9a=function(_0x571c64){while(--_0x571c64){_0x1e777f['push'](_0x1e777f['shift']());}};_0x524b9a(++_0x1b0acd);}(_0xc647,0xb6));var _0x7c64=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xc647[_0x18a79d];return _0x4f8848;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x7c64('0x0'));var express=require(_0x7c64('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7c64('0x2'));var config=require('../../config/environment');var controller=require(_0x7c64('0x3'));router[_0x7c64('0x4')]('/',auth[_0x7c64('0x5')](),controller[_0x7c64('0x6')]);router[_0x7c64('0x4')](_0x7c64('0x7'),auth[_0x7c64('0x5')](),controller[_0x7c64('0x8')]);router[_0x7c64('0x4')](_0x7c64('0x9'),auth[_0x7c64('0x5')](),controller['getFields']);router[_0x7c64('0x4')](_0x7c64('0xa'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x7c64('0x4')](_0x7c64('0xb'),auth[_0x7c64('0x5')](),controller[_0x7c64('0xc')]);router[_0x7c64('0xd')]('/',auth['isAuthenticated'](),controller[_0x7c64('0xe')]);router[_0x7c64('0xf')](_0x7c64('0x7'),auth[_0x7c64('0x5')](),controller[_0x7c64('0x10')]);router[_0x7c64('0x11')](_0x7c64('0x7'),auth[_0x7c64('0x5')](),controller[_0x7c64('0x12')]);module[_0x7c64('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 46e04f8..a362b63 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 _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 +var _0xaf7b=['incident','phonecall','exports'];(function(_0x220af6,_0x338c7c){var _0x141675=function(_0x4fa85e){while(--_0x4fa85e){_0x220af6['push'](_0x220af6['shift']());}};_0x141675(++_0x338c7c);}(_0xaf7b,0x16d));var _0xbaf7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaf7b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xbaf7('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0xbaf7('0x1'),_0xbaf7('0x2')),'defaultValue':_0xbaf7('0x1')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ad3e458..f807e46 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 _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 +var _0x0aeb=['attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Dynamics365Configuration','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','update','destroy','getFields','Dynamics365Field','getSubjects','findOne','nolimit','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','status','end','json','count','offset','set','Content-Range','reject','save','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0aeb,0x7c));var _0xb0ae=function(_0x55cc21,_0x2fbe8b){_0x55cc21=_0x55cc21-0x0;var _0xb30fa1=_0x0aeb[_0x55cc21];return _0xb30fa1;};'use strict';var pdf=require(_0xb0ae('0x0'));var emlformat=require(_0xb0ae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb0ae('0x2'));var jsonpatch=require(_0xb0ae('0x3'));var rp=require(_0xb0ae('0x4'));var moment=require('moment');var BPromise=require(_0xb0ae('0x5'));var Mustache=require(_0xb0ae('0x6'));var util=require(_0xb0ae('0x7'));var path=require(_0xb0ae('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb0ae('0x9'));var squel=require(_0xb0ae('0xa'));var crypto=require(_0xb0ae('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb0ae('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb0ae('0xd'));var Papa=require(_0xb0ae('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb0ae('0xf'));var hardwareService=require(_0xb0ae('0x10'));var logger=require(_0xb0ae('0x11'))(_0xb0ae('0x12'));var utils=require(_0xb0ae('0x13'));var config=require(_0xb0ae('0x14'));var licenseUtil=require(_0xb0ae('0x15'));var db=require(_0xb0ae('0x16'))['db'];var jayson=require(_0xb0ae('0x17'));var client=jayson[_0xb0ae('0x18')][_0xb0ae('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2c8d2d,_0x47413f,_0x341839,_0x76fbe8){return new BPromise(function(_0x5e3c9c,_0x2dc2cb){var _0x49a0a6=_0x76fbe8||client;return _0x49a0a6[_0xb0ae('0x1a')](_0x2c8d2d,_0x341839)[_0xb0ae('0x1b')](function(_0x3649a4){logger[_0xb0ae('0x1c')](_0xb0ae('0x1d'),_0x47413f,'request\x20sent');logger['debug'](_0xb0ae('0x1e'),_0x47413f,_0xb0ae('0x1f'),JSON[_0xb0ae('0x20')](_0x3649a4));if(_0x3649a4[_0xb0ae('0x21')]){if(_0x3649a4[_0xb0ae('0x21')][_0xb0ae('0x22')]===0x1f4){logger[_0xb0ae('0x21')](_0xb0ae('0x1d'),_0x47413f,_0x3649a4['error'][_0xb0ae('0x23')]);return _0x2dc2cb(_0x3649a4[_0xb0ae('0x21')]['message']);}logger[_0xb0ae('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47413f,_0x3649a4[_0xb0ae('0x21')]['message']);return _0x5e3c9c(_0x3649a4[_0xb0ae('0x21')][_0xb0ae('0x23')]);}else{logger[_0xb0ae('0x1c')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47413f,_0xb0ae('0x1f'));_0x5e3c9c(_0x3649a4['result']['message']);}})['catch'](function(_0x3dbb36){logger[_0xb0ae('0x21')](_0xb0ae('0x1d'),_0x47413f,_0x3dbb36);_0x2dc2cb(_0x3dbb36);});});}function respondWithStatusCode(_0x419721,_0x1f1588){_0x1f1588=_0x1f1588||0xcc;return function(_0x582c87){if(_0x582c87){return _0x419721['sendStatus'](_0x1f1588);}return _0x419721[_0xb0ae('0x24')](_0x1f1588)[_0xb0ae('0x25')]();};}function respondWithResult(_0x2730e9,_0x7fee2f){_0x7fee2f=_0x7fee2f||0xc8;return function(_0x1a0559){if(_0x1a0559){return _0x2730e9[_0xb0ae('0x24')](_0x7fee2f)[_0xb0ae('0x26')](_0x1a0559);}};}function respondWithFilteredResult(_0x36c778,_0x3667c9){return function(_0x540919){if(_0x540919){var _0x3fd7aa=_0x540919[_0xb0ae('0x27')],_0x272add=_0x3667c9[_0xb0ae('0x28')],_0x182912=_0x3667c9[_0xb0ae('0x28')]+_0x3667c9['limit'],_0x3a1793;if(_0x182912>=_0x3fd7aa){_0x182912=_0x3fd7aa;_0x3a1793=0xc8;}else{_0x3a1793=0xce;}_0x36c778['status'](_0x3a1793);return _0x36c778[_0xb0ae('0x29')](_0xb0ae('0x2a'),_0x272add+'-'+_0x182912+'/'+_0x3fd7aa)['json'](_0x540919);}return null;};}function patchUpdates(_0x4bb06f){return function(_0x1b1244){try{jsonpatch['apply'](_0x1b1244,_0x4bb06f,!![]);}catch(_0xbc2b65){return BPromise[_0xb0ae('0x2b')](_0xbc2b65);}return _0x1b1244[_0xb0ae('0x2c')]();};}function saveUpdates(_0x5c5783,_0x237bd0){return function(_0x518901){if(_0x518901){return _0x518901['update'](_0x5c5783)['then'](function(_0xa31ca7){return _0xa31ca7;});}return null;};}function removeEntity(_0x1e2e58,_0x4df1c2){return function(_0x2543dc){if(_0x2543dc){return _0x2543dc['destroy']()[_0xb0ae('0x1b')](function(){_0x1e2e58[_0xb0ae('0x24')](0xcc)[_0xb0ae('0x25')]();});}};}function handleEntityNotFound(_0x4bdf1b,_0x379ff0){return function(_0x51b328){if(!_0x51b328){_0x4bdf1b[_0xb0ae('0x2d')](0x194);}return _0x51b328;};}function handleError(_0x44d4a2,_0x18e989){_0x18e989=_0x18e989||0x1f4;return function(_0x121201){logger[_0xb0ae('0x21')](_0x121201[_0xb0ae('0x2e')]);if(_0x121201[_0xb0ae('0x2f')]){delete _0x121201['name'];}_0x44d4a2['status'](_0x18e989)[_0xb0ae('0x30')](_0x121201);};}exports[_0xb0ae('0x31')]=function(_0x33ff29,_0x2f6999){var _0x949d53={},_0x5f471e={},_0x2d3353={'count':0x0,'rows':[]};var _0x332d1f=_[_0xb0ae('0x32')](db['Dynamics365Configuration'][_0xb0ae('0x33')],function(_0x2094ae){return{'name':_0x2094ae['fieldName'],'type':_0x2094ae[_0xb0ae('0x34')][_0xb0ae('0x35')]};});_0x5f471e[_0xb0ae('0x36')]=_[_0xb0ae('0x32')](_0x332d1f,_0xb0ae('0x2f'));_0x5f471e['query']=_[_0xb0ae('0x37')](_0x33ff29[_0xb0ae('0x38')]);_0x5f471e['filters']=_[_0xb0ae('0x39')](_0x5f471e[_0xb0ae('0x36')],_0x5f471e[_0xb0ae('0x38')]);_0x949d53[_0xb0ae('0x3a')]=_[_0xb0ae('0x39')](_0x5f471e[_0xb0ae('0x36')],qs['fields'](_0x33ff29[_0xb0ae('0x38')][_0xb0ae('0x3b')]));_0x949d53[_0xb0ae('0x3a')]=_0x949d53[_0xb0ae('0x3a')]['length']?_0x949d53[_0xb0ae('0x3a')]:_0x5f471e[_0xb0ae('0x36')];if(!_0x33ff29[_0xb0ae('0x38')][_0xb0ae('0x3c')]('nolimit')){_0x949d53[_0xb0ae('0x3d')]=qs[_0xb0ae('0x3d')](_0x33ff29[_0xb0ae('0x38')][_0xb0ae('0x3d')]);_0x949d53[_0xb0ae('0x28')]=qs[_0xb0ae('0x28')](_0x33ff29[_0xb0ae('0x38')]['offset']);}_0x949d53[_0xb0ae('0x3e')]=qs[_0xb0ae('0x3f')](_0x33ff29[_0xb0ae('0x38')][_0xb0ae('0x3f')]);_0x949d53[_0xb0ae('0x40')]=qs[_0xb0ae('0x41')](_[_0xb0ae('0x42')](_0x33ff29[_0xb0ae('0x38')],_0x5f471e[_0xb0ae('0x41')]),_0x332d1f);if(_0x33ff29[_0xb0ae('0x38')][_0xb0ae('0x43')]){_0x949d53['where']=_[_0xb0ae('0x44')](_0x949d53[_0xb0ae('0x40')],{'$or':_[_0xb0ae('0x32')](_0x332d1f,function(_0x14a4ea){if(_0x14a4ea[_0xb0ae('0x34')]!==_0xb0ae('0x45')){var _0x2d0152={};_0x2d0152[_0x14a4ea[_0xb0ae('0x2f')]]={'$like':'%'+_0x33ff29[_0xb0ae('0x38')]['filter']+'%'};return _0x2d0152;}})});}_0x949d53=_[_0xb0ae('0x44')]({},_0x949d53,_0x33ff29['options']);var _0x5e6fbb={'where':_0x949d53['where']};return db[_0xb0ae('0x46')]['count'](_0x5e6fbb)[_0xb0ae('0x1b')](function(_0x5cbcb9){_0x2d3353[_0xb0ae('0x27')]=_0x5cbcb9;if(_0x33ff29[_0xb0ae('0x38')][_0xb0ae('0x47')]){_0x949d53[_0xb0ae('0x48')]=[{'all':!![]}];}return db[_0xb0ae('0x46')][_0xb0ae('0x49')](_0x949d53);})[_0xb0ae('0x1b')](function(_0xa4f796){_0x2d3353[_0xb0ae('0x4a')]=_0xa4f796;return _0x2d3353;})[_0xb0ae('0x1b')](respondWithFilteredResult(_0x2f6999,_0x949d53))[_0xb0ae('0x4b')](handleError(_0x2f6999,null));};exports[_0xb0ae('0x4c')]=function(_0x558ecc,_0x4104f9){var _0x23cf1d={'raw':![],'where':{'id':_0x558ecc[_0xb0ae('0x4d')]['id']}},_0x479dac={};_0x479dac[_0xb0ae('0x36')]=_['keys'](db[_0xb0ae('0x46')][_0xb0ae('0x33')]);_0x479dac[_0xb0ae('0x38')]=_[_0xb0ae('0x37')](_0x558ecc['query']);_0x479dac[_0xb0ae('0x41')]=_[_0xb0ae('0x39')](_0x479dac['model'],_0x479dac[_0xb0ae('0x38')]);_0x23cf1d[_0xb0ae('0x3a')]=_[_0xb0ae('0x39')](_0x479dac[_0xb0ae('0x36')],qs[_0xb0ae('0x3b')](_0x558ecc[_0xb0ae('0x38')][_0xb0ae('0x3b')]));_0x23cf1d[_0xb0ae('0x3a')]=_0x23cf1d[_0xb0ae('0x3a')][_0xb0ae('0x4e')]?_0x23cf1d[_0xb0ae('0x3a')]:_0x479dac['model'];if(_0x558ecc[_0xb0ae('0x38')]['includeAll']){_0x23cf1d['include']=[{'all':!![]}];}_0x23cf1d=_[_0xb0ae('0x44')]({},_0x23cf1d,_0x558ecc[_0xb0ae('0x4f')]);return db[_0xb0ae('0x46')][_0xb0ae('0x50')](_0x23cf1d)['then'](handleEntityNotFound(_0x4104f9,null))['then'](respondWithResult(_0x4104f9,null))[_0xb0ae('0x4b')](handleError(_0x4104f9,null));};exports[_0xb0ae('0x51')]=function(_0x321057,_0x400b5b){return db[_0xb0ae('0x46')][_0xb0ae('0x51')](_0x321057[_0xb0ae('0x52')],{})[_0xb0ae('0x1b')](respondWithResult(_0x400b5b,0xc9))[_0xb0ae('0x4b')](handleError(_0x400b5b,null));};exports[_0xb0ae('0x53')]=function(_0x29ce19,_0x1eb475){if(_0x29ce19[_0xb0ae('0x52')]['id']){delete _0x29ce19[_0xb0ae('0x52')]['id'];}return db[_0xb0ae('0x46')][_0xb0ae('0x50')]({'where':{'id':_0x29ce19[_0xb0ae('0x4d')]['id']}})[_0xb0ae('0x1b')](handleEntityNotFound(_0x1eb475,null))[_0xb0ae('0x1b')](saveUpdates(_0x29ce19[_0xb0ae('0x52')],null))[_0xb0ae('0x1b')](respondWithResult(_0x1eb475,null))[_0xb0ae('0x4b')](handleError(_0x1eb475,null));};exports[_0xb0ae('0x54')]=function(_0x11717a,_0x2ce047){return db[_0xb0ae('0x46')][_0xb0ae('0x50')]({'where':{'id':_0x11717a[_0xb0ae('0x4d')]['id']}})[_0xb0ae('0x1b')](handleEntityNotFound(_0x2ce047,null))[_0xb0ae('0x1b')](removeEntity(_0x2ce047,null))['catch'](handleError(_0x2ce047,null));};exports[_0xb0ae('0x55')]=function(_0x383d13,_0x254352,_0x5a800b){var _0x32feea={};var _0x4a6580={};var _0x59975f;var _0x4a2c1b;return db[_0xb0ae('0x46')]['findOne']({'where':{'id':_0x383d13[_0xb0ae('0x4d')]['id']}})['then'](handleEntityNotFound(_0x254352,null))[_0xb0ae('0x1b')](function(_0xbf5d53){if(_0xbf5d53){_0x59975f=_0xbf5d53;_0x4a6580[_0xb0ae('0x36')]=_[_0xb0ae('0x37')](db[_0xb0ae('0x56')][_0xb0ae('0x33')]);_0x4a6580[_0xb0ae('0x38')]=_[_0xb0ae('0x37')](_0x383d13[_0xb0ae('0x38')]);_0x4a6580[_0xb0ae('0x41')]=_['intersection'](_0x4a6580['model'],_0x4a6580[_0xb0ae('0x38')]);_0x32feea['attributes']=_[_0xb0ae('0x39')](_0x4a6580[_0xb0ae('0x36')],qs[_0xb0ae('0x3b')](_0x383d13['query'][_0xb0ae('0x3b')]));_0x32feea[_0xb0ae('0x3a')]=_0x32feea[_0xb0ae('0x3a')][_0xb0ae('0x4e')]?_0x32feea[_0xb0ae('0x3a')]:_0x4a6580['model'];_0x32feea[_0xb0ae('0x3e')]=qs[_0xb0ae('0x3f')](_0x383d13[_0xb0ae('0x38')]['sort']);_0x32feea[_0xb0ae('0x40')]=qs[_0xb0ae('0x41')](_[_0xb0ae('0x42')](_0x383d13[_0xb0ae('0x38')],_0x4a6580[_0xb0ae('0x41')]));if(_0x383d13[_0xb0ae('0x38')][_0xb0ae('0x43')]){_0x32feea[_0xb0ae('0x40')]=_[_0xb0ae('0x44')](_0x32feea[_0xb0ae('0x40')],{'$or':_[_0xb0ae('0x32')](_0x32feea[_0xb0ae('0x3a')],function(_0x3e03a2){var _0x5c2d89={};_0x5c2d89[_0x3e03a2]={'$like':'%'+_0x383d13['query'][_0xb0ae('0x43')]+'%'};return _0x5c2d89;})});}_0x32feea=_[_0xb0ae('0x44')]({},_0x32feea,_0x383d13['options']);return _0x59975f[_0xb0ae('0x55')](_0x32feea);}})[_0xb0ae('0x1b')](function(_0x43679c){if(_0x43679c){_0x4a2c1b=_0x43679c['length'];if(!_0x383d13[_0xb0ae('0x38')][_0xb0ae('0x3c')]('nolimit')){_0x32feea[_0xb0ae('0x3d')]=qs[_0xb0ae('0x3d')](_0x383d13[_0xb0ae('0x38')][_0xb0ae('0x3d')]);_0x32feea['offset']=qs[_0xb0ae('0x28')](_0x383d13[_0xb0ae('0x38')][_0xb0ae('0x28')]);}return _0x59975f[_0xb0ae('0x55')](_0x32feea);}})[_0xb0ae('0x1b')](function(_0x1f2b81){if(_0x1f2b81){return _0x1f2b81?{'count':_0x4a2c1b,'rows':_0x1f2b81}:null;}})[_0xb0ae('0x1b')](respondWithResult(_0x254352,null))[_0xb0ae('0x4b')](handleError(_0x254352,null));};exports[_0xb0ae('0x57')]=function(_0x188fd4,_0x3ff38a,_0x32e83a){var _0x10d332={};var _0x5e0f58={};var _0x398530;var _0x2511d1;return db['Dynamics365Configuration'][_0xb0ae('0x58')]({'where':{'id':_0x188fd4[_0xb0ae('0x4d')]['id']}})[_0xb0ae('0x1b')](handleEntityNotFound(_0x3ff38a,null))[_0xb0ae('0x1b')](function(_0x231a4e){if(_0x231a4e){_0x398530=_0x231a4e;_0x5e0f58[_0xb0ae('0x36')]=_[_0xb0ae('0x37')](db[_0xb0ae('0x56')]['rawAttributes']);_0x5e0f58[_0xb0ae('0x38')]=_[_0xb0ae('0x37')](_0x188fd4['query']);_0x5e0f58[_0xb0ae('0x41')]=_[_0xb0ae('0x39')](_0x5e0f58['model'],_0x5e0f58['query']);_0x10d332[_0xb0ae('0x3a')]=_[_0xb0ae('0x39')](_0x5e0f58['model'],qs[_0xb0ae('0x3b')](_0x188fd4[_0xb0ae('0x38')][_0xb0ae('0x3b')]));_0x10d332['attributes']=_0x10d332[_0xb0ae('0x3a')][_0xb0ae('0x4e')]?_0x10d332[_0xb0ae('0x3a')]:_0x5e0f58[_0xb0ae('0x36')];_0x10d332['order']=qs[_0xb0ae('0x3f')](_0x188fd4['query'][_0xb0ae('0x3f')]);_0x10d332[_0xb0ae('0x40')]=qs['filters'](_['pick'](_0x188fd4[_0xb0ae('0x38')],_0x5e0f58[_0xb0ae('0x41')]));if(_0x188fd4[_0xb0ae('0x38')][_0xb0ae('0x43')]){_0x10d332[_0xb0ae('0x40')]=_[_0xb0ae('0x44')](_0x10d332[_0xb0ae('0x40')],{'$or':_[_0xb0ae('0x32')](_0x10d332[_0xb0ae('0x3a')],function(_0x4847b2){var _0x4f98d3={};_0x4f98d3[_0x4847b2]={'$like':'%'+_0x188fd4['query']['filter']+'%'};return _0x4f98d3;})});}_0x10d332=_[_0xb0ae('0x44')]({},_0x10d332,_0x188fd4[_0xb0ae('0x4f')]);return _0x398530['getSubjects'](_0x10d332);}})[_0xb0ae('0x1b')](function(_0xbfc695){if(_0xbfc695){_0x2511d1=_0xbfc695['length'];if(!_0x188fd4[_0xb0ae('0x38')]['hasOwnProperty'](_0xb0ae('0x59'))){_0x10d332[_0xb0ae('0x3d')]=qs[_0xb0ae('0x3d')](_0x188fd4[_0xb0ae('0x38')][_0xb0ae('0x3d')]);_0x10d332[_0xb0ae('0x28')]=qs[_0xb0ae('0x28')](_0x188fd4[_0xb0ae('0x38')][_0xb0ae('0x28')]);}return _0x398530[_0xb0ae('0x57')](_0x10d332);}})[_0xb0ae('0x1b')](function(_0x2b2c85){if(_0x2b2c85){return _0x2b2c85?{'count':_0x2511d1,'rows':_0x2b2c85}:null;}})['then'](respondWithResult(_0x3ff38a,null))['catch'](handleError(_0x3ff38a,null));};exports[_0xb0ae('0x5a')]=function(_0x300d2c,_0x1abd7b,_0x5de9fe){var _0xd3c418={};var _0x34c9fa={};var _0x1a27c7;var _0x195288;return db[_0xb0ae('0x46')][_0xb0ae('0x58')]({'where':{'id':_0x300d2c['params']['id']}})[_0xb0ae('0x1b')](handleEntityNotFound(_0x1abd7b,null))[_0xb0ae('0x1b')](function(_0x15111d){if(_0x15111d){_0x1a27c7=_0x15111d;_0x34c9fa['model']=_[_0xb0ae('0x37')](db[_0xb0ae('0x56')][_0xb0ae('0x33')]);_0x34c9fa['query']=_['keys'](_0x300d2c[_0xb0ae('0x38')]);_0x34c9fa[_0xb0ae('0x41')]=_[_0xb0ae('0x39')](_0x34c9fa['model'],_0x34c9fa['query']);_0xd3c418[_0xb0ae('0x3a')]=_[_0xb0ae('0x39')](_0x34c9fa[_0xb0ae('0x36')],qs[_0xb0ae('0x3b')](_0x300d2c[_0xb0ae('0x38')]['fields']));_0xd3c418[_0xb0ae('0x3a')]=_0xd3c418[_0xb0ae('0x3a')][_0xb0ae('0x4e')]?_0xd3c418[_0xb0ae('0x3a')]:_0x34c9fa[_0xb0ae('0x36')];_0xd3c418[_0xb0ae('0x3e')]=qs[_0xb0ae('0x3f')](_0x300d2c[_0xb0ae('0x38')]['sort']);_0xd3c418[_0xb0ae('0x40')]=qs[_0xb0ae('0x41')](_[_0xb0ae('0x42')](_0x300d2c[_0xb0ae('0x38')],_0x34c9fa[_0xb0ae('0x41')]));if(_0x300d2c['query'][_0xb0ae('0x43')]){_0xd3c418[_0xb0ae('0x40')]=_[_0xb0ae('0x44')](_0xd3c418[_0xb0ae('0x40')],{'$or':_[_0xb0ae('0x32')](_0xd3c418[_0xb0ae('0x3a')],function(_0x3a3d04){var _0x186598={};_0x186598[_0x3a3d04]={'$like':'%'+_0x300d2c[_0xb0ae('0x38')][_0xb0ae('0x43')]+'%'};return _0x186598;})});}_0xd3c418=_[_0xb0ae('0x44')]({},_0xd3c418,_0x300d2c[_0xb0ae('0x4f')]);return _0x1a27c7['getDescriptions'](_0xd3c418);}})['then'](function(_0x54f4a2){if(_0x54f4a2){_0x195288=_0x54f4a2['length'];if(!_0x300d2c[_0xb0ae('0x38')]['hasOwnProperty'](_0xb0ae('0x59'))){_0xd3c418['limit']=qs['limit'](_0x300d2c['query']['limit']);_0xd3c418[_0xb0ae('0x28')]=qs['offset'](_0x300d2c[_0xb0ae('0x38')][_0xb0ae('0x28')]);}return _0x1a27c7[_0xb0ae('0x5a')](_0xd3c418);}})[_0xb0ae('0x1b')](function(_0x66988f){if(_0x66988f){return _0x66988f?{'count':_0x195288,'rows':_0x66988f}:null;}})[_0xb0ae('0x1b')](respondWithResult(_0x1abd7b,null))[_0xb0ae('0x4b')](handleError(_0x1abd7b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a0380e9..317e1c3 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 _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 +var _0xbd6e=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5c3d01,_0xab51bc){var _0x1eeb54=function(_0xfcc149){while(--_0xfcc149){_0x5c3d01['push'](_0x5c3d01['shift']());}};_0x1eeb54(++_0xab51bc);}(_0xbd6e,0xd2));var _0xebd6=function(_0x19d64f,_0x2b1572){_0x19d64f=_0x19d64f-0x0;var _0x5c3810=_0xbd6e[_0x19d64f];return _0x5c3810;};'use strict';var _=require(_0xebd6('0x0'));var util=require(_0xebd6('0x1'));var logger=require(_0xebd6('0x2'))(_0xebd6('0x3'));var moment=require(_0xebd6('0x4'));var BPromise=require(_0xebd6('0x5'));var rp=require(_0xebd6('0x6'));var fs=require('fs');var path=require(_0xebd6('0x7'));var rimraf=require('rimraf');var config=require(_0xebd6('0x8'));var attributes=require(_0xebd6('0x9'));module['exports']=function(_0x4ae56d,_0x49c69d){return _0x4ae56d[_0xebd6('0xa')](_0xebd6('0xb'),attributes,{'tableName':'int_dynamics365_configurations','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 2a5a32d..251bb9f 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 _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 +var _0x6091=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x24378e,_0x2433bd){var _0x52c410=function(_0xcf16b5){while(--_0xcf16b5){_0x24378e['push'](_0x24378e['shift']());}};_0x52c410(++_0x2433bd);}(_0x6091,0xa2));var _0x1609=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x6091[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x1609('0x0'));var util=require(_0x1609('0x1'));var moment=require('moment');var BPromise=require(_0x1609('0x2'));var rs=require(_0x1609('0x3'));var fs=require('fs');var Redis=require(_0x1609('0x4'));var db=require(_0x1609('0x5'))['db'];var utils=require(_0x1609('0x6'));var logger=require('../../config/logger')(_0x1609('0x7'));var config=require(_0x1609('0x8'));var jayson=require(_0x1609('0x9'));var client=jayson[_0x1609('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x107bc0,_0x3330a2,_0x3ad1d3){return new BPromise(function(_0x1fe6c8,_0x3aea3c){return client[_0x1609('0xb')](_0x107bc0,_0x3ad1d3)[_0x1609('0xc')](function(_0x127aaa){logger[_0x1609('0xd')](_0x1609('0xe'),_0x3330a2,_0x1609('0xf'));logger['debug'](_0x1609('0x10'),_0x3330a2,'request\x20sent',JSON[_0x1609('0x11')](_0x127aaa));if(_0x127aaa['error']){if(_0x127aaa[_0x1609('0x12')][_0x1609('0x13')]===0x1f4){logger[_0x1609('0x12')](_0x1609('0xe'),_0x3330a2,_0x127aaa[_0x1609('0x12')][_0x1609('0x14')]);return _0x3aea3c(_0x127aaa[_0x1609('0x12')]['message']);}logger['error'](_0x1609('0xe'),_0x3330a2,_0x127aaa[_0x1609('0x12')][_0x1609('0x14')]);return _0x1fe6c8(_0x127aaa[_0x1609('0x12')][_0x1609('0x14')]);}else{logger[_0x1609('0xd')](_0x1609('0xe'),_0x3330a2,'request\x20sent');_0x1fe6c8(_0x127aaa[_0x1609('0x15')][_0x1609('0x14')]);}})[_0x1609('0x16')](function(_0x165ef8){logger[_0x1609('0x12')](_0x1609('0xe'),_0x3330a2,_0x165ef8);_0x3aea3c(_0x165ef8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index f3be096..ca1c943 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 _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 +var _0x6953=['./intDynamics365Field.controller','isAuthenticated','get','/:id','show','post','create','delete','destroy','exports','multer','util','Router','../../components/interaction/service','../../config/environment'];(function(_0x19c699,_0x36eeb7){var _0x327fab=function(_0x45cc5d){while(--_0x45cc5d){_0x19c699['push'](_0x19c699['shift']());}};_0x327fab(++_0x36eeb7);}(_0x6953,0x91));var _0x3695=function(_0x5ebf3e,_0x476696){_0x5ebf3e=_0x5ebf3e-0x0;var _0x40f180=_0x6953[_0x5ebf3e];return _0x40f180;};'use strict';var multer=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3695('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x3695('0x3'));var config=require(_0x3695('0x4'));var controller=require(_0x3695('0x5'));router['get']('/',auth[_0x3695('0x6')](),controller['index']);router[_0x3695('0x7')](_0x3695('0x8'),auth[_0x3695('0x6')](),controller[_0x3695('0x9')]);router[_0x3695('0xa')]('/',auth['isAuthenticated'](),controller[_0x3695('0xb')]);router['put'](_0x3695('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x3695('0xc')]('/:id',auth[_0x3695('0x6')](),controller[_0x3695('0xd')]);module[_0x3695('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 9e4c859..9eb061c 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 _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 +var _0x5752=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x45cbbc,_0x209ae8){var _0x40e336=function(_0x42bcbb){while(--_0x42bcbb){_0x45cbbc['push'](_0x45cbbc['shift']());}};_0x40e336(++_0x209ae8);}(_0x5752,0x99));var _0x2575=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x5752[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0x2575('0x0'));module[_0x2575('0x1')]={'type':{'type':Sequelize[_0x2575('0x2')](_0x2575('0x3'),_0x2575('0x4'),_0x2575('0x5'),_0x2575('0x6')),'defaultValue':_0x2575('0x3')},'content':{'type':Sequelize[_0x2575('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2575('0x2')](_0x2575('0x3'),_0x2575('0x4'),_0x2575('0x5'))},'keyContent':{'type':Sequelize[_0x2575('0x7')]},'idField':{'type':Sequelize[_0x2575('0x7')]},'nameField':{'type':Sequelize[_0x2575('0x7')]},'customField':{'type':Sequelize[_0x2575('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2575('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index f39d7af..72ffe9e 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 _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 +var _0x0257=['bluebird','util','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','Dynamics365Field','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x3b9e13,_0x3cdc73){var _0x4ea299=function(_0x3dbfc2){while(--_0x3dbfc2){_0x3b9e13['push'](_0x3b9e13['shift']());}};_0x4ea299(++_0x3cdc73);}(_0x0257,0x11a));var _0x7025=function(_0x294e64,_0x22460a){_0x294e64=_0x294e64-0x0;var _0x42b05b=_0x0257[_0x294e64];return _0x42b05b;};'use strict';var pdf=require(_0x7025('0x0'));var emlformat=require(_0x7025('0x1'));var rimraf=require(_0x7025('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7025('0x3'));var rp=require(_0x7025('0x4'));var moment=require(_0x7025('0x5'));var BPromise=require(_0x7025('0x6'));var Mustache=require('mustache');var util=require(_0x7025('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7025('0x8'));var fs=require('fs');var _=require(_0x7025('0x9'));var squel=require(_0x7025('0xa'));var crypto=require(_0x7025('0xb'));var jsforce=require(_0x7025('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7025('0xd'));var querystring=require('querystring');var Papa=require(_0x7025('0xe'));var Redis=require('ioredis');var authService=require(_0x7025('0xf'));var qs=require(_0x7025('0x10'));var as=require(_0x7025('0x11'));var hardwareService=require(_0x7025('0x12'));var logger=require(_0x7025('0x13'))(_0x7025('0x14'));var utils=require(_0x7025('0x15'));var config=require(_0x7025('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7025('0x17'))['db'];function respondWithStatusCode(_0x33990b,_0x3eaf0f){_0x3eaf0f=_0x3eaf0f||0xcc;return function(_0x4ce728){if(_0x4ce728){return _0x33990b[_0x7025('0x18')](_0x3eaf0f);}return _0x33990b[_0x7025('0x19')](_0x3eaf0f)['end']();};}function respondWithResult(_0x28baf3,_0x575581){_0x575581=_0x575581||0xc8;return function(_0x3c7697){if(_0x3c7697){return _0x28baf3[_0x7025('0x19')](_0x575581)[_0x7025('0x1a')](_0x3c7697);}};}function respondWithFilteredResult(_0x28892b,_0x420ed8){return function(_0x6ac9d9){if(_0x6ac9d9){var _0x1ef32c=_0x6ac9d9['count'],_0x3ee2d1=_0x420ed8['offset'],_0x4518ec=_0x420ed8[_0x7025('0x1b')]+_0x420ed8['limit'],_0x59607d;if(_0x4518ec>=_0x1ef32c){_0x4518ec=_0x1ef32c;_0x59607d=0xc8;}else{_0x59607d=0xce;}_0x28892b['status'](_0x59607d);return _0x28892b[_0x7025('0x1c')](_0x7025('0x1d'),_0x3ee2d1+'-'+_0x4518ec+'/'+_0x1ef32c)[_0x7025('0x1a')](_0x6ac9d9);}return null;};}function patchUpdates(_0x3344bc){return function(_0x1a960a){try{jsonpatch[_0x7025('0x1e')](_0x1a960a,_0x3344bc,!![]);}catch(_0x58906c){return BPromise[_0x7025('0x1f')](_0x58906c);}return _0x1a960a[_0x7025('0x20')]();};}function saveUpdates(_0x29e927,_0x371c21){return function(_0x505eea){if(_0x505eea){return _0x505eea[_0x7025('0x21')](_0x29e927)[_0x7025('0x22')](function(_0x3a9385){return _0x3a9385;});}return null;};}function removeEntity(_0xaf4052,_0xed1db0){return function(_0x42f141){if(_0x42f141){return _0x42f141[_0x7025('0x23')]()[_0x7025('0x22')](function(){_0xaf4052[_0x7025('0x19')](0xcc)[_0x7025('0x24')]();});}};}function handleEntityNotFound(_0x4962a7,_0x29a57f){return function(_0x39bbec){if(!_0x39bbec){_0x4962a7['sendStatus'](0x194);}return _0x39bbec;};}function handleError(_0x316d3b,_0x46cd16){_0x46cd16=_0x46cd16||0x1f4;return function(_0x80d9a6){logger[_0x7025('0x25')](_0x80d9a6['stack']);if(_0x80d9a6['name']){delete _0x80d9a6[_0x7025('0x26')];}_0x316d3b[_0x7025('0x19')](_0x46cd16)[_0x7025('0x27')](_0x80d9a6);};}exports[_0x7025('0x28')]=function(_0x175df5,_0x2b82da){var _0x2ee4ab={},_0xac9548={},_0x5bb3a2={'count':0x0,'rows':[]};var _0x3f9d8b=_['map'](db[_0x7025('0x29')][_0x7025('0x2a')],function(_0x468664){return{'name':_0x468664['fieldName'],'type':_0x468664[_0x7025('0x2b')][_0x7025('0x2c')]};});_0xac9548['model']=_[_0x7025('0x2d')](_0x3f9d8b,_0x7025('0x26'));_0xac9548[_0x7025('0x2e')]=_[_0x7025('0x2f')](_0x175df5[_0x7025('0x2e')]);_0xac9548[_0x7025('0x30')]=_[_0x7025('0x31')](_0xac9548[_0x7025('0x32')],_0xac9548['query']);_0x2ee4ab[_0x7025('0x33')]=_['intersection'](_0xac9548['model'],qs[_0x7025('0x34')](_0x175df5[_0x7025('0x2e')][_0x7025('0x34')]));_0x2ee4ab[_0x7025('0x33')]=_0x2ee4ab[_0x7025('0x33')][_0x7025('0x35')]?_0x2ee4ab[_0x7025('0x33')]:_0xac9548[_0x7025('0x32')];if(!_0x175df5[_0x7025('0x2e')][_0x7025('0x36')](_0x7025('0x37'))){_0x2ee4ab[_0x7025('0x38')]=qs[_0x7025('0x38')](_0x175df5[_0x7025('0x2e')]['limit']);_0x2ee4ab['offset']=qs[_0x7025('0x1b')](_0x175df5[_0x7025('0x2e')][_0x7025('0x1b')]);}_0x2ee4ab[_0x7025('0x39')]=qs['sort'](_0x175df5[_0x7025('0x2e')][_0x7025('0x3a')]);_0x2ee4ab[_0x7025('0x3b')]=qs[_0x7025('0x30')](_[_0x7025('0x3c')](_0x175df5[_0x7025('0x2e')],_0xac9548[_0x7025('0x30')]),_0x3f9d8b);if(_0x175df5[_0x7025('0x2e')]['filter']){_0x2ee4ab['where']=_[_0x7025('0x3d')](_0x2ee4ab[_0x7025('0x3b')],{'$or':_[_0x7025('0x2d')](_0x3f9d8b,function(_0x1f5475){if(_0x1f5475[_0x7025('0x2b')]!=='VIRTUAL'){var _0x462b90={};_0x462b90[_0x1f5475['name']]={'$like':'%'+_0x175df5[_0x7025('0x2e')][_0x7025('0x3e')]+'%'};return _0x462b90;}})});}_0x2ee4ab=_[_0x7025('0x3d')]({},_0x2ee4ab,_0x175df5[_0x7025('0x3f')]);var _0x5d73e9={'where':_0x2ee4ab[_0x7025('0x3b')]};return db[_0x7025('0x29')]['count'](_0x5d73e9)[_0x7025('0x22')](function(_0x235629){_0x5bb3a2['count']=_0x235629;if(_0x175df5[_0x7025('0x2e')][_0x7025('0x40')]){_0x2ee4ab[_0x7025('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7025('0x42')](_0x2ee4ab);})[_0x7025('0x22')](function(_0x2d8bc5){_0x5bb3a2['rows']=_0x2d8bc5;return _0x5bb3a2;})[_0x7025('0x22')](respondWithFilteredResult(_0x2b82da,_0x2ee4ab))[_0x7025('0x43')](handleError(_0x2b82da,null));};exports['show']=function(_0x18cbc9,_0x16ac56){var _0x58bc83={'raw':!![],'where':{'id':_0x18cbc9[_0x7025('0x44')]['id']}},_0x4dfe57={};_0x4dfe57[_0x7025('0x32')]=_[_0x7025('0x2f')](db[_0x7025('0x29')][_0x7025('0x2a')]);_0x4dfe57[_0x7025('0x2e')]=_[_0x7025('0x2f')](_0x18cbc9[_0x7025('0x2e')]);_0x4dfe57[_0x7025('0x30')]=_[_0x7025('0x31')](_0x4dfe57[_0x7025('0x32')],_0x4dfe57[_0x7025('0x2e')]);_0x58bc83['attributes']=_[_0x7025('0x31')](_0x4dfe57['model'],qs[_0x7025('0x34')](_0x18cbc9[_0x7025('0x2e')][_0x7025('0x34')]));_0x58bc83[_0x7025('0x33')]=_0x58bc83['attributes']['length']?_0x58bc83[_0x7025('0x33')]:_0x4dfe57[_0x7025('0x32')];if(_0x18cbc9[_0x7025('0x2e')][_0x7025('0x40')]){_0x58bc83[_0x7025('0x41')]=[{'all':!![]}];}_0x58bc83=_[_0x7025('0x3d')]({},_0x58bc83,_0x18cbc9[_0x7025('0x3f')]);return db[_0x7025('0x29')][_0x7025('0x45')](_0x58bc83)[_0x7025('0x22')](handleEntityNotFound(_0x16ac56,null))['then'](respondWithResult(_0x16ac56,null))['catch'](handleError(_0x16ac56,null));};exports['create']=function(_0x2d3b5c,_0xe4e4d9){return db[_0x7025('0x29')][_0x7025('0x46')](_0x2d3b5c[_0x7025('0x47')],{})['then'](respondWithResult(_0xe4e4d9,0xc9))[_0x7025('0x43')](handleError(_0xe4e4d9,null));};exports[_0x7025('0x21')]=function(_0x4ab071,_0x5b204a){if(_0x4ab071[_0x7025('0x47')]['id']){delete _0x4ab071['body']['id'];}return db[_0x7025('0x29')]['find']({'where':{'id':_0x4ab071[_0x7025('0x44')]['id']}})[_0x7025('0x22')](handleEntityNotFound(_0x5b204a,null))[_0x7025('0x22')](saveUpdates(_0x4ab071[_0x7025('0x47')],null))[_0x7025('0x22')](respondWithResult(_0x5b204a,null))[_0x7025('0x43')](handleError(_0x5b204a,null));};exports[_0x7025('0x23')]=function(_0x1d2980,_0x33bc43){return db[_0x7025('0x29')][_0x7025('0x45')]({'where':{'id':_0x1d2980[_0x7025('0x44')]['id']}})[_0x7025('0x22')](handleEntityNotFound(_0x33bc43,null))[_0x7025('0x22')](removeEntity(_0x33bc43,null))[_0x7025('0x43')](handleError(_0x33bc43,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9486e8d..cf82dcd 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 _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 +var _0x3212=['exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','../../config/logger','api','bluebird','path','./intDynamics365Field.attributes'];(function(_0x40e681,_0x39999a){var _0x8528d2=function(_0x42ba6f){while(--_0x42ba6f){_0x40e681['push'](_0x40e681['shift']());}};_0x8528d2(++_0x39999a);}(_0x3212,0x165));var _0x2321=function(_0x2d29c0,_0x4fd9e9){_0x2d29c0=_0x2d29c0-0x0;var _0x13f86f=_0x3212[_0x2d29c0];return _0x13f86f;};'use strict';var _=require(_0x2321('0x0'));var util=require('util');var logger=require(_0x2321('0x1'))(_0x2321('0x2'));var moment=require('moment');var BPromise=require(_0x2321('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2321('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2321('0x5'));module[_0x2321('0x6')]=function(_0x2fbe2b,_0x55cf79){return _0x2fbe2b[_0x2321('0x7')](_0x2321('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x2321('0x9'),'fields':[_0x2321('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 33b424b..7462f4f 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 _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 +var _0x363e=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x363e,0x179));var _0xe363=function(_0x354871,_0x2e1491){_0x354871=_0x354871-0x0;var _0x4c3d9a=_0x363e[_0x354871];return _0x4c3d9a;};'use strict';var _=require(_0xe363('0x0'));var util=require(_0xe363('0x1'));var moment=require('moment');var BPromise=require(_0xe363('0x2'));var rs=require(_0xe363('0x3'));var fs=require('fs');var Redis=require(_0xe363('0x4'));var db=require(_0xe363('0x5'))['db'];var utils=require(_0xe363('0x6'));var logger=require(_0xe363('0x7'))(_0xe363('0x8'));var config=require(_0xe363('0x9'));var jayson=require(_0xe363('0xa'));var client=jayson[_0xe363('0xb')][_0xe363('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4fe10b,_0x1fc808,_0x30bffc){return new BPromise(function(_0xc5df66,_0x29d330){return client['request'](_0x4fe10b,_0x30bffc)[_0xe363('0xd')](function(_0x308de7){logger[_0xe363('0xe')](_0xe363('0xf'),_0x1fc808,_0xe363('0x10'));logger[_0xe363('0x11')](_0xe363('0x12'),_0x1fc808,'request\x20sent',JSON[_0xe363('0x13')](_0x308de7));if(_0x308de7[_0xe363('0x14')]){if(_0x308de7['error'][_0xe363('0x15')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0x29d330(_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);}logger[_0xe363('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0x308de7[_0xe363('0x14')][_0xe363('0x16')]);return _0xc5df66(_0x308de7['error'][_0xe363('0x16')]);}else{logger[_0xe363('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x1fc808,_0xe363('0x10'));_0xc5df66(_0x308de7[_0xe363('0x17')]['message']);}})[_0xe363('0x18')](function(_0xc94d0a){logger['error'](_0xe363('0xf'),_0x1fc808,_0xc94d0a);_0x29d330(_0xc94d0a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 784e8ea..8a0c987 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 _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 +var _0xa09a=['addConfiguration','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations'];(function(_0x309639,_0x239245){var _0x357c62=function(_0x173c39){while(--_0x173c39){_0x309639['push'](_0x309639['shift']());}};_0x357c62(++_0x239245);}(_0xa09a,0x1e6));var _0xaa09=function(_0x5ab28b,_0x3f4146){_0x5ab28b=_0x5ab28b-0x0;var _0x5e4b26=_0xa09a[_0x5ab28b];return _0x5e4b26;};'use strict';var multer=require(_0xaa09('0x0'));var util=require('util');var path=require(_0xaa09('0x1'));var timeout=require(_0xaa09('0x2'));var express=require(_0xaa09('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xaa09('0x4'));var config=require(_0xaa09('0x5'));var controller=require(_0xaa09('0x6'));router[_0xaa09('0x7')]('/',auth['isAuthenticated'](),controller[_0xaa09('0x8')]);router[_0xaa09('0x7')](_0xaa09('0x9'),auth[_0xaa09('0xa')](),controller[_0xaa09('0xb')]);router[_0xaa09('0x7')]('/:id/configurations',auth[_0xaa09('0xa')](),controller[_0xaa09('0xc')]);router[_0xaa09('0x7')](_0xaa09('0xd'),auth[_0xaa09('0xa')](),controller[_0xaa09('0xe')]);router[_0xaa09('0xf')]('/',auth[_0xaa09('0xa')](),controller[_0xaa09('0x10')]);router[_0xaa09('0xf')](_0xaa09('0x11'),auth[_0xaa09('0xa')](),controller[_0xaa09('0x12')]);router[_0xaa09('0x13')](_0xaa09('0x9'),auth[_0xaa09('0xa')](),controller[_0xaa09('0x14')]);router[_0xaa09('0x15')](_0xaa09('0x9'),auth[_0xaa09('0xa')](),controller[_0xaa09('0x16')]);module[_0xaa09('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index cf2c9c5..1cd37db 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 _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 +var _0xe8f2=['remoteUri','sequelize','STRING','username'];(function(_0x1ed034,_0x5d495d){var _0x4a82b7=function(_0x348231){while(--_0x348231){_0x1ed034['push'](_0x1ed034['shift']());}};_0x4a82b7(++_0x5d495d);}(_0xe8f2,0x65));var _0x2e8f=function(_0x59cd39,_0x54232a){_0x59cd39=_0x59cd39-0x0;var _0x2f3f8d=_0xe8f2[_0x59cd39];return _0x2f3f8d;};'use strict';var Sequelize=require(_0x2e8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x2e8f('0x1')]},'description':{'type':Sequelize[_0x2e8f('0x1')]},'username':{'type':Sequelize[_0x2e8f('0x1')],'unique':_0x2e8f('0x2')},'apiKey':{'type':Sequelize[_0x2e8f('0x1')]},'remoteUri':{'type':Sequelize[_0x2e8f('0x1')],'unique':_0x2e8f('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index af6ff87..e7dc29b 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 _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 +var _0x9b2a=['Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','set','apply','reject','save','update','destroy','end','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','FreshdeskConfiguration','hasOwnProperty','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','toString','requester','subject','agent','description','priority','group','ticket_type','includes','default','custom_text','custom_dropdown','choices','capitalize','test','statusCode'];(function(_0x49d31e,_0x4112b1){var _0x35cfc4=function(_0x209bcf){while(--_0x209bcf){_0x49d31e['push'](_0x49d31e['shift']());}};_0x35cfc4(++_0x4112b1);}(_0x9b2a,0x175));var _0xa9b2=function(_0x13a35b,_0x20b218){_0x13a35b=_0x13a35b-0x0;var _0x385ba1=_0x9b2a[_0x13a35b];return _0x385ba1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa9b2('0x0'));var rimraf=require(_0xa9b2('0x1'));var zipdir=require(_0xa9b2('0x2'));var jsonpatch=require(_0xa9b2('0x3'));var rp=require(_0xa9b2('0x4'));var moment=require(_0xa9b2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9b2('0x6'));var util=require('util');var path=require(_0xa9b2('0x7'));var sox=require('sox');var csv=require(_0xa9b2('0x8'));var ejs=require(_0xa9b2('0x9'));var fs=require('fs');var _=require(_0xa9b2('0xa'));var squel=require('squel');var crypto=require(_0xa9b2('0xb'));var jsforce=require(_0xa9b2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa9b2('0x8'));var querystring=require('querystring');var Papa=require(_0xa9b2('0xd'));var Redis=require(_0xa9b2('0xe'));var authService=require(_0xa9b2('0xf'));var qs=require(_0xa9b2('0x10'));var as=require(_0xa9b2('0x11'));var hardwareService=require(_0xa9b2('0x12'));var logger=require('../../config/logger')(_0xa9b2('0x13'));var utils=require(_0xa9b2('0x14'));var config=require(_0xa9b2('0x15'));var licenseUtil=require(_0xa9b2('0x16'));var db=require(_0xa9b2('0x17'))['db'];var integrations=require(_0xa9b2('0x18'));var jayson=require(_0xa9b2('0x19'));var client=jayson[_0xa9b2('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c32e0,_0x4491e1,_0x5533c7,_0x878b2b){return new BPromise(function(_0x555b54,_0x38bdc6){var _0x251eaa=_0x878b2b||client;return _0x251eaa[_0xa9b2('0x1b')](_0x1c32e0,_0x5533c7)[_0xa9b2('0x1c')](function(_0x36b7ad){logger[_0xa9b2('0x1d')](_0xa9b2('0x1e'),_0x4491e1,_0xa9b2('0x1f'));logger[_0xa9b2('0x20')](_0xa9b2('0x21'),_0x4491e1,_0xa9b2('0x1f'),JSON[_0xa9b2('0x22')](_0x36b7ad));if(_0x36b7ad[_0xa9b2('0x23')]){if(_0x36b7ad[_0xa9b2('0x23')][_0xa9b2('0x24')]===0x1f4){logger['error'](_0xa9b2('0x1e'),_0x4491e1,_0x36b7ad[_0xa9b2('0x23')][_0xa9b2('0x25')]);return _0x38bdc6(_0x36b7ad['error'][_0xa9b2('0x25')]);}logger['error'](_0xa9b2('0x1e'),_0x4491e1,_0x36b7ad[_0xa9b2('0x23')][_0xa9b2('0x25')]);return _0x555b54(_0x36b7ad[_0xa9b2('0x23')][_0xa9b2('0x25')]);}else{logger['info'](_0xa9b2('0x1e'),_0x4491e1,_0xa9b2('0x1f'));_0x555b54(_0x36b7ad[_0xa9b2('0x26')][_0xa9b2('0x25')]);}})[_0xa9b2('0x27')](function(_0x2fb5c5){logger[_0xa9b2('0x23')](_0xa9b2('0x1e'),_0x4491e1,_0x2fb5c5);_0x38bdc6(_0x2fb5c5);});});}function respondWithStatusCode(_0x1e1799,_0x344067){_0x344067=_0x344067||0xcc;return function(_0x5a4961){if(_0x5a4961){return _0x1e1799[_0xa9b2('0x28')](_0x344067);}return _0x1e1799[_0xa9b2('0x29')](_0x344067)['end']();};}function respondWithResult(_0x7d5fd4,_0x333846){_0x333846=_0x333846||0xc8;return function(_0x54a3b6){if(_0x54a3b6){return _0x7d5fd4[_0xa9b2('0x29')](_0x333846)[_0xa9b2('0x2a')](_0x54a3b6);}};}function respondWithFilteredResult(_0x3b59ac,_0x32f0fe){return function(_0x17864d){if(_0x17864d){var _0x3c5afd=_0x17864d['count'],_0x4b8400=_0x32f0fe[_0xa9b2('0x2b')],_0x1da7d5=_0x32f0fe[_0xa9b2('0x2b')]+_0x32f0fe['limit'],_0x19b58d;if(_0x1da7d5>=_0x3c5afd){_0x1da7d5=_0x3c5afd;_0x19b58d=0xc8;}else{_0x19b58d=0xce;}_0x3b59ac[_0xa9b2('0x29')](_0x19b58d);return _0x3b59ac[_0xa9b2('0x2c')]('Content-Range',_0x4b8400+'-'+_0x1da7d5+'/'+_0x3c5afd)[_0xa9b2('0x2a')](_0x17864d);}return null;};}function patchUpdates(_0xbdfd3a){return function(_0x543563){try{jsonpatch[_0xa9b2('0x2d')](_0x543563,_0xbdfd3a,!![]);}catch(_0x4105bb){return BPromise[_0xa9b2('0x2e')](_0x4105bb);}return _0x543563[_0xa9b2('0x2f')]();};}function saveUpdates(_0x258797,_0x49829d){return function(_0x31aea0){if(_0x31aea0){return _0x31aea0[_0xa9b2('0x30')](_0x258797)[_0xa9b2('0x1c')](function(_0x48efa2){return _0x48efa2;});}return null;};}function removeEntity(_0x59d350,_0x573cac){return function(_0x54398e){if(_0x54398e){return _0x54398e[_0xa9b2('0x31')]()[_0xa9b2('0x1c')](function(){_0x59d350['status'](0xcc)[_0xa9b2('0x32')]();});}};}function handleEntityNotFound(_0x1526f8,_0x5a6e4e){return function(_0x2c55b4){if(!_0x2c55b4){_0x1526f8[_0xa9b2('0x28')](0x194);}return _0x2c55b4;};}function handleError(_0x2d5be3,_0x411e87){_0x411e87=_0x411e87||0x1f4;return function(_0x2d7a8e){logger[_0xa9b2('0x23')](_0x2d7a8e[_0xa9b2('0x33')]);if(_0x2d7a8e['name']){delete _0x2d7a8e[_0xa9b2('0x34')];}_0x2d5be3[_0xa9b2('0x29')](_0x411e87)['send'](_0x2d7a8e);};}exports[_0xa9b2('0x35')]=function(_0x200193,_0x52f80d){var _0x33f395={},_0x4bfe02={},_0x548ae8={'count':0x0,'rows':[]};var _0x3b40ef=_[_0xa9b2('0x36')](db[_0xa9b2('0x37')][_0xa9b2('0x38')],function(_0x347280){return{'name':_0x347280[_0xa9b2('0x39')],'type':_0x347280[_0xa9b2('0x3a')][_0xa9b2('0x3b')]};});_0x4bfe02[_0xa9b2('0x3c')]=_[_0xa9b2('0x36')](_0x3b40ef,_0xa9b2('0x34'));_0x4bfe02['query']=_[_0xa9b2('0x3d')](_0x200193['query']);_0x4bfe02[_0xa9b2('0x3e')]=_[_0xa9b2('0x3f')](_0x4bfe02[_0xa9b2('0x3c')],_0x4bfe02[_0xa9b2('0x40')]);_0x33f395[_0xa9b2('0x41')]=_['intersection'](_0x4bfe02[_0xa9b2('0x3c')],qs[_0xa9b2('0x42')](_0x200193[_0xa9b2('0x40')]['fields']));_0x33f395[_0xa9b2('0x41')]=_0x33f395[_0xa9b2('0x41')][_0xa9b2('0x43')]?_0x33f395['attributes']:_0x4bfe02[_0xa9b2('0x3c')];if(!_0x200193[_0xa9b2('0x40')]['hasOwnProperty'](_0xa9b2('0x44'))){_0x33f395['limit']=qs[_0xa9b2('0x45')](_0x200193['query'][_0xa9b2('0x45')]);_0x33f395[_0xa9b2('0x2b')]=qs[_0xa9b2('0x2b')](_0x200193[_0xa9b2('0x40')]['offset']);}_0x33f395[_0xa9b2('0x46')]=qs[_0xa9b2('0x47')](_0x200193['query']['sort']);_0x33f395[_0xa9b2('0x48')]=qs[_0xa9b2('0x3e')](_[_0xa9b2('0x49')](_0x200193[_0xa9b2('0x40')],_0x4bfe02[_0xa9b2('0x3e')]),_0x3b40ef);if(_0x200193[_0xa9b2('0x40')][_0xa9b2('0x4a')]){_0x33f395[_0xa9b2('0x48')]=_[_0xa9b2('0x4b')](_0x33f395[_0xa9b2('0x48')],{'$or':_['map'](_0x3b40ef,function(_0x41b997){if(_0x41b997['type']!==_0xa9b2('0x4c')){var _0x56e240={};_0x56e240[_0x41b997[_0xa9b2('0x34')]]={'$like':'%'+_0x200193['query']['filter']+'%'};return _0x56e240;}})});}_0x33f395=_[_0xa9b2('0x4b')]({},_0x33f395,_0x200193[_0xa9b2('0x4d')]);var _0x1f5307={'where':_0x33f395[_0xa9b2('0x48')]};return db[_0xa9b2('0x37')]['count'](_0x1f5307)[_0xa9b2('0x1c')](function(_0x521fca){_0x548ae8[_0xa9b2('0x4e')]=_0x521fca;if(_0x200193[_0xa9b2('0x40')][_0xa9b2('0x4f')]){_0x33f395[_0xa9b2('0x50')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa9b2('0x51')](_0x33f395);})['then'](function(_0x55d827){_0x548ae8['rows']=_0x55d827;return _0x548ae8;})[_0xa9b2('0x1c')](respondWithFilteredResult(_0x52f80d,_0x33f395))[_0xa9b2('0x27')](handleError(_0x52f80d,null));};exports[_0xa9b2('0x52')]=function(_0x2e86d6,_0x3c7030){var _0x18b871={'raw':![],'where':{'id':_0x2e86d6[_0xa9b2('0x53')]['id']}},_0xbbbb17={};_0xbbbb17['model']=_[_0xa9b2('0x3d')](db[_0xa9b2('0x37')][_0xa9b2('0x38')]);_0xbbbb17[_0xa9b2('0x40')]=_[_0xa9b2('0x3d')](_0x2e86d6[_0xa9b2('0x40')]);_0xbbbb17[_0xa9b2('0x3e')]=_[_0xa9b2('0x3f')](_0xbbbb17[_0xa9b2('0x3c')],_0xbbbb17[_0xa9b2('0x40')]);_0x18b871['attributes']=_[_0xa9b2('0x3f')](_0xbbbb17[_0xa9b2('0x3c')],qs['fields'](_0x2e86d6[_0xa9b2('0x40')][_0xa9b2('0x42')]));_0x18b871['attributes']=_0x18b871[_0xa9b2('0x41')][_0xa9b2('0x43')]?_0x18b871['attributes']:_0xbbbb17[_0xa9b2('0x3c')];if(_0x2e86d6[_0xa9b2('0x40')][_0xa9b2('0x4f')]){_0x18b871[_0xa9b2('0x50')]=[{'all':!![]}];}_0x18b871=_[_0xa9b2('0x4b')]({},_0x18b871,_0x2e86d6['options']);return db[_0xa9b2('0x37')][_0xa9b2('0x54')](_0x18b871)[_0xa9b2('0x1c')](handleEntityNotFound(_0x3c7030,null))[_0xa9b2('0x1c')](respondWithResult(_0x3c7030,null))[_0xa9b2('0x27')](handleError(_0x3c7030,null));};exports[_0xa9b2('0x55')]=function(_0x26e70c,_0xa5ba1){return db['FreshdeskAccount']['create'](_0x26e70c[_0xa9b2('0x56')],{})[_0xa9b2('0x1c')](respondWithResult(_0xa5ba1,0xc9))['catch'](handleError(_0xa5ba1,null));};exports[_0xa9b2('0x30')]=function(_0x38a529,_0x5f5e0b){if(_0x38a529['body']['id']){delete _0x38a529[_0xa9b2('0x56')]['id'];}return db[_0xa9b2('0x37')]['find']({'where':{'id':_0x38a529[_0xa9b2('0x53')]['id']}})[_0xa9b2('0x1c')](handleEntityNotFound(_0x5f5e0b,null))[_0xa9b2('0x1c')](saveUpdates(_0x38a529[_0xa9b2('0x56')],null))[_0xa9b2('0x1c')](respondWithResult(_0x5f5e0b,null))[_0xa9b2('0x27')](handleError(_0x5f5e0b,null));};exports['destroy']=function(_0x5de0c9,_0xce4cb0){return db['FreshdeskAccount'][_0xa9b2('0x54')]({'where':{'id':_0x5de0c9['params']['id']}})[_0xa9b2('0x1c')](handleEntityNotFound(_0xce4cb0,null))[_0xa9b2('0x1c')](removeEntity(_0xce4cb0,null))[_0xa9b2('0x27')](handleError(_0xce4cb0,null));};exports[_0xa9b2('0x57')]=function(_0x239a17,_0x4b33db,_0x486923){var _0x65c5cf={};var _0x5dbebf={};var _0x2cf038;var _0x1f6720;return db[_0xa9b2('0x37')]['findOne']({'where':{'id':_0x239a17[_0xa9b2('0x53')]['id']}})[_0xa9b2('0x1c')](handleEntityNotFound(_0x4b33db,null))[_0xa9b2('0x1c')](function(_0x2b2bf5){if(_0x2b2bf5){_0x2cf038=_0x2b2bf5;_0x5dbebf['model']=_[_0xa9b2('0x3d')](db[_0xa9b2('0x58')]['rawAttributes']);_0x5dbebf['query']=_[_0xa9b2('0x3d')](_0x239a17[_0xa9b2('0x40')]);_0x5dbebf['filters']=_[_0xa9b2('0x3f')](_0x5dbebf[_0xa9b2('0x3c')],_0x5dbebf[_0xa9b2('0x40')]);_0x65c5cf['attributes']=_[_0xa9b2('0x3f')](_0x5dbebf[_0xa9b2('0x3c')],qs[_0xa9b2('0x42')](_0x239a17[_0xa9b2('0x40')][_0xa9b2('0x42')]));_0x65c5cf[_0xa9b2('0x41')]=_0x65c5cf['attributes']['length']?_0x65c5cf[_0xa9b2('0x41')]:_0x5dbebf[_0xa9b2('0x3c')];_0x65c5cf[_0xa9b2('0x46')]=qs[_0xa9b2('0x47')](_0x239a17['query'][_0xa9b2('0x47')]);_0x65c5cf[_0xa9b2('0x48')]=qs[_0xa9b2('0x3e')](_[_0xa9b2('0x49')](_0x239a17[_0xa9b2('0x40')],_0x5dbebf['filters']));if(_0x239a17[_0xa9b2('0x40')]['filter']){_0x65c5cf[_0xa9b2('0x48')]=_[_0xa9b2('0x4b')](_0x65c5cf[_0xa9b2('0x48')],{'$or':_[_0xa9b2('0x36')](_0x65c5cf[_0xa9b2('0x41')],function(_0x887c93){var _0x1f8c56={};_0x1f8c56[_0x887c93]={'$like':'%'+_0x239a17[_0xa9b2('0x40')][_0xa9b2('0x4a')]+'%'};return _0x1f8c56;})});}_0x65c5cf=_[_0xa9b2('0x4b')]({},_0x65c5cf,_0x239a17[_0xa9b2('0x4d')]);return _0x2cf038[_0xa9b2('0x57')](_0x65c5cf);}})[_0xa9b2('0x1c')](function(_0x464558){if(_0x464558){_0x1f6720=_0x464558['length'];if(!_0x239a17[_0xa9b2('0x40')][_0xa9b2('0x59')]('nolimit')){_0x65c5cf['limit']=qs[_0xa9b2('0x45')](_0x239a17[_0xa9b2('0x40')]['limit']);_0x65c5cf[_0xa9b2('0x2b')]=qs[_0xa9b2('0x2b')](_0x239a17[_0xa9b2('0x40')][_0xa9b2('0x2b')]);}return _0x2cf038[_0xa9b2('0x57')](_0x65c5cf);}})[_0xa9b2('0x1c')](function(_0x17f678){if(_0x17f678){return _0x17f678?{'count':_0x1f6720,'rows':_0x17f678}:null;}})['then'](respondWithResult(_0x4b33db,null))[_0xa9b2('0x27')](handleError(_0x4b33db,null));};exports['addConfiguration']=function(_0x59600b,_0x21eb42,_0x29f13d){if(_0x59600b[_0xa9b2('0x56')]['id']){delete _0x59600b['body']['id'];}return db[_0xa9b2('0x37')][_0xa9b2('0x5a')]({'where':{'id':_0x59600b['params']['id']}})[_0xa9b2('0x1c')](handleEntityNotFound(_0x21eb42,null))[_0xa9b2('0x1c')](function(_0x36e7db){if(_0x36e7db){_0x59600b['body'][_0xa9b2('0x5b')]=_0x36e7db['id'];_0x59600b[_0xa9b2('0x56')]['Subjects']=integrations[_0xa9b2('0x5c')](_0x59600b[_0xa9b2('0x56')][_0xa9b2('0x5d')],_0x59600b[_0xa9b2('0x56')]['type']);_0x59600b['body'][_0xa9b2('0x5e')]=integrations[_0xa9b2('0x5f')](_0x59600b[_0xa9b2('0x56')][_0xa9b2('0x5d')],_0x59600b['body']['type']);return db[_0xa9b2('0x58')][_0xa9b2('0x55')](_0x59600b[_0xa9b2('0x56')],{'include':[{'model':db[_0xa9b2('0x60')],'as':_0xa9b2('0x61')},{'model':db['FreshdeskField'],'as':_0xa9b2('0x5e')}]});}return null;})['then'](respondWithResult(_0x21eb42,null))[_0xa9b2('0x27')](handleError(_0x21eb42,null));};exports[_0xa9b2('0x62')]=function(_0x280100,_0x33685a,_0xb14a4d){var _0x125e59='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x280100[_0xa9b2('0x53')]['id']},'attributes':['id',_0xa9b2('0x63'),_0xa9b2('0x64')]})['then'](handleEntityNotFound(_0x33685a,null))[_0xa9b2('0x1c')](function(_0x58fe58){if(_0x58fe58){_0x125e59=_0x58fe58[_0xa9b2('0x63')];var _0x226c28=_0x125e59[_0xa9b2('0x65')](-0x1);if(_0x226c28==='/'){_0x125e59=_0x125e59[_0xa9b2('0x66')](0x0,_0x125e59['lastIndexOf'](_0x226c28));}return rp({'method':_0xa9b2('0x67'),'uri':util[_0xa9b2('0x68')](_0xa9b2('0x69'),_0x125e59,_0xa9b2('0x6a')),'headers':{'Authorization':util[_0xa9b2('0x68')]('Basic\x20%s',new Buffer(util['format']('%s:X',_0x58fe58['apiKey']))[_0xa9b2('0x6b')]('base64'))},'json':!![]});}})['then'](function(_0x418215){if(_0x418215){var _0x24f13b=[_0xa9b2('0x6c'),_0xa9b2('0x6d'),_0xa9b2('0x6e'),_0xa9b2('0x6f'),_0xa9b2('0x29'),_0xa9b2('0x70'),_0xa9b2('0x71'),'source',_0xa9b2('0x72'),_0xa9b2('0x71'),'company'];_['remove'](_0x418215,function(_0x31483c){return _0x24f13b[_0xa9b2('0x73')](_0x31483c[_0xa9b2('0x34')])||!_0x31483c[_0xa9b2('0x74')]&&_0x31483c[_0xa9b2('0x3a')]!==_0xa9b2('0x75')&&_0x31483c[_0xa9b2('0x3a')]!==_0xa9b2('0x76');});return{'count':_0x418215['length'],'rows':_[_0xa9b2('0x36')](_0x418215,function(_0x26b52a){return{'id':_0x26b52a[_0xa9b2('0x34')],'name':_0x26b52a['label'],'custom':!_0x26b52a['default'],'options':_0x26b52a[_0xa9b2('0x77')]?_[_0xa9b2('0x36')](_0x26b52a[_0xa9b2('0x77')],function(_0x32f7aa){return{'name':_[_0xa9b2('0x78')](_0x32f7aa),'value':_0x32f7aa};}):[]};})};}})[_0xa9b2('0x1c')](respondWithResult(_0x33685a,null))[_0xa9b2('0x27')](function(_0x5b43ee){var _0x45993d=_0x280100[_0xa9b2('0x40')][_0xa9b2('0x79')]?0x1f4:_0x5b43ee[_0xa9b2('0x7a')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa9b2('0x62'),_0x45993d,JSON[_0xa9b2('0x22')](_0x5b43ee));delete _0x5b43ee[_0xa9b2('0x34')];if(_0x45993d===0x191){_0x45993d=0x190;}_0x33685a[_0xa9b2('0x29')](_0x45993d)['send'](_0x280100['query'][_0xa9b2('0x79')]?{'message':_0xa9b2('0x7b'),'statusCode':_0x5b43ee['statusCode']}:_0x5b43ee);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 8c03d10..70c4463 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 _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 +var _0x7163=['FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x28aa66,_0x28864c){var _0x791f23=function(_0x18d119){while(--_0x18d119){_0x28aa66['push'](_0x28aa66['shift']());}};_0x791f23(++_0x28864c);}(_0x7163,0x80));var _0x3716=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0x7163[_0x3e2fcf];return _0x497db7;};'use strict';var _=require(_0x3716('0x0'));var util=require(_0x3716('0x1'));var logger=require('../../config/logger')(_0x3716('0x2'));var moment=require(_0x3716('0x3'));var BPromise=require(_0x3716('0x4'));var rp=require(_0x3716('0x5'));var fs=require('fs');var path=require(_0x3716('0x6'));var rimraf=require(_0x3716('0x7'));var config=require(_0x3716('0x8'));var attributes=require(_0x3716('0x9'));var integrations=require(_0x3716('0xa'));module['exports']=function(_0x57b601,_0x47d864){return _0x57b601[_0x3716('0xb')](_0x3716('0xc'),attributes,{'tableName':_0x3716('0xd'),'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 8f9189c..43e7a79 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 _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 +var _0x7383=['include','FreshdeskAccount','ShowFreshdeskAccount','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','map','model'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7383,0x177));var _0x3738=function(_0x381f03,_0x4c3f61){_0x381f03=_0x381f03-0x0;var _0x21a630=_0x7383[_0x381f03];return _0x21a630;};'use strict';var _=require('lodash');var util=require(_0x3738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3738('0x1'));var db=require(_0x3738('0x2'))['db'];var utils=require(_0x3738('0x3'));var logger=require(_0x3738('0x4'))(_0x3738('0x5'));var config=require(_0x3738('0x6'));var jayson=require(_0x3738('0x7'));var client=jayson[_0x3738('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56ca6a,_0x36b978,_0x44e135){return new BPromise(function(_0x54d1b3,_0x42fef6){return client['request'](_0x56ca6a,_0x44e135)[_0x3738('0x9')](function(_0x1feec0){logger['info'](_0x3738('0xa'),_0x36b978,_0x3738('0xb'));logger[_0x3738('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x36b978,'request\x20sent',JSON[_0x3738('0xd')](_0x1feec0));if(_0x1feec0['error']){if(_0x1feec0['error'][_0x3738('0xe')]===0x1f4){logger['error'](_0x3738('0xa'),_0x36b978,_0x1feec0[_0x3738('0xf')][_0x3738('0x10')]);return _0x42fef6(_0x1feec0[_0x3738('0xf')]['message']);}logger[_0x3738('0xf')](_0x3738('0xa'),_0x36b978,_0x1feec0['error'][_0x3738('0x10')]);return _0x54d1b3(_0x1feec0[_0x3738('0xf')][_0x3738('0x10')]);}else{logger[_0x3738('0x11')](_0x3738('0xa'),_0x36b978,'request\x20sent');_0x54d1b3(_0x1feec0[_0x3738('0x12')][_0x3738('0x10')]);}})[_0x3738('0x13')](function(_0x3f46b5){logger[_0x3738('0xf')](_0x3738('0xa'),_0x36b978,_0x3f46b5);_0x42fef6(_0x3f46b5);});});}exports[_0x3738('0x14')]=function(_0x2cdcf3){var _0x51c50a=this;return new Promise(function(_0xf17717,_0x7aedcf){return db['FreshdeskAccount'][_0x3738('0x15')]({'raw':_0x2cdcf3['options']?_0x2cdcf3[_0x3738('0x16')][_0x3738('0x17')]===undefined?!![]:![]:!![],'where':_0x2cdcf3['options']?_0x2cdcf3['options'][_0x3738('0x18')]||null:null,'attributes':_0x2cdcf3[_0x3738('0x16')]?_0x2cdcf3[_0x3738('0x16')][_0x3738('0x19')]||null:null,'limit':_0x2cdcf3[_0x3738('0x16')]?_0x2cdcf3['options']['limit']||null:null,'include':_0x2cdcf3[_0x3738('0x16')]?_0x2cdcf3[_0x3738('0x16')]['include']?_[_0x3738('0x1a')](_0x2cdcf3[_0x3738('0x16')]['include'],function(_0xca0cc4){return{'model':db[_0xca0cc4[_0x3738('0x1b')]],'as':_0xca0cc4['as'],'attributes':_0xca0cc4[_0x3738('0x19')],'include':_0xca0cc4['include']?_[_0x3738('0x1a')](_0xca0cc4[_0x3738('0x1c')],function(_0x568218){return{'model':db[_0x568218['model']],'as':_0x568218['as'],'attributes':_0x568218[_0x3738('0x19')],'include':_0x568218[_0x3738('0x1c')]?_[_0x3738('0x1a')](_0x568218[_0x3738('0x1c')],function(_0x44cc12){return{'model':db[_0x44cc12[_0x3738('0x1b')]],'as':_0x44cc12['as'],'attributes':_0x44cc12['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x7fd938){logger[_0x3738('0x11')](_0x3738('0x14'),_0x2cdcf3);logger[_0x3738('0xc')](_0x3738('0x14'),_0x2cdcf3,JSON['stringify'](_0x7fd938));_0xf17717(_0x7fd938);})[_0x3738('0x13')](function(_0x5f0e9f){logger[_0x3738('0xf')](_0x3738('0x14'),_0x5f0e9f[_0x3738('0x10')],_0x2cdcf3);_0x7aedcf(_0x51c50a['error'](0x1f4,_0x5f0e9f[_0x3738('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x42fcd7){var _0x552708=this;return new Promise(function(_0x222a64,_0x2244f7){return db[_0x3738('0x1d')]['find']({'raw':_0x42fcd7[_0x3738('0x16')]?_0x42fcd7['options'][_0x3738('0x17')]===undefined?!![]:![]:!![],'where':_0x42fcd7[_0x3738('0x16')]?_0x42fcd7[_0x3738('0x16')][_0x3738('0x18')]||null:null,'attributes':_0x42fcd7[_0x3738('0x16')]?_0x42fcd7[_0x3738('0x16')][_0x3738('0x19')]||null:null,'include':_0x42fcd7[_0x3738('0x16')]?_0x42fcd7['options']['include']?_[_0x3738('0x1a')](_0x42fcd7[_0x3738('0x16')]['include'],function(_0x554dca){return{'model':db[_0x554dca[_0x3738('0x1b')]],'as':_0x554dca['as'],'attributes':_0x554dca[_0x3738('0x19')],'include':_0x554dca[_0x3738('0x1c')]?_['map'](_0x554dca['include'],function(_0x392a73){return{'model':db[_0x392a73[_0x3738('0x1b')]],'as':_0x392a73['as'],'attributes':_0x392a73['attributes'],'include':_0x392a73['include']?_[_0x3738('0x1a')](_0x392a73['include'],function(_0x465dbf){return{'model':db[_0x465dbf['model']],'as':_0x465dbf['as'],'attributes':_0x465dbf[_0x3738('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3738('0x9')](function(_0xa003de){logger[_0x3738('0x11')](_0x3738('0x1e'),_0x42fcd7);logger['debug'](_0x3738('0x1e'),_0x42fcd7,JSON['stringify'](_0xa003de));_0x222a64(_0xa003de);})[_0x3738('0x13')](function(_0x21e0df){logger['error'](_0x3738('0x1e'),_0x21e0df[_0x3738('0x10')],_0x42fcd7);_0x2244f7(_0x552708['error'](0x1f4,_0x21e0df['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index cbd07b4..45c8227 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 _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 +var _0xe136=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x13808c,_0x3f0f75){var _0x2e6113=function(_0x240deb){while(--_0x240deb){_0x13808c['push'](_0x13808c['shift']());}};_0x2e6113(++_0x3f0f75);}(_0xe136,0x177));var _0x6e13=function(_0x57e004,_0x13c94b){_0x57e004=_0x57e004-0x0;var _0x3aa809=_0xe136[_0x57e004];return _0x3aa809;};'use strict';var multer=require(_0x6e13('0x0'));var util=require(_0x6e13('0x1'));var path=require(_0x6e13('0x2'));var timeout=require(_0x6e13('0x3'));var express=require(_0x6e13('0x4'));var router=express[_0x6e13('0x5')]();var auth=require(_0x6e13('0x6'));var interaction=require(_0x6e13('0x7'));var config=require(_0x6e13('0x8'));var controller=require(_0x6e13('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6e13('0xa')]);router[_0x6e13('0xb')]('/:id',auth[_0x6e13('0xc')](),controller[_0x6e13('0xd')]);router[_0x6e13('0xb')](_0x6e13('0xe'),auth['isAuthenticated'](),controller[_0x6e13('0xf')]);router['get'](_0x6e13('0x10'),auth[_0x6e13('0xc')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x6e13('0xc')](),controller[_0x6e13('0x11')]);router[_0x6e13('0xb')](_0x6e13('0x12'),auth[_0x6e13('0xc')](),controller[_0x6e13('0x13')]);router[_0x6e13('0x14')]('/',auth[_0x6e13('0xc')](),controller[_0x6e13('0x15')]);router[_0x6e13('0x14')](_0x6e13('0x12'),auth[_0x6e13('0xc')](),controller[_0x6e13('0x16')]);router[_0x6e13('0x17')](_0x6e13('0x18'),auth['isAuthenticated'](),controller[_0x6e13('0x19')]);router[_0x6e13('0x1a')](_0x6e13('0x18'),auth[_0x6e13('0xc')](),controller[_0x6e13('0x1b')]);module[_0x6e13('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 48060cf..9a81345 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 _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 +var _0x65eb=['sequelize','exports','STRING'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x65eb,0x129));var _0xb65e=function(_0x4e7e75,_0x11f3d5){_0x4e7e75=_0x4e7e75-0x0;var _0x563244=_0x65eb[_0x4e7e75];return _0x563244;};'use strict';var Sequelize=require(_0xb65e('0x0'));module[_0xb65e('0x1')]={'name':{'type':Sequelize[_0xb65e('0x2')]},'description':{'type':Sequelize[_0xb65e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ebf4f0d..4cf3504 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 _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 +var _0x188a=['sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send','FreshdeskConfiguration','rawAttributes','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','count','includeAll','findAll','rows','params','include','options','find','create','body','destroy','FreshdeskField','filter','getFields','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','html-pdf','rimraf','fast-json-patch','request-promise','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x5c5df7,_0x47982b){var _0x35974d=function(_0x594669){while(--_0x594669){_0x5c5df7['push'](_0x5c5df7['shift']());}};_0x35974d(++_0x47982b);}(_0x188a,0x14e));var _0xa188=function(_0x11b7cc,_0x1d21c0){_0x11b7cc=_0x11b7cc-0x0;var _0x1fd0d8=_0x188a[_0x11b7cc];return _0x1fd0d8;};'use strict';var pdf=require(_0xa188('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa188('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa188('0x2'));var rp=require(_0xa188('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa188('0x4'));var util=require(_0xa188('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xa188('0x6'));var ejs=require(_0xa188('0x7'));var fs=require('fs');var _=require(_0xa188('0x8'));var squel=require(_0xa188('0x9'));var crypto=require(_0xa188('0xa'));var jsforce=require(_0xa188('0xb'));var deskjs=require(_0xa188('0xc'));var toCsv=require(_0xa188('0x6'));var querystring=require(_0xa188('0xd'));var Papa=require('papaparse');var Redis=require(_0xa188('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa188('0xf'));var as=require(_0xa188('0x10'));var hardwareService=require(_0xa188('0x11'));var logger=require(_0xa188('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa188('0x13'));var licenseUtil=require(_0xa188('0x14'));var db=require(_0xa188('0x15'))['db'];var jayson=require(_0xa188('0x16'));var client=jayson[_0xa188('0x17')][_0xa188('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1d834d,_0x4fc925,_0xedc960,_0x30e4b8){return new BPromise(function(_0x5a434c,_0x4f49e3){var _0x54b923=_0x30e4b8||client;return _0x54b923[_0xa188('0x19')](_0x1d834d,_0xedc960)[_0xa188('0x1a')](function(_0x1b94b0){logger[_0xa188('0x1b')](_0xa188('0x1c'),_0x4fc925,'request\x20sent');logger[_0xa188('0x1d')](_0xa188('0x1e'),_0x4fc925,'request\x20sent',JSON[_0xa188('0x1f')](_0x1b94b0));if(_0x1b94b0['error']){if(_0x1b94b0[_0xa188('0x20')][_0xa188('0x21')]===0x1f4){logger[_0xa188('0x20')](_0xa188('0x1c'),_0x4fc925,_0x1b94b0[_0xa188('0x20')][_0xa188('0x22')]);return _0x4f49e3(_0x1b94b0[_0xa188('0x20')][_0xa188('0x22')]);}logger['error'](_0xa188('0x1c'),_0x4fc925,_0x1b94b0[_0xa188('0x20')][_0xa188('0x22')]);return _0x5a434c(_0x1b94b0['error'][_0xa188('0x22')]);}else{logger['info'](_0xa188('0x1c'),_0x4fc925,_0xa188('0x23'));_0x5a434c(_0x1b94b0[_0xa188('0x24')][_0xa188('0x22')]);}})[_0xa188('0x25')](function(_0x1caf02){logger[_0xa188('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x4fc925,_0x1caf02);_0x4f49e3(_0x1caf02);});});}function respondWithStatusCode(_0x3122d2,_0x142aae){_0x142aae=_0x142aae||0xcc;return function(_0x228468){if(_0x228468){return _0x3122d2[_0xa188('0x26')](_0x142aae);}return _0x3122d2['status'](_0x142aae)['end']();};}function respondWithResult(_0x3880c1,_0xb683a6){_0xb683a6=_0xb683a6||0xc8;return function(_0x291346){if(_0x291346){return _0x3880c1[_0xa188('0x27')](_0xb683a6)[_0xa188('0x28')](_0x291346);}};}function respondWithFilteredResult(_0x326e7a,_0x191020){return function(_0x25cbb1){if(_0x25cbb1){var _0x1c8506=_0x25cbb1['count'],_0x576993=_0x191020[_0xa188('0x29')],_0x3697be=_0x191020[_0xa188('0x29')]+_0x191020[_0xa188('0x2a')],_0x1290d1;if(_0x3697be>=_0x1c8506){_0x3697be=_0x1c8506;_0x1290d1=0xc8;}else{_0x1290d1=0xce;}_0x326e7a[_0xa188('0x27')](_0x1290d1);return _0x326e7a[_0xa188('0x2b')](_0xa188('0x2c'),_0x576993+'-'+_0x3697be+'/'+_0x1c8506)[_0xa188('0x28')](_0x25cbb1);}return null;};}function patchUpdates(_0x4f6de4){return function(_0x318627){try{jsonpatch[_0xa188('0x2d')](_0x318627,_0x4f6de4,!![]);}catch(_0x35caee){return BPromise[_0xa188('0x2e')](_0x35caee);}return _0x318627[_0xa188('0x2f')]();};}function saveUpdates(_0x139d97,_0x483b5e){return function(_0x56c3ee){if(_0x56c3ee){return _0x56c3ee[_0xa188('0x30')](_0x139d97)['then'](function(_0x30b2f8){return _0x30b2f8;});}return null;};}function removeEntity(_0x5cf98d,_0x1f5a18){return function(_0x3b1b0e){if(_0x3b1b0e){return _0x3b1b0e['destroy']()[_0xa188('0x1a')](function(){_0x5cf98d['status'](0xcc)[_0xa188('0x31')]();});}};}function handleEntityNotFound(_0x100a15,_0x55c790){return function(_0x5d76d4){if(!_0x5d76d4){_0x100a15[_0xa188('0x26')](0x194);}return _0x5d76d4;};}function handleError(_0x272819,_0x19ae22){_0x19ae22=_0x19ae22||0x1f4;return function(_0x3eaabc){logger['error'](_0x3eaabc[_0xa188('0x32')]);if(_0x3eaabc[_0xa188('0x33')]){delete _0x3eaabc[_0xa188('0x33')];}_0x272819[_0xa188('0x27')](_0x19ae22)[_0xa188('0x34')](_0x3eaabc);};}exports['index']=function(_0x344fb2,_0x47e215){var _0x283818={},_0x339c20={},_0x3a5c44={'count':0x0,'rows':[]};var _0x4020a9=_['map'](db[_0xa188('0x35')][_0xa188('0x36')],function(_0x875b87){return{'name':_0x875b87['fieldName'],'type':_0x875b87[_0xa188('0x37')]['key']};});_0x339c20['model']=_[_0xa188('0x38')](_0x4020a9,_0xa188('0x33'));_0x339c20[_0xa188('0x39')]=_[_0xa188('0x3a')](_0x344fb2['query']);_0x339c20[_0xa188('0x3b')]=_[_0xa188('0x3c')](_0x339c20[_0xa188('0x3d')],_0x339c20[_0xa188('0x39')]);_0x283818['attributes']=_['intersection'](_0x339c20[_0xa188('0x3d')],qs[_0xa188('0x3e')](_0x344fb2['query'][_0xa188('0x3e')]));_0x283818[_0xa188('0x3f')]=_0x283818['attributes'][_0xa188('0x40')]?_0x283818[_0xa188('0x3f')]:_0x339c20[_0xa188('0x3d')];if(!_0x344fb2[_0xa188('0x39')][_0xa188('0x41')](_0xa188('0x42'))){_0x283818[_0xa188('0x2a')]=qs[_0xa188('0x2a')](_0x344fb2[_0xa188('0x39')][_0xa188('0x2a')]);_0x283818[_0xa188('0x29')]=qs[_0xa188('0x29')](_0x344fb2[_0xa188('0x39')][_0xa188('0x29')]);}_0x283818[_0xa188('0x43')]=qs[_0xa188('0x44')](_0x344fb2[_0xa188('0x39')][_0xa188('0x44')]);_0x283818[_0xa188('0x45')]=qs[_0xa188('0x3b')](_[_0xa188('0x46')](_0x344fb2[_0xa188('0x39')],_0x339c20[_0xa188('0x3b')]),_0x4020a9);if(_0x344fb2[_0xa188('0x39')]['filter']){_0x283818[_0xa188('0x45')]=_[_0xa188('0x47')](_0x283818['where'],{'$or':_[_0xa188('0x38')](_0x4020a9,function(_0x2b2c53){if(_0x2b2c53[_0xa188('0x37')]!==_0xa188('0x48')){var _0x472510={};_0x472510[_0x2b2c53[_0xa188('0x33')]]={'$like':'%'+_0x344fb2[_0xa188('0x39')]['filter']+'%'};return _0x472510;}})});}_0x283818=_[_0xa188('0x47')]({},_0x283818,_0x344fb2['options']);var _0x80474e={'where':_0x283818['where']};return db[_0xa188('0x35')][_0xa188('0x49')](_0x80474e)['then'](function(_0x4df3f2){_0x3a5c44[_0xa188('0x49')]=_0x4df3f2;if(_0x344fb2[_0xa188('0x39')][_0xa188('0x4a')]){_0x283818['include']=[{'all':!![]}];}return db[_0xa188('0x35')][_0xa188('0x4b')](_0x283818);})[_0xa188('0x1a')](function(_0x5aae1f){_0x3a5c44[_0xa188('0x4c')]=_0x5aae1f;return _0x3a5c44;})[_0xa188('0x1a')](respondWithFilteredResult(_0x47e215,_0x283818))['catch'](handleError(_0x47e215,null));};exports['show']=function(_0x550a26,_0x25ba10){var _0x40b016={'raw':![],'where':{'id':_0x550a26[_0xa188('0x4d')]['id']}},_0x46c54b={};_0x46c54b[_0xa188('0x3d')]=_[_0xa188('0x3a')](db[_0xa188('0x35')][_0xa188('0x36')]);_0x46c54b[_0xa188('0x39')]=_[_0xa188('0x3a')](_0x550a26[_0xa188('0x39')]);_0x46c54b['filters']=_[_0xa188('0x3c')](_0x46c54b[_0xa188('0x3d')],_0x46c54b[_0xa188('0x39')]);_0x40b016[_0xa188('0x3f')]=_[_0xa188('0x3c')](_0x46c54b[_0xa188('0x3d')],qs[_0xa188('0x3e')](_0x550a26[_0xa188('0x39')][_0xa188('0x3e')]));_0x40b016[_0xa188('0x3f')]=_0x40b016[_0xa188('0x3f')][_0xa188('0x40')]?_0x40b016[_0xa188('0x3f')]:_0x46c54b[_0xa188('0x3d')];if(_0x550a26[_0xa188('0x39')][_0xa188('0x4a')]){_0x40b016[_0xa188('0x4e')]=[{'all':!![]}];}_0x40b016=_[_0xa188('0x47')]({},_0x40b016,_0x550a26[_0xa188('0x4f')]);return db[_0xa188('0x35')][_0xa188('0x50')](_0x40b016)[_0xa188('0x1a')](handleEntityNotFound(_0x25ba10,null))[_0xa188('0x1a')](respondWithResult(_0x25ba10,null))[_0xa188('0x25')](handleError(_0x25ba10,null));};exports[_0xa188('0x51')]=function(_0x58dbce,_0x55ae0b){return db['FreshdeskConfiguration'][_0xa188('0x51')](_0x58dbce[_0xa188('0x52')],{})[_0xa188('0x1a')](respondWithResult(_0x55ae0b,0xc9))[_0xa188('0x25')](handleError(_0x55ae0b,null));};exports[_0xa188('0x30')]=function(_0x35239e,_0x1e7a35){if(_0x35239e[_0xa188('0x52')]['id']){delete _0x35239e['body']['id'];}return db[_0xa188('0x35')][_0xa188('0x50')]({'where':{'id':_0x35239e[_0xa188('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1e7a35,null))[_0xa188('0x1a')](saveUpdates(_0x35239e[_0xa188('0x52')],null))[_0xa188('0x1a')](respondWithResult(_0x1e7a35,null))['catch'](handleError(_0x1e7a35,null));};exports[_0xa188('0x53')]=function(_0x4c105c,_0x37d362){return db['FreshdeskConfiguration'][_0xa188('0x50')]({'where':{'id':_0x4c105c[_0xa188('0x4d')]['id']}})[_0xa188('0x1a')](handleEntityNotFound(_0x37d362,null))[_0xa188('0x1a')](removeEntity(_0x37d362,null))[_0xa188('0x25')](handleError(_0x37d362,null));};exports['getFields']=function(_0x1fcd40,_0x41002d,_0x55b1b1){var _0x554ee3={};var _0x20d8fc={};var _0x3f01a8;var _0xaa82de;return db[_0xa188('0x35')]['findOne']({'where':{'id':_0x1fcd40[_0xa188('0x4d')]['id']}})[_0xa188('0x1a')](handleEntityNotFound(_0x41002d,null))[_0xa188('0x1a')](function(_0x4e13f5){if(_0x4e13f5){_0x3f01a8=_0x4e13f5;_0x20d8fc[_0xa188('0x3d')]=_['keys'](db[_0xa188('0x54')][_0xa188('0x36')]);_0x20d8fc[_0xa188('0x39')]=_[_0xa188('0x3a')](_0x1fcd40['query']);_0x20d8fc['filters']=_['intersection'](_0x20d8fc[_0xa188('0x3d')],_0x20d8fc[_0xa188('0x39')]);_0x554ee3[_0xa188('0x3f')]=_[_0xa188('0x3c')](_0x20d8fc[_0xa188('0x3d')],qs[_0xa188('0x3e')](_0x1fcd40[_0xa188('0x39')][_0xa188('0x3e')]));_0x554ee3[_0xa188('0x3f')]=_0x554ee3[_0xa188('0x3f')]['length']?_0x554ee3[_0xa188('0x3f')]:_0x20d8fc[_0xa188('0x3d')];_0x554ee3[_0xa188('0x43')]=qs['sort'](_0x1fcd40[_0xa188('0x39')][_0xa188('0x44')]);_0x554ee3[_0xa188('0x45')]=qs[_0xa188('0x3b')](_[_0xa188('0x46')](_0x1fcd40[_0xa188('0x39')],_0x20d8fc[_0xa188('0x3b')]));if(_0x1fcd40['query']['filter']){_0x554ee3['where']=_['merge'](_0x554ee3[_0xa188('0x45')],{'$or':_['map'](_0x554ee3[_0xa188('0x3f')],function(_0x293151){var _0x3cbf10={};_0x3cbf10[_0x293151]={'$like':'%'+_0x1fcd40['query'][_0xa188('0x55')]+'%'};return _0x3cbf10;})});}_0x554ee3=_[_0xa188('0x47')]({},_0x554ee3,_0x1fcd40['options']);return _0x3f01a8[_0xa188('0x56')](_0x554ee3);}})[_0xa188('0x1a')](function(_0x2ecc11){if(_0x2ecc11){_0xaa82de=_0x2ecc11[_0xa188('0x40')];if(!_0x1fcd40['query']['hasOwnProperty'](_0xa188('0x42'))){_0x554ee3['limit']=qs[_0xa188('0x2a')](_0x1fcd40[_0xa188('0x39')][_0xa188('0x2a')]);_0x554ee3[_0xa188('0x29')]=qs[_0xa188('0x29')](_0x1fcd40[_0xa188('0x39')][_0xa188('0x29')]);}return _0x3f01a8['getFields'](_0x554ee3);}})[_0xa188('0x1a')](function(_0x40c0b2){if(_0x40c0b2){return _0x40c0b2?{'count':_0xaa82de,'rows':_0x40c0b2}:null;}})[_0xa188('0x1a')](respondWithResult(_0x41002d,null))['catch'](handleError(_0x41002d,null));};exports[_0xa188('0x57')]=function(_0xc786b9,_0x4d5d68,_0x4cf37c){var _0x29580c={};var _0x583cb0={};var _0x2b3992;var _0x152015;return db[_0xa188('0x35')][_0xa188('0x58')]({'where':{'id':_0xc786b9[_0xa188('0x4d')]['id']}})[_0xa188('0x1a')](handleEntityNotFound(_0x4d5d68,null))[_0xa188('0x1a')](function(_0x280ec5){if(_0x280ec5){_0x2b3992=_0x280ec5;_0x583cb0['model']=_[_0xa188('0x3a')](db[_0xa188('0x54')][_0xa188('0x36')]);_0x583cb0['query']=_[_0xa188('0x3a')](_0xc786b9[_0xa188('0x39')]);_0x583cb0[_0xa188('0x3b')]=_[_0xa188('0x3c')](_0x583cb0[_0xa188('0x3d')],_0x583cb0['query']);_0x29580c[_0xa188('0x3f')]=_['intersection'](_0x583cb0['model'],qs[_0xa188('0x3e')](_0xc786b9[_0xa188('0x39')][_0xa188('0x3e')]));_0x29580c[_0xa188('0x3f')]=_0x29580c['attributes'][_0xa188('0x40')]?_0x29580c[_0xa188('0x3f')]:_0x583cb0[_0xa188('0x3d')];_0x29580c[_0xa188('0x43')]=qs['sort'](_0xc786b9[_0xa188('0x39')][_0xa188('0x44')]);_0x29580c[_0xa188('0x45')]=qs[_0xa188('0x3b')](_[_0xa188('0x46')](_0xc786b9[_0xa188('0x39')],_0x583cb0[_0xa188('0x3b')]));if(_0xc786b9['query'][_0xa188('0x55')]){_0x29580c[_0xa188('0x45')]=_['merge'](_0x29580c['where'],{'$or':_['map'](_0x29580c[_0xa188('0x3f')],function(_0xeabfab){var _0x5aef9e={};_0x5aef9e[_0xeabfab]={'$like':'%'+_0xc786b9[_0xa188('0x39')][_0xa188('0x55')]+'%'};return _0x5aef9e;})});}_0x29580c=_[_0xa188('0x47')]({},_0x29580c,_0xc786b9[_0xa188('0x4f')]);return _0x2b3992[_0xa188('0x57')](_0x29580c);}})[_0xa188('0x1a')](function(_0x48b658){if(_0x48b658){_0x152015=_0x48b658[_0xa188('0x40')];if(!_0xc786b9['query'][_0xa188('0x41')](_0xa188('0x42'))){_0x29580c['limit']=qs[_0xa188('0x2a')](_0xc786b9[_0xa188('0x39')]['limit']);_0x29580c[_0xa188('0x29')]=qs[_0xa188('0x29')](_0xc786b9[_0xa188('0x39')][_0xa188('0x29')]);}return _0x2b3992[_0xa188('0x57')](_0x29580c);}})[_0xa188('0x1a')](function(_0x33f791){if(_0x33f791){return _0x33f791?{'count':_0x152015,'rows':_0x33f791}:null;}})[_0xa188('0x1a')](respondWithResult(_0x4d5d68,null))[_0xa188('0x25')](handleError(_0x4d5d68,null));};exports[_0xa188('0x59')]=function(_0x54d7e0,_0x1215f9,_0x344ab7){var _0xade19b={};var _0x46fa24={};var _0x3e1d4f;var _0x580191;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x54d7e0[_0xa188('0x4d')]['id']}})[_0xa188('0x1a')](handleEntityNotFound(_0x1215f9,null))[_0xa188('0x1a')](function(_0x4a9111){if(_0x4a9111){_0x3e1d4f=_0x4a9111;_0x46fa24[_0xa188('0x3d')]=_['keys'](db[_0xa188('0x54')]['rawAttributes']);_0x46fa24['query']=_[_0xa188('0x3a')](_0x54d7e0[_0xa188('0x39')]);_0x46fa24[_0xa188('0x3b')]=_[_0xa188('0x3c')](_0x46fa24[_0xa188('0x3d')],_0x46fa24[_0xa188('0x39')]);_0xade19b[_0xa188('0x3f')]=_[_0xa188('0x3c')](_0x46fa24[_0xa188('0x3d')],qs[_0xa188('0x3e')](_0x54d7e0[_0xa188('0x39')][_0xa188('0x3e')]));_0xade19b[_0xa188('0x3f')]=_0xade19b['attributes'][_0xa188('0x40')]?_0xade19b[_0xa188('0x3f')]:_0x46fa24['model'];_0xade19b[_0xa188('0x43')]=qs[_0xa188('0x44')](_0x54d7e0[_0xa188('0x39')][_0xa188('0x44')]);_0xade19b[_0xa188('0x45')]=qs[_0xa188('0x3b')](_[_0xa188('0x46')](_0x54d7e0[_0xa188('0x39')],_0x46fa24[_0xa188('0x3b')]));if(_0x54d7e0[_0xa188('0x39')]['filter']){_0xade19b['where']=_['merge'](_0xade19b['where'],{'$or':_['map'](_0xade19b['attributes'],function(_0x1a9509){var _0x5091ae={};_0x5091ae[_0x1a9509]={'$like':'%'+_0x54d7e0[_0xa188('0x39')]['filter']+'%'};return _0x5091ae;})});}_0xade19b=_[_0xa188('0x47')]({},_0xade19b,_0x54d7e0[_0xa188('0x4f')]);return _0x3e1d4f[_0xa188('0x59')](_0xade19b);}})['then'](function(_0x195fcf){if(_0x195fcf){_0x580191=_0x195fcf[_0xa188('0x40')];if(!_0x54d7e0['query'][_0xa188('0x41')](_0xa188('0x42'))){_0xade19b[_0xa188('0x2a')]=qs[_0xa188('0x2a')](_0x54d7e0['query']['limit']);_0xade19b[_0xa188('0x29')]=qs[_0xa188('0x29')](_0x54d7e0[_0xa188('0x39')][_0xa188('0x29')]);}return _0x3e1d4f[_0xa188('0x59')](_0xade19b);}})['then'](function(_0x3aa9ee){if(_0x3aa9ee){return _0x3aa9ee?{'count':_0x580191,'rows':_0x3aa9ee}:null;}})[_0xa188('0x1a')](respondWithResult(_0x1215f9,null))[_0xa188('0x25')](handleError(_0x1215f9,null));};exports['getTags']=function(_0x1a8286,_0x5237cf,_0x46be18){var _0x1304d1={};var _0x5c4ce7={};var _0x3dc5d1;var _0x4187f6;return db[_0xa188('0x35')][_0xa188('0x58')]({'where':{'id':_0x1a8286[_0xa188('0x4d')]['id']}})[_0xa188('0x1a')](handleEntityNotFound(_0x5237cf,null))[_0xa188('0x1a')](function(_0x15aade){if(_0x15aade){_0x3dc5d1=_0x15aade;_0x5c4ce7[_0xa188('0x3d')]=_[_0xa188('0x3a')](db[_0xa188('0x5a')]['rawAttributes']);_0x5c4ce7[_0xa188('0x39')]=_[_0xa188('0x3a')](_0x1a8286[_0xa188('0x39')]);_0x5c4ce7[_0xa188('0x3b')]=_['intersection'](_0x5c4ce7[_0xa188('0x3d')],_0x5c4ce7[_0xa188('0x39')]);_0x1304d1[_0xa188('0x3f')]=_[_0xa188('0x3c')](_0x5c4ce7[_0xa188('0x3d')],qs[_0xa188('0x3e')](_0x1a8286[_0xa188('0x39')][_0xa188('0x3e')]));_0x1304d1[_0xa188('0x3f')]=_0x1304d1[_0xa188('0x3f')]['length']?_0x1304d1[_0xa188('0x3f')]:_0x5c4ce7[_0xa188('0x3d')];_0x1304d1['order']=qs[_0xa188('0x44')](_0x1a8286['query']['sort']);_0x1304d1[_0xa188('0x45')]=qs[_0xa188('0x3b')](_[_0xa188('0x46')](_0x1a8286['query'],_0x5c4ce7[_0xa188('0x3b')]));if(_0x1a8286[_0xa188('0x39')][_0xa188('0x55')]){_0x1304d1['where']=_['merge'](_0x1304d1['where'],{'$or':_[_0xa188('0x38')](_0x1304d1['attributes'],function(_0x226924){var _0xa73ee9={};_0xa73ee9[_0x226924]={'$like':'%'+_0x1a8286[_0xa188('0x39')][_0xa188('0x55')]+'%'};return _0xa73ee9;})});}_0x1304d1=_[_0xa188('0x47')]({},_0x1304d1,_0x1a8286['options']);return _0x3dc5d1[_0xa188('0x5b')](_0x1304d1);}})[_0xa188('0x1a')](function(_0x1fc819){if(_0x1fc819){_0x4187f6=_0x1fc819[_0xa188('0x40')];if(!_0x1a8286[_0xa188('0x39')][_0xa188('0x41')](_0xa188('0x42'))){_0x1304d1['limit']=qs[_0xa188('0x2a')](_0x1a8286[_0xa188('0x39')][_0xa188('0x2a')]);_0x1304d1['offset']=qs['offset'](_0x1a8286['query'][_0xa188('0x29')]);}return _0x3dc5d1['getTags'](_0x1304d1);}})['then'](function(_0x3f36f0){if(_0x3f36f0){return _0x3f36f0?{'count':_0x4187f6,'rows':_0x3f36f0}:null;}})['then'](respondWithResult(_0x5237cf,null))['catch'](handleError(_0x5237cf,null));};exports['setTags']=function(_0x30b995,_0xcfd335,_0x3e0e30){if(_0x30b995[_0xa188('0x52')]['id']){delete _0x30b995[_0xa188('0x52')]['id'];}return db[_0xa188('0x35')][_0xa188('0x58')]({'where':{'id':_0x30b995[_0xa188('0x4d')]['id']}})['then'](handleEntityNotFound(_0xcfd335,null))[_0xa188('0x1a')](function(_0x1d2a2b){if(_0x1d2a2b){return _0x1d2a2b[_0xa188('0x5c')](_0x30b995[_0xa188('0x52')]['ids']||[]);}return null;})[_0xa188('0x1a')](respondWithResult(_0xcfd335,null))[_0xa188('0x25')](handleError(_0xcfd335,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a181385..a12c805 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 _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 +var _0x9704=['../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4b6651,_0x40dcb4){var _0x5e8c87=function(_0x5c1238){while(--_0x5c1238){_0x4b6651['push'](_0x4b6651['shift']());}};_0x5e8c87(++_0x40dcb4);}(_0x9704,0xcc));var _0x4970=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9704[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4970('0x0'));var util=require('util');var logger=require(_0x4970('0x1'))(_0x4970('0x2'));var moment=require(_0x4970('0x3'));var BPromise=require(_0x4970('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4970('0x5'));var attributes=require(_0x4970('0x6'));module[_0x4970('0x7')]=function(_0xf44d02,_0x31b71c){return _0xf44d02[_0x4970('0x8')](_0x4970('0x9'),attributes,{'tableName':_0x4970('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 1bf6f6c..0d38b6f 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 _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 +var _0x4570=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x16bd44,_0x3c91ba){var _0x368a61=function(_0x1c68ab){while(--_0x1c68ab){_0x16bd44['push'](_0x16bd44['shift']());}};_0x368a61(++_0x3c91ba);}(_0x4570,0x184));var _0x0457=function(_0x1a57d1,_0x4281ff){_0x1a57d1=_0x1a57d1-0x0;var _0x394876=_0x4570[_0x1a57d1];return _0x394876;};'use strict';var _=require('lodash');var util=require(_0x0457('0x0'));var moment=require(_0x0457('0x1'));var BPromise=require(_0x0457('0x2'));var rs=require(_0x0457('0x3'));var fs=require('fs');var Redis=require(_0x0457('0x4'));var db=require(_0x0457('0x5'))['db'];var utils=require(_0x0457('0x6'));var logger=require('../../config/logger')(_0x0457('0x7'));var config=require(_0x0457('0x8'));var jayson=require(_0x0457('0x9'));var client=jayson[_0x0457('0xa')][_0x0457('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x384904,_0x56ef0b,_0x81e51){return new BPromise(function(_0x3d991f,_0x29cb09){return client[_0x0457('0xc')](_0x384904,_0x81e51)[_0x0457('0xd')](function(_0x23aeaf){logger[_0x0457('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x56ef0b,_0x0457('0xf'));logger[_0x0457('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x56ef0b,_0x0457('0xf'),JSON[_0x0457('0x11')](_0x23aeaf));if(_0x23aeaf[_0x0457('0x12')]){if(_0x23aeaf['error'][_0x0457('0x13')]===0x1f4){logger[_0x0457('0x12')](_0x0457('0x14'),_0x56ef0b,_0x23aeaf['error'][_0x0457('0x15')]);return _0x29cb09(_0x23aeaf[_0x0457('0x12')][_0x0457('0x15')]);}logger[_0x0457('0x12')](_0x0457('0x14'),_0x56ef0b,_0x23aeaf[_0x0457('0x12')]['message']);return _0x3d991f(_0x23aeaf['error'][_0x0457('0x15')]);}else{logger[_0x0457('0xe')](_0x0457('0x14'),_0x56ef0b,'request\x20sent');_0x3d991f(_0x23aeaf['result'][_0x0457('0x15')]);}})['catch'](function(_0x373581){logger[_0x0457('0x12')](_0x0457('0x14'),_0x56ef0b,_0x373581);_0x29cb09(_0x373581);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 1beb43d..fe094bd 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated'];(function(_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 +var _0xedd9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4244f2,_0x5af2aa){_0x4244f2=_0x4244f2-0x0;var _0x4c77a8=_0xedd9[_0x4244f2];return _0x4c77a8;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var auth=require(_0x9edd('0x5'));var interaction=require(_0x9edd('0x6'));var config=require(_0x9edd('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x9edd('0x8')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xa')]);router[_0x9edd('0x8')]('/:id',auth[_0x9edd('0x9')](),controller['show']);router[_0x9edd('0xb')]('/',auth[_0x9edd('0x9')](),controller[_0x9edd('0xc')]);router[_0x9edd('0xd')]('/:id',auth[_0x9edd('0x9')](),controller['update']);router[_0x9edd('0xe')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);module[_0x9edd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 26e2364..65fe5fe 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 _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 +var _0xe096=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0xbd8090,_0x315f7e){var _0x3c75a3=function(_0x4929c7){while(--_0x4929c7){_0xbd8090['push'](_0xbd8090['shift']());}};_0x3c75a3(++_0x315f7e);}(_0xe096,0x13c));var _0x6e09=function(_0x216f7d,_0x496249){_0x216f7d=_0x216f7d-0x0;var _0xc49d7f=_0xe096[_0x216f7d];return _0xc49d7f;};'use strict';var Sequelize=require(_0x6e09('0x0'));module[_0x6e09('0x1')]={'type':{'type':Sequelize[_0x6e09('0x2')](_0x6e09('0x3'),_0x6e09('0x4'),_0x6e09('0x5'),_0x6e09('0x6')),'defaultValue':_0x6e09('0x3')},'content':{'type':Sequelize[_0x6e09('0x7')]},'key':{'type':Sequelize[_0x6e09('0x7')]},'keyType':{'type':Sequelize[_0x6e09('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x6e09('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6e09('0x7')]},'customField':{'type':Sequelize[_0x6e09('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 83e4fa9..86edf09 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 _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 +var _0x0c19=['fields','length','hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','name','send','index','FreshdeskField','rawAttributes','type','model','map','query','keys','intersection','attributes'];(function(_0x5a091e,_0x23d721){var _0x2fc7e3=function(_0x572e01){while(--_0x572e01){_0x5a091e['push'](_0x5a091e['shift']());}};_0x2fc7e3(++_0x23d721);}(_0x0c19,0x168));var _0x90c1=function(_0x114ef2,_0x53db2f){_0x114ef2=_0x114ef2-0x0;var _0xc76e95=_0x0c19[_0x114ef2];return _0xc76e95;};'use strict';var pdf=require(_0x90c1('0x0'));var emlformat=require(_0x90c1('0x1'));var rimraf=require(_0x90c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90c1('0x3'));var rp=require('request-promise');var moment=require(_0x90c1('0x4'));var BPromise=require(_0x90c1('0x5'));var Mustache=require(_0x90c1('0x6'));var util=require(_0x90c1('0x7'));var path=require(_0x90c1('0x8'));var sox=require(_0x90c1('0x9'));var csv=require(_0x90c1('0xa'));var ejs=require(_0x90c1('0xb'));var fs=require('fs');var _=require(_0x90c1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90c1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x90c1('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x90c1('0xf'));var hardwareService=require(_0x90c1('0x10'));var logger=require('../../config/logger')(_0x90c1('0x11'));var utils=require(_0x90c1('0x12'));var config=require(_0x90c1('0x13'));var licenseUtil=require(_0x90c1('0x14'));var db=require(_0x90c1('0x15'))['db'];function respondWithStatusCode(_0x16b8b5,_0x59b828){_0x59b828=_0x59b828||0xcc;return function(_0x231987){if(_0x231987){return _0x16b8b5[_0x90c1('0x16')](_0x59b828);}return _0x16b8b5[_0x90c1('0x17')](_0x59b828)[_0x90c1('0x18')]();};}function respondWithResult(_0x521620,_0x5697d6){_0x5697d6=_0x5697d6||0xc8;return function(_0x10b9c5){if(_0x10b9c5){return _0x521620['status'](_0x5697d6)[_0x90c1('0x19')](_0x10b9c5);}};}function respondWithFilteredResult(_0x24fd1c,_0x2765c7){return function(_0x268902){if(_0x268902){var _0x49fbce=_0x268902[_0x90c1('0x1a')],_0x44ee30=_0x2765c7[_0x90c1('0x1b')],_0x1f97b2=_0x2765c7['offset']+_0x2765c7[_0x90c1('0x1c')],_0x3b31a4;if(_0x1f97b2>=_0x49fbce){_0x1f97b2=_0x49fbce;_0x3b31a4=0xc8;}else{_0x3b31a4=0xce;}_0x24fd1c[_0x90c1('0x17')](_0x3b31a4);return _0x24fd1c['set'](_0x90c1('0x1d'),_0x44ee30+'-'+_0x1f97b2+'/'+_0x49fbce)[_0x90c1('0x19')](_0x268902);}return null;};}function patchUpdates(_0x2b04ef){return function(_0x21cb32){try{jsonpatch[_0x90c1('0x1e')](_0x21cb32,_0x2b04ef,!![]);}catch(_0x5d283a){return BPromise[_0x90c1('0x1f')](_0x5d283a);}return _0x21cb32[_0x90c1('0x20')]();};}function saveUpdates(_0x1198de,_0x5c4e82){return function(_0x580271){if(_0x580271){return _0x580271[_0x90c1('0x21')](_0x1198de)[_0x90c1('0x22')](function(_0x37afc3){return _0x37afc3;});}return null;};}function removeEntity(_0x4064b9,_0x3f5262){return function(_0x1cae58){if(_0x1cae58){return _0x1cae58[_0x90c1('0x23')]()['then'](function(){_0x4064b9['status'](0xcc)[_0x90c1('0x18')]();});}};}function handleEntityNotFound(_0x40b569,_0x9efe29){return function(_0x526ad2){if(!_0x526ad2){_0x40b569[_0x90c1('0x16')](0x194);}return _0x526ad2;};}function handleError(_0x4acba5,_0x6ee03d){_0x6ee03d=_0x6ee03d||0x1f4;return function(_0x4187ab){logger['error'](_0x4187ab['stack']);if(_0x4187ab['name']){delete _0x4187ab[_0x90c1('0x24')];}_0x4acba5[_0x90c1('0x17')](_0x6ee03d)[_0x90c1('0x25')](_0x4187ab);};}exports[_0x90c1('0x26')]=function(_0x2e48fe,_0x274823){var _0x1d6c4f={},_0x2f15ff={},_0x10d4bb={'count':0x0,'rows':[]};var _0x277333=_['map'](db[_0x90c1('0x27')][_0x90c1('0x28')],function(_0xd99356){return{'name':_0xd99356['fieldName'],'type':_0xd99356[_0x90c1('0x29')]['key']};});_0x2f15ff[_0x90c1('0x2a')]=_[_0x90c1('0x2b')](_0x277333,'name');_0x2f15ff[_0x90c1('0x2c')]=_[_0x90c1('0x2d')](_0x2e48fe['query']);_0x2f15ff['filters']=_[_0x90c1('0x2e')](_0x2f15ff[_0x90c1('0x2a')],_0x2f15ff['query']);_0x1d6c4f[_0x90c1('0x2f')]=_[_0x90c1('0x2e')](_0x2f15ff['model'],qs[_0x90c1('0x30')](_0x2e48fe[_0x90c1('0x2c')][_0x90c1('0x30')]));_0x1d6c4f['attributes']=_0x1d6c4f[_0x90c1('0x2f')][_0x90c1('0x31')]?_0x1d6c4f[_0x90c1('0x2f')]:_0x2f15ff[_0x90c1('0x2a')];if(!_0x2e48fe['query'][_0x90c1('0x32')]('nolimit')){_0x1d6c4f[_0x90c1('0x1c')]=qs['limit'](_0x2e48fe[_0x90c1('0x2c')][_0x90c1('0x1c')]);_0x1d6c4f[_0x90c1('0x1b')]=qs[_0x90c1('0x1b')](_0x2e48fe[_0x90c1('0x2c')][_0x90c1('0x1b')]);}_0x1d6c4f[_0x90c1('0x33')]=qs['sort'](_0x2e48fe[_0x90c1('0x2c')]['sort']);_0x1d6c4f[_0x90c1('0x34')]=qs[_0x90c1('0x35')](_[_0x90c1('0x36')](_0x2e48fe['query'],_0x2f15ff[_0x90c1('0x35')]),_0x277333);if(_0x2e48fe[_0x90c1('0x2c')][_0x90c1('0x37')]){_0x1d6c4f[_0x90c1('0x34')]=_[_0x90c1('0x38')](_0x1d6c4f[_0x90c1('0x34')],{'$or':_['map'](_0x277333,function(_0x3f9009){if(_0x3f9009[_0x90c1('0x29')]!==_0x90c1('0x39')){var _0x175fbb={};_0x175fbb[_0x3f9009[_0x90c1('0x24')]]={'$like':'%'+_0x2e48fe[_0x90c1('0x2c')][_0x90c1('0x37')]+'%'};return _0x175fbb;}})});}_0x1d6c4f=_[_0x90c1('0x38')]({},_0x1d6c4f,_0x2e48fe[_0x90c1('0x3a')]);var _0xca3f88={'where':_0x1d6c4f[_0x90c1('0x34')]};return db['FreshdeskField']['count'](_0xca3f88)['then'](function(_0x4c32c3){_0x10d4bb[_0x90c1('0x1a')]=_0x4c32c3;if(_0x2e48fe[_0x90c1('0x2c')][_0x90c1('0x3b')]){_0x1d6c4f[_0x90c1('0x3c')]=[{'all':!![]}];}return db[_0x90c1('0x27')][_0x90c1('0x3d')](_0x1d6c4f);})[_0x90c1('0x22')](function(_0x4a1b9d){_0x10d4bb['rows']=_0x4a1b9d;return _0x10d4bb;})[_0x90c1('0x22')](respondWithFilteredResult(_0x274823,_0x1d6c4f))[_0x90c1('0x3e')](handleError(_0x274823,null));};exports[_0x90c1('0x3f')]=function(_0x1d8d9e,_0x4f2af9){var _0x5bbfc6={'raw':!![],'where':{'id':_0x1d8d9e[_0x90c1('0x40')]['id']}},_0x160677={};_0x160677[_0x90c1('0x2a')]=_[_0x90c1('0x2d')](db[_0x90c1('0x27')][_0x90c1('0x28')]);_0x160677[_0x90c1('0x2c')]=_[_0x90c1('0x2d')](_0x1d8d9e['query']);_0x160677[_0x90c1('0x35')]=_[_0x90c1('0x2e')](_0x160677[_0x90c1('0x2a')],_0x160677['query']);_0x5bbfc6['attributes']=_[_0x90c1('0x2e')](_0x160677[_0x90c1('0x2a')],qs[_0x90c1('0x30')](_0x1d8d9e[_0x90c1('0x2c')][_0x90c1('0x30')]));_0x5bbfc6['attributes']=_0x5bbfc6['attributes']['length']?_0x5bbfc6[_0x90c1('0x2f')]:_0x160677[_0x90c1('0x2a')];if(_0x1d8d9e['query'][_0x90c1('0x3b')]){_0x5bbfc6[_0x90c1('0x3c')]=[{'all':!![]}];}_0x5bbfc6=_[_0x90c1('0x38')]({},_0x5bbfc6,_0x1d8d9e[_0x90c1('0x3a')]);return db['FreshdeskField'][_0x90c1('0x41')](_0x5bbfc6)[_0x90c1('0x22')](handleEntityNotFound(_0x4f2af9,null))[_0x90c1('0x22')](respondWithResult(_0x4f2af9,null))[_0x90c1('0x3e')](handleError(_0x4f2af9,null));};exports[_0x90c1('0x42')]=function(_0x2bd801,_0x58365d){return db['FreshdeskField']['create'](_0x2bd801[_0x90c1('0x43')],{})[_0x90c1('0x22')](respondWithResult(_0x58365d,0xc9))[_0x90c1('0x3e')](handleError(_0x58365d,null));};exports[_0x90c1('0x21')]=function(_0x111d8e,_0x24310b){if(_0x111d8e[_0x90c1('0x43')]['id']){delete _0x111d8e[_0x90c1('0x43')]['id'];}return db[_0x90c1('0x27')][_0x90c1('0x41')]({'where':{'id':_0x111d8e[_0x90c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x24310b,null))['then'](saveUpdates(_0x111d8e[_0x90c1('0x43')],null))[_0x90c1('0x22')](respondWithResult(_0x24310b,null))[_0x90c1('0x3e')](handleError(_0x24310b,null));};exports['destroy']=function(_0x27c0fa,_0x5c9711){return db['FreshdeskField'][_0x90c1('0x41')]({'where':{'id':_0x27c0fa[_0x90c1('0x40')]['id']}})[_0x90c1('0x22')](handleEntityNotFound(_0x5c9711,null))[_0x90c1('0x22')](removeEntity(_0x5c9711,null))['catch'](handleError(_0x5c9711,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index ec891e6..d75c93a 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 _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 +var _0x25ad=['api','request-promise','path','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util'];(function(_0x210b93,_0x133e6d){var _0x2b020f=function(_0x3f9601){while(--_0x3f9601){_0x210b93['push'](_0x210b93['shift']());}};_0x2b020f(++_0x133e6d);}(_0x25ad,0x7c));var _0xd25a=function(_0x1f0bba,_0x430c51){_0x1f0bba=_0x1f0bba-0x0;var _0x258c06=_0x25ad[_0x1f0bba];return _0x258c06;};'use strict';var _=require(_0xd25a('0x0'));var util=require(_0xd25a('0x1'));var logger=require('../../config/logger')(_0xd25a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd25a('0x3'));var fs=require('fs');var path=require(_0xd25a('0x4'));var rimraf=require(_0xd25a('0x5'));var config=require(_0xd25a('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0xd25a('0x7')]=function(_0x54e5e0,_0x260ea4){return _0x54e5e0[_0xd25a('0x8')](_0xd25a('0x9'),attributes,{'tableName':_0xd25a('0xa'),'paranoid':![],'indexes':[{'name':_0xd25a('0xb'),'fields':[_0xd25a('0xc'),_0xd25a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index c7b6da0..7c8ad75 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(_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 +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x10988c,_0x43a161){var _0x29f88b=function(_0xd1912d){while(--_0xd1912d){_0x10988c['push'](_0x10988c['shift']());}};_0x29f88b(++_0x43a161);}(_0xb10b,0x12a));var _0xbb10=function(_0x27062d,_0x24b179){_0x27062d=_0x27062d-0x0;var _0x4f1478=_0xb10b[_0x27062d];return _0x4f1478;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 293ec9f..84c7f33 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 _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 +var _0x7241=['getFields','post','/:id/configurations','addConfiguration','put','update','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations'];(function(_0x15549e,_0xedbdea){var _0x50196a=function(_0x565ff0){while(--_0x565ff0){_0x15549e['push'](_0x15549e['shift']());}};_0x50196a(++_0xedbdea);}(_0x7241,0x17d));var _0x1724=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x7241[_0x2283dc];return _0x16db90;};'use strict';var multer=require(_0x1724('0x0'));var util=require('util');var path=require(_0x1724('0x1'));var timeout=require(_0x1724('0x2'));var express=require(_0x1724('0x3'));var router=express[_0x1724('0x4')]();var auth=require(_0x1724('0x5'));var interaction=require(_0x1724('0x6'));var config=require(_0x1724('0x7'));var controller=require(_0x1724('0x8'));router[_0x1724('0x9')]('/',auth['isAuthenticated'](),controller[_0x1724('0xa')]);router[_0x1724('0x9')](_0x1724('0xb'),auth[_0x1724('0xc')](),controller[_0x1724('0xd')]);router[_0x1724('0x9')]('/:id/configurations',auth[_0x1724('0xc')](),controller[_0x1724('0xe')]);router[_0x1724('0x9')]('/:id/fields',auth[_0x1724('0xc')](),controller[_0x1724('0xf')]);router[_0x1724('0x10')]('/',auth[_0x1724('0xc')](),controller['create']);router[_0x1724('0x10')](_0x1724('0x11'),auth[_0x1724('0xc')](),controller[_0x1724('0x12')]);router[_0x1724('0x13')](_0x1724('0xb'),auth[_0x1724('0xc')](),controller[_0x1724('0x14')]);router['delete'](_0x1724('0xb'),auth[_0x1724('0xc')](),controller['destroy']);module[_0x1724('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 6b36a76..31e6eb6 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 _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 +var _0x6c07=['STRING','username','sequelize','exports'];(function(_0x50c4f0,_0x45230c){var _0x150ba3=function(_0x5119f5){while(--_0x5119f5){_0x50c4f0['push'](_0x50c4f0['shift']());}};_0x150ba3(++_0x45230c);}(_0x6c07,0x86));var _0x76c0=function(_0x287536,_0x17c4cb){_0x287536=_0x287536-0x0;var _0x5d6f2d=_0x6c07[_0x287536];return _0x5d6f2d;};'use strict';var Sequelize=require(_0x76c0('0x0'));module[_0x76c0('0x1')]={'name':{'type':Sequelize[_0x76c0('0x2')]},'description':{'type':Sequelize[_0x76c0('0x2')]},'username':{'type':Sequelize[_0x76c0('0x2')],'unique':_0x76c0('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x76c0('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x76c0('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 193ba84..f4c6717 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 _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 +var _0x9c44=['fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','rawAttributes','length','include','find','create','body','getConfigurations','FreshsalesConfiguration','order','addConfiguration','findOne','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','map','FreshsalesAccount','type','key','model','query','keys','intersection','attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9c44,0x178));var _0x49c4=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9c44[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x13'));var db=require(_0x49c4('0x14'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x49c4('0x15'));var client=jayson[_0x49c4('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1909fe,_0x280996,_0x21f15a,_0x2decee){return new BPromise(function(_0x12777c,_0x18211c){var _0x75ea8=_0x2decee||client;return _0x75ea8[_0x49c4('0x17')](_0x1909fe,_0x21f15a)['then'](function(_0x3acd06){logger[_0x49c4('0x18')](_0x49c4('0x19'),_0x280996,_0x49c4('0x1a'));logger[_0x49c4('0x1b')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x280996,_0x49c4('0x1a'),JSON[_0x49c4('0x1c')](_0x3acd06));if(_0x3acd06['error']){if(_0x3acd06['error'][_0x49c4('0x1d')]===0x1f4){logger[_0x49c4('0x1e')](_0x49c4('0x19'),_0x280996,_0x3acd06['error'][_0x49c4('0x1f')]);return _0x18211c(_0x3acd06['error'][_0x49c4('0x1f')]);}logger[_0x49c4('0x1e')](_0x49c4('0x19'),_0x280996,_0x3acd06[_0x49c4('0x1e')][_0x49c4('0x1f')]);return _0x12777c(_0x3acd06[_0x49c4('0x1e')][_0x49c4('0x1f')]);}else{logger[_0x49c4('0x18')](_0x49c4('0x19'),_0x280996,'request\x20sent');_0x12777c(_0x3acd06['result']['message']);}})[_0x49c4('0x20')](function(_0x4f0b62){logger['error'](_0x49c4('0x19'),_0x280996,_0x4f0b62);_0x18211c(_0x4f0b62);});});}function respondWithStatusCode(_0x15581b,_0x26c640){_0x26c640=_0x26c640||0xcc;return function(_0xd335e4){if(_0xd335e4){return _0x15581b['sendStatus'](_0x26c640);}return _0x15581b['status'](_0x26c640)[_0x49c4('0x21')]();};}function respondWithResult(_0x9cb797,_0x565423){_0x565423=_0x565423||0xc8;return function(_0x207358){if(_0x207358){return _0x9cb797[_0x49c4('0x22')](_0x565423)[_0x49c4('0x23')](_0x207358);}};}function respondWithFilteredResult(_0xa7a826,_0x531d92){return function(_0x543ea2){if(_0x543ea2){var _0x449960=_0x543ea2[_0x49c4('0x24')],_0x53c199=_0x531d92[_0x49c4('0x25')],_0x3800b7=_0x531d92['offset']+_0x531d92[_0x49c4('0x26')],_0x3852b2;if(_0x3800b7>=_0x449960){_0x3800b7=_0x449960;_0x3852b2=0xc8;}else{_0x3852b2=0xce;}_0xa7a826[_0x49c4('0x22')](_0x3852b2);return _0xa7a826[_0x49c4('0x27')](_0x49c4('0x28'),_0x53c199+'-'+_0x3800b7+'/'+_0x449960)[_0x49c4('0x23')](_0x543ea2);}return null;};}function patchUpdates(_0x29f835){return function(_0x26ba17){try{jsonpatch[_0x49c4('0x29')](_0x26ba17,_0x29f835,!![]);}catch(_0x17b50f){return BPromise[_0x49c4('0x2a')](_0x17b50f);}return _0x26ba17[_0x49c4('0x2b')]();};}function saveUpdates(_0x4ea6ea,_0x4f4495){return function(_0x59eb84){if(_0x59eb84){return _0x59eb84[_0x49c4('0x2c')](_0x4ea6ea)[_0x49c4('0x2d')](function(_0x1eb035){return _0x1eb035;});}return null;};}function removeEntity(_0x27e467,_0x28eb47){return function(_0x574fd3){if(_0x574fd3){return _0x574fd3[_0x49c4('0x2e')]()[_0x49c4('0x2d')](function(){_0x27e467[_0x49c4('0x22')](0xcc)[_0x49c4('0x21')]();});}};}function handleEntityNotFound(_0x58e252,_0x57a29c){return function(_0xce57ef){if(!_0xce57ef){_0x58e252[_0x49c4('0x2f')](0x194);}return _0xce57ef;};}function handleError(_0x167efe,_0x13b3b4){_0x13b3b4=_0x13b3b4||0x1f4;return function(_0xd38540){logger['error'](_0xd38540[_0x49c4('0x30')]);if(_0xd38540[_0x49c4('0x31')]){delete _0xd38540[_0x49c4('0x31')];}_0x167efe['status'](_0x13b3b4)['send'](_0xd38540);};}exports[_0x49c4('0x32')]=function(_0x1991e9,_0x3bec0a){var _0x1238c0={},_0x2b45a1={},_0x2cf897={'count':0x0,'rows':[]};var _0x1d1557=_[_0x49c4('0x33')](db[_0x49c4('0x34')]['rawAttributes'],function(_0x2d34ca){return{'name':_0x2d34ca['fieldName'],'type':_0x2d34ca[_0x49c4('0x35')][_0x49c4('0x36')]};});_0x2b45a1[_0x49c4('0x37')]=_[_0x49c4('0x33')](_0x1d1557,'name');_0x2b45a1[_0x49c4('0x38')]=_[_0x49c4('0x39')](_0x1991e9[_0x49c4('0x38')]);_0x2b45a1['filters']=_[_0x49c4('0x3a')](_0x2b45a1[_0x49c4('0x37')],_0x2b45a1[_0x49c4('0x38')]);_0x1238c0[_0x49c4('0x3b')]=_[_0x49c4('0x3a')](_0x2b45a1[_0x49c4('0x37')],qs[_0x49c4('0x3c')](_0x1991e9[_0x49c4('0x38')][_0x49c4('0x3c')]));_0x1238c0[_0x49c4('0x3b')]=_0x1238c0[_0x49c4('0x3b')]['length']?_0x1238c0[_0x49c4('0x3b')]:_0x2b45a1[_0x49c4('0x37')];if(!_0x1991e9[_0x49c4('0x38')][_0x49c4('0x3d')](_0x49c4('0x3e'))){_0x1238c0[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x1991e9[_0x49c4('0x38')][_0x49c4('0x26')]);_0x1238c0[_0x49c4('0x25')]=qs[_0x49c4('0x25')](_0x1991e9[_0x49c4('0x38')][_0x49c4('0x25')]);}_0x1238c0['order']=qs[_0x49c4('0x3f')](_0x1991e9['query'][_0x49c4('0x3f')]);_0x1238c0[_0x49c4('0x40')]=qs[_0x49c4('0x41')](_[_0x49c4('0x42')](_0x1991e9[_0x49c4('0x38')],_0x2b45a1[_0x49c4('0x41')]),_0x1d1557);if(_0x1991e9['query']['filter']){_0x1238c0[_0x49c4('0x40')]=_[_0x49c4('0x43')](_0x1238c0[_0x49c4('0x40')],{'$or':_[_0x49c4('0x33')](_0x1d1557,function(_0x490823){if(_0x490823[_0x49c4('0x35')]!==_0x49c4('0x44')){var _0x2ccd47={};_0x2ccd47[_0x490823[_0x49c4('0x31')]]={'$like':'%'+_0x1991e9[_0x49c4('0x38')][_0x49c4('0x45')]+'%'};return _0x2ccd47;}})});}_0x1238c0=_[_0x49c4('0x43')]({},_0x1238c0,_0x1991e9[_0x49c4('0x46')]);var _0x3c4a1d={'where':_0x1238c0['where']};return db[_0x49c4('0x34')]['count'](_0x3c4a1d)[_0x49c4('0x2d')](function(_0x628423){_0x2cf897[_0x49c4('0x24')]=_0x628423;if(_0x1991e9[_0x49c4('0x38')][_0x49c4('0x47')]){_0x1238c0['include']=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x48')](_0x1238c0);})[_0x49c4('0x2d')](function(_0x254d07){_0x2cf897[_0x49c4('0x49')]=_0x254d07;return _0x2cf897;})[_0x49c4('0x2d')](respondWithFilteredResult(_0x3bec0a,_0x1238c0))[_0x49c4('0x20')](handleError(_0x3bec0a,null));};exports['show']=function(_0x3bac1b,_0x5cfff9){var _0x3f7379={'raw':![],'where':{'id':_0x3bac1b[_0x49c4('0x4a')]['id']}},_0x906d3={};_0x906d3[_0x49c4('0x37')]=_[_0x49c4('0x39')](db[_0x49c4('0x34')][_0x49c4('0x4b')]);_0x906d3['query']=_[_0x49c4('0x39')](_0x3bac1b[_0x49c4('0x38')]);_0x906d3['filters']=_[_0x49c4('0x3a')](_0x906d3[_0x49c4('0x37')],_0x906d3[_0x49c4('0x38')]);_0x3f7379[_0x49c4('0x3b')]=_['intersection'](_0x906d3['model'],qs[_0x49c4('0x3c')](_0x3bac1b['query'][_0x49c4('0x3c')]));_0x3f7379[_0x49c4('0x3b')]=_0x3f7379[_0x49c4('0x3b')][_0x49c4('0x4c')]?_0x3f7379[_0x49c4('0x3b')]:_0x906d3[_0x49c4('0x37')];if(_0x3bac1b[_0x49c4('0x38')]['includeAll']){_0x3f7379[_0x49c4('0x4d')]=[{'all':!![]}];}_0x3f7379=_[_0x49c4('0x43')]({},_0x3f7379,_0x3bac1b[_0x49c4('0x46')]);return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x3f7379)[_0x49c4('0x2d')](handleEntityNotFound(_0x5cfff9,null))[_0x49c4('0x2d')](respondWithResult(_0x5cfff9,null))[_0x49c4('0x20')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x4f')]=function(_0x1856be,_0x5b822f){return db['FreshsalesAccount'][_0x49c4('0x4f')](_0x1856be[_0x49c4('0x50')],{})['then'](respondWithResult(_0x5b822f,0xc9))['catch'](handleError(_0x5b822f,null));};exports[_0x49c4('0x2c')]=function(_0x4a00c5,_0x54dda8){if(_0x4a00c5[_0x49c4('0x50')]['id']){delete _0x4a00c5[_0x49c4('0x50')]['id'];}return db[_0x49c4('0x34')][_0x49c4('0x4e')]({'where':{'id':_0x4a00c5[_0x49c4('0x4a')]['id']}})[_0x49c4('0x2d')](handleEntityNotFound(_0x54dda8,null))[_0x49c4('0x2d')](saveUpdates(_0x4a00c5['body'],null))[_0x49c4('0x2d')](respondWithResult(_0x54dda8,null))[_0x49c4('0x20')](handleError(_0x54dda8,null));};exports[_0x49c4('0x2e')]=function(_0x208208,_0x73840f){return db[_0x49c4('0x34')]['find']({'where':{'id':_0x208208['params']['id']}})[_0x49c4('0x2d')](handleEntityNotFound(_0x73840f,null))[_0x49c4('0x2d')](removeEntity(_0x73840f,null))[_0x49c4('0x20')](handleError(_0x73840f,null));};exports[_0x49c4('0x51')]=function(_0x23288e,_0x6b2592,_0xc2033f){var _0x58dc5f={};var _0x45d715={};var _0x33c9a6;var _0x4ba4eb;return db[_0x49c4('0x34')]['findOne']({'where':{'id':_0x23288e[_0x49c4('0x4a')]['id']}})[_0x49c4('0x2d')](handleEntityNotFound(_0x6b2592,null))[_0x49c4('0x2d')](function(_0x2fe89a){if(_0x2fe89a){_0x33c9a6=_0x2fe89a;_0x45d715[_0x49c4('0x37')]=_[_0x49c4('0x39')](db[_0x49c4('0x52')][_0x49c4('0x4b')]);_0x45d715['query']=_[_0x49c4('0x39')](_0x23288e[_0x49c4('0x38')]);_0x45d715['filters']=_[_0x49c4('0x3a')](_0x45d715[_0x49c4('0x37')],_0x45d715['query']);_0x58dc5f[_0x49c4('0x3b')]=_[_0x49c4('0x3a')](_0x45d715['model'],qs['fields'](_0x23288e['query']['fields']));_0x58dc5f[_0x49c4('0x3b')]=_0x58dc5f['attributes'][_0x49c4('0x4c')]?_0x58dc5f[_0x49c4('0x3b')]:_0x45d715['model'];_0x58dc5f[_0x49c4('0x53')]=qs[_0x49c4('0x3f')](_0x23288e['query'][_0x49c4('0x3f')]);_0x58dc5f[_0x49c4('0x40')]=qs[_0x49c4('0x41')](_[_0x49c4('0x42')](_0x23288e['query'],_0x45d715[_0x49c4('0x41')]));if(_0x23288e[_0x49c4('0x38')][_0x49c4('0x45')]){_0x58dc5f[_0x49c4('0x40')]=_['merge'](_0x58dc5f[_0x49c4('0x40')],{'$or':_['map'](_0x58dc5f['attributes'],function(_0x58259d){var _0x5d6de0={};_0x5d6de0[_0x58259d]={'$like':'%'+_0x23288e[_0x49c4('0x38')][_0x49c4('0x45')]+'%'};return _0x5d6de0;})});}_0x58dc5f=_[_0x49c4('0x43')]({},_0x58dc5f,_0x23288e[_0x49c4('0x46')]);return _0x33c9a6['getConfigurations'](_0x58dc5f);}})['then'](function(_0x340523){if(_0x340523){_0x4ba4eb=_0x340523[_0x49c4('0x4c')];if(!_0x23288e[_0x49c4('0x38')][_0x49c4('0x3d')](_0x49c4('0x3e'))){_0x58dc5f[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x23288e[_0x49c4('0x38')]['limit']);_0x58dc5f[_0x49c4('0x25')]=qs['offset'](_0x23288e[_0x49c4('0x38')][_0x49c4('0x25')]);}return _0x33c9a6[_0x49c4('0x51')](_0x58dc5f);}})[_0x49c4('0x2d')](function(_0x3a1c81){if(_0x3a1c81){return _0x3a1c81?{'count':_0x4ba4eb,'rows':_0x3a1c81}:null;}})[_0x49c4('0x2d')](respondWithResult(_0x6b2592,null))[_0x49c4('0x20')](handleError(_0x6b2592,null));};exports[_0x49c4('0x54')]=function(_0x13d951,_0x1743d0,_0x1e3911){if(_0x13d951[_0x49c4('0x50')]['id']){delete _0x13d951[_0x49c4('0x50')]['id'];}return db[_0x49c4('0x34')][_0x49c4('0x55')]({'where':{'id':_0x13d951[_0x49c4('0x4a')]['id']}})[_0x49c4('0x2d')](handleEntityNotFound(_0x1743d0,null))[_0x49c4('0x2d')](function(_0x4e1544){if(_0x4e1544){_0x13d951['body'][_0x49c4('0x56')]=_0x4e1544['id'];_0x13d951[_0x49c4('0x50')]['Subjects']=integrations[_0x49c4('0x57')](_0x13d951[_0x49c4('0x50')][_0x49c4('0x58')],_0x13d951[_0x49c4('0x50')]['type']);_0x13d951['body']['Descriptions']=integrations[_0x49c4('0x59')](_0x13d951[_0x49c4('0x50')][_0x49c4('0x58')],_0x13d951[_0x49c4('0x50')][_0x49c4('0x35')]);return db[_0x49c4('0x52')][_0x49c4('0x4f')](_0x13d951[_0x49c4('0x50')],{'include':[{'model':db[_0x49c4('0x5a')],'as':'Subjects'},{'model':db[_0x49c4('0x5a')],'as':_0x49c4('0x5b')}]});}return null;})[_0x49c4('0x2d')](respondWithResult(_0x1743d0,null))['catch'](handleError(_0x1743d0,null));};exports[_0x49c4('0x5c')]=function(_0x46d94a,_0x1fa0a6,_0xb6031b){var _0x1f25be='';var _0x2fd749='';return db[_0x49c4('0x34')][_0x49c4('0x55')]({'where':{'id':_0x46d94a['params']['id']},'attributes':['id',_0x49c4('0x5d'),_0x49c4('0x5e'),_0x49c4('0x5f')]})[_0x49c4('0x2d')](handleEntityNotFound(_0x1fa0a6,null))[_0x49c4('0x2d')](function(_0x4a204d){if(_0x4a204d){_0x2fd749=_0x4a204d['username'];_0x1f25be=_0x4a204d[_0x49c4('0x5e')];var _0x59aa67=_0x4a204d[_0x49c4('0x5e')]['slice'](-0x1);if(_0x59aa67==='/'){_0x1f25be=_0x1f25be[_0x49c4('0x60')](0x0,_0x1f25be[_0x49c4('0x61')](_0x59aa67));}return rp({'method':_0x49c4('0x62'),'uri':util[_0x49c4('0x63')]('%s%s',_0x1f25be,_0x49c4('0x64')),'headers':{'Authorization':_0x49c4('0x65')+_0x4a204d[_0x49c4('0x5f')]},'json':!![]});}})[_0x49c4('0x2d')](function(_0x100bc4){if(_0x100bc4){var _0xbb7f42=_0x100bc4[_0x49c4('0x66')];var _0x23bb1c=![];var _0x46477f=null;for(_0x46477f=0x0;_0x46477f<_0xbb7f42[_0x49c4('0x4c')];_0x46477f++){if(_0xbb7f42[_0x46477f]['email']===_0x2fd749){_0x23bb1c=!![];}}if(_0x23bb1c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x49c4('0x67')});}}})[_0x49c4('0x2d')](respondWithResult(_0x1fa0a6,null))['catch'](function(_0x15bee0){var _0x5c7e8c=_0x46d94a[_0x49c4('0x38')][_0x49c4('0x68')]?0x1f4:_0x15bee0[_0x49c4('0x69')]||0x1f4;logger[_0x49c4('0x1e')](_0x49c4('0x6a'),'getFields',_0x5c7e8c,JSON[_0x49c4('0x1c')](_0x15bee0));delete _0x15bee0[_0x49c4('0x31')];if(_0x5c7e8c===0x191){_0x5c7e8c=0x190;}_0x1fa0a6['status'](_0x5c7e8c)[_0x49c4('0x6b')](_0x46d94a[_0x49c4('0x38')]['test']?{'message':_0x49c4('0x6c'),'statusCode':_0x15bee0[_0x49c4('0x69')]}:_0x15bee0);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8f4bef9..50993bd 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 _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 +var _0xeca8=['../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x228894,_0x33444d){var _0x3eb04d=function(_0x3ff01c){while(--_0x3ff01c){_0x228894['push'](_0x228894['shift']());}};_0x3eb04d(++_0x33444d);}(_0xeca8,0x1f2));var _0x8eca=function(_0x91b29,_0x5572d5){_0x91b29=_0x91b29-0x0;var _0x424d66=_0xeca8[_0x91b29];return _0x424d66;};'use strict';var _=require(_0x8eca('0x0'));var util=require(_0x8eca('0x1'));var logger=require(_0x8eca('0x2'))(_0x8eca('0x3'));var moment=require(_0x8eca('0x4'));var BPromise=require(_0x8eca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eca('0x6'));var rimraf=require('rimraf');var config=require(_0x8eca('0x7'));var attributes=require(_0x8eca('0x8'));var integrations=require(_0x8eca('0x9'));module['exports']=function(_0x46f257,_0x12c679){return _0x46f257[_0x8eca('0xa')](_0x8eca('0xb'),attributes,{'tableName':_0x8eca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 037bbb4..fe346dc 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 _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 +var _0xf4f4=['then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowFreshsalesAccount','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x229ef4,_0x2433a1){var _0x256239=function(_0x55399d){while(--_0x55399d){_0x229ef4['push'](_0x229ef4['shift']());}};_0x256239(++_0x2433a1);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x89e78b,_0x3d334f){_0x89e78b=_0x89e78b-0x0;var _0x44ee90=_0xf4f4[_0x89e78b];return _0x44ee90;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var moment=require('moment');var BPromise=require(_0x4f4f('0x2'));var rs=require(_0x4f4f('0x3'));var fs=require('fs');var Redis=require(_0x4f4f('0x4'));var db=require(_0x4f4f('0x5'))['db'];var utils=require(_0x4f4f('0x6'));var logger=require('../../config/logger')(_0x4f4f('0x7'));var config=require('../../config/environment');var jayson=require(_0x4f4f('0x8'));var client=jayson[_0x4f4f('0x9')][_0x4f4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ff75a,_0x3c4877,_0x249f8a){return new BPromise(function(_0x2faba9,_0x3768d7){return client['request'](_0x1ff75a,_0x249f8a)[_0x4f4f('0xb')](function(_0x38d110){logger[_0x4f4f('0xc')](_0x4f4f('0xd'),_0x3c4877,_0x4f4f('0xe'));logger[_0x4f4f('0xf')](_0x4f4f('0x10'),_0x3c4877,_0x4f4f('0xe'),JSON['stringify'](_0x38d110));if(_0x38d110['error']){if(_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x12')]===0x1f4){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x3768d7(_0x38d110['error'][_0x4f4f('0x13')]);}logger['error'](_0x4f4f('0xd'),_0x3c4877,_0x38d110[_0x4f4f('0x11')][_0x4f4f('0x13')]);return _0x2faba9(_0x38d110[_0x4f4f('0x11')]['message']);}else{logger[_0x4f4f('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x3c4877,'request\x20sent');_0x2faba9(_0x38d110['result'][_0x4f4f('0x13')]);}})[_0x4f4f('0x14')](function(_0x2d21ed){logger[_0x4f4f('0x11')](_0x4f4f('0xd'),_0x3c4877,_0x2d21ed);_0x3768d7(_0x2d21ed);});});}exports[_0x4f4f('0x15')]=function(_0x1245c4){var _0x60ce2=this;return new Promise(function(_0x929a0b,_0x2f9397){return db[_0x4f4f('0x16')][_0x4f4f('0x17')]({'raw':_0x1245c4['options']?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x19')]===undefined?!![]:![]:!![],'where':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'limit':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1c')]||null:null,'include':_0x1245c4[_0x4f4f('0x18')]?_0x1245c4[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_['map'](_0x1245c4['options']['include'],function(_0x272125){return{'model':db[_0x272125[_0x4f4f('0x1e')]],'as':_0x272125['as'],'attributes':_0x272125['attributes'],'include':_0x272125[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x272125[_0x4f4f('0x1d')],function(_0x2ec92a){return{'model':db[_0x2ec92a[_0x4f4f('0x1e')]],'as':_0x2ec92a['as'],'attributes':_0x2ec92a[_0x4f4f('0x1b')],'include':_0x2ec92a[_0x4f4f('0x1d')]?_['map'](_0x2ec92a[_0x4f4f('0x1d')],function(_0x237cf9){return{'model':db[_0x237cf9[_0x4f4f('0x1e')]],'as':_0x237cf9['as'],'attributes':_0x237cf9[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f4f('0xb')](function(_0x4ad33d){logger[_0x4f4f('0xc')](_0x4f4f('0x15'),_0x1245c4);logger[_0x4f4f('0xf')]('GetFreshsalesAccount',_0x1245c4,JSON['stringify'](_0x4ad33d));_0x929a0b(_0x4ad33d);})['catch'](function(_0x73b8bb){logger['error'](_0x4f4f('0x15'),_0x73b8bb[_0x4f4f('0x13')],_0x1245c4);_0x2f9397(_0x60ce2[_0x4f4f('0x11')](0x1f4,_0x73b8bb['message']));});});};exports[_0x4f4f('0x20')]=function(_0x1b6f53){var _0x5dd5a3=this;return new Promise(function(_0x413b71,_0x1a551a){return db[_0x4f4f('0x16')]['find']({'raw':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1b6f53['options']?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1a')]||null:null,'attributes':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1b')]||null:null,'include':_0x1b6f53[_0x4f4f('0x18')]?_0x1b6f53[_0x4f4f('0x18')][_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x1b6f53[_0x4f4f('0x18')]['include'],function(_0x4d87fd){return{'model':db[_0x4d87fd[_0x4f4f('0x1e')]],'as':_0x4d87fd['as'],'attributes':_0x4d87fd['attributes'],'include':_0x4d87fd[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4d87fd[_0x4f4f('0x1d')],function(_0x4215da){return{'model':db[_0x4215da[_0x4f4f('0x1e')]],'as':_0x4215da['as'],'attributes':_0x4215da[_0x4f4f('0x1b')],'include':_0x4215da[_0x4f4f('0x1d')]?_[_0x4f4f('0x1f')](_0x4215da[_0x4f4f('0x1d')],function(_0x19785e){return{'model':db[_0x19785e[_0x4f4f('0x1e')]],'as':_0x19785e['as'],'attributes':_0x19785e[_0x4f4f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411e94){logger[_0x4f4f('0xc')](_0x4f4f('0x20'),_0x1b6f53);logger[_0x4f4f('0xf')](_0x4f4f('0x20'),_0x1b6f53,JSON[_0x4f4f('0x21')](_0x411e94));_0x413b71(_0x411e94);})[_0x4f4f('0x14')](function(_0x32b077){logger[_0x4f4f('0x11')]('ShowFreshsalesAccount',_0x32b077[_0x4f4f('0x13')],_0x1b6f53);_0x1a551a(_0x5dd5a3[_0x4f4f('0x11')](0x1f4,_0x32b077[_0x4f4f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 3295310..4bd10f1 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 _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 +var _0xee0b=['exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','put','update','delete','destroy'];(function(_0x14753a,_0x5448dc){var _0xa81808=function(_0xd4ceff){while(--_0xd4ceff){_0x14753a['push'](_0x14753a['shift']());}};_0xa81808(++_0x5448dc);}(_0xee0b,0x85));var _0xbee0=function(_0x3141e9,_0x1f0303){_0x3141e9=_0x3141e9-0x0;var _0x55cdc9=_0xee0b[_0x3141e9];return _0x55cdc9;};'use strict';var multer=require(_0xbee0('0x0'));var util=require('util');var path=require(_0xbee0('0x1'));var timeout=require(_0xbee0('0x2'));var express=require(_0xbee0('0x3'));var router=express['Router']();var auth=require(_0xbee0('0x4'));var interaction=require(_0xbee0('0x5'));var config=require(_0xbee0('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xbee0('0x7')]('/',auth[_0xbee0('0x8')](),controller['index']);router['get'](_0xbee0('0x9'),auth[_0xbee0('0x8')](),controller[_0xbee0('0xa')]);router['get'](_0xbee0('0xb'),auth[_0xbee0('0x8')](),controller[_0xbee0('0xc')]);router[_0xbee0('0x7')](_0xbee0('0xd'),auth[_0xbee0('0x8')](),controller[_0xbee0('0xe')]);router['get'](_0xbee0('0xf'),auth[_0xbee0('0x8')](),controller[_0xbee0('0x10')]);router['post']('/',auth[_0xbee0('0x8')](),controller['create']);router[_0xbee0('0x11')](_0xbee0('0x9'),auth[_0xbee0('0x8')](),controller[_0xbee0('0x12')]);router[_0xbee0('0x13')](_0xbee0('0x9'),auth[_0xbee0('0x8')](),controller[_0xbee0('0x14')]);module[_0xbee0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 1622ed5..2e1214c 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 _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 +var _0xf938=['exports','STRING','sequelize'];(function(_0x1ab807,_0x596dee){var _0x474bee=function(_0x557684){while(--_0x557684){_0x1ab807['push'](_0x1ab807['shift']());}};_0x474bee(++_0x596dee);}(_0xf938,0x152));var _0x8f93=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0xf938[_0x1c7889];return _0x2f14e5;};'use strict';var Sequelize=require(_0x8f93('0x0'));module[_0x8f93('0x1')]={'name':{'type':Sequelize[_0x8f93('0x2')]},'description':{'type':Sequelize[_0x8f93('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 32b6084..a025251 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 _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 +var _0x9957=['status','end','json','count','offset','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','include','FreshsalesConfiguration','findAll','rows','show','find','create','body','params','getSubjects','FreshsalesField','filter','getDescriptions','findOne','pick','getFields','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','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus'];(function(_0x3040ce,_0x2e7b9e){var _0x50be57=function(_0x173be2){while(--_0x173be2){_0x3040ce['push'](_0x3040ce['shift']());}};_0x50be57(++_0x2e7b9e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=_0x56691a[_0x7995('0x2e')],_0x5911c3=_0x2a307e[_0x7995('0x2f')],_0x229742=_0x2a307e[_0x7995('0x2f')]+_0x2a307e['limit'],_0x49bc7e;if(_0x229742>=_0x47625f){_0x229742=_0x47625f;_0x49bc7e=0xc8;}else{_0x49bc7e=0xce;}_0x3a3fcf[_0x7995('0x2b')](_0x49bc7e);return _0x3a3fcf['set'](_0x7995('0x30'),_0x5911c3+'-'+_0x229742+'/'+_0x47625f)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x4253e5){return function(_0x574574){try{jsonpatch['apply'](_0x574574,_0x4253e5,!![]);}catch(_0x48e573){return BPromise[_0x7995('0x31')](_0x48e573);}return _0x574574[_0x7995('0x32')]();};}function saveUpdates(_0x327a81,_0x2b874d){return function(_0x2e3493){if(_0x2e3493){return _0x2e3493[_0x7995('0x33')](_0x327a81)['then'](function(_0x481c74){return _0x481c74;});}return null;};}function removeEntity(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')]()[_0x7995('0x1f')](function(){_0xfa8f15[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x510841,_0x44309d){return function(_0x33e24e){if(!_0x33e24e){_0x510841['sendStatus'](0x194);}return _0x33e24e;};}function handleError(_0x48db25,_0x577412){_0x577412=_0x577412||0x1f4;return function(_0x45bc5e){logger[_0x7995('0x25')](_0x45bc5e['stack']);if(_0x45bc5e[_0x7995('0x35')]){delete _0x45bc5e['name'];}_0x48db25[_0x7995('0x2b')](_0x577412)[_0x7995('0x36')](_0x45bc5e);};}exports[_0x7995('0x37')]=function(_0x5014d2,_0x52d76d){var _0x36d057={},_0x5e67fe={},_0x5d2428={'count':0x0,'rows':[]};var _0x3e99cd=_[_0x7995('0x38')](db['FreshsalesConfiguration'][_0x7995('0x39')],function(_0x1922b4){return{'name':_0x1922b4[_0x7995('0x3a')],'type':_0x1922b4[_0x7995('0x3b')][_0x7995('0x3c')]};});_0x5e67fe['model']=_[_0x7995('0x38')](_0x3e99cd,_0x7995('0x35'));_0x5e67fe[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x5014d2['query']);_0x5e67fe[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5e67fe[_0x7995('0x41')],_0x5e67fe[_0x7995('0x3d')]);_0x36d057[_0x7995('0x42')]=_[_0x7995('0x40')](_0x5e67fe['model'],qs[_0x7995('0x43')](_0x5014d2[_0x7995('0x3d')][_0x7995('0x43')]));_0x36d057[_0x7995('0x42')]=_0x36d057[_0x7995('0x42')][_0x7995('0x44')]?_0x36d057[_0x7995('0x42')]:_0x5e67fe[_0x7995('0x41')];if(!_0x5014d2[_0x7995('0x3d')][_0x7995('0x45')](_0x7995('0x46'))){_0x36d057[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x5014d2['query']['limit']);_0x36d057[_0x7995('0x2f')]=qs[_0x7995('0x2f')](_0x5014d2['query']['offset']);}_0x36d057[_0x7995('0x48')]=qs['sort'](_0x5014d2['query'][_0x7995('0x49')]);_0x36d057[_0x7995('0x4a')]=qs[_0x7995('0x3f')](_['pick'](_0x5014d2[_0x7995('0x3d')],_0x5e67fe['filters']),_0x3e99cd);if(_0x5014d2[_0x7995('0x3d')]['filter']){_0x36d057['where']=_[_0x7995('0x4b')](_0x36d057[_0x7995('0x4a')],{'$or':_[_0x7995('0x38')](_0x3e99cd,function(_0x3f1c35){if(_0x3f1c35['type']!==_0x7995('0x4c')){var _0x40fc68={};_0x40fc68[_0x3f1c35[_0x7995('0x35')]]={'$like':'%'+_0x5014d2[_0x7995('0x3d')]['filter']+'%'};return _0x40fc68;}})});}_0x36d057=_['merge']({},_0x36d057,_0x5014d2[_0x7995('0x4d')]);var _0x55791b={'where':_0x36d057[_0x7995('0x4a')]};return db['FreshsalesConfiguration'][_0x7995('0x2e')](_0x55791b)['then'](function(_0x1e795e){_0x5d2428[_0x7995('0x2e')]=_0x1e795e;if(_0x5014d2['query'][_0x7995('0x4e')]){_0x36d057[_0x7995('0x4f')]=[{'all':!![]}];}return db[_0x7995('0x50')][_0x7995('0x51')](_0x36d057);})['then'](function(_0x2458cb){_0x5d2428[_0x7995('0x52')]=_0x2458cb;return _0x5d2428;})[_0x7995('0x1f')](respondWithFilteredResult(_0x52d76d,_0x36d057))['catch'](handleError(_0x52d76d,null));};exports[_0x7995('0x53')]=function(_0x44f516,_0x511567){var _0x3d8ae3={'raw':![],'where':{'id':_0x44f516['params']['id']}},_0x255313={};_0x255313[_0x7995('0x41')]=_[_0x7995('0x3e')](db['FreshsalesConfiguration'][_0x7995('0x39')]);_0x255313['query']=_[_0x7995('0x3e')](_0x44f516[_0x7995('0x3d')]);_0x255313[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x255313[_0x7995('0x41')],_0x255313[_0x7995('0x3d')]);_0x3d8ae3[_0x7995('0x42')]=_['intersection'](_0x255313[_0x7995('0x41')],qs[_0x7995('0x43')](_0x44f516[_0x7995('0x3d')]['fields']));_0x3d8ae3[_0x7995('0x42')]=_0x3d8ae3[_0x7995('0x42')][_0x7995('0x44')]?_0x3d8ae3['attributes']:_0x255313['model'];if(_0x44f516['query'][_0x7995('0x4e')]){_0x3d8ae3[_0x7995('0x4f')]=[{'all':!![]}];}_0x3d8ae3=_['merge']({},_0x3d8ae3,_0x44f516[_0x7995('0x4d')]);return db[_0x7995('0x50')][_0x7995('0x54')](_0x3d8ae3)[_0x7995('0x1f')](handleEntityNotFound(_0x511567,null))[_0x7995('0x1f')](respondWithResult(_0x511567,null))['catch'](handleError(_0x511567,null));};exports[_0x7995('0x55')]=function(_0x4ab09f,_0x14fe7f){return db[_0x7995('0x50')][_0x7995('0x55')](_0x4ab09f['body'],{})['then'](respondWithResult(_0x14fe7f,0xc9))['catch'](handleError(_0x14fe7f,null));};exports['update']=function(_0x2e13b0,_0x3709de){if(_0x2e13b0[_0x7995('0x56')]['id']){delete _0x2e13b0[_0x7995('0x56')]['id'];}return db[_0x7995('0x50')][_0x7995('0x54')]({'where':{'id':_0x2e13b0[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x3709de,null))[_0x7995('0x1f')](saveUpdates(_0x2e13b0[_0x7995('0x56')],null))[_0x7995('0x1f')](respondWithResult(_0x3709de,null))[_0x7995('0x29')](handleError(_0x3709de,null));};exports[_0x7995('0x34')]=function(_0x35bea3,_0x1ea1dc){return db[_0x7995('0x50')][_0x7995('0x54')]({'where':{'id':_0x35bea3[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x1ea1dc,null))['then'](removeEntity(_0x1ea1dc,null))[_0x7995('0x29')](handleError(_0x1ea1dc,null));};exports[_0x7995('0x58')]=function(_0x3b8a54,_0x32c0d3,_0x5d160d){var _0x53125a={};var _0x402fa0={};var _0x197b52;var _0x5b9467;return db[_0x7995('0x50')]['findOne']({'where':{'id':_0x3b8a54[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x32c0d3,null))[_0x7995('0x1f')](function(_0x33c49c){if(_0x33c49c){_0x197b52=_0x33c49c;_0x402fa0['model']=_['keys'](db[_0x7995('0x59')][_0x7995('0x39')]);_0x402fa0[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x3b8a54[_0x7995('0x3d')]);_0x402fa0[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x402fa0[_0x7995('0x41')],_0x402fa0[_0x7995('0x3d')]);_0x53125a['attributes']=_[_0x7995('0x40')](_0x402fa0[_0x7995('0x41')],qs[_0x7995('0x43')](_0x3b8a54[_0x7995('0x3d')]['fields']));_0x53125a['attributes']=_0x53125a[_0x7995('0x42')][_0x7995('0x44')]?_0x53125a['attributes']:_0x402fa0[_0x7995('0x41')];_0x53125a[_0x7995('0x48')]=qs[_0x7995('0x49')](_0x3b8a54[_0x7995('0x3d')][_0x7995('0x49')]);_0x53125a['where']=qs[_0x7995('0x3f')](_['pick'](_0x3b8a54[_0x7995('0x3d')],_0x402fa0[_0x7995('0x3f')]));if(_0x3b8a54[_0x7995('0x3d')][_0x7995('0x5a')]){_0x53125a[_0x7995('0x4a')]=_[_0x7995('0x4b')](_0x53125a[_0x7995('0x4a')],{'$or':_[_0x7995('0x38')](_0x53125a[_0x7995('0x42')],function(_0x3f2bde){var _0x2618c4={};_0x2618c4[_0x3f2bde]={'$like':'%'+_0x3b8a54[_0x7995('0x3d')]['filter']+'%'};return _0x2618c4;})});}_0x53125a=_[_0x7995('0x4b')]({},_0x53125a,_0x3b8a54[_0x7995('0x4d')]);return _0x197b52[_0x7995('0x58')](_0x53125a);}})[_0x7995('0x1f')](function(_0x2c6548){if(_0x2c6548){_0x5b9467=_0x2c6548['length'];if(!_0x3b8a54['query'][_0x7995('0x45')](_0x7995('0x46'))){_0x53125a[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x3b8a54['query'][_0x7995('0x47')]);_0x53125a['offset']=qs['offset'](_0x3b8a54[_0x7995('0x3d')][_0x7995('0x2f')]);}return _0x197b52[_0x7995('0x58')](_0x53125a);}})[_0x7995('0x1f')](function(_0x290eae){if(_0x290eae){return _0x290eae?{'count':_0x5b9467,'rows':_0x290eae}:null;}})[_0x7995('0x1f')](respondWithResult(_0x32c0d3,null))[_0x7995('0x29')](handleError(_0x32c0d3,null));};exports[_0x7995('0x5b')]=function(_0x3fde86,_0x2466df,_0x560b0a){var _0x2dc1f7={};var _0x8908cd={};var _0x3c5802;var _0x4cc247;return db[_0x7995('0x50')][_0x7995('0x5c')]({'where':{'id':_0x3fde86[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x2466df,null))[_0x7995('0x1f')](function(_0x51ab1e){if(_0x51ab1e){_0x3c5802=_0x51ab1e;_0x8908cd[_0x7995('0x41')]=_[_0x7995('0x3e')](db[_0x7995('0x59')][_0x7995('0x39')]);_0x8908cd[_0x7995('0x3d')]=_['keys'](_0x3fde86['query']);_0x8908cd[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x8908cd[_0x7995('0x41')],_0x8908cd[_0x7995('0x3d')]);_0x2dc1f7['attributes']=_[_0x7995('0x40')](_0x8908cd[_0x7995('0x41')],qs['fields'](_0x3fde86['query'][_0x7995('0x43')]));_0x2dc1f7[_0x7995('0x42')]=_0x2dc1f7['attributes'][_0x7995('0x44')]?_0x2dc1f7['attributes']:_0x8908cd[_0x7995('0x41')];_0x2dc1f7[_0x7995('0x48')]=qs['sort'](_0x3fde86['query'][_0x7995('0x49')]);_0x2dc1f7['where']=qs[_0x7995('0x3f')](_[_0x7995('0x5d')](_0x3fde86[_0x7995('0x3d')],_0x8908cd[_0x7995('0x3f')]));if(_0x3fde86[_0x7995('0x3d')][_0x7995('0x5a')]){_0x2dc1f7[_0x7995('0x4a')]=_[_0x7995('0x4b')](_0x2dc1f7[_0x7995('0x4a')],{'$or':_[_0x7995('0x38')](_0x2dc1f7[_0x7995('0x42')],function(_0x16108c){var _0x10a2f5={};_0x10a2f5[_0x16108c]={'$like':'%'+_0x3fde86[_0x7995('0x3d')][_0x7995('0x5a')]+'%'};return _0x10a2f5;})});}_0x2dc1f7=_[_0x7995('0x4b')]({},_0x2dc1f7,_0x3fde86[_0x7995('0x4d')]);return _0x3c5802[_0x7995('0x5b')](_0x2dc1f7);}})[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x4cc247=_0xa2fc8e[_0x7995('0x44')];if(!_0x3fde86[_0x7995('0x3d')][_0x7995('0x45')](_0x7995('0x46'))){_0x2dc1f7[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x3fde86[_0x7995('0x3d')][_0x7995('0x47')]);_0x2dc1f7['offset']=qs[_0x7995('0x2f')](_0x3fde86[_0x7995('0x3d')]['offset']);}return _0x3c5802['getDescriptions'](_0x2dc1f7);}})[_0x7995('0x1f')](function(_0x3fe8fc){if(_0x3fe8fc){return _0x3fe8fc?{'count':_0x4cc247,'rows':_0x3fe8fc}:null;}})[_0x7995('0x1f')](respondWithResult(_0x2466df,null))[_0x7995('0x29')](handleError(_0x2466df,null));};exports[_0x7995('0x5e')]=function(_0x2491fe,_0x5507a0,_0x2f8a2d){var _0xb68962={};var _0x3fea6a={};var _0x77b03f;var _0x7d9c6e;return db[_0x7995('0x50')][_0x7995('0x5c')]({'where':{'id':_0x2491fe[_0x7995('0x57')]['id']}})['then'](handleEntityNotFound(_0x5507a0,null))[_0x7995('0x1f')](function(_0x2b8217){if(_0x2b8217){_0x77b03f=_0x2b8217;_0x3fea6a['model']=_['keys'](db[_0x7995('0x59')][_0x7995('0x39')]);_0x3fea6a[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x2491fe[_0x7995('0x3d')]);_0x3fea6a['filters']=_[_0x7995('0x40')](_0x3fea6a[_0x7995('0x41')],_0x3fea6a['query']);_0xb68962[_0x7995('0x42')]=_[_0x7995('0x40')](_0x3fea6a['model'],qs[_0x7995('0x43')](_0x2491fe['query'][_0x7995('0x43')]));_0xb68962[_0x7995('0x42')]=_0xb68962[_0x7995('0x42')][_0x7995('0x44')]?_0xb68962[_0x7995('0x42')]:_0x3fea6a['model'];_0xb68962[_0x7995('0x48')]=qs[_0x7995('0x49')](_0x2491fe[_0x7995('0x3d')]['sort']);_0xb68962[_0x7995('0x4a')]=qs[_0x7995('0x3f')](_[_0x7995('0x5d')](_0x2491fe[_0x7995('0x3d')],_0x3fea6a['filters']));if(_0x2491fe[_0x7995('0x3d')][_0x7995('0x5a')]){_0xb68962[_0x7995('0x4a')]=_['merge'](_0xb68962['where'],{'$or':_[_0x7995('0x38')](_0xb68962[_0x7995('0x42')],function(_0x4800a8){var _0x590373={};_0x590373[_0x4800a8]={'$like':'%'+_0x2491fe[_0x7995('0x3d')][_0x7995('0x5a')]+'%'};return _0x590373;})});}_0xb68962=_[_0x7995('0x4b')]({},_0xb68962,_0x2491fe[_0x7995('0x4d')]);return _0x77b03f[_0x7995('0x5e')](_0xb68962);}})['then'](function(_0x56003d){if(_0x56003d){_0x7d9c6e=_0x56003d[_0x7995('0x44')];if(!_0x2491fe['query']['hasOwnProperty'](_0x7995('0x46'))){_0xb68962[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x2491fe['query'][_0x7995('0x47')]);_0xb68962[_0x7995('0x2f')]=qs[_0x7995('0x2f')](_0x2491fe[_0x7995('0x3d')][_0x7995('0x2f')]);}return _0x77b03f['getFields'](_0xb68962);}})[_0x7995('0x1f')](function(_0x41d9d1){if(_0x41d9d1){return _0x41d9d1?{'count':_0x7d9c6e,'rows':_0x41d9d1}:null;}})[_0x7995('0x1f')](respondWithResult(_0x5507a0,null))[_0x7995('0x29')](handleError(_0x5507a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4b308dd..edc1356 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 _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 +var _0xc961=['exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment'];(function(_0x383356,_0x33d2f5){var _0x32ee5a=function(_0x2741db){while(--_0x2741db){_0x383356['push'](_0x383356['shift']());}};_0x32ee5a(++_0x33d2f5);}(_0xc961,0x17a));var _0x1c96=function(_0x145eae,_0x2fc6a5){_0x145eae=_0x145eae-0x0;var _0x4c6a1f=_0xc961[_0x145eae];return _0x4c6a1f;};'use strict';var _=require(_0x1c96('0x0'));var util=require(_0x1c96('0x1'));var logger=require(_0x1c96('0x2'))(_0x1c96('0x3'));var moment=require(_0x1c96('0x4'));var BPromise=require(_0x1c96('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1c96('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x1c96('0x7')]=function(_0x5594ee,_0x19d78b){return _0x5594ee[_0x1c96('0x8')](_0x1c96('0x9'),attributes,{'tableName':_0x1c96('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 60e8b63..4b05cba 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 _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 +var _0xf6e8=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2691d8,_0x1e1cb0){var _0x2ca910=function(_0x2e589e){while(--_0x2e589e){_0x2691d8['push'](_0x2691d8['shift']());}};_0x2ca910(++_0x1e1cb0);}(_0xf6e8,0xc1));var _0x8f6e=function(_0x3103cc,_0x231cd8){_0x3103cc=_0x3103cc-0x0;var _0x4b57db=_0xf6e8[_0x3103cc];return _0x4b57db;};'use strict';var _=require('lodash');var util=require(_0x8f6e('0x0'));var moment=require(_0x8f6e('0x1'));var BPromise=require(_0x8f6e('0x2'));var rs=require(_0x8f6e('0x3'));var fs=require('fs');var Redis=require(_0x8f6e('0x4'));var db=require(_0x8f6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f6e('0x6'))('rpc');var config=require(_0x8f6e('0x7'));var jayson=require(_0x8f6e('0x8'));var client=jayson['client'][_0x8f6e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233158,_0xd26126,_0x71b52c){return new BPromise(function(_0x423ed4,_0x105076){return client[_0x8f6e('0xa')](_0x233158,_0x71b52c)[_0x8f6e('0xb')](function(_0x364ade){logger[_0x8f6e('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xd26126,_0x8f6e('0xd'));logger[_0x8f6e('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0xd26126,_0x8f6e('0xd'),JSON[_0x8f6e('0xf')](_0x364ade));if(_0x364ade[_0x8f6e('0x10')]){if(_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x11')]===0x1f4){logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x13')]);return _0x105076(_0x364ade[_0x8f6e('0x10')][_0x8f6e('0x13')]);}logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x364ade['error'][_0x8f6e('0x13')]);return _0x423ed4(_0x364ade[_0x8f6e('0x10')]['message']);}else{logger[_0x8f6e('0xc')](_0x8f6e('0x12'),_0xd26126,_0x8f6e('0xd'));_0x423ed4(_0x364ade['result']['message']);}})['catch'](function(_0x201991){logger[_0x8f6e('0x10')](_0x8f6e('0x12'),_0xd26126,_0x201991);_0x105076(_0x201991);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 68808ac..90e92e3 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 _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 +var _0x917d=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x18eae6,_0x708e29){var _0x409d85=function(_0x3c3807){while(--_0x3c3807){_0x18eae6['push'](_0x18eae6['shift']());}};_0x409d85(++_0x708e29);}(_0x917d,0x164));var _0xd917=function(_0x225b97,_0xe3bf52){_0x225b97=_0x225b97-0x0;var _0x2435bc=_0x917d[_0x225b97];return _0x2435bc;};'use strict';var multer=require(_0xd917('0x0'));var util=require(_0xd917('0x1'));var path=require(_0xd917('0x2'));var timeout=require(_0xd917('0x3'));var express=require(_0xd917('0x4'));var router=express[_0xd917('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd917('0x6'));var config=require(_0xd917('0x7'));var controller=require('./intFreshsalesField.controller');router[_0xd917('0x8')]('/',auth[_0xd917('0x9')](),controller[_0xd917('0xa')]);router[_0xd917('0x8')](_0xd917('0xb'),auth[_0xd917('0x9')](),controller[_0xd917('0xc')]);router[_0xd917('0xd')]('/',auth[_0xd917('0x9')](),controller['create']);router[_0xd917('0xe')](_0xd917('0xb'),auth[_0xd917('0x9')](),controller[_0xd917('0xf')]);router[_0xd917('0x10')](_0xd917('0xb'),auth['isAuthenticated'](),controller[_0xd917('0x11')]);module[_0xd917('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index dee5f2d..c1c1aea 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 _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 +var _0x14f6=['sequelize','exports','ENUM','string','variable','customVariable','STRING','BOOLEAN'];(function(_0x357883,_0xa7c877){var _0x453ad6=function(_0x5599e7){while(--_0x5599e7){_0x357883['push'](_0x357883['shift']());}};_0x453ad6(++_0xa7c877);}(_0x14f6,0x170));var _0x614f=function(_0xbf7e5d,_0xaac903){_0xbf7e5d=_0xbf7e5d-0x0;var _0x45bef7=_0x14f6[_0xbf7e5d];return _0x45bef7;};'use strict';var Sequelize=require(_0x614f('0x0'));module[_0x614f('0x1')]={'type':{'type':Sequelize[_0x614f('0x2')](_0x614f('0x3'),_0x614f('0x4'),_0x614f('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0x614f('0x6')]},'key':{'type':Sequelize[_0x614f('0x6')]},'keyType':{'type':Sequelize[_0x614f('0x2')]('string','variable',_0x614f('0x5'))},'keyContent':{'type':Sequelize[_0x614f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x614f('0x6')]},'customField':{'type':Sequelize[_0x614f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x614f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index cbfb78b..61a70f8 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 _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 +var _0x2cc4=['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','sendStatus','status','json','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','find','create','body','destroy','params','html-pdf','eml-format','rimraf','zip-dir','mustache','util','path','sox','to-csv','squel','crypto','jsforce'];(function(_0x5275b8,_0x51e5dd){var _0x568a9b=function(_0x583a71){while(--_0x583a71){_0x5275b8['push'](_0x5275b8['shift']());}};_0x568a9b(++_0x51e5dd);}(_0x2cc4,0x1f3));var _0x42cc=function(_0x1d3577,_0x17a32e){_0x1d3577=_0x1d3577-0x0;var _0x277d9a=_0x2cc4[_0x1d3577];return _0x277d9a;};'use strict';var pdf=require(_0x42cc('0x0'));var emlformat=require(_0x42cc('0x1'));var rimraf=require(_0x42cc('0x2'));var zipdir=require(_0x42cc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x42cc('0x4'));var util=require(_0x42cc('0x5'));var path=require(_0x42cc('0x6'));var sox=require(_0x42cc('0x7'));var csv=require(_0x42cc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x42cc('0x9'));var crypto=require(_0x42cc('0xa'));var jsforce=require(_0x42cc('0xb'));var deskjs=require(_0x42cc('0xc'));var toCsv=require(_0x42cc('0x8'));var querystring=require(_0x42cc('0xd'));var Papa=require(_0x42cc('0xe'));var Redis=require('ioredis');var authService=require(_0x42cc('0xf'));var qs=require(_0x42cc('0x10'));var as=require(_0x42cc('0x11'));var hardwareService=require(_0x42cc('0x12'));var logger=require('../../config/logger')(_0x42cc('0x13'));var utils=require(_0x42cc('0x14'));var config=require(_0x42cc('0x15'));var licenseUtil=require(_0x42cc('0x16'));var db=require(_0x42cc('0x17'))['db'];function respondWithStatusCode(_0xcd5642,_0x2fd93d){_0x2fd93d=_0x2fd93d||0xcc;return function(_0x3aaaa7){if(_0x3aaaa7){return _0xcd5642[_0x42cc('0x18')](_0x2fd93d);}return _0xcd5642['status'](_0x2fd93d)['end']();};}function respondWithResult(_0x2167c3,_0x3774c2){_0x3774c2=_0x3774c2||0xc8;return function(_0x419b77){if(_0x419b77){return _0x2167c3[_0x42cc('0x19')](_0x3774c2)[_0x42cc('0x1a')](_0x419b77);}};}function respondWithFilteredResult(_0x20cc1f,_0xaad230){return function(_0x3c775a){if(_0x3c775a){var _0x16df98=_0x3c775a['count'],_0x504ac3=_0xaad230['offset'],_0x29f558=_0xaad230['offset']+_0xaad230[_0x42cc('0x1b')],_0x970d8f;if(_0x29f558>=_0x16df98){_0x29f558=_0x16df98;_0x970d8f=0xc8;}else{_0x970d8f=0xce;}_0x20cc1f[_0x42cc('0x19')](_0x970d8f);return _0x20cc1f[_0x42cc('0x1c')](_0x42cc('0x1d'),_0x504ac3+'-'+_0x29f558+'/'+_0x16df98)[_0x42cc('0x1a')](_0x3c775a);}return null;};}function patchUpdates(_0x47f0f9){return function(_0x2fde1c){try{jsonpatch['apply'](_0x2fde1c,_0x47f0f9,!![]);}catch(_0x54a3ad){return BPromise[_0x42cc('0x1e')](_0x54a3ad);}return _0x2fde1c[_0x42cc('0x1f')]();};}function saveUpdates(_0x4501df,_0x5850c1){return function(_0x530ba6){if(_0x530ba6){return _0x530ba6[_0x42cc('0x20')](_0x4501df)[_0x42cc('0x21')](function(_0x286418){return _0x286418;});}return null;};}function removeEntity(_0x4bea56,_0x31cd34){return function(_0x26b414){if(_0x26b414){return _0x26b414['destroy']()[_0x42cc('0x21')](function(){_0x4bea56['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c952c,_0x460015){return function(_0x29ad01){if(!_0x29ad01){_0x2c952c[_0x42cc('0x18')](0x194);}return _0x29ad01;};}function handleError(_0x3ff8dd,_0x9b1427){_0x9b1427=_0x9b1427||0x1f4;return function(_0x5a1a57){logger[_0x42cc('0x22')](_0x5a1a57[_0x42cc('0x23')]);if(_0x5a1a57[_0x42cc('0x24')]){delete _0x5a1a57[_0x42cc('0x24')];}_0x3ff8dd[_0x42cc('0x19')](_0x9b1427)[_0x42cc('0x25')](_0x5a1a57);};}exports[_0x42cc('0x26')]=function(_0x58b0f1,_0x3b124e){var _0x2b272c={},_0x33b910={},_0x4a5517={'count':0x0,'rows':[]};var _0xbcf339=_[_0x42cc('0x27')](db[_0x42cc('0x28')][_0x42cc('0x29')],function(_0x563fa8){return{'name':_0x563fa8[_0x42cc('0x2a')],'type':_0x563fa8[_0x42cc('0x2b')]['key']};});_0x33b910[_0x42cc('0x2c')]=_['map'](_0xbcf339,'name');_0x33b910[_0x42cc('0x2d')]=_[_0x42cc('0x2e')](_0x58b0f1['query']);_0x33b910[_0x42cc('0x2f')]=_['intersection'](_0x33b910['model'],_0x33b910[_0x42cc('0x2d')]);_0x2b272c[_0x42cc('0x30')]=_[_0x42cc('0x31')](_0x33b910[_0x42cc('0x2c')],qs[_0x42cc('0x32')](_0x58b0f1[_0x42cc('0x2d')][_0x42cc('0x32')]));_0x2b272c[_0x42cc('0x30')]=_0x2b272c[_0x42cc('0x30')][_0x42cc('0x33')]?_0x2b272c[_0x42cc('0x30')]:_0x33b910['model'];if(!_0x58b0f1[_0x42cc('0x2d')][_0x42cc('0x34')](_0x42cc('0x35'))){_0x2b272c[_0x42cc('0x1b')]=qs['limit'](_0x58b0f1[_0x42cc('0x2d')][_0x42cc('0x1b')]);_0x2b272c[_0x42cc('0x36')]=qs['offset'](_0x58b0f1[_0x42cc('0x2d')]['offset']);}_0x2b272c[_0x42cc('0x37')]=qs[_0x42cc('0x38')](_0x58b0f1[_0x42cc('0x2d')][_0x42cc('0x38')]);_0x2b272c[_0x42cc('0x39')]=qs[_0x42cc('0x2f')](_[_0x42cc('0x3a')](_0x58b0f1[_0x42cc('0x2d')],_0x33b910[_0x42cc('0x2f')]),_0xbcf339);if(_0x58b0f1[_0x42cc('0x2d')][_0x42cc('0x3b')]){_0x2b272c[_0x42cc('0x39')]=_[_0x42cc('0x3c')](_0x2b272c['where'],{'$or':_[_0x42cc('0x27')](_0xbcf339,function(_0x3dbcd4){if(_0x3dbcd4[_0x42cc('0x2b')]!==_0x42cc('0x3d')){var _0x1d6ebf={};_0x1d6ebf[_0x3dbcd4[_0x42cc('0x24')]]={'$like':'%'+_0x58b0f1[_0x42cc('0x2d')][_0x42cc('0x3b')]+'%'};return _0x1d6ebf;}})});}_0x2b272c=_[_0x42cc('0x3c')]({},_0x2b272c,_0x58b0f1[_0x42cc('0x3e')]);var _0x3c431c={'where':_0x2b272c[_0x42cc('0x39')]};return db[_0x42cc('0x28')][_0x42cc('0x3f')](_0x3c431c)['then'](function(_0x4da0b0){_0x4a5517['count']=_0x4da0b0;if(_0x58b0f1['query'][_0x42cc('0x40')]){_0x2b272c[_0x42cc('0x41')]=[{'all':!![]}];}return db[_0x42cc('0x28')]['findAll'](_0x2b272c);})[_0x42cc('0x21')](function(_0x43c354){_0x4a5517[_0x42cc('0x42')]=_0x43c354;return _0x4a5517;})[_0x42cc('0x21')](respondWithFilteredResult(_0x3b124e,_0x2b272c))[_0x42cc('0x43')](handleError(_0x3b124e,null));};exports['show']=function(_0x1dfce9,_0xbde563){var _0x1caa7e={'raw':!![],'where':{'id':_0x1dfce9['params']['id']}},_0x41c23b={};_0x41c23b[_0x42cc('0x2c')]=_['keys'](db[_0x42cc('0x28')][_0x42cc('0x29')]);_0x41c23b[_0x42cc('0x2d')]=_[_0x42cc('0x2e')](_0x1dfce9[_0x42cc('0x2d')]);_0x41c23b[_0x42cc('0x2f')]=_['intersection'](_0x41c23b[_0x42cc('0x2c')],_0x41c23b[_0x42cc('0x2d')]);_0x1caa7e[_0x42cc('0x30')]=_['intersection'](_0x41c23b[_0x42cc('0x2c')],qs['fields'](_0x1dfce9[_0x42cc('0x2d')][_0x42cc('0x32')]));_0x1caa7e[_0x42cc('0x30')]=_0x1caa7e[_0x42cc('0x30')][_0x42cc('0x33')]?_0x1caa7e[_0x42cc('0x30')]:_0x41c23b[_0x42cc('0x2c')];if(_0x1dfce9['query'][_0x42cc('0x40')]){_0x1caa7e[_0x42cc('0x41')]=[{'all':!![]}];}_0x1caa7e=_[_0x42cc('0x3c')]({},_0x1caa7e,_0x1dfce9[_0x42cc('0x3e')]);return db['FreshsalesField'][_0x42cc('0x44')](_0x1caa7e)[_0x42cc('0x21')](handleEntityNotFound(_0xbde563,null))[_0x42cc('0x21')](respondWithResult(_0xbde563,null))[_0x42cc('0x43')](handleError(_0xbde563,null));};exports[_0x42cc('0x45')]=function(_0x399223,_0x1bed79){return db['FreshsalesField'][_0x42cc('0x45')](_0x399223['body'],{})[_0x42cc('0x21')](respondWithResult(_0x1bed79,0xc9))[_0x42cc('0x43')](handleError(_0x1bed79,null));};exports['update']=function(_0x827603,_0x5b6e52){if(_0x827603[_0x42cc('0x46')]['id']){delete _0x827603['body']['id'];}return db[_0x42cc('0x28')][_0x42cc('0x44')]({'where':{'id':_0x827603['params']['id']}})[_0x42cc('0x21')](handleEntityNotFound(_0x5b6e52,null))['then'](saveUpdates(_0x827603[_0x42cc('0x46')],null))[_0x42cc('0x21')](respondWithResult(_0x5b6e52,null))[_0x42cc('0x43')](handleError(_0x5b6e52,null));};exports[_0x42cc('0x47')]=function(_0x4890f0,_0x98c961){return db[_0x42cc('0x28')]['find']({'where':{'id':_0x4890f0[_0x42cc('0x48')]['id']}})[_0x42cc('0x21')](handleEntityNotFound(_0x98c961,null))[_0x42cc('0x21')](removeEntity(_0x98c961,null))[_0x42cc('0x43')](handleError(_0x98c961,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6cb7d32..b525664 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 _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 +var _0x793b=['int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','request-promise','rimraf','./intFreshsalesField.attributes','FreshsalesField'];(function(_0x2d7df2,_0x5705a8){var _0x55906e=function(_0x5a306d){while(--_0x5a306d){_0x2d7df2['push'](_0x2d7df2['shift']());}};_0x55906e(++_0x5705a8);}(_0x793b,0x1f2));var _0xb793=function(_0x4ddf4d,_0x4cc1f6){_0x4ddf4d=_0x4ddf4d-0x0;var _0x11cd7c=_0x793b[_0x4ddf4d];return _0x11cd7c;};'use strict';var _=require(_0xb793('0x0'));var util=require(_0xb793('0x1'));var logger=require(_0xb793('0x2'))(_0xb793('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb793('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb793('0x5'));var config=require('../../config/environment');var attributes=require(_0xb793('0x6'));module['exports']=function(_0x4ce4cd,_0x410084){return _0x4ce4cd['define'](_0xb793('0x7'),attributes,{'tableName':_0xb793('0x8'),'paranoid':![],'indexes':[{'name':_0xb793('0x9'),'fields':['idField',_0xb793('0xa')],'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 c7c9dfe..5f2b51c 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 _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 +var _0x66b8=['stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','client','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x66b8,0x8b));var _0x866b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x66b8[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x866b('0x0'));var util=require('util');var moment=require(_0x866b('0x1'));var BPromise=require(_0x866b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x866b('0x3'))['db'];var utils=require(_0x866b('0x4'));var logger=require('../../config/logger')(_0x866b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x866b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4618fb,_0x54fe92,_0x94c78){return new BPromise(function(_0x44bdfa,_0x33cb43){return client[_0x866b('0x7')](_0x4618fb,_0x94c78)[_0x866b('0x8')](function(_0x3c4d72){logger[_0x866b('0x9')](_0x866b('0xa'),_0x54fe92,_0x866b('0xb'));logger['debug'](_0x866b('0xc'),_0x54fe92,'request\x20sent',JSON[_0x866b('0xd')](_0x3c4d72));if(_0x3c4d72[_0x866b('0xe')]){if(_0x3c4d72[_0x866b('0xe')][_0x866b('0xf')]===0x1f4){logger[_0x866b('0xe')](_0x866b('0xa'),_0x54fe92,_0x3c4d72[_0x866b('0xe')][_0x866b('0x10')]);return _0x33cb43(_0x3c4d72['error']['message']);}logger['error'](_0x866b('0xa'),_0x54fe92,_0x3c4d72[_0x866b('0xe')][_0x866b('0x10')]);return _0x44bdfa(_0x3c4d72[_0x866b('0xe')][_0x866b('0x10')]);}else{logger[_0x866b('0x9')](_0x866b('0xa'),_0x54fe92,'request\x20sent');_0x44bdfa(_0x3c4d72[_0x866b('0x11')][_0x866b('0x10')]);}})[_0x866b('0x12')](function(_0x250fe6){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x54fe92,_0x250fe6);_0x33cb43(_0x250fe6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5f17abc..849f5ec 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 _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 +var _0x54d4=['addConfiguration','/:id','update','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','show','getConfigurations','/:id/fields','isAuthenticated','post','/:id/configurations'];(function(_0x35f0bc,_0x536ad1){var _0x4edfc9=function(_0x4a2178){while(--_0x4a2178){_0x35f0bc['push'](_0x35f0bc['shift']());}};_0x4edfc9(++_0x536ad1);}(_0x54d4,0x192));var _0x454d=function(_0xbf3fa2,_0x17928c){_0xbf3fa2=_0xbf3fa2-0x0;var _0x3ffa3c=_0x54d4[_0xbf3fa2];return _0x3ffa3c;};'use strict';var multer=require(_0x454d('0x0'));var util=require(_0x454d('0x1'));var path=require('path');var timeout=require(_0x454d('0x2'));var express=require(_0x454d('0x3'));var router=express[_0x454d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x454d('0x5'));var config=require(_0x454d('0x6'));var controller=require(_0x454d('0x7'));router[_0x454d('0x8')]('/',auth['isAuthenticated'](),controller[_0x454d('0x9')]);router[_0x454d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x454d('0xa')]);router[_0x454d('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x454d('0xb')]);router[_0x454d('0x8')](_0x454d('0xc'),auth[_0x454d('0xd')](),controller['getFields']);router[_0x454d('0xe')]('/',auth[_0x454d('0xd')](),controller['create']);router[_0x454d('0xe')](_0x454d('0xf'),auth[_0x454d('0xd')](),controller[_0x454d('0x10')]);router['put'](_0x454d('0x11'),auth[_0x454d('0xd')](),controller[_0x454d('0x12')]);router['delete'](_0x454d('0x11'),auth[_0x454d('0xd')](),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 8d24d1b..1c71d5a 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 _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 +var _0x918c=['username','ENUM','integrationTab','exports','STRING'];(function(_0xce5632,_0x1f781b){var _0x31b279=function(_0x29f345){while(--_0x29f345){_0xce5632['push'](_0xce5632['shift']());}};_0x31b279(++_0x1f781b);}(_0x918c,0x1b6));var _0xc918=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x918c[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0xc918('0x0')]={'name':{'type':Sequelize[_0xc918('0x1')]},'description':{'type':Sequelize[_0xc918('0x1')]},'username':{'type':Sequelize[_0xc918('0x1')],'unique':_0xc918('0x2')},'remoteUri':{'type':Sequelize[_0xc918('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc918('0x1')]},'clientSecret':{'type':Sequelize[_0xc918('0x1')]},'securityToken':{'type':Sequelize[_0xc918('0x1')]},'serverUrl':{'type':Sequelize[_0xc918('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xc918('0x3')](_0xc918('0x4'),'newTab'),'defaultValue':_0xc918('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index bdcec54..db0b069 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 _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 +var _0x94ca=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceAccount','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','filter','options','count','includeAll','include','findAll','show','params','rawAttributes','keys','find','create','body','findOne','SalesforceConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','getFields','Task','clientSecret','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','IsRecurrence','Subject','string','int','picklist','boolean','email','textarea','remove','includes','label','picklistValues','true','False','false','test','statusCode','Wrong\x20credentials','html-pdf','eml-format','rimraf'];(function(_0x4fe69d,_0x2dea4c){var _0x534500=function(_0x3354ad){while(--_0x3354ad){_0x4fe69d['push'](_0x4fe69d['shift']());}};_0x534500(++_0x2dea4c);}(_0x94ca,0x105));var _0xa94c=function(_0x3e46ed,_0x4d8a3d){_0x3e46ed=_0x3e46ed-0x0;var _0x2ca02d=_0x94ca[_0x3e46ed];return _0x2ca02d;};'use strict';var pdf=require(_0xa94c('0x0'));var emlformat=require(_0xa94c('0x1'));var rimraf=require(_0xa94c('0x2'));var zipdir=require(_0xa94c('0x3'));var jsonpatch=require(_0xa94c('0x4'));var rp=require(_0xa94c('0x5'));var moment=require('moment');var BPromise=require(_0xa94c('0x6'));var Mustache=require(_0xa94c('0x7'));var util=require(_0xa94c('0x8'));var path=require(_0xa94c('0x9'));var sox=require(_0xa94c('0xa'));var csv=require(_0xa94c('0xb'));var ejs=require(_0xa94c('0xc'));var fs=require('fs');var _=require(_0xa94c('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa94c('0xe'));var deskjs=require(_0xa94c('0xf'));var toCsv=require(_0xa94c('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa94c('0x10'));var as=require(_0xa94c('0x11'));var hardwareService=require(_0xa94c('0x12'));var logger=require(_0xa94c('0x13'))('api');var utils=require(_0xa94c('0x14'));var config=require(_0xa94c('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xa94c('0x16'));var jayson=require(_0xa94c('0x17'));var client=jayson['client'][_0xa94c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x80015,_0x441b93,_0x5c265e,_0x24c381){return new BPromise(function(_0x688b84,_0x27db6b){var _0x35f25d=_0x24c381||client;return _0x35f25d[_0xa94c('0x19')](_0x80015,_0x5c265e)[_0xa94c('0x1a')](function(_0x2456f2){logger[_0xa94c('0x1b')](_0xa94c('0x1c'),_0x441b93,_0xa94c('0x1d'));logger[_0xa94c('0x1e')](_0xa94c('0x1f'),_0x441b93,'request\x20sent',JSON[_0xa94c('0x20')](_0x2456f2));if(_0x2456f2[_0xa94c('0x21')]){if(_0x2456f2[_0xa94c('0x21')]['code']===0x1f4){logger[_0xa94c('0x21')](_0xa94c('0x1c'),_0x441b93,_0x2456f2['error'][_0xa94c('0x22')]);return _0x27db6b(_0x2456f2[_0xa94c('0x21')][_0xa94c('0x22')]);}logger['error'](_0xa94c('0x1c'),_0x441b93,_0x2456f2[_0xa94c('0x21')][_0xa94c('0x22')]);return _0x688b84(_0x2456f2[_0xa94c('0x21')][_0xa94c('0x22')]);}else{logger['info'](_0xa94c('0x1c'),_0x441b93,_0xa94c('0x1d'));_0x688b84(_0x2456f2[_0xa94c('0x23')][_0xa94c('0x22')]);}})[_0xa94c('0x24')](function(_0xf11e3d){logger['error'](_0xa94c('0x1c'),_0x441b93,_0xf11e3d);_0x27db6b(_0xf11e3d);});});}function respondWithStatusCode(_0x58078f,_0x43fc82){_0x43fc82=_0x43fc82||0xcc;return function(_0x408294){if(_0x408294){return _0x58078f[_0xa94c('0x25')](_0x43fc82);}return _0x58078f['status'](_0x43fc82)[_0xa94c('0x26')]();};}function respondWithResult(_0x3e6cb0,_0xab0a1d){_0xab0a1d=_0xab0a1d||0xc8;return function(_0x1e6931){if(_0x1e6931){return _0x3e6cb0[_0xa94c('0x27')](_0xab0a1d)[_0xa94c('0x28')](_0x1e6931);}};}function respondWithFilteredResult(_0x476b77,_0x466798){return function(_0x15a44c){if(_0x15a44c){var _0x295802=_0x15a44c['count'],_0x13bb31=_0x466798[_0xa94c('0x29')],_0x2f90af=_0x466798[_0xa94c('0x29')]+_0x466798[_0xa94c('0x2a')],_0x5533ed;if(_0x2f90af>=_0x295802){_0x2f90af=_0x295802;_0x5533ed=0xc8;}else{_0x5533ed=0xce;}_0x476b77['status'](_0x5533ed);return _0x476b77[_0xa94c('0x2b')](_0xa94c('0x2c'),_0x13bb31+'-'+_0x2f90af+'/'+_0x295802)[_0xa94c('0x28')](_0x15a44c);}return null;};}function patchUpdates(_0x54a044){return function(_0x3b1c67){try{jsonpatch[_0xa94c('0x2d')](_0x3b1c67,_0x54a044,!![]);}catch(_0x7b642){return BPromise[_0xa94c('0x2e')](_0x7b642);}return _0x3b1c67[_0xa94c('0x2f')]();};}function saveUpdates(_0x414af5,_0x31cbfa){return function(_0x145d14){if(_0x145d14){return _0x145d14[_0xa94c('0x30')](_0x414af5)[_0xa94c('0x1a')](function(_0x27482e){return _0x27482e;});}return null;};}function removeEntity(_0x5610de,_0x1710ff){return function(_0x41db84){if(_0x41db84){return _0x41db84[_0xa94c('0x31')]()[_0xa94c('0x1a')](function(){_0x5610de[_0xa94c('0x27')](0xcc)[_0xa94c('0x26')]();});}};}function handleEntityNotFound(_0x40a4dc,_0x2e980e){return function(_0x4365f3){if(!_0x4365f3){_0x40a4dc['sendStatus'](0x194);}return _0x4365f3;};}function handleError(_0x3bb1bb,_0x460998){_0x460998=_0x460998||0x1f4;return function(_0x34f43f){logger[_0xa94c('0x21')](_0x34f43f[_0xa94c('0x32')]);if(_0x34f43f[_0xa94c('0x33')]){delete _0x34f43f[_0xa94c('0x33')];}_0x3bb1bb['status'](_0x460998)[_0xa94c('0x34')](_0x34f43f);};}exports[_0xa94c('0x35')]=function(_0xc0ece3,_0x20d469){var _0xb516c9={},_0x584a21={},_0x33c283={'count':0x0,'rows':[]};var _0x3893e7=_[_0xa94c('0x36')](db[_0xa94c('0x37')]['rawAttributes'],function(_0x493f09){return{'name':_0x493f09[_0xa94c('0x38')],'type':_0x493f09['type'][_0xa94c('0x39')]};});_0x584a21[_0xa94c('0x3a')]=_[_0xa94c('0x36')](_0x3893e7,_0xa94c('0x33'));_0x584a21['query']=_['keys'](_0xc0ece3[_0xa94c('0x3b')]);_0x584a21[_0xa94c('0x3c')]=_[_0xa94c('0x3d')](_0x584a21[_0xa94c('0x3a')],_0x584a21['query']);_0xb516c9[_0xa94c('0x3e')]=_[_0xa94c('0x3d')](_0x584a21['model'],qs['fields'](_0xc0ece3[_0xa94c('0x3b')][_0xa94c('0x3f')]));_0xb516c9['attributes']=_0xb516c9[_0xa94c('0x3e')][_0xa94c('0x40')]?_0xb516c9[_0xa94c('0x3e')]:_0x584a21[_0xa94c('0x3a')];if(!_0xc0ece3[_0xa94c('0x3b')][_0xa94c('0x41')](_0xa94c('0x42'))){_0xb516c9[_0xa94c('0x2a')]=qs[_0xa94c('0x2a')](_0xc0ece3[_0xa94c('0x3b')]['limit']);_0xb516c9['offset']=qs[_0xa94c('0x29')](_0xc0ece3['query'][_0xa94c('0x29')]);}_0xb516c9[_0xa94c('0x43')]=qs[_0xa94c('0x44')](_0xc0ece3['query'][_0xa94c('0x44')]);_0xb516c9['where']=qs[_0xa94c('0x3c')](_['pick'](_0xc0ece3[_0xa94c('0x3b')],_0x584a21[_0xa94c('0x3c')]),_0x3893e7);if(_0xc0ece3[_0xa94c('0x3b')]['filter']){_0xb516c9['where']=_[_0xa94c('0x45')](_0xb516c9[_0xa94c('0x46')],{'$or':_[_0xa94c('0x36')](_0x3893e7,function(_0x5ccf7a){if(_0x5ccf7a['type']!=='VIRTUAL'){var _0x875f91={};_0x875f91[_0x5ccf7a['name']]={'$like':'%'+_0xc0ece3[_0xa94c('0x3b')][_0xa94c('0x47')]+'%'};return _0x875f91;}})});}_0xb516c9=_[_0xa94c('0x45')]({},_0xb516c9,_0xc0ece3[_0xa94c('0x48')]);var _0x33867c={'where':_0xb516c9[_0xa94c('0x46')]};return db[_0xa94c('0x37')][_0xa94c('0x49')](_0x33867c)[_0xa94c('0x1a')](function(_0x6ce6df){_0x33c283[_0xa94c('0x49')]=_0x6ce6df;if(_0xc0ece3[_0xa94c('0x3b')][_0xa94c('0x4a')]){_0xb516c9[_0xa94c('0x4b')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xa94c('0x4c')](_0xb516c9);})[_0xa94c('0x1a')](function(_0x57be02){_0x33c283['rows']=_0x57be02;return _0x33c283;})[_0xa94c('0x1a')](respondWithFilteredResult(_0x20d469,_0xb516c9))[_0xa94c('0x24')](handleError(_0x20d469,null));};exports[_0xa94c('0x4d')]=function(_0x1c1e6d,_0x5957d7){var _0x14e921={'raw':![],'where':{'id':_0x1c1e6d[_0xa94c('0x4e')]['id']}},_0x16ce88={};_0x16ce88[_0xa94c('0x3a')]=_['keys'](db[_0xa94c('0x37')][_0xa94c('0x4f')]);_0x16ce88[_0xa94c('0x3b')]=_[_0xa94c('0x50')](_0x1c1e6d[_0xa94c('0x3b')]);_0x16ce88[_0xa94c('0x3c')]=_[_0xa94c('0x3d')](_0x16ce88['model'],_0x16ce88[_0xa94c('0x3b')]);_0x14e921['attributes']=_[_0xa94c('0x3d')](_0x16ce88['model'],qs[_0xa94c('0x3f')](_0x1c1e6d['query'][_0xa94c('0x3f')]));_0x14e921['attributes']=_0x14e921['attributes'][_0xa94c('0x40')]?_0x14e921[_0xa94c('0x3e')]:_0x16ce88[_0xa94c('0x3a')];if(_0x1c1e6d['query']['includeAll']){_0x14e921['include']=[{'all':!![]}];}_0x14e921=_[_0xa94c('0x45')]({},_0x14e921,_0x1c1e6d[_0xa94c('0x48')]);return db['SalesforceAccount'][_0xa94c('0x51')](_0x14e921)[_0xa94c('0x1a')](handleEntityNotFound(_0x5957d7,null))[_0xa94c('0x1a')](respondWithResult(_0x5957d7,null))[_0xa94c('0x24')](handleError(_0x5957d7,null));};exports[_0xa94c('0x52')]=function(_0x59bc6b,_0x4f9c4d){return db[_0xa94c('0x37')]['create'](_0x59bc6b[_0xa94c('0x53')],{})[_0xa94c('0x1a')](respondWithResult(_0x4f9c4d,0xc9))[_0xa94c('0x24')](handleError(_0x4f9c4d,null));};exports['update']=function(_0xf4518e,_0xe2ac9c){if(_0xf4518e[_0xa94c('0x53')]['id']){delete _0xf4518e['body']['id'];}return db[_0xa94c('0x37')]['find']({'where':{'id':_0xf4518e['params']['id']}})[_0xa94c('0x1a')](handleEntityNotFound(_0xe2ac9c,null))[_0xa94c('0x1a')](saveUpdates(_0xf4518e[_0xa94c('0x53')],null))[_0xa94c('0x1a')](respondWithResult(_0xe2ac9c,null))[_0xa94c('0x24')](handleError(_0xe2ac9c,null));};exports['destroy']=function(_0x42a550,_0x1efc94){return db['SalesforceAccount'][_0xa94c('0x51')]({'where':{'id':_0x42a550[_0xa94c('0x4e')]['id']}})[_0xa94c('0x1a')](handleEntityNotFound(_0x1efc94,null))[_0xa94c('0x1a')](removeEntity(_0x1efc94,null))[_0xa94c('0x24')](handleError(_0x1efc94,null));};exports['getConfigurations']=function(_0x25f897,_0x59b649,_0x53d8fe){var _0x378092={};var _0x2646a4={};var _0x2546b3;var _0x395032;return db[_0xa94c('0x37')][_0xa94c('0x54')]({'where':{'id':_0x25f897[_0xa94c('0x4e')]['id']}})[_0xa94c('0x1a')](handleEntityNotFound(_0x59b649,null))['then'](function(_0x516ec8){if(_0x516ec8){_0x2546b3=_0x516ec8;_0x2646a4['model']=_[_0xa94c('0x50')](db[_0xa94c('0x55')][_0xa94c('0x4f')]);_0x2646a4['query']=_['keys'](_0x25f897[_0xa94c('0x3b')]);_0x2646a4['filters']=_[_0xa94c('0x3d')](_0x2646a4[_0xa94c('0x3a')],_0x2646a4[_0xa94c('0x3b')]);_0x378092['attributes']=_[_0xa94c('0x3d')](_0x2646a4[_0xa94c('0x3a')],qs[_0xa94c('0x3f')](_0x25f897[_0xa94c('0x3b')]['fields']));_0x378092[_0xa94c('0x3e')]=_0x378092['attributes'][_0xa94c('0x40')]?_0x378092[_0xa94c('0x3e')]:_0x2646a4[_0xa94c('0x3a')];_0x378092[_0xa94c('0x43')]=qs['sort'](_0x25f897[_0xa94c('0x3b')][_0xa94c('0x44')]);_0x378092[_0xa94c('0x46')]=qs[_0xa94c('0x3c')](_['pick'](_0x25f897['query'],_0x2646a4[_0xa94c('0x3c')]));if(_0x25f897['query'][_0xa94c('0x47')]){_0x378092[_0xa94c('0x46')]=_['merge'](_0x378092['where'],{'$or':_[_0xa94c('0x36')](_0x378092[_0xa94c('0x3e')],function(_0x27b943){var _0x2287dd={};_0x2287dd[_0x27b943]={'$like':'%'+_0x25f897[_0xa94c('0x3b')][_0xa94c('0x47')]+'%'};return _0x2287dd;})});}_0x378092=_[_0xa94c('0x45')]({},_0x378092,_0x25f897[_0xa94c('0x48')]);return _0x2546b3[_0xa94c('0x56')](_0x378092);}})[_0xa94c('0x1a')](function(_0x9207fd){if(_0x9207fd){_0x395032=_0x9207fd[_0xa94c('0x40')];if(!_0x25f897[_0xa94c('0x3b')][_0xa94c('0x41')]('nolimit')){_0x378092[_0xa94c('0x2a')]=qs[_0xa94c('0x2a')](_0x25f897[_0xa94c('0x3b')][_0xa94c('0x2a')]);_0x378092[_0xa94c('0x29')]=qs['offset'](_0x25f897['query'][_0xa94c('0x29')]);}return _0x2546b3[_0xa94c('0x56')](_0x378092);}})[_0xa94c('0x1a')](function(_0x4c9efd){if(_0x4c9efd){return _0x4c9efd?{'count':_0x395032,'rows':_0x4c9efd}:null;}})[_0xa94c('0x1a')](respondWithResult(_0x59b649,null))[_0xa94c('0x24')](handleError(_0x59b649,null));};exports[_0xa94c('0x57')]=function(_0x16e621,_0x52ffc7,_0x12bf03){if(_0x16e621[_0xa94c('0x53')]['id']){delete _0x16e621['body']['id'];}return db[_0xa94c('0x37')][_0xa94c('0x54')]({'where':{'id':_0x16e621[_0xa94c('0x4e')]['id']}})[_0xa94c('0x1a')](handleEntityNotFound(_0x52ffc7,null))[_0xa94c('0x1a')](function(_0x4dc577){if(_0x4dc577){_0x16e621[_0xa94c('0x53')][_0xa94c('0x58')]=_0x4dc577['id'];_0x16e621[_0xa94c('0x53')][_0xa94c('0x59')]=integrations[_0xa94c('0x5a')](_0x16e621['body'][_0xa94c('0x5b')],_0x16e621[_0xa94c('0x53')][_0xa94c('0x5c')]);_0x16e621[_0xa94c('0x53')][_0xa94c('0x5d')]=integrations[_0xa94c('0x5e')](_0x16e621[_0xa94c('0x53')][_0xa94c('0x5b')],_0x16e621[_0xa94c('0x53')][_0xa94c('0x5c')]);return db[_0xa94c('0x55')][_0xa94c('0x52')](_0x16e621['body'],{'include':[{'model':db[_0xa94c('0x5f')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xa94c('0x5d')}]});}return null;})[_0xa94c('0x1a')](respondWithResult(_0x52ffc7,null))[_0xa94c('0x24')](handleError(_0x52ffc7,null));};exports[_0xa94c('0x60')]=function(_0x358ba9,_0x448be3,_0x19c645){var _0xf21883;var _0x4586b4='';var _0x3e4291=_0xa94c('0x61');return db[_0xa94c('0x37')]['findOne']({'where':{'id':_0x358ba9[_0xa94c('0x4e')]['id']},'attributes':['id','remoteUri','clientId',_0xa94c('0x62'),'username',_0xa94c('0x63'),_0xa94c('0x64')]})['then'](handleEntityNotFound(_0x448be3,null))[_0xa94c('0x1a')](function(_0x28d611){if(_0x28d611){_0x4586b4=_0x28d611[_0xa94c('0x65')];var _0x209158=_0x4586b4[_0xa94c('0x66')](-0x1);if(_0x209158==='/'){_0x4586b4=_0x4586b4[_0xa94c('0x67')](0x0,_0x4586b4[_0xa94c('0x68')](_0x209158));}_0xf21883=new jsforce[(_0xa94c('0x69'))]({'oauth2':{'loginUrl':_0x4586b4,'clientId':_0x28d611['clientId'],'clientSecret':_0x28d611[_0xa94c('0x62')]}});return _0xf21883[_0xa94c('0x6a')](_0x28d611[_0xa94c('0x6b')],_0x28d611[_0xa94c('0x63')][_0xa94c('0x6c')](_0x28d611[_0xa94c('0x64')]));}})[_0xa94c('0x1a')](function(_0xd64c5e){if(_0xd64c5e){if(!_[_0xa94c('0x6d')](_0x358ba9[_0xa94c('0x3b')][_0xa94c('0x6e')])){_0x3e4291=_0x358ba9[_0xa94c('0x3b')][_0xa94c('0x6e')];}return _0xf21883[_0xa94c('0x6f')](_0x3e4291)[_0xa94c('0x70')]();}})[_0xa94c('0x1a')](function(_0x121e65){var _0x49b239=[_0xa94c('0x71'),'ActivityDate','IsReminderSet',_0xa94c('0x72'),_0xa94c('0x73'),'Description'];var _0x105c16=[_0xa94c('0x74'),_0xa94c('0x75'),_0xa94c('0x76'),_0xa94c('0x77'),_0xa94c('0x78'),_0xa94c('0x79'),'phone'];if(_0x121e65){_[_0xa94c('0x7a')](_0x121e65[_0xa94c('0x3f')],function(_0x5008eb){return _0x49b239[_0xa94c('0x7b')](_0x5008eb[_0xa94c('0x33')])||!_0x105c16[_0xa94c('0x7b')](_0x5008eb[_0xa94c('0x5c')]);});return{'count':_0x121e65[_0xa94c('0x3f')][_0xa94c('0x40')],'rows':_['map'](_0x121e65['fields'],function(_0x3140ed){return{'id':_0x3140ed[_0xa94c('0x33')],'name':_0x3140ed[_0xa94c('0x7c')],'custom':_0x3140ed['custom'],'options':_0x3140ed[_0xa94c('0x7d')][_0xa94c('0x40')]>0x0?_[_0xa94c('0x36')](_0x3140ed[_0xa94c('0x7d')],function(_0x1fe4be){return{'name':_0x1fe4be[_0xa94c('0x7c')],'value':_0x1fe4be['value']};}):_0x3140ed[_0xa94c('0x5c')]==_0xa94c('0x77')?[{'name':'True','value':_0xa94c('0x7e')},{'name':_0xa94c('0x7f'),'value':_0xa94c('0x80')}]:[]};})};}})[_0xa94c('0x1a')](respondWithResult(_0x448be3,null))[_0xa94c('0x24')](function(_0x1dbe1f){var _0x350e7b=_0x358ba9['query'][_0xa94c('0x81')]?0x1f4:_0x1dbe1f[_0xa94c('0x82')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa94c('0x60'),_0x350e7b,JSON[_0xa94c('0x20')](_0x1dbe1f));delete _0x1dbe1f[_0xa94c('0x33')];if(_0x350e7b===0x191){_0x350e7b=0x190;}_0x448be3[_0xa94c('0x27')](_0x350e7b)['send'](_0x358ba9[_0xa94c('0x3b')][_0xa94c('0x81')]?{'message':_0xa94c('0x83'),'statusCode':_0x1dbe1f['statusCode']}:_0x1dbe1f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 6682947..237d49e 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 _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 +var _0xe209=['int_salesforce_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount'];(function(_0x4950ca,_0x467cee){var _0x38b58c=function(_0x20844d){while(--_0x20844d){_0x4950ca['push'](_0x4950ca['shift']());}};_0x38b58c(++_0x467cee);}(_0xe209,0x135));var _0x9e20=function(_0x4d8138,_0xb2f67){_0x4d8138=_0x4d8138-0x0;var _0x25f33c=_0xe209[_0x4d8138];return _0x25f33c;};'use strict';var _=require(_0x9e20('0x0'));var util=require('util');var logger=require(_0x9e20('0x1'))(_0x9e20('0x2'));var moment=require(_0x9e20('0x3'));var BPromise=require(_0x9e20('0x4'));var rp=require(_0x9e20('0x5'));var fs=require('fs');var path=require(_0x9e20('0x6'));var rimraf=require(_0x9e20('0x7'));var config=require(_0x9e20('0x8'));var attributes=require(_0x9e20('0x9'));var integrations=require(_0x9e20('0xa'));module[_0x9e20('0xb')]=function(_0x253a7c,_0x81e879){return _0x253a7c['define'](_0x9e20('0xc'),attributes,{'tableName':_0x9e20('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 039cee9..5380f0a 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 _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 +var _0xd2ea=['attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where'];(function(_0x4417aa,_0x35aa12){var _0x38220f=function(_0x2570a4){while(--_0x2570a4){_0x4417aa['push'](_0x4417aa['shift']());}};_0x38220f(++_0x35aa12);}(_0xd2ea,0x15f));var _0xad2e=function(_0x28fbe1,_0x17a33f){_0x28fbe1=_0x28fbe1-0x0;var _0x1a6171=_0xd2ea[_0x28fbe1];return _0x1a6171;};'use strict';var _=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var BPromise=require(_0xad2e('0x3'));var rs=require(_0xad2e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xad2e('0x5'))['db'];var utils=require(_0xad2e('0x6'));var logger=require(_0xad2e('0x7'))(_0xad2e('0x8'));var config=require(_0xad2e('0x9'));var jayson=require(_0xad2e('0xa'));var client=jayson[_0xad2e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5170,_0x3e3d1f,_0x2ff7b2){return new BPromise(function(_0x5710ac,_0x1e0e9e){return client[_0xad2e('0xc')](_0x3b5170,_0x2ff7b2)['then'](function(_0x1eed2f){logger['info'](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));logger[_0xad2e('0xf')](_0xad2e('0x10'),_0x3e3d1f,'request\x20sent',JSON[_0xad2e('0x11')](_0x1eed2f));if(_0x1eed2f['error']){if(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x13')]===0x1f4){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0x1eed2f['error'][_0xad2e('0x14')]);return _0x1e0e9e(_0x1eed2f['error'][_0xad2e('0x14')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x3e3d1f,_0x1eed2f['error']['message']);return _0x5710ac(_0x1eed2f[_0xad2e('0x12')][_0xad2e('0x14')]);}else{logger[_0xad2e('0x15')](_0xad2e('0xd'),_0x3e3d1f,_0xad2e('0xe'));_0x5710ac(_0x1eed2f[_0xad2e('0x16')][_0xad2e('0x14')]);}})[_0xad2e('0x17')](function(_0xd40b31){logger[_0xad2e('0x12')](_0xad2e('0xd'),_0x3e3d1f,_0xd40b31);_0x1e0e9e(_0xd40b31);});});}exports[_0xad2e('0x18')]=function(_0x34f946){var _0x1b4889=this;return new Promise(function(_0x163e83,_0x4ef16f){return db[_0xad2e('0x19')][_0xad2e('0x1a')]({'raw':_0x34f946['options']?_0x34f946['options']['raw']===undefined?!![]:![]:!![],'where':_0x34f946['options']?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1c')]||null:null,'attributes':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1d')]||null:null,'limit':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1e')]||null:null,'include':_0x34f946[_0xad2e('0x1b')]?_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x34f946[_0xad2e('0x1b')][_0xad2e('0x1f')],function(_0x207517){return{'model':db[_0x207517[_0xad2e('0x21')]],'as':_0x207517['as'],'attributes':_0x207517['attributes'],'include':_0x207517[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x207517[_0xad2e('0x1f')],function(_0x350c66){return{'model':db[_0x350c66[_0xad2e('0x21')]],'as':_0x350c66['as'],'attributes':_0x350c66[_0xad2e('0x1d')],'include':_0x350c66[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x350c66[_0xad2e('0x1f')],function(_0x50d446){return{'model':db[_0x50d446[_0xad2e('0x21')]],'as':_0x50d446['as'],'attributes':_0x50d446['attributes']};}):[]};}):[]};}):[]:[]})[_0xad2e('0x22')](function(_0x28ef72){logger[_0xad2e('0x15')](_0xad2e('0x18'),_0x34f946);logger[_0xad2e('0xf')](_0xad2e('0x18'),_0x34f946,JSON[_0xad2e('0x11')](_0x28ef72));_0x163e83(_0x28ef72);})[_0xad2e('0x17')](function(_0x52fdda){logger[_0xad2e('0x12')]('GetSalesforceAccount',_0x52fdda[_0xad2e('0x14')],_0x34f946);_0x4ef16f(_0x1b4889[_0xad2e('0x12')](0x1f4,_0x52fdda[_0xad2e('0x14')]));});});};exports[_0xad2e('0x23')]=function(_0x42fe6c){var _0x9b4a23=this;return new Promise(function(_0x409f58,_0x3e3d86){return db[_0xad2e('0x19')][_0xad2e('0x24')]({'raw':_0x42fe6c[_0xad2e('0x1b')]?_0x42fe6c['options'][_0xad2e('0x25')]===undefined?!![]:![]:!![],'where':_0x42fe6c['options']?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1c')]||null:null,'attributes':_0x42fe6c[_0xad2e('0x1b')]?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1d')]||null:null,'include':_0x42fe6c['options']?_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1f')]?_['map'](_0x42fe6c[_0xad2e('0x1b')][_0xad2e('0x1f')],function(_0x569b9c){return{'model':db[_0x569b9c[_0xad2e('0x21')]],'as':_0x569b9c['as'],'attributes':_0x569b9c[_0xad2e('0x1d')],'include':_0x569b9c[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x569b9c[_0xad2e('0x1f')],function(_0x2fa320){return{'model':db[_0x2fa320[_0xad2e('0x21')]],'as':_0x2fa320['as'],'attributes':_0x2fa320['attributes'],'include':_0x2fa320[_0xad2e('0x1f')]?_[_0xad2e('0x20')](_0x2fa320['include'],function(_0x161402){return{'model':db[_0x161402[_0xad2e('0x21')]],'as':_0x161402['as'],'attributes':_0x161402[_0xad2e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xad2e('0x22')](function(_0x48c77b){logger[_0xad2e('0x15')]('ShowSalesforceAccount',_0x42fe6c);logger['debug'](_0xad2e('0x23'),_0x42fe6c,JSON['stringify'](_0x48c77b));_0x409f58(_0x48c77b);})[_0xad2e('0x17')](function(_0x33c2a8){logger[_0xad2e('0x12')](_0xad2e('0x23'),_0x33c2a8[_0xad2e('0x14')],_0x42fe6c);_0x3e3d86(_0x9b4a23['error'](0x1f4,_0x33c2a8[_0xad2e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index e0b399e..a69fc3c 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 _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 +var _0xfbbc=['../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','path','express','Router','../../components/auth/service'];(function(_0x52a40a,_0x37b4b1){var _0x183fec=function(_0x2eca82){while(--_0x2eca82){_0x52a40a['push'](_0x52a40a['shift']());}};_0x183fec(++_0x37b4b1);}(_0xfbbc,0x176));var _0xcfbb=function(_0xee2bbf,_0x3f5b8a){_0xee2bbf=_0xee2bbf-0x0;var _0x5a7077=_0xfbbc[_0xee2bbf];return _0x5a7077;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcfbb('0x0'));var timeout=require('connect-timeout');var express=require(_0xcfbb('0x1'));var router=express[_0xcfbb('0x2')]();var auth=require(_0xcfbb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcfbb('0x4'));var controller=require(_0xcfbb('0x5'));router[_0xcfbb('0x6')]('/',auth[_0xcfbb('0x7')](),controller[_0xcfbb('0x8')]);router[_0xcfbb('0x6')](_0xcfbb('0x9'),auth['isAuthenticated'](),controller[_0xcfbb('0xa')]);router[_0xcfbb('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcfbb('0xb')]);router[_0xcfbb('0x6')](_0xcfbb('0xc'),auth[_0xcfbb('0x7')](),controller[_0xcfbb('0xd')]);router[_0xcfbb('0x6')]('/:id/descriptions',auth[_0xcfbb('0x7')](),controller[_0xcfbb('0xe')]);router[_0xcfbb('0xf')]('/',auth[_0xcfbb('0x7')](),controller['create']);router[_0xcfbb('0x10')](_0xcfbb('0x9'),auth[_0xcfbb('0x7')](),controller[_0xcfbb('0x11')]);router[_0xcfbb('0x12')](_0xcfbb('0x9'),auth['isAuthenticated'](),controller[_0xcfbb('0x13')]);module[_0xcfbb('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 898db19..ab81f2e 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 _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 +var _0x6492=['exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','nothing','sequelize'];(function(_0x3e70ee,_0x57d9ae){var _0x445993=function(_0x2a2e73){while(--_0x2a2e73){_0x3e70ee['push'](_0x3e70ee['shift']());}};_0x445993(++_0x57d9ae);}(_0x6492,0x1b7));var _0x2649=function(_0x3e1cc0,_0x224a16){_0x3e1cc0=_0x3e1cc0-0x0;var _0x425f0a=_0x6492[_0x3e1cc0];return _0x425f0a;};'use strict';var Sequelize=require(_0x2649('0x0'));module[_0x2649('0x1')]={'name':{'type':Sequelize[_0x2649('0x2')]},'description':{'type':Sequelize[_0x2649('0x2')]},'ticketType':{'type':Sequelize[_0x2649('0x3')](_0x2649('0x4'),_0x2649('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x2649('0x6'),_0x2649('0x7'),_0x2649('0x8')),'defaultValue':_0x2649('0x6')},'moduleCreate':{'type':Sequelize[_0x2649('0x3')](_0x2649('0x9'),_0x2649('0x7'),'lead'),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f71291b..26de117 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 _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 +var _0x5189=['options','count','include','findAll','show','includeAll','find','create','body','params','getFields','findOne','order','getSubjects','SalesforceField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5189,0xc6));var _0x9518=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x5189[_0x308213];return _0x2e1619;};'use strict';var pdf=require(_0x9518('0x0'));var emlformat=require(_0x9518('0x1'));var rimraf=require(_0x9518('0x2'));var zipdir=require(_0x9518('0x3'));var jsonpatch=require(_0x9518('0x4'));var rp=require(_0x9518('0x5'));var moment=require(_0x9518('0x6'));var BPromise=require(_0x9518('0x7'));var Mustache=require('mustache');var util=require(_0x9518('0x8'));var path=require(_0x9518('0x9'));var sox=require(_0x9518('0xa'));var csv=require(_0x9518('0xb'));var ejs=require(_0x9518('0xc'));var fs=require('fs');var _=require(_0x9518('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9518('0xe'));var toCsv=require(_0x9518('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9518('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9518('0x10'));var as=require(_0x9518('0x11'));var hardwareService=require(_0x9518('0x12'));var logger=require(_0x9518('0x13'))('api');var utils=require(_0x9518('0x14'));var config=require(_0x9518('0x15'));var licenseUtil=require(_0x9518('0x16'));var db=require(_0x9518('0x17'))['db'];var jayson=require(_0x9518('0x18'));var client=jayson['client'][_0x9518('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1168cf,_0x203bec,_0x4d52ee,_0x46dbae){return new BPromise(function(_0x2c20d1,_0x41c954){var _0x94ef86=_0x46dbae||client;return _0x94ef86[_0x9518('0x1a')](_0x1168cf,_0x4d52ee)[_0x9518('0x1b')](function(_0x4e5c05){logger[_0x9518('0x1c')](_0x9518('0x1d'),_0x203bec,'request\x20sent');logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x203bec,'request\x20sent',JSON[_0x9518('0x1e')](_0x4e5c05));if(_0x4e5c05[_0x9518('0x1f')]){if(_0x4e5c05[_0x9518('0x1f')][_0x9518('0x20')]===0x1f4){logger['error'](_0x9518('0x1d'),_0x203bec,_0x4e5c05['error']['message']);return _0x41c954(_0x4e5c05['error'][_0x9518('0x21')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x203bec,_0x4e5c05[_0x9518('0x1f')][_0x9518('0x21')]);return _0x2c20d1(_0x4e5c05[_0x9518('0x1f')][_0x9518('0x21')]);}else{logger[_0x9518('0x1c')]('SalesforceConfiguration,\x20%s,\x20%s',_0x203bec,_0x9518('0x22'));_0x2c20d1(_0x4e5c05[_0x9518('0x23')][_0x9518('0x21')]);}})[_0x9518('0x24')](function(_0x2ad433){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x203bec,_0x2ad433);_0x41c954(_0x2ad433);});});}function respondWithStatusCode(_0x43a59b,_0x4d4108){_0x4d4108=_0x4d4108||0xcc;return function(_0x514458){if(_0x514458){return _0x43a59b[_0x9518('0x25')](_0x4d4108);}return _0x43a59b['status'](_0x4d4108)[_0x9518('0x26')]();};}function respondWithResult(_0x413713,_0x23ef56){_0x23ef56=_0x23ef56||0xc8;return function(_0x327c4b){if(_0x327c4b){return _0x413713['status'](_0x23ef56)[_0x9518('0x27')](_0x327c4b);}};}function respondWithFilteredResult(_0x5ef504,_0x107da7){return function(_0x1789c1){if(_0x1789c1){var _0x2df9df=_0x1789c1['count'],_0x2a7d1b=_0x107da7[_0x9518('0x28')],_0x5852b2=_0x107da7['offset']+_0x107da7[_0x9518('0x29')],_0x12af24;if(_0x5852b2>=_0x2df9df){_0x5852b2=_0x2df9df;_0x12af24=0xc8;}else{_0x12af24=0xce;}_0x5ef504[_0x9518('0x2a')](_0x12af24);return _0x5ef504[_0x9518('0x2b')](_0x9518('0x2c'),_0x2a7d1b+'-'+_0x5852b2+'/'+_0x2df9df)['json'](_0x1789c1);}return null;};}function patchUpdates(_0x1e26f3){return function(_0x3b9b97){try{jsonpatch[_0x9518('0x2d')](_0x3b9b97,_0x1e26f3,!![]);}catch(_0x37b26f){return BPromise[_0x9518('0x2e')](_0x37b26f);}return _0x3b9b97['save']();};}function saveUpdates(_0x2e503b,_0x5275eb){return function(_0x21322d){if(_0x21322d){return _0x21322d[_0x9518('0x2f')](_0x2e503b)[_0x9518('0x1b')](function(_0x33b79b){return _0x33b79b;});}return null;};}function removeEntity(_0x395e1d,_0x5c736d){return function(_0x48a5b1){if(_0x48a5b1){return _0x48a5b1[_0x9518('0x30')]()['then'](function(){_0x395e1d[_0x9518('0x2a')](0xcc)[_0x9518('0x26')]();});}};}function handleEntityNotFound(_0x32ead0,_0x264d20){return function(_0xf5acf2){if(!_0xf5acf2){_0x32ead0['sendStatus'](0x194);}return _0xf5acf2;};}function handleError(_0xd66dcc,_0x3ffe8f){_0x3ffe8f=_0x3ffe8f||0x1f4;return function(_0x1fec4){logger[_0x9518('0x1f')](_0x1fec4[_0x9518('0x31')]);if(_0x1fec4[_0x9518('0x32')]){delete _0x1fec4[_0x9518('0x32')];}_0xd66dcc[_0x9518('0x2a')](_0x3ffe8f)[_0x9518('0x33')](_0x1fec4);};}exports[_0x9518('0x34')]=function(_0x642b9,_0x2b0bbc){var _0x3f1d9d={},_0x585274={},_0x2293e5={'count':0x0,'rows':[]};var _0x2cc16d=_[_0x9518('0x35')](db[_0x9518('0x36')][_0x9518('0x37')],function(_0x31e382){return{'name':_0x31e382[_0x9518('0x38')],'type':_0x31e382['type'][_0x9518('0x39')]};});_0x585274[_0x9518('0x3a')]=_[_0x9518('0x35')](_0x2cc16d,_0x9518('0x32'));_0x585274[_0x9518('0x3b')]=_[_0x9518('0x3c')](_0x642b9['query']);_0x585274[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x585274[_0x9518('0x3a')],_0x585274[_0x9518('0x3b')]);_0x3f1d9d[_0x9518('0x3f')]=_[_0x9518('0x3e')](_0x585274[_0x9518('0x3a')],qs[_0x9518('0x40')](_0x642b9[_0x9518('0x3b')][_0x9518('0x40')]));_0x3f1d9d[_0x9518('0x3f')]=_0x3f1d9d[_0x9518('0x3f')][_0x9518('0x41')]?_0x3f1d9d[_0x9518('0x3f')]:_0x585274[_0x9518('0x3a')];if(!_0x642b9[_0x9518('0x3b')][_0x9518('0x42')](_0x9518('0x43'))){_0x3f1d9d[_0x9518('0x29')]=qs[_0x9518('0x29')](_0x642b9[_0x9518('0x3b')][_0x9518('0x29')]);_0x3f1d9d['offset']=qs[_0x9518('0x28')](_0x642b9['query']['offset']);}_0x3f1d9d['order']=qs[_0x9518('0x44')](_0x642b9[_0x9518('0x3b')]['sort']);_0x3f1d9d[_0x9518('0x45')]=qs[_0x9518('0x3d')](_[_0x9518('0x46')](_0x642b9['query'],_0x585274[_0x9518('0x3d')]),_0x2cc16d);if(_0x642b9['query'][_0x9518('0x47')]){_0x3f1d9d[_0x9518('0x45')]=_[_0x9518('0x48')](_0x3f1d9d[_0x9518('0x45')],{'$or':_[_0x9518('0x35')](_0x2cc16d,function(_0x5371f9){if(_0x5371f9[_0x9518('0x49')]!==_0x9518('0x4a')){var _0x2060b8={};_0x2060b8[_0x5371f9[_0x9518('0x32')]]={'$like':'%'+_0x642b9['query'][_0x9518('0x47')]+'%'};return _0x2060b8;}})});}_0x3f1d9d=_[_0x9518('0x48')]({},_0x3f1d9d,_0x642b9[_0x9518('0x4b')]);var _0x42faec={'where':_0x3f1d9d[_0x9518('0x45')]};return db[_0x9518('0x36')][_0x9518('0x4c')](_0x42faec)[_0x9518('0x1b')](function(_0x422b6d){_0x2293e5[_0x9518('0x4c')]=_0x422b6d;if(_0x642b9[_0x9518('0x3b')]['includeAll']){_0x3f1d9d[_0x9518('0x4d')]=[{'all':!![]}];}return db[_0x9518('0x36')][_0x9518('0x4e')](_0x3f1d9d);})[_0x9518('0x1b')](function(_0x127724){_0x2293e5['rows']=_0x127724;return _0x2293e5;})[_0x9518('0x1b')](respondWithFilteredResult(_0x2b0bbc,_0x3f1d9d))[_0x9518('0x24')](handleError(_0x2b0bbc,null));};exports[_0x9518('0x4f')]=function(_0x235fbc,_0x2cbb28){var _0x18a4fb={'raw':![],'where':{'id':_0x235fbc['params']['id']}},_0x18be5c={};_0x18be5c['model']=_['keys'](db[_0x9518('0x36')][_0x9518('0x37')]);_0x18be5c['query']=_[_0x9518('0x3c')](_0x235fbc[_0x9518('0x3b')]);_0x18be5c[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x18be5c['model'],_0x18be5c['query']);_0x18a4fb['attributes']=_[_0x9518('0x3e')](_0x18be5c[_0x9518('0x3a')],qs[_0x9518('0x40')](_0x235fbc[_0x9518('0x3b')]['fields']));_0x18a4fb[_0x9518('0x3f')]=_0x18a4fb[_0x9518('0x3f')][_0x9518('0x41')]?_0x18a4fb[_0x9518('0x3f')]:_0x18be5c[_0x9518('0x3a')];if(_0x235fbc[_0x9518('0x3b')][_0x9518('0x50')]){_0x18a4fb[_0x9518('0x4d')]=[{'all':!![]}];}_0x18a4fb=_[_0x9518('0x48')]({},_0x18a4fb,_0x235fbc['options']);return db[_0x9518('0x36')][_0x9518('0x51')](_0x18a4fb)[_0x9518('0x1b')](handleEntityNotFound(_0x2cbb28,null))[_0x9518('0x1b')](respondWithResult(_0x2cbb28,null))['catch'](handleError(_0x2cbb28,null));};exports[_0x9518('0x52')]=function(_0x19a043,_0x160571){return db[_0x9518('0x36')][_0x9518('0x52')](_0x19a043[_0x9518('0x53')],{})[_0x9518('0x1b')](respondWithResult(_0x160571,0xc9))[_0x9518('0x24')](handleError(_0x160571,null));};exports['update']=function(_0x58c908,_0x89537e){if(_0x58c908['body']['id']){delete _0x58c908[_0x9518('0x53')]['id'];}return db[_0x9518('0x36')][_0x9518('0x51')]({'where':{'id':_0x58c908['params']['id']}})[_0x9518('0x1b')](handleEntityNotFound(_0x89537e,null))[_0x9518('0x1b')](saveUpdates(_0x58c908[_0x9518('0x53')],null))['then'](respondWithResult(_0x89537e,null))['catch'](handleError(_0x89537e,null));};exports['destroy']=function(_0x7dc7d9,_0x20fc89){return db['SalesforceConfiguration'][_0x9518('0x51')]({'where':{'id':_0x7dc7d9[_0x9518('0x54')]['id']}})[_0x9518('0x1b')](handleEntityNotFound(_0x20fc89,null))[_0x9518('0x1b')](removeEntity(_0x20fc89,null))[_0x9518('0x24')](handleError(_0x20fc89,null));};exports[_0x9518('0x55')]=function(_0x5be524,_0x5c2337,_0x2e9437){var _0x478491={};var _0x2e14fe={};var _0x9ff3fd;var _0x17c2d4;return db[_0x9518('0x36')][_0x9518('0x56')]({'where':{'id':_0x5be524[_0x9518('0x54')]['id']}})[_0x9518('0x1b')](handleEntityNotFound(_0x5c2337,null))['then'](function(_0x502496){if(_0x502496){_0x9ff3fd=_0x502496;_0x2e14fe[_0x9518('0x3a')]=_[_0x9518('0x3c')](db['SalesforceField']['rawAttributes']);_0x2e14fe[_0x9518('0x3b')]=_[_0x9518('0x3c')](_0x5be524[_0x9518('0x3b')]);_0x2e14fe[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x2e14fe[_0x9518('0x3a')],_0x2e14fe[_0x9518('0x3b')]);_0x478491['attributes']=_[_0x9518('0x3e')](_0x2e14fe[_0x9518('0x3a')],qs['fields'](_0x5be524[_0x9518('0x3b')]['fields']));_0x478491[_0x9518('0x3f')]=_0x478491[_0x9518('0x3f')][_0x9518('0x41')]?_0x478491[_0x9518('0x3f')]:_0x2e14fe['model'];_0x478491[_0x9518('0x57')]=qs[_0x9518('0x44')](_0x5be524[_0x9518('0x3b')][_0x9518('0x44')]);_0x478491[_0x9518('0x45')]=qs[_0x9518('0x3d')](_['pick'](_0x5be524['query'],_0x2e14fe[_0x9518('0x3d')]));if(_0x5be524[_0x9518('0x3b')][_0x9518('0x47')]){_0x478491[_0x9518('0x45')]=_[_0x9518('0x48')](_0x478491[_0x9518('0x45')],{'$or':_[_0x9518('0x35')](_0x478491[_0x9518('0x3f')],function(_0x1d7b2f){var _0x3ec8c8={};_0x3ec8c8[_0x1d7b2f]={'$like':'%'+_0x5be524[_0x9518('0x3b')][_0x9518('0x47')]+'%'};return _0x3ec8c8;})});}_0x478491=_[_0x9518('0x48')]({},_0x478491,_0x5be524['options']);return _0x9ff3fd[_0x9518('0x55')](_0x478491);}})[_0x9518('0x1b')](function(_0x2be3a8){if(_0x2be3a8){_0x17c2d4=_0x2be3a8[_0x9518('0x41')];if(!_0x5be524[_0x9518('0x3b')][_0x9518('0x42')](_0x9518('0x43'))){_0x478491[_0x9518('0x29')]=qs[_0x9518('0x29')](_0x5be524['query'][_0x9518('0x29')]);_0x478491['offset']=qs[_0x9518('0x28')](_0x5be524[_0x9518('0x3b')][_0x9518('0x28')]);}return _0x9ff3fd[_0x9518('0x55')](_0x478491);}})['then'](function(_0xf0336b){if(_0xf0336b){return _0xf0336b?{'count':_0x17c2d4,'rows':_0xf0336b}:null;}})[_0x9518('0x1b')](respondWithResult(_0x5c2337,null))[_0x9518('0x24')](handleError(_0x5c2337,null));};exports[_0x9518('0x58')]=function(_0x175318,_0x30d52c,_0x32bee8){var _0x2ee64b={};var _0x3935f4={};var _0xb46624;var _0x3bead3;return db['SalesforceConfiguration'][_0x9518('0x56')]({'where':{'id':_0x175318['params']['id']}})[_0x9518('0x1b')](handleEntityNotFound(_0x30d52c,null))[_0x9518('0x1b')](function(_0x425df3){if(_0x425df3){_0xb46624=_0x425df3;_0x3935f4[_0x9518('0x3a')]=_[_0x9518('0x3c')](db[_0x9518('0x59')][_0x9518('0x37')]);_0x3935f4[_0x9518('0x3b')]=_[_0x9518('0x3c')](_0x175318['query']);_0x3935f4[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x3935f4['model'],_0x3935f4[_0x9518('0x3b')]);_0x2ee64b[_0x9518('0x3f')]=_['intersection'](_0x3935f4[_0x9518('0x3a')],qs[_0x9518('0x40')](_0x175318[_0x9518('0x3b')][_0x9518('0x40')]));_0x2ee64b[_0x9518('0x3f')]=_0x2ee64b[_0x9518('0x3f')]['length']?_0x2ee64b['attributes']:_0x3935f4['model'];_0x2ee64b['order']=qs[_0x9518('0x44')](_0x175318[_0x9518('0x3b')][_0x9518('0x44')]);_0x2ee64b[_0x9518('0x45')]=qs[_0x9518('0x3d')](_[_0x9518('0x46')](_0x175318['query'],_0x3935f4['filters']));if(_0x175318[_0x9518('0x3b')]['filter']){_0x2ee64b[_0x9518('0x45')]=_[_0x9518('0x48')](_0x2ee64b[_0x9518('0x45')],{'$or':_[_0x9518('0x35')](_0x2ee64b[_0x9518('0x3f')],function(_0x13d7cd){var _0x125411={};_0x125411[_0x13d7cd]={'$like':'%'+_0x175318[_0x9518('0x3b')][_0x9518('0x47')]+'%'};return _0x125411;})});}_0x2ee64b=_['merge']({},_0x2ee64b,_0x175318[_0x9518('0x4b')]);return _0xb46624[_0x9518('0x58')](_0x2ee64b);}})[_0x9518('0x1b')](function(_0x47521a){if(_0x47521a){_0x3bead3=_0x47521a['length'];if(!_0x175318[_0x9518('0x3b')][_0x9518('0x42')](_0x9518('0x43'))){_0x2ee64b[_0x9518('0x29')]=qs['limit'](_0x175318[_0x9518('0x3b')][_0x9518('0x29')]);_0x2ee64b[_0x9518('0x28')]=qs['offset'](_0x175318['query'][_0x9518('0x28')]);}return _0xb46624['getSubjects'](_0x2ee64b);}})[_0x9518('0x1b')](function(_0x5b6052){if(_0x5b6052){return _0x5b6052?{'count':_0x3bead3,'rows':_0x5b6052}:null;}})[_0x9518('0x1b')](respondWithResult(_0x30d52c,null))['catch'](handleError(_0x30d52c,null));};exports['getDescriptions']=function(_0x4e1f62,_0x41d078,_0x43d62b){var _0x2bc67d={};var _0x3cf674={};var _0x2357e0;var _0x5d2fb2;return db[_0x9518('0x36')][_0x9518('0x56')]({'where':{'id':_0x4e1f62[_0x9518('0x54')]['id']}})[_0x9518('0x1b')](handleEntityNotFound(_0x41d078,null))[_0x9518('0x1b')](function(_0x38b2ba){if(_0x38b2ba){_0x2357e0=_0x38b2ba;_0x3cf674[_0x9518('0x3a')]=_[_0x9518('0x3c')](db[_0x9518('0x59')][_0x9518('0x37')]);_0x3cf674[_0x9518('0x3b')]=_['keys'](_0x4e1f62['query']);_0x3cf674[_0x9518('0x3d')]=_[_0x9518('0x3e')](_0x3cf674[_0x9518('0x3a')],_0x3cf674[_0x9518('0x3b')]);_0x2bc67d['attributes']=_[_0x9518('0x3e')](_0x3cf674[_0x9518('0x3a')],qs[_0x9518('0x40')](_0x4e1f62[_0x9518('0x3b')][_0x9518('0x40')]));_0x2bc67d[_0x9518('0x3f')]=_0x2bc67d[_0x9518('0x3f')]['length']?_0x2bc67d[_0x9518('0x3f')]:_0x3cf674[_0x9518('0x3a')];_0x2bc67d[_0x9518('0x57')]=qs[_0x9518('0x44')](_0x4e1f62[_0x9518('0x3b')][_0x9518('0x44')]);_0x2bc67d['where']=qs[_0x9518('0x3d')](_[_0x9518('0x46')](_0x4e1f62[_0x9518('0x3b')],_0x3cf674[_0x9518('0x3d')]));if(_0x4e1f62[_0x9518('0x3b')]['filter']){_0x2bc67d[_0x9518('0x45')]=_[_0x9518('0x48')](_0x2bc67d[_0x9518('0x45')],{'$or':_[_0x9518('0x35')](_0x2bc67d[_0x9518('0x3f')],function(_0x5c2c96){var _0x236599={};_0x236599[_0x5c2c96]={'$like':'%'+_0x4e1f62[_0x9518('0x3b')][_0x9518('0x47')]+'%'};return _0x236599;})});}_0x2bc67d=_[_0x9518('0x48')]({},_0x2bc67d,_0x4e1f62['options']);return _0x2357e0[_0x9518('0x5a')](_0x2bc67d);}})[_0x9518('0x1b')](function(_0x2491d2){if(_0x2491d2){_0x5d2fb2=_0x2491d2[_0x9518('0x41')];if(!_0x4e1f62[_0x9518('0x3b')][_0x9518('0x42')](_0x9518('0x43'))){_0x2bc67d[_0x9518('0x29')]=qs[_0x9518('0x29')](_0x4e1f62['query'][_0x9518('0x29')]);_0x2bc67d[_0x9518('0x28')]=qs[_0x9518('0x28')](_0x4e1f62['query'][_0x9518('0x28')]);}return _0x2357e0['getDescriptions'](_0x2bc67d);}})[_0x9518('0x1b')](function(_0x2b0385){if(_0x2b0385){return _0x2b0385?{'count':_0x5d2fb2,'rows':_0x2b0385}:null;}})[_0x9518('0x1b')](respondWithResult(_0x41d078,null))[_0x9518('0x24')](handleError(_0x41d078,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 9359127..2b2dfec 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 _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 +var _0x27fb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','int_salesforce_configurations','util'];(function(_0x2185cd,_0x72c9ce){var _0x4a33d6=function(_0x339587){while(--_0x339587){_0x2185cd['push'](_0x2185cd['shift']());}};_0x4a33d6(++_0x72c9ce);}(_0x27fb,0x13e));var _0xb27f=function(_0x2626ab,_0x493048){_0x2626ab=_0x2626ab-0x0;var _0x2b5c3d=_0x27fb[_0x2626ab];return _0x2b5c3d;};'use strict';var _=require('lodash');var util=require(_0xb27f('0x0'));var logger=require(_0xb27f('0x1'))(_0xb27f('0x2'));var moment=require(_0xb27f('0x3'));var BPromise=require(_0xb27f('0x4'));var rp=require(_0xb27f('0x5'));var fs=require('fs');var path=require(_0xb27f('0x6'));var rimraf=require(_0xb27f('0x7'));var config=require(_0xb27f('0x8'));var attributes=require(_0xb27f('0x9'));module['exports']=function(_0x705c37,_0x257c58){return _0x705c37['define']('SalesforceConfiguration',attributes,{'tableName':_0xb27f('0xa'),'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 a2cc7e7..5841525 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 _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 +var _0x83a9=['jayson/promise','request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment'];(function(_0x829616,_0x5d9318){var _0x35857a=function(_0x502cb9){while(--_0x502cb9){_0x829616['push'](_0x829616['shift']());}};_0x35857a(++_0x5d9318);}(_0x83a9,0x158));var _0x983a=function(_0x1c5ad6,_0x47b206){_0x1c5ad6=_0x1c5ad6-0x0;var _0x1d5829=_0x83a9[_0x1c5ad6];return _0x1d5829;};'use strict';var _=require(_0x983a('0x0'));var util=require(_0x983a('0x1'));var moment=require(_0x983a('0x2'));var BPromise=require(_0x983a('0x3'));var rs=require(_0x983a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x983a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x983a('0x6'));var config=require(_0x983a('0x7'));var jayson=require(_0x983a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e5731,_0x2d2d0d,_0x5d19c3){return new BPromise(function(_0x8f2140,_0x239a25){return client[_0x983a('0x9')](_0x5e5731,_0x5d19c3)[_0x983a('0xa')](function(_0x4b99a4){logger['info'](_0x983a('0xb'),_0x2d2d0d,'request\x20sent');logger[_0x983a('0xc')](_0x983a('0xd'),_0x2d2d0d,_0x983a('0xe'),JSON[_0x983a('0xf')](_0x4b99a4));if(_0x4b99a4['error']){if(_0x4b99a4[_0x983a('0x10')][_0x983a('0x11')]===0x1f4){logger[_0x983a('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d2d0d,_0x4b99a4['error']['message']);return _0x239a25(_0x4b99a4[_0x983a('0x10')][_0x983a('0x12')]);}logger[_0x983a('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2d2d0d,_0x4b99a4[_0x983a('0x10')][_0x983a('0x12')]);return _0x8f2140(_0x4b99a4[_0x983a('0x10')][_0x983a('0x12')]);}else{logger[_0x983a('0x13')](_0x983a('0xb'),_0x2d2d0d,_0x983a('0xe'));_0x8f2140(_0x4b99a4[_0x983a('0x14')]['message']);}})[_0x983a('0x15')](function(_0x4bf8b9){logger[_0x983a('0x10')](_0x983a('0xb'),_0x2d2d0d,_0x4bf8b9);_0x239a25(_0x4bf8b9);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index f8b8cb4..5d39881 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 _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 +var _0xd8fb=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','post','/:id','update','multer'];(function(_0x18ec1b,_0x4e15db){var _0x3e03d6=function(_0x568dc1){while(--_0x568dc1){_0x18ec1b['push'](_0x18ec1b['shift']());}};_0x3e03d6(++_0x4e15db);}(_0xd8fb,0x99));var _0xbd8f=function(_0x2b5ee8,_0x40093b){_0x2b5ee8=_0x2b5ee8-0x0;var _0x5cedec=_0xd8fb[_0x2b5ee8];return _0x5cedec;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xbd8f('0x4'));var config=require(_0xbd8f('0x5'));var controller=require('./intSalesforceField.controller');router[_0xbd8f('0x6')]('/',auth[_0xbd8f('0x7')](),controller['index']);router[_0xbd8f('0x6')]('/:id',auth[_0xbd8f('0x7')](),controller['show']);router[_0xbd8f('0x8')]('/',auth[_0xbd8f('0x7')](),controller['create']);router['put'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller[_0xbd8f('0xa')]);router['delete'](_0xbd8f('0x9'),auth[_0xbd8f('0x7')](),controller['destroy']);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 df54a06..fef9167 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 _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 +var _0x56d2=['exports','ENUM','variable','customVariable','keyValue','STRING','string','sequelize'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x56d2,0x1b7));var _0x256d=function(_0x2f8334,_0x39d5b9){_0x2f8334=_0x2f8334-0x0;var _0x39d92d=_0x56d2[_0x2f8334];return _0x39d92d;};'use strict';var Sequelize=require(_0x256d('0x0'));module[_0x256d('0x1')]={'type':{'type':Sequelize[_0x256d('0x2')]('string',_0x256d('0x3'),_0x256d('0x4'),_0x256d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x256d('0x6')]},'key':{'type':Sequelize[_0x256d('0x6')]},'keyType':{'type':Sequelize[_0x256d('0x2')](_0x256d('0x7'),_0x256d('0x3'),_0x256d('0x4'))},'keyContent':{'type':Sequelize[_0x256d('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x256d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index f934be4..770b223 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 _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 +var _0xcf8b=['order','sort','pick','filter','where','merge','count','includeAll','include','findAll','catch','show','params','options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','map','SalesforceField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x10bd33,_0x2b1b71){var _0x4cc179=function(_0x51394c){while(--_0x51394c){_0x10bd33['push'](_0x10bd33['shift']());}};_0x4cc179(++_0x2b1b71);}(_0xcf8b,0x99));var _0xbcf8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf8b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xbcf8('0x0'));var emlformat=require(_0xbcf8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xbcf8('0x2'));var jsonpatch=require(_0xbcf8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcf8('0x4'));var Mustache=require(_0xbcf8('0x5'));var util=require(_0xbcf8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbcf8('0x7'));var ejs=require(_0xbcf8('0x8'));var fs=require('fs');var _=require(_0xbcf8('0x9'));var squel=require(_0xbcf8('0xa'));var crypto=require('crypto');var jsforce=require(_0xbcf8('0xb'));var deskjs=require(_0xbcf8('0xc'));var toCsv=require(_0xbcf8('0x7'));var querystring=require(_0xbcf8('0xd'));var Papa=require('papaparse');var Redis=require(_0xbcf8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbcf8('0xf'));var as=require(_0xbcf8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcf8('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbcf8('0x12'));var db=require(_0xbcf8('0x13'))['db'];function respondWithStatusCode(_0x531cdf,_0x359e35){_0x359e35=_0x359e35||0xcc;return function(_0x335b71){if(_0x335b71){return _0x531cdf[_0xbcf8('0x14')](_0x359e35);}return _0x531cdf['status'](_0x359e35)[_0xbcf8('0x15')]();};}function respondWithResult(_0x2fc5ce,_0x513f07){_0x513f07=_0x513f07||0xc8;return function(_0x34913f){if(_0x34913f){return _0x2fc5ce[_0xbcf8('0x16')](_0x513f07)[_0xbcf8('0x17')](_0x34913f);}};}function respondWithFilteredResult(_0x4b94be,_0x2e0bae){return function(_0x3ec7ef){if(_0x3ec7ef){var _0x385545=_0x3ec7ef['count'],_0x5dc972=_0x2e0bae[_0xbcf8('0x18')],_0x21f65e=_0x2e0bae['offset']+_0x2e0bae[_0xbcf8('0x19')],_0x13268d;if(_0x21f65e>=_0x385545){_0x21f65e=_0x385545;_0x13268d=0xc8;}else{_0x13268d=0xce;}_0x4b94be[_0xbcf8('0x16')](_0x13268d);return _0x4b94be['set'](_0xbcf8('0x1a'),_0x5dc972+'-'+_0x21f65e+'/'+_0x385545)['json'](_0x3ec7ef);}return null;};}function patchUpdates(_0x37a070){return function(_0x36cbd3){try{jsonpatch[_0xbcf8('0x1b')](_0x36cbd3,_0x37a070,!![]);}catch(_0x53903e){return BPromise[_0xbcf8('0x1c')](_0x53903e);}return _0x36cbd3[_0xbcf8('0x1d')]();};}function saveUpdates(_0x5ec147,_0xaeda15){return function(_0x387319){if(_0x387319){return _0x387319[_0xbcf8('0x1e')](_0x5ec147)[_0xbcf8('0x1f')](function(_0x1860f2){return _0x1860f2;});}return null;};}function removeEntity(_0xb54543,_0x72ea22){return function(_0x20c154){if(_0x20c154){return _0x20c154[_0xbcf8('0x20')]()[_0xbcf8('0x1f')](function(){_0xb54543[_0xbcf8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8fb61b,_0x293b14){return function(_0x339b05){if(!_0x339b05){_0x8fb61b['sendStatus'](0x194);}return _0x339b05;};}function handleError(_0x371f12,_0x2892b8){_0x2892b8=_0x2892b8||0x1f4;return function(_0x35e6b8){logger[_0xbcf8('0x21')](_0x35e6b8['stack']);if(_0x35e6b8['name']){delete _0x35e6b8['name'];}_0x371f12[_0xbcf8('0x16')](_0x2892b8)['send'](_0x35e6b8);};}exports['index']=function(_0x36343f,_0x2a3cab){var _0x13f210={},_0x59b548={},_0x42dd82={'count':0x0,'rows':[]};var _0x2051f4=_[_0xbcf8('0x22')](db[_0xbcf8('0x23')][_0xbcf8('0x24')],function(_0x4b3664){return{'name':_0x4b3664[_0xbcf8('0x25')],'type':_0x4b3664[_0xbcf8('0x26')][_0xbcf8('0x27')]};});_0x59b548[_0xbcf8('0x28')]=_[_0xbcf8('0x22')](_0x2051f4,_0xbcf8('0x29'));_0x59b548[_0xbcf8('0x2a')]=_[_0xbcf8('0x2b')](_0x36343f[_0xbcf8('0x2a')]);_0x59b548[_0xbcf8('0x2c')]=_[_0xbcf8('0x2d')](_0x59b548[_0xbcf8('0x28')],_0x59b548[_0xbcf8('0x2a')]);_0x13f210['attributes']=_['intersection'](_0x59b548['model'],qs[_0xbcf8('0x2e')](_0x36343f['query'][_0xbcf8('0x2e')]));_0x13f210[_0xbcf8('0x2f')]=_0x13f210[_0xbcf8('0x2f')][_0xbcf8('0x30')]?_0x13f210['attributes']:_0x59b548[_0xbcf8('0x28')];if(!_0x36343f[_0xbcf8('0x2a')][_0xbcf8('0x31')](_0xbcf8('0x32'))){_0x13f210['limit']=qs['limit'](_0x36343f[_0xbcf8('0x2a')][_0xbcf8('0x19')]);_0x13f210[_0xbcf8('0x18')]=qs[_0xbcf8('0x18')](_0x36343f['query']['offset']);}_0x13f210[_0xbcf8('0x33')]=qs[_0xbcf8('0x34')](_0x36343f[_0xbcf8('0x2a')][_0xbcf8('0x34')]);_0x13f210['where']=qs[_0xbcf8('0x2c')](_[_0xbcf8('0x35')](_0x36343f['query'],_0x59b548[_0xbcf8('0x2c')]),_0x2051f4);if(_0x36343f['query'][_0xbcf8('0x36')]){_0x13f210[_0xbcf8('0x37')]=_[_0xbcf8('0x38')](_0x13f210['where'],{'$or':_[_0xbcf8('0x22')](_0x2051f4,function(_0x510ca5){if(_0x510ca5[_0xbcf8('0x26')]!=='VIRTUAL'){var _0x4a33b7={};_0x4a33b7[_0x510ca5[_0xbcf8('0x29')]]={'$like':'%'+_0x36343f[_0xbcf8('0x2a')][_0xbcf8('0x36')]+'%'};return _0x4a33b7;}})});}_0x13f210=_['merge']({},_0x13f210,_0x36343f['options']);var _0x64d8ed={'where':_0x13f210[_0xbcf8('0x37')]};return db[_0xbcf8('0x23')][_0xbcf8('0x39')](_0x64d8ed)['then'](function(_0x1424a0){_0x42dd82['count']=_0x1424a0;if(_0x36343f[_0xbcf8('0x2a')][_0xbcf8('0x3a')]){_0x13f210[_0xbcf8('0x3b')]=[{'all':!![]}];}return db[_0xbcf8('0x23')][_0xbcf8('0x3c')](_0x13f210);})[_0xbcf8('0x1f')](function(_0x50e73e){_0x42dd82['rows']=_0x50e73e;return _0x42dd82;})[_0xbcf8('0x1f')](respondWithFilteredResult(_0x2a3cab,_0x13f210))[_0xbcf8('0x3d')](handleError(_0x2a3cab,null));};exports[_0xbcf8('0x3e')]=function(_0x473032,_0x298729){var _0x1788ce={'raw':!![],'where':{'id':_0x473032[_0xbcf8('0x3f')]['id']}},_0xa217e1={};_0xa217e1[_0xbcf8('0x28')]=_[_0xbcf8('0x2b')](db[_0xbcf8('0x23')][_0xbcf8('0x24')]);_0xa217e1['query']=_['keys'](_0x473032[_0xbcf8('0x2a')]);_0xa217e1[_0xbcf8('0x2c')]=_[_0xbcf8('0x2d')](_0xa217e1[_0xbcf8('0x28')],_0xa217e1['query']);_0x1788ce[_0xbcf8('0x2f')]=_[_0xbcf8('0x2d')](_0xa217e1[_0xbcf8('0x28')],qs['fields'](_0x473032[_0xbcf8('0x2a')]['fields']));_0x1788ce[_0xbcf8('0x2f')]=_0x1788ce[_0xbcf8('0x2f')][_0xbcf8('0x30')]?_0x1788ce['attributes']:_0xa217e1[_0xbcf8('0x28')];if(_0x473032['query'][_0xbcf8('0x3a')]){_0x1788ce[_0xbcf8('0x3b')]=[{'all':!![]}];}_0x1788ce=_[_0xbcf8('0x38')]({},_0x1788ce,_0x473032[_0xbcf8('0x40')]);return db[_0xbcf8('0x23')][_0xbcf8('0x41')](_0x1788ce)[_0xbcf8('0x1f')](handleEntityNotFound(_0x298729,null))['then'](respondWithResult(_0x298729,null))[_0xbcf8('0x3d')](handleError(_0x298729,null));};exports[_0xbcf8('0x42')]=function(_0x3b72e2,_0x28d7fd){return db['SalesforceField'][_0xbcf8('0x42')](_0x3b72e2[_0xbcf8('0x43')],{})[_0xbcf8('0x1f')](respondWithResult(_0x28d7fd,0xc9))[_0xbcf8('0x3d')](handleError(_0x28d7fd,null));};exports[_0xbcf8('0x1e')]=function(_0x482bff,_0xceab3a){if(_0x482bff[_0xbcf8('0x43')]['id']){delete _0x482bff[_0xbcf8('0x43')]['id'];}return db[_0xbcf8('0x23')][_0xbcf8('0x41')]({'where':{'id':_0x482bff['params']['id']}})['then'](handleEntityNotFound(_0xceab3a,null))[_0xbcf8('0x1f')](saveUpdates(_0x482bff['body'],null))['then'](respondWithResult(_0xceab3a,null))[_0xbcf8('0x3d')](handleError(_0xceab3a,null));};exports[_0xbcf8('0x20')]=function(_0x4f5bd2,_0x19a039){return db[_0xbcf8('0x23')][_0xbcf8('0x41')]({'where':{'id':_0x4f5bd2[_0xbcf8('0x3f')]['id']}})[_0xbcf8('0x1f')](handleEntityNotFound(_0x19a039,null))[_0xbcf8('0x1f')](removeEntity(_0x19a039,null))[_0xbcf8('0x3d')](handleError(_0x19a039,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 33f4015..9a63aff 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 _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 +var _0xefe7=['lodash','../../config/logger','api','request-promise','path','../../config/environment','define','SalesforceField','salesforce_unique_index','idField'];(function(_0x35fa96,_0x17efdf){var _0x16c921=function(_0x7efc19){while(--_0x7efc19){_0x35fa96['push'](_0x35fa96['shift']());}};_0x16c921(++_0x17efdf);}(_0xefe7,0x168));var _0x7efe=function(_0x5325b3,_0x5b3ad7){_0x5325b3=_0x5325b3-0x0;var _0x3cbb29=_0xefe7[_0x5325b3];return _0x3cbb29;};'use strict';var _=require(_0x7efe('0x0'));var util=require('util');var logger=require(_0x7efe('0x1'))(_0x7efe('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7efe('0x3'));var fs=require('fs');var path=require(_0x7efe('0x4'));var rimraf=require('rimraf');var config=require(_0x7efe('0x5'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x4183a6,_0x43ac91){return _0x4183a6[_0x7efe('0x6')](_0x7efe('0x7'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x7efe('0x8'),'fields':[_0x7efe('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d993dfd..f4b94ff 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 _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 +var _0x087b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','result','lodash','util','randomstring','../../mysqldb'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x087b,0x11a));var _0xb087=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x087b[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb087('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb087('0x3'))['db'];var utils=require(_0xb087('0x4'));var logger=require(_0xb087('0x5'))(_0xb087('0x6'));var config=require(_0xb087('0x7'));var jayson=require(_0xb087('0x8'));var client=jayson[_0xb087('0x9')][_0xb087('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xecf080,_0x36ac30,_0x3cebbf){return new BPromise(function(_0x6d83fb,_0x1dbe9f){return client[_0xb087('0xb')](_0xecf080,_0x3cebbf)[_0xb087('0xc')](function(_0x23cdd7){logger[_0xb087('0xd')]('SalesforceField,\x20%s,\x20%s',_0x36ac30,_0xb087('0xe'));logger[_0xb087('0xf')](_0xb087('0x10'),_0x36ac30,_0xb087('0xe'),JSON[_0xb087('0x11')](_0x23cdd7));if(_0x23cdd7[_0xb087('0x12')]){if(_0x23cdd7[_0xb087('0x12')]['code']===0x1f4){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')]['message']);return _0x1dbe9f(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);return _0x6d83fb(_0x23cdd7[_0xb087('0x12')][_0xb087('0x14')]);}else{logger[_0xb087('0xd')](_0xb087('0x13'),_0x36ac30,'request\x20sent');_0x6d83fb(_0x23cdd7[_0xb087('0x15')][_0xb087('0x14')]);}})['catch'](function(_0xcc4426){logger[_0xb087('0x12')](_0xb087('0x13'),_0x36ac30,_0xcc4426);_0x1dbe9f(_0xcc4426);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 9c764f8..9374f3c 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 _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 +var _0x1bf9=['destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1bf9,0x188));var _0x91bf=function(_0x85b060,_0x4c32c3){_0x85b060=_0x85b060-0x0;var _0xd45a58=_0x1bf9[_0x85b060];return _0xd45a58;};'use strict';var multer=require(_0x91bf('0x0'));var util=require('util');var path=require(_0x91bf('0x1'));var timeout=require(_0x91bf('0x2'));var express=require(_0x91bf('0x3'));var router=express[_0x91bf('0x4')]();var auth=require(_0x91bf('0x5'));var interaction=require(_0x91bf('0x6'));var config=require(_0x91bf('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x91bf('0x8')]('/',auth[_0x91bf('0x9')](),controller['index']);router[_0x91bf('0x8')](_0x91bf('0xa'),auth[_0x91bf('0x9')](),controller[_0x91bf('0xb')]);router[_0x91bf('0x8')]('/:id/configurations',auth[_0x91bf('0x9')](),controller[_0x91bf('0xc')]);router['get'](_0x91bf('0xd'),auth['isAuthenticated'](),controller[_0x91bf('0xe')]);router[_0x91bf('0xf')]('/',auth[_0x91bf('0x9')](),controller[_0x91bf('0x10')]);router[_0x91bf('0xf')](_0x91bf('0x11'),auth[_0x91bf('0x9')](),controller[_0x91bf('0x12')]);router[_0x91bf('0x13')](_0x91bf('0xa'),auth['isAuthenticated'](),controller[_0x91bf('0x14')]);router[_0x91bf('0x15')]('/:id',auth[_0x91bf('0x9')](),controller[_0x91bf('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index caf9b75..9a5f3be 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 _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 +var _0x4713=['exports','STRING','remoteUri','sequelize'];(function(_0x431f27,_0x152cc4){var _0x559a65=function(_0x1117ed){while(--_0x1117ed){_0x431f27['push'](_0x431f27['shift']());}};_0x559a65(++_0x152cc4);}(_0x4713,0x147));var _0x3471=function(_0x485feb,_0x4687f9){_0x485feb=_0x485feb-0x0;var _0x3013fd=_0x4713[_0x485feb];return _0x3013fd;};'use strict';var Sequelize=require(_0x3471('0x0'));module[_0x3471('0x1')]={'name':{'type':Sequelize[_0x3471('0x2')]},'description':{'type':Sequelize[_0x3471('0x2')]},'username':{'type':Sequelize[_0x3471('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x3471('0x2')]},'email':{'type':Sequelize[_0x3471('0x2')]},'remoteUri':{'type':Sequelize[_0x3471('0x2')],'unique':_0x3471('0x3')},'serverUrl':{'type':Sequelize[_0x3471('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 958d4c0..a403b13 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 _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 +var _0xf34d=['hold_reason','subcategory','notify','incident_state','severity','category','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','all','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','destroy','end','stack','name','index','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','filter','includeAll','include','ServicenowAccount','findAll','rows','show','keys','create','body','find','params','getConfigurations','findOne','ServicenowConfiguration','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla'];(function(_0x49e7dd,_0x7d68e7){var _0x47c0db=function(_0x566994){while(--_0x566994){_0x49e7dd['push'](_0x49e7dd['shift']());}};_0x47c0db(++_0x7d68e7);}(_0xf34d,0x132));var _0xdf34=function(_0x31684a,_0x10832e){_0x31684a=_0x31684a-0x0;var _0x2d60e9=_0xf34d[_0x31684a];return _0x2d60e9;};'use strict';var pdf=require(_0xdf34('0x0'));var emlformat=require(_0xdf34('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xdf34('0x2'));var jsonpatch=require(_0xdf34('0x3'));var rp=require(_0xdf34('0x4'));var moment=require(_0xdf34('0x5'));var BPromise=require(_0xdf34('0x6'));var Mustache=require(_0xdf34('0x7'));var util=require('util');var path=require('path');var sox=require(_0xdf34('0x8'));var csv=require(_0xdf34('0x9'));var ejs=require(_0xdf34('0xa'));var fs=require('fs');var _=require(_0xdf34('0xb'));var squel=require(_0xdf34('0xc'));var crypto=require(_0xdf34('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf34('0x9'));var querystring=require(_0xdf34('0xe'));var Papa=require(_0xdf34('0xf'));var Redis=require(_0xdf34('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf34('0x11'));var hardwareService=require(_0xdf34('0x12'));var logger=require(_0xdf34('0x13'))('api');var utils=require(_0xdf34('0x14'));var config=require(_0xdf34('0x15'));var licenseUtil=require(_0xdf34('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdf34('0x17'));var jayson=require(_0xdf34('0x18'));var client=jayson[_0xdf34('0x19')][_0xdf34('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5a2413,_0x49326d,_0x340ab9,_0x2eaf05){return new BPromise(function(_0x128dc9,_0x1877d3){var _0x158e65=_0x2eaf05||client;return _0x158e65[_0xdf34('0x1b')](_0x5a2413,_0x340ab9)['then'](function(_0x32aee8){logger[_0xdf34('0x1c')](_0xdf34('0x1d'),_0x49326d,_0xdf34('0x1e'));logger[_0xdf34('0x1f')](_0xdf34('0x20'),_0x49326d,'request\x20sent',JSON[_0xdf34('0x21')](_0x32aee8));if(_0x32aee8[_0xdf34('0x22')]){if(_0x32aee8['error'][_0xdf34('0x23')]===0x1f4){logger[_0xdf34('0x22')](_0xdf34('0x1d'),_0x49326d,_0x32aee8[_0xdf34('0x22')][_0xdf34('0x24')]);return _0x1877d3(_0x32aee8[_0xdf34('0x22')][_0xdf34('0x24')]);}logger[_0xdf34('0x22')](_0xdf34('0x1d'),_0x49326d,_0x32aee8[_0xdf34('0x22')][_0xdf34('0x24')]);return _0x128dc9(_0x32aee8['error']['message']);}else{logger['info'](_0xdf34('0x1d'),_0x49326d,_0xdf34('0x1e'));_0x128dc9(_0x32aee8[_0xdf34('0x25')]['message']);}})[_0xdf34('0x26')](function(_0x27dd26){logger['error'](_0xdf34('0x1d'),_0x49326d,_0x27dd26);_0x1877d3(_0x27dd26);});});}function respondWithStatusCode(_0x4f7c39,_0x2184d4){_0x2184d4=_0x2184d4||0xcc;return function(_0x1e0c61){if(_0x1e0c61){return _0x4f7c39[_0xdf34('0x27')](_0x2184d4);}return _0x4f7c39['status'](_0x2184d4)['end']();};}function respondWithResult(_0x556466,_0x3f8009){_0x3f8009=_0x3f8009||0xc8;return function(_0x371958){if(_0x371958){return _0x556466['status'](_0x3f8009)[_0xdf34('0x28')](_0x371958);}};}function respondWithFilteredResult(_0x2e95e7,_0x3dcf68){return function(_0x58ac55){if(_0x58ac55){var _0x4bce67=_0x58ac55[_0xdf34('0x29')],_0x2289df=_0x3dcf68[_0xdf34('0x2a')],_0x353b52=_0x3dcf68['offset']+_0x3dcf68[_0xdf34('0x2b')],_0xa59e33;if(_0x353b52>=_0x4bce67){_0x353b52=_0x4bce67;_0xa59e33=0xc8;}else{_0xa59e33=0xce;}_0x2e95e7[_0xdf34('0x2c')](_0xa59e33);return _0x2e95e7[_0xdf34('0x2d')](_0xdf34('0x2e'),_0x2289df+'-'+_0x353b52+'/'+_0x4bce67)[_0xdf34('0x28')](_0x58ac55);}return null;};}function patchUpdates(_0x5af9ec){return function(_0x344abc){try{jsonpatch['apply'](_0x344abc,_0x5af9ec,!![]);}catch(_0x219da5){return BPromise[_0xdf34('0x2f')](_0x219da5);}return _0x344abc[_0xdf34('0x30')]();};}function saveUpdates(_0x240400,_0x1ead26){return function(_0x12e73b){if(_0x12e73b){return _0x12e73b[_0xdf34('0x31')](_0x240400)[_0xdf34('0x32')](function(_0x25491b){return _0x25491b;});}return null;};}function removeEntity(_0x899d13,_0x10b908){return function(_0xdc289d){if(_0xdc289d){return _0xdc289d[_0xdf34('0x33')]()[_0xdf34('0x32')](function(){_0x899d13[_0xdf34('0x2c')](0xcc)[_0xdf34('0x34')]();});}};}function handleEntityNotFound(_0x2e1843,_0x4eb97){return function(_0x34ac93){if(!_0x34ac93){_0x2e1843[_0xdf34('0x27')](0x194);}return _0x34ac93;};}function handleError(_0x30abe2,_0x10fccc){_0x10fccc=_0x10fccc||0x1f4;return function(_0x36f847){logger['error'](_0x36f847[_0xdf34('0x35')]);if(_0x36f847[_0xdf34('0x36')]){delete _0x36f847['name'];}_0x30abe2[_0xdf34('0x2c')](_0x10fccc)['send'](_0x36f847);};}exports[_0xdf34('0x37')]=function(_0x4f3b5c,_0x4c625e){var _0x4b326c={},_0x4e6fbf={},_0x3236ac={'count':0x0,'rows':[]};var _0x4227c9=_[_0xdf34('0x38')](db['ServicenowAccount'][_0xdf34('0x39')],function(_0x3696cd){return{'name':_0x3696cd['fieldName'],'type':_0x3696cd[_0xdf34('0x3a')]['key']};});_0x4e6fbf['model']=_[_0xdf34('0x38')](_0x4227c9,_0xdf34('0x36'));_0x4e6fbf[_0xdf34('0x3b')]=_['keys'](_0x4f3b5c[_0xdf34('0x3b')]);_0x4e6fbf[_0xdf34('0x3c')]=_[_0xdf34('0x3d')](_0x4e6fbf[_0xdf34('0x3e')],_0x4e6fbf[_0xdf34('0x3b')]);_0x4b326c[_0xdf34('0x3f')]=_[_0xdf34('0x3d')](_0x4e6fbf[_0xdf34('0x3e')],qs[_0xdf34('0x40')](_0x4f3b5c[_0xdf34('0x3b')][_0xdf34('0x40')]));_0x4b326c[_0xdf34('0x3f')]=_0x4b326c[_0xdf34('0x3f')][_0xdf34('0x41')]?_0x4b326c[_0xdf34('0x3f')]:_0x4e6fbf['model'];if(!_0x4f3b5c[_0xdf34('0x3b')][_0xdf34('0x42')]('nolimit')){_0x4b326c['limit']=qs[_0xdf34('0x2b')](_0x4f3b5c[_0xdf34('0x3b')][_0xdf34('0x2b')]);_0x4b326c[_0xdf34('0x2a')]=qs[_0xdf34('0x2a')](_0x4f3b5c[_0xdf34('0x3b')][_0xdf34('0x2a')]);}_0x4b326c['order']=qs[_0xdf34('0x43')](_0x4f3b5c['query'][_0xdf34('0x43')]);_0x4b326c[_0xdf34('0x44')]=qs[_0xdf34('0x3c')](_[_0xdf34('0x45')](_0x4f3b5c['query'],_0x4e6fbf[_0xdf34('0x3c')]),_0x4227c9);if(_0x4f3b5c[_0xdf34('0x3b')]['filter']){_0x4b326c[_0xdf34('0x44')]=_[_0xdf34('0x46')](_0x4b326c['where'],{'$or':_[_0xdf34('0x38')](_0x4227c9,function(_0x325408){if(_0x325408[_0xdf34('0x3a')]!=='VIRTUAL'){var _0x20f5e4={};_0x20f5e4[_0x325408[_0xdf34('0x36')]]={'$like':'%'+_0x4f3b5c[_0xdf34('0x3b')][_0xdf34('0x47')]+'%'};return _0x20f5e4;}})});}_0x4b326c=_[_0xdf34('0x46')]({},_0x4b326c,_0x4f3b5c['options']);var _0x33e5fa={'where':_0x4b326c[_0xdf34('0x44')]};return db['ServicenowAccount'][_0xdf34('0x29')](_0x33e5fa)['then'](function(_0x396141){_0x3236ac['count']=_0x396141;if(_0x4f3b5c[_0xdf34('0x3b')][_0xdf34('0x48')]){_0x4b326c[_0xdf34('0x49')]=[{'all':!![]}];}return db[_0xdf34('0x4a')][_0xdf34('0x4b')](_0x4b326c);})[_0xdf34('0x32')](function(_0x573003){_0x3236ac[_0xdf34('0x4c')]=_0x573003;return _0x3236ac;})['then'](respondWithFilteredResult(_0x4c625e,_0x4b326c))[_0xdf34('0x26')](handleError(_0x4c625e,null));};exports[_0xdf34('0x4d')]=function(_0x5ad688,_0x58af08){var _0x5e0c7c={'raw':![],'where':{'id':_0x5ad688['params']['id']}},_0x581ceb={};_0x581ceb[_0xdf34('0x3e')]=_[_0xdf34('0x4e')](db[_0xdf34('0x4a')][_0xdf34('0x39')]);_0x581ceb[_0xdf34('0x3b')]=_[_0xdf34('0x4e')](_0x5ad688[_0xdf34('0x3b')]);_0x581ceb[_0xdf34('0x3c')]=_[_0xdf34('0x3d')](_0x581ceb[_0xdf34('0x3e')],_0x581ceb[_0xdf34('0x3b')]);_0x5e0c7c[_0xdf34('0x3f')]=_[_0xdf34('0x3d')](_0x581ceb['model'],qs[_0xdf34('0x40')](_0x5ad688['query'][_0xdf34('0x40')]));_0x5e0c7c[_0xdf34('0x3f')]=_0x5e0c7c[_0xdf34('0x3f')][_0xdf34('0x41')]?_0x5e0c7c[_0xdf34('0x3f')]:_0x581ceb['model'];if(_0x5ad688[_0xdf34('0x3b')][_0xdf34('0x48')]){_0x5e0c7c[_0xdf34('0x49')]=[{'all':!![]}];}_0x5e0c7c=_[_0xdf34('0x46')]({},_0x5e0c7c,_0x5ad688['options']);return db[_0xdf34('0x4a')]['find'](_0x5e0c7c)['then'](handleEntityNotFound(_0x58af08,null))[_0xdf34('0x32')](respondWithResult(_0x58af08,null))[_0xdf34('0x26')](handleError(_0x58af08,null));};exports[_0xdf34('0x4f')]=function(_0x59104d,_0x18e2b6){return db[_0xdf34('0x4a')][_0xdf34('0x4f')](_0x59104d[_0xdf34('0x50')],{})[_0xdf34('0x32')](respondWithResult(_0x18e2b6,0xc9))['catch'](handleError(_0x18e2b6,null));};exports[_0xdf34('0x31')]=function(_0x1aad6b,_0x4b8bab){if(_0x1aad6b[_0xdf34('0x50')]['id']){delete _0x1aad6b['body']['id'];}return db[_0xdf34('0x4a')][_0xdf34('0x51')]({'where':{'id':_0x1aad6b[_0xdf34('0x52')]['id']}})[_0xdf34('0x32')](handleEntityNotFound(_0x4b8bab,null))[_0xdf34('0x32')](saveUpdates(_0x1aad6b['body'],null))['then'](respondWithResult(_0x4b8bab,null))[_0xdf34('0x26')](handleError(_0x4b8bab,null));};exports[_0xdf34('0x33')]=function(_0x32b0a1,_0x4c85df){return db[_0xdf34('0x4a')][_0xdf34('0x51')]({'where':{'id':_0x32b0a1[_0xdf34('0x52')]['id']}})[_0xdf34('0x32')](handleEntityNotFound(_0x4c85df,null))[_0xdf34('0x32')](removeEntity(_0x4c85df,null))[_0xdf34('0x26')](handleError(_0x4c85df,null));};exports[_0xdf34('0x53')]=function(_0x40fe41,_0x364037,_0xf81b04){var _0x166cd3={};var _0x2125e3={};var _0x5f3d1e;var _0x3494b3;return db[_0xdf34('0x4a')][_0xdf34('0x54')]({'where':{'id':_0x40fe41['params']['id']}})[_0xdf34('0x32')](handleEntityNotFound(_0x364037,null))[_0xdf34('0x32')](function(_0x5613ba){if(_0x5613ba){_0x5f3d1e=_0x5613ba;_0x2125e3[_0xdf34('0x3e')]=_['keys'](db[_0xdf34('0x55')][_0xdf34('0x39')]);_0x2125e3[_0xdf34('0x3b')]=_[_0xdf34('0x4e')](_0x40fe41[_0xdf34('0x3b')]);_0x2125e3[_0xdf34('0x3c')]=_[_0xdf34('0x3d')](_0x2125e3[_0xdf34('0x3e')],_0x2125e3[_0xdf34('0x3b')]);_0x166cd3[_0xdf34('0x3f')]=_[_0xdf34('0x3d')](_0x2125e3[_0xdf34('0x3e')],qs[_0xdf34('0x40')](_0x40fe41[_0xdf34('0x3b')][_0xdf34('0x40')]));_0x166cd3[_0xdf34('0x3f')]=_0x166cd3[_0xdf34('0x3f')]['length']?_0x166cd3[_0xdf34('0x3f')]:_0x2125e3['model'];_0x166cd3[_0xdf34('0x56')]=qs['sort'](_0x40fe41[_0xdf34('0x3b')][_0xdf34('0x43')]);_0x166cd3['where']=qs['filters'](_[_0xdf34('0x45')](_0x40fe41['query'],_0x2125e3['filters']));if(_0x40fe41[_0xdf34('0x3b')][_0xdf34('0x47')]){_0x166cd3['where']=_[_0xdf34('0x46')](_0x166cd3['where'],{'$or':_[_0xdf34('0x38')](_0x166cd3['attributes'],function(_0x6d4f52){var _0x5a738b={};_0x5a738b[_0x6d4f52]={'$like':'%'+_0x40fe41[_0xdf34('0x3b')][_0xdf34('0x47')]+'%'};return _0x5a738b;})});}_0x166cd3=_[_0xdf34('0x46')]({},_0x166cd3,_0x40fe41[_0xdf34('0x57')]);return _0x5f3d1e[_0xdf34('0x53')](_0x166cd3);}})[_0xdf34('0x32')](function(_0x25cea7){if(_0x25cea7){_0x3494b3=_0x25cea7['length'];if(!_0x40fe41['query']['hasOwnProperty']('nolimit')){_0x166cd3[_0xdf34('0x2b')]=qs['limit'](_0x40fe41[_0xdf34('0x3b')]['limit']);_0x166cd3['offset']=qs[_0xdf34('0x2a')](_0x40fe41['query'][_0xdf34('0x2a')]);}return _0x5f3d1e[_0xdf34('0x53')](_0x166cd3);}})[_0xdf34('0x32')](function(_0x33957f){if(_0x33957f){return _0x33957f?{'count':_0x3494b3,'rows':_0x33957f}:null;}})['then'](respondWithResult(_0x364037,null))['catch'](handleError(_0x364037,null));};exports[_0xdf34('0x58')]=function(_0xb0ebe8,_0x5f1879,_0x117260){if(_0xb0ebe8[_0xdf34('0x50')]['id']){delete _0xb0ebe8[_0xdf34('0x50')]['id'];}return db[_0xdf34('0x4a')][_0xdf34('0x54')]({'where':{'id':_0xb0ebe8[_0xdf34('0x52')]['id']}})[_0xdf34('0x32')](handleEntityNotFound(_0x5f1879,null))[_0xdf34('0x32')](function(_0xb40fca){if(_0xb40fca){_0xb0ebe8[_0xdf34('0x50')][_0xdf34('0x59')]=_0xb40fca['id'];_0xb0ebe8[_0xdf34('0x50')][_0xdf34('0x5a')]=integrations[_0xdf34('0x5b')](_0xb0ebe8[_0xdf34('0x50')][_0xdf34('0x5c')],_0xb0ebe8['body'][_0xdf34('0x3a')]);_0xb0ebe8[_0xdf34('0x50')][_0xdf34('0x5d')]=integrations['getDescriptions'](_0xb0ebe8[_0xdf34('0x50')][_0xdf34('0x5c')],_0xb0ebe8['body'][_0xdf34('0x3a')]);return db[_0xdf34('0x55')]['create'](_0xb0ebe8['body'],{'include':[{'model':db[_0xdf34('0x5e')],'as':_0xdf34('0x5a')},{'model':db[_0xdf34('0x5e')],'as':'Descriptions'}]});}return null;})[_0xdf34('0x32')](respondWithResult(_0x5f1879,null))[_0xdf34('0x26')](handleError(_0x5f1879,null));};exports['getFields']=function(_0x4f2caf,_0x4789f9,_0x238ab8){var _0x4975b4=[_0xdf34('0x5f'),_0xdf34('0x60'),'knowledge',_0xdf34('0x61'),'close_code',_0xdf34('0x62'),_0xdf34('0x63'),_0xdf34('0x64'),_0xdf34('0x65')];var _0x4c37da=['parent','made_sla',_0xdf34('0x66'),_0xdf34('0x67'),_0xdf34('0x68'),_0xdf34('0x69'),'child_incidents',_0xdf34('0x60'),_0xdf34('0x6a'),_0xdf34('0x6b'),'resolved_by',_0xdf34('0x6c'),_0xdf34('0x6d'),_0xdf34('0x6e'),_0xdf34('0x6f'),_0xdf34('0x70'),_0xdf34('0x71'),'sys_created_by',_0xdf34('0x72'),_0xdf34('0x56'),_0xdf34('0x73'),_0xdf34('0x74'),_0xdf34('0x75'),_0xdf34('0x76'),_0xdf34('0x77'),'active',_0xdf34('0x78'),_0xdf34('0x79'),_0xdf34('0x7a'),_0xdf34('0x7b'),_0xdf34('0x7c'),_0xdf34('0x7d'),'expected_start',_0xdf34('0x7e'),_0xdf34('0x7f'),_0xdf34('0x80'),_0xdf34('0x81'),_0xdf34('0x82'),_0xdf34('0x83'),_0xdf34('0x84'),_0xdf34('0x85'),'subcategory',_0xdf34('0x86'),_0xdf34('0x87'),_0xdf34('0x88'),_0xdf34('0x89'),_0xdf34('0x8a'),_0xdf34('0x8b'),'assignment_group',_0xdf34('0x8c'),_0xdf34('0x8d'),_0xdf34('0x8e'),_0xdf34('0x8f'),_0xdf34('0x62'),_0xdf34('0x90'),_0xdf34('0x91'),_0xdf34('0x92'),_0xdf34('0x93'),_0xdf34('0x94'),_0xdf34('0x95'),_0xdf34('0x96'),_0xdf34('0x97'),_0xdf34('0x63'),_0xdf34('0x98'),_0xdf34('0x99'),_0xdf34('0x9a'),_0xdf34('0x9b'),_0xdf34('0x9c'),_0xdf34('0x9d'),_0xdf34('0x64'),_0xdf34('0x9e'),_0xdf34('0x9f'),'approval',_0xdf34('0xa0'),_0xdf34('0xa1'),_0xdf34('0xa2'),_0xdf34('0xa3'),_0xdf34('0xa4'),_0xdf34('0xa5'),_0xdf34('0xa6'),_0xdf34('0xa7'),_0xdf34('0xa8'),_0xdf34('0x65')];var _0x12ad76='';var _0x56db29='';var _0x5b5220=[];var _0x1fd5a4='';var _0x568f95='';var _0x4249a7=[];var _0x2b86b2='';var _0x2515fd='';var _0x3baa7f={};var _0x4d2daf='';return db[_0xdf34('0x4a')][_0xdf34('0x54')]({'where':{'id':_0x4f2caf[_0xdf34('0x52')]['id']},'attributes':['id',_0xdf34('0xa9'),'password',_0xdf34('0xaa'),'remoteUri',_0xdf34('0xab')]})['then'](handleEntityNotFound(_0x4789f9,null))[_0xdf34('0x32')](function(_0x2585c9){if(_0x2585c9){_0x4d2daf=_0x2585c9['remoteUri'];var _0x460ce0=_0x4d2daf[_0xdf34('0xac')](-0x1);if(_0x460ce0==='/'){_0x4d2daf=_0x4d2daf['substring'](0x0,_0x4d2daf[_0xdf34('0xad')](_0x460ce0));}_0x2515fd=util[_0xdf34('0xae')](_0xdf34('0xaf'),_0x4d2daf);_0x2b86b2=util[_0xdf34('0xae')](_0xdf34('0xb0'),_0x4d2daf);_0x3baa7f={'user':_0x2585c9[_0xdf34('0xa9')],'pass':_0x2585c9['password']};var _0x48184f={'method':'GET','uri':_0x2515fd+_0xdf34('0xb1'),'auth':_0x3baa7f,'json':!![]};return rp(_0x48184f);}})[_0xdf34('0x32')](function(_0x22fc68){if(_0x22fc68[_0xdf34('0x25')]['length']>0x0){_0x12ad76=_0x22fc68[_0xdf34('0x25')];}console[_0xdf34('0xb2')](_0xdf34('0xb3'),_0x12ad76);_0x4249a7=[];_0x56db29=Object[_0xdf34('0xb4')]([],_0x12ad76);_[_0xdf34('0xb5')](_0x56db29,function(_0x298567){return!_0x4975b4[_0xdf34('0xb6')](_0x298567[_0xdf34('0x36')]);});_0x56db29[_0xdf34('0xb7')](function(_0x398af4){var _0x31553c=createFieldObject(_0x2b86b2,_0x3baa7f,_0x398af4[_0xdf34('0xb8')],_0x398af4[_0xdf34('0x36')],_0x398af4[_0xdf34('0xb9')],![]);_0x4249a7[_0xdf34('0xba')](_0x31553c);});return Promise['all'](_0x4249a7);})[_0xdf34('0x32')](function(_0x3c6980){_0x5b5220=_0x3c6980;_0x1fd5a4=Object[_0xdf34('0xb4')]([],_0x12ad76);console['log'](_0xdf34('0xbb'),_0x12ad76);_[_0xdf34('0xb5')](_0x1fd5a4,function(_0x34ef77){return _0x4c37da[_0xdf34('0xb6')](_0x34ef77[_0xdf34('0x36')]);});console[_0xdf34('0xb2')](_0xdf34('0xbc'),_0x1fd5a4);_0x4249a7=[];_0x1fd5a4[_0xdf34('0xb7')](function(_0xc4bc4a){var _0x23d98e=createFieldObject(_0x2b86b2,_0x3baa7f,_0xc4bc4a[_0xdf34('0xb8')],_0xc4bc4a['name'],_0xc4bc4a[_0xdf34('0xb9')],!![]);_0x4249a7[_0xdf34('0xba')](_0x23d98e);});return Promise[_0xdf34('0xbd')](_0x4249a7);})[_0xdf34('0x32')](function(_0x149e39){_0x568f95=_0x149e39;var _0x2d67de=_0x5b5220['concat'](_0x568f95);return{'count':_0x2d67de[_0xdf34('0x41')],'rows':_0x2d67de};})['then'](respondWithResult(_0x4789f9,null))[_0xdf34('0x26')](function(_0xdfba6a){console[_0xdf34('0xb2')](_0xdf34('0xbe')+_0xdfba6a);var _0x3d08e3=_0x4f2caf[_0xdf34('0x3b')][_0xdf34('0xbf')]?0x1f4:_0xdfba6a[_0xdf34('0xc0')]||0x1f4;logger[_0xdf34('0x22')](_0xdfba6a[_0xdf34('0x35')]);delete _0xdfba6a['name'];if(_0x3d08e3===0x191){_0x3d08e3=0x190;}_0x4789f9['status'](_0x3d08e3)['send'](_0x4f2caf['query'][_0xdf34('0xbf')]?{'message':'Wrong\x20credentials','statusCode':_0xdfba6a[_0xdf34('0xc0')]}:_0xdfba6a);});};function createFieldObject(_0x336e4b,_0x25bfe5,_0x4b2a8d,_0x27ede6,_0x52d5a3,_0x305463){return new Promise(function(_0x521a6e,_0x35021e){var _0x54b702={'id':_0x27ede6,'name':_0x52d5a3,'custom':_0x305463};if(_0x4b2a8d===_0xdf34('0xc1')){_0x54b702[_0xdf34('0x57')]=[{'name':_0xdf34('0xc2'),'value':_0xdf34('0xc3')},{'name':_0xdf34('0xc4'),'value':'false'}];_0x521a6e(_0x54b702);}else{var _0x47de5d={'method':_0xdf34('0xc5'),'uri':_0x336e4b+_0xdf34('0xc6')+_0x27ede6,'auth':_0x25bfe5,'json':!![]};return rp(_0x47de5d)['then'](function(_0x45e2ea){var _0x3208a0=[];if(_0x45e2ea['result'][_0xdf34('0x41')]>0x0){_0x45e2ea[_0xdf34('0x25')][_0xdf34('0xb7')](function(_0x1e9e27){if(_0x1e9e27[_0xdf34('0xc7')]==='false'){var _0x5cf3ea={'name':_0x1e9e27[_0xdf34('0xb9')],'value':_0x1e9e27[_0xdf34('0xc8')]};_0x3208a0[_0xdf34('0xba')](_0x5cf3ea);}});}_0x54b702['options']=_0x3208a0;if(_0x54b702[_0xdf34('0x57')][_0xdf34('0x41')]>0x0){_0x521a6e(_0x54b702);}else{if(_0x305463==![]){_0x521a6e();}else{_0x521a6e(_0x54b702);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4676a15..ba6d2e4 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 _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 +var _0xf006=['ServicenowAccount','int_servicenow_accounts','../../config/logger','api','bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x739633,_0x27aceb){var _0x447361=function(_0x5b72e3){while(--_0x5b72e3){_0x739633['push'](_0x739633['shift']());}};_0x447361(++_0x27aceb);}(_0xf006,0x146));var _0x6f00=function(_0x1948a3,_0x313941){_0x1948a3=_0x1948a3-0x0;var _0x3ef570=_0xf006[_0x1948a3];return _0x3ef570;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f00('0x0'))(_0x6f00('0x1'));var moment=require('moment');var BPromise=require(_0x6f00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f00('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6f00('0x4'));var integrations=require(_0x6f00('0x5'));module[_0x6f00('0x6')]=function(_0x52c9a2,_0x3c29ff){return _0x52c9a2['define'](_0x6f00('0x7'),attributes,{'tableName':_0x6f00('0x8'),'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 aaf6407..7eb3496 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 _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 +var _0x8b06=['findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowServicenowAccount','ServicenowAccount','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetServicenowAccount'];(function(_0x40910a,_0x27361c){var _0x21ec19=function(_0x8505a6){while(--_0x8505a6){_0x40910a['push'](_0x40910a['shift']());}};_0x21ec19(++_0x27361c);}(_0x8b06,0xfb));var _0x68b0=function(_0xa85881,_0x5d25e7){_0xa85881=_0xa85881-0x0;var _0x237012=_0x8b06[_0xa85881];return _0x237012;};'use strict';var _=require('lodash');var util=require(_0x68b0('0x0'));var moment=require(_0x68b0('0x1'));var BPromise=require('bluebird');var rs=require(_0x68b0('0x2'));var fs=require('fs');var Redis=require(_0x68b0('0x3'));var db=require(_0x68b0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x68b0('0x5'));var config=require(_0x68b0('0x6'));var jayson=require(_0x68b0('0x7'));var client=jayson[_0x68b0('0x8')][_0x68b0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e56d5,_0x183705,_0x407962){return new BPromise(function(_0x10bef2,_0x2b9a3e){return client[_0x68b0('0xa')](_0x2e56d5,_0x407962)['then'](function(_0x47f2da){logger[_0x68b0('0xb')](_0x68b0('0xc'),_0x183705,'request\x20sent');logger['debug'](_0x68b0('0xd'),_0x183705,_0x68b0('0xe'),JSON[_0x68b0('0xf')](_0x47f2da));if(_0x47f2da[_0x68b0('0x10')]){if(_0x47f2da[_0x68b0('0x10')][_0x68b0('0x11')]===0x1f4){logger[_0x68b0('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x183705,_0x47f2da[_0x68b0('0x10')][_0x68b0('0x12')]);return _0x2b9a3e(_0x47f2da['error'][_0x68b0('0x12')]);}logger[_0x68b0('0x10')](_0x68b0('0xc'),_0x183705,_0x47f2da[_0x68b0('0x10')][_0x68b0('0x12')]);return _0x10bef2(_0x47f2da['error'][_0x68b0('0x12')]);}else{logger['info'](_0x68b0('0xc'),_0x183705,_0x68b0('0xe'));_0x10bef2(_0x47f2da['result']['message']);}})[_0x68b0('0x13')](function(_0x352127){logger['error'](_0x68b0('0xc'),_0x183705,_0x352127);_0x2b9a3e(_0x352127);});});}exports[_0x68b0('0x14')]=function(_0x2bebef){var _0x3d4afe=this;return new Promise(function(_0xac90be,_0xc3531a){return db['ServicenowAccount'][_0x68b0('0x15')]({'raw':_0x2bebef['options']?_0x2bebef[_0x68b0('0x16')][_0x68b0('0x17')]===undefined?!![]:![]:!![],'where':_0x2bebef['options']?_0x2bebef[_0x68b0('0x16')][_0x68b0('0x18')]||null:null,'attributes':_0x2bebef[_0x68b0('0x16')]?_0x2bebef[_0x68b0('0x16')][_0x68b0('0x19')]||null:null,'limit':_0x2bebef['options']?_0x2bebef[_0x68b0('0x16')][_0x68b0('0x1a')]||null:null,'include':_0x2bebef['options']?_0x2bebef[_0x68b0('0x16')][_0x68b0('0x1b')]?_['map'](_0x2bebef[_0x68b0('0x16')][_0x68b0('0x1b')],function(_0x156065){return{'model':db[_0x156065[_0x68b0('0x1c')]],'as':_0x156065['as'],'attributes':_0x156065[_0x68b0('0x19')],'include':_0x156065[_0x68b0('0x1b')]?_[_0x68b0('0x1d')](_0x156065['include'],function(_0x2647fa){return{'model':db[_0x2647fa[_0x68b0('0x1c')]],'as':_0x2647fa['as'],'attributes':_0x2647fa[_0x68b0('0x19')],'include':_0x2647fa[_0x68b0('0x1b')]?_[_0x68b0('0x1d')](_0x2647fa['include'],function(_0x1916bc){return{'model':db[_0x1916bc[_0x68b0('0x1c')]],'as':_0x1916bc['as'],'attributes':_0x1916bc[_0x68b0('0x19')]};}):[]};}):[]};}):[]:[]})[_0x68b0('0x1e')](function(_0x404c30){logger[_0x68b0('0xb')](_0x68b0('0x14'),_0x2bebef);logger[_0x68b0('0x1f')](_0x68b0('0x14'),_0x2bebef,JSON[_0x68b0('0xf')](_0x404c30));_0xac90be(_0x404c30);})[_0x68b0('0x13')](function(_0x17224f){logger[_0x68b0('0x10')](_0x68b0('0x14'),_0x17224f[_0x68b0('0x12')],_0x2bebef);_0xc3531a(_0x3d4afe[_0x68b0('0x10')](0x1f4,_0x17224f['message']));});});};exports[_0x68b0('0x20')]=function(_0x4812b1){var _0x4e8416=this;return new Promise(function(_0x32d4e4,_0x5246c3){return db[_0x68b0('0x21')]['find']({'raw':_0x4812b1[_0x68b0('0x16')]?_0x4812b1[_0x68b0('0x16')][_0x68b0('0x17')]===undefined?!![]:![]:!![],'where':_0x4812b1['options']?_0x4812b1[_0x68b0('0x16')][_0x68b0('0x18')]||null:null,'attributes':_0x4812b1[_0x68b0('0x16')]?_0x4812b1[_0x68b0('0x16')][_0x68b0('0x19')]||null:null,'include':_0x4812b1[_0x68b0('0x16')]?_0x4812b1[_0x68b0('0x16')][_0x68b0('0x1b')]?_[_0x68b0('0x1d')](_0x4812b1[_0x68b0('0x16')][_0x68b0('0x1b')],function(_0x171a3a){return{'model':db[_0x171a3a[_0x68b0('0x1c')]],'as':_0x171a3a['as'],'attributes':_0x171a3a[_0x68b0('0x19')],'include':_0x171a3a[_0x68b0('0x1b')]?_[_0x68b0('0x1d')](_0x171a3a[_0x68b0('0x1b')],function(_0x396bed){return{'model':db[_0x396bed[_0x68b0('0x1c')]],'as':_0x396bed['as'],'attributes':_0x396bed[_0x68b0('0x19')],'include':_0x396bed[_0x68b0('0x1b')]?_[_0x68b0('0x1d')](_0x396bed[_0x68b0('0x1b')],function(_0x504704){return{'model':db[_0x504704[_0x68b0('0x1c')]],'as':_0x504704['as'],'attributes':_0x504704[_0x68b0('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5af63e){logger[_0x68b0('0xb')](_0x68b0('0x20'),_0x4812b1);logger[_0x68b0('0x1f')](_0x68b0('0x20'),_0x4812b1,JSON['stringify'](_0x5af63e));_0x32d4e4(_0x5af63e);})['catch'](function(_0x179265){logger[_0x68b0('0x10')](_0x68b0('0x20'),_0x179265[_0x68b0('0x12')],_0x4812b1);_0x5246c3(_0x4e8416['error'](0x1f4,_0x179265['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 25ac0c9..74f35d0 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 _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 +var _0xe15b=['destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe15b,0x70));var _0xbe15=function(_0x532112,_0x37d94b){_0x532112=_0x532112-0x0;var _0x23e5fb=_0xe15b[_0x532112];return _0x23e5fb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe15('0x0'));var timeout=require(_0xbe15('0x1'));var express=require(_0xbe15('0x2'));var router=express[_0xbe15('0x3')]();var auth=require(_0xbe15('0x4'));var interaction=require(_0xbe15('0x5'));var config=require(_0xbe15('0x6'));var controller=require(_0xbe15('0x7'));router[_0xbe15('0x8')]('/',auth[_0xbe15('0x9')](),controller['index']);router[_0xbe15('0x8')]('/:id',auth[_0xbe15('0x9')](),controller[_0xbe15('0xa')]);router[_0xbe15('0x8')](_0xbe15('0xb'),auth[_0xbe15('0x9')](),controller[_0xbe15('0xc')]);router[_0xbe15('0x8')](_0xbe15('0xd'),auth['isAuthenticated'](),controller[_0xbe15('0xe')]);router['get'](_0xbe15('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbe15('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbe15('0x11'),auth[_0xbe15('0x9')](),controller[_0xbe15('0x12')]);router[_0xbe15('0x13')](_0xbe15('0x11'),auth[_0xbe15('0x9')](),controller[_0xbe15('0x14')]);module[_0xbe15('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ff185a8..24de290 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 _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 +var _0xe0ce=['STRING','sequelize','exports'];(function(_0x2b23d9,_0x397850){var _0x3c5371=function(_0x1e9dd4){while(--_0x1e9dd4){_0x2b23d9['push'](_0x2b23d9['shift']());}};_0x3c5371(++_0x397850);}(_0xe0ce,0xcd));var _0xee0c=function(_0x402565,_0x431efa){_0x402565=_0x402565-0x0;var _0x2ed987=_0xe0ce[_0x402565];return _0x2ed987;};'use strict';var Sequelize=require(_0xee0c('0x0'));module[_0xee0c('0x1')]={'name':{'type':Sequelize[_0xee0c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 59df140..4685f93 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 _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 +var _0x410b=['error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','destroy','then','stack','name','send','index','ServicenowConfiguration','rawAttributes','type','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','length','find','create','body','params','getFields','getSubjects','findOne','ServicenowField','nolimit','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x14e8b8,_0x418d3b){var _0x11967e=function(_0x4a0b41){while(--_0x4a0b41){_0x14e8b8['push'](_0x14e8b8['shift']());}};_0x11967e(++_0x418d3b);}(_0x410b,0x14b));var _0xb410=function(_0x22811e,_0x145170){_0x22811e=_0x22811e-0x0;var _0xcc69c4=_0x410b[_0x22811e];return _0xcc69c4;};'use strict';var pdf=require(_0xb410('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb410('0x1'));var zipdir=require(_0xb410('0x2'));var jsonpatch=require(_0xb410('0x3'));var rp=require(_0xb410('0x4'));var moment=require(_0xb410('0x5'));var BPromise=require(_0xb410('0x6'));var Mustache=require('mustache');var util=require(_0xb410('0x7'));var path=require(_0xb410('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb410('0x9'));var squel=require(_0xb410('0xa'));var crypto=require(_0xb410('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb410('0xc'));var toCsv=require(_0xb410('0xd'));var querystring=require(_0xb410('0xe'));var Papa=require(_0xb410('0xf'));var Redis=require('ioredis');var authService=require(_0xb410('0x10'));var qs=require(_0xb410('0x11'));var as=require(_0xb410('0x12'));var hardwareService=require(_0xb410('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb410('0x14'));var config=require(_0xb410('0x15'));var licenseUtil=require(_0xb410('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xb410('0x17'));var client=jayson[_0xb410('0x18')][_0xb410('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5e3fcc,_0x4a34a3,_0x48949b,_0x13c86f){return new BPromise(function(_0x57a0bd,_0x3eaa49){var _0x5908dd=_0x13c86f||client;return _0x5908dd[_0xb410('0x1a')](_0x5e3fcc,_0x48949b)['then'](function(_0x539263){logger[_0xb410('0x1b')](_0xb410('0x1c'),_0x4a34a3,_0xb410('0x1d'));logger[_0xb410('0x1e')](_0xb410('0x1f'),_0x4a34a3,_0xb410('0x1d'),JSON[_0xb410('0x20')](_0x539263));if(_0x539263[_0xb410('0x21')]){if(_0x539263[_0xb410('0x21')][_0xb410('0x22')]===0x1f4){logger['error'](_0xb410('0x1c'),_0x4a34a3,_0x539263[_0xb410('0x21')][_0xb410('0x23')]);return _0x3eaa49(_0x539263['error']['message']);}logger['error'](_0xb410('0x1c'),_0x4a34a3,_0x539263[_0xb410('0x21')][_0xb410('0x23')]);return _0x57a0bd(_0x539263[_0xb410('0x21')][_0xb410('0x23')]);}else{logger[_0xb410('0x1b')](_0xb410('0x1c'),_0x4a34a3,_0xb410('0x1d'));_0x57a0bd(_0x539263[_0xb410('0x24')][_0xb410('0x23')]);}})[_0xb410('0x25')](function(_0x843e15){logger[_0xb410('0x21')](_0xb410('0x1c'),_0x4a34a3,_0x843e15);_0x3eaa49(_0x843e15);});});}function respondWithStatusCode(_0x3225b7,_0x26c951){_0x26c951=_0x26c951||0xcc;return function(_0x1d8914){if(_0x1d8914){return _0x3225b7[_0xb410('0x26')](_0x26c951);}return _0x3225b7[_0xb410('0x27')](_0x26c951)[_0xb410('0x28')]();};}function respondWithResult(_0x571058,_0xe184b2){_0xe184b2=_0xe184b2||0xc8;return function(_0x13c75e){if(_0x13c75e){return _0x571058[_0xb410('0x27')](_0xe184b2)[_0xb410('0x29')](_0x13c75e);}};}function respondWithFilteredResult(_0x1e6e55,_0x904bd5){return function(_0x48f4a3){if(_0x48f4a3){var _0x58d978=_0x48f4a3['count'],_0x177c4c=_0x904bd5['offset'],_0x4e9247=_0x904bd5[_0xb410('0x2a')]+_0x904bd5[_0xb410('0x2b')],_0xcd4c16;if(_0x4e9247>=_0x58d978){_0x4e9247=_0x58d978;_0xcd4c16=0xc8;}else{_0xcd4c16=0xce;}_0x1e6e55[_0xb410('0x27')](_0xcd4c16);return _0x1e6e55[_0xb410('0x2c')](_0xb410('0x2d'),_0x177c4c+'-'+_0x4e9247+'/'+_0x58d978)[_0xb410('0x29')](_0x48f4a3);}return null;};}function patchUpdates(_0x3499da){return function(_0x650bcd){try{jsonpatch['apply'](_0x650bcd,_0x3499da,!![]);}catch(_0x128142){return BPromise['reject'](_0x128142);}return _0x650bcd[_0xb410('0x2e')]();};}function saveUpdates(_0x18ca69,_0x21b01c){return function(_0x50ef39){if(_0x50ef39){return _0x50ef39[_0xb410('0x2f')](_0x18ca69)['then'](function(_0x5e2157){return _0x5e2157;});}return null;};}function removeEntity(_0x31900e,_0x553995){return function(_0x1bf165){if(_0x1bf165){return _0x1bf165[_0xb410('0x30')]()[_0xb410('0x31')](function(){_0x31900e[_0xb410('0x27')](0xcc)[_0xb410('0x28')]();});}};}function handleEntityNotFound(_0x3aaaae,_0x44b976){return function(_0x2e4703){if(!_0x2e4703){_0x3aaaae['sendStatus'](0x194);}return _0x2e4703;};}function handleError(_0x659ebd,_0x50d927){_0x50d927=_0x50d927||0x1f4;return function(_0x2b226a){logger['error'](_0x2b226a[_0xb410('0x32')]);if(_0x2b226a[_0xb410('0x33')]){delete _0x2b226a[_0xb410('0x33')];}_0x659ebd['status'](_0x50d927)[_0xb410('0x34')](_0x2b226a);};}exports[_0xb410('0x35')]=function(_0x9db1d1,_0x19f7ae){var _0x1f8f11={},_0x27142d={},_0xfc0813={'count':0x0,'rows':[]};var _0x39fdd2=_['map'](db[_0xb410('0x36')][_0xb410('0x37')],function(_0x580925){return{'name':_0x580925['fieldName'],'type':_0x580925[_0xb410('0x38')][_0xb410('0x39')]};});_0x27142d[_0xb410('0x3a')]=_[_0xb410('0x3b')](_0x39fdd2,_0xb410('0x33'));_0x27142d['query']=_[_0xb410('0x3c')](_0x9db1d1['query']);_0x27142d['filters']=_[_0xb410('0x3d')](_0x27142d[_0xb410('0x3a')],_0x27142d[_0xb410('0x3e')]);_0x1f8f11[_0xb410('0x3f')]=_['intersection'](_0x27142d['model'],qs[_0xb410('0x40')](_0x9db1d1[_0xb410('0x3e')][_0xb410('0x40')]));_0x1f8f11[_0xb410('0x3f')]=_0x1f8f11['attributes']['length']?_0x1f8f11['attributes']:_0x27142d[_0xb410('0x3a')];if(!_0x9db1d1[_0xb410('0x3e')][_0xb410('0x41')]('nolimit')){_0x1f8f11[_0xb410('0x2b')]=qs[_0xb410('0x2b')](_0x9db1d1[_0xb410('0x3e')][_0xb410('0x2b')]);_0x1f8f11[_0xb410('0x2a')]=qs[_0xb410('0x2a')](_0x9db1d1[_0xb410('0x3e')][_0xb410('0x2a')]);}_0x1f8f11[_0xb410('0x42')]=qs[_0xb410('0x43')](_0x9db1d1[_0xb410('0x3e')]['sort']);_0x1f8f11[_0xb410('0x44')]=qs[_0xb410('0x45')](_[_0xb410('0x46')](_0x9db1d1[_0xb410('0x3e')],_0x27142d[_0xb410('0x45')]),_0x39fdd2);if(_0x9db1d1['query']['filter']){_0x1f8f11[_0xb410('0x44')]=_[_0xb410('0x47')](_0x1f8f11[_0xb410('0x44')],{'$or':_[_0xb410('0x3b')](_0x39fdd2,function(_0x3b2db0){if(_0x3b2db0[_0xb410('0x38')]!=='VIRTUAL'){var _0x541148={};_0x541148[_0x3b2db0[_0xb410('0x33')]]={'$like':'%'+_0x9db1d1[_0xb410('0x3e')][_0xb410('0x48')]+'%'};return _0x541148;}})});}_0x1f8f11=_[_0xb410('0x47')]({},_0x1f8f11,_0x9db1d1[_0xb410('0x49')]);var _0x2b4e75={'where':_0x1f8f11['where']};return db['ServicenowConfiguration'][_0xb410('0x4a')](_0x2b4e75)[_0xb410('0x31')](function(_0x3bd53c){_0xfc0813[_0xb410('0x4a')]=_0x3bd53c;if(_0x9db1d1['query'][_0xb410('0x4b')]){_0x1f8f11[_0xb410('0x4c')]=[{'all':!![]}];}return db[_0xb410('0x36')][_0xb410('0x4d')](_0x1f8f11);})[_0xb410('0x31')](function(_0x4c655a){_0xfc0813[_0xb410('0x4e')]=_0x4c655a;return _0xfc0813;})[_0xb410('0x31')](respondWithFilteredResult(_0x19f7ae,_0x1f8f11))['catch'](handleError(_0x19f7ae,null));};exports[_0xb410('0x4f')]=function(_0x16e049,_0x5b48a2){var _0x62e198={'raw':![],'where':{'id':_0x16e049['params']['id']}},_0x30a5d7={};_0x30a5d7[_0xb410('0x3a')]=_['keys'](db[_0xb410('0x36')][_0xb410('0x37')]);_0x30a5d7[_0xb410('0x3e')]=_[_0xb410('0x3c')](_0x16e049[_0xb410('0x3e')]);_0x30a5d7[_0xb410('0x45')]=_[_0xb410('0x3d')](_0x30a5d7[_0xb410('0x3a')],_0x30a5d7[_0xb410('0x3e')]);_0x62e198['attributes']=_[_0xb410('0x3d')](_0x30a5d7[_0xb410('0x3a')],qs['fields'](_0x16e049[_0xb410('0x3e')][_0xb410('0x40')]));_0x62e198[_0xb410('0x3f')]=_0x62e198[_0xb410('0x3f')][_0xb410('0x50')]?_0x62e198[_0xb410('0x3f')]:_0x30a5d7[_0xb410('0x3a')];if(_0x16e049[_0xb410('0x3e')][_0xb410('0x4b')]){_0x62e198[_0xb410('0x4c')]=[{'all':!![]}];}_0x62e198=_[_0xb410('0x47')]({},_0x62e198,_0x16e049[_0xb410('0x49')]);return db['ServicenowConfiguration'][_0xb410('0x51')](_0x62e198)[_0xb410('0x31')](handleEntityNotFound(_0x5b48a2,null))[_0xb410('0x31')](respondWithResult(_0x5b48a2,null))[_0xb410('0x25')](handleError(_0x5b48a2,null));};exports[_0xb410('0x52')]=function(_0x2edf48,_0x32f356){return db[_0xb410('0x36')][_0xb410('0x52')](_0x2edf48[_0xb410('0x53')],{})[_0xb410('0x31')](respondWithResult(_0x32f356,0xc9))[_0xb410('0x25')](handleError(_0x32f356,null));};exports[_0xb410('0x2f')]=function(_0x2232e9,_0x56bc90){if(_0x2232e9[_0xb410('0x53')]['id']){delete _0x2232e9[_0xb410('0x53')]['id'];}return db[_0xb410('0x36')][_0xb410('0x51')]({'where':{'id':_0x2232e9[_0xb410('0x54')]['id']}})[_0xb410('0x31')](handleEntityNotFound(_0x56bc90,null))[_0xb410('0x31')](saveUpdates(_0x2232e9['body'],null))[_0xb410('0x31')](respondWithResult(_0x56bc90,null))['catch'](handleError(_0x56bc90,null));};exports[_0xb410('0x30')]=function(_0x104851,_0x26af82){return db[_0xb410('0x36')][_0xb410('0x51')]({'where':{'id':_0x104851['params']['id']}})[_0xb410('0x31')](handleEntityNotFound(_0x26af82,null))[_0xb410('0x31')](removeEntity(_0x26af82,null))[_0xb410('0x25')](handleError(_0x26af82,null));};exports[_0xb410('0x55')]=function(_0x1b177c,_0x127ade,_0x23c3c9){var _0x11092d={};var _0xba8de={};var _0x348d93;var _0x23b3c2;return db[_0xb410('0x36')]['findOne']({'where':{'id':_0x1b177c['params']['id']}})[_0xb410('0x31')](handleEntityNotFound(_0x127ade,null))['then'](function(_0x267868){if(_0x267868){_0x348d93=_0x267868;_0xba8de['model']=_['keys'](db['ServicenowField']['rawAttributes']);_0xba8de[_0xb410('0x3e')]=_[_0xb410('0x3c')](_0x1b177c[_0xb410('0x3e')]);_0xba8de[_0xb410('0x45')]=_[_0xb410('0x3d')](_0xba8de[_0xb410('0x3a')],_0xba8de[_0xb410('0x3e')]);_0x11092d[_0xb410('0x3f')]=_[_0xb410('0x3d')](_0xba8de['model'],qs[_0xb410('0x40')](_0x1b177c[_0xb410('0x3e')]['fields']));_0x11092d['attributes']=_0x11092d['attributes'][_0xb410('0x50')]?_0x11092d['attributes']:_0xba8de[_0xb410('0x3a')];_0x11092d[_0xb410('0x42')]=qs['sort'](_0x1b177c[_0xb410('0x3e')]['sort']);_0x11092d['where']=qs[_0xb410('0x45')](_[_0xb410('0x46')](_0x1b177c[_0xb410('0x3e')],_0xba8de[_0xb410('0x45')]));if(_0x1b177c[_0xb410('0x3e')][_0xb410('0x48')]){_0x11092d[_0xb410('0x44')]=_['merge'](_0x11092d[_0xb410('0x44')],{'$or':_['map'](_0x11092d[_0xb410('0x3f')],function(_0x3370f9){var _0x128756={};_0x128756[_0x3370f9]={'$like':'%'+_0x1b177c[_0xb410('0x3e')]['filter']+'%'};return _0x128756;})});}_0x11092d=_['merge']({},_0x11092d,_0x1b177c[_0xb410('0x49')]);return _0x348d93[_0xb410('0x55')](_0x11092d);}})[_0xb410('0x31')](function(_0x2f1019){if(_0x2f1019){_0x23b3c2=_0x2f1019[_0xb410('0x50')];if(!_0x1b177c[_0xb410('0x3e')]['hasOwnProperty']('nolimit')){_0x11092d[_0xb410('0x2b')]=qs[_0xb410('0x2b')](_0x1b177c[_0xb410('0x3e')][_0xb410('0x2b')]);_0x11092d['offset']=qs['offset'](_0x1b177c[_0xb410('0x3e')]['offset']);}return _0x348d93[_0xb410('0x55')](_0x11092d);}})[_0xb410('0x31')](function(_0x3a0084){if(_0x3a0084){return _0x3a0084?{'count':_0x23b3c2,'rows':_0x3a0084}:null;}})['then'](respondWithResult(_0x127ade,null))[_0xb410('0x25')](handleError(_0x127ade,null));};exports[_0xb410('0x56')]=function(_0x155f20,_0x11c35b,_0x28446e){var _0x2b8c93={};var _0x55c562={};var _0x31232d;var _0x59f06f;return db[_0xb410('0x36')][_0xb410('0x57')]({'where':{'id':_0x155f20[_0xb410('0x54')]['id']}})['then'](handleEntityNotFound(_0x11c35b,null))[_0xb410('0x31')](function(_0x2552f1){if(_0x2552f1){_0x31232d=_0x2552f1;_0x55c562[_0xb410('0x3a')]=_['keys'](db[_0xb410('0x58')][_0xb410('0x37')]);_0x55c562[_0xb410('0x3e')]=_[_0xb410('0x3c')](_0x155f20[_0xb410('0x3e')]);_0x55c562[_0xb410('0x45')]=_[_0xb410('0x3d')](_0x55c562['model'],_0x55c562['query']);_0x2b8c93[_0xb410('0x3f')]=_['intersection'](_0x55c562[_0xb410('0x3a')],qs[_0xb410('0x40')](_0x155f20['query'][_0xb410('0x40')]));_0x2b8c93[_0xb410('0x3f')]=_0x2b8c93[_0xb410('0x3f')][_0xb410('0x50')]?_0x2b8c93[_0xb410('0x3f')]:_0x55c562['model'];_0x2b8c93[_0xb410('0x42')]=qs[_0xb410('0x43')](_0x155f20[_0xb410('0x3e')]['sort']);_0x2b8c93['where']=qs[_0xb410('0x45')](_[_0xb410('0x46')](_0x155f20[_0xb410('0x3e')],_0x55c562['filters']));if(_0x155f20[_0xb410('0x3e')][_0xb410('0x48')]){_0x2b8c93[_0xb410('0x44')]=_['merge'](_0x2b8c93[_0xb410('0x44')],{'$or':_['map'](_0x2b8c93[_0xb410('0x3f')],function(_0x33fc5b){var _0x5bcffa={};_0x5bcffa[_0x33fc5b]={'$like':'%'+_0x155f20[_0xb410('0x3e')][_0xb410('0x48')]+'%'};return _0x5bcffa;})});}_0x2b8c93=_['merge']({},_0x2b8c93,_0x155f20[_0xb410('0x49')]);return _0x31232d['getSubjects'](_0x2b8c93);}})['then'](function(_0x12879a){if(_0x12879a){_0x59f06f=_0x12879a[_0xb410('0x50')];if(!_0x155f20[_0xb410('0x3e')]['hasOwnProperty'](_0xb410('0x59'))){_0x2b8c93[_0xb410('0x2b')]=qs['limit'](_0x155f20[_0xb410('0x3e')]['limit']);_0x2b8c93[_0xb410('0x2a')]=qs['offset'](_0x155f20['query'][_0xb410('0x2a')]);}return _0x31232d[_0xb410('0x56')](_0x2b8c93);}})[_0xb410('0x31')](function(_0x228047){if(_0x228047){return _0x228047?{'count':_0x59f06f,'rows':_0x228047}:null;}})[_0xb410('0x31')](respondWithResult(_0x11c35b,null))[_0xb410('0x25')](handleError(_0x11c35b,null));};exports['getDescriptions']=function(_0x38fd0e,_0x91b841,_0x455eb1){var _0x1d3cf4={};var _0x3fe098={};var _0x539804;var _0x15a405;return db[_0xb410('0x36')][_0xb410('0x57')]({'where':{'id':_0x38fd0e[_0xb410('0x54')]['id']}})[_0xb410('0x31')](handleEntityNotFound(_0x91b841,null))[_0xb410('0x31')](function(_0x1d41b9){if(_0x1d41b9){_0x539804=_0x1d41b9;_0x3fe098['model']=_['keys'](db['ServicenowField'][_0xb410('0x37')]);_0x3fe098[_0xb410('0x3e')]=_[_0xb410('0x3c')](_0x38fd0e['query']);_0x3fe098['filters']=_[_0xb410('0x3d')](_0x3fe098[_0xb410('0x3a')],_0x3fe098[_0xb410('0x3e')]);_0x1d3cf4[_0xb410('0x3f')]=_[_0xb410('0x3d')](_0x3fe098[_0xb410('0x3a')],qs[_0xb410('0x40')](_0x38fd0e[_0xb410('0x3e')]['fields']));_0x1d3cf4[_0xb410('0x3f')]=_0x1d3cf4[_0xb410('0x3f')][_0xb410('0x50')]?_0x1d3cf4[_0xb410('0x3f')]:_0x3fe098[_0xb410('0x3a')];_0x1d3cf4['order']=qs[_0xb410('0x43')](_0x38fd0e[_0xb410('0x3e')][_0xb410('0x43')]);_0x1d3cf4[_0xb410('0x44')]=qs['filters'](_[_0xb410('0x46')](_0x38fd0e[_0xb410('0x3e')],_0x3fe098['filters']));if(_0x38fd0e[_0xb410('0x3e')][_0xb410('0x48')]){_0x1d3cf4[_0xb410('0x44')]=_[_0xb410('0x47')](_0x1d3cf4[_0xb410('0x44')],{'$or':_['map'](_0x1d3cf4[_0xb410('0x3f')],function(_0x3fe5cc){var _0x2e0d21={};_0x2e0d21[_0x3fe5cc]={'$like':'%'+_0x38fd0e[_0xb410('0x3e')][_0xb410('0x48')]+'%'};return _0x2e0d21;})});}_0x1d3cf4=_[_0xb410('0x47')]({},_0x1d3cf4,_0x38fd0e[_0xb410('0x49')]);return _0x539804[_0xb410('0x5a')](_0x1d3cf4);}})['then'](function(_0xacc143){if(_0xacc143){_0x15a405=_0xacc143[_0xb410('0x50')];if(!_0x38fd0e['query'][_0xb410('0x41')](_0xb410('0x59'))){_0x1d3cf4[_0xb410('0x2b')]=qs[_0xb410('0x2b')](_0x38fd0e['query'][_0xb410('0x2b')]);_0x1d3cf4[_0xb410('0x2a')]=qs['offset'](_0x38fd0e[_0xb410('0x3e')][_0xb410('0x2a')]);}return _0x539804[_0xb410('0x5a')](_0x1d3cf4);}})['then'](function(_0x5112de){if(_0x5112de){return _0x5112de?{'count':_0x15a405,'rows':_0x5112de}:null;}})['then'](respondWithResult(_0x91b841,null))['catch'](handleError(_0x91b841,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 687e474..3d30700 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 _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 +var _0xe272=['exports','define','int_servicenow_configurations','api','moment','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x2262c0,_0x200e5d){var _0x444527=function(_0x2cd69c){while(--_0x2cd69c){_0x2262c0['push'](_0x2262c0['shift']());}};_0x444527(++_0x200e5d);}(_0xe272,0xed));var _0x2e27=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xe272[_0x29b609];return _0x54c952;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2e27('0x0'));var moment=require(_0x2e27('0x1'));var BPromise=require('bluebird');var rp=require(_0x2e27('0x2'));var fs=require('fs');var path=require(_0x2e27('0x3'));var rimraf=require('rimraf');var config=require(_0x2e27('0x4'));var attributes=require(_0x2e27('0x5'));module[_0x2e27('0x6')]=function(_0x50c9aa,_0x49012b){return _0x50c9aa[_0x2e27('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0x2e27('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index accd7dd..71d38e7 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 _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 +var _0x9fbf=['debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','ServicenowConfiguration,\x20%s,\x20%s','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','then','info','request\x20sent'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x9fbf,0x1a6));var _0xf9fb=function(_0x4f152e,_0x2cfea5){_0x4f152e=_0x4f152e-0x0;var _0x5814f5=_0x9fbf[_0x4f152e];return _0x5814f5;};'use strict';var _=require('lodash');var util=require(_0xf9fb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf9fb('0x1'));var fs=require('fs');var Redis=require(_0xf9fb('0x2'));var db=require(_0xf9fb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9fb('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf9fb('0x5'));var client=jayson['client'][_0xf9fb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x27d5c7,_0x52a13a,_0x18689f){return new BPromise(function(_0x3de31,_0x32893c){return client['request'](_0x27d5c7,_0x18689f)[_0xf9fb('0x7')](function(_0x1a163c){logger[_0xf9fb('0x8')]('ServicenowConfiguration,\x20%s,\x20%s',_0x52a13a,_0xf9fb('0x9'));logger[_0xf9fb('0xa')](_0xf9fb('0xb'),_0x52a13a,_0xf9fb('0x9'),JSON[_0xf9fb('0xc')](_0x1a163c));if(_0x1a163c['error']){if(_0x1a163c['error']['code']===0x1f4){logger[_0xf9fb('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x52a13a,_0x1a163c[_0xf9fb('0xd')][_0xf9fb('0xe')]);return _0x32893c(_0x1a163c[_0xf9fb('0xd')][_0xf9fb('0xe')]);}logger[_0xf9fb('0xd')](_0xf9fb('0xf'),_0x52a13a,_0x1a163c[_0xf9fb('0xd')][_0xf9fb('0xe')]);return _0x3de31(_0x1a163c[_0xf9fb('0xd')][_0xf9fb('0xe')]);}else{logger[_0xf9fb('0x8')](_0xf9fb('0xf'),_0x52a13a,'request\x20sent');_0x3de31(_0x1a163c[_0xf9fb('0x10')][_0xf9fb('0xe')]);}})[_0xf9fb('0x11')](function(_0x5b59ca){logger[_0xf9fb('0xd')](_0xf9fb('0xf'),_0x52a13a,_0x5b59ca);_0x32893c(_0x5b59ca);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 75d0d96..f060f0f 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 _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 +var _0x4069=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','get','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4069,0xfe));var _0x9406=function(_0x5c1aac,_0x5205a8){_0x5c1aac=_0x5c1aac-0x0;var _0x136b27=_0x4069[_0x5c1aac];return _0x136b27;};'use strict';var multer=require(_0x9406('0x0'));var util=require(_0x9406('0x1'));var path=require(_0x9406('0x2'));var timeout=require(_0x9406('0x3'));var express=require(_0x9406('0x4'));var router=express[_0x9406('0x5')]();var auth=require(_0x9406('0x6'));var interaction=require(_0x9406('0x7'));var config=require(_0x9406('0x8'));var controller=require(_0x9406('0x9'));router['get']('/',auth[_0x9406('0xa')](),controller['index']);router[_0x9406('0xb')]('/:id',auth[_0x9406('0xa')](),controller[_0x9406('0xc')]);router[_0x9406('0xd')]('/',auth[_0x9406('0xa')](),controller[_0x9406('0xe')]);router['put']('/:id',auth[_0x9406('0xa')](),controller[_0x9406('0xf')]);router[_0x9406('0x10')](_0x9406('0x11'),auth[_0x9406('0xa')](),controller[_0x9406('0x12')]);module[_0x9406('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9f8a62b..a1cb7ca 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 _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 +var _0x260f=['BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0xd22b44,_0x5d63fd){var _0x339745=function(_0x78f7ff){while(--_0x78f7ff){_0xd22b44['push'](_0xd22b44['shift']());}};_0x339745(++_0x5d63fd);}(_0x260f,0xfd));var _0xf260=function(_0x6b591e,_0x4183d8){_0x6b591e=_0x6b591e-0x0;var _0x20c433=_0x260f[_0x6b591e];return _0x20c433;};'use strict';var Sequelize=require(_0xf260('0x0'));module[_0xf260('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf260('0x2'),_0xf260('0x3'),_0xf260('0x4'),_0xf260('0x5')),'defaultValue':_0xf260('0x2')},'content':{'type':Sequelize[_0xf260('0x6')]},'key':{'type':Sequelize[_0xf260('0x6')]},'keyType':{'type':Sequelize[_0xf260('0x7')](_0xf260('0x2'),_0xf260('0x3'),_0xf260('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf260('0x6')]},'customField':{'type':Sequelize[_0xf260('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf260('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 15ef091..1a4f8a7 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 _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 +var _0x4295=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','intersection','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ServicenowField','includeAll','findAll','rows','show','params','fields','include','catch','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x272993,_0x3a1fb6){var _0x344f41=function(_0x1c1da1){while(--_0x1c1da1){_0x272993['push'](_0x272993['shift']());}};_0x344f41(++_0x3a1fb6);}(_0x4295,0xc3));var _0x5429=function(_0xe5742c,_0x11503e){_0xe5742c=_0xe5742c-0x0;var _0x3db329=_0x4295[_0xe5742c];return _0x3db329;};'use strict';var pdf=require(_0x5429('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5429('0x1'));var zipdir=require(_0x5429('0x2'));var jsonpatch=require(_0x5429('0x3'));var rp=require('request-promise');var moment=require(_0x5429('0x4'));var BPromise=require(_0x5429('0x5'));var Mustache=require('mustache');var util=require(_0x5429('0x6'));var path=require(_0x5429('0x7'));var sox=require(_0x5429('0x8'));var csv=require('to-csv');var ejs=require(_0x5429('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5429('0xa'));var crypto=require(_0x5429('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5429('0xc'));var toCsv=require(_0x5429('0xd'));var querystring=require('querystring');var Papa=require(_0x5429('0xe'));var Redis=require('ioredis');var authService=require(_0x5429('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5429('0x10'));var hardwareService=require(_0x5429('0x11'));var logger=require(_0x5429('0x12'))(_0x5429('0x13'));var utils=require(_0x5429('0x14'));var config=require(_0x5429('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5429('0x16'))['db'];function respondWithStatusCode(_0x2039c5,_0x21309d){_0x21309d=_0x21309d||0xcc;return function(_0x5e4239){if(_0x5e4239){return _0x2039c5[_0x5429('0x17')](_0x21309d);}return _0x2039c5['status'](_0x21309d)[_0x5429('0x18')]();};}function respondWithResult(_0x557581,_0x5abbc6){_0x5abbc6=_0x5abbc6||0xc8;return function(_0x2efd16){if(_0x2efd16){return _0x557581[_0x5429('0x19')](_0x5abbc6)[_0x5429('0x1a')](_0x2efd16);}};}function respondWithFilteredResult(_0x339e01,_0x221a51){return function(_0x9b4cd5){if(_0x9b4cd5){var _0x237939=_0x9b4cd5[_0x5429('0x1b')],_0x48f684=_0x221a51[_0x5429('0x1c')],_0x557198=_0x221a51[_0x5429('0x1c')]+_0x221a51[_0x5429('0x1d')],_0x4326a5;if(_0x557198>=_0x237939){_0x557198=_0x237939;_0x4326a5=0xc8;}else{_0x4326a5=0xce;}_0x339e01['status'](_0x4326a5);return _0x339e01['set'](_0x5429('0x1e'),_0x48f684+'-'+_0x557198+'/'+_0x237939)[_0x5429('0x1a')](_0x9b4cd5);}return null;};}function patchUpdates(_0x5838f2){return function(_0x333942){try{jsonpatch['apply'](_0x333942,_0x5838f2,!![]);}catch(_0x5e40f4){return BPromise[_0x5429('0x1f')](_0x5e40f4);}return _0x333942[_0x5429('0x20')]();};}function saveUpdates(_0x59c9c7,_0x4db9c5){return function(_0xad8056){if(_0xad8056){return _0xad8056[_0x5429('0x21')](_0x59c9c7)[_0x5429('0x22')](function(_0x1ee03c){return _0x1ee03c;});}return null;};}function removeEntity(_0x3448a6,_0x5206cc){return function(_0x28ffad){if(_0x28ffad){return _0x28ffad[_0x5429('0x23')]()[_0x5429('0x22')](function(){_0x3448a6['status'](0xcc)[_0x5429('0x18')]();});}};}function handleEntityNotFound(_0x51bdb4,_0x132efe){return function(_0x5a5a8f){if(!_0x5a5a8f){_0x51bdb4[_0x5429('0x17')](0x194);}return _0x5a5a8f;};}function handleError(_0x2949c0,_0x3e1d5f){_0x3e1d5f=_0x3e1d5f||0x1f4;return function(_0x218a82){logger[_0x5429('0x24')](_0x218a82[_0x5429('0x25')]);if(_0x218a82['name']){delete _0x218a82[_0x5429('0x26')];}_0x2949c0[_0x5429('0x19')](_0x3e1d5f)[_0x5429('0x27')](_0x218a82);};}exports[_0x5429('0x28')]=function(_0x4068b1,_0x400930){var _0x4d685b={},_0x487951={},_0x55ad85={'count':0x0,'rows':[]};var _0x59df91=_[_0x5429('0x29')](db['ServicenowField'][_0x5429('0x2a')],function(_0x210278){return{'name':_0x210278['fieldName'],'type':_0x210278['type'][_0x5429('0x2b')]};});_0x487951[_0x5429('0x2c')]=_[_0x5429('0x29')](_0x59df91,_0x5429('0x26'));_0x487951[_0x5429('0x2d')]=_[_0x5429('0x2e')](_0x4068b1['query']);_0x487951['filters']=_[_0x5429('0x2f')](_0x487951[_0x5429('0x2c')],_0x487951['query']);_0x4d685b[_0x5429('0x30')]=_['intersection'](_0x487951['model'],qs['fields'](_0x4068b1['query']['fields']));_0x4d685b[_0x5429('0x30')]=_0x4d685b[_0x5429('0x30')][_0x5429('0x31')]?_0x4d685b['attributes']:_0x487951['model'];if(!_0x4068b1[_0x5429('0x2d')]['hasOwnProperty'](_0x5429('0x32'))){_0x4d685b[_0x5429('0x1d')]=qs['limit'](_0x4068b1[_0x5429('0x2d')]['limit']);_0x4d685b[_0x5429('0x1c')]=qs[_0x5429('0x1c')](_0x4068b1[_0x5429('0x2d')]['offset']);}_0x4d685b['order']=qs[_0x5429('0x33')](_0x4068b1[_0x5429('0x2d')][_0x5429('0x33')]);_0x4d685b[_0x5429('0x34')]=qs[_0x5429('0x35')](_[_0x5429('0x36')](_0x4068b1['query'],_0x487951[_0x5429('0x35')]),_0x59df91);if(_0x4068b1['query'][_0x5429('0x37')]){_0x4d685b[_0x5429('0x34')]=_[_0x5429('0x38')](_0x4d685b[_0x5429('0x34')],{'$or':_[_0x5429('0x29')](_0x59df91,function(_0x347e63){if(_0x347e63['type']!==_0x5429('0x39')){var _0x2e920f={};_0x2e920f[_0x347e63[_0x5429('0x26')]]={'$like':'%'+_0x4068b1[_0x5429('0x2d')]['filter']+'%'};return _0x2e920f;}})});}_0x4d685b=_['merge']({},_0x4d685b,_0x4068b1[_0x5429('0x3a')]);var _0x153e2e={'where':_0x4d685b[_0x5429('0x34')]};return db[_0x5429('0x3b')][_0x5429('0x1b')](_0x153e2e)[_0x5429('0x22')](function(_0x36ff75){_0x55ad85[_0x5429('0x1b')]=_0x36ff75;if(_0x4068b1[_0x5429('0x2d')][_0x5429('0x3c')]){_0x4d685b['include']=[{'all':!![]}];}return db['ServicenowField'][_0x5429('0x3d')](_0x4d685b);})[_0x5429('0x22')](function(_0x567b52){_0x55ad85[_0x5429('0x3e')]=_0x567b52;return _0x55ad85;})[_0x5429('0x22')](respondWithFilteredResult(_0x400930,_0x4d685b))['catch'](handleError(_0x400930,null));};exports[_0x5429('0x3f')]=function(_0x2695fb,_0x24f85e){var _0x183925={'raw':!![],'where':{'id':_0x2695fb[_0x5429('0x40')]['id']}},_0xde83be={};_0xde83be[_0x5429('0x2c')]=_[_0x5429('0x2e')](db[_0x5429('0x3b')]['rawAttributes']);_0xde83be['query']=_['keys'](_0x2695fb[_0x5429('0x2d')]);_0xde83be[_0x5429('0x35')]=_['intersection'](_0xde83be[_0x5429('0x2c')],_0xde83be[_0x5429('0x2d')]);_0x183925[_0x5429('0x30')]=_['intersection'](_0xde83be['model'],qs[_0x5429('0x41')](_0x2695fb[_0x5429('0x2d')][_0x5429('0x41')]));_0x183925[_0x5429('0x30')]=_0x183925[_0x5429('0x30')][_0x5429('0x31')]?_0x183925['attributes']:_0xde83be[_0x5429('0x2c')];if(_0x2695fb[_0x5429('0x2d')][_0x5429('0x3c')]){_0x183925[_0x5429('0x42')]=[{'all':!![]}];}_0x183925=_['merge']({},_0x183925,_0x2695fb[_0x5429('0x3a')]);return db[_0x5429('0x3b')]['find'](_0x183925)['then'](handleEntityNotFound(_0x24f85e,null))[_0x5429('0x22')](respondWithResult(_0x24f85e,null))[_0x5429('0x43')](handleError(_0x24f85e,null));};exports[_0x5429('0x44')]=function(_0x58ba92,_0x20378f){return db[_0x5429('0x3b')][_0x5429('0x44')](_0x58ba92[_0x5429('0x45')],{})['then'](respondWithResult(_0x20378f,0xc9))[_0x5429('0x43')](handleError(_0x20378f,null));};exports[_0x5429('0x21')]=function(_0x3dac32,_0x55a9ba){if(_0x3dac32[_0x5429('0x45')]['id']){delete _0x3dac32[_0x5429('0x45')]['id'];}return db['ServicenowField'][_0x5429('0x46')]({'where':{'id':_0x3dac32['params']['id']}})['then'](handleEntityNotFound(_0x55a9ba,null))['then'](saveUpdates(_0x3dac32['body'],null))[_0x5429('0x22')](respondWithResult(_0x55a9ba,null))[_0x5429('0x43')](handleError(_0x55a9ba,null));};exports[_0x5429('0x23')]=function(_0x113930,_0x4d754d){return db[_0x5429('0x3b')]['find']({'where':{'id':_0x113930[_0x5429('0x40')]['id']}})[_0x5429('0x22')](handleEntityNotFound(_0x4d754d,null))[_0x5429('0x22')](removeEntity(_0x4d754d,null))[_0x5429('0x43')](handleError(_0x4d754d,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 2fad503..374b098 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 _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 +var _0xb347=['int_servicenow_fields','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x4f42e2,_0x3a7406){var _0x321d0a=function(_0x4752db){while(--_0x4752db){_0x4f42e2['push'](_0x4f42e2['shift']());}};_0x321d0a(++_0x3a7406);}(_0xb347,0x1a2));var _0x7b34=function(_0x2b7dec,_0x549857){_0x2b7dec=_0x2b7dec-0x0;var _0x293f01=_0xb347[_0x2b7dec];return _0x293f01;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7b34('0x0'))(_0x7b34('0x1'));var moment=require('moment');var BPromise=require(_0x7b34('0x2'));var rp=require(_0x7b34('0x3'));var fs=require('fs');var path=require(_0x7b34('0x4'));var rimraf=require(_0x7b34('0x5'));var config=require(_0x7b34('0x6'));var attributes=require(_0x7b34('0x7'));module[_0x7b34('0x8')]=function(_0x2755c6,_0x5ef406){return _0x2755c6[_0x7b34('0x9')](_0x7b34('0xa'),attributes,{'tableName':_0x7b34('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0x7b34('0xc')],'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 26bd96e..01a8cee 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 _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 +var _0xdb96=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x53fad1,_0x2b9d45){var _0x2c17d9=function(_0x789b39){while(--_0x789b39){_0x53fad1['push'](_0x53fad1['shift']());}};_0x2c17d9(++_0x2b9d45);}(_0xdb96,0x1c7));var _0x6db9=function(_0x3d1717,_0x24d397){_0x3d1717=_0x3d1717-0x0;var _0x4d6633=_0xdb96[_0x3d1717];return _0x4d6633;};'use strict';var _=require(_0x6db9('0x0'));var util=require(_0x6db9('0x1'));var moment=require('moment');var BPromise=require(_0x6db9('0x2'));var rs=require(_0x6db9('0x3'));var fs=require('fs');var Redis=require(_0x6db9('0x4'));var db=require(_0x6db9('0x5'))['db'];var utils=require(_0x6db9('0x6'));var logger=require(_0x6db9('0x7'))(_0x6db9('0x8'));var config=require(_0x6db9('0x9'));var jayson=require(_0x6db9('0xa'));var client=jayson[_0x6db9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6ef0df,_0x2da505,_0x8e3677){return new BPromise(function(_0x28e45f,_0x25cf35){return client[_0x6db9('0xc')](_0x6ef0df,_0x8e3677)[_0x6db9('0xd')](function(_0x149af1){logger[_0x6db9('0xe')](_0x6db9('0xf'),_0x2da505,_0x6db9('0x10'));logger[_0x6db9('0x11')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x2da505,_0x6db9('0x10'),JSON[_0x6db9('0x12')](_0x149af1));if(_0x149af1['error']){if(_0x149af1[_0x6db9('0x13')][_0x6db9('0x14')]===0x1f4){logger[_0x6db9('0x13')](_0x6db9('0xf'),_0x2da505,_0x149af1[_0x6db9('0x13')][_0x6db9('0x15')]);return _0x25cf35(_0x149af1[_0x6db9('0x13')][_0x6db9('0x15')]);}logger['error'](_0x6db9('0xf'),_0x2da505,_0x149af1[_0x6db9('0x13')][_0x6db9('0x15')]);return _0x28e45f(_0x149af1['error'][_0x6db9('0x15')]);}else{logger[_0x6db9('0xe')](_0x6db9('0xf'),_0x2da505,'request\x20sent');_0x28e45f(_0x149af1['result']['message']);}})[_0x6db9('0x16')](function(_0x387bda){logger[_0x6db9('0x13')](_0x6db9('0xf'),_0x2da505,_0x387bda);_0x25cf35(_0x387bda);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c4a27c5..5fdc239 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 _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 +var _0xb95d=['index','show','/:id/configurations','isAuthenticated','/:id/fields','post','create','addConfiguration','put','/:id','update','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get'];(function(_0x54f58c,_0x2aa79b){var _0x2fd3ce=function(_0x52aa6a){while(--_0x52aa6a){_0x54f58c['push'](_0x54f58c['shift']());}};_0x2fd3ce(++_0x2aa79b);}(_0xb95d,0x1c5));var _0xdb95=function(_0x496a49,_0x5430cd){_0x496a49=_0x496a49-0x0;var _0x3f7705=_0xb95d[_0x496a49];return _0x3f7705;};'use strict';var multer=require(_0xdb95('0x0'));var util=require('util');var path=require(_0xdb95('0x1'));var timeout=require(_0xdb95('0x2'));var express=require(_0xdb95('0x3'));var router=express[_0xdb95('0x4')]();var auth=require(_0xdb95('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdb95('0x6'));var controller=require(_0xdb95('0x7'));router[_0xdb95('0x8')]('/',auth['isAuthenticated'](),controller[_0xdb95('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xdb95('0xa')]);router[_0xdb95('0x8')](_0xdb95('0xb'),auth[_0xdb95('0xc')](),controller['getConfigurations']);router[_0xdb95('0x8')](_0xdb95('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xdb95('0xe')]('/',auth['isAuthenticated'](),controller[_0xdb95('0xf')]);router[_0xdb95('0xe')](_0xdb95('0xb'),auth[_0xdb95('0xc')](),controller[_0xdb95('0x10')]);router[_0xdb95('0x11')](_0xdb95('0x12'),auth[_0xdb95('0xc')](),controller[_0xdb95('0x13')]);router['delete']('/:id',auth[_0xdb95('0xc')](),controller[_0xdb95('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 2079d20..ed26284 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 _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 +var _0x8419=['username','remoteUri','sequelize','STRING'];(function(_0x3496d3,_0x4467a2){var _0x509096=function(_0xcc66bc){while(--_0xcc66bc){_0x3496d3['push'](_0x3496d3['shift']());}};_0x509096(++_0x4467a2);}(_0x8419,0xee));var _0x9841=function(_0x25fe85,_0x8d204e){_0x25fe85=_0x25fe85-0x0;var _0x254d5f=_0x8419[_0x25fe85];return _0x254d5f;};'use strict';var Sequelize=require(_0x9841('0x0'));module['exports']={'name':{'type':Sequelize[_0x9841('0x1')]},'description':{'type':Sequelize[_0x9841('0x1')]},'username':{'type':Sequelize[_0x9841('0x1')],'unique':_0x9841('0x2')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9841('0x1')],'unique':_0x9841('0x3')},'serverUrl':{'type':Sequelize[_0x9841('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 62b4e56..96b0f69 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 _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 +var _0xf686=['limit','Content-Range','reject','save','update','destroy','name','send','index','map','SugarcrmAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getConfigurations','rawAttributes','addConfiguration','findOne','AccountId','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','stringify','Calls','values','remove','label','test','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','sendStatus','status','end','json','count'];(function(_0x156cce,_0x2bdd57){var _0x5925cb=function(_0x3e26cb){while(--_0x3e26cb){_0x156cce['push'](_0x156cce['shift']());}};_0x5925cb(++_0x2bdd57);}(_0xf686,0xd8));var _0x6f68=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf686[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x6f68('0x0'));var emlformat=require(_0x6f68('0x1'));var rimraf=require(_0x6f68('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f68('0x3'));var rp=require(_0x6f68('0x4'));var moment=require(_0x6f68('0x5'));var BPromise=require(_0x6f68('0x6'));var Mustache=require(_0x6f68('0x7'));var util=require(_0x6f68('0x8'));var path=require(_0x6f68('0x9'));var sox=require(_0x6f68('0xa'));var csv=require('to-csv');var ejs=require(_0x6f68('0xb'));var fs=require('fs');var _=require(_0x6f68('0xc'));var squel=require(_0x6f68('0xd'));var crypto=require(_0x6f68('0xe'));var jsforce=require(_0x6f68('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x6f68('0x10'));var querystring=require(_0x6f68('0x11'));var Papa=require(_0x6f68('0x12'));var Redis=require(_0x6f68('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6f68('0x14'));var hardwareService=require(_0x6f68('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6f68('0x16'));var config=require(_0x6f68('0x17'));var licenseUtil=require(_0x6f68('0x18'));var db=require(_0x6f68('0x19'))['db'];var integrations=require(_0x6f68('0x1a'));var jayson=require(_0x6f68('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xbb8fb7,_0x1fce7c,_0xccb285,_0x5b0db8){return new BPromise(function(_0x374b6c,_0x8acf2a){var _0x4d3bfe=_0x5b0db8||client;return _0x4d3bfe[_0x6f68('0x1c')](_0xbb8fb7,_0xccb285)[_0x6f68('0x1d')](function(_0x4ac3ba){logger['info'](_0x6f68('0x1e'),_0x1fce7c,_0x6f68('0x1f'));logger[_0x6f68('0x20')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1fce7c,_0x6f68('0x1f'),JSON['stringify'](_0x4ac3ba));if(_0x4ac3ba['error']){if(_0x4ac3ba[_0x6f68('0x21')][_0x6f68('0x22')]===0x1f4){logger[_0x6f68('0x21')](_0x6f68('0x1e'),_0x1fce7c,_0x4ac3ba[_0x6f68('0x21')]['message']);return _0x8acf2a(_0x4ac3ba[_0x6f68('0x21')]['message']);}logger[_0x6f68('0x21')]('SugarcrmAccount,\x20%s,\x20%s',_0x1fce7c,_0x4ac3ba[_0x6f68('0x21')][_0x6f68('0x23')]);return _0x374b6c(_0x4ac3ba[_0x6f68('0x21')][_0x6f68('0x23')]);}else{logger[_0x6f68('0x24')](_0x6f68('0x1e'),_0x1fce7c,_0x6f68('0x1f'));_0x374b6c(_0x4ac3ba['result'][_0x6f68('0x23')]);}})['catch'](function(_0x3bdd92){logger[_0x6f68('0x21')](_0x6f68('0x1e'),_0x1fce7c,_0x3bdd92);_0x8acf2a(_0x3bdd92);});});}function respondWithStatusCode(_0x47a8ea,_0x2d03a2){_0x2d03a2=_0x2d03a2||0xcc;return function(_0x1c7c36){if(_0x1c7c36){return _0x47a8ea[_0x6f68('0x25')](_0x2d03a2);}return _0x47a8ea[_0x6f68('0x26')](_0x2d03a2)[_0x6f68('0x27')]();};}function respondWithResult(_0x2368cb,_0x3a16ac){_0x3a16ac=_0x3a16ac||0xc8;return function(_0x305fff){if(_0x305fff){return _0x2368cb['status'](_0x3a16ac)[_0x6f68('0x28')](_0x305fff);}};}function respondWithFilteredResult(_0x42cca6,_0x128898){return function(_0x4f8e81){if(_0x4f8e81){var _0x3c4fad=_0x4f8e81[_0x6f68('0x29')],_0x42e0a4=_0x128898['offset'],_0x4cf6d0=_0x128898['offset']+_0x128898[_0x6f68('0x2a')],_0x4c84e6;if(_0x4cf6d0>=_0x3c4fad){_0x4cf6d0=_0x3c4fad;_0x4c84e6=0xc8;}else{_0x4c84e6=0xce;}_0x42cca6[_0x6f68('0x26')](_0x4c84e6);return _0x42cca6['set'](_0x6f68('0x2b'),_0x42e0a4+'-'+_0x4cf6d0+'/'+_0x3c4fad)[_0x6f68('0x28')](_0x4f8e81);}return null;};}function patchUpdates(_0x516246){return function(_0x415a79){try{jsonpatch['apply'](_0x415a79,_0x516246,!![]);}catch(_0x32a403){return BPromise[_0x6f68('0x2c')](_0x32a403);}return _0x415a79[_0x6f68('0x2d')]();};}function saveUpdates(_0x2bd19b,_0xf5a1a9){return function(_0x142380){if(_0x142380){return _0x142380[_0x6f68('0x2e')](_0x2bd19b)[_0x6f68('0x1d')](function(_0x565116){return _0x565116;});}return null;};}function removeEntity(_0x231e7d,_0x3399a4){return function(_0x194c8e){if(_0x194c8e){return _0x194c8e[_0x6f68('0x2f')]()[_0x6f68('0x1d')](function(){_0x231e7d[_0x6f68('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45999f,_0x491f8b){return function(_0x3dfde7){if(!_0x3dfde7){_0x45999f['sendStatus'](0x194);}return _0x3dfde7;};}function handleError(_0x469484,_0x33dfd9){_0x33dfd9=_0x33dfd9||0x1f4;return function(_0x148831){logger['error'](_0x148831['stack']);if(_0x148831[_0x6f68('0x30')]){delete _0x148831[_0x6f68('0x30')];}_0x469484[_0x6f68('0x26')](_0x33dfd9)[_0x6f68('0x31')](_0x148831);};}exports[_0x6f68('0x32')]=function(_0xa7f87d,_0x676ac4){var _0x13df79={},_0x262d4c={},_0xcb6e45={'count':0x0,'rows':[]};var _0x408808=_[_0x6f68('0x33')](db[_0x6f68('0x34')]['rawAttributes'],function(_0x1e3b5c){return{'name':_0x1e3b5c[_0x6f68('0x35')],'type':_0x1e3b5c[_0x6f68('0x36')][_0x6f68('0x37')]};});_0x262d4c[_0x6f68('0x38')]=_[_0x6f68('0x33')](_0x408808,_0x6f68('0x30'));_0x262d4c[_0x6f68('0x39')]=_['keys'](_0xa7f87d[_0x6f68('0x39')]);_0x262d4c['filters']=_[_0x6f68('0x3a')](_0x262d4c[_0x6f68('0x38')],_0x262d4c['query']);_0x13df79[_0x6f68('0x3b')]=_[_0x6f68('0x3a')](_0x262d4c['model'],qs[_0x6f68('0x3c')](_0xa7f87d[_0x6f68('0x39')][_0x6f68('0x3c')]));_0x13df79[_0x6f68('0x3b')]=_0x13df79[_0x6f68('0x3b')][_0x6f68('0x3d')]?_0x13df79[_0x6f68('0x3b')]:_0x262d4c[_0x6f68('0x38')];if(!_0xa7f87d['query'][_0x6f68('0x3e')](_0x6f68('0x3f'))){_0x13df79['limit']=qs[_0x6f68('0x2a')](_0xa7f87d[_0x6f68('0x39')]['limit']);_0x13df79[_0x6f68('0x40')]=qs['offset'](_0xa7f87d['query'][_0x6f68('0x40')]);}_0x13df79[_0x6f68('0x41')]=qs[_0x6f68('0x42')](_0xa7f87d[_0x6f68('0x39')][_0x6f68('0x42')]);_0x13df79[_0x6f68('0x43')]=qs[_0x6f68('0x44')](_[_0x6f68('0x45')](_0xa7f87d['query'],_0x262d4c[_0x6f68('0x44')]),_0x408808);if(_0xa7f87d[_0x6f68('0x39')][_0x6f68('0x46')]){_0x13df79[_0x6f68('0x43')]=_[_0x6f68('0x47')](_0x13df79[_0x6f68('0x43')],{'$or':_[_0x6f68('0x33')](_0x408808,function(_0x46ef8e){if(_0x46ef8e['type']!=='VIRTUAL'){var _0x3de439={};_0x3de439[_0x46ef8e[_0x6f68('0x30')]]={'$like':'%'+_0xa7f87d[_0x6f68('0x39')][_0x6f68('0x46')]+'%'};return _0x3de439;}})});}_0x13df79=_[_0x6f68('0x47')]({},_0x13df79,_0xa7f87d['options']);var _0x152769={'where':_0x13df79['where']};return db[_0x6f68('0x34')][_0x6f68('0x29')](_0x152769)[_0x6f68('0x1d')](function(_0x49cf20){_0xcb6e45[_0x6f68('0x29')]=_0x49cf20;if(_0xa7f87d[_0x6f68('0x39')][_0x6f68('0x48')]){_0x13df79[_0x6f68('0x49')]=[{'all':!![]}];}return db[_0x6f68('0x34')][_0x6f68('0x4a')](_0x13df79);})['then'](function(_0x3f9e1c){_0xcb6e45[_0x6f68('0x4b')]=_0x3f9e1c;return _0xcb6e45;})[_0x6f68('0x1d')](respondWithFilteredResult(_0x676ac4,_0x13df79))[_0x6f68('0x4c')](handleError(_0x676ac4,null));};exports[_0x6f68('0x4d')]=function(_0x439da1,_0x352f9a){var _0x256cf5={'raw':![],'where':{'id':_0x439da1[_0x6f68('0x4e')]['id']}},_0x4ebf4c={};_0x4ebf4c[_0x6f68('0x38')]=_['keys'](db['SugarcrmAccount']['rawAttributes']);_0x4ebf4c[_0x6f68('0x39')]=_[_0x6f68('0x4f')](_0x439da1[_0x6f68('0x39')]);_0x4ebf4c['filters']=_['intersection'](_0x4ebf4c[_0x6f68('0x38')],_0x4ebf4c[_0x6f68('0x39')]);_0x256cf5[_0x6f68('0x3b')]=_[_0x6f68('0x3a')](_0x4ebf4c['model'],qs[_0x6f68('0x3c')](_0x439da1[_0x6f68('0x39')][_0x6f68('0x3c')]));_0x256cf5[_0x6f68('0x3b')]=_0x256cf5[_0x6f68('0x3b')][_0x6f68('0x3d')]?_0x256cf5[_0x6f68('0x3b')]:_0x4ebf4c[_0x6f68('0x38')];if(_0x439da1[_0x6f68('0x39')]['includeAll']){_0x256cf5[_0x6f68('0x49')]=[{'all':!![]}];}_0x256cf5=_[_0x6f68('0x47')]({},_0x256cf5,_0x439da1[_0x6f68('0x50')]);return db['SugarcrmAccount'][_0x6f68('0x51')](_0x256cf5)[_0x6f68('0x1d')](handleEntityNotFound(_0x352f9a,null))[_0x6f68('0x1d')](respondWithResult(_0x352f9a,null))[_0x6f68('0x4c')](handleError(_0x352f9a,null));};exports[_0x6f68('0x52')]=function(_0x5335af,_0x4b39b5){return db[_0x6f68('0x34')][_0x6f68('0x52')](_0x5335af[_0x6f68('0x53')],{})[_0x6f68('0x1d')](respondWithResult(_0x4b39b5,0xc9))[_0x6f68('0x4c')](handleError(_0x4b39b5,null));};exports[_0x6f68('0x2e')]=function(_0x1c8a6b,_0x557eba){if(_0x1c8a6b[_0x6f68('0x53')]['id']){delete _0x1c8a6b[_0x6f68('0x53')]['id'];}return db[_0x6f68('0x34')]['find']({'where':{'id':_0x1c8a6b[_0x6f68('0x4e')]['id']}})[_0x6f68('0x1d')](handleEntityNotFound(_0x557eba,null))[_0x6f68('0x1d')](saveUpdates(_0x1c8a6b[_0x6f68('0x53')],null))['then'](respondWithResult(_0x557eba,null))['catch'](handleError(_0x557eba,null));};exports[_0x6f68('0x2f')]=function(_0x1a53d2,_0x2baf90){return db['SugarcrmAccount'][_0x6f68('0x51')]({'where':{'id':_0x1a53d2[_0x6f68('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2baf90,null))['then'](removeEntity(_0x2baf90,null))['catch'](handleError(_0x2baf90,null));};exports[_0x6f68('0x54')]=function(_0x347067,_0x6e5c2c,_0xaffc40){var _0x2fa340={};var _0x56b010={};var _0x49b42a;var _0x7c5d45;return db[_0x6f68('0x34')]['findOne']({'where':{'id':_0x347067[_0x6f68('0x4e')]['id']}})['then'](handleEntityNotFound(_0x6e5c2c,null))['then'](function(_0x39c36d){if(_0x39c36d){_0x49b42a=_0x39c36d;_0x56b010[_0x6f68('0x38')]=_['keys'](db['SugarcrmConfiguration'][_0x6f68('0x55')]);_0x56b010[_0x6f68('0x39')]=_[_0x6f68('0x4f')](_0x347067[_0x6f68('0x39')]);_0x56b010['filters']=_[_0x6f68('0x3a')](_0x56b010[_0x6f68('0x38')],_0x56b010[_0x6f68('0x39')]);_0x2fa340['attributes']=_[_0x6f68('0x3a')](_0x56b010[_0x6f68('0x38')],qs[_0x6f68('0x3c')](_0x347067[_0x6f68('0x39')][_0x6f68('0x3c')]));_0x2fa340[_0x6f68('0x3b')]=_0x2fa340[_0x6f68('0x3b')][_0x6f68('0x3d')]?_0x2fa340['attributes']:_0x56b010['model'];_0x2fa340[_0x6f68('0x41')]=qs[_0x6f68('0x42')](_0x347067[_0x6f68('0x39')][_0x6f68('0x42')]);_0x2fa340[_0x6f68('0x43')]=qs[_0x6f68('0x44')](_['pick'](_0x347067['query'],_0x56b010[_0x6f68('0x44')]));if(_0x347067[_0x6f68('0x39')][_0x6f68('0x46')]){_0x2fa340['where']=_[_0x6f68('0x47')](_0x2fa340[_0x6f68('0x43')],{'$or':_[_0x6f68('0x33')](_0x2fa340[_0x6f68('0x3b')],function(_0x5520c4){var _0x57a7f6={};_0x57a7f6[_0x5520c4]={'$like':'%'+_0x347067[_0x6f68('0x39')][_0x6f68('0x46')]+'%'};return _0x57a7f6;})});}_0x2fa340=_[_0x6f68('0x47')]({},_0x2fa340,_0x347067[_0x6f68('0x50')]);return _0x49b42a[_0x6f68('0x54')](_0x2fa340);}})[_0x6f68('0x1d')](function(_0x58203f){if(_0x58203f){_0x7c5d45=_0x58203f[_0x6f68('0x3d')];if(!_0x347067[_0x6f68('0x39')][_0x6f68('0x3e')](_0x6f68('0x3f'))){_0x2fa340[_0x6f68('0x2a')]=qs[_0x6f68('0x2a')](_0x347067['query'][_0x6f68('0x2a')]);_0x2fa340[_0x6f68('0x40')]=qs[_0x6f68('0x40')](_0x347067[_0x6f68('0x39')][_0x6f68('0x40')]);}return _0x49b42a[_0x6f68('0x54')](_0x2fa340);}})[_0x6f68('0x1d')](function(_0x50b978){if(_0x50b978){return _0x50b978?{'count':_0x7c5d45,'rows':_0x50b978}:null;}})[_0x6f68('0x1d')](respondWithResult(_0x6e5c2c,null))[_0x6f68('0x4c')](handleError(_0x6e5c2c,null));};exports[_0x6f68('0x56')]=function(_0x738a8e,_0x4003ee,_0x190446){if(_0x738a8e[_0x6f68('0x53')]['id']){delete _0x738a8e[_0x6f68('0x53')]['id'];}return db['SugarcrmAccount'][_0x6f68('0x57')]({'where':{'id':_0x738a8e['params']['id']}})[_0x6f68('0x1d')](handleEntityNotFound(_0x4003ee,null))[_0x6f68('0x1d')](function(_0x2df2a2){if(_0x2df2a2){_0x738a8e['body'][_0x6f68('0x58')]=_0x2df2a2['id'];_0x738a8e[_0x6f68('0x53')]['Subjects']=integrations['getSubjects'](_0x738a8e['body'][_0x6f68('0x59')],_0x738a8e[_0x6f68('0x53')][_0x6f68('0x36')]);_0x738a8e[_0x6f68('0x53')][_0x6f68('0x5a')]=integrations[_0x6f68('0x5b')](_0x738a8e[_0x6f68('0x53')][_0x6f68('0x59')],_0x738a8e['body'][_0x6f68('0x36')]);return db[_0x6f68('0x5c')][_0x6f68('0x52')](_0x738a8e[_0x6f68('0x53')],{'include':[{'model':db[_0x6f68('0x5d')],'as':_0x6f68('0x5e')},{'model':db[_0x6f68('0x5d')],'as':_0x6f68('0x5a')}]});}return null;})[_0x6f68('0x1d')](respondWithResult(_0x4003ee,null))[_0x6f68('0x4c')](handleError(_0x4003ee,null));};exports['getFields']=function(_0x5b7308,_0x55ecf6,_0x3c237a){var _0x1c8899='';var _0x122f84=['id',_0x6f68('0x30'),_0x6f68('0x5f'),_0x6f68('0x60'),_0x6f68('0x61'),_0x6f68('0x62'),_0x6f68('0x63'),_0x6f68('0x64'),_0x6f68('0x65'),_0x6f68('0x66'),_0x6f68('0x67'),_0x6f68('0x68')];return db[_0x6f68('0x34')]['findOne']({'where':{'id':_0x5b7308[_0x6f68('0x4e')]['id']},'attributes':['id',_0x6f68('0x69'),'password',_0x6f68('0x6a')]})[_0x6f68('0x1d')](handleEntityNotFound(_0x55ecf6,null))[_0x6f68('0x1d')](function(_0x37186e){if(_0x37186e){_0x1c8899=_0x37186e[_0x6f68('0x6a')];var _0x5efcfb=_0x1c8899[_0x6f68('0x6b')](-0x1);if(_0x5efcfb==='/'){_0x1c8899=_0x1c8899[_0x6f68('0x6c')](0x0,_0x1c8899[_0x6f68('0x6d')](_0x5efcfb));}return rp({'method':_0x6f68('0x6e'),'uri':util[_0x6f68('0x6f')](_0x6f68('0x70'),_0x1c8899,_0x6f68('0x71')),'json':!![],'form':{'method':'login','input_type':_0x6f68('0x72'),'response_type':_0x6f68('0x72'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x37186e[_0x6f68('0x69')],'password':_0x37186e[_0x6f68('0x73')],'encryption':_0x6f68('0x74')},'application':_0x6f68('0x75')})}});}})[_0x6f68('0x1d')](function(_0x2be017){if(_0x2be017&&_0x2be017['name']!==_0x6f68('0x76')&&_0x2be017[_0x6f68('0x30')]!==_0x6f68('0x77')){return rp({'method':_0x6f68('0x6e'),'uri':util['format'](_0x6f68('0x70'),_0x1c8899,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x6f68('0x78'),'input_type':_0x6f68('0x72'),'response_type':_0x6f68('0x72'),'rest_data':JSON[_0x6f68('0x79')]({'session':_0x2be017['id'],'module_name':_0x6f68('0x7a')})}})[_0x6f68('0x1d')](function(_0x3324f8){if(_0x3324f8){var _0xa55f93=_[_0x6f68('0x7b')](_0x3324f8['module_fields']);_[_0x6f68('0x7c')](_0xa55f93,function(_0x31ae99){return _0x122f84['includes'](_0x31ae99[_0x6f68('0x30')]);});return{'count':_0xa55f93[_0x6f68('0x3d')],'rows':_[_0x6f68('0x33')](_0xa55f93,function(_0x3f852e){return{'id':_0x3f852e[_0x6f68('0x30')],'name':_0x3f852e[_0x6f68('0x7d')],'custom':_['endsWith'](_0x3f852e['name'],'_c')?!![]:![],'options':_0x3f852e['options']?_[_0x6f68('0x33')](_[_0x6f68('0x7b')](_0x3f852e[_0x6f68('0x50')]),function(_0x15059b){return{'name':_0x15059b['value'],'value':_0x15059b['name']};}):[]};})};}})[_0x6f68('0x1d')](respondWithResult(_0x55ecf6,null))[_0x6f68('0x4c')](function(_0xc988e9){var _0x2d1a95=_0x5b7308[_0x6f68('0x39')][_0x6f68('0x7e')]?0x1f4:_0xc988e9['statusCode']||0x1f4;logger[_0x6f68('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x6f68('0x7f'),_0x2d1a95,JSON[_0x6f68('0x79')](_0xc988e9));delete _0xc988e9[_0x6f68('0x30')];if(_0x2d1a95===0x191){_0x2d1a95=0x190;}_0x55ecf6[_0x6f68('0x26')](_0x2d1a95)[_0x6f68('0x31')](_0x5b7308[_0x6f68('0x39')][_0x6f68('0x7e')]?{'message':_0x6f68('0x80'),'statusCode':_0xc988e9['statusCode']}:_0xc988e9);});}else{var _0x83dfcf=0x1f4;_0x55ecf6['status'](_0x83dfcf)['send']({'message':_0x6f68('0x80'),'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 80d3872..99e529e 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 _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 +var _0xbd55=['exports','define','util','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration'];(function(_0x182b7d,_0x416e33){var _0x4f3e12=function(_0x595fde){while(--_0x595fde){_0x182b7d['push'](_0x182b7d['shift']());}};_0x4f3e12(++_0x416e33);}(_0xbd55,0xff));var _0x5bd5=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0xbd55[_0x366e75];return _0x3b167b;};'use strict';var _=require('lodash');var util=require(_0x5bd5('0x0'));var logger=require('../../config/logger')(_0x5bd5('0x1'));var moment=require(_0x5bd5('0x2'));var BPromise=require(_0x5bd5('0x3'));var rp=require(_0x5bd5('0x4'));var fs=require('fs');var path=require(_0x5bd5('0x5'));var rimraf=require(_0x5bd5('0x6'));var config=require('../../config/environment');var attributes=require(_0x5bd5('0x7'));var integrations=require(_0x5bd5('0x8'));module[_0x5bd5('0x9')]=function(_0x14b6be,_0x447b48){return _0x14b6be[_0x5bd5('0xa')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 0c1ad84..a67fa8c 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 _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 +var _0xa3a3=['error','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','include','model','map','then','debug','ShowSugarcrmAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x22c60c,_0x135bc1){var _0x4a0f31=function(_0x406ec9){while(--_0x406ec9){_0x22c60c['push'](_0x22c60c['shift']());}};_0x4a0f31(++_0x135bc1);}(_0xa3a3,0xc1));var _0x3a3a=function(_0x2f5e9c,_0x50149d){_0x2f5e9c=_0x2f5e9c-0x0;var _0x104e08=_0xa3a3[_0x2f5e9c];return _0x104e08;};'use strict';var _=require(_0x3a3a('0x0'));var util=require(_0x3a3a('0x1'));var moment=require(_0x3a3a('0x2'));var BPromise=require(_0x3a3a('0x3'));var rs=require(_0x3a3a('0x4'));var fs=require('fs');var Redis=require(_0x3a3a('0x5'));var db=require(_0x3a3a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a3a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a3a('0x8'));var client=jayson[_0x3a3a('0x9')][_0x3a3a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52a62a,_0x40753d,_0x102ebb){return new BPromise(function(_0x1f62e8,_0x519a74){return client[_0x3a3a('0xb')](_0x52a62a,_0x102ebb)['then'](function(_0x2dc3e0){logger[_0x3a3a('0xc')](_0x3a3a('0xd'),_0x40753d,'request\x20sent');logger['debug'](_0x3a3a('0xe'),_0x40753d,_0x3a3a('0xf'),JSON[_0x3a3a('0x10')](_0x2dc3e0));if(_0x2dc3e0[_0x3a3a('0x11')]){if(_0x2dc3e0[_0x3a3a('0x11')]['code']===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x40753d,_0x2dc3e0[_0x3a3a('0x11')][_0x3a3a('0x12')]);return _0x519a74(_0x2dc3e0[_0x3a3a('0x11')][_0x3a3a('0x12')]);}logger[_0x3a3a('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x40753d,_0x2dc3e0[_0x3a3a('0x11')][_0x3a3a('0x12')]);return _0x1f62e8(_0x2dc3e0[_0x3a3a('0x11')]['message']);}else{logger[_0x3a3a('0xc')](_0x3a3a('0xd'),_0x40753d,_0x3a3a('0xf'));_0x1f62e8(_0x2dc3e0[_0x3a3a('0x13')][_0x3a3a('0x12')]);}})[_0x3a3a('0x14')](function(_0x5e7275){logger[_0x3a3a('0x11')](_0x3a3a('0xd'),_0x40753d,_0x5e7275);_0x519a74(_0x5e7275);});});}exports[_0x3a3a('0x15')]=function(_0x5f298f){var _0x3b3886=this;return new Promise(function(_0x1935c7,_0x14ea54){return db[_0x3a3a('0x16')][_0x3a3a('0x17')]({'raw':_0x5f298f[_0x3a3a('0x18')]?_0x5f298f[_0x3a3a('0x18')][_0x3a3a('0x19')]===undefined?!![]:![]:!![],'where':_0x5f298f['options']?_0x5f298f[_0x3a3a('0x18')]['where']||null:null,'attributes':_0x5f298f[_0x3a3a('0x18')]?_0x5f298f['options'][_0x3a3a('0x1a')]||null:null,'limit':_0x5f298f['options']?_0x5f298f[_0x3a3a('0x18')][_0x3a3a('0x1b')]||null:null,'include':_0x5f298f[_0x3a3a('0x18')]?_0x5f298f[_0x3a3a('0x18')][_0x3a3a('0x1c')]?_['map'](_0x5f298f[_0x3a3a('0x18')][_0x3a3a('0x1c')],function(_0x30529a){return{'model':db[_0x30529a[_0x3a3a('0x1d')]],'as':_0x30529a['as'],'attributes':_0x30529a[_0x3a3a('0x1a')],'include':_0x30529a[_0x3a3a('0x1c')]?_['map'](_0x30529a['include'],function(_0x59266b){return{'model':db[_0x59266b[_0x3a3a('0x1d')]],'as':_0x59266b['as'],'attributes':_0x59266b[_0x3a3a('0x1a')],'include':_0x59266b[_0x3a3a('0x1c')]?_[_0x3a3a('0x1e')](_0x59266b['include'],function(_0x5ea9c4){return{'model':db[_0x5ea9c4['model']],'as':_0x5ea9c4['as'],'attributes':_0x5ea9c4[_0x3a3a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3a3a('0x1f')](function(_0x5d77b4){logger[_0x3a3a('0xc')](_0x3a3a('0x15'),_0x5f298f);logger[_0x3a3a('0x20')]('GetSugarcrmAccount',_0x5f298f,JSON['stringify'](_0x5d77b4));_0x1935c7(_0x5d77b4);})[_0x3a3a('0x14')](function(_0x4362e0){logger['error'](_0x3a3a('0x15'),_0x4362e0[_0x3a3a('0x12')],_0x5f298f);_0x14ea54(_0x3b3886[_0x3a3a('0x11')](0x1f4,_0x4362e0[_0x3a3a('0x12')]));});});};exports[_0x3a3a('0x21')]=function(_0x247dce){var _0x55c3fe=this;return new Promise(function(_0x22a0de,_0x149fc9){return db[_0x3a3a('0x16')]['find']({'raw':_0x247dce[_0x3a3a('0x18')]?_0x247dce[_0x3a3a('0x18')][_0x3a3a('0x19')]===undefined?!![]:![]:!![],'where':_0x247dce['options']?_0x247dce[_0x3a3a('0x18')][_0x3a3a('0x22')]||null:null,'attributes':_0x247dce[_0x3a3a('0x18')]?_0x247dce['options'][_0x3a3a('0x1a')]||null:null,'include':_0x247dce['options']?_0x247dce['options']['include']?_[_0x3a3a('0x1e')](_0x247dce['options'][_0x3a3a('0x1c')],function(_0x55209d){return{'model':db[_0x55209d[_0x3a3a('0x1d')]],'as':_0x55209d['as'],'attributes':_0x55209d[_0x3a3a('0x1a')],'include':_0x55209d[_0x3a3a('0x1c')]?_[_0x3a3a('0x1e')](_0x55209d[_0x3a3a('0x1c')],function(_0x318315){return{'model':db[_0x318315[_0x3a3a('0x1d')]],'as':_0x318315['as'],'attributes':_0x318315['attributes'],'include':_0x318315['include']?_[_0x3a3a('0x1e')](_0x318315[_0x3a3a('0x1c')],function(_0x39631f){return{'model':db[_0x39631f[_0x3a3a('0x1d')]],'as':_0x39631f['as'],'attributes':_0x39631f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x246b68){logger[_0x3a3a('0xc')](_0x3a3a('0x21'),_0x247dce);logger['debug'](_0x3a3a('0x21'),_0x247dce,JSON[_0x3a3a('0x10')](_0x246b68));_0x22a0de(_0x246b68);})[_0x3a3a('0x14')](function(_0x100060){logger['error'](_0x3a3a('0x21'),_0x100060['message'],_0x247dce);_0x149fc9(_0x55c3fe['error'](0x1f4,_0x100060[_0x3a3a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 29c1d16..4e24e0e 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 _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 +var _0x9115=['getFields','getSubjects','/:id/descriptions','post','create','put','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0xdb5551,_0x5821ae){var _0x49e771=function(_0x34befc){while(--_0x34befc){_0xdb5551['push'](_0xdb5551['shift']());}};_0x49e771(++_0x5821ae);}(_0x9115,0xd8));var _0x5911=function(_0x8e9386,_0x3cc60f){_0x8e9386=_0x8e9386-0x0;var _0x4abf26=_0x9115[_0x8e9386];return _0x4abf26;};'use strict';var multer=require(_0x5911('0x0'));var util=require(_0x5911('0x1'));var path=require(_0x5911('0x2'));var timeout=require(_0x5911('0x3'));var express=require(_0x5911('0x4'));var router=express[_0x5911('0x5')]();var auth=require(_0x5911('0x6'));var interaction=require(_0x5911('0x7'));var config=require(_0x5911('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x5911('0x9')]('/',auth[_0x5911('0xa')](),controller[_0x5911('0xb')]);router['get'](_0x5911('0xc'),auth[_0x5911('0xa')](),controller[_0x5911('0xd')]);router['get'](_0x5911('0xe'),auth[_0x5911('0xa')](),controller[_0x5911('0xf')]);router[_0x5911('0x9')]('/:id/subjects',auth[_0x5911('0xa')](),controller[_0x5911('0x10')]);router['get'](_0x5911('0x11'),auth[_0x5911('0xa')](),controller['getDescriptions']);router[_0x5911('0x12')]('/',auth[_0x5911('0xa')](),controller[_0x5911('0x13')]);router[_0x5911('0x14')](_0x5911('0xc'),auth[_0x5911('0xa')](),controller['update']);router['delete'](_0x5911('0xc'),auth['isAuthenticated'](),controller['destroy']);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 f3fd813..ae7a19e 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 _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 +var _0xe70c=['sequelize','exports','STRING'];(function(_0x46c8a7,_0x1405e8){var _0x32ae91=function(_0xaaa12d){while(--_0xaaa12d){_0x46c8a7['push'](_0x46c8a7['shift']());}};_0x32ae91(++_0x1405e8);}(_0xe70c,0x159));var _0xce70=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe70c[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xce70('0x0'));module[_0xce70('0x1')]={'name':{'type':Sequelize[_0xce70('0x2')]},'description':{'type':Sequelize[_0xce70('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 2e3953d..da628b9 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 _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 +var _0x0e25=['bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','count','offset','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','SugarcrmConfiguration','fieldName','key','model','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','show','params','rawAttributes','intersection','find','create','body','findOne','SugarcrmField','length','order','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x155a88,_0x5704df){var _0x49776f=function(_0x5c4a59){while(--_0x5c4a59){_0x155a88['push'](_0x155a88['shift']());}};_0x49776f(++_0x5704df);}(_0x0e25,0x16d));var _0x50e2=function(_0x526191,_0x41acc2){_0x526191=_0x526191-0x0;var _0x20c7fc=_0x0e25[_0x526191];return _0x20c7fc;};'use strict';var pdf=require(_0x50e2('0x0'));var emlformat=require(_0x50e2('0x1'));var rimraf=require(_0x50e2('0x2'));var zipdir=require(_0x50e2('0x3'));var jsonpatch=require(_0x50e2('0x4'));var rp=require(_0x50e2('0x5'));var moment=require(_0x50e2('0x6'));var BPromise=require(_0x50e2('0x7'));var Mustache=require(_0x50e2('0x8'));var util=require(_0x50e2('0x9'));var path=require(_0x50e2('0xa'));var sox=require('sox');var csv=require(_0x50e2('0xb'));var ejs=require(_0x50e2('0xc'));var fs=require('fs');var _=require(_0x50e2('0xd'));var squel=require(_0x50e2('0xe'));var crypto=require(_0x50e2('0xf'));var jsforce=require(_0x50e2('0x10'));var deskjs=require(_0x50e2('0x11'));var toCsv=require(_0x50e2('0xb'));var querystring=require(_0x50e2('0x12'));var Papa=require('papaparse');var Redis=require(_0x50e2('0x13'));var authService=require(_0x50e2('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x50e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x50e2('0x16'))(_0x50e2('0x17'));var utils=require(_0x50e2('0x18'));var config=require(_0x50e2('0x19'));var licenseUtil=require(_0x50e2('0x1a'));var db=require(_0x50e2('0x1b'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x50e2('0x1c')][_0x50e2('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4af3cb,_0xaaa1d7,_0x5280f0,_0x450e6f){return new BPromise(function(_0x175052,_0x30f090){var _0x340bce=_0x450e6f||client;return _0x340bce[_0x50e2('0x1e')](_0x4af3cb,_0x5280f0)[_0x50e2('0x1f')](function(_0x1683e3){logger[_0x50e2('0x20')](_0x50e2('0x21'),_0xaaa1d7,_0x50e2('0x22'));logger['debug'](_0x50e2('0x23'),_0xaaa1d7,_0x50e2('0x22'),JSON[_0x50e2('0x24')](_0x1683e3));if(_0x1683e3['error']){if(_0x1683e3[_0x50e2('0x25')]['code']===0x1f4){logger['error'](_0x50e2('0x21'),_0xaaa1d7,_0x1683e3['error'][_0x50e2('0x26')]);return _0x30f090(_0x1683e3[_0x50e2('0x25')]['message']);}logger[_0x50e2('0x25')](_0x50e2('0x21'),_0xaaa1d7,_0x1683e3['error'][_0x50e2('0x26')]);return _0x175052(_0x1683e3['error'][_0x50e2('0x26')]);}else{logger['info'](_0x50e2('0x21'),_0xaaa1d7,_0x50e2('0x22'));_0x175052(_0x1683e3[_0x50e2('0x27')][_0x50e2('0x26')]);}})[_0x50e2('0x28')](function(_0x1288ec){logger['error'](_0x50e2('0x21'),_0xaaa1d7,_0x1288ec);_0x30f090(_0x1288ec);});});}function respondWithStatusCode(_0x4f67fd,_0x365b23){_0x365b23=_0x365b23||0xcc;return function(_0x45bffe){if(_0x45bffe){return _0x4f67fd[_0x50e2('0x29')](_0x365b23);}return _0x4f67fd[_0x50e2('0x2a')](_0x365b23)['end']();};}function respondWithResult(_0x5db2ae,_0x23867a){_0x23867a=_0x23867a||0xc8;return function(_0x2c7574){if(_0x2c7574){return _0x5db2ae[_0x50e2('0x2a')](_0x23867a)[_0x50e2('0x2b')](_0x2c7574);}};}function respondWithFilteredResult(_0x132198,_0x5c5e28){return function(_0x469ea9){if(_0x469ea9){var _0x5e3fe1=_0x469ea9[_0x50e2('0x2c')],_0xaeb5a7=_0x5c5e28[_0x50e2('0x2d')],_0x22b669=_0x5c5e28[_0x50e2('0x2d')]+_0x5c5e28['limit'],_0x2d735f;if(_0x22b669>=_0x5e3fe1){_0x22b669=_0x5e3fe1;_0x2d735f=0xc8;}else{_0x2d735f=0xce;}_0x132198[_0x50e2('0x2a')](_0x2d735f);return _0x132198[_0x50e2('0x2e')]('Content-Range',_0xaeb5a7+'-'+_0x22b669+'/'+_0x5e3fe1)[_0x50e2('0x2b')](_0x469ea9);}return null;};}function patchUpdates(_0x402648){return function(_0x2badce){try{jsonpatch[_0x50e2('0x2f')](_0x2badce,_0x402648,!![]);}catch(_0x2f6dfb){return BPromise[_0x50e2('0x30')](_0x2f6dfb);}return _0x2badce[_0x50e2('0x31')]();};}function saveUpdates(_0x51722e,_0x4c5072){return function(_0x3d097d){if(_0x3d097d){return _0x3d097d[_0x50e2('0x32')](_0x51722e)[_0x50e2('0x1f')](function(_0x1ae9b8){return _0x1ae9b8;});}return null;};}function removeEntity(_0x209108,_0x12ef02){return function(_0x15b300){if(_0x15b300){return _0x15b300[_0x50e2('0x33')]()[_0x50e2('0x1f')](function(){_0x209108[_0x50e2('0x2a')](0xcc)[_0x50e2('0x34')]();});}};}function handleEntityNotFound(_0x5ba7c7,_0x925e0e){return function(_0x55a50b){if(!_0x55a50b){_0x5ba7c7[_0x50e2('0x29')](0x194);}return _0x55a50b;};}function handleError(_0x5828a6,_0x14e1c2){_0x14e1c2=_0x14e1c2||0x1f4;return function(_0x4e7477){logger[_0x50e2('0x25')](_0x4e7477[_0x50e2('0x35')]);if(_0x4e7477[_0x50e2('0x36')]){delete _0x4e7477['name'];}_0x5828a6['status'](_0x14e1c2)[_0x50e2('0x37')](_0x4e7477);};}exports[_0x50e2('0x38')]=function(_0x53c947,_0x2579db){var _0x52e991={},_0x108417={},_0x39cf6f={'count':0x0,'rows':[]};var _0xbe1037=_[_0x50e2('0x39')](db[_0x50e2('0x3a')]['rawAttributes'],function(_0x5b110a){return{'name':_0x5b110a[_0x50e2('0x3b')],'type':_0x5b110a['type'][_0x50e2('0x3c')]};});_0x108417[_0x50e2('0x3d')]=_[_0x50e2('0x39')](_0xbe1037,_0x50e2('0x36'));_0x108417[_0x50e2('0x3e')]=_[_0x50e2('0x3f')](_0x53c947[_0x50e2('0x3e')]);_0x108417[_0x50e2('0x40')]=_['intersection'](_0x108417[_0x50e2('0x3d')],_0x108417[_0x50e2('0x3e')]);_0x52e991['attributes']=_['intersection'](_0x108417[_0x50e2('0x3d')],qs[_0x50e2('0x41')](_0x53c947[_0x50e2('0x3e')][_0x50e2('0x41')]));_0x52e991[_0x50e2('0x42')]=_0x52e991['attributes']['length']?_0x52e991['attributes']:_0x108417[_0x50e2('0x3d')];if(!_0x53c947[_0x50e2('0x3e')][_0x50e2('0x43')](_0x50e2('0x44'))){_0x52e991[_0x50e2('0x45')]=qs[_0x50e2('0x45')](_0x53c947[_0x50e2('0x3e')][_0x50e2('0x45')]);_0x52e991[_0x50e2('0x2d')]=qs[_0x50e2('0x2d')](_0x53c947['query'][_0x50e2('0x2d')]);}_0x52e991['order']=qs[_0x50e2('0x46')](_0x53c947[_0x50e2('0x3e')][_0x50e2('0x46')]);_0x52e991[_0x50e2('0x47')]=qs['filters'](_['pick'](_0x53c947[_0x50e2('0x3e')],_0x108417[_0x50e2('0x40')]),_0xbe1037);if(_0x53c947[_0x50e2('0x3e')][_0x50e2('0x48')]){_0x52e991['where']=_[_0x50e2('0x49')](_0x52e991[_0x50e2('0x47')],{'$or':_['map'](_0xbe1037,function(_0x41af44){if(_0x41af44[_0x50e2('0x4a')]!==_0x50e2('0x4b')){var _0x356471={};_0x356471[_0x41af44[_0x50e2('0x36')]]={'$like':'%'+_0x53c947[_0x50e2('0x3e')][_0x50e2('0x48')]+'%'};return _0x356471;}})});}_0x52e991=_['merge']({},_0x52e991,_0x53c947[_0x50e2('0x4c')]);var _0x62723d={'where':_0x52e991[_0x50e2('0x47')]};return db['SugarcrmConfiguration'][_0x50e2('0x2c')](_0x62723d)[_0x50e2('0x1f')](function(_0x390bed){_0x39cf6f[_0x50e2('0x2c')]=_0x390bed;if(_0x53c947[_0x50e2('0x3e')]['includeAll']){_0x52e991[_0x50e2('0x4d')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x50e2('0x4e')](_0x52e991);})[_0x50e2('0x1f')](function(_0x221ed6){_0x39cf6f['rows']=_0x221ed6;return _0x39cf6f;})['then'](respondWithFilteredResult(_0x2579db,_0x52e991))[_0x50e2('0x28')](handleError(_0x2579db,null));};exports[_0x50e2('0x4f')]=function(_0x5c7e86,_0x5d1210){var _0x36f89b={'raw':![],'where':{'id':_0x5c7e86[_0x50e2('0x50')]['id']}},_0x5818e4={};_0x5818e4['model']=_[_0x50e2('0x3f')](db[_0x50e2('0x3a')][_0x50e2('0x51')]);_0x5818e4[_0x50e2('0x3e')]=_[_0x50e2('0x3f')](_0x5c7e86[_0x50e2('0x3e')]);_0x5818e4['filters']=_['intersection'](_0x5818e4['model'],_0x5818e4[_0x50e2('0x3e')]);_0x36f89b[_0x50e2('0x42')]=_[_0x50e2('0x52')](_0x5818e4[_0x50e2('0x3d')],qs[_0x50e2('0x41')](_0x5c7e86[_0x50e2('0x3e')][_0x50e2('0x41')]));_0x36f89b[_0x50e2('0x42')]=_0x36f89b['attributes']['length']?_0x36f89b[_0x50e2('0x42')]:_0x5818e4[_0x50e2('0x3d')];if(_0x5c7e86[_0x50e2('0x3e')]['includeAll']){_0x36f89b[_0x50e2('0x4d')]=[{'all':!![]}];}_0x36f89b=_[_0x50e2('0x49')]({},_0x36f89b,_0x5c7e86[_0x50e2('0x4c')]);return db[_0x50e2('0x3a')][_0x50e2('0x53')](_0x36f89b)[_0x50e2('0x1f')](handleEntityNotFound(_0x5d1210,null))[_0x50e2('0x1f')](respondWithResult(_0x5d1210,null))['catch'](handleError(_0x5d1210,null));};exports[_0x50e2('0x54')]=function(_0x30e00a,_0x3c8848){return db['SugarcrmConfiguration'][_0x50e2('0x54')](_0x30e00a[_0x50e2('0x55')],{})[_0x50e2('0x1f')](respondWithResult(_0x3c8848,0xc9))[_0x50e2('0x28')](handleError(_0x3c8848,null));};exports[_0x50e2('0x32')]=function(_0x5e0fe6,_0x1a8897){if(_0x5e0fe6[_0x50e2('0x55')]['id']){delete _0x5e0fe6[_0x50e2('0x55')]['id'];}return db[_0x50e2('0x3a')]['find']({'where':{'id':_0x5e0fe6[_0x50e2('0x50')]['id']}})[_0x50e2('0x1f')](handleEntityNotFound(_0x1a8897,null))[_0x50e2('0x1f')](saveUpdates(_0x5e0fe6['body'],null))[_0x50e2('0x1f')](respondWithResult(_0x1a8897,null))[_0x50e2('0x28')](handleError(_0x1a8897,null));};exports['destroy']=function(_0x3c03d1,_0x487974){return db['SugarcrmConfiguration'][_0x50e2('0x53')]({'where':{'id':_0x3c03d1['params']['id']}})[_0x50e2('0x1f')](handleEntityNotFound(_0x487974,null))['then'](removeEntity(_0x487974,null))[_0x50e2('0x28')](handleError(_0x487974,null));};exports['getFields']=function(_0x50d8e7,_0x1da1ce,_0x503898){var _0x3eb0ad={};var _0x66027c={};var _0x538ba8;var _0x35cba8;return db['SugarcrmConfiguration'][_0x50e2('0x56')]({'where':{'id':_0x50d8e7[_0x50e2('0x50')]['id']}})[_0x50e2('0x1f')](handleEntityNotFound(_0x1da1ce,null))['then'](function(_0x36d656){if(_0x36d656){_0x538ba8=_0x36d656;_0x66027c[_0x50e2('0x3d')]=_[_0x50e2('0x3f')](db[_0x50e2('0x57')][_0x50e2('0x51')]);_0x66027c[_0x50e2('0x3e')]=_[_0x50e2('0x3f')](_0x50d8e7[_0x50e2('0x3e')]);_0x66027c['filters']=_[_0x50e2('0x52')](_0x66027c[_0x50e2('0x3d')],_0x66027c[_0x50e2('0x3e')]);_0x3eb0ad[_0x50e2('0x42')]=_[_0x50e2('0x52')](_0x66027c['model'],qs[_0x50e2('0x41')](_0x50d8e7[_0x50e2('0x3e')][_0x50e2('0x41')]));_0x3eb0ad['attributes']=_0x3eb0ad['attributes'][_0x50e2('0x58')]?_0x3eb0ad[_0x50e2('0x42')]:_0x66027c['model'];_0x3eb0ad['order']=qs[_0x50e2('0x46')](_0x50d8e7[_0x50e2('0x3e')][_0x50e2('0x46')]);_0x3eb0ad[_0x50e2('0x47')]=qs['filters'](_['pick'](_0x50d8e7['query'],_0x66027c[_0x50e2('0x40')]));if(_0x50d8e7[_0x50e2('0x3e')][_0x50e2('0x48')]){_0x3eb0ad[_0x50e2('0x47')]=_[_0x50e2('0x49')](_0x3eb0ad[_0x50e2('0x47')],{'$or':_[_0x50e2('0x39')](_0x3eb0ad[_0x50e2('0x42')],function(_0x4f81fd){var _0x1b5b18={};_0x1b5b18[_0x4f81fd]={'$like':'%'+_0x50d8e7[_0x50e2('0x3e')][_0x50e2('0x48')]+'%'};return _0x1b5b18;})});}_0x3eb0ad=_[_0x50e2('0x49')]({},_0x3eb0ad,_0x50d8e7[_0x50e2('0x4c')]);return _0x538ba8['getFields'](_0x3eb0ad);}})[_0x50e2('0x1f')](function(_0x509b2f){if(_0x509b2f){_0x35cba8=_0x509b2f[_0x50e2('0x58')];if(!_0x50d8e7[_0x50e2('0x3e')]['hasOwnProperty'](_0x50e2('0x44'))){_0x3eb0ad[_0x50e2('0x45')]=qs[_0x50e2('0x45')](_0x50d8e7[_0x50e2('0x3e')][_0x50e2('0x45')]);_0x3eb0ad['offset']=qs[_0x50e2('0x2d')](_0x50d8e7[_0x50e2('0x3e')][_0x50e2('0x2d')]);}return _0x538ba8['getFields'](_0x3eb0ad);}})[_0x50e2('0x1f')](function(_0x559b74){if(_0x559b74){return _0x559b74?{'count':_0x35cba8,'rows':_0x559b74}:null;}})[_0x50e2('0x1f')](respondWithResult(_0x1da1ce,null))[_0x50e2('0x28')](handleError(_0x1da1ce,null));};exports['getSubjects']=function(_0x47ec6a,_0x51a2c6,_0x5c2a86){var _0x1950ef={};var _0x224afa={};var _0x1aa571;var _0x23368a;return db[_0x50e2('0x3a')]['findOne']({'where':{'id':_0x47ec6a[_0x50e2('0x50')]['id']}})['then'](handleEntityNotFound(_0x51a2c6,null))[_0x50e2('0x1f')](function(_0x507325){if(_0x507325){_0x1aa571=_0x507325;_0x224afa['model']=_[_0x50e2('0x3f')](db[_0x50e2('0x57')][_0x50e2('0x51')]);_0x224afa[_0x50e2('0x3e')]=_['keys'](_0x47ec6a[_0x50e2('0x3e')]);_0x224afa[_0x50e2('0x40')]=_[_0x50e2('0x52')](_0x224afa['model'],_0x224afa['query']);_0x1950ef['attributes']=_['intersection'](_0x224afa[_0x50e2('0x3d')],qs[_0x50e2('0x41')](_0x47ec6a[_0x50e2('0x3e')]['fields']));_0x1950ef[_0x50e2('0x42')]=_0x1950ef[_0x50e2('0x42')]['length']?_0x1950ef[_0x50e2('0x42')]:_0x224afa['model'];_0x1950ef[_0x50e2('0x59')]=qs[_0x50e2('0x46')](_0x47ec6a[_0x50e2('0x3e')][_0x50e2('0x46')]);_0x1950ef['where']=qs['filters'](_[_0x50e2('0x5a')](_0x47ec6a[_0x50e2('0x3e')],_0x224afa['filters']));if(_0x47ec6a['query']['filter']){_0x1950ef[_0x50e2('0x47')]=_[_0x50e2('0x49')](_0x1950ef[_0x50e2('0x47')],{'$or':_['map'](_0x1950ef[_0x50e2('0x42')],function(_0x5b4cf8){var _0x5143e7={};_0x5143e7[_0x5b4cf8]={'$like':'%'+_0x47ec6a[_0x50e2('0x3e')][_0x50e2('0x48')]+'%'};return _0x5143e7;})});}_0x1950ef=_[_0x50e2('0x49')]({},_0x1950ef,_0x47ec6a[_0x50e2('0x4c')]);return _0x1aa571[_0x50e2('0x5b')](_0x1950ef);}})[_0x50e2('0x1f')](function(_0x451421){if(_0x451421){_0x23368a=_0x451421[_0x50e2('0x58')];if(!_0x47ec6a[_0x50e2('0x3e')][_0x50e2('0x43')](_0x50e2('0x44'))){_0x1950ef[_0x50e2('0x45')]=qs[_0x50e2('0x45')](_0x47ec6a['query'][_0x50e2('0x45')]);_0x1950ef[_0x50e2('0x2d')]=qs[_0x50e2('0x2d')](_0x47ec6a[_0x50e2('0x3e')][_0x50e2('0x2d')]);}return _0x1aa571['getSubjects'](_0x1950ef);}})['then'](function(_0x519513){if(_0x519513){return _0x519513?{'count':_0x23368a,'rows':_0x519513}:null;}})[_0x50e2('0x1f')](respondWithResult(_0x51a2c6,null))['catch'](handleError(_0x51a2c6,null));};exports[_0x50e2('0x5c')]=function(_0x1e1917,_0x157f16,_0x1e0e18){var _0x18e2b5={};var _0x5cdccc={};var _0x3d8fb2;var _0x16bcdf;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x1e1917[_0x50e2('0x50')]['id']}})['then'](handleEntityNotFound(_0x157f16,null))[_0x50e2('0x1f')](function(_0xde9c74){if(_0xde9c74){_0x3d8fb2=_0xde9c74;_0x5cdccc[_0x50e2('0x3d')]=_[_0x50e2('0x3f')](db['SugarcrmField']['rawAttributes']);_0x5cdccc[_0x50e2('0x3e')]=_[_0x50e2('0x3f')](_0x1e1917['query']);_0x5cdccc[_0x50e2('0x40')]=_[_0x50e2('0x52')](_0x5cdccc[_0x50e2('0x3d')],_0x5cdccc[_0x50e2('0x3e')]);_0x18e2b5[_0x50e2('0x42')]=_[_0x50e2('0x52')](_0x5cdccc['model'],qs['fields'](_0x1e1917[_0x50e2('0x3e')][_0x50e2('0x41')]));_0x18e2b5[_0x50e2('0x42')]=_0x18e2b5[_0x50e2('0x42')][_0x50e2('0x58')]?_0x18e2b5[_0x50e2('0x42')]:_0x5cdccc[_0x50e2('0x3d')];_0x18e2b5[_0x50e2('0x59')]=qs['sort'](_0x1e1917['query'][_0x50e2('0x46')]);_0x18e2b5['where']=qs[_0x50e2('0x40')](_['pick'](_0x1e1917[_0x50e2('0x3e')],_0x5cdccc[_0x50e2('0x40')]));if(_0x1e1917[_0x50e2('0x3e')]['filter']){_0x18e2b5['where']=_['merge'](_0x18e2b5[_0x50e2('0x47')],{'$or':_[_0x50e2('0x39')](_0x18e2b5[_0x50e2('0x42')],function(_0x3dc348){var _0xccfa67={};_0xccfa67[_0x3dc348]={'$like':'%'+_0x1e1917['query'][_0x50e2('0x48')]+'%'};return _0xccfa67;})});}_0x18e2b5=_['merge']({},_0x18e2b5,_0x1e1917[_0x50e2('0x4c')]);return _0x3d8fb2[_0x50e2('0x5c')](_0x18e2b5);}})[_0x50e2('0x1f')](function(_0x38a5e0){if(_0x38a5e0){_0x16bcdf=_0x38a5e0[_0x50e2('0x58')];if(!_0x1e1917[_0x50e2('0x3e')][_0x50e2('0x43')](_0x50e2('0x44'))){_0x18e2b5[_0x50e2('0x45')]=qs['limit'](_0x1e1917[_0x50e2('0x3e')][_0x50e2('0x45')]);_0x18e2b5[_0x50e2('0x2d')]=qs[_0x50e2('0x2d')](_0x1e1917[_0x50e2('0x3e')]['offset']);}return _0x3d8fb2[_0x50e2('0x5c')](_0x18e2b5);}})['then'](function(_0x1c3b22){if(_0x1c3b22){return _0x1c3b22?{'count':_0x16bcdf,'rows':_0x1c3b22}:null;}})['then'](respondWithResult(_0x157f16,null))[_0x50e2('0x28')](handleError(_0x157f16,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index a1ea5aa..d956d23 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 _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 +var _0xb798=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration'];(function(_0x4dcac4,_0x10e48a){var _0x2a238d=function(_0x25c6fc){while(--_0x25c6fc){_0x4dcac4['push'](_0x4dcac4['shift']());}};_0x2a238d(++_0x10e48a);}(_0xb798,0xa5));var _0x8b79=function(_0x19ec1d,_0x113527){_0x19ec1d=_0x19ec1d-0x0;var _0x8f68a1=_0xb798[_0x19ec1d];return _0x8f68a1;};'use strict';var _=require('lodash');var util=require(_0x8b79('0x0'));var logger=require(_0x8b79('0x1'))(_0x8b79('0x2'));var moment=require(_0x8b79('0x3'));var BPromise=require(_0x8b79('0x4'));var rp=require(_0x8b79('0x5'));var fs=require('fs');var path=require(_0x8b79('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b79('0x7'));module[_0x8b79('0x8')]=function(_0x4e07db,_0xf81661){return _0x4e07db[_0x8b79('0x9')](_0x8b79('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 2166d6d..7f39fc7 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 _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 +var _0x2a3c=['then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x1d6e12,_0x5ac3b5){var _0x1d8187=function(_0x54e55b){while(--_0x54e55b){_0x1d6e12['push'](_0x1d6e12['shift']());}};_0x1d8187(++_0x5ac3b5);}(_0x2a3c,0x79));var _0xc2a3=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x2a3c[_0x2576d7];return _0x16a08c;};'use strict';var _=require(_0xc2a3('0x0'));var util=require('util');var moment=require(_0xc2a3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2a3('0x2'));var db=require(_0xc2a3('0x3'))['db'];var utils=require(_0xc2a3('0x4'));var logger=require(_0xc2a3('0x5'))(_0xc2a3('0x6'));var config=require('../../config/environment');var jayson=require(_0xc2a3('0x7'));var client=jayson[_0xc2a3('0x8')][_0xc2a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8e8cc5,_0x46b444,_0x18b61f){return new BPromise(function(_0x1aee24,_0x5beab7){return client[_0xc2a3('0xa')](_0x8e8cc5,_0x18b61f)[_0xc2a3('0xb')](function(_0x3c03b7){logger['info'](_0xc2a3('0xc'),_0x46b444,_0xc2a3('0xd'));logger[_0xc2a3('0xe')](_0xc2a3('0xf'),_0x46b444,_0xc2a3('0xd'),JSON[_0xc2a3('0x10')](_0x3c03b7));if(_0x3c03b7[_0xc2a3('0x11')]){if(_0x3c03b7['error'][_0xc2a3('0x12')]===0x1f4){logger[_0xc2a3('0x11')](_0xc2a3('0xc'),_0x46b444,_0x3c03b7['error']['message']);return _0x5beab7(_0x3c03b7[_0xc2a3('0x11')][_0xc2a3('0x13')]);}logger[_0xc2a3('0x11')](_0xc2a3('0xc'),_0x46b444,_0x3c03b7[_0xc2a3('0x11')]['message']);return _0x1aee24(_0x3c03b7[_0xc2a3('0x11')]['message']);}else{logger[_0xc2a3('0x14')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x46b444,_0xc2a3('0xd'));_0x1aee24(_0x3c03b7[_0xc2a3('0x15')][_0xc2a3('0x13')]);}})['catch'](function(_0x34dcd8){logger[_0xc2a3('0x11')](_0xc2a3('0xc'),_0x46b444,_0x34dcd8);_0x5beab7(_0x34dcd8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index d688e24..1ef325a 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 _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 +var _0x19e1=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','show','post','put','update','delete','/:id'];(function(_0x25fdf2,_0x2905d8){var _0x2af508=function(_0xedee7){while(--_0xedee7){_0x25fdf2['push'](_0x25fdf2['shift']());}};_0x2af508(++_0x2905d8);}(_0x19e1,0x81));var _0x119e=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x19e1[_0x2c1dcd];return _0x158ce5;};'use strict';var multer=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x119e('0x2'));var router=express[_0x119e('0x3')]();var auth=require(_0x119e('0x4'));var interaction=require(_0x119e('0x5'));var config=require('../../config/environment');var controller=require(_0x119e('0x6'));router['get']('/',auth[_0x119e('0x7')](),controller[_0x119e('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x119e('0x9')]);router[_0x119e('0xa')]('/',auth[_0x119e('0x7')](),controller['create']);router[_0x119e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x119e('0xc')]);router[_0x119e('0xd')](_0x119e('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x119e('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 8fc47d1..5628784 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 _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 +var _0x1e92=['string','STRING','variable','sequelize','ENUM','customVariable','keyValue'];(function(_0x28ca56,_0xa566e5){var _0x411b7d=function(_0x3e50f2){while(--_0x3e50f2){_0x28ca56['push'](_0x28ca56['shift']());}};_0x411b7d(++_0xa566e5);}(_0x1e92,0x1df));var _0x21e9=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1e92[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x21e9('0x0'));module['exports']={'type':{'type':Sequelize[_0x21e9('0x1')]('string','variable',_0x21e9('0x2'),_0x21e9('0x3')),'defaultValue':_0x21e9('0x4')},'content':{'type':Sequelize[_0x21e9('0x5')]},'key':{'type':Sequelize[_0x21e9('0x5')]},'keyType':{'type':Sequelize[_0x21e9('0x1')](_0x21e9('0x4'),_0x21e9('0x6'),_0x21e9('0x2'))},'keyContent':{'type':Sequelize[_0x21e9('0x5')]},'idField':{'type':Sequelize[_0x21e9('0x5')]},'nameField':{'type':Sequelize[_0x21e9('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x21e9('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index fd37a9d..d029daf 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 _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 +var _0x723e=['catch','show','includeAll','include','find','body','params','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','end','sendStatus','error','stack','name','index','map','rawAttributes','type','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','SugarcrmField','findAll','rows'];(function(_0x3e6912,_0x2184dc){var _0x2837fe=function(_0x47915d){while(--_0x47915d){_0x3e6912['push'](_0x3e6912['shift']());}};_0x2837fe(++_0x2184dc);}(_0x723e,0x179));var _0xe723=function(_0x54f056,_0x10ac46){_0x54f056=_0x54f056-0x0;var _0x195e5f=_0x723e[_0x54f056];return _0x195e5f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe723('0x0'));var rimraf=require(_0xe723('0x1'));var zipdir=require(_0xe723('0x2'));var jsonpatch=require(_0xe723('0x3'));var rp=require(_0xe723('0x4'));var moment=require(_0xe723('0x5'));var BPromise=require(_0xe723('0x6'));var Mustache=require(_0xe723('0x7'));var util=require(_0xe723('0x8'));var path=require(_0xe723('0x9'));var sox=require('sox');var csv=require(_0xe723('0xa'));var ejs=require(_0xe723('0xb'));var fs=require('fs');var _=require(_0xe723('0xc'));var squel=require(_0xe723('0xd'));var crypto=require(_0xe723('0xe'));var jsforce=require(_0xe723('0xf'));var deskjs=require(_0xe723('0x10'));var toCsv=require(_0xe723('0xa'));var querystring=require('querystring');var Papa=require(_0xe723('0x11'));var Redis=require(_0xe723('0x12'));var authService=require(_0xe723('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe723('0x14'));var hardwareService=require(_0xe723('0x15'));var logger=require(_0xe723('0x16'))('api');var utils=require(_0xe723('0x17'));var config=require(_0xe723('0x18'));var licenseUtil=require(_0xe723('0x19'));var db=require(_0xe723('0x1a'))['db'];function respondWithStatusCode(_0x236b69,_0x5c066c){_0x5c066c=_0x5c066c||0xcc;return function(_0x29a1e){if(_0x29a1e){return _0x236b69['sendStatus'](_0x5c066c);}return _0x236b69['status'](_0x5c066c)['end']();};}function respondWithResult(_0x57bc0e,_0x75c12c){_0x75c12c=_0x75c12c||0xc8;return function(_0x30b2ba){if(_0x30b2ba){return _0x57bc0e[_0xe723('0x1b')](_0x75c12c)[_0xe723('0x1c')](_0x30b2ba);}};}function respondWithFilteredResult(_0xf29a39,_0x5aec97){return function(_0x23d0b2){if(_0x23d0b2){var _0xbf5ca3=_0x23d0b2[_0xe723('0x1d')],_0xb8f1d=_0x5aec97[_0xe723('0x1e')],_0x2ec702=_0x5aec97[_0xe723('0x1e')]+_0x5aec97[_0xe723('0x1f')],_0x347fa0;if(_0x2ec702>=_0xbf5ca3){_0x2ec702=_0xbf5ca3;_0x347fa0=0xc8;}else{_0x347fa0=0xce;}_0xf29a39[_0xe723('0x1b')](_0x347fa0);return _0xf29a39[_0xe723('0x20')](_0xe723('0x21'),_0xb8f1d+'-'+_0x2ec702+'/'+_0xbf5ca3)[_0xe723('0x1c')](_0x23d0b2);}return null;};}function patchUpdates(_0x367782){return function(_0x5e8a90){try{jsonpatch['apply'](_0x5e8a90,_0x367782,!![]);}catch(_0x31c839){return BPromise[_0xe723('0x22')](_0x31c839);}return _0x5e8a90['save']();};}function saveUpdates(_0x28caca,_0x2762e2){return function(_0x5a8c73){if(_0x5a8c73){return _0x5a8c73[_0xe723('0x23')](_0x28caca)['then'](function(_0x3296cc){return _0x3296cc;});}return null;};}function removeEntity(_0x43ccfc,_0x3b82b2){return function(_0x1fe43d){if(_0x1fe43d){return _0x1fe43d[_0xe723('0x24')]()[_0xe723('0x25')](function(){_0x43ccfc[_0xe723('0x1b')](0xcc)[_0xe723('0x26')]();});}};}function handleEntityNotFound(_0x1228f2,_0x19bd0c){return function(_0x4a0899){if(!_0x4a0899){_0x1228f2[_0xe723('0x27')](0x194);}return _0x4a0899;};}function handleError(_0x5c4fb4,_0x384786){_0x384786=_0x384786||0x1f4;return function(_0x59f095){logger[_0xe723('0x28')](_0x59f095[_0xe723('0x29')]);if(_0x59f095[_0xe723('0x2a')]){delete _0x59f095[_0xe723('0x2a')];}_0x5c4fb4[_0xe723('0x1b')](_0x384786)['send'](_0x59f095);};}exports[_0xe723('0x2b')]=function(_0x52feb9,_0x52f919){var _0x15911d={},_0x511c74={},_0x3e6bc0={'count':0x0,'rows':[]};var _0x3a475a=_[_0xe723('0x2c')](db['SugarcrmField'][_0xe723('0x2d')],function(_0x45e162){return{'name':_0x45e162['fieldName'],'type':_0x45e162[_0xe723('0x2e')]['key']};});_0x511c74['model']=_[_0xe723('0x2c')](_0x3a475a,_0xe723('0x2a'));_0x511c74[_0xe723('0x2f')]=_[_0xe723('0x30')](_0x52feb9['query']);_0x511c74['filters']=_[_0xe723('0x31')](_0x511c74['model'],_0x511c74[_0xe723('0x2f')]);_0x15911d[_0xe723('0x32')]=_[_0xe723('0x31')](_0x511c74[_0xe723('0x33')],qs[_0xe723('0x34')](_0x52feb9[_0xe723('0x2f')][_0xe723('0x34')]));_0x15911d[_0xe723('0x32')]=_0x15911d[_0xe723('0x32')][_0xe723('0x35')]?_0x15911d[_0xe723('0x32')]:_0x511c74[_0xe723('0x33')];if(!_0x52feb9[_0xe723('0x2f')][_0xe723('0x36')]('nolimit')){_0x15911d[_0xe723('0x1f')]=qs['limit'](_0x52feb9[_0xe723('0x2f')][_0xe723('0x1f')]);_0x15911d['offset']=qs['offset'](_0x52feb9[_0xe723('0x2f')][_0xe723('0x1e')]);}_0x15911d[_0xe723('0x37')]=qs[_0xe723('0x38')](_0x52feb9[_0xe723('0x2f')][_0xe723('0x38')]);_0x15911d['where']=qs[_0xe723('0x39')](_[_0xe723('0x3a')](_0x52feb9[_0xe723('0x2f')],_0x511c74[_0xe723('0x39')]),_0x3a475a);if(_0x52feb9[_0xe723('0x2f')][_0xe723('0x3b')]){_0x15911d[_0xe723('0x3c')]=_[_0xe723('0x3d')](_0x15911d[_0xe723('0x3c')],{'$or':_[_0xe723('0x2c')](_0x3a475a,function(_0x9918d9){if(_0x9918d9[_0xe723('0x2e')]!==_0xe723('0x3e')){var _0x3a7027={};_0x3a7027[_0x9918d9[_0xe723('0x2a')]]={'$like':'%'+_0x52feb9[_0xe723('0x2f')]['filter']+'%'};return _0x3a7027;}})});}_0x15911d=_[_0xe723('0x3d')]({},_0x15911d,_0x52feb9[_0xe723('0x3f')]);var _0x68eda5={'where':_0x15911d[_0xe723('0x3c')]};return db['SugarcrmField']['count'](_0x68eda5)[_0xe723('0x25')](function(_0x3ba6ef){_0x3e6bc0[_0xe723('0x1d')]=_0x3ba6ef;if(_0x52feb9[_0xe723('0x2f')]['includeAll']){_0x15911d['include']=[{'all':!![]}];}return db[_0xe723('0x40')][_0xe723('0x41')](_0x15911d);})[_0xe723('0x25')](function(_0x245512){_0x3e6bc0[_0xe723('0x42')]=_0x245512;return _0x3e6bc0;})[_0xe723('0x25')](respondWithFilteredResult(_0x52f919,_0x15911d))[_0xe723('0x43')](handleError(_0x52f919,null));};exports[_0xe723('0x44')]=function(_0x637b5f,_0x5b0c89){var _0x490993={'raw':!![],'where':{'id':_0x637b5f['params']['id']}},_0x40dd1a={};_0x40dd1a['model']=_[_0xe723('0x30')](db['SugarcrmField'][_0xe723('0x2d')]);_0x40dd1a[_0xe723('0x2f')]=_[_0xe723('0x30')](_0x637b5f[_0xe723('0x2f')]);_0x40dd1a[_0xe723('0x39')]=_[_0xe723('0x31')](_0x40dd1a[_0xe723('0x33')],_0x40dd1a['query']);_0x490993['attributes']=_[_0xe723('0x31')](_0x40dd1a['model'],qs[_0xe723('0x34')](_0x637b5f['query'][_0xe723('0x34')]));_0x490993[_0xe723('0x32')]=_0x490993[_0xe723('0x32')][_0xe723('0x35')]?_0x490993[_0xe723('0x32')]:_0x40dd1a[_0xe723('0x33')];if(_0x637b5f[_0xe723('0x2f')][_0xe723('0x45')]){_0x490993[_0xe723('0x46')]=[{'all':!![]}];}_0x490993=_['merge']({},_0x490993,_0x637b5f['options']);return db[_0xe723('0x40')][_0xe723('0x47')](_0x490993)[_0xe723('0x25')](handleEntityNotFound(_0x5b0c89,null))['then'](respondWithResult(_0x5b0c89,null))['catch'](handleError(_0x5b0c89,null));};exports['create']=function(_0xf25d94,_0x1d9811){return db[_0xe723('0x40')]['create'](_0xf25d94[_0xe723('0x48')],{})[_0xe723('0x25')](respondWithResult(_0x1d9811,0xc9))[_0xe723('0x43')](handleError(_0x1d9811,null));};exports[_0xe723('0x23')]=function(_0x15bfd0,_0x5b0df4){if(_0x15bfd0[_0xe723('0x48')]['id']){delete _0x15bfd0['body']['id'];}return db[_0xe723('0x40')]['find']({'where':{'id':_0x15bfd0['params']['id']}})[_0xe723('0x25')](handleEntityNotFound(_0x5b0df4,null))[_0xe723('0x25')](saveUpdates(_0x15bfd0[_0xe723('0x48')],null))['then'](respondWithResult(_0x5b0df4,null))[_0xe723('0x43')](handleError(_0x5b0df4,null));};exports['destroy']=function(_0x467cbd,_0x2755ea){return db[_0xe723('0x40')][_0xe723('0x47')]({'where':{'id':_0x467cbd[_0xe723('0x49')]['id']}})[_0xe723('0x25')](handleEntityNotFound(_0x2755ea,null))[_0xe723('0x25')](removeEntity(_0x2755ea,null))[_0xe723('0x43')](handleError(_0x2755ea,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 94ba5b1..b609da3 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 _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 +var _0x5e63=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x5e63,0x17d));var _0x35e6=function(_0x1f8cbc,_0x404fad){_0x1f8cbc=_0x1f8cbc-0x0;var _0x26e5d6=_0x5e63[_0x1f8cbc];return _0x26e5d6;};'use strict';var _=require('lodash');var util=require(_0x35e6('0x0'));var logger=require(_0x35e6('0x1'))(_0x35e6('0x2'));var moment=require(_0x35e6('0x3'));var BPromise=require(_0x35e6('0x4'));var rp=require(_0x35e6('0x5'));var fs=require('fs');var path=require(_0x35e6('0x6'));var rimraf=require(_0x35e6('0x7'));var config=require(_0x35e6('0x8'));var attributes=require(_0x35e6('0x9'));module[_0x35e6('0xa')]=function(_0x3416b9,_0x116919){return _0x3416b9[_0x35e6('0xb')](_0x35e6('0xc'),attributes,{'tableName':_0x35e6('0xd'),'paranoid':![],'indexes':[{'name':_0x35e6('0xe'),'fields':['idField','FieldId'],'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 84ecbb8..304095d 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 _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 +var _0x14a0=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x41749a,_0x4106f4){var _0x4c0505=function(_0x31ec93){while(--_0x31ec93){_0x41749a['push'](_0x41749a['shift']());}};_0x4c0505(++_0x4106f4);}(_0x14a0,0x8e));var _0x014a=function(_0x2ce312,_0xbd0755){_0x2ce312=_0x2ce312-0x0;var _0x210f0d=_0x14a0[_0x2ce312];return _0x210f0d;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 99b8a96..24bc103 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 _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 +var _0xba2d=['get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x83af7f,_0x49c6fd){var _0x32d85c=function(_0xf0e8bc){while(--_0xf0e8bc){_0x83af7f['push'](_0x83af7f['shift']());}};_0x32d85c(++_0x49c6fd);}(_0xba2d,0x76));var _0xdba2=function(_0x3d997d,_0x11f13d){_0x3d997d=_0x3d997d-0x0;var _0x1058bb=_0xba2d[_0x3d997d];return _0x1058bb;};'use strict';var multer=require(_0xdba2('0x0'));var util=require(_0xdba2('0x1'));var path=require(_0xdba2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdba2('0x3')]();var auth=require(_0xdba2('0x4'));var interaction=require(_0xdba2('0x5'));var config=require(_0xdba2('0x6'));var controller=require(_0xdba2('0x7'));router[_0xdba2('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdba2('0x8')](_0xdba2('0x9'),auth[_0xdba2('0xa')](),controller[_0xdba2('0xb')]);router['get'](_0xdba2('0xc'),auth[_0xdba2('0xa')](),controller['getConfigurations']);router[_0xdba2('0x8')](_0xdba2('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xdba2('0xe')]('/',auth['isAuthenticated'](),controller[_0xdba2('0xf')]);router[_0xdba2('0xe')](_0xdba2('0xc'),auth[_0xdba2('0xa')](),controller[_0xdba2('0x10')]);router[_0xdba2('0x11')](_0xdba2('0x9'),auth[_0xdba2('0xa')](),controller[_0xdba2('0x12')]);router['delete'](_0xdba2('0x9'),auth[_0xdba2('0xa')](),controller[_0xdba2('0x13')]);module[_0xdba2('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 46ef4a6..cf1783f 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 _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 +var _0x55f9=['exports','STRING','HelpDesk','sequelize'];(function(_0x16cdf2,_0x8ec198){var _0x702347=function(_0x5349fa){while(--_0x5349fa){_0x16cdf2['push'](_0x16cdf2['shift']());}};_0x702347(++_0x8ec198);}(_0x55f9,0x1cf));var _0x955f=function(_0x5a353c,_0x4e3b7a){_0x5a353c=_0x5a353c-0x0;var _0x46c3b8=_0x55f9[_0x5a353c];return _0x46c3b8;};'use strict';var Sequelize=require(_0x955f('0x0'));module[_0x955f('0x1')]={'name':{'type':Sequelize[_0x955f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x955f('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x955f('0x2')],'allowNull':![],'defaultValue':_0x955f('0x3')},'remoteUri':{'type':Sequelize[_0x955f('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x955f('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x955f('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 7f7b5e1..c5a404c 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 _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 +var _0xa801=['nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','body','update','destroy','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','POST','token','describe','sessionName','owner','remove','includes','editable','false','startsWith','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','stringify','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','stack','name','index','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0x27f8f3,_0x400032){var _0x4692c5=function(_0x2cb3d1){while(--_0x2cb3d1){_0x27f8f3['push'](_0x27f8f3['shift']());}};_0x4692c5(++_0x400032);}(_0xa801,0xc5));var _0x1a80=function(_0x329571,_0x3b04da){_0x329571=_0x329571-0x0;var _0x5b44ca=_0xa801[_0x329571];return _0x5b44ca;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1a80('0x0'));var rimraf=require(_0x1a80('0x1'));var zipdir=require(_0x1a80('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1a80('0x3'));var moment=require('moment');var BPromise=require(_0x1a80('0x4'));var Mustache=require(_0x1a80('0x5'));var util=require(_0x1a80('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x1a80('0x7'));var ejs=require(_0x1a80('0x8'));var fs=require('fs');var _=require(_0x1a80('0x9'));var squel=require(_0x1a80('0xa'));var crypto=require(_0x1a80('0xb'));var jsforce=require(_0x1a80('0xc'));var deskjs=require(_0x1a80('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a80('0xe'));var Papa=require(_0x1a80('0xf'));var Redis=require(_0x1a80('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1a80('0x11'));var as=require(_0x1a80('0x12'));var hardwareService=require(_0x1a80('0x13'));var logger=require('../../config/logger')(_0x1a80('0x14'));var utils=require(_0x1a80('0x15'));var config=require(_0x1a80('0x16'));var licenseUtil=require(_0x1a80('0x17'));var db=require(_0x1a80('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x1a80('0x19'));var client=jayson[_0x1a80('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28a8a6,_0x3da245,_0x2680ee,_0xde9773){return new BPromise(function(_0x15508b,_0x7bb88c){var _0x74539c=_0xde9773||client;return _0x74539c['request'](_0x28a8a6,_0x2680ee)[_0x1a80('0x1b')](function(_0x40796f){logger[_0x1a80('0x1c')](_0x1a80('0x1d'),_0x3da245,_0x1a80('0x1e'));logger[_0x1a80('0x1f')](_0x1a80('0x20'),_0x3da245,_0x1a80('0x1e'),JSON['stringify'](_0x40796f));if(_0x40796f[_0x1a80('0x21')]){if(_0x40796f[_0x1a80('0x21')][_0x1a80('0x22')]===0x1f4){logger['error'](_0x1a80('0x1d'),_0x3da245,_0x40796f[_0x1a80('0x21')][_0x1a80('0x23')]);return _0x7bb88c(_0x40796f[_0x1a80('0x21')][_0x1a80('0x23')]);}logger[_0x1a80('0x21')](_0x1a80('0x1d'),_0x3da245,_0x40796f[_0x1a80('0x21')][_0x1a80('0x23')]);return _0x15508b(_0x40796f[_0x1a80('0x21')][_0x1a80('0x23')]);}else{logger[_0x1a80('0x1c')](_0x1a80('0x1d'),_0x3da245,_0x1a80('0x1e'));_0x15508b(_0x40796f[_0x1a80('0x24')]['message']);}})[_0x1a80('0x25')](function(_0x7edc91){logger[_0x1a80('0x21')](_0x1a80('0x1d'),_0x3da245,_0x7edc91);_0x7bb88c(_0x7edc91);});});}function respondWithStatusCode(_0x47fc1d,_0x11bcd3){_0x11bcd3=_0x11bcd3||0xcc;return function(_0x259fb4){if(_0x259fb4){return _0x47fc1d[_0x1a80('0x26')](_0x11bcd3);}return _0x47fc1d[_0x1a80('0x27')](_0x11bcd3)[_0x1a80('0x28')]();};}function respondWithResult(_0x8a373f,_0x3c431a){_0x3c431a=_0x3c431a||0xc8;return function(_0x2e1b35){if(_0x2e1b35){return _0x8a373f['status'](_0x3c431a)[_0x1a80('0x29')](_0x2e1b35);}};}function respondWithFilteredResult(_0x4f21c7,_0x10f968){return function(_0x5e8133){if(_0x5e8133){var _0x3380c8=_0x5e8133[_0x1a80('0x2a')],_0x4ae960=_0x10f968[_0x1a80('0x2b')],_0x89de11=_0x10f968[_0x1a80('0x2b')]+_0x10f968[_0x1a80('0x2c')],_0x376307;if(_0x89de11>=_0x3380c8){_0x89de11=_0x3380c8;_0x376307=0xc8;}else{_0x376307=0xce;}_0x4f21c7['status'](_0x376307);return _0x4f21c7[_0x1a80('0x2d')]('Content-Range',_0x4ae960+'-'+_0x89de11+'/'+_0x3380c8)[_0x1a80('0x29')](_0x5e8133);}return null;};}function patchUpdates(_0x454e21){return function(_0x4d459d){try{jsonpatch[_0x1a80('0x2e')](_0x4d459d,_0x454e21,!![]);}catch(_0x2fa2fb){return BPromise[_0x1a80('0x2f')](_0x2fa2fb);}return _0x4d459d[_0x1a80('0x30')]();};}function saveUpdates(_0x4fd2d3,_0x287d3a){return function(_0x58ac74){if(_0x58ac74){return _0x58ac74['update'](_0x4fd2d3)[_0x1a80('0x1b')](function(_0x1337b1){return _0x1337b1;});}return null;};}function removeEntity(_0x1fd42e,_0xbb89fc){return function(_0x3134c1){if(_0x3134c1){return _0x3134c1['destroy']()['then'](function(){_0x1fd42e[_0x1a80('0x27')](0xcc)[_0x1a80('0x28')]();});}};}function handleEntityNotFound(_0x58e7dc,_0x4c692f){return function(_0x2c1aa0){if(!_0x2c1aa0){_0x58e7dc['sendStatus'](0x194);}return _0x2c1aa0;};}function handleError(_0x5ba632,_0x242470){_0x242470=_0x242470||0x1f4;return function(_0x4744be){logger[_0x1a80('0x21')](_0x4744be[_0x1a80('0x31')]);if(_0x4744be[_0x1a80('0x32')]){delete _0x4744be[_0x1a80('0x32')];}_0x5ba632[_0x1a80('0x27')](_0x242470)['send'](_0x4744be);};}exports[_0x1a80('0x33')]=function(_0x2c9212,_0x2ba0fc){var _0xc6c27f={},_0x311d54={},_0x38c02d={'count':0x0,'rows':[]};var _0x2b14aa=_['map'](db[_0x1a80('0x34')][_0x1a80('0x35')],function(_0x520d5d){return{'name':_0x520d5d[_0x1a80('0x36')],'type':_0x520d5d[_0x1a80('0x37')][_0x1a80('0x38')]};});_0x311d54[_0x1a80('0x39')]=_['map'](_0x2b14aa,'name');_0x311d54[_0x1a80('0x3a')]=_[_0x1a80('0x3b')](_0x2c9212[_0x1a80('0x3a')]);_0x311d54[_0x1a80('0x3c')]=_['intersection'](_0x311d54[_0x1a80('0x39')],_0x311d54[_0x1a80('0x3a')]);_0xc6c27f[_0x1a80('0x3d')]=_['intersection'](_0x311d54['model'],qs[_0x1a80('0x3e')](_0x2c9212[_0x1a80('0x3a')][_0x1a80('0x3e')]));_0xc6c27f[_0x1a80('0x3d')]=_0xc6c27f[_0x1a80('0x3d')][_0x1a80('0x3f')]?_0xc6c27f[_0x1a80('0x3d')]:_0x311d54[_0x1a80('0x39')];if(!_0x2c9212[_0x1a80('0x3a')][_0x1a80('0x40')](_0x1a80('0x41'))){_0xc6c27f[_0x1a80('0x2c')]=qs[_0x1a80('0x2c')](_0x2c9212[_0x1a80('0x3a')][_0x1a80('0x2c')]);_0xc6c27f['offset']=qs[_0x1a80('0x2b')](_0x2c9212[_0x1a80('0x3a')][_0x1a80('0x2b')]);}_0xc6c27f[_0x1a80('0x42')]=qs['sort'](_0x2c9212['query'][_0x1a80('0x43')]);_0xc6c27f['where']=qs[_0x1a80('0x3c')](_[_0x1a80('0x44')](_0x2c9212[_0x1a80('0x3a')],_0x311d54['filters']),_0x2b14aa);if(_0x2c9212[_0x1a80('0x3a')][_0x1a80('0x45')]){_0xc6c27f['where']=_[_0x1a80('0x46')](_0xc6c27f[_0x1a80('0x47')],{'$or':_[_0x1a80('0x48')](_0x2b14aa,function(_0x2b4042){if(_0x2b4042[_0x1a80('0x37')]!==_0x1a80('0x49')){var _0x4b2e3f={};_0x4b2e3f[_0x2b4042[_0x1a80('0x32')]]={'$like':'%'+_0x2c9212[_0x1a80('0x3a')]['filter']+'%'};return _0x4b2e3f;}})});}_0xc6c27f=_[_0x1a80('0x46')]({},_0xc6c27f,_0x2c9212[_0x1a80('0x4a')]);var _0x1b69c7={'where':_0xc6c27f['where']};return db[_0x1a80('0x34')][_0x1a80('0x2a')](_0x1b69c7)['then'](function(_0x59a825){_0x38c02d['count']=_0x59a825;if(_0x2c9212[_0x1a80('0x3a')][_0x1a80('0x4b')]){_0xc6c27f[_0x1a80('0x4c')]=[{'all':!![]}];}return db['VtigerAccount'][_0x1a80('0x4d')](_0xc6c27f);})[_0x1a80('0x1b')](function(_0x48540d){_0x38c02d[_0x1a80('0x4e')]=_0x48540d;return _0x38c02d;})[_0x1a80('0x1b')](respondWithFilteredResult(_0x2ba0fc,_0xc6c27f))[_0x1a80('0x25')](handleError(_0x2ba0fc,null));};exports[_0x1a80('0x4f')]=function(_0x4c7f50,_0x284df5){var _0x36f228={'raw':![],'where':{'id':_0x4c7f50[_0x1a80('0x50')]['id']}},_0x4c8d5e={};_0x4c8d5e[_0x1a80('0x39')]=_[_0x1a80('0x3b')](db[_0x1a80('0x34')][_0x1a80('0x35')]);_0x4c8d5e[_0x1a80('0x3a')]=_[_0x1a80('0x3b')](_0x4c7f50['query']);_0x4c8d5e['filters']=_[_0x1a80('0x51')](_0x4c8d5e[_0x1a80('0x39')],_0x4c8d5e[_0x1a80('0x3a')]);_0x36f228['attributes']=_[_0x1a80('0x51')](_0x4c8d5e['model'],qs[_0x1a80('0x3e')](_0x4c7f50['query']['fields']));_0x36f228[_0x1a80('0x3d')]=_0x36f228[_0x1a80('0x3d')]['length']?_0x36f228[_0x1a80('0x3d')]:_0x4c8d5e['model'];if(_0x4c7f50[_0x1a80('0x3a')][_0x1a80('0x4b')]){_0x36f228[_0x1a80('0x4c')]=[{'all':!![]}];}_0x36f228=_[_0x1a80('0x46')]({},_0x36f228,_0x4c7f50[_0x1a80('0x4a')]);return db[_0x1a80('0x34')][_0x1a80('0x52')](_0x36f228)[_0x1a80('0x1b')](handleEntityNotFound(_0x284df5,null))['then'](respondWithResult(_0x284df5,null))[_0x1a80('0x25')](handleError(_0x284df5,null));};exports['create']=function(_0x485375,_0x30b285){return db[_0x1a80('0x34')]['create'](_0x485375[_0x1a80('0x53')],{})['then'](respondWithResult(_0x30b285,0xc9))['catch'](handleError(_0x30b285,null));};exports[_0x1a80('0x54')]=function(_0x3725a7,_0x3876d7){if(_0x3725a7['body']['id']){delete _0x3725a7[_0x1a80('0x53')]['id'];}return db[_0x1a80('0x34')][_0x1a80('0x52')]({'where':{'id':_0x3725a7[_0x1a80('0x50')]['id']}})['then'](handleEntityNotFound(_0x3876d7,null))[_0x1a80('0x1b')](saveUpdates(_0x3725a7[_0x1a80('0x53')],null))[_0x1a80('0x1b')](respondWithResult(_0x3876d7,null))[_0x1a80('0x25')](handleError(_0x3876d7,null));};exports[_0x1a80('0x55')]=function(_0x50473c,_0x150ee8){return db[_0x1a80('0x34')][_0x1a80('0x52')]({'where':{'id':_0x50473c['params']['id']}})[_0x1a80('0x1b')](handleEntityNotFound(_0x150ee8,null))[_0x1a80('0x1b')](removeEntity(_0x150ee8,null))[_0x1a80('0x25')](handleError(_0x150ee8,null));};exports['getConfigurations']=function(_0x45d94f,_0xbcf37e,_0xb3960c){var _0x11c0b6={};var _0x34c104={};var _0x4a0dd0;var _0x1ffeb9;return db['VtigerAccount'][_0x1a80('0x56')]({'where':{'id':_0x45d94f[_0x1a80('0x50')]['id']}})[_0x1a80('0x1b')](handleEntityNotFound(_0xbcf37e,null))[_0x1a80('0x1b')](function(_0x862fd1){if(_0x862fd1){_0x4a0dd0=_0x862fd1;_0x34c104[_0x1a80('0x39')]=_[_0x1a80('0x3b')](db['VtigerConfiguration'][_0x1a80('0x35')]);_0x34c104['query']=_['keys'](_0x45d94f[_0x1a80('0x3a')]);_0x34c104[_0x1a80('0x3c')]=_[_0x1a80('0x51')](_0x34c104['model'],_0x34c104[_0x1a80('0x3a')]);_0x11c0b6[_0x1a80('0x3d')]=_['intersection'](_0x34c104['model'],qs[_0x1a80('0x3e')](_0x45d94f[_0x1a80('0x3a')][_0x1a80('0x3e')]));_0x11c0b6[_0x1a80('0x3d')]=_0x11c0b6['attributes'][_0x1a80('0x3f')]?_0x11c0b6[_0x1a80('0x3d')]:_0x34c104['model'];_0x11c0b6['order']=qs[_0x1a80('0x43')](_0x45d94f[_0x1a80('0x3a')][_0x1a80('0x43')]);_0x11c0b6[_0x1a80('0x47')]=qs[_0x1a80('0x3c')](_[_0x1a80('0x44')](_0x45d94f[_0x1a80('0x3a')],_0x34c104[_0x1a80('0x3c')]));if(_0x45d94f[_0x1a80('0x3a')][_0x1a80('0x45')]){_0x11c0b6[_0x1a80('0x47')]=_['merge'](_0x11c0b6[_0x1a80('0x47')],{'$or':_[_0x1a80('0x48')](_0x11c0b6[_0x1a80('0x3d')],function(_0x5463cd){var _0x513168={};_0x513168[_0x5463cd]={'$like':'%'+_0x45d94f['query'][_0x1a80('0x45')]+'%'};return _0x513168;})});}_0x11c0b6=_[_0x1a80('0x46')]({},_0x11c0b6,_0x45d94f['options']);return _0x4a0dd0[_0x1a80('0x57')](_0x11c0b6);}})[_0x1a80('0x1b')](function(_0x4eb836){if(_0x4eb836){_0x1ffeb9=_0x4eb836[_0x1a80('0x3f')];if(!_0x45d94f[_0x1a80('0x3a')][_0x1a80('0x40')](_0x1a80('0x41'))){_0x11c0b6['limit']=qs[_0x1a80('0x2c')](_0x45d94f['query']['limit']);_0x11c0b6[_0x1a80('0x2b')]=qs[_0x1a80('0x2b')](_0x45d94f['query'][_0x1a80('0x2b')]);}return _0x4a0dd0[_0x1a80('0x57')](_0x11c0b6);}})[_0x1a80('0x1b')](function(_0x328513){if(_0x328513){return _0x328513?{'count':_0x1ffeb9,'rows':_0x328513}:null;}})[_0x1a80('0x1b')](respondWithResult(_0xbcf37e,null))[_0x1a80('0x25')](handleError(_0xbcf37e,null));};exports[_0x1a80('0x58')]=function(_0x5e12bd,_0xe35db4,_0x1c90b0){if(_0x5e12bd[_0x1a80('0x53')]['id']){delete _0x5e12bd[_0x1a80('0x53')]['id'];}return db[_0x1a80('0x34')][_0x1a80('0x56')]({'where':{'id':_0x5e12bd[_0x1a80('0x50')]['id']}})[_0x1a80('0x1b')](handleEntityNotFound(_0xe35db4,null))[_0x1a80('0x1b')](function(_0x2ba79e){if(_0x2ba79e){_0x5e12bd[_0x1a80('0x53')][_0x1a80('0x59')]=_0x2ba79e['id'];_0x5e12bd[_0x1a80('0x53')][_0x1a80('0x5a')]=integrations[_0x1a80('0x5b')](_0x5e12bd[_0x1a80('0x53')][_0x1a80('0x5c')],_0x5e12bd[_0x1a80('0x53')][_0x1a80('0x37')]);_0x5e12bd['body'][_0x1a80('0x5d')]=integrations[_0x1a80('0x5e')](_0x5e12bd['body']['channel'],_0x5e12bd[_0x1a80('0x53')][_0x1a80('0x37')]);return db['VtigerConfiguration']['create'](_0x5e12bd[_0x1a80('0x53')],{'include':[{'model':db[_0x1a80('0x5f')],'as':_0x1a80('0x5a')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0x1a80('0x1b')](respondWithResult(_0xe35db4,null))[_0x1a80('0x25')](handleError(_0xe35db4,null));};var md5=require(_0x1a80('0x60'));exports[_0x1a80('0x61')]=function(_0x25081a,_0x6632ae,_0x23bb58){var _0x15edba=null;var _0x943da0=null;var _0x2f18aa=null;var _0x30b052=null;var _0x590ecc='';return db[_0x1a80('0x34')][_0x1a80('0x56')]({'where':{'id':_0x25081a[_0x1a80('0x50')]['id']},'attributes':['id',_0x1a80('0x32'),_0x1a80('0x62'),_0x1a80('0x63'),_0x1a80('0x64'),_0x1a80('0x65'),_0x1a80('0x66'),_0x1a80('0x67')]})['then'](handleEntityNotFound(_0x6632ae,null))[_0x1a80('0x1b')](function(_0x359c17){if(_0x359c17){_0x15edba=_0x359c17['username'];_0x943da0=_0x359c17[_0x1a80('0x67')];_0x2f18aa=_0x359c17[_0x1a80('0x64')];_0x590ecc=_0x359c17[_0x1a80('0x65')];var _0x4c995e=_0x590ecc[_0x1a80('0x68')](-0x1);if(_0x4c995e==='/'){_0x590ecc=_0x590ecc[_0x1a80('0x69')](0x0,_0x590ecc[_0x1a80('0x6a')](_0x4c995e));}_0x30b052=util[_0x1a80('0x6b')](_0x1a80('0x6c'),_0x590ecc);var _0x5c4303={'method':_0x1a80('0x6d'),'uri':_0x30b052,'qs':{'operation':_0x1a80('0x6e'),'username':_0x359c17[_0x1a80('0x62')]},'json':!![]};return rp(_0x5c4303);}})[_0x1a80('0x1b')](function(_0x49171b){if(_0x49171b[_0x1a80('0x6f')]){var _0x23cad8={'method':_0x1a80('0x70'),'uri':_0x30b052,'form':{'operation':'login','username':_0x15edba,'accessKey':md5(_0x49171b['result'][_0x1a80('0x71')]+_0x943da0)},'json':!![]};return rp(_0x23cad8);}})[_0x1a80('0x1b')](function(_0x5b4895){if(_0x5b4895[_0x1a80('0x6f')]){var _0x32f120={'method':_0x1a80('0x6d'),'uri':_0x30b052,'qs':{'operation':_0x1a80('0x72'),'username':_0x15edba,'sessionName':_0x5b4895[_0x1a80('0x24')][_0x1a80('0x73')],'elementType':_0x2f18aa},'json':!![]};return rp(_0x32f120);}})[_0x1a80('0x1b')](function(_0x7adeef){if(_0x7adeef[_0x1a80('0x6f')]){var _0x3a5f0a=['autogenerated','reference',_0x1a80('0x74')];_[_0x1a80('0x75')](_0x7adeef['result']['fields'],function(_0x49ab5a){return _0x3a5f0a[_0x1a80('0x76')](_0x49ab5a['type']['name']);});_['remove'](_0x7adeef[_0x1a80('0x24')][_0x1a80('0x3e')],function(_0x34371b){return _0x34371b[_0x1a80('0x77')]===_0x1a80('0x78');});return{'count':_0x7adeef['result'][_0x1a80('0x3e')][_0x1a80('0x3f')],'rows':_[_0x1a80('0x48')](_0x7adeef[_0x1a80('0x24')][_0x1a80('0x3e')],function(_0x4a4941){return{'id':_0x4a4941['name'],'name':_0x4a4941['label'],'custom':_[_0x1a80('0x79')](_0x4a4941[_0x1a80('0x32')],'cf_')?!![]:![],'options':_0x4a4941[_0x1a80('0x37')][_0x1a80('0x32')]===_0x1a80('0x7a')&&_0x4a4941['type'][_0x1a80('0x7b')][_0x1a80('0x3f')]>0x0?_[_0x1a80('0x48')](_0x4a4941['type'][_0x1a80('0x7b')],function(_0x1dce74){return{'name':_0x1dce74[_0x1a80('0x7c')],'value':_0x1dce74[_0x1a80('0x7d')]};}):[]};})};}})['then'](respondWithResult(_0x6632ae,null))[_0x1a80('0x25')](function(_0x31054e){console[_0x1a80('0x7e')](_0x1a80('0x7f')+_0x31054e);var _0x3f262a=_0x25081a[_0x1a80('0x3a')][_0x1a80('0x80')]?0x1f4:_0x31054e['statusCode']||0x1f4;logger[_0x1a80('0x21')]('getFields,\x20%s,\x20%s,\x20%s',_0x1a80('0x61'),_0x3f262a,JSON[_0x1a80('0x81')](_0x31054e));delete _0x31054e[_0x1a80('0x32')];if(_0x3f262a===0x191){_0x3f262a=0x190;}_0x6632ae[_0x1a80('0x27')](_0x3f262a)['send'](_0x25081a[_0x1a80('0x3a')][_0x1a80('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0x31054e[_0x1a80('0x82')]}:_0x31054e);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index f9936a2..a3a328c 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 _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 +var _0x15a6=['define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration'];(function(_0x2700c2,_0x26e039){var _0x484bb=function(_0x1e8222){while(--_0x1e8222){_0x2700c2['push'](_0x2700c2['shift']());}};_0x484bb(++_0x26e039);}(_0x15a6,0x6f));var _0x615a=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x15a6[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x615a('0x0'));var util=require(_0x615a('0x1'));var logger=require(_0x615a('0x2'))('api');var moment=require(_0x615a('0x3'));var BPromise=require('bluebird');var rp=require(_0x615a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x615a('0x5'));var config=require(_0x615a('0x6'));var attributes=require(_0x615a('0x7'));var integrations=require(_0x615a('0x8'));module['exports']=function(_0x3ebed6,_0x56dc77){return _0x3ebed6[_0x615a('0x9')](_0x615a('0xa'),attributes,{'tableName':_0x615a('0xb'),'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 1c1bb13..8c54280 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 _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 +var _0x5adc=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','VtigerAccount','findAll','options','where','attributes','limit','map','include','model','GetVtigerAccount','stringify','find','then','ShowVtigerAccount','debug'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x5adc,0x199));var _0xc5ad=function(_0x20c54b,_0x1f8b43){_0x20c54b=_0x20c54b-0x0;var _0x52d09f=_0x5adc[_0x20c54b];return _0x52d09f;};'use strict';var _=require(_0xc5ad('0x0'));var util=require(_0xc5ad('0x1'));var moment=require(_0xc5ad('0x2'));var BPromise=require(_0xc5ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5ad('0x4'));var db=require(_0xc5ad('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5ad('0x6'))(_0xc5ad('0x7'));var config=require(_0xc5ad('0x8'));var jayson=require(_0xc5ad('0x9'));var client=jayson['client'][_0xc5ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3861f7,_0x4903e9,_0xb9a570){return new BPromise(function(_0x34c0ba,_0x5cd9f7){return client['request'](_0x3861f7,_0xb9a570)['then'](function(_0x5dff17){logger[_0xc5ad('0xb')](_0xc5ad('0xc'),_0x4903e9,_0xc5ad('0xd'));logger['debug'](_0xc5ad('0xe'),_0x4903e9,_0xc5ad('0xd'),JSON['stringify'](_0x5dff17));if(_0x5dff17[_0xc5ad('0xf')]){if(_0x5dff17[_0xc5ad('0xf')][_0xc5ad('0x10')]===0x1f4){logger['error'](_0xc5ad('0xc'),_0x4903e9,_0x5dff17[_0xc5ad('0xf')][_0xc5ad('0x11')]);return _0x5cd9f7(_0x5dff17[_0xc5ad('0xf')]['message']);}logger['error'](_0xc5ad('0xc'),_0x4903e9,_0x5dff17[_0xc5ad('0xf')][_0xc5ad('0x11')]);return _0x34c0ba(_0x5dff17[_0xc5ad('0xf')][_0xc5ad('0x11')]);}else{logger['info'](_0xc5ad('0xc'),_0x4903e9,_0xc5ad('0xd'));_0x34c0ba(_0x5dff17['result'][_0xc5ad('0x11')]);}})['catch'](function(_0x28ae4a){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x4903e9,_0x28ae4a);_0x5cd9f7(_0x28ae4a);});});}exports['GetVtigerAccount']=function(_0xf906b0){var _0x1504de=this;return new Promise(function(_0x53551a,_0x291f52){return db[_0xc5ad('0x12')][_0xc5ad('0x13')]({'raw':_0xf906b0[_0xc5ad('0x14')]?_0xf906b0[_0xc5ad('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0xf906b0[_0xc5ad('0x14')]?_0xf906b0[_0xc5ad('0x14')][_0xc5ad('0x15')]||null:null,'attributes':_0xf906b0[_0xc5ad('0x14')]?_0xf906b0['options'][_0xc5ad('0x16')]||null:null,'limit':_0xf906b0[_0xc5ad('0x14')]?_0xf906b0[_0xc5ad('0x14')][_0xc5ad('0x17')]||null:null,'include':_0xf906b0[_0xc5ad('0x14')]?_0xf906b0[_0xc5ad('0x14')]['include']?_[_0xc5ad('0x18')](_0xf906b0[_0xc5ad('0x14')][_0xc5ad('0x19')],function(_0x5c1e62){return{'model':db[_0x5c1e62['model']],'as':_0x5c1e62['as'],'attributes':_0x5c1e62[_0xc5ad('0x16')],'include':_0x5c1e62[_0xc5ad('0x19')]?_[_0xc5ad('0x18')](_0x5c1e62['include'],function(_0x2d8539){return{'model':db[_0x2d8539[_0xc5ad('0x1a')]],'as':_0x2d8539['as'],'attributes':_0x2d8539['attributes'],'include':_0x2d8539['include']?_[_0xc5ad('0x18')](_0x2d8539[_0xc5ad('0x19')],function(_0xb331c6){return{'model':db[_0xb331c6[_0xc5ad('0x1a')]],'as':_0xb331c6['as'],'attributes':_0xb331c6[_0xc5ad('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4de5cc){logger[_0xc5ad('0xb')]('GetVtigerAccount',_0xf906b0);logger['debug'](_0xc5ad('0x1b'),_0xf906b0,JSON[_0xc5ad('0x1c')](_0x4de5cc));_0x53551a(_0x4de5cc);})['catch'](function(_0xdb5254){logger[_0xc5ad('0xf')](_0xc5ad('0x1b'),_0xdb5254[_0xc5ad('0x11')],_0xf906b0);_0x291f52(_0x1504de[_0xc5ad('0xf')](0x1f4,_0xdb5254[_0xc5ad('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x289be6){var _0x46fc45=this;return new Promise(function(_0x40482a,_0x263631){return db['VtigerAccount'][_0xc5ad('0x1d')]({'raw':_0x289be6[_0xc5ad('0x14')]?_0x289be6[_0xc5ad('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x289be6[_0xc5ad('0x14')]?_0x289be6[_0xc5ad('0x14')][_0xc5ad('0x15')]||null:null,'attributes':_0x289be6['options']?_0x289be6[_0xc5ad('0x14')][_0xc5ad('0x16')]||null:null,'include':_0x289be6[_0xc5ad('0x14')]?_0x289be6[_0xc5ad('0x14')][_0xc5ad('0x19')]?_[_0xc5ad('0x18')](_0x289be6[_0xc5ad('0x14')][_0xc5ad('0x19')],function(_0x5e5efa){return{'model':db[_0x5e5efa[_0xc5ad('0x1a')]],'as':_0x5e5efa['as'],'attributes':_0x5e5efa['attributes'],'include':_0x5e5efa[_0xc5ad('0x19')]?_[_0xc5ad('0x18')](_0x5e5efa[_0xc5ad('0x19')],function(_0x2a9bf4){return{'model':db[_0x2a9bf4[_0xc5ad('0x1a')]],'as':_0x2a9bf4['as'],'attributes':_0x2a9bf4[_0xc5ad('0x16')],'include':_0x2a9bf4[_0xc5ad('0x19')]?_[_0xc5ad('0x18')](_0x2a9bf4[_0xc5ad('0x19')],function(_0x1b2be1){return{'model':db[_0x1b2be1[_0xc5ad('0x1a')]],'as':_0x1b2be1['as'],'attributes':_0x1b2be1['attributes']};}):[]};}):[]};}):[]:[]})[_0xc5ad('0x1e')](function(_0x5992ef){logger[_0xc5ad('0xb')](_0xc5ad('0x1f'),_0x289be6);logger[_0xc5ad('0x20')](_0xc5ad('0x1f'),_0x289be6,JSON[_0xc5ad('0x1c')](_0x5992ef));_0x40482a(_0x5992ef);})[_0xc5ad('0x21')](function(_0x41f1fd){logger[_0xc5ad('0xf')](_0xc5ad('0x1f'),_0x41f1fd['message'],_0x289be6);_0x263631(_0x46fc45[_0xc5ad('0xf')](0x1f4,_0x41f1fd['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 1d258cc..039a89b 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(_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 +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x480fb7,_0xda97ba){var _0x54a051=function(_0x13f02b){while(--_0x13f02b){_0x480fb7['push'](_0x480fb7['shift']());}};_0x54a051(++_0xda97ba);}(_0xb10b,0x12a));var _0xbb10=function(_0xb1a4df,_0xad7f78){_0xb1a4df=_0xb1a4df-0x0;var _0x4fbd06=_0xb10b[_0xb1a4df];return _0x4fbd06;};'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['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);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 diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index aaa9038..d0501fb 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 _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 +var _0xfa5d=['STRING','exports'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xfa5d,0xb1));var _0xdfa5=function(_0x223c57,_0x263881){_0x223c57=_0x223c57-0x0;var _0x24f845=_0xfa5d[_0x223c57];return _0x24f845;};'use strict';var Sequelize=require('sequelize');module[_0xdfa5('0x0')]={'name':{'type':Sequelize[_0xdfa5('0x1')]},'description':{'type':Sequelize[_0xdfa5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 8834c90..57877f0 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 _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 +var _0x6778=['client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','message','error','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','map','VIRTUAL','merge','options','includeAll','findAll','params','create','body','catch','update','find','getFields','findOne','VtigerField','hasOwnProperty','pick','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6778,0xea));var _0x8677=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x6778[_0x3a0c4f];return _0x247049;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8677('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8677('0x1'));var rp=require(_0x8677('0x2'));var moment=require(_0x8677('0x3'));var BPromise=require(_0x8677('0x4'));var Mustache=require(_0x8677('0x5'));var util=require('util');var path=require(_0x8677('0x6'));var sox=require(_0x8677('0x7'));var csv=require(_0x8677('0x8'));var ejs=require(_0x8677('0x9'));var fs=require('fs');var _=require(_0x8677('0xa'));var squel=require(_0x8677('0xb'));var crypto=require(_0x8677('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8677('0xd'));var toCsv=require(_0x8677('0x8'));var querystring=require(_0x8677('0xe'));var Papa=require(_0x8677('0xf'));var Redis=require(_0x8677('0x10'));var authService=require(_0x8677('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8677('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8677('0x13'))(_0x8677('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8677('0x15'));var db=require(_0x8677('0x16'))['db'];var jayson=require(_0x8677('0x17'));var client=jayson[_0x8677('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8d38,_0x9b4fef,_0x3a17b1,_0x4268bc){return new BPromise(function(_0x5b4a43,_0x6b75aa){var _0x2ad11e=_0x4268bc||client;return _0x2ad11e[_0x8677('0x19')](_0x4e8d38,_0x3a17b1)[_0x8677('0x1a')](function(_0x5e84a2){logger[_0x8677('0x1b')](_0x8677('0x1c'),_0x9b4fef,_0x8677('0x1d'));logger[_0x8677('0x1e')](_0x8677('0x1f'),_0x9b4fef,'request\x20sent',JSON['stringify'](_0x5e84a2));if(_0x5e84a2['error']){if(_0x5e84a2['error']['code']===0x1f4){logger['error'](_0x8677('0x1c'),_0x9b4fef,_0x5e84a2['error'][_0x8677('0x20')]);return _0x6b75aa(_0x5e84a2[_0x8677('0x21')][_0x8677('0x20')]);}logger[_0x8677('0x21')](_0x8677('0x1c'),_0x9b4fef,_0x5e84a2['error'][_0x8677('0x20')]);return _0x5b4a43(_0x5e84a2[_0x8677('0x21')]['message']);}else{logger[_0x8677('0x1b')](_0x8677('0x1c'),_0x9b4fef,_0x8677('0x1d'));_0x5b4a43(_0x5e84a2[_0x8677('0x22')]['message']);}})['catch'](function(_0x548b45){logger[_0x8677('0x21')](_0x8677('0x1c'),_0x9b4fef,_0x548b45);_0x6b75aa(_0x548b45);});});}function respondWithStatusCode(_0x29d9d3,_0x3e333f){_0x3e333f=_0x3e333f||0xcc;return function(_0x3e1352){if(_0x3e1352){return _0x29d9d3[_0x8677('0x23')](_0x3e333f);}return _0x29d9d3[_0x8677('0x24')](_0x3e333f)[_0x8677('0x25')]();};}function respondWithResult(_0xf9ed53,_0x2a9743){_0x2a9743=_0x2a9743||0xc8;return function(_0x34c427){if(_0x34c427){return _0xf9ed53[_0x8677('0x24')](_0x2a9743)[_0x8677('0x26')](_0x34c427);}};}function respondWithFilteredResult(_0x5c24e5,_0x472c07){return function(_0x422122){if(_0x422122){var _0x16f942=_0x422122[_0x8677('0x27')],_0xbae8fb=_0x472c07[_0x8677('0x28')],_0x49cb5f=_0x472c07[_0x8677('0x28')]+_0x472c07[_0x8677('0x29')],_0x535df7;if(_0x49cb5f>=_0x16f942){_0x49cb5f=_0x16f942;_0x535df7=0xc8;}else{_0x535df7=0xce;}_0x5c24e5[_0x8677('0x24')](_0x535df7);return _0x5c24e5[_0x8677('0x2a')](_0x8677('0x2b'),_0xbae8fb+'-'+_0x49cb5f+'/'+_0x16f942)[_0x8677('0x26')](_0x422122);}return null;};}function patchUpdates(_0x3c809e){return function(_0x17bc9f){try{jsonpatch[_0x8677('0x2c')](_0x17bc9f,_0x3c809e,!![]);}catch(_0x597bec){return BPromise[_0x8677('0x2d')](_0x597bec);}return _0x17bc9f['save']();};}function saveUpdates(_0x29a2cd,_0x5c2620){return function(_0x45f1a9){if(_0x45f1a9){return _0x45f1a9['update'](_0x29a2cd)['then'](function(_0x2ac39e){return _0x2ac39e;});}return null;};}function removeEntity(_0x1bc641,_0x4c9664){return function(_0x58643d){if(_0x58643d){return _0x58643d[_0x8677('0x2e')]()[_0x8677('0x1a')](function(){_0x1bc641['status'](0xcc)[_0x8677('0x25')]();});}};}function handleEntityNotFound(_0x4cda81,_0x301b6d){return function(_0x33906b){if(!_0x33906b){_0x4cda81['sendStatus'](0x194);}return _0x33906b;};}function handleError(_0x370117,_0x230322){_0x230322=_0x230322||0x1f4;return function(_0x1db6bb){logger[_0x8677('0x21')](_0x1db6bb[_0x8677('0x2f')]);if(_0x1db6bb[_0x8677('0x30')]){delete _0x1db6bb[_0x8677('0x30')];}_0x370117[_0x8677('0x24')](_0x230322)['send'](_0x1db6bb);};}exports[_0x8677('0x31')]=function(_0x1012b4,_0x1634a2){var _0x3e13c0={},_0x4257ba={},_0x48f5bb={'count':0x0,'rows':[]};var _0x26de82=_['map'](db[_0x8677('0x32')][_0x8677('0x33')],function(_0x4be5b6){return{'name':_0x4be5b6[_0x8677('0x34')],'type':_0x4be5b6['type'][_0x8677('0x35')]};});_0x4257ba[_0x8677('0x36')]=_['map'](_0x26de82,_0x8677('0x30'));_0x4257ba[_0x8677('0x37')]=_[_0x8677('0x38')](_0x1012b4[_0x8677('0x37')]);_0x4257ba[_0x8677('0x39')]=_[_0x8677('0x3a')](_0x4257ba[_0x8677('0x36')],_0x4257ba['query']);_0x3e13c0[_0x8677('0x3b')]=_['intersection'](_0x4257ba['model'],qs[_0x8677('0x3c')](_0x1012b4[_0x8677('0x37')][_0x8677('0x3c')]));_0x3e13c0['attributes']=_0x3e13c0[_0x8677('0x3b')][_0x8677('0x3d')]?_0x3e13c0[_0x8677('0x3b')]:_0x4257ba[_0x8677('0x36')];if(!_0x1012b4[_0x8677('0x37')]['hasOwnProperty'](_0x8677('0x3e'))){_0x3e13c0[_0x8677('0x29')]=qs[_0x8677('0x29')](_0x1012b4['query'][_0x8677('0x29')]);_0x3e13c0[_0x8677('0x28')]=qs[_0x8677('0x28')](_0x1012b4[_0x8677('0x37')]['offset']);}_0x3e13c0[_0x8677('0x3f')]=qs[_0x8677('0x40')](_0x1012b4[_0x8677('0x37')][_0x8677('0x40')]);_0x3e13c0[_0x8677('0x41')]=qs[_0x8677('0x39')](_['pick'](_0x1012b4[_0x8677('0x37')],_0x4257ba[_0x8677('0x39')]),_0x26de82);if(_0x1012b4[_0x8677('0x37')][_0x8677('0x42')]){_0x3e13c0[_0x8677('0x41')]=_['merge'](_0x3e13c0[_0x8677('0x41')],{'$or':_[_0x8677('0x43')](_0x26de82,function(_0x322718){if(_0x322718['type']!==_0x8677('0x44')){var _0x3374e8={};_0x3374e8[_0x322718[_0x8677('0x30')]]={'$like':'%'+_0x1012b4[_0x8677('0x37')][_0x8677('0x42')]+'%'};return _0x3374e8;}})});}_0x3e13c0=_[_0x8677('0x45')]({},_0x3e13c0,_0x1012b4[_0x8677('0x46')]);var _0x1ba493={'where':_0x3e13c0[_0x8677('0x41')]};return db['VtigerConfiguration'][_0x8677('0x27')](_0x1ba493)[_0x8677('0x1a')](function(_0x4243a8){_0x48f5bb[_0x8677('0x27')]=_0x4243a8;if(_0x1012b4[_0x8677('0x37')][_0x8677('0x47')]){_0x3e13c0['include']=[{'all':!![]}];}return db[_0x8677('0x32')][_0x8677('0x48')](_0x3e13c0);})[_0x8677('0x1a')](function(_0x1617c1){_0x48f5bb['rows']=_0x1617c1;return _0x48f5bb;})[_0x8677('0x1a')](respondWithFilteredResult(_0x1634a2,_0x3e13c0))['catch'](handleError(_0x1634a2,null));};exports['show']=function(_0x316233,_0x1d0863){var _0x3c231d={'raw':![],'where':{'id':_0x316233[_0x8677('0x49')]['id']}},_0x3f8d05={};_0x3f8d05['model']=_[_0x8677('0x38')](db['VtigerConfiguration'][_0x8677('0x33')]);_0x3f8d05[_0x8677('0x37')]=_[_0x8677('0x38')](_0x316233[_0x8677('0x37')]);_0x3f8d05['filters']=_[_0x8677('0x3a')](_0x3f8d05[_0x8677('0x36')],_0x3f8d05[_0x8677('0x37')]);_0x3c231d['attributes']=_[_0x8677('0x3a')](_0x3f8d05[_0x8677('0x36')],qs[_0x8677('0x3c')](_0x316233[_0x8677('0x37')]['fields']));_0x3c231d[_0x8677('0x3b')]=_0x3c231d[_0x8677('0x3b')][_0x8677('0x3d')]?_0x3c231d[_0x8677('0x3b')]:_0x3f8d05['model'];if(_0x316233['query'][_0x8677('0x47')]){_0x3c231d['include']=[{'all':!![]}];}_0x3c231d=_[_0x8677('0x45')]({},_0x3c231d,_0x316233[_0x8677('0x46')]);return db[_0x8677('0x32')]['find'](_0x3c231d)[_0x8677('0x1a')](handleEntityNotFound(_0x1d0863,null))[_0x8677('0x1a')](respondWithResult(_0x1d0863,null))['catch'](handleError(_0x1d0863,null));};exports[_0x8677('0x4a')]=function(_0x563249,_0x4bb7a7){return db[_0x8677('0x32')]['create'](_0x563249[_0x8677('0x4b')],{})['then'](respondWithResult(_0x4bb7a7,0xc9))[_0x8677('0x4c')](handleError(_0x4bb7a7,null));};exports[_0x8677('0x4d')]=function(_0x262667,_0x595750){if(_0x262667['body']['id']){delete _0x262667[_0x8677('0x4b')]['id'];}return db[_0x8677('0x32')][_0x8677('0x4e')]({'where':{'id':_0x262667['params']['id']}})[_0x8677('0x1a')](handleEntityNotFound(_0x595750,null))['then'](saveUpdates(_0x262667['body'],null))[_0x8677('0x1a')](respondWithResult(_0x595750,null))[_0x8677('0x4c')](handleError(_0x595750,null));};exports[_0x8677('0x2e')]=function(_0xdadc34,_0x4cdd01){return db[_0x8677('0x32')][_0x8677('0x4e')]({'where':{'id':_0xdadc34[_0x8677('0x49')]['id']}})[_0x8677('0x1a')](handleEntityNotFound(_0x4cdd01,null))[_0x8677('0x1a')](removeEntity(_0x4cdd01,null))[_0x8677('0x4c')](handleError(_0x4cdd01,null));};exports[_0x8677('0x4f')]=function(_0x276421,_0x20a37c,_0x2dd65d){var _0x1bb129={};var _0x2d7846={};var _0x12be7d;var _0xa9200f;return db[_0x8677('0x32')][_0x8677('0x50')]({'where':{'id':_0x276421[_0x8677('0x49')]['id']}})[_0x8677('0x1a')](handleEntityNotFound(_0x20a37c,null))[_0x8677('0x1a')](function(_0x45489d){if(_0x45489d){_0x12be7d=_0x45489d;_0x2d7846[_0x8677('0x36')]=_[_0x8677('0x38')](db[_0x8677('0x51')][_0x8677('0x33')]);_0x2d7846[_0x8677('0x37')]=_['keys'](_0x276421['query']);_0x2d7846[_0x8677('0x39')]=_['intersection'](_0x2d7846[_0x8677('0x36')],_0x2d7846['query']);_0x1bb129[_0x8677('0x3b')]=_[_0x8677('0x3a')](_0x2d7846[_0x8677('0x36')],qs[_0x8677('0x3c')](_0x276421['query'][_0x8677('0x3c')]));_0x1bb129[_0x8677('0x3b')]=_0x1bb129['attributes'][_0x8677('0x3d')]?_0x1bb129['attributes']:_0x2d7846[_0x8677('0x36')];_0x1bb129['order']=qs['sort'](_0x276421[_0x8677('0x37')]['sort']);_0x1bb129[_0x8677('0x41')]=qs[_0x8677('0x39')](_['pick'](_0x276421[_0x8677('0x37')],_0x2d7846[_0x8677('0x39')]));if(_0x276421[_0x8677('0x37')][_0x8677('0x42')]){_0x1bb129[_0x8677('0x41')]=_[_0x8677('0x45')](_0x1bb129[_0x8677('0x41')],{'$or':_['map'](_0x1bb129[_0x8677('0x3b')],function(_0x1157d7){var _0x2f1066={};_0x2f1066[_0x1157d7]={'$like':'%'+_0x276421[_0x8677('0x37')]['filter']+'%'};return _0x2f1066;})});}_0x1bb129=_['merge']({},_0x1bb129,_0x276421['options']);return _0x12be7d['getFields'](_0x1bb129);}})[_0x8677('0x1a')](function(_0x18cbdb){if(_0x18cbdb){_0xa9200f=_0x18cbdb[_0x8677('0x3d')];if(!_0x276421[_0x8677('0x37')][_0x8677('0x52')](_0x8677('0x3e'))){_0x1bb129['limit']=qs[_0x8677('0x29')](_0x276421[_0x8677('0x37')][_0x8677('0x29')]);_0x1bb129['offset']=qs[_0x8677('0x28')](_0x276421[_0x8677('0x37')]['offset']);}return _0x12be7d['getFields'](_0x1bb129);}})[_0x8677('0x1a')](function(_0x3f5856){if(_0x3f5856){return _0x3f5856?{'count':_0xa9200f,'rows':_0x3f5856}:null;}})[_0x8677('0x1a')](respondWithResult(_0x20a37c,null))[_0x8677('0x4c')](handleError(_0x20a37c,null));};exports['getSubjects']=function(_0x4855a1,_0x19a7ab,_0x14c4cb){var _0x3e9bcb={};var _0x35f788={};var _0x58a5b5;var _0x179267;return db[_0x8677('0x32')][_0x8677('0x50')]({'where':{'id':_0x4855a1[_0x8677('0x49')]['id']}})[_0x8677('0x1a')](handleEntityNotFound(_0x19a7ab,null))[_0x8677('0x1a')](function(_0x2d979e){if(_0x2d979e){_0x58a5b5=_0x2d979e;_0x35f788[_0x8677('0x36')]=_[_0x8677('0x38')](db[_0x8677('0x51')]['rawAttributes']);_0x35f788[_0x8677('0x37')]=_['keys'](_0x4855a1[_0x8677('0x37')]);_0x35f788[_0x8677('0x39')]=_[_0x8677('0x3a')](_0x35f788[_0x8677('0x36')],_0x35f788[_0x8677('0x37')]);_0x3e9bcb[_0x8677('0x3b')]=_[_0x8677('0x3a')](_0x35f788[_0x8677('0x36')],qs[_0x8677('0x3c')](_0x4855a1['query']['fields']));_0x3e9bcb['attributes']=_0x3e9bcb['attributes'][_0x8677('0x3d')]?_0x3e9bcb[_0x8677('0x3b')]:_0x35f788[_0x8677('0x36')];_0x3e9bcb[_0x8677('0x3f')]=qs[_0x8677('0x40')](_0x4855a1['query']['sort']);_0x3e9bcb[_0x8677('0x41')]=qs['filters'](_[_0x8677('0x53')](_0x4855a1[_0x8677('0x37')],_0x35f788['filters']));if(_0x4855a1[_0x8677('0x37')]['filter']){_0x3e9bcb[_0x8677('0x41')]=_[_0x8677('0x45')](_0x3e9bcb[_0x8677('0x41')],{'$or':_['map'](_0x3e9bcb[_0x8677('0x3b')],function(_0x39ee1a){var _0x1d2853={};_0x1d2853[_0x39ee1a]={'$like':'%'+_0x4855a1[_0x8677('0x37')][_0x8677('0x42')]+'%'};return _0x1d2853;})});}_0x3e9bcb=_[_0x8677('0x45')]({},_0x3e9bcb,_0x4855a1[_0x8677('0x46')]);return _0x58a5b5[_0x8677('0x54')](_0x3e9bcb);}})[_0x8677('0x1a')](function(_0x3c3409){if(_0x3c3409){_0x179267=_0x3c3409[_0x8677('0x3d')];if(!_0x4855a1[_0x8677('0x37')][_0x8677('0x52')](_0x8677('0x3e'))){_0x3e9bcb[_0x8677('0x29')]=qs[_0x8677('0x29')](_0x4855a1[_0x8677('0x37')][_0x8677('0x29')]);_0x3e9bcb[_0x8677('0x28')]=qs[_0x8677('0x28')](_0x4855a1[_0x8677('0x37')][_0x8677('0x28')]);}return _0x58a5b5[_0x8677('0x54')](_0x3e9bcb);}})[_0x8677('0x1a')](function(_0xa97e0a){if(_0xa97e0a){return _0xa97e0a?{'count':_0x179267,'rows':_0xa97e0a}:null;}})[_0x8677('0x1a')](respondWithResult(_0x19a7ab,null))[_0x8677('0x4c')](handleError(_0x19a7ab,null));};exports['getDescriptions']=function(_0x2fec87,_0x2ea8b0,_0x2ca506){var _0x1481e8={};var _0x34a4a1={};var _0x2f0a80;var _0x116204;return db[_0x8677('0x32')][_0x8677('0x50')]({'where':{'id':_0x2fec87[_0x8677('0x49')]['id']}})[_0x8677('0x1a')](handleEntityNotFound(_0x2ea8b0,null))['then'](function(_0x1fb9ac){if(_0x1fb9ac){_0x2f0a80=_0x1fb9ac;_0x34a4a1['model']=_[_0x8677('0x38')](db[_0x8677('0x51')][_0x8677('0x33')]);_0x34a4a1[_0x8677('0x37')]=_[_0x8677('0x38')](_0x2fec87[_0x8677('0x37')]);_0x34a4a1[_0x8677('0x39')]=_['intersection'](_0x34a4a1['model'],_0x34a4a1[_0x8677('0x37')]);_0x1481e8[_0x8677('0x3b')]=_['intersection'](_0x34a4a1[_0x8677('0x36')],qs[_0x8677('0x3c')](_0x2fec87[_0x8677('0x37')][_0x8677('0x3c')]));_0x1481e8[_0x8677('0x3b')]=_0x1481e8['attributes']['length']?_0x1481e8[_0x8677('0x3b')]:_0x34a4a1[_0x8677('0x36')];_0x1481e8['order']=qs['sort'](_0x2fec87['query'][_0x8677('0x40')]);_0x1481e8[_0x8677('0x41')]=qs['filters'](_[_0x8677('0x53')](_0x2fec87[_0x8677('0x37')],_0x34a4a1[_0x8677('0x39')]));if(_0x2fec87[_0x8677('0x37')][_0x8677('0x42')]){_0x1481e8[_0x8677('0x41')]=_['merge'](_0x1481e8['where'],{'$or':_[_0x8677('0x43')](_0x1481e8[_0x8677('0x3b')],function(_0x99c419){var _0x572563={};_0x572563[_0x99c419]={'$like':'%'+_0x2fec87['query']['filter']+'%'};return _0x572563;})});}_0x1481e8=_[_0x8677('0x45')]({},_0x1481e8,_0x2fec87[_0x8677('0x46')]);return _0x2f0a80[_0x8677('0x55')](_0x1481e8);}})[_0x8677('0x1a')](function(_0x54aeed){if(_0x54aeed){_0x116204=_0x54aeed[_0x8677('0x3d')];if(!_0x2fec87[_0x8677('0x37')]['hasOwnProperty']('nolimit')){_0x1481e8[_0x8677('0x29')]=qs[_0x8677('0x29')](_0x2fec87['query'][_0x8677('0x29')]);_0x1481e8[_0x8677('0x28')]=qs[_0x8677('0x28')](_0x2fec87[_0x8677('0x37')][_0x8677('0x28')]);}return _0x2f0a80[_0x8677('0x55')](_0x1481e8);}})['then'](function(_0x46e9af){if(_0x46e9af){return _0x46e9af?{'count':_0x116204,'rows':_0x46e9af}:null;}})[_0x8677('0x1a')](respondWithResult(_0x2ea8b0,null))[_0x8677('0x4c')](handleError(_0x2ea8b0,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index ac780e3..1197bcd 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 _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 +var _0x3169=['path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','api','moment','bluebird'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x3169,0x8a));var _0x9316=function(_0x25f39c,_0x4f231a){_0x25f39c=_0x25f39c-0x0;var _0x19bb4a=_0x3169[_0x25f39c];return _0x19bb4a;};'use strict';var _=require('lodash');var util=require(_0x9316('0x0'));var logger=require(_0x9316('0x1'))(_0x9316('0x2'));var moment=require(_0x9316('0x3'));var BPromise=require(_0x9316('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9316('0x5'));var rimraf=require(_0x9316('0x6'));var config=require(_0x9316('0x7'));var attributes=require(_0x9316('0x8'));module[_0x9316('0x9')]=function(_0x137f83,_0x1abfc7){return _0x137f83[_0x9316('0xa')](_0x9316('0xb'),attributes,{'tableName':_0x9316('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 bec380f..46c6987 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 _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 +var _0x535d=['http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x259551,_0x3f26e2){var _0x2db61f=function(_0x443149){while(--_0x443149){_0x259551['push'](_0x259551['shift']());}};_0x2db61f(++_0x3f26e2);}(_0x535d,0x80));var _0xd535=function(_0x25b5c8,_0xb711bc){_0x25b5c8=_0x25b5c8-0x0;var _0x39359b=_0x535d[_0x25b5c8];return _0x39359b;};'use strict';var _=require('lodash');var util=require(_0xd535('0x0'));var moment=require(_0xd535('0x1'));var BPromise=require(_0xd535('0x2'));var rs=require(_0xd535('0x3'));var fs=require('fs');var Redis=require(_0xd535('0x4'));var db=require(_0xd535('0x5'))['db'];var utils=require(_0xd535('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd535('0x7'));var jayson=require(_0xd535('0x8'));var client=jayson[_0xd535('0x9')][_0xd535('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eaf26,_0x47118d,_0x102ab9){return new BPromise(function(_0x46e279,_0x2386f1){return client[_0xd535('0xb')](_0x3eaf26,_0x102ab9)[_0xd535('0xc')](function(_0x55f9ec){logger[_0xd535('0xd')](_0xd535('0xe'),_0x47118d,_0xd535('0xf'));logger[_0xd535('0x10')](_0xd535('0x11'),_0x47118d,_0xd535('0xf'),JSON['stringify'](_0x55f9ec));if(_0x55f9ec['error']){if(_0x55f9ec[_0xd535('0x12')][_0xd535('0x13')]===0x1f4){logger['error'](_0xd535('0xe'),_0x47118d,_0x55f9ec[_0xd535('0x12')]['message']);return _0x2386f1(_0x55f9ec['error'][_0xd535('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x47118d,_0x55f9ec[_0xd535('0x12')][_0xd535('0x14')]);return _0x46e279(_0x55f9ec[_0xd535('0x12')][_0xd535('0x14')]);}else{logger['info'](_0xd535('0xe'),_0x47118d,'request\x20sent');_0x46e279(_0x55f9ec[_0xd535('0x15')][_0xd535('0x14')]);}})[_0xd535('0x16')](function(_0xc435e6){logger[_0xd535('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x47118d,_0xc435e6);_0x2386f1(_0xc435e6);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0abc933..4d9099d 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 _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 +var _0xce9e=['isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x300c5e,_0x13876a){var _0x5b4cc=function(_0x47df3d){while(--_0x47df3d){_0x300c5e['push'](_0x300c5e['shift']());}};_0x5b4cc(++_0x13876a);}(_0xce9e,0x87));var _0xece9=function(_0x1905cc,_0x99e86f){_0x1905cc=_0x1905cc-0x0;var _0x15f952=_0xce9e[_0x1905cc];return _0x15f952;};'use strict';var multer=require(_0xece9('0x0'));var util=require(_0xece9('0x1'));var path=require(_0xece9('0x2'));var timeout=require('connect-timeout');var express=require(_0xece9('0x3'));var router=express[_0xece9('0x4')]();var auth=require(_0xece9('0x5'));var interaction=require(_0xece9('0x6'));var config=require(_0xece9('0x7'));var controller=require('./intVtigerField.controller');router[_0xece9('0x8')]('/',auth[_0xece9('0x9')](),controller[_0xece9('0xa')]);router[_0xece9('0x8')](_0xece9('0xb'),auth[_0xece9('0x9')](),controller['show']);router[_0xece9('0xc')]('/',auth['isAuthenticated'](),controller[_0xece9('0xd')]);router[_0xece9('0xe')]('/:id',auth[_0xece9('0x9')](),controller[_0xece9('0xf')]);router['delete']('/:id',auth[_0xece9('0x9')](),controller[_0xece9('0x10')]);module[_0xece9('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 1a309fb..94dda05 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 _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 +var _0x57d4=['sequelize','exports','string','variable','customVariable','keyValue','STRING','ENUM'];(function(_0x3fcebf,_0x10d452){var _0x1e07ce=function(_0x3a9a27){while(--_0x3a9a27){_0x3fcebf['push'](_0x3fcebf['shift']());}};_0x1e07ce(++_0x10d452);}(_0x57d4,0x78));var _0x457d=function(_0x4c8888,_0x3bda20){_0x4c8888=_0x4c8888-0x0;var _0x250176=_0x57d4[_0x4c8888];return _0x250176;};'use strict';var Sequelize=require(_0x457d('0x0'));module[_0x457d('0x1')]={'type':{'type':Sequelize['ENUM'](_0x457d('0x2'),_0x457d('0x3'),_0x457d('0x4'),_0x457d('0x5')),'defaultValue':_0x457d('0x2')},'content':{'type':Sequelize[_0x457d('0x6')]},'key':{'type':Sequelize[_0x457d('0x6')]},'keyType':{'type':Sequelize[_0x457d('0x7')](_0x457d('0x2'),_0x457d('0x3'),_0x457d('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x457d('0x6')]},'nameField':{'type':Sequelize[_0x457d('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4670bd2..3b7d03e 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 _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 +var _0xf40b=['model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','catch','show','include','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','VtigerField','rawAttributes','type','key'];(function(_0x2febbd,_0x25379c){var _0x3cc3aa=function(_0x37132a){while(--_0x37132a){_0x2febbd['push'](_0x2febbd['shift']());}};_0x3cc3aa(++_0x25379c);}(_0xf40b,0xb0));var _0xbf40=function(_0x38382f,_0x51183d){_0x38382f=_0x38382f-0x0;var _0x152e8b=_0xf40b[_0x38382f];return _0x152e8b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbf40('0x0'));var rimraf=require(_0xbf40('0x1'));var zipdir=require(_0xbf40('0x2'));var jsonpatch=require(_0xbf40('0x3'));var rp=require('request-promise');var moment=require(_0xbf40('0x4'));var BPromise=require(_0xbf40('0x5'));var Mustache=require(_0xbf40('0x6'));var util=require(_0xbf40('0x7'));var path=require(_0xbf40('0x8'));var sox=require('sox');var csv=require(_0xbf40('0x9'));var ejs=require(_0xbf40('0xa'));var fs=require('fs');var _=require(_0xbf40('0xb'));var squel=require(_0xbf40('0xc'));var crypto=require(_0xbf40('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbf40('0xe'));var toCsv=require(_0xbf40('0x9'));var querystring=require(_0xbf40('0xf'));var Papa=require(_0xbf40('0x10'));var Redis=require(_0xbf40('0x11'));var authService=require(_0xbf40('0x12'));var qs=require(_0xbf40('0x13'));var as=require(_0xbf40('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbf40('0x15'))(_0xbf40('0x16'));var utils=require(_0xbf40('0x17'));var config=require(_0xbf40('0x18'));var licenseUtil=require(_0xbf40('0x19'));var db=require(_0xbf40('0x1a'))['db'];function respondWithStatusCode(_0x2417ae,_0x46e5a5){_0x46e5a5=_0x46e5a5||0xcc;return function(_0x52c58c){if(_0x52c58c){return _0x2417ae['sendStatus'](_0x46e5a5);}return _0x2417ae[_0xbf40('0x1b')](_0x46e5a5)[_0xbf40('0x1c')]();};}function respondWithResult(_0x2cecca,_0x106e68){_0x106e68=_0x106e68||0xc8;return function(_0x562346){if(_0x562346){return _0x2cecca[_0xbf40('0x1b')](_0x106e68)[_0xbf40('0x1d')](_0x562346);}};}function respondWithFilteredResult(_0x3965f6,_0x347473){return function(_0x39a323){if(_0x39a323){var _0x203056=_0x39a323[_0xbf40('0x1e')],_0x128f7d=_0x347473[_0xbf40('0x1f')],_0x37ea0c=_0x347473[_0xbf40('0x1f')]+_0x347473[_0xbf40('0x20')],_0x54c517;if(_0x37ea0c>=_0x203056){_0x37ea0c=_0x203056;_0x54c517=0xc8;}else{_0x54c517=0xce;}_0x3965f6[_0xbf40('0x1b')](_0x54c517);return _0x3965f6[_0xbf40('0x21')](_0xbf40('0x22'),_0x128f7d+'-'+_0x37ea0c+'/'+_0x203056)[_0xbf40('0x1d')](_0x39a323);}return null;};}function patchUpdates(_0x5979da){return function(_0x2c8af5){try{jsonpatch[_0xbf40('0x23')](_0x2c8af5,_0x5979da,!![]);}catch(_0x3af762){return BPromise[_0xbf40('0x24')](_0x3af762);}return _0x2c8af5['save']();};}function saveUpdates(_0x46a864,_0x2a4ec7){return function(_0x2c2640){if(_0x2c2640){return _0x2c2640[_0xbf40('0x25')](_0x46a864)[_0xbf40('0x26')](function(_0x23fc5b){return _0x23fc5b;});}return null;};}function removeEntity(_0x275ff1,_0x36aef3){return function(_0x558e1f){if(_0x558e1f){return _0x558e1f[_0xbf40('0x27')]()[_0xbf40('0x26')](function(){_0x275ff1[_0xbf40('0x1b')](0xcc)[_0xbf40('0x1c')]();});}};}function handleEntityNotFound(_0x1471ee,_0x2ead11){return function(_0xadf34b){if(!_0xadf34b){_0x1471ee['sendStatus'](0x194);}return _0xadf34b;};}function handleError(_0x2df7a8,_0x1a4b48){_0x1a4b48=_0x1a4b48||0x1f4;return function(_0x2890e7){logger[_0xbf40('0x28')](_0x2890e7[_0xbf40('0x29')]);if(_0x2890e7[_0xbf40('0x2a')]){delete _0x2890e7[_0xbf40('0x2a')];}_0x2df7a8[_0xbf40('0x1b')](_0x1a4b48)[_0xbf40('0x2b')](_0x2890e7);};}exports[_0xbf40('0x2c')]=function(_0x2faef5,_0x2528f2){var _0x2af9ce={},_0x3db5e7={},_0x4e4dcc={'count':0x0,'rows':[]};var _0x17a29a=_['map'](db[_0xbf40('0x2d')][_0xbf40('0x2e')],function(_0x1b7870){return{'name':_0x1b7870['fieldName'],'type':_0x1b7870[_0xbf40('0x2f')][_0xbf40('0x30')]};});_0x3db5e7[_0xbf40('0x31')]=_['map'](_0x17a29a,_0xbf40('0x2a'));_0x3db5e7['query']=_[_0xbf40('0x32')](_0x2faef5[_0xbf40('0x33')]);_0x3db5e7[_0xbf40('0x34')]=_['intersection'](_0x3db5e7[_0xbf40('0x31')],_0x3db5e7[_0xbf40('0x33')]);_0x2af9ce[_0xbf40('0x35')]=_[_0xbf40('0x36')](_0x3db5e7[_0xbf40('0x31')],qs[_0xbf40('0x37')](_0x2faef5[_0xbf40('0x33')][_0xbf40('0x37')]));_0x2af9ce[_0xbf40('0x35')]=_0x2af9ce['attributes'][_0xbf40('0x38')]?_0x2af9ce[_0xbf40('0x35')]:_0x3db5e7[_0xbf40('0x31')];if(!_0x2faef5[_0xbf40('0x33')]['hasOwnProperty'](_0xbf40('0x39'))){_0x2af9ce['limit']=qs[_0xbf40('0x20')](_0x2faef5[_0xbf40('0x33')][_0xbf40('0x20')]);_0x2af9ce['offset']=qs[_0xbf40('0x1f')](_0x2faef5[_0xbf40('0x33')][_0xbf40('0x1f')]);}_0x2af9ce[_0xbf40('0x3a')]=qs[_0xbf40('0x3b')](_0x2faef5['query'][_0xbf40('0x3b')]);_0x2af9ce[_0xbf40('0x3c')]=qs[_0xbf40('0x34')](_['pick'](_0x2faef5[_0xbf40('0x33')],_0x3db5e7[_0xbf40('0x34')]),_0x17a29a);if(_0x2faef5[_0xbf40('0x33')]['filter']){_0x2af9ce[_0xbf40('0x3c')]=_[_0xbf40('0x3d')](_0x2af9ce[_0xbf40('0x3c')],{'$or':_[_0xbf40('0x3e')](_0x17a29a,function(_0x868fa5){if(_0x868fa5[_0xbf40('0x2f')]!==_0xbf40('0x3f')){var _0x6b404f={};_0x6b404f[_0x868fa5[_0xbf40('0x2a')]]={'$like':'%'+_0x2faef5[_0xbf40('0x33')][_0xbf40('0x40')]+'%'};return _0x6b404f;}})});}_0x2af9ce=_[_0xbf40('0x3d')]({},_0x2af9ce,_0x2faef5[_0xbf40('0x41')]);var _0x356bdc={'where':_0x2af9ce['where']};return db[_0xbf40('0x2d')]['count'](_0x356bdc)[_0xbf40('0x26')](function(_0x17a031){_0x4e4dcc[_0xbf40('0x1e')]=_0x17a031;if(_0x2faef5[_0xbf40('0x33')][_0xbf40('0x42')]){_0x2af9ce['include']=[{'all':!![]}];}return db[_0xbf40('0x2d')][_0xbf40('0x43')](_0x2af9ce);})['then'](function(_0x14f87c){_0x4e4dcc['rows']=_0x14f87c;return _0x4e4dcc;})[_0xbf40('0x26')](respondWithFilteredResult(_0x2528f2,_0x2af9ce))[_0xbf40('0x44')](handleError(_0x2528f2,null));};exports[_0xbf40('0x45')]=function(_0x434d50,_0x761b55){var _0x2d370c={'raw':!![],'where':{'id':_0x434d50['params']['id']}},_0x1a9916={};_0x1a9916[_0xbf40('0x31')]=_[_0xbf40('0x32')](db[_0xbf40('0x2d')][_0xbf40('0x2e')]);_0x1a9916[_0xbf40('0x33')]=_[_0xbf40('0x32')](_0x434d50[_0xbf40('0x33')]);_0x1a9916[_0xbf40('0x34')]=_['intersection'](_0x1a9916[_0xbf40('0x31')],_0x1a9916['query']);_0x2d370c[_0xbf40('0x35')]=_[_0xbf40('0x36')](_0x1a9916[_0xbf40('0x31')],qs[_0xbf40('0x37')](_0x434d50['query']['fields']));_0x2d370c[_0xbf40('0x35')]=_0x2d370c[_0xbf40('0x35')][_0xbf40('0x38')]?_0x2d370c['attributes']:_0x1a9916['model'];if(_0x434d50[_0xbf40('0x33')]['includeAll']){_0x2d370c[_0xbf40('0x46')]=[{'all':!![]}];}_0x2d370c=_['merge']({},_0x2d370c,_0x434d50[_0xbf40('0x41')]);return db[_0xbf40('0x2d')]['find'](_0x2d370c)[_0xbf40('0x26')](handleEntityNotFound(_0x761b55,null))[_0xbf40('0x26')](respondWithResult(_0x761b55,null))['catch'](handleError(_0x761b55,null));};exports['create']=function(_0x1d7bb1,_0x17dc02){return db['VtigerField'][_0xbf40('0x47')](_0x1d7bb1[_0xbf40('0x48')],{})[_0xbf40('0x26')](respondWithResult(_0x17dc02,0xc9))[_0xbf40('0x44')](handleError(_0x17dc02,null));};exports[_0xbf40('0x25')]=function(_0x49fd24,_0x336b09){if(_0x49fd24[_0xbf40('0x48')]['id']){delete _0x49fd24[_0xbf40('0x48')]['id'];}return db[_0xbf40('0x2d')][_0xbf40('0x49')]({'where':{'id':_0x49fd24[_0xbf40('0x4a')]['id']}})[_0xbf40('0x26')](handleEntityNotFound(_0x336b09,null))['then'](saveUpdates(_0x49fd24['body'],null))[_0xbf40('0x26')](respondWithResult(_0x336b09,null))[_0xbf40('0x44')](handleError(_0x336b09,null));};exports['destroy']=function(_0x1df034,_0xe0ee8){return db[_0xbf40('0x2d')]['find']({'where':{'id':_0x1df034[_0xbf40('0x4a')]['id']}})[_0xbf40('0x26')](handleEntityNotFound(_0xe0ee8,null))[_0xbf40('0x26')](removeEntity(_0xe0ee8,null))['catch'](handleError(_0xe0ee8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 12ce2a2..19a39dc 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_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 +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_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 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 e04ae96..551e528 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 _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 +var _0x180d=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x4fadaf,_0x179d85){var _0x4738a8=function(_0x34ce7b){while(--_0x34ce7b){_0x4fadaf['push'](_0x4fadaf['shift']());}};_0x4738a8(++_0x179d85);}(_0x180d,0xf9));var _0xd180=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x180d[_0x2112d4];return _0x434972;};'use strict';var _=require('lodash');var util=require(_0xd180('0x0'));var moment=require(_0xd180('0x1'));var BPromise=require(_0xd180('0x2'));var rs=require(_0xd180('0x3'));var fs=require('fs');var Redis=require(_0xd180('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd180('0x5'));var logger=require(_0xd180('0x6'))(_0xd180('0x7'));var config=require(_0xd180('0x8'));var jayson=require(_0xd180('0x9'));var client=jayson[_0xd180('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56d47d,_0x1751aa,_0xfa20c2){return new BPromise(function(_0x345a39,_0x2bb664){return client[_0xd180('0xb')](_0x56d47d,_0xfa20c2)[_0xd180('0xc')](function(_0x19f7b0){logger[_0xd180('0xd')](_0xd180('0xe'),_0x1751aa,_0xd180('0xf'));logger[_0xd180('0x10')](_0xd180('0x11'),_0x1751aa,_0xd180('0xf'),JSON[_0xd180('0x12')](_0x19f7b0));if(_0x19f7b0['error']){if(_0x19f7b0[_0xd180('0x13')][_0xd180('0x14')]===0x1f4){logger[_0xd180('0x13')](_0xd180('0xe'),_0x1751aa,_0x19f7b0[_0xd180('0x13')]['message']);return _0x2bb664(_0x19f7b0['error'][_0xd180('0x15')]);}logger[_0xd180('0x13')](_0xd180('0xe'),_0x1751aa,_0x19f7b0[_0xd180('0x13')][_0xd180('0x15')]);return _0x345a39(_0x19f7b0[_0xd180('0x13')]['message']);}else{logger['info'](_0xd180('0xe'),_0x1751aa,'request\x20sent');_0x345a39(_0x19f7b0['result'][_0xd180('0x15')]);}})['catch'](function(_0x462a38){logger[_0xd180('0x13')](_0xd180('0xe'),_0x1751aa,_0x462a38);_0x2bb664(_0x462a38);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 9f89e4e..c624a6b 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 _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 +var _0x175e=['show','/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x353a44,_0x573d50){var _0x341a6d=function(_0x218f72){while(--_0x218f72){_0x353a44['push'](_0x353a44['shift']());}};_0x341a6d(++_0x573d50);}(_0x175e,0xe6));var _0xe175=function(_0x4244f8,_0x42dd75){_0x4244f8=_0x4244f8-0x0;var _0x49fd44=_0x175e[_0x4244f8];return _0x49fd44;};'use strict';var multer=require(_0xe175('0x0'));var util=require(_0xe175('0x1'));var path=require(_0xe175('0x2'));var timeout=require(_0xe175('0x3'));var express=require(_0xe175('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe175('0x5'));var config=require(_0xe175('0x6'));var controller=require(_0xe175('0x7'));router[_0xe175('0x8')]('/',auth[_0xe175('0x9')](),controller[_0xe175('0xa')]);router[_0xe175('0x8')](_0xe175('0xb'),auth[_0xe175('0x9')](),controller[_0xe175('0xc')]);router[_0xe175('0x8')](_0xe175('0xd'),auth[_0xe175('0x9')](),controller[_0xe175('0xe')]);router[_0xe175('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xe175('0xf')]);router['post']('/',auth[_0xe175('0x9')](),controller[_0xe175('0x10')]);router[_0xe175('0x11')](_0xe175('0xd'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xe175('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xe175('0x13')]);router[_0xe175('0x14')](_0xe175('0xb'),auth[_0xe175('0x9')](),controller[_0xe175('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0c7a9d3..d73d75a 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 _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 +var _0x22bf=['exports','STRING','remoteUri','ENUM','password','token','newTab','sequelize'];(function(_0x25099c,_0x2588bf){var _0x5f0f01=function(_0x2a5602){while(--_0x2a5602){_0x25099c['push'](_0x25099c['shift']());}};_0x5f0f01(++_0x2588bf);}(_0x22bf,0xbf));var _0xf22b=function(_0x45b4f6,_0x37631c){_0x45b4f6=_0x45b4f6-0x0;var _0x53659f=_0x22bf[_0x45b4f6];return _0x53659f;};'use strict';var Sequelize=require(_0xf22b('0x0'));module[_0xf22b('0x1')]={'name':{'type':Sequelize[_0xf22b('0x2')]},'description':{'type':Sequelize[_0xf22b('0x2')]},'username':{'type':Sequelize[_0xf22b('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xf22b('0x2')]},'token':{'type':Sequelize[_0xf22b('0x2')]},'remoteUri':{'type':Sequelize[_0xf22b('0x2')],'unique':_0xf22b('0x3')},'authType':{'type':Sequelize[_0xf22b('0x4')](_0xf22b('0x5'),_0xf22b('0x6')),'defaultValue':_0xf22b('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf22b('0x4')]('integrationTab',_0xf22b('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 514b36f..a6198d2 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 _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 +var _0xc5c0=['../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','ZendeskAccount','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','length','include','create','body','find','getConfigurations','ZendeskConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','findOne','username','password','remoteUri','substring','lastIndexOf','GET','format','ticket_fields','authType','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x248066,_0x1d8def){_0x248066=_0x248066-0x0;var _0xdbbd4f=_0xc5c0[_0x248066];return _0xdbbd4f;};'use strict';var pdf=require(_0x0c5c('0x0'));var emlformat=require(_0x0c5c('0x1'));var rimraf=require(_0x0c5c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0c5c('0x3'));var moment=require(_0x0c5c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0c5c('0x5'));var util=require(_0x0c5c('0x6'));var path=require(_0x0c5c('0x7'));var sox=require(_0x0c5c('0x8'));var csv=require(_0x0c5c('0x9'));var ejs=require(_0x0c5c('0xa'));var fs=require('fs');var _=require(_0x0c5c('0xb'));var squel=require('squel');var crypto=require(_0x0c5c('0xc'));var jsforce=require(_0x0c5c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0c5c('0x9'));var querystring=require(_0x0c5c('0xe'));var Papa=require(_0x0c5c('0xf'));var Redis=require(_0x0c5c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0c5c('0x11'));var as=require(_0x0c5c('0x12'));var hardwareService=require(_0x0c5c('0x13'));var logger=require(_0x0c5c('0x14'))(_0x0c5c('0x15'));var utils=require('../../config/utils');var config=require(_0x0c5c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c5c('0x17'))['db'];var integrations=require(_0x0c5c('0x18'));var jayson=require(_0x0c5c('0x19'));var client=jayson[_0x0c5c('0x1a')][_0x0c5c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x1d18f3,_0x2ef42f,_0x35a896,_0x30f123){return new BPromise(function(_0x35e7e3,_0x57288a){var _0x1c6916=_0x30f123||client;return _0x1c6916['request'](_0x1d18f3,_0x35a896)['then'](function(_0x375e9d){logger[_0x0c5c('0x1c')]('ZendeskAccount,\x20%s,\x20%s',_0x2ef42f,_0x0c5c('0x1d'));logger['debug'](_0x0c5c('0x1e'),_0x2ef42f,_0x0c5c('0x1d'),JSON[_0x0c5c('0x1f')](_0x375e9d));if(_0x375e9d['error']){if(_0x375e9d[_0x0c5c('0x20')][_0x0c5c('0x21')]===0x1f4){logger[_0x0c5c('0x20')](_0x0c5c('0x22'),_0x2ef42f,_0x375e9d['error'][_0x0c5c('0x23')]);return _0x57288a(_0x375e9d[_0x0c5c('0x20')][_0x0c5c('0x23')]);}logger[_0x0c5c('0x20')](_0x0c5c('0x22'),_0x2ef42f,_0x375e9d[_0x0c5c('0x20')][_0x0c5c('0x23')]);return _0x35e7e3(_0x375e9d[_0x0c5c('0x20')]['message']);}else{logger[_0x0c5c('0x1c')](_0x0c5c('0x22'),_0x2ef42f,_0x0c5c('0x1d'));_0x35e7e3(_0x375e9d[_0x0c5c('0x24')][_0x0c5c('0x23')]);}})[_0x0c5c('0x25')](function(_0x4c6ad4){logger[_0x0c5c('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x2ef42f,_0x4c6ad4);_0x57288a(_0x4c6ad4);});});}function respondWithStatusCode(_0x12bc50,_0x4356fa){_0x4356fa=_0x4356fa||0xcc;return function(_0x1f8704){if(_0x1f8704){return _0x12bc50[_0x0c5c('0x26')](_0x4356fa);}return _0x12bc50[_0x0c5c('0x27')](_0x4356fa)['end']();};}function respondWithResult(_0x19f49e,_0x1ae0de){_0x1ae0de=_0x1ae0de||0xc8;return function(_0x26cf9d){if(_0x26cf9d){return _0x19f49e[_0x0c5c('0x27')](_0x1ae0de)[_0x0c5c('0x28')](_0x26cf9d);}};}function respondWithFilteredResult(_0x2fa786,_0xc4358c){return function(_0x12d5af){if(_0x12d5af){var _0x2f3b67=_0x12d5af['count'],_0x307e59=_0xc4358c['offset'],_0x302663=_0xc4358c[_0x0c5c('0x29')]+_0xc4358c[_0x0c5c('0x2a')],_0x11f7e1;if(_0x302663>=_0x2f3b67){_0x302663=_0x2f3b67;_0x11f7e1=0xc8;}else{_0x11f7e1=0xce;}_0x2fa786[_0x0c5c('0x27')](_0x11f7e1);return _0x2fa786[_0x0c5c('0x2b')](_0x0c5c('0x2c'),_0x307e59+'-'+_0x302663+'/'+_0x2f3b67)[_0x0c5c('0x28')](_0x12d5af);}return null;};}function patchUpdates(_0xca2b95){return function(_0x16eb7b){try{jsonpatch[_0x0c5c('0x2d')](_0x16eb7b,_0xca2b95,!![]);}catch(_0x1b88c1){return BPromise[_0x0c5c('0x2e')](_0x1b88c1);}return _0x16eb7b[_0x0c5c('0x2f')]();};}function saveUpdates(_0xd94d41,_0x280983){return function(_0x29562d){if(_0x29562d){return _0x29562d[_0x0c5c('0x30')](_0xd94d41)[_0x0c5c('0x31')](function(_0x20b336){return _0x20b336;});}return null;};}function removeEntity(_0x3bf481,_0x5821da){return function(_0x5ec408){if(_0x5ec408){return _0x5ec408[_0x0c5c('0x32')]()[_0x0c5c('0x31')](function(){_0x3bf481['status'](0xcc)[_0x0c5c('0x33')]();});}};}function handleEntityNotFound(_0x400580,_0x46541d){return function(_0x4ab643){if(!_0x4ab643){_0x400580[_0x0c5c('0x26')](0x194);}return _0x4ab643;};}function handleError(_0x51f5bd,_0x237e94){_0x237e94=_0x237e94||0x1f4;return function(_0x56553e){logger[_0x0c5c('0x20')](_0x56553e[_0x0c5c('0x34')]);if(_0x56553e[_0x0c5c('0x35')]){delete _0x56553e[_0x0c5c('0x35')];}_0x51f5bd['status'](_0x237e94)[_0x0c5c('0x36')](_0x56553e);};}exports['index']=function(_0x51b436,_0x13fde2){var _0x21c827={},_0x2047d1={},_0x1c4ac3={'count':0x0,'rows':[]};var _0x1690d7=_[_0x0c5c('0x37')](db[_0x0c5c('0x38')]['rawAttributes'],function(_0x367286){return{'name':_0x367286[_0x0c5c('0x39')],'type':_0x367286[_0x0c5c('0x3a')][_0x0c5c('0x3b')]};});_0x2047d1['model']=_['map'](_0x1690d7,_0x0c5c('0x35'));_0x2047d1['query']=_[_0x0c5c('0x3c')](_0x51b436[_0x0c5c('0x3d')]);_0x2047d1[_0x0c5c('0x3e')]=_['intersection'](_0x2047d1[_0x0c5c('0x3f')],_0x2047d1[_0x0c5c('0x3d')]);_0x21c827[_0x0c5c('0x40')]=_[_0x0c5c('0x41')](_0x2047d1[_0x0c5c('0x3f')],qs[_0x0c5c('0x42')](_0x51b436['query'][_0x0c5c('0x42')]));_0x21c827['attributes']=_0x21c827[_0x0c5c('0x40')]['length']?_0x21c827['attributes']:_0x2047d1[_0x0c5c('0x3f')];if(!_0x51b436[_0x0c5c('0x3d')][_0x0c5c('0x43')](_0x0c5c('0x44'))){_0x21c827[_0x0c5c('0x2a')]=qs[_0x0c5c('0x2a')](_0x51b436[_0x0c5c('0x3d')][_0x0c5c('0x2a')]);_0x21c827[_0x0c5c('0x29')]=qs[_0x0c5c('0x29')](_0x51b436[_0x0c5c('0x3d')][_0x0c5c('0x29')]);}_0x21c827[_0x0c5c('0x45')]=qs[_0x0c5c('0x46')](_0x51b436[_0x0c5c('0x3d')]['sort']);_0x21c827[_0x0c5c('0x47')]=qs['filters'](_['pick'](_0x51b436[_0x0c5c('0x3d')],_0x2047d1[_0x0c5c('0x3e')]),_0x1690d7);if(_0x51b436[_0x0c5c('0x3d')][_0x0c5c('0x48')]){_0x21c827['where']=_[_0x0c5c('0x49')](_0x21c827[_0x0c5c('0x47')],{'$or':_[_0x0c5c('0x37')](_0x1690d7,function(_0x5069d0){if(_0x5069d0['type']!==_0x0c5c('0x4a')){var _0x4bb7e7={};_0x4bb7e7[_0x5069d0['name']]={'$like':'%'+_0x51b436[_0x0c5c('0x3d')][_0x0c5c('0x48')]+'%'};return _0x4bb7e7;}})});}_0x21c827=_[_0x0c5c('0x49')]({},_0x21c827,_0x51b436[_0x0c5c('0x4b')]);var _0x77cd7f={'where':_0x21c827[_0x0c5c('0x47')]};return db[_0x0c5c('0x38')][_0x0c5c('0x4c')](_0x77cd7f)[_0x0c5c('0x31')](function(_0x1c97e2){_0x1c4ac3[_0x0c5c('0x4c')]=_0x1c97e2;if(_0x51b436[_0x0c5c('0x3d')][_0x0c5c('0x4d')]){_0x21c827['include']=[{'all':!![]}];}return db[_0x0c5c('0x38')][_0x0c5c('0x4e')](_0x21c827);})['then'](function(_0x2a2a8c){_0x1c4ac3[_0x0c5c('0x4f')]=_0x2a2a8c;return _0x1c4ac3;})[_0x0c5c('0x31')](respondWithFilteredResult(_0x13fde2,_0x21c827))['catch'](handleError(_0x13fde2,null));};exports[_0x0c5c('0x50')]=function(_0x5c8519,_0x2be6f5){var _0x4726be={'raw':![],'where':{'id':_0x5c8519[_0x0c5c('0x51')]['id']}},_0x2fc6ae={};_0x2fc6ae[_0x0c5c('0x3f')]=_[_0x0c5c('0x3c')](db[_0x0c5c('0x38')]['rawAttributes']);_0x2fc6ae[_0x0c5c('0x3d')]=_[_0x0c5c('0x3c')](_0x5c8519[_0x0c5c('0x3d')]);_0x2fc6ae['filters']=_[_0x0c5c('0x41')](_0x2fc6ae['model'],_0x2fc6ae[_0x0c5c('0x3d')]);_0x4726be['attributes']=_[_0x0c5c('0x41')](_0x2fc6ae[_0x0c5c('0x3f')],qs[_0x0c5c('0x42')](_0x5c8519[_0x0c5c('0x3d')]['fields']));_0x4726be[_0x0c5c('0x40')]=_0x4726be['attributes'][_0x0c5c('0x52')]?_0x4726be[_0x0c5c('0x40')]:_0x2fc6ae['model'];if(_0x5c8519[_0x0c5c('0x3d')]['includeAll']){_0x4726be[_0x0c5c('0x53')]=[{'all':!![]}];}_0x4726be=_['merge']({},_0x4726be,_0x5c8519[_0x0c5c('0x4b')]);return db[_0x0c5c('0x38')]['find'](_0x4726be)[_0x0c5c('0x31')](handleEntityNotFound(_0x2be6f5,null))[_0x0c5c('0x31')](respondWithResult(_0x2be6f5,null))['catch'](handleError(_0x2be6f5,null));};exports[_0x0c5c('0x54')]=function(_0x2db039,_0x259b52){return db[_0x0c5c('0x38')][_0x0c5c('0x54')](_0x2db039[_0x0c5c('0x55')],{})[_0x0c5c('0x31')](respondWithResult(_0x259b52,0xc9))['catch'](handleError(_0x259b52,null));};exports[_0x0c5c('0x30')]=function(_0x4335c4,_0x20c0c3){if(_0x4335c4['body']['id']){delete _0x4335c4[_0x0c5c('0x55')]['id'];}return db[_0x0c5c('0x38')]['find']({'where':{'id':_0x4335c4[_0x0c5c('0x51')]['id']}})[_0x0c5c('0x31')](handleEntityNotFound(_0x20c0c3,null))[_0x0c5c('0x31')](saveUpdates(_0x4335c4[_0x0c5c('0x55')],null))['then'](respondWithResult(_0x20c0c3,null))[_0x0c5c('0x25')](handleError(_0x20c0c3,null));};exports[_0x0c5c('0x32')]=function(_0x1dc854,_0x409f97){return db[_0x0c5c('0x38')][_0x0c5c('0x56')]({'where':{'id':_0x1dc854['params']['id']}})[_0x0c5c('0x31')](handleEntityNotFound(_0x409f97,null))[_0x0c5c('0x31')](removeEntity(_0x409f97,null))[_0x0c5c('0x25')](handleError(_0x409f97,null));};exports[_0x0c5c('0x57')]=function(_0x1c533d,_0x262e2e,_0x41456a){var _0x1ae121={};var _0x36ad9c={};var _0x25698b;var _0x2abbb5;return db[_0x0c5c('0x38')]['findOne']({'where':{'id':_0x1c533d[_0x0c5c('0x51')]['id']}})[_0x0c5c('0x31')](handleEntityNotFound(_0x262e2e,null))[_0x0c5c('0x31')](function(_0x2e1bfb){if(_0x2e1bfb){_0x25698b=_0x2e1bfb;_0x36ad9c[_0x0c5c('0x3f')]=_[_0x0c5c('0x3c')](db[_0x0c5c('0x58')][_0x0c5c('0x59')]);_0x36ad9c[_0x0c5c('0x3d')]=_[_0x0c5c('0x3c')](_0x1c533d[_0x0c5c('0x3d')]);_0x36ad9c['filters']=_[_0x0c5c('0x41')](_0x36ad9c['model'],_0x36ad9c['query']);_0x1ae121[_0x0c5c('0x40')]=_['intersection'](_0x36ad9c[_0x0c5c('0x3f')],qs[_0x0c5c('0x42')](_0x1c533d[_0x0c5c('0x3d')][_0x0c5c('0x42')]));_0x1ae121[_0x0c5c('0x40')]=_0x1ae121[_0x0c5c('0x40')]['length']?_0x1ae121[_0x0c5c('0x40')]:_0x36ad9c[_0x0c5c('0x3f')];_0x1ae121[_0x0c5c('0x45')]=qs[_0x0c5c('0x46')](_0x1c533d[_0x0c5c('0x3d')][_0x0c5c('0x46')]);_0x1ae121[_0x0c5c('0x47')]=qs['filters'](_['pick'](_0x1c533d[_0x0c5c('0x3d')],_0x36ad9c[_0x0c5c('0x3e')]));if(_0x1c533d[_0x0c5c('0x3d')][_0x0c5c('0x48')]){_0x1ae121['where']=_[_0x0c5c('0x49')](_0x1ae121[_0x0c5c('0x47')],{'$or':_['map'](_0x1ae121[_0x0c5c('0x40')],function(_0x2aa341){var _0x54b234={};_0x54b234[_0x2aa341]={'$like':'%'+_0x1c533d[_0x0c5c('0x3d')][_0x0c5c('0x48')]+'%'};return _0x54b234;})});}_0x1ae121=_['merge']({},_0x1ae121,_0x1c533d[_0x0c5c('0x4b')]);return _0x25698b[_0x0c5c('0x57')](_0x1ae121);}})['then'](function(_0x3d221a){if(_0x3d221a){_0x2abbb5=_0x3d221a['length'];if(!_0x1c533d['query'][_0x0c5c('0x43')](_0x0c5c('0x44'))){_0x1ae121[_0x0c5c('0x2a')]=qs['limit'](_0x1c533d[_0x0c5c('0x3d')][_0x0c5c('0x2a')]);_0x1ae121[_0x0c5c('0x29')]=qs[_0x0c5c('0x29')](_0x1c533d['query'][_0x0c5c('0x29')]);}return _0x25698b[_0x0c5c('0x57')](_0x1ae121);}})[_0x0c5c('0x31')](function(_0x4e9227){if(_0x4e9227){return _0x4e9227?{'count':_0x2abbb5,'rows':_0x4e9227}:null;}})[_0x0c5c('0x31')](respondWithResult(_0x262e2e,null))[_0x0c5c('0x25')](handleError(_0x262e2e,null));};exports[_0x0c5c('0x5a')]=function(_0x5b7150,_0x593137,_0x268de2){if(_0x5b7150[_0x0c5c('0x55')]['id']){delete _0x5b7150[_0x0c5c('0x55')]['id'];}return db[_0x0c5c('0x38')]['findOne']({'where':{'id':_0x5b7150[_0x0c5c('0x51')]['id']}})['then'](handleEntityNotFound(_0x593137,null))[_0x0c5c('0x31')](function(_0x52150a){if(_0x52150a){_0x5b7150[_0x0c5c('0x55')][_0x0c5c('0x5b')]=_0x52150a['id'];_0x5b7150[_0x0c5c('0x55')][_0x0c5c('0x5c')]=integrations[_0x0c5c('0x5d')](_0x5b7150['body'][_0x0c5c('0x5e')],_0x5b7150['body'][_0x0c5c('0x3a')]);_0x5b7150['body'][_0x0c5c('0x5f')]=integrations[_0x0c5c('0x60')](_0x5b7150[_0x0c5c('0x55')]['channel'],_0x5b7150['body'][_0x0c5c('0x3a')]);return db[_0x0c5c('0x58')][_0x0c5c('0x54')](_0x5b7150[_0x0c5c('0x55')],{'include':[{'model':db[_0x0c5c('0x61')],'as':_0x0c5c('0x5c')},{'model':db[_0x0c5c('0x61')],'as':'Descriptions'}]});}return null;})[_0x0c5c('0x31')](respondWithResult(_0x593137,null))[_0x0c5c('0x25')](handleError(_0x593137,null));};exports['getFields']=function(_0x5ab78f,_0x3e50ea,_0xb7c06){var _0xbf4e4d='';return db[_0x0c5c('0x38')][_0x0c5c('0x62')]({'where':{'id':_0x5ab78f['params']['id']},'attributes':['id',_0x0c5c('0x63'),_0x0c5c('0x64'),'token','authType',_0x0c5c('0x65')]})[_0x0c5c('0x31')](handleEntityNotFound(_0x3e50ea,null))[_0x0c5c('0x31')](function(_0x5ca155){if(_0x5ca155){_0xbf4e4d=_0x5ca155[_0x0c5c('0x65')];var _0x2b9e16=_0xbf4e4d['slice'](-0x1);if(_0x2b9e16==='/'){_0xbf4e4d=_0xbf4e4d[_0x0c5c('0x66')](0x0,_0xbf4e4d[_0x0c5c('0x67')](_0x2b9e16));}var _0x4432e6={'method':_0x0c5c('0x68'),'uri':util[_0x0c5c('0x69')]('%s/%s',_0xbf4e4d,_0x0c5c('0x6a')),'json':!![]};switch(_0x5ca155[_0x0c5c('0x6b')]){case _0x0c5c('0x64'):_0x4432e6[_0x0c5c('0x6c')]={'Authorization':util[_0x0c5c('0x69')](_0x0c5c('0x6d'),new Buffer(util[_0x0c5c('0x69')](_0x0c5c('0x6e'),_0x5ca155['username'],_0x5ca155[_0x0c5c('0x64')]))[_0x0c5c('0x6f')](_0x0c5c('0x70')))};break;case'token':_0x4432e6['headers']={'Authorization':util[_0x0c5c('0x69')](_0x0c5c('0x6d'),new Buffer(util[_0x0c5c('0x69')](_0x0c5c('0x71'),_0x5ca155[_0x0c5c('0x63')],_0x5ca155[_0x0c5c('0x72')]))[_0x0c5c('0x6f')](_0x0c5c('0x70')))};break;default:throw new db[(_0x0c5c('0x73'))][(_0x0c5c('0x74'))](_0x0c5c('0x75'));}return rp(_0x4432e6);}})['then'](function(_0x3d3858){if(_0x3d3858){var _0x114d3e=['subject',_0x0c5c('0x76'),_0x0c5c('0x77'),_0x0c5c('0x78')];_[_0x0c5c('0x79')](_0x3d3858[_0x0c5c('0x6a')],function(_0x1dda21){return _0x114d3e['includes'](_0x1dda21['type']);});return{'count':_0x3d3858[_0x0c5c('0x6a')][_0x0c5c('0x52')],'rows':_['map'](_0x3d3858[_0x0c5c('0x6a')],function(_0x526c2b){return{'id':_0x526c2b['id'],'name':_0x526c2b[_0x0c5c('0x7a')]>0x7?_0x526c2b['title']:_0x526c2b['type'],'custom':_0x526c2b['position']>0x7?!![]:![],'options':_0x526c2b[_0x0c5c('0x7b')]?_0x526c2b[_0x0c5c('0x7b')]:_0x526c2b['custom_field_options']?_0x526c2b[_0x0c5c('0x7c')]:[]};})};}})[_0x0c5c('0x31')](respondWithResult(_0x3e50ea,null))[_0x0c5c('0x25')](function(_0x20c5ac){var _0x527b09=_0x5ab78f[_0x0c5c('0x3d')][_0x0c5c('0x7d')]?0x1f4:_0x20c5ac['statusCode']||0x1f4;logger[_0x0c5c('0x20')](_0x0c5c('0x7e'),_0x0c5c('0x7f'),_0x527b09,JSON[_0x0c5c('0x1f')](_0x20c5ac));delete _0x20c5ac[_0x0c5c('0x35')];if(_0x527b09===0x191){_0x527b09=0x190;}_0x3e50ea['status'](_0x527b09)[_0x0c5c('0x36')](_0x5ab78f['query'][_0x0c5c('0x7d')]?{'message':_0x0c5c('0x80'),'statusCode':_0x20c5ac[_0x0c5c('0x81')]}:_0x20c5ac);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c5f2bed..8ca7c70 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 _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 +var _0x9219=['rimraf','../../config/environment','./intZendeskAccount.attributes','exports','define','ZendeskAccount','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xea283b,_0x322fdd){var _0x56e2c9=function(_0x512a47){while(--_0x512a47){_0xea283b['push'](_0xea283b['shift']());}};_0x56e2c9(++_0x322fdd);}(_0x9219,0xd6));var _0x9921=function(_0x444c9d,_0x234e39){_0x444c9d=_0x444c9d-0x0;var _0x4f50ec=_0x9219[_0x444c9d];return _0x4f50ec;};'use strict';var _=require(_0x9921('0x0'));var util=require(_0x9921('0x1'));var logger=require('../../config/logger')(_0x9921('0x2'));var moment=require(_0x9921('0x3'));var BPromise=require(_0x9921('0x4'));var rp=require(_0x9921('0x5'));var fs=require('fs');var path=require(_0x9921('0x6'));var rimraf=require(_0x9921('0x7'));var config=require(_0x9921('0x8'));var attributes=require(_0x9921('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9921('0xa')]=function(_0x204cc3,_0x81abc9){return _0x204cc3[_0x9921('0xb')](_0x9921('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 5fa767e..6b8a9df 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll'];(function(_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 +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(_0xaf8391,_0x29a82c){var _0x50ba97=function(_0x228aef){while(--_0x228aef){_0xaf8391['push'](_0xaf8391['shift']());}};_0x50ba97(++_0x29a82c);}(_0xe706,0xa3));var _0x6e70=function(_0x458edc,_0x9baf98){_0x458edc=_0x458edc-0x0;var _0x44af29=_0xe706[_0x458edc];return _0x44af29;};'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 8608d20..1cac2ed 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 _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 +var _0x47a0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4c6233,_0x12bc76){var _0x1949b4=function(_0x411000){while(--_0x411000){_0x4c6233['push'](_0x4c6233['shift']());}};_0x1949b4(++_0x12bc76);}(_0x47a0,0x13f));var _0x047a=function(_0x1fe7be,_0x1877c9){_0x1fe7be=_0x1fe7be-0x0;var _0x33d640=_0x47a0[_0x1fe7be];return _0x33d640;};'use strict';var multer=require(_0x047a('0x0'));var util=require(_0x047a('0x1'));var path=require(_0x047a('0x2'));var timeout=require(_0x047a('0x3'));var express=require(_0x047a('0x4'));var router=express[_0x047a('0x5')]();var auth=require(_0x047a('0x6'));var interaction=require(_0x047a('0x7'));var config=require(_0x047a('0x8'));var controller=require(_0x047a('0x9'));router[_0x047a('0xa')]('/',auth[_0x047a('0xb')](),controller[_0x047a('0xc')]);router[_0x047a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x047a('0xd')]);router[_0x047a('0xa')](_0x047a('0xe'),auth[_0x047a('0xb')](),controller[_0x047a('0xf')]);router[_0x047a('0xa')](_0x047a('0x10'),auth[_0x047a('0xb')](),controller[_0x047a('0x11')]);router[_0x047a('0xa')](_0x047a('0x12'),auth[_0x047a('0xb')](),controller['getDescriptions']);router[_0x047a('0xa')](_0x047a('0x13'),auth['isAuthenticated'](),controller[_0x047a('0x14')]);router['post']('/',auth[_0x047a('0xb')](),controller[_0x047a('0x15')]);router['post'](_0x047a('0x13'),auth[_0x047a('0xb')](),controller['setTags']);router[_0x047a('0x16')]('/:id',auth[_0x047a('0xb')](),controller[_0x047a('0x17')]);router[_0x047a('0x18')]('/:id',auth[_0x047a('0xb')](),controller[_0x047a('0x19')]);module[_0x047a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index c639ca6..025d09b 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 _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 +var _0x81c2=['sequelize','STRING'];(function(_0x3ab78f,_0x47cb92){var _0x12d9cf=function(_0x55fe3b){while(--_0x55fe3b){_0x3ab78f['push'](_0x3ab78f['shift']());}};_0x12d9cf(++_0x47cb92);}(_0x81c2,0x126));var _0x281c=function(_0x377f50,_0x5589ba){_0x377f50=_0x377f50-0x0;var _0x14a9d2=_0x81c2[_0x377f50];return _0x14a9d2;};'use strict';var Sequelize=require(_0x281c('0x0'));module['exports']={'name':{'type':Sequelize[_0x281c('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 20196aa..e58950c 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 _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 +var _0x68b4=['rows','catch','show','options','find','create','body','params','destroy','getFields','findOne','ZendeskField','getSubjects','hasOwnProperty','getDescriptions','Tag','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','status','offset','limit','set','Content-Range','json','apply','update','then','end','sendStatus','stack','name','map','rawAttributes','query','keys','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','merge','type','filter','ZendeskConfiguration','count','includeAll','include'];(function(_0x4652c0,_0x55f00f){var _0x54952e=function(_0x250561){while(--_0x250561){_0x4652c0['push'](_0x4652c0['shift']());}};_0x54952e(++_0x55f00f);}(_0x68b4,0x11e));var _0x468b=function(_0x9c2d0c,_0x1c551f){_0x9c2d0c=_0x9c2d0c-0x0;var _0x745947=_0x68b4[_0x9c2d0c];return _0x745947;};'use strict';var pdf=require(_0x468b('0x0'));var emlformat=require(_0x468b('0x1'));var rimraf=require(_0x468b('0x2'));var zipdir=require(_0x468b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x468b('0x4'));var moment=require(_0x468b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x468b('0x6'));var util=require(_0x468b('0x7'));var path=require('path');var sox=require(_0x468b('0x8'));var csv=require('to-csv');var ejs=require(_0x468b('0x9'));var fs=require('fs');var _=require(_0x468b('0xa'));var squel=require(_0x468b('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x468b('0xc'));var toCsv=require(_0x468b('0xd'));var querystring=require(_0x468b('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x468b('0xf'));var qs=require(_0x468b('0x10'));var as=require(_0x468b('0x11'));var hardwareService=require(_0x468b('0x12'));var logger=require(_0x468b('0x13'))(_0x468b('0x14'));var utils=require('../../config/utils');var config=require(_0x468b('0x15'));var licenseUtil=require(_0x468b('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x468b('0x17'));var client=jayson[_0x468b('0x18')][_0x468b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0xbea6d2,_0x3e1443,_0x4508a5,_0x234267){return new BPromise(function(_0x3d6496,_0x4ba4c8){var _0x279865=_0x234267||client;return _0x279865[_0x468b('0x1a')](_0xbea6d2,_0x4508a5)['then'](function(_0x46932f){logger['info'](_0x468b('0x1b'),_0x3e1443,_0x468b('0x1c'));logger[_0x468b('0x1d')](_0x468b('0x1e'),_0x3e1443,_0x468b('0x1c'),JSON['stringify'](_0x46932f));if(_0x46932f[_0x468b('0x1f')]){if(_0x46932f[_0x468b('0x1f')][_0x468b('0x20')]===0x1f4){logger[_0x468b('0x1f')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3e1443,_0x46932f[_0x468b('0x1f')][_0x468b('0x21')]);return _0x4ba4c8(_0x46932f[_0x468b('0x1f')][_0x468b('0x21')]);}logger[_0x468b('0x1f')](_0x468b('0x1b'),_0x3e1443,_0x46932f[_0x468b('0x1f')][_0x468b('0x21')]);return _0x3d6496(_0x46932f[_0x468b('0x1f')][_0x468b('0x21')]);}else{logger[_0x468b('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3e1443,_0x468b('0x1c'));_0x3d6496(_0x46932f['result'][_0x468b('0x21')]);}})['catch'](function(_0x27c56c){logger[_0x468b('0x1f')](_0x468b('0x1b'),_0x3e1443,_0x27c56c);_0x4ba4c8(_0x27c56c);});});}function respondWithStatusCode(_0x152fc5,_0x5768f4){_0x5768f4=_0x5768f4||0xcc;return function(_0x4e1ec2){if(_0x4e1ec2){return _0x152fc5['sendStatus'](_0x5768f4);}return _0x152fc5[_0x468b('0x23')](_0x5768f4)['end']();};}function respondWithResult(_0x2d3d90,_0x13a4fb){_0x13a4fb=_0x13a4fb||0xc8;return function(_0x470727){if(_0x470727){return _0x2d3d90[_0x468b('0x23')](_0x13a4fb)['json'](_0x470727);}};}function respondWithFilteredResult(_0x17a863,_0x55e787){return function(_0x4ecec9){if(_0x4ecec9){var _0x13b807=_0x4ecec9['count'],_0x2e75a1=_0x55e787[_0x468b('0x24')],_0x587054=_0x55e787[_0x468b('0x24')]+_0x55e787[_0x468b('0x25')],_0x3b86db;if(_0x587054>=_0x13b807){_0x587054=_0x13b807;_0x3b86db=0xc8;}else{_0x3b86db=0xce;}_0x17a863[_0x468b('0x23')](_0x3b86db);return _0x17a863[_0x468b('0x26')](_0x468b('0x27'),_0x2e75a1+'-'+_0x587054+'/'+_0x13b807)[_0x468b('0x28')](_0x4ecec9);}return null;};}function patchUpdates(_0x4bbb9b){return function(_0x1ccc4b){try{jsonpatch[_0x468b('0x29')](_0x1ccc4b,_0x4bbb9b,!![]);}catch(_0x1ca5dd){return BPromise['reject'](_0x1ca5dd);}return _0x1ccc4b['save']();};}function saveUpdates(_0x39c906,_0x38b359){return function(_0x1706e6){if(_0x1706e6){return _0x1706e6[_0x468b('0x2a')](_0x39c906)[_0x468b('0x2b')](function(_0x307ca9){return _0x307ca9;});}return null;};}function removeEntity(_0x106faf,_0x25411b){return function(_0x400663){if(_0x400663){return _0x400663['destroy']()[_0x468b('0x2b')](function(){_0x106faf['status'](0xcc)[_0x468b('0x2c')]();});}};}function handleEntityNotFound(_0x1942da,_0x537db2){return function(_0x5bb0ef){if(!_0x5bb0ef){_0x1942da[_0x468b('0x2d')](0x194);}return _0x5bb0ef;};}function handleError(_0x3872d7,_0x2f757b){_0x2f757b=_0x2f757b||0x1f4;return function(_0x465ad0){logger['error'](_0x465ad0[_0x468b('0x2e')]);if(_0x465ad0[_0x468b('0x2f')]){delete _0x465ad0['name'];}_0x3872d7[_0x468b('0x23')](_0x2f757b)['send'](_0x465ad0);};}exports['index']=function(_0x1aca87,_0x17f883){var _0x480648={},_0x4018d3={},_0x24c932={'count':0x0,'rows':[]};var _0x4befee=_[_0x468b('0x30')](db['ZendeskConfiguration'][_0x468b('0x31')],function(_0x3279c4){return{'name':_0x3279c4['fieldName'],'type':_0x3279c4['type']['key']};});_0x4018d3['model']=_['map'](_0x4befee,_0x468b('0x2f'));_0x4018d3[_0x468b('0x32')]=_[_0x468b('0x33')](_0x1aca87['query']);_0x4018d3['filters']=_['intersection'](_0x4018d3[_0x468b('0x34')],_0x4018d3['query']);_0x480648[_0x468b('0x35')]=_[_0x468b('0x36')](_0x4018d3[_0x468b('0x34')],qs[_0x468b('0x37')](_0x1aca87[_0x468b('0x32')][_0x468b('0x37')]));_0x480648[_0x468b('0x35')]=_0x480648[_0x468b('0x35')][_0x468b('0x38')]?_0x480648[_0x468b('0x35')]:_0x4018d3[_0x468b('0x34')];if(!_0x1aca87[_0x468b('0x32')]['hasOwnProperty'](_0x468b('0x39'))){_0x480648['limit']=qs[_0x468b('0x25')](_0x1aca87[_0x468b('0x32')][_0x468b('0x25')]);_0x480648[_0x468b('0x24')]=qs['offset'](_0x1aca87[_0x468b('0x32')][_0x468b('0x24')]);}_0x480648[_0x468b('0x3a')]=qs[_0x468b('0x3b')](_0x1aca87['query'][_0x468b('0x3b')]);_0x480648[_0x468b('0x3c')]=qs['filters'](_[_0x468b('0x3d')](_0x1aca87[_0x468b('0x32')],_0x4018d3[_0x468b('0x3e')]),_0x4befee);if(_0x1aca87[_0x468b('0x32')]['filter']){_0x480648[_0x468b('0x3c')]=_[_0x468b('0x3f')](_0x480648[_0x468b('0x3c')],{'$or':_[_0x468b('0x30')](_0x4befee,function(_0x171662){if(_0x171662[_0x468b('0x40')]!=='VIRTUAL'){var _0x567c47={};_0x567c47[_0x171662['name']]={'$like':'%'+_0x1aca87[_0x468b('0x32')][_0x468b('0x41')]+'%'};return _0x567c47;}})});}_0x480648=_[_0x468b('0x3f')]({},_0x480648,_0x1aca87['options']);var _0x1a2ca4={'where':_0x480648[_0x468b('0x3c')]};return db[_0x468b('0x42')][_0x468b('0x43')](_0x1a2ca4)[_0x468b('0x2b')](function(_0x4671e4){_0x24c932[_0x468b('0x43')]=_0x4671e4;if(_0x1aca87['query'][_0x468b('0x44')]){_0x480648[_0x468b('0x45')]=[{'all':!![]}];}return db[_0x468b('0x42')]['findAll'](_0x480648);})[_0x468b('0x2b')](function(_0x15427f){_0x24c932[_0x468b('0x46')]=_0x15427f;return _0x24c932;})[_0x468b('0x2b')](respondWithFilteredResult(_0x17f883,_0x480648))[_0x468b('0x47')](handleError(_0x17f883,null));};exports[_0x468b('0x48')]=function(_0x47d9be,_0x23800e){var _0x636190={'raw':![],'where':{'id':_0x47d9be['params']['id']}},_0x18053b={};_0x18053b[_0x468b('0x34')]=_['keys'](db[_0x468b('0x42')][_0x468b('0x31')]);_0x18053b[_0x468b('0x32')]=_[_0x468b('0x33')](_0x47d9be[_0x468b('0x32')]);_0x18053b[_0x468b('0x3e')]=_[_0x468b('0x36')](_0x18053b['model'],_0x18053b[_0x468b('0x32')]);_0x636190[_0x468b('0x35')]=_[_0x468b('0x36')](_0x18053b[_0x468b('0x34')],qs[_0x468b('0x37')](_0x47d9be[_0x468b('0x32')][_0x468b('0x37')]));_0x636190[_0x468b('0x35')]=_0x636190[_0x468b('0x35')][_0x468b('0x38')]?_0x636190['attributes']:_0x18053b['model'];if(_0x47d9be['query']['includeAll']){_0x636190[_0x468b('0x45')]=[{'all':!![]}];}_0x636190=_[_0x468b('0x3f')]({},_0x636190,_0x47d9be[_0x468b('0x49')]);return db[_0x468b('0x42')][_0x468b('0x4a')](_0x636190)[_0x468b('0x2b')](handleEntityNotFound(_0x23800e,null))[_0x468b('0x2b')](respondWithResult(_0x23800e,null))[_0x468b('0x47')](handleError(_0x23800e,null));};exports[_0x468b('0x4b')]=function(_0x3395e6,_0x192faf){return db[_0x468b('0x42')][_0x468b('0x4b')](_0x3395e6[_0x468b('0x4c')],{})[_0x468b('0x2b')](respondWithResult(_0x192faf,0xc9))[_0x468b('0x47')](handleError(_0x192faf,null));};exports[_0x468b('0x2a')]=function(_0x4ffcb6,_0x26edb3){if(_0x4ffcb6[_0x468b('0x4c')]['id']){delete _0x4ffcb6['body']['id'];}return db[_0x468b('0x42')]['find']({'where':{'id':_0x4ffcb6[_0x468b('0x4d')]['id']}})[_0x468b('0x2b')](handleEntityNotFound(_0x26edb3,null))[_0x468b('0x2b')](saveUpdates(_0x4ffcb6[_0x468b('0x4c')],null))[_0x468b('0x2b')](respondWithResult(_0x26edb3,null))[_0x468b('0x47')](handleError(_0x26edb3,null));};exports[_0x468b('0x4e')]=function(_0x2fe620,_0x309c0e){return db[_0x468b('0x42')][_0x468b('0x4a')]({'where':{'id':_0x2fe620[_0x468b('0x4d')]['id']}})[_0x468b('0x2b')](handleEntityNotFound(_0x309c0e,null))[_0x468b('0x2b')](removeEntity(_0x309c0e,null))['catch'](handleError(_0x309c0e,null));};exports[_0x468b('0x4f')]=function(_0x59202f,_0x138f10,_0x52f2d9){var _0x3598d8={};var _0x3baf8b={};var _0x3703d7;var _0x33e357;return db[_0x468b('0x42')][_0x468b('0x50')]({'where':{'id':_0x59202f[_0x468b('0x4d')]['id']}})[_0x468b('0x2b')](handleEntityNotFound(_0x138f10,null))[_0x468b('0x2b')](function(_0x28c751){if(_0x28c751){_0x3703d7=_0x28c751;_0x3baf8b['model']=_['keys'](db[_0x468b('0x51')][_0x468b('0x31')]);_0x3baf8b[_0x468b('0x32')]=_[_0x468b('0x33')](_0x59202f[_0x468b('0x32')]);_0x3baf8b[_0x468b('0x3e')]=_[_0x468b('0x36')](_0x3baf8b[_0x468b('0x34')],_0x3baf8b[_0x468b('0x32')]);_0x3598d8['attributes']=_[_0x468b('0x36')](_0x3baf8b[_0x468b('0x34')],qs[_0x468b('0x37')](_0x59202f['query']['fields']));_0x3598d8[_0x468b('0x35')]=_0x3598d8['attributes'][_0x468b('0x38')]?_0x3598d8['attributes']:_0x3baf8b[_0x468b('0x34')];_0x3598d8[_0x468b('0x3a')]=qs[_0x468b('0x3b')](_0x59202f[_0x468b('0x32')][_0x468b('0x3b')]);_0x3598d8[_0x468b('0x3c')]=qs[_0x468b('0x3e')](_[_0x468b('0x3d')](_0x59202f[_0x468b('0x32')],_0x3baf8b[_0x468b('0x3e')]));if(_0x59202f['query'][_0x468b('0x41')]){_0x3598d8[_0x468b('0x3c')]=_[_0x468b('0x3f')](_0x3598d8['where'],{'$or':_[_0x468b('0x30')](_0x3598d8[_0x468b('0x35')],function(_0x50065b){var _0x24db63={};_0x24db63[_0x50065b]={'$like':'%'+_0x59202f[_0x468b('0x32')][_0x468b('0x41')]+'%'};return _0x24db63;})});}_0x3598d8=_['merge']({},_0x3598d8,_0x59202f[_0x468b('0x49')]);return _0x3703d7[_0x468b('0x4f')](_0x3598d8);}})[_0x468b('0x2b')](function(_0x4d4e03){if(_0x4d4e03){_0x33e357=_0x4d4e03[_0x468b('0x38')];if(!_0x59202f[_0x468b('0x32')]['hasOwnProperty'](_0x468b('0x39'))){_0x3598d8[_0x468b('0x25')]=qs[_0x468b('0x25')](_0x59202f['query'][_0x468b('0x25')]);_0x3598d8['offset']=qs['offset'](_0x59202f[_0x468b('0x32')][_0x468b('0x24')]);}return _0x3703d7[_0x468b('0x4f')](_0x3598d8);}})[_0x468b('0x2b')](function(_0x288d77){if(_0x288d77){return _0x288d77?{'count':_0x33e357,'rows':_0x288d77}:null;}})[_0x468b('0x2b')](respondWithResult(_0x138f10,null))[_0x468b('0x47')](handleError(_0x138f10,null));};exports['getSubjects']=function(_0x17e82f,_0x581b81,_0xd76d6c){var _0x393941={};var _0x499940={};var _0xb24d57;var _0x54e330;return db[_0x468b('0x42')][_0x468b('0x50')]({'where':{'id':_0x17e82f[_0x468b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x581b81,null))['then'](function(_0x22056b){if(_0x22056b){_0xb24d57=_0x22056b;_0x499940['model']=_[_0x468b('0x33')](db[_0x468b('0x51')][_0x468b('0x31')]);_0x499940['query']=_[_0x468b('0x33')](_0x17e82f[_0x468b('0x32')]);_0x499940[_0x468b('0x3e')]=_[_0x468b('0x36')](_0x499940[_0x468b('0x34')],_0x499940['query']);_0x393941['attributes']=_[_0x468b('0x36')](_0x499940[_0x468b('0x34')],qs['fields'](_0x17e82f[_0x468b('0x32')][_0x468b('0x37')]));_0x393941[_0x468b('0x35')]=_0x393941[_0x468b('0x35')][_0x468b('0x38')]?_0x393941[_0x468b('0x35')]:_0x499940[_0x468b('0x34')];_0x393941[_0x468b('0x3a')]=qs['sort'](_0x17e82f['query'][_0x468b('0x3b')]);_0x393941[_0x468b('0x3c')]=qs['filters'](_[_0x468b('0x3d')](_0x17e82f[_0x468b('0x32')],_0x499940[_0x468b('0x3e')]));if(_0x17e82f['query']['filter']){_0x393941[_0x468b('0x3c')]=_['merge'](_0x393941[_0x468b('0x3c')],{'$or':_[_0x468b('0x30')](_0x393941['attributes'],function(_0x334af1){var _0x4c4159={};_0x4c4159[_0x334af1]={'$like':'%'+_0x17e82f[_0x468b('0x32')]['filter']+'%'};return _0x4c4159;})});}_0x393941=_['merge']({},_0x393941,_0x17e82f[_0x468b('0x49')]);return _0xb24d57[_0x468b('0x52')](_0x393941);}})[_0x468b('0x2b')](function(_0x3325fa){if(_0x3325fa){_0x54e330=_0x3325fa[_0x468b('0x38')];if(!_0x17e82f[_0x468b('0x32')][_0x468b('0x53')](_0x468b('0x39'))){_0x393941['limit']=qs[_0x468b('0x25')](_0x17e82f['query']['limit']);_0x393941[_0x468b('0x24')]=qs[_0x468b('0x24')](_0x17e82f[_0x468b('0x32')][_0x468b('0x24')]);}return _0xb24d57[_0x468b('0x52')](_0x393941);}})[_0x468b('0x2b')](function(_0xfc08c){if(_0xfc08c){return _0xfc08c?{'count':_0x54e330,'rows':_0xfc08c}:null;}})[_0x468b('0x2b')](respondWithResult(_0x581b81,null))[_0x468b('0x47')](handleError(_0x581b81,null));};exports[_0x468b('0x54')]=function(_0x33e98b,_0x40df2e,_0xed37db){var _0x45256e={};var _0x54e2fe={};var _0x1ea374;var _0x167fc0;return db[_0x468b('0x42')][_0x468b('0x50')]({'where':{'id':_0x33e98b[_0x468b('0x4d')]['id']}})[_0x468b('0x2b')](handleEntityNotFound(_0x40df2e,null))[_0x468b('0x2b')](function(_0x178fc1){if(_0x178fc1){_0x1ea374=_0x178fc1;_0x54e2fe[_0x468b('0x34')]=_[_0x468b('0x33')](db[_0x468b('0x51')]['rawAttributes']);_0x54e2fe[_0x468b('0x32')]=_[_0x468b('0x33')](_0x33e98b[_0x468b('0x32')]);_0x54e2fe[_0x468b('0x3e')]=_[_0x468b('0x36')](_0x54e2fe[_0x468b('0x34')],_0x54e2fe['query']);_0x45256e[_0x468b('0x35')]=_[_0x468b('0x36')](_0x54e2fe[_0x468b('0x34')],qs[_0x468b('0x37')](_0x33e98b[_0x468b('0x32')]['fields']));_0x45256e[_0x468b('0x35')]=_0x45256e[_0x468b('0x35')]['length']?_0x45256e[_0x468b('0x35')]:_0x54e2fe[_0x468b('0x34')];_0x45256e['order']=qs['sort'](_0x33e98b[_0x468b('0x32')]['sort']);_0x45256e[_0x468b('0x3c')]=qs[_0x468b('0x3e')](_['pick'](_0x33e98b['query'],_0x54e2fe[_0x468b('0x3e')]));if(_0x33e98b[_0x468b('0x32')][_0x468b('0x41')]){_0x45256e[_0x468b('0x3c')]=_[_0x468b('0x3f')](_0x45256e['where'],{'$or':_['map'](_0x45256e['attributes'],function(_0x1f671f){var _0x50a457={};_0x50a457[_0x1f671f]={'$like':'%'+_0x33e98b[_0x468b('0x32')][_0x468b('0x41')]+'%'};return _0x50a457;})});}_0x45256e=_[_0x468b('0x3f')]({},_0x45256e,_0x33e98b[_0x468b('0x49')]);return _0x1ea374['getDescriptions'](_0x45256e);}})[_0x468b('0x2b')](function(_0x258010){if(_0x258010){_0x167fc0=_0x258010[_0x468b('0x38')];if(!_0x33e98b[_0x468b('0x32')][_0x468b('0x53')]('nolimit')){_0x45256e[_0x468b('0x25')]=qs[_0x468b('0x25')](_0x33e98b['query'][_0x468b('0x25')]);_0x45256e[_0x468b('0x24')]=qs[_0x468b('0x24')](_0x33e98b['query']['offset']);}return _0x1ea374[_0x468b('0x54')](_0x45256e);}})['then'](function(_0x3e7650){if(_0x3e7650){return _0x3e7650?{'count':_0x167fc0,'rows':_0x3e7650}:null;}})[_0x468b('0x2b')](respondWithResult(_0x40df2e,null))['catch'](handleError(_0x40df2e,null));};exports['getTags']=function(_0x1d710e,_0x4e2d91,_0x2188be){var _0x269833={};var _0x25462f={};var _0x12e214;var _0x2be47d;return db[_0x468b('0x42')][_0x468b('0x50')]({'where':{'id':_0x1d710e['params']['id']}})[_0x468b('0x2b')](handleEntityNotFound(_0x4e2d91,null))[_0x468b('0x2b')](function(_0x4ddc75){if(_0x4ddc75){_0x12e214=_0x4ddc75;_0x25462f[_0x468b('0x34')]=_[_0x468b('0x33')](db[_0x468b('0x55')][_0x468b('0x31')]);_0x25462f['query']=_[_0x468b('0x33')](_0x1d710e[_0x468b('0x32')]);_0x25462f['filters']=_['intersection'](_0x25462f[_0x468b('0x34')],_0x25462f[_0x468b('0x32')]);_0x269833[_0x468b('0x35')]=_[_0x468b('0x36')](_0x25462f['model'],qs[_0x468b('0x37')](_0x1d710e['query'][_0x468b('0x37')]));_0x269833[_0x468b('0x35')]=_0x269833[_0x468b('0x35')][_0x468b('0x38')]?_0x269833[_0x468b('0x35')]:_0x25462f[_0x468b('0x34')];_0x269833[_0x468b('0x3a')]=qs[_0x468b('0x3b')](_0x1d710e[_0x468b('0x32')][_0x468b('0x3b')]);_0x269833['where']=qs[_0x468b('0x3e')](_[_0x468b('0x3d')](_0x1d710e[_0x468b('0x32')],_0x25462f['filters']));if(_0x1d710e[_0x468b('0x32')][_0x468b('0x41')]){_0x269833[_0x468b('0x3c')]=_[_0x468b('0x3f')](_0x269833[_0x468b('0x3c')],{'$or':_[_0x468b('0x30')](_0x269833[_0x468b('0x35')],function(_0x81fb85){var _0x340518={};_0x340518[_0x81fb85]={'$like':'%'+_0x1d710e[_0x468b('0x32')][_0x468b('0x41')]+'%'};return _0x340518;})});}_0x269833=_[_0x468b('0x3f')]({},_0x269833,_0x1d710e[_0x468b('0x49')]);return _0x12e214[_0x468b('0x56')](_0x269833);}})['then'](function(_0x3edd03){if(_0x3edd03){_0x2be47d=_0x3edd03['length'];if(!_0x1d710e[_0x468b('0x32')][_0x468b('0x53')](_0x468b('0x39'))){_0x269833[_0x468b('0x25')]=qs[_0x468b('0x25')](_0x1d710e[_0x468b('0x32')]['limit']);_0x269833[_0x468b('0x24')]=qs[_0x468b('0x24')](_0x1d710e[_0x468b('0x32')][_0x468b('0x24')]);}return _0x12e214[_0x468b('0x56')](_0x269833);}})['then'](function(_0x4adfae){if(_0x4adfae){return _0x4adfae?{'count':_0x2be47d,'rows':_0x4adfae}:null;}})[_0x468b('0x2b')](respondWithResult(_0x4e2d91,null))['catch'](handleError(_0x4e2d91,null));};exports[_0x468b('0x57')]=function(_0x307dd3,_0x1eebf8,_0x298ef9){if(_0x307dd3[_0x468b('0x4c')]['id']){delete _0x307dd3['body']['id'];}return db[_0x468b('0x42')][_0x468b('0x50')]({'where':{'id':_0x307dd3[_0x468b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1eebf8,null))['then'](function(_0x3b8f39){if(_0x3b8f39){return _0x3b8f39['setTags'](_0x307dd3[_0x468b('0x4c')][_0x468b('0x58')]||[]);}return null;})['then'](respondWithResult(_0x1eebf8,null))['catch'](handleError(_0x1eebf8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 669151a..321f7ca 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 _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 +var _0x7f85=['rimraf','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59c52f,_0x4e0626){var _0x18d218=function(_0x24e435){while(--_0x24e435){_0x59c52f['push'](_0x59c52f['shift']());}};_0x18d218(++_0x4e0626);}(_0x7f85,0xf0));var _0x57f8=function(_0x296e0e,_0x342fa4){_0x296e0e=_0x296e0e-0x0;var _0x101c03=_0x7f85[_0x296e0e];return _0x101c03;};'use strict';var _=require(_0x57f8('0x0'));var util=require(_0x57f8('0x1'));var logger=require(_0x57f8('0x2'))(_0x57f8('0x3'));var moment=require(_0x57f8('0x4'));var BPromise=require(_0x57f8('0x5'));var rp=require(_0x57f8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57f8('0x7'));var config=require(_0x57f8('0x8'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x57f8('0x9')]=function(_0x2cd4c2,_0x219e19){return _0x2cd4c2[_0x57f8('0xa')](_0x57f8('0xb'),attributes,{'tableName':_0x57f8('0xc'),'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 49ffad7..51ed75c 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 _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 +var _0x1610=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1610,0x17b));var _0x0161=function(_0x4d9011,_0x2b76d5){_0x4d9011=_0x4d9011-0x0;var _0x49673e=_0x1610[_0x4d9011];return _0x49673e;};'use strict';var _=require(_0x0161('0x0'));var util=require(_0x0161('0x1'));var moment=require(_0x0161('0x2'));var BPromise=require(_0x0161('0x3'));var rs=require(_0x0161('0x4'));var fs=require('fs');var Redis=require(_0x0161('0x5'));var db=require(_0x0161('0x6'))['db'];var utils=require(_0x0161('0x7'));var logger=require(_0x0161('0x8'))('rpc');var config=require(_0x0161('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0161('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x164d23,_0x467820,_0x44ace3){return new BPromise(function(_0x21c997,_0x37a5e1){return client['request'](_0x164d23,_0x44ace3)[_0x0161('0xb')](function(_0x33774e){logger[_0x0161('0xc')](_0x0161('0xd'),_0x467820,_0x0161('0xe'));logger[_0x0161('0xf')](_0x0161('0x10'),_0x467820,_0x0161('0xe'),JSON['stringify'](_0x33774e));if(_0x33774e[_0x0161('0x11')]){if(_0x33774e[_0x0161('0x11')]['code']===0x1f4){logger[_0x0161('0x11')](_0x0161('0xd'),_0x467820,_0x33774e['error'][_0x0161('0x12')]);return _0x37a5e1(_0x33774e[_0x0161('0x11')]['message']);}logger['error'](_0x0161('0xd'),_0x467820,_0x33774e[_0x0161('0x11')][_0x0161('0x12')]);return _0x21c997(_0x33774e[_0x0161('0x11')]['message']);}else{logger['info'](_0x0161('0xd'),_0x467820,_0x0161('0xe'));_0x21c997(_0x33774e[_0x0161('0x13')][_0x0161('0x12')]);}})['catch'](function(_0x24b422){logger[_0x0161('0x11')](_0x0161('0xd'),_0x467820,_0x24b422);_0x37a5e1(_0x24b422);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 76d694a..9d0c416 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 _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 +var _0x8512=['../../config/environment','index','get','/:id','show','isAuthenticated','create','put','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x335bbe,_0x475451){var _0xd348b7=function(_0x8dd47b){while(--_0x8dd47b){_0x335bbe['push'](_0x335bbe['shift']());}};_0xd348b7(++_0x475451);}(_0x8512,0x70));var _0x2851=function(_0xed46dc,_0x5a4e89){_0xed46dc=_0xed46dc-0x0;var _0x2170d4=_0x8512[_0xed46dc];return _0x2170d4;};'use strict';var multer=require(_0x2851('0x0'));var util=require(_0x2851('0x1'));var path=require(_0x2851('0x2'));var timeout=require(_0x2851('0x3'));var express=require(_0x2851('0x4'));var router=express['Router']();var auth=require(_0x2851('0x5'));var interaction=require(_0x2851('0x6'));var config=require(_0x2851('0x7'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2851('0x8')]);router[_0x2851('0x9')](_0x2851('0xa'),auth['isAuthenticated'](),controller[_0x2851('0xb')]);router['post']('/',auth[_0x2851('0xc')](),controller[_0x2851('0xd')]);router[_0x2851('0xe')](_0x2851('0xa'),auth[_0x2851('0xc')](),controller['update']);router[_0x2851('0xf')](_0x2851('0xa'),auth[_0x2851('0xc')](),controller[_0x2851('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index ec72ec3..6332248 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 _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 +var _0xabe8=['customVariable','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xabe8,0x8c));var _0x8abe=function(_0x2119ed,_0x171c9c){_0x2119ed=_0x2119ed-0x0;var _0x4b0332=_0xabe8[_0x2119ed];return _0x4b0332;};'use strict';var Sequelize=require(_0x8abe('0x0'));module[_0x8abe('0x1')]={'type':{'type':Sequelize[_0x8abe('0x2')]('string',_0x8abe('0x3'),_0x8abe('0x4'),'keyValue'),'defaultValue':_0x8abe('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8abe('0x6')]},'keyType':{'type':Sequelize[_0x8abe('0x2')](_0x8abe('0x5'),_0x8abe('0x3'),_0x8abe('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8abe('0x6')]},'customField':{'type':Sequelize[_0x8abe('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8abe('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 35400e4..5f06c8f 100644 --- a/server/api/intZendeskField/intZendeskField.controller.js +++ b/server/api/intZendeskField/intZendeskField.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0120=['sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end'];(function(_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 +var _0x5430=['../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','destroy','then','error','stack','name','send','map','ZendeskField','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x345f8a,_0x1ae102){var _0x18e500=function(_0x464198){while(--_0x464198){_0x345f8a['push'](_0x345f8a['shift']());}};_0x18e500(++_0x1ae102);}(_0x5430,0x10c));var _0x0543=function(_0x557c33,_0x1f7240){_0x557c33=_0x557c33-0x0;var _0x571ea3=_0x5430[_0x557c33];return _0x571ea3;};'use strict';var pdf=require(_0x0543('0x0'));var emlformat=require(_0x0543('0x1'));var rimraf=require(_0x0543('0x2'));var zipdir=require(_0x0543('0x3'));var jsonpatch=require(_0x0543('0x4'));var rp=require(_0x0543('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0543('0x6'));var util=require('util');var path=require('path');var sox=require(_0x0543('0x7'));var csv=require(_0x0543('0x8'));var ejs=require(_0x0543('0x9'));var fs=require('fs');var _=require(_0x0543('0xa'));var squel=require(_0x0543('0xb'));var crypto=require('crypto');var jsforce=require(_0x0543('0xc'));var deskjs=require(_0x0543('0xd'));var toCsv=require(_0x0543('0x8'));var querystring=require(_0x0543('0xe'));var Papa=require(_0x0543('0xf'));var Redis=require(_0x0543('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0543('0x11'));var as=require(_0x0543('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0543('0x13'))(_0x0543('0x14'));var utils=require(_0x0543('0x15'));var config=require(_0x0543('0x16'));var licenseUtil=require(_0x0543('0x17'));var db=require(_0x0543('0x18'))['db'];function respondWithStatusCode(_0x30c54e,_0x27290d){_0x27290d=_0x27290d||0xcc;return function(_0x46d176){if(_0x46d176){return _0x30c54e[_0x0543('0x19')](_0x27290d);}return _0x30c54e[_0x0543('0x1a')](_0x27290d)[_0x0543('0x1b')]();};}function respondWithResult(_0x552980,_0x4f1f2a){_0x4f1f2a=_0x4f1f2a||0xc8;return function(_0x21e9ac){if(_0x21e9ac){return _0x552980['status'](_0x4f1f2a)['json'](_0x21e9ac);}};}function respondWithFilteredResult(_0xcb09df,_0x40fb03){return function(_0x1dff7d){if(_0x1dff7d){var _0x1cfadf=_0x1dff7d[_0x0543('0x1c')],_0x38a32e=_0x40fb03[_0x0543('0x1d')],_0x50d504=_0x40fb03[_0x0543('0x1d')]+_0x40fb03[_0x0543('0x1e')],_0xe69a3d;if(_0x50d504>=_0x1cfadf){_0x50d504=_0x1cfadf;_0xe69a3d=0xc8;}else{_0xe69a3d=0xce;}_0xcb09df[_0x0543('0x1a')](_0xe69a3d);return _0xcb09df[_0x0543('0x1f')]('Content-Range',_0x38a32e+'-'+_0x50d504+'/'+_0x1cfadf)[_0x0543('0x20')](_0x1dff7d);}return null;};}function patchUpdates(_0x5362cb){return function(_0x50ea84){try{jsonpatch[_0x0543('0x21')](_0x50ea84,_0x5362cb,!![]);}catch(_0x419913){return BPromise[_0x0543('0x22')](_0x419913);}return _0x50ea84['save']();};}function saveUpdates(_0x3f0452,_0x51c271){return function(_0x401da5){if(_0x401da5){return _0x401da5[_0x0543('0x23')](_0x3f0452)['then'](function(_0x18dd45){return _0x18dd45;});}return null;};}function removeEntity(_0x333c72,_0x427919){return function(_0x110060){if(_0x110060){return _0x110060[_0x0543('0x24')]()[_0x0543('0x25')](function(){_0x333c72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59f1b2,_0xbfe5dc){return function(_0x25b3a1){if(!_0x25b3a1){_0x59f1b2[_0x0543('0x19')](0x194);}return _0x25b3a1;};}function handleError(_0xaf1c0e,_0x2b1425){_0x2b1425=_0x2b1425||0x1f4;return function(_0x26e500){logger[_0x0543('0x26')](_0x26e500[_0x0543('0x27')]);if(_0x26e500[_0x0543('0x28')]){delete _0x26e500[_0x0543('0x28')];}_0xaf1c0e[_0x0543('0x1a')](_0x2b1425)[_0x0543('0x29')](_0x26e500);};}exports['index']=function(_0x25e6f1,_0x153bda){var _0x30ad9e={},_0x4f2592={},_0x9c7e34={'count':0x0,'rows':[]};var _0x27031f=_[_0x0543('0x2a')](db[_0x0543('0x2b')]['rawAttributes'],function(_0x1732be){return{'name':_0x1732be[_0x0543('0x2c')],'type':_0x1732be['type']['key']};});_0x4f2592[_0x0543('0x2d')]=_[_0x0543('0x2a')](_0x27031f,'name');_0x4f2592[_0x0543('0x2e')]=_[_0x0543('0x2f')](_0x25e6f1[_0x0543('0x2e')]);_0x4f2592[_0x0543('0x30')]=_[_0x0543('0x31')](_0x4f2592[_0x0543('0x2d')],_0x4f2592[_0x0543('0x2e')]);_0x30ad9e['attributes']=_[_0x0543('0x31')](_0x4f2592['model'],qs[_0x0543('0x32')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x32')]));_0x30ad9e[_0x0543('0x33')]=_0x30ad9e[_0x0543('0x33')]['length']?_0x30ad9e[_0x0543('0x33')]:_0x4f2592['model'];if(!_0x25e6f1[_0x0543('0x2e')][_0x0543('0x34')](_0x0543('0x35'))){_0x30ad9e[_0x0543('0x1e')]=qs['limit'](_0x25e6f1[_0x0543('0x2e')]['limit']);_0x30ad9e[_0x0543('0x1d')]=qs[_0x0543('0x1d')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x1d')]);}_0x30ad9e[_0x0543('0x36')]=qs[_0x0543('0x37')](_0x25e6f1[_0x0543('0x2e')][_0x0543('0x37')]);_0x30ad9e[_0x0543('0x38')]=qs[_0x0543('0x30')](_['pick'](_0x25e6f1[_0x0543('0x2e')],_0x4f2592[_0x0543('0x30')]),_0x27031f);if(_0x25e6f1['query'][_0x0543('0x39')]){_0x30ad9e['where']=_[_0x0543('0x3a')](_0x30ad9e[_0x0543('0x38')],{'$or':_['map'](_0x27031f,function(_0x5e8800){if(_0x5e8800[_0x0543('0x3b')]!==_0x0543('0x3c')){var _0x4ca572={};_0x4ca572[_0x5e8800[_0x0543('0x28')]]={'$like':'%'+_0x25e6f1[_0x0543('0x2e')]['filter']+'%'};return _0x4ca572;}})});}_0x30ad9e=_[_0x0543('0x3a')]({},_0x30ad9e,_0x25e6f1[_0x0543('0x3d')]);var _0x3ecd70={'where':_0x30ad9e[_0x0543('0x38')]};return db[_0x0543('0x2b')]['count'](_0x3ecd70)['then'](function(_0x4816ac){_0x9c7e34[_0x0543('0x1c')]=_0x4816ac;if(_0x25e6f1[_0x0543('0x2e')][_0x0543('0x3e')]){_0x30ad9e[_0x0543('0x3f')]=[{'all':!![]}];}return db['ZendeskField'][_0x0543('0x40')](_0x30ad9e);})[_0x0543('0x25')](function(_0xe3936f){_0x9c7e34[_0x0543('0x41')]=_0xe3936f;return _0x9c7e34;})[_0x0543('0x25')](respondWithFilteredResult(_0x153bda,_0x30ad9e))[_0x0543('0x42')](handleError(_0x153bda,null));};exports[_0x0543('0x43')]=function(_0x58e779,_0x24a891){var _0x32d031={'raw':!![],'where':{'id':_0x58e779[_0x0543('0x44')]['id']}},_0x3dd2ca={};_0x3dd2ca[_0x0543('0x2d')]=_[_0x0543('0x2f')](db['ZendeskField']['rawAttributes']);_0x3dd2ca[_0x0543('0x2e')]=_[_0x0543('0x2f')](_0x58e779[_0x0543('0x2e')]);_0x3dd2ca[_0x0543('0x30')]=_[_0x0543('0x31')](_0x3dd2ca[_0x0543('0x2d')],_0x3dd2ca[_0x0543('0x2e')]);_0x32d031[_0x0543('0x33')]=_[_0x0543('0x31')](_0x3dd2ca['model'],qs['fields'](_0x58e779[_0x0543('0x2e')][_0x0543('0x32')]));_0x32d031['attributes']=_0x32d031['attributes'][_0x0543('0x45')]?_0x32d031[_0x0543('0x33')]:_0x3dd2ca['model'];if(_0x58e779[_0x0543('0x2e')]['includeAll']){_0x32d031[_0x0543('0x3f')]=[{'all':!![]}];}_0x32d031=_[_0x0543('0x3a')]({},_0x32d031,_0x58e779['options']);return db['ZendeskField'][_0x0543('0x46')](_0x32d031)['then'](handleEntityNotFound(_0x24a891,null))[_0x0543('0x25')](respondWithResult(_0x24a891,null))[_0x0543('0x42')](handleError(_0x24a891,null));};exports[_0x0543('0x47')]=function(_0x270ce0,_0x158536){return db[_0x0543('0x2b')]['create'](_0x270ce0[_0x0543('0x48')],{})[_0x0543('0x25')](respondWithResult(_0x158536,0xc9))[_0x0543('0x42')](handleError(_0x158536,null));};exports[_0x0543('0x23')]=function(_0x40abbd,_0x4ea239){if(_0x40abbd[_0x0543('0x48')]['id']){delete _0x40abbd['body']['id'];}return db[_0x0543('0x2b')][_0x0543('0x46')]({'where':{'id':_0x40abbd[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x4ea239,null))[_0x0543('0x25')](saveUpdates(_0x40abbd[_0x0543('0x48')],null))['then'](respondWithResult(_0x4ea239,null))['catch'](handleError(_0x4ea239,null));};exports['destroy']=function(_0xc832e2,_0x2177b8){return db['ZendeskField'][_0x0543('0x46')]({'where':{'id':_0xc832e2[_0x0543('0x44')]['id']}})[_0x0543('0x25')](handleEntityNotFound(_0x2177b8,null))[_0x0543('0x25')](removeEntity(_0x2177b8,null))[_0x0543('0x42')](handleError(_0x2177b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 4b0fd6d..49859f9 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 _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 +var _0x8721=['FieldId','lodash','util','../../config/logger','bluebird','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8721,0xd9));var _0x1872=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x8721[_0x1562a2];return _0x39a636;};'use strict';var _=require(_0x1872('0x0'));var util=require(_0x1872('0x1'));var logger=require(_0x1872('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1872('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1872('0x4'));var attributes=require(_0x1872('0x5'));module[_0x1872('0x6')]=function(_0x47ca3a,_0x4befaf){return _0x47ca3a[_0x1872('0x7')](_0x1872('0x8'),attributes,{'tableName':_0x1872('0x9'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x1872('0xa'),_0x1872('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 9613151..6023bd5 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 _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 +var _0xc347=['../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','ZendeskField,\x20%s,\x20%s','result','util','randomstring','../../mysqldb'];(function(_0x4a38f2,_0x3f92ba){var _0xdac198=function(_0x1a9ef3){while(--_0x1a9ef3){_0x4a38f2['push'](_0x4a38f2['shift']());}};_0xdac198(++_0x3f92ba);}(_0xc347,0x1a6));var _0x7c34=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xc347[_0x46aff0];return _0x9d78cf;};'use strict';var _=require('lodash');var util=require(_0x7c34('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c34('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c34('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c34('0x3'))(_0x7c34('0x4'));var config=require(_0x7c34('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7c34('0x6')][_0x7c34('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x90f0a5,_0x28b8a6,_0x34d07d){return new BPromise(function(_0x40c25f,_0x1ddeb2){return client[_0x7c34('0x8')](_0x90f0a5,_0x34d07d)['then'](function(_0x5c42de){logger[_0x7c34('0x9')]('ZendeskField,\x20%s,\x20%s',_0x28b8a6,_0x7c34('0xa'));logger[_0x7c34('0xb')](_0x7c34('0xc'),_0x28b8a6,_0x7c34('0xa'),JSON['stringify'](_0x5c42de));if(_0x5c42de[_0x7c34('0xd')]){if(_0x5c42de[_0x7c34('0xd')]['code']===0x1f4){logger[_0x7c34('0xd')]('ZendeskField,\x20%s,\x20%s',_0x28b8a6,_0x5c42de[_0x7c34('0xd')][_0x7c34('0xe')]);return _0x1ddeb2(_0x5c42de[_0x7c34('0xd')][_0x7c34('0xe')]);}logger[_0x7c34('0xd')](_0x7c34('0xf'),_0x28b8a6,_0x5c42de[_0x7c34('0xd')][_0x7c34('0xe')]);return _0x40c25f(_0x5c42de[_0x7c34('0xd')]['message']);}else{logger[_0x7c34('0x9')](_0x7c34('0xf'),_0x28b8a6,_0x7c34('0xa'));_0x40c25f(_0x5c42de[_0x7c34('0x10')][_0x7c34('0xe')]);}})['catch'](function(_0x2ef205){logger['error']('ZendeskField,\x20%s,\x20%s',_0x28b8a6,_0x2ef205);_0x1ddeb2(_0x2ef205);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 7b99822..686a015 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(_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 +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(_0x9978c6,_0x138067){var _0x1bf52f=function(_0x5ab37b){while(--_0x5ab37b){_0x9978c6['push'](_0x9978c6['shift']());}};_0x1bf52f(++_0x138067);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 8487288..56ff616 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 _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 +var _0xa2d9=['sequelize','STRING'];(function(_0x2f59be,_0x47e4d2){var _0x47bdd0=function(_0x185ff9){while(--_0x185ff9){_0x2f59be['push'](_0x2f59be['shift']());}};_0x47bdd0(++_0x47e4d2);}(_0xa2d9,0x124));var _0x9a2d=function(_0x18deff,_0x46b74a){_0x18deff=_0x18deff-0x0;var _0x5add7c=_0xa2d9[_0x18deff];return _0x5add7c;};'use strict';var Sequelize=require(_0x9a2d('0x0'));module['exports']={'name':{'type':Sequelize[_0x9a2d('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x9a2d('0x1')]},'clientSecret':{'type':Sequelize[_0x9a2d('0x1')]},'serverUrl':{'type':Sequelize[_0x9a2d('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x9a2d('0x1')]},'refreshToken':{'type':Sequelize[_0x9a2d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 1e7437c..0f1b5aa 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 _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 +var _0x38b8=['ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','set','apply','reject','save','then','destroy','end','sendStatus','stack','name','send','index','ZohoAccount','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','where','merge','VIRTUAL','filter','count','includeAll','rows','show','params','rawAttributes','options','find','create','update','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','system_mandatory','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','mustache','util','to-csv'];(function(_0x21acb5,_0x1df19f){var _0x548d9d=function(_0x30d982){while(--_0x30d982){_0x21acb5['push'](_0x21acb5['shift']());}};_0x548d9d(++_0x1df19f);}(_0x38b8,0x7f));var _0x838b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x38b8[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x838b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x838b('0x1'));var zipdir=require(_0x838b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x838b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x838b('0x4'));var util=require(_0x838b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x838b('0x6'));var ejs=require(_0x838b('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x838b('0x8'));var crypto=require(_0x838b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x838b('0x6'));var querystring=require(_0x838b('0xa'));var Papa=require(_0x838b('0xb'));var Redis=require('ioredis');var authService=require(_0x838b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x838b('0xd'));var hardwareService=require(_0x838b('0xe'));var logger=require(_0x838b('0xf'))(_0x838b('0x10'));var utils=require(_0x838b('0x11'));var config=require(_0x838b('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x838b('0x13'))['db'];var integrations=require(_0x838b('0x14'));var jayson=require(_0x838b('0x15'));var client=jayson[_0x838b('0x16')][_0x838b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x21cc45,_0xba19e4,_0x3324de,_0x1ddf43){return new BPromise(function(_0x525c60,_0x13344){var _0x5497fd=_0x1ddf43||client;return _0x5497fd['request'](_0x21cc45,_0x3324de)['then'](function(_0x450b9b){logger[_0x838b('0x18')](_0x838b('0x19'),_0xba19e4,_0x838b('0x1a'));logger[_0x838b('0x1b')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0xba19e4,_0x838b('0x1a'),JSON[_0x838b('0x1c')](_0x450b9b));if(_0x450b9b[_0x838b('0x1d')]){if(_0x450b9b[_0x838b('0x1d')]['code']===0x1f4){logger[_0x838b('0x1d')](_0x838b('0x19'),_0xba19e4,_0x450b9b['error'][_0x838b('0x1e')]);return _0x13344(_0x450b9b[_0x838b('0x1d')]['message']);}logger[_0x838b('0x1d')](_0x838b('0x19'),_0xba19e4,_0x450b9b[_0x838b('0x1d')]['message']);return _0x525c60(_0x450b9b[_0x838b('0x1d')][_0x838b('0x1e')]);}else{logger[_0x838b('0x18')](_0x838b('0x19'),_0xba19e4,_0x838b('0x1a'));_0x525c60(_0x450b9b[_0x838b('0x1f')][_0x838b('0x1e')]);}})[_0x838b('0x20')](function(_0x17a0eb){logger[_0x838b('0x1d')](_0x838b('0x19'),_0xba19e4,_0x17a0eb);_0x13344(_0x17a0eb);});});}function respondWithStatusCode(_0xba76,_0x451089){_0x451089=_0x451089||0xcc;return function(_0x2d9d12){if(_0x2d9d12){return _0xba76['sendStatus'](_0x451089);}return _0xba76[_0x838b('0x21')](_0x451089)['end']();};}function respondWithResult(_0x51adc6,_0x430400){_0x430400=_0x430400||0xc8;return function(_0x2bc24c){if(_0x2bc24c){return _0x51adc6[_0x838b('0x21')](_0x430400)['json'](_0x2bc24c);}};}function respondWithFilteredResult(_0x302445,_0x27f385){return function(_0x47d239){if(_0x47d239){var _0x19fc7b=_0x47d239['count'],_0x322e3f=_0x27f385['offset'],_0x59fa16=_0x27f385['offset']+_0x27f385['limit'],_0x576bfa;if(_0x59fa16>=_0x19fc7b){_0x59fa16=_0x19fc7b;_0x576bfa=0xc8;}else{_0x576bfa=0xce;}_0x302445[_0x838b('0x21')](_0x576bfa);return _0x302445[_0x838b('0x22')]('Content-Range',_0x322e3f+'-'+_0x59fa16+'/'+_0x19fc7b)['json'](_0x47d239);}return null;};}function patchUpdates(_0xc9ebfd){return function(_0x4081b1){try{jsonpatch[_0x838b('0x23')](_0x4081b1,_0xc9ebfd,!![]);}catch(_0x29e161){return BPromise[_0x838b('0x24')](_0x29e161);}return _0x4081b1[_0x838b('0x25')]();};}function saveUpdates(_0xc7b054,_0x3ebc0c){return function(_0x3e1407){if(_0x3e1407){return _0x3e1407['update'](_0xc7b054)[_0x838b('0x26')](function(_0x756dcc){return _0x756dcc;});}return null;};}function removeEntity(_0xd4f382,_0x294ae0){return function(_0x55f36a){if(_0x55f36a){return _0x55f36a[_0x838b('0x27')]()[_0x838b('0x26')](function(){_0xd4f382[_0x838b('0x21')](0xcc)[_0x838b('0x28')]();});}};}function handleEntityNotFound(_0x44d037,_0x4fd48b){return function(_0x43ca2f){if(!_0x43ca2f){_0x44d037[_0x838b('0x29')](0x194);}return _0x43ca2f;};}function handleError(_0x13a3df,_0x4599f3){_0x4599f3=_0x4599f3||0x1f4;return function(_0x489637){logger[_0x838b('0x1d')](_0x489637[_0x838b('0x2a')]);if(_0x489637['name']){delete _0x489637[_0x838b('0x2b')];}_0x13a3df[_0x838b('0x21')](_0x4599f3)[_0x838b('0x2c')](_0x489637);};}exports[_0x838b('0x2d')]=function(_0x3008fa,_0x4bf515){var _0x1e9405={},_0x38c3a3={},_0x5e42ad={'count':0x0,'rows':[]};var _0x2eff71=_['map'](db[_0x838b('0x2e')]['rawAttributes'],function(_0x26e428){return{'name':_0x26e428['fieldName'],'type':_0x26e428[_0x838b('0x2f')][_0x838b('0x30')]};});_0x38c3a3[_0x838b('0x31')]=_[_0x838b('0x32')](_0x2eff71,_0x838b('0x2b'));_0x38c3a3[_0x838b('0x33')]=_[_0x838b('0x34')](_0x3008fa[_0x838b('0x33')]);_0x38c3a3[_0x838b('0x35')]=_[_0x838b('0x36')](_0x38c3a3['model'],_0x38c3a3[_0x838b('0x33')]);_0x1e9405['attributes']=_[_0x838b('0x36')](_0x38c3a3[_0x838b('0x31')],qs[_0x838b('0x37')](_0x3008fa[_0x838b('0x33')][_0x838b('0x37')]));_0x1e9405[_0x838b('0x38')]=_0x1e9405[_0x838b('0x38')][_0x838b('0x39')]?_0x1e9405['attributes']:_0x38c3a3[_0x838b('0x31')];if(!_0x3008fa[_0x838b('0x33')][_0x838b('0x3a')](_0x838b('0x3b'))){_0x1e9405[_0x838b('0x3c')]=qs[_0x838b('0x3c')](_0x3008fa['query'][_0x838b('0x3c')]);_0x1e9405['offset']=qs[_0x838b('0x3d')](_0x3008fa[_0x838b('0x33')]['offset']);}_0x1e9405[_0x838b('0x3e')]=qs[_0x838b('0x3f')](_0x3008fa[_0x838b('0x33')][_0x838b('0x3f')]);_0x1e9405['where']=qs['filters'](_[_0x838b('0x40')](_0x3008fa[_0x838b('0x33')],_0x38c3a3['filters']),_0x2eff71);if(_0x3008fa[_0x838b('0x33')]['filter']){_0x1e9405[_0x838b('0x41')]=_[_0x838b('0x42')](_0x1e9405[_0x838b('0x41')],{'$or':_[_0x838b('0x32')](_0x2eff71,function(_0xece006){if(_0xece006['type']!==_0x838b('0x43')){var _0x5f42a7={};_0x5f42a7[_0xece006[_0x838b('0x2b')]]={'$like':'%'+_0x3008fa['query'][_0x838b('0x44')]+'%'};return _0x5f42a7;}})});}_0x1e9405=_[_0x838b('0x42')]({},_0x1e9405,_0x3008fa['options']);var _0x1e936b={'where':_0x1e9405[_0x838b('0x41')]};return db['ZohoAccount'][_0x838b('0x45')](_0x1e936b)['then'](function(_0xa66be5){_0x5e42ad[_0x838b('0x45')]=_0xa66be5;if(_0x3008fa['query'][_0x838b('0x46')]){_0x1e9405['include']=[{'all':!![]}];}return db['ZohoAccount']['findAll'](_0x1e9405);})['then'](function(_0x2aa6b7){_0x5e42ad[_0x838b('0x47')]=_0x2aa6b7;return _0x5e42ad;})[_0x838b('0x26')](respondWithFilteredResult(_0x4bf515,_0x1e9405))[_0x838b('0x20')](handleError(_0x4bf515,null));};exports[_0x838b('0x48')]=function(_0x1aaeb2,_0x5ebde7){var _0x1a816f={'raw':![],'where':{'id':_0x1aaeb2[_0x838b('0x49')]['id']}},_0x53a25b={};_0x53a25b['model']=_[_0x838b('0x34')](db[_0x838b('0x2e')][_0x838b('0x4a')]);_0x53a25b[_0x838b('0x33')]=_[_0x838b('0x34')](_0x1aaeb2['query']);_0x53a25b['filters']=_[_0x838b('0x36')](_0x53a25b[_0x838b('0x31')],_0x53a25b['query']);_0x1a816f['attributes']=_[_0x838b('0x36')](_0x53a25b[_0x838b('0x31')],qs[_0x838b('0x37')](_0x1aaeb2[_0x838b('0x33')][_0x838b('0x37')]));_0x1a816f[_0x838b('0x38')]=_0x1a816f[_0x838b('0x38')][_0x838b('0x39')]?_0x1a816f[_0x838b('0x38')]:_0x53a25b[_0x838b('0x31')];if(_0x1aaeb2['query']['includeAll']){_0x1a816f['include']=[{'all':!![]}];}_0x1a816f=_[_0x838b('0x42')]({},_0x1a816f,_0x1aaeb2[_0x838b('0x4b')]);return db[_0x838b('0x2e')][_0x838b('0x4c')](_0x1a816f)[_0x838b('0x26')](handleEntityNotFound(_0x5ebde7,null))['then'](respondWithResult(_0x5ebde7,null))[_0x838b('0x20')](handleError(_0x5ebde7,null));};exports['create']=function(_0x59ebde,_0x27ee83){return db[_0x838b('0x2e')][_0x838b('0x4d')](_0x59ebde['body'],{})[_0x838b('0x26')](respondWithResult(_0x27ee83,0xc9))[_0x838b('0x20')](handleError(_0x27ee83,null));};exports[_0x838b('0x4e')]=function(_0x12180b,_0x28d753){if(_0x12180b[_0x838b('0x4f')]['id']){delete _0x12180b['body']['id'];}return db[_0x838b('0x2e')][_0x838b('0x4c')]({'where':{'id':_0x12180b[_0x838b('0x49')]['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x28d753,null))[_0x838b('0x26')](saveUpdates(_0x12180b[_0x838b('0x4f')],null))[_0x838b('0x26')](respondWithResult(_0x28d753,null))['catch'](handleError(_0x28d753,null));};exports[_0x838b('0x27')]=function(_0xf115f8,_0x6c68e2){return db[_0x838b('0x2e')][_0x838b('0x4c')]({'where':{'id':_0xf115f8[_0x838b('0x49')]['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x6c68e2,null))[_0x838b('0x26')](removeEntity(_0x6c68e2,null))[_0x838b('0x20')](handleError(_0x6c68e2,null));};exports[_0x838b('0x50')]=function(_0x4a170c,_0x781e1e,_0x5025c2){var _0x3c501c={};var _0x43a95d={};var _0x12c565;var _0x164e01;return db[_0x838b('0x2e')][_0x838b('0x51')]({'where':{'id':_0x4a170c['params']['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x781e1e,null))[_0x838b('0x26')](function(_0x1321e1){if(_0x1321e1){_0x12c565=_0x1321e1;_0x43a95d[_0x838b('0x31')]=_[_0x838b('0x34')](db[_0x838b('0x52')][_0x838b('0x4a')]);_0x43a95d[_0x838b('0x33')]=_[_0x838b('0x34')](_0x4a170c[_0x838b('0x33')]);_0x43a95d[_0x838b('0x35')]=_[_0x838b('0x36')](_0x43a95d[_0x838b('0x31')],_0x43a95d[_0x838b('0x33')]);_0x3c501c['attributes']=_[_0x838b('0x36')](_0x43a95d['model'],qs['fields'](_0x4a170c[_0x838b('0x33')]['fields']));_0x3c501c[_0x838b('0x38')]=_0x3c501c[_0x838b('0x38')][_0x838b('0x39')]?_0x3c501c[_0x838b('0x38')]:_0x43a95d[_0x838b('0x31')];_0x3c501c[_0x838b('0x3e')]=qs['sort'](_0x4a170c['query'][_0x838b('0x3f')]);_0x3c501c[_0x838b('0x41')]=qs[_0x838b('0x35')](_[_0x838b('0x40')](_0x4a170c['query'],_0x43a95d['filters']));if(_0x4a170c['query'][_0x838b('0x44')]){_0x3c501c[_0x838b('0x41')]=_['merge'](_0x3c501c[_0x838b('0x41')],{'$or':_['map'](_0x3c501c[_0x838b('0x38')],function(_0x5ab860){var _0x54e502={};_0x54e502[_0x5ab860]={'$like':'%'+_0x4a170c['query']['filter']+'%'};return _0x54e502;})});}_0x3c501c=_[_0x838b('0x42')]({},_0x3c501c,_0x4a170c[_0x838b('0x4b')]);return _0x12c565['getConfigurations'](_0x3c501c);}})[_0x838b('0x26')](function(_0x4d03b8){if(_0x4d03b8){_0x164e01=_0x4d03b8[_0x838b('0x39')];if(!_0x4a170c[_0x838b('0x33')][_0x838b('0x3a')](_0x838b('0x3b'))){_0x3c501c[_0x838b('0x3c')]=qs[_0x838b('0x3c')](_0x4a170c[_0x838b('0x33')][_0x838b('0x3c')]);_0x3c501c['offset']=qs[_0x838b('0x3d')](_0x4a170c[_0x838b('0x33')][_0x838b('0x3d')]);}return _0x12c565[_0x838b('0x50')](_0x3c501c);}})['then'](function(_0x59e508){if(_0x59e508){return _0x59e508?{'count':_0x164e01,'rows':_0x59e508}:null;}})[_0x838b('0x26')](respondWithResult(_0x781e1e,null))['catch'](handleError(_0x781e1e,null));};exports[_0x838b('0x53')]=function(_0x3ecfbe,_0x29fa16,_0x42c321){if(_0x3ecfbe[_0x838b('0x4f')]['id']){delete _0x3ecfbe[_0x838b('0x4f')]['id'];}return db[_0x838b('0x2e')][_0x838b('0x51')]({'where':{'id':_0x3ecfbe[_0x838b('0x49')]['id']}})[_0x838b('0x26')](handleEntityNotFound(_0x29fa16,null))[_0x838b('0x26')](function(_0x5e37e1){if(_0x5e37e1){_0x3ecfbe[_0x838b('0x4f')]['AccountId']=_0x5e37e1['id'];_0x3ecfbe['body'][_0x838b('0x54')]=integrations[_0x838b('0x55')](_0x3ecfbe[_0x838b('0x4f')][_0x838b('0x56')],_0x3ecfbe['body'][_0x838b('0x2f')]);_0x3ecfbe[_0x838b('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x3ecfbe[_0x838b('0x4f')][_0x838b('0x56')],_0x3ecfbe['body'][_0x838b('0x2f')]);return db[_0x838b('0x52')]['create'](_0x3ecfbe['body'],{'include':[{'model':db['ZohoField'],'as':_0x838b('0x54')},{'model':db['ZohoField'],'as':_0x838b('0x57')}]});}return null;})['then'](respondWithResult(_0x29fa16,null))[_0x838b('0x20')](handleError(_0x29fa16,null));};function getAccessToken(_0x2c8ea5){return new Promise(function(_0x2cf9be,_0x272d2b){var _0x31e780;switch(_0x2c8ea5[_0x838b('0x58')]){case'US':_0x31e780=_0x838b('0x59');break;case'AU':_0x31e780=_0x838b('0x5a');break;case'EU':_0x31e780=_0x838b('0x5b');break;case'IN':_0x31e780='https://accounts.zoho.in';break;case'CN':_0x31e780='https://accounts.zoho.com.cn';break;default:_0x31e780=_0x838b('0x5b');break;}var _0x1241df={'method':_0x838b('0x5c'),'uri':_0x31e780+_0x838b('0x5d'),'qs':{'refresh_token':_0x2c8ea5[_0x838b('0x5e')],'client_id':_0x2c8ea5['clientId'],'client_secret':_0x2c8ea5[_0x838b('0x5f')],'grant_type':_0x838b('0x60')},'json':!![]};return rp(_0x1241df)['then'](function(_0x4e82aa){if(_0x4e82aa[_0x838b('0x61')]){_0x2cf9be(_0x4e82aa[_0x838b('0x61')]);}else{_0x272d2b(_0x838b('0x62'));}})[_0x838b('0x20')](function(_0x57ff74){_0x272d2b(_0x57ff74);});});}exports[_0x838b('0x63')]=function(_0x243eaa,_0x3f28da,_0x440a4c){var _0x3d4fce,_0x44a251,_0xa3f233,_0x505f2,_0x359753;return db[_0x838b('0x2e')][_0x838b('0x51')]({'where':{'id':_0x243eaa[_0x838b('0x49')]['id']},'attributes':['id',_0x838b('0x64'),'zone','clientId',_0x838b('0x5f'),'serverUrl',_0x838b('0x65'),_0x838b('0x5e')]})[_0x838b('0x26')](handleEntityNotFound(_0x3f28da,null))['then'](function(_0x40ba64){_0x359753=_0x40ba64;_0x3d4fce=_0x359753[_0x838b('0x64')];_0x44a251=_0x3d4fce===_0x838b('0x66')?'eu':_0x838b('0x67');_0xa3f233=_0x359753[_0x838b('0x68')];var _0x5a3d0f=_0xa3f233[_0x838b('0x69')](-0x1);if(_0x5a3d0f==='/'||_0x5a3d0f==='\x5c'||_0x5a3d0f===':'){_0xa3f233=_0xa3f233[_0x838b('0x6a')](0x0,_0xa3f233[_0x838b('0x6b')](_0x5a3d0f));}if(!_0x359753[_0x838b('0x5e')]){throw new Error(_0x838b('0x6c'));}return getAccessToken(_0x359753);})['then'](function(_0x81909e){if(_0x81909e){return rp({'method':_0x838b('0x6d'),'uri':util[_0x838b('0x6e')](_0x838b('0x6f'),_0x44a251),'qs':{'module':_0x838b('0x70')},'headers':{'Authorization':_0x838b('0x71')+_0x81909e},'json':!![]});}})[_0x838b('0x26')](function(_0x3a97d4){if(_0x3a97d4){if(_0x3a97d4[_0x838b('0x72')]&&_0x3a97d4['response'][_0x838b('0x1d')]){throw new Error(_0x3a97d4[_0x838b('0x72')][_0x838b('0x1d')][_0x838b('0x1e')]);}var _0x54e3b8=[];var _0x3ab270=[];var _0xd52bf8=[_0x838b('0x73'),_0x838b('0x74'),'Description',_0x838b('0x75'),_0x838b('0x76'),_0x838b('0x77'),_0x838b('0x78'),_0x838b('0x79')];_0x3ab270=_[_0x838b('0x7a')](_0x3a97d4['fields'],function(_0x1f0d31){return _0xd52bf8['includes'](_0x1f0d31['api_name']);});for(var _0x29c148=0x0;_0x29c148<_0x3ab270[_0x838b('0x39')];_0x29c148++){if(_0x3ab270[_0x29c148][_0x838b('0x7b')]===![]){_0x54e3b8[_0x838b('0x7c')]({'id':_0x3ab270[_0x29c148]['id'],'name':_0x3ab270[_0x29c148][_0x838b('0x7d')],'custom':_0x3ab270[_0x29c148][_0x838b('0x7e')],'options':_0x3ab270[_0x29c148][_0x838b('0x7f')]===_0x838b('0x80')&&_0x3ab270[_0x29c148][_0x838b('0x81')]['length']>-0x1?_[_0x838b('0x32')](_0x3ab270[_0x29c148][_0x838b('0x81')],function(_0x50fbec){return{'name':_0x50fbec,'value':_0x50fbec};}):[]});}}return{'count':_0x54e3b8[_0x838b('0x39')],'rows':_0x54e3b8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x3f28da,null))['catch'](function(_0x846cf1){var _0x527c30=_0x243eaa[_0x838b('0x33')][_0x838b('0x82')]?0x1f4:_0x846cf1[_0x838b('0x83')]||0x1f4;logger[_0x838b('0x1d')](_0x838b('0x84'),_0x838b('0x63'),_0x527c30,JSON[_0x838b('0x1c')](_0x846cf1));delete _0x846cf1[_0x838b('0x2b')];if(_0x527c30===0x191){_0x527c30=0x190;}_0x3f28da[_0x838b('0x21')](_0x527c30)[_0x838b('0x2c')](_0x243eaa[_0x838b('0x33')][_0x838b('0x82')]?{'message':_0x838b('0x85'),'statusCode':_0x846cf1[_0x838b('0x83')]}:_0x846cf1);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index cdd20f0..2870010 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 _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 +var _0xf6e2=['./intZohoAccount.attributes','../../components/integrations/configuration','int_zoho_accounts','zone','serverUrl','changed','clientId','clientSecret','code','host','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','application/x-www-form-urlencoded','parse','util','../../config/logger','moment','bluebird','path','../../config/environment'];(function(_0x4e0587,_0x409e3a){var _0x39a2c6=function(_0x5aa883){while(--_0x5aa883){_0x4e0587['push'](_0x4e0587['shift']());}};_0x39a2c6(++_0x409e3a);}(_0xf6e2,0x104));var _0x2f6e=function(_0x16e2a0,_0x499f26){_0x16e2a0=_0x16e2a0-0x0;var _0x582f15=_0xf6e2[_0x16e2a0];return _0x582f15;};'use strict';var _=require('lodash');var util=require(_0x2f6e('0x0'));var logger=require(_0x2f6e('0x1'))('api');var moment=require(_0x2f6e('0x2'));var BPromise=require(_0x2f6e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f6e('0x4'));var rimraf=require('rimraf');var config=require(_0x2f6e('0x5'));var attributes=require(_0x2f6e('0x6'));var integrations=require(_0x2f6e('0x7'));module['exports']=function(_0x233e73,_0x39f334){return _0x233e73['define']('ZohoAccount',attributes,{'tableName':_0x2f6e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c581d,_0x191164,_0x5c3683){if(_0x3c581d['changed'](_0x2f6e('0x9'))||_0x3c581d['changed'](_0x2f6e('0xa'))||_0x3c581d[_0x2f6e('0xb')](_0x2f6e('0xc'))||_0x3c581d[_0x2f6e('0xb')](_0x2f6e('0xd'))||_0x3c581d['changed'](_0x2f6e('0xe'))||_0x3c581d[_0x2f6e('0xb')](_0x2f6e('0xf'))){var _0x28c2c6,_0x41f8de;_0x28c2c6=_0x3c581d[_0x2f6e('0xa')];var _0x5ba82b=_0x28c2c6[_0x2f6e('0x10')](-0x1);if(_0x5ba82b==='/'||_0x5ba82b==='\x5c'||_0x5ba82b===':'){_0x28c2c6=_0x28c2c6[_0x2f6e('0x11')](0x0,_0x28c2c6['lastIndexOf'](_0x5ba82b));}switch(_0x3c581d[_0x2f6e('0x9')]){case'US':_0x41f8de='https://accounts.zoho.com';break;case'AU':_0x41f8de=_0x2f6e('0x12');break;case'IN':_0x41f8de='https://accounts.zoho.in';break;case'CN':_0x41f8de=_0x2f6e('0x13');break;default:_0x41f8de=_0x2f6e('0x14');break;}var _0xa0f7c2={'method':_0x2f6e('0x15'),'uri':_0x41f8de+_0x2f6e('0x16'),'form':{'grant_type':_0x2f6e('0x17'),'client_id':_0x3c581d[_0x2f6e('0xc')],'client_secret':_0x3c581d[_0x2f6e('0xd')],'redirect_uri':_0x3c581d[_0x2f6e('0xa')],'code':_0x3c581d[_0x2f6e('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0xa0f7c2)[_0x2f6e('0x18')](function(_0x169b50){var _0x473278=JSON['parse'](_0x169b50);if(_0x473278[_0x2f6e('0x19')]){_0x3c581d['refreshToken']=_0x473278[_0x2f6e('0x19')];logger[_0x2f6e('0x1a')](util[_0x2f6e('0x1b')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3c581d[_0x2f6e('0x1c')],_0x3c581d['id']));}else{logger[_0x2f6e('0x1d')](util[_0x2f6e('0x1b')](_0x2f6e('0x1e'),_0x3c581d['name'],_0x3c581d['id']),util[_0x2f6e('0x1f')](_0x473278,{'showHidden':![],'depth':null}));}return _0x5c3683(null,_0x191164);})[_0x2f6e('0x20')](function(_0x282603){logger[_0x2f6e('0x1d')](util['format'](_0x2f6e('0x1e'),_0x3c581d[_0x2f6e('0x1c')],_0x3c581d['id']),util[_0x2f6e('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x5c3683(_0x282603);});}else{return _0x5c3683(null,_0x191164);}},'beforeUpdate':function(_0x5c69a3,_0x366435,_0x55caf2){if(_0x5c69a3['changed'](_0x2f6e('0x9'))||_0x5c69a3['changed']('serverUrl')||_0x5c69a3['changed'](_0x2f6e('0xc'))||_0x5c69a3[_0x2f6e('0xb')](_0x2f6e('0xd'))||_0x5c69a3[_0x2f6e('0xb')](_0x2f6e('0xe'))||_0x5c69a3[_0x2f6e('0xb')](_0x2f6e('0xf'))){var _0x377950,_0x357213;_0x377950=_0x5c69a3[_0x2f6e('0xa')];var _0x30b72b=_0x377950[_0x2f6e('0x10')](-0x1);if(_0x30b72b==='/'||_0x30b72b==='\x5c'||_0x30b72b===':'){_0x377950=_0x377950[_0x2f6e('0x11')](0x0,_0x377950[_0x2f6e('0x21')](_0x30b72b));}switch(_0x5c69a3['zone']){case'US':_0x357213=_0x2f6e('0x22');break;case'AU':_0x357213=_0x2f6e('0x12');break;case'IN':_0x357213=_0x2f6e('0x23');break;case'CN':_0x357213=_0x2f6e('0x13');break;default:_0x357213=_0x2f6e('0x14');break;}var _0x482b03={'method':_0x2f6e('0x15'),'uri':_0x357213+_0x2f6e('0x16'),'form':{'grant_type':_0x2f6e('0x17'),'client_id':_0x5c69a3['clientId'],'client_secret':_0x5c69a3[_0x2f6e('0xd')],'redirect_uri':_0x5c69a3[_0x2f6e('0xa')],'code':_0x5c69a3[_0x2f6e('0xe')]},'headers':{'Content-Type':_0x2f6e('0x24')}};return rp(_0x482b03)[_0x2f6e('0x18')](function(_0x449566){var _0x19da3b=JSON[_0x2f6e('0x25')](_0x449566);if(_0x19da3b[_0x2f6e('0x19')]){_0x5c69a3['refreshToken']=_0x19da3b[_0x2f6e('0x19')];logger[_0x2f6e('0x1a')](util[_0x2f6e('0x1b')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5c69a3[_0x2f6e('0x1c')],_0x5c69a3['id']));}else{logger[_0x2f6e('0x1d')](util[_0x2f6e('0x1b')](_0x2f6e('0x1e'),_0x5c69a3['name'],_0x5c69a3['id']),util['inspect'](_0x19da3b,{'showHidden':![],'depth':null}));}return _0x55caf2(null,_0x366435);})[_0x2f6e('0x20')](function(_0x35f04c){logger[_0x2f6e('0x1d')](util[_0x2f6e('0x1b')](_0x2f6e('0x1e'),_0x5c69a3[_0x2f6e('0x1c')],_0x5c69a3['id']),util[_0x2f6e('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x55caf2(_0x35f04c);});}else{return _0x55caf2(null,_0x366435);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 30cad99..f707909 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 _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 +var _0xf893=['GetZohoAccount','stringify','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZohoAccount','options','raw','where','limit','include','map','model','attributes'];(function(_0x263f2e,_0x2da62f){var _0x3474e3=function(_0x1aa23e){while(--_0x1aa23e){_0x263f2e['push'](_0x263f2e['shift']());}};_0x3474e3(++_0x2da62f);}(_0xf893,0xf3));var _0x3f89=function(_0x5cd5fa,_0x5c7926){_0x5cd5fa=_0x5cd5fa-0x0;var _0x3fc40d=_0xf893[_0x5cd5fa];return _0x3fc40d;};'use strict';var _=require(_0x3f89('0x0'));var util=require(_0x3f89('0x1'));var moment=require(_0x3f89('0x2'));var BPromise=require(_0x3f89('0x3'));var rs=require(_0x3f89('0x4'));var fs=require('fs');var Redis=require(_0x3f89('0x5'));var db=require(_0x3f89('0x6'))['db'];var utils=require(_0x3f89('0x7'));var logger=require('../../config/logger')(_0x3f89('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3f89('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x117f1c,_0x5bcc44,_0x550016){return new BPromise(function(_0x3b9b7b,_0x28553f){return client[_0x3f89('0xa')](_0x117f1c,_0x550016)[_0x3f89('0xb')](function(_0x1c6cae){logger[_0x3f89('0xc')](_0x3f89('0xd'),_0x5bcc44,_0x3f89('0xe'));logger[_0x3f89('0xf')](_0x3f89('0x10'),_0x5bcc44,_0x3f89('0xe'),JSON['stringify'](_0x1c6cae));if(_0x1c6cae[_0x3f89('0x11')]){if(_0x1c6cae[_0x3f89('0x11')][_0x3f89('0x12')]===0x1f4){logger[_0x3f89('0x11')](_0x3f89('0xd'),_0x5bcc44,_0x1c6cae['error']['message']);return _0x28553f(_0x1c6cae['error'][_0x3f89('0x13')]);}logger[_0x3f89('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x5bcc44,_0x1c6cae[_0x3f89('0x11')][_0x3f89('0x13')]);return _0x3b9b7b(_0x1c6cae[_0x3f89('0x11')][_0x3f89('0x13')]);}else{logger[_0x3f89('0xc')](_0x3f89('0xd'),_0x5bcc44,_0x3f89('0xe'));_0x3b9b7b(_0x1c6cae['result']['message']);}})['catch'](function(_0x56a776){logger[_0x3f89('0x11')](_0x3f89('0xd'),_0x5bcc44,_0x56a776);_0x28553f(_0x56a776);});});}exports['GetZohoAccount']=function(_0x340eaf){var _0x45a98b=this;return new Promise(function(_0x40b88b,_0x4b309e){return db[_0x3f89('0x14')]['findAll']({'raw':_0x340eaf[_0x3f89('0x15')]?_0x340eaf[_0x3f89('0x15')][_0x3f89('0x16')]===undefined?!![]:![]:!![],'where':_0x340eaf[_0x3f89('0x15')]?_0x340eaf[_0x3f89('0x15')][_0x3f89('0x17')]||null:null,'attributes':_0x340eaf[_0x3f89('0x15')]?_0x340eaf[_0x3f89('0x15')]['attributes']||null:null,'limit':_0x340eaf[_0x3f89('0x15')]?_0x340eaf['options'][_0x3f89('0x18')]||null:null,'include':_0x340eaf[_0x3f89('0x15')]?_0x340eaf['options'][_0x3f89('0x19')]?_[_0x3f89('0x1a')](_0x340eaf[_0x3f89('0x15')][_0x3f89('0x19')],function(_0x576862){return{'model':db[_0x576862[_0x3f89('0x1b')]],'as':_0x576862['as'],'attributes':_0x576862[_0x3f89('0x1c')],'include':_0x576862['include']?_[_0x3f89('0x1a')](_0x576862[_0x3f89('0x19')],function(_0x1d22a6){return{'model':db[_0x1d22a6[_0x3f89('0x1b')]],'as':_0x1d22a6['as'],'attributes':_0x1d22a6[_0x3f89('0x1c')],'include':_0x1d22a6['include']?_['map'](_0x1d22a6[_0x3f89('0x19')],function(_0x57157e){return{'model':db[_0x57157e['model']],'as':_0x57157e['as'],'attributes':_0x57157e[_0x3f89('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3f89('0xb')](function(_0x4e3fd4){logger[_0x3f89('0xc')]('GetZohoAccount',_0x340eaf);logger[_0x3f89('0xf')](_0x3f89('0x1d'),_0x340eaf,JSON[_0x3f89('0x1e')](_0x4e3fd4));_0x40b88b(_0x4e3fd4);})[_0x3f89('0x1f')](function(_0x289d50){logger['error'](_0x3f89('0x1d'),_0x289d50['message'],_0x340eaf);_0x4b309e(_0x45a98b[_0x3f89('0x11')](0x1f4,_0x289d50[_0x3f89('0x13')]));});});};exports[_0x3f89('0x20')]=function(_0x164379){var _0x49110d=this;return new Promise(function(_0x497593,_0x43916b){return db[_0x3f89('0x14')][_0x3f89('0x21')]({'raw':_0x164379['options']?_0x164379[_0x3f89('0x15')][_0x3f89('0x16')]===undefined?!![]:![]:!![],'where':_0x164379['options']?_0x164379[_0x3f89('0x15')]['where']||null:null,'attributes':_0x164379[_0x3f89('0x15')]?_0x164379[_0x3f89('0x15')][_0x3f89('0x1c')]||null:null,'include':_0x164379['options']?_0x164379['options']['include']?_[_0x3f89('0x1a')](_0x164379[_0x3f89('0x15')][_0x3f89('0x19')],function(_0x56a842){return{'model':db[_0x56a842[_0x3f89('0x1b')]],'as':_0x56a842['as'],'attributes':_0x56a842[_0x3f89('0x1c')],'include':_0x56a842[_0x3f89('0x19')]?_['map'](_0x56a842[_0x3f89('0x19')],function(_0x18991c){return{'model':db[_0x18991c[_0x3f89('0x1b')]],'as':_0x18991c['as'],'attributes':_0x18991c[_0x3f89('0x1c')],'include':_0x18991c[_0x3f89('0x19')]?_[_0x3f89('0x1a')](_0x18991c[_0x3f89('0x19')],function(_0x14e581){return{'model':db[_0x14e581[_0x3f89('0x1b')]],'as':_0x14e581['as'],'attributes':_0x14e581['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x576c6b){logger['info'](_0x3f89('0x20'),_0x164379);logger[_0x3f89('0xf')]('ShowZohoAccount',_0x164379,JSON[_0x3f89('0x1e')](_0x576c6b));_0x497593(_0x576c6b);})[_0x3f89('0x1f')](function(_0x56fd3f){logger[_0x3f89('0x11')]('ShowZohoAccount',_0x56fd3f[_0x3f89('0x13')],_0x164379);_0x43916b(_0x49110d['error'](0x1f4,_0x56fd3f[_0x3f89('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 64e56ba..3ea1f72 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 _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 +var _0xffaa=['put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','create'];(function(_0x1da27a,_0x2fafc9){var _0x3d1e0c=function(_0x2c4c84){while(--_0x2c4c84){_0x1da27a['push'](_0x1da27a['shift']());}};_0x3d1e0c(++_0x2fafc9);}(_0xffaa,0x130));var _0xaffa=function(_0x4665f3,_0x3fc0c0){_0x4665f3=_0x4665f3-0x0;var _0x1609f6=_0xffaa[_0x4665f3];return _0x1609f6;};'use strict';var multer=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var path=require(_0xaffa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaffa('0x3')]();var auth=require(_0xaffa('0x4'));var interaction=require(_0xaffa('0x5'));var config=require(_0xaffa('0x6'));var controller=require(_0xaffa('0x7'));router[_0xaffa('0x8')]('/',auth[_0xaffa('0x9')](),controller[_0xaffa('0xa')]);router[_0xaffa('0x8')](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0xc')]);router[_0xaffa('0x8')](_0xaffa('0xd'),auth[_0xaffa('0x9')](),controller['getFields']);router[_0xaffa('0x8')]('/:id/subjects',auth[_0xaffa('0x9')](),controller[_0xaffa('0xe')]);router[_0xaffa('0x8')]('/:id/descriptions',auth[_0xaffa('0x9')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller[_0xaffa('0xf')]);router[_0xaffa('0x10')](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0x11')]);router['delete'](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0x12')]);module[_0xaffa('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index cbbe9e1..153ecd8 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 _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 +var _0xaf46=['ENUM','contact','nothing','sequelize','exports','STRING'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xaf46,0x75));var _0x6af4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xaf46[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6af4('0x0'));module[_0x6af4('0x1')]={'name':{'type':Sequelize[_0x6af4('0x2')]},'moduleCreate':{'type':Sequelize[_0x6af4('0x3')]('lead',_0x6af4('0x4'),_0x6af4('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x6af4('0x4'),'lead'),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x6af4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4cf639e..32c91fb 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(_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 +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(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 b509e03..0aa0cfb 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 _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 +var _0x3fa3=['rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','util','api','moment','bluebird','request-promise'];(function(_0xc03ff,_0x3b2f39){var _0x3ffa6d=function(_0x4c7047){while(--_0x4c7047){_0xc03ff['push'](_0xc03ff['shift']());}};_0x3ffa6d(++_0x3b2f39);}(_0x3fa3,0xb6));var _0x33fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3fa3[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x33fa('0x0'));var logger=require('../../config/logger')(_0x33fa('0x1'));var moment=require(_0x33fa('0x2'));var BPromise=require(_0x33fa('0x3'));var rp=require(_0x33fa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33fa('0x5'));var config=require(_0x33fa('0x6'));var attributes=require(_0x33fa('0x7'));module[_0x33fa('0x8')]=function(_0xcdcb12,_0x29c653){return _0xcdcb12[_0x33fa('0x9')](_0x33fa('0xa'),attributes,{'tableName':'int_zoho_configurations','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 773d8e0..4a4d06f 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 _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 +var _0x1345=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x521929,_0x479be5){var _0x632436=function(_0x288290){while(--_0x288290){_0x521929['push'](_0x521929['shift']());}};_0x632436(++_0x479be5);}(_0x1345,0x1a8));var _0x5134=function(_0x55ffee,_0x1862c1){_0x55ffee=_0x55ffee-0x0;var _0x27992d=_0x1345[_0x55ffee];return _0x27992d;};'use strict';var _=require('lodash');var util=require(_0x5134('0x0'));var moment=require('moment');var BPromise=require(_0x5134('0x1'));var rs=require(_0x5134('0x2'));var fs=require('fs');var Redis=require(_0x5134('0x3'));var db=require(_0x5134('0x4'))['db'];var utils=require(_0x5134('0x5'));var logger=require(_0x5134('0x6'))(_0x5134('0x7'));var config=require(_0x5134('0x8'));var jayson=require(_0x5134('0x9'));var client=jayson[_0x5134('0xa')][_0x5134('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54f367,_0x728c7b,_0x3a1eed){return new BPromise(function(_0x290c2e,_0x2259fc){return client['request'](_0x54f367,_0x3a1eed)[_0x5134('0xc')](function(_0x2d020e){logger[_0x5134('0xd')](_0x5134('0xe'),_0x728c7b,_0x5134('0xf'));logger[_0x5134('0x10')](_0x5134('0x11'),_0x728c7b,_0x5134('0xf'),JSON['stringify'](_0x2d020e));if(_0x2d020e[_0x5134('0x12')]){if(_0x2d020e[_0x5134('0x12')]['code']===0x1f4){logger[_0x5134('0x12')](_0x5134('0xe'),_0x728c7b,_0x2d020e['error'][_0x5134('0x13')]);return _0x2259fc(_0x2d020e[_0x5134('0x12')][_0x5134('0x13')]);}logger[_0x5134('0x12')](_0x5134('0xe'),_0x728c7b,_0x2d020e[_0x5134('0x12')][_0x5134('0x13')]);return _0x290c2e(_0x2d020e['error'][_0x5134('0x13')]);}else{logger[_0x5134('0xd')](_0x5134('0xe'),_0x728c7b,_0x5134('0xf'));_0x290c2e(_0x2d020e[_0x5134('0x14')]['message']);}})[_0x5134('0x15')](function(_0x8bcd59){logger['error'](_0x5134('0xe'),_0x728c7b,_0x8bcd59);_0x2259fc(_0x8bcd59);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ccc2e58..9de6d16 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 _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 +var _0x1399=['isAuthenticated','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','/:id'];(function(_0x372b07,_0x6af854){var _0x4ec305=function(_0x310c41){while(--_0x310c41){_0x372b07['push'](_0x372b07['shift']());}};_0x4ec305(++_0x6af854);}(_0x1399,0x16c));var _0x9139=function(_0x6cd6f,_0x268963){_0x6cd6f=_0x6cd6f-0x0;var _0x3f6240=_0x1399[_0x6cd6f];return _0x3f6240;};'use strict';var multer=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var path=require('path');var timeout=require(_0x9139('0x2'));var express=require('express');var router=express[_0x9139('0x3')]();var auth=require(_0x9139('0x4'));var interaction=require(_0x9139('0x5'));var config=require(_0x9139('0x6'));var controller=require(_0x9139('0x7'));router[_0x9139('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9139('0x8')](_0x9139('0x9'),auth[_0x9139('0xa')](),controller['show']);router[_0x9139('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9139('0xc')](_0x9139('0x9'),auth['isAuthenticated'](),controller[_0x9139('0xd')]);router[_0x9139('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9139('0xf')]);module[_0x9139('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 312b251..1d606ef 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 _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 +var _0xc770=['string','STRING','ENUM','sequelize','exports','variable','customVariable','keyValue'];(function(_0x43f6ea,_0x100655){var _0x571323=function(_0x1a679f){while(--_0x1a679f){_0x43f6ea['push'](_0x43f6ea['shift']());}};_0x571323(++_0x100655);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0c77('0x0'));module[_0x0c77('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x0c77('0x2'),_0x0c77('0x3'),_0x0c77('0x4')),'defaultValue':_0x0c77('0x5')},'content':{'type':Sequelize[_0x0c77('0x6')]},'key':{'type':Sequelize[_0x0c77('0x6')]},'keyType':{'type':Sequelize[_0x0c77('0x7')](_0x0c77('0x5'),'variable',_0x0c77('0x3'))},'keyContent':{'type':Sequelize[_0x0c77('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0c77('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0c77('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 1f4ac57..ea7fc32 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 _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 +var _0xcd66=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','rawAttributes','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','update','then','destroy','end','error','stack','name','send','index','map','ZohoField','fieldName','type'];(function(_0x713e72,_0x2ba0a7){var _0x133658=function(_0x5e8595){while(--_0x5e8595){_0x713e72['push'](_0x713e72['shift']());}};_0x133658(++_0x2ba0a7);}(_0xcd66,0x1d7));var _0x6cd6=function(_0x466041,_0x328d81){_0x466041=_0x466041-0x0;var _0x184b3c=_0xcd66[_0x466041];return _0x184b3c;};'use strict';var pdf=require(_0x6cd6('0x0'));var emlformat=require(_0x6cd6('0x1'));var rimraf=require(_0x6cd6('0x2'));var zipdir=require(_0x6cd6('0x3'));var jsonpatch=require(_0x6cd6('0x4'));var rp=require(_0x6cd6('0x5'));var moment=require(_0x6cd6('0x6'));var BPromise=require(_0x6cd6('0x7'));var Mustache=require(_0x6cd6('0x8'));var util=require('util');var path=require(_0x6cd6('0x9'));var sox=require('sox');var csv=require(_0x6cd6('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6cd6('0xb'));var jsforce=require(_0x6cd6('0xc'));var deskjs=require(_0x6cd6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6cd6('0xe'));var Papa=require(_0x6cd6('0xf'));var Redis=require(_0x6cd6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6cd6('0x11'));var as=require(_0x6cd6('0x12'));var hardwareService=require(_0x6cd6('0x13'));var logger=require(_0x6cd6('0x14'))(_0x6cd6('0x15'));var utils=require(_0x6cd6('0x16'));var config=require(_0x6cd6('0x17'));var licenseUtil=require(_0x6cd6('0x18'));var db=require(_0x6cd6('0x19'))['db'];function respondWithStatusCode(_0x33e309,_0x3b6723){_0x3b6723=_0x3b6723||0xcc;return function(_0x3848c7){if(_0x3848c7){return _0x33e309[_0x6cd6('0x1a')](_0x3b6723);}return _0x33e309[_0x6cd6('0x1b')](_0x3b6723)['end']();};}function respondWithResult(_0x15670b,_0xf8859a){_0xf8859a=_0xf8859a||0xc8;return function(_0x26c6f8){if(_0x26c6f8){return _0x15670b['status'](_0xf8859a)['json'](_0x26c6f8);}};}function respondWithFilteredResult(_0x1e3a14,_0x5362cb){return function(_0x3eda38){if(_0x3eda38){var _0x238a77=_0x3eda38[_0x6cd6('0x1c')],_0x5e5e24=_0x5362cb[_0x6cd6('0x1d')],_0x561ed7=_0x5362cb[_0x6cd6('0x1d')]+_0x5362cb[_0x6cd6('0x1e')],_0x4cc12c;if(_0x561ed7>=_0x238a77){_0x561ed7=_0x238a77;_0x4cc12c=0xc8;}else{_0x4cc12c=0xce;}_0x1e3a14[_0x6cd6('0x1b')](_0x4cc12c);return _0x1e3a14[_0x6cd6('0x1f')](_0x6cd6('0x20'),_0x5e5e24+'-'+_0x561ed7+'/'+_0x238a77)[_0x6cd6('0x21')](_0x3eda38);}return null;};}function patchUpdates(_0x500e3b){return function(_0xf6fd29){try{jsonpatch['apply'](_0xf6fd29,_0x500e3b,!![]);}catch(_0xb5a664){return BPromise['reject'](_0xb5a664);}return _0xf6fd29['save']();};}function saveUpdates(_0x1e5a3b,_0x1f216e){return function(_0x3eca2e){if(_0x3eca2e){return _0x3eca2e[_0x6cd6('0x22')](_0x1e5a3b)[_0x6cd6('0x23')](function(_0x35483e){return _0x35483e;});}return null;};}function removeEntity(_0x325505,_0x5bbc88){return function(_0x37c940){if(_0x37c940){return _0x37c940[_0x6cd6('0x24')]()[_0x6cd6('0x23')](function(){_0x325505['status'](0xcc)[_0x6cd6('0x25')]();});}};}function handleEntityNotFound(_0x1252e5,_0x4d61d9){return function(_0x9858e){if(!_0x9858e){_0x1252e5[_0x6cd6('0x1a')](0x194);}return _0x9858e;};}function handleError(_0x16c4a6,_0x332b79){_0x332b79=_0x332b79||0x1f4;return function(_0x32e183){logger[_0x6cd6('0x26')](_0x32e183[_0x6cd6('0x27')]);if(_0x32e183[_0x6cd6('0x28')]){delete _0x32e183[_0x6cd6('0x28')];}_0x16c4a6[_0x6cd6('0x1b')](_0x332b79)[_0x6cd6('0x29')](_0x32e183);};}exports[_0x6cd6('0x2a')]=function(_0x5cc778,_0x130c7b){var _0x501628={},_0x4f3144={},_0x575cff={'count':0x0,'rows':[]};var _0x480cc5=_[_0x6cd6('0x2b')](db[_0x6cd6('0x2c')]['rawAttributes'],function(_0x4294ef){return{'name':_0x4294ef[_0x6cd6('0x2d')],'type':_0x4294ef[_0x6cd6('0x2e')][_0x6cd6('0x2f')]};});_0x4f3144[_0x6cd6('0x30')]=_[_0x6cd6('0x2b')](_0x480cc5,_0x6cd6('0x28'));_0x4f3144[_0x6cd6('0x31')]=_[_0x6cd6('0x32')](_0x5cc778['query']);_0x4f3144[_0x6cd6('0x33')]=_[_0x6cd6('0x34')](_0x4f3144[_0x6cd6('0x30')],_0x4f3144['query']);_0x501628[_0x6cd6('0x35')]=_[_0x6cd6('0x34')](_0x4f3144[_0x6cd6('0x30')],qs[_0x6cd6('0x36')](_0x5cc778['query'][_0x6cd6('0x36')]));_0x501628[_0x6cd6('0x35')]=_0x501628[_0x6cd6('0x35')][_0x6cd6('0x37')]?_0x501628[_0x6cd6('0x35')]:_0x4f3144[_0x6cd6('0x30')];if(!_0x5cc778[_0x6cd6('0x31')][_0x6cd6('0x38')](_0x6cd6('0x39'))){_0x501628[_0x6cd6('0x1e')]=qs[_0x6cd6('0x1e')](_0x5cc778[_0x6cd6('0x31')][_0x6cd6('0x1e')]);_0x501628[_0x6cd6('0x1d')]=qs[_0x6cd6('0x1d')](_0x5cc778[_0x6cd6('0x31')][_0x6cd6('0x1d')]);}_0x501628['order']=qs[_0x6cd6('0x3a')](_0x5cc778[_0x6cd6('0x31')][_0x6cd6('0x3a')]);_0x501628['where']=qs[_0x6cd6('0x33')](_[_0x6cd6('0x3b')](_0x5cc778[_0x6cd6('0x31')],_0x4f3144[_0x6cd6('0x33')]),_0x480cc5);if(_0x5cc778[_0x6cd6('0x31')][_0x6cd6('0x3c')]){_0x501628['where']=_[_0x6cd6('0x3d')](_0x501628['where'],{'$or':_['map'](_0x480cc5,function(_0x30c92f){if(_0x30c92f[_0x6cd6('0x2e')]!==_0x6cd6('0x3e')){var _0x24f405={};_0x24f405[_0x30c92f[_0x6cd6('0x28')]]={'$like':'%'+_0x5cc778['query'][_0x6cd6('0x3c')]+'%'};return _0x24f405;}})});}_0x501628=_[_0x6cd6('0x3d')]({},_0x501628,_0x5cc778[_0x6cd6('0x3f')]);var _0x13b886={'where':_0x501628['where']};return db['ZohoField'][_0x6cd6('0x1c')](_0x13b886)[_0x6cd6('0x23')](function(_0x393c01){_0x575cff['count']=_0x393c01;if(_0x5cc778['query'][_0x6cd6('0x40')]){_0x501628['include']=[{'all':!![]}];}return db[_0x6cd6('0x2c')]['findAll'](_0x501628);})[_0x6cd6('0x23')](function(_0x169b47){_0x575cff[_0x6cd6('0x41')]=_0x169b47;return _0x575cff;})[_0x6cd6('0x23')](respondWithFilteredResult(_0x130c7b,_0x501628))[_0x6cd6('0x42')](handleError(_0x130c7b,null));};exports[_0x6cd6('0x43')]=function(_0x16a089,_0x123cf4){var _0x4f6e7e={'raw':!![],'where':{'id':_0x16a089[_0x6cd6('0x44')]['id']}},_0x59239b={};_0x59239b['model']=_[_0x6cd6('0x32')](db[_0x6cd6('0x2c')][_0x6cd6('0x45')]);_0x59239b[_0x6cd6('0x31')]=_[_0x6cd6('0x32')](_0x16a089[_0x6cd6('0x31')]);_0x59239b[_0x6cd6('0x33')]=_[_0x6cd6('0x34')](_0x59239b[_0x6cd6('0x30')],_0x59239b[_0x6cd6('0x31')]);_0x4f6e7e[_0x6cd6('0x35')]=_[_0x6cd6('0x34')](_0x59239b[_0x6cd6('0x30')],qs[_0x6cd6('0x36')](_0x16a089[_0x6cd6('0x31')][_0x6cd6('0x36')]));_0x4f6e7e[_0x6cd6('0x35')]=_0x4f6e7e['attributes'][_0x6cd6('0x37')]?_0x4f6e7e['attributes']:_0x59239b['model'];if(_0x16a089[_0x6cd6('0x31')][_0x6cd6('0x40')]){_0x4f6e7e[_0x6cd6('0x46')]=[{'all':!![]}];}_0x4f6e7e=_[_0x6cd6('0x3d')]({},_0x4f6e7e,_0x16a089[_0x6cd6('0x3f')]);return db['ZohoField'][_0x6cd6('0x47')](_0x4f6e7e)[_0x6cd6('0x23')](handleEntityNotFound(_0x123cf4,null))['then'](respondWithResult(_0x123cf4,null))[_0x6cd6('0x42')](handleError(_0x123cf4,null));};exports[_0x6cd6('0x48')]=function(_0x553654,_0x1acd62){return db['ZohoField'][_0x6cd6('0x48')](_0x553654['body'],{})[_0x6cd6('0x23')](respondWithResult(_0x1acd62,0xc9))[_0x6cd6('0x42')](handleError(_0x1acd62,null));};exports[_0x6cd6('0x22')]=function(_0x11429c,_0x364e1a){if(_0x11429c[_0x6cd6('0x49')]['id']){delete _0x11429c[_0x6cd6('0x49')]['id'];}return db['ZohoField'][_0x6cd6('0x47')]({'where':{'id':_0x11429c[_0x6cd6('0x44')]['id']}})[_0x6cd6('0x23')](handleEntityNotFound(_0x364e1a,null))[_0x6cd6('0x23')](saveUpdates(_0x11429c[_0x6cd6('0x49')],null))[_0x6cd6('0x23')](respondWithResult(_0x364e1a,null))['catch'](handleError(_0x364e1a,null));};exports[_0x6cd6('0x24')]=function(_0x2d6bfb,_0x4b88bd){return db[_0x6cd6('0x2c')][_0x6cd6('0x47')]({'where':{'id':_0x2d6bfb[_0x6cd6('0x44')]['id']}})[_0x6cd6('0x23')](handleEntityNotFound(_0x4b88bd,null))[_0x6cd6('0x23')](removeEntity(_0x4b88bd,null))['catch'](handleError(_0x4b88bd,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index beec5fa..d187b73 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 _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 +var _0x549b=['FieldId','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x43a1b8,_0x1c90c8){var _0x324ecc=function(_0x53a93b){while(--_0x53a93b){_0x43a1b8['push'](_0x43a1b8['shift']());}};_0x324ecc(++_0x1c90c8);}(_0x549b,0x1dd));var _0xb549=function(_0x5b077b,_0x50b707){_0x5b077b=_0x5b077b-0x0;var _0x16faf7=_0x549b[_0x5b077b];return _0x16faf7;};'use strict';var _=require(_0xb549('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb549('0x1'));var moment=require(_0xb549('0x2'));var BPromise=require(_0xb549('0x3'));var rp=require(_0xb549('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb549('0x5'));var config=require(_0xb549('0x6'));var attributes=require(_0xb549('0x7'));module[_0xb549('0x8')]=function(_0x58e305,_0x253375){return _0x58e305[_0xb549('0x9')](_0xb549('0xa'),attributes,{'tableName':_0xb549('0xb'),'paranoid':![],'indexes':[{'name':_0xb549('0xc'),'fields':['idField',_0xb549('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9cee2b2..358536d 100644 --- a/server/api/intZohoField/intZohoField.rpc.js +++ b/server/api/intZohoField/intZohoField.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_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 +var _0xe14d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x417c18,_0x48b392){var _0xf2306=function(_0x467978){while(--_0x467978){_0x417c18['push'](_0x417c18['shift']());}};_0xf2306(++_0x48b392);}(_0xe14d,0x1ee));var _0xde14=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xe14d[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('ZohoField,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index d9824e6..2002dfa 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 _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 +var _0x943c=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4d7433,_0x225b4f){var _0x23917d=function(_0x44d290){while(--_0x44d290){_0x4d7433['push'](_0x4d7433['shift']());}};_0x23917d(++_0x225b4f);}(_0x943c,0x16a));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc943('0x0'));var util=require(_0xc943('0x1'));var path=require('path');var timeout=require(_0xc943('0x2'));var express=require(_0xc943('0x3'));var router=express[_0xc943('0x4')]();var auth=require(_0xc943('0x5'));var interaction=require(_0xc943('0x6'));var config=require(_0xc943('0x7'));module[_0xc943('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index cb9f076..18dd301 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 _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 +var _0x39ac=['state','sequelize','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39ac,0x1e1));var _0xc39a=function(_0x3850f9,_0x17c070){_0x3850f9=_0x3850f9-0x0;var _0x15c90f=_0x39ac[_0x3850f9];return _0x15c90f;};'use strict';var Sequelize=require(_0xc39a('0x0'));module['exports']={'name':{'type':Sequelize[_0xc39a('0x1')],'allowNull':![],'unique':_0xc39a('0x2')},'version':{'type':Sequelize[_0xc39a('0x1')],'allowNull':![],'unique':_0xc39a('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xc39a('0x1')]},'type':{'type':Sequelize[_0xc39a('0x1')]},'size':{'type':Sequelize[_0xc39a('0x3')]},'active':{'type':Sequelize[_0xc39a('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc39a('0x1')]},'state':{'type':Sequelize[_0xc39a('0x1')],'unique':_0xc39a('0x5')},'description':{'type':Sequelize[_0xc39a('0x1')]},'title':{'type':Sequelize[_0xc39a('0x1')]},'remoteUri':{'type':Sequelize[_0xc39a('0x1')]},'link':{'type':Sequelize[_0xc39a('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 514b3d5..57d720d 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 _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 +var _0xccde=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','findAll','catch','show','params','keys','includeAll','include','find','create','body','update','destroy','eml-format','rimraf','fast-json-patch','moment','mustache','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'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xccde,0x158));var _0xeccd=function(_0x351b46,_0x26b265){_0x351b46=_0x351b46-0x0;var _0x1515df=_0xccde[_0x351b46];return _0x1515df;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xeccd('0x0'));var rimraf=require(_0xeccd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeccd('0x2'));var rp=require('request-promise');var moment=require(_0xeccd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xeccd('0x4'));var util=require(_0xeccd('0x5'));var path=require(_0xeccd('0x6'));var sox=require(_0xeccd('0x7'));var csv=require(_0xeccd('0x8'));var ejs=require(_0xeccd('0x9'));var fs=require('fs');var _=require(_0xeccd('0xa'));var squel=require(_0xeccd('0xb'));var crypto=require(_0xeccd('0xc'));var jsforce=require(_0xeccd('0xd'));var deskjs=require(_0xeccd('0xe'));var toCsv=require(_0xeccd('0x8'));var querystring=require(_0xeccd('0xf'));var Papa=require('papaparse');var Redis=require(_0xeccd('0x10'));var authService=require(_0xeccd('0x11'));var qs=require(_0xeccd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeccd('0x13'));var logger=require(_0xeccd('0x14'))('api');var utils=require(_0xeccd('0x15'));var config=require(_0xeccd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xeccd('0x17'))['db'];function respondWithStatusCode(_0x237d87,_0x10e435){_0x10e435=_0x10e435||0xcc;return function(_0x4b64fa){if(_0x4b64fa){return _0x237d87[_0xeccd('0x18')](_0x10e435);}return _0x237d87['status'](_0x10e435)['end']();};}function respondWithResult(_0x263745,_0x2d503b){_0x2d503b=_0x2d503b||0xc8;return function(_0x31760a){if(_0x31760a){return _0x263745[_0xeccd('0x19')](_0x2d503b)[_0xeccd('0x1a')](_0x31760a);}};}function respondWithFilteredResult(_0x4b90d6,_0x2c11e){return function(_0x16a4d1){if(_0x16a4d1){var _0x202d3c=_0x16a4d1[_0xeccd('0x1b')],_0x20afa5=_0x2c11e[_0xeccd('0x1c')],_0x557535=_0x2c11e[_0xeccd('0x1c')]+_0x2c11e[_0xeccd('0x1d')],_0x28e723;if(_0x557535>=_0x202d3c){_0x557535=_0x202d3c;_0x28e723=0xc8;}else{_0x28e723=0xce;}_0x4b90d6[_0xeccd('0x19')](_0x28e723);return _0x4b90d6['set'](_0xeccd('0x1e'),_0x20afa5+'-'+_0x557535+'/'+_0x202d3c)[_0xeccd('0x1a')](_0x16a4d1);}return null;};}function patchUpdates(_0x58eb1f){return function(_0x3864e0){try{jsonpatch[_0xeccd('0x1f')](_0x3864e0,_0x58eb1f,!![]);}catch(_0x327416){return BPromise[_0xeccd('0x20')](_0x327416);}return _0x3864e0[_0xeccd('0x21')]();};}function saveUpdates(_0x4896af,_0x41b46d){return function(_0x268851){if(_0x268851){return _0x268851['update'](_0x4896af)[_0xeccd('0x22')](function(_0x6551f){return _0x6551f;});}return null;};}function removeEntity(_0x6a5e0f,_0x5c4d0b){return function(_0xaa1f93){if(_0xaa1f93){return _0xaa1f93['destroy']()[_0xeccd('0x22')](function(){_0x6a5e0f[_0xeccd('0x19')](0xcc)[_0xeccd('0x23')]();});}};}function handleEntityNotFound(_0x1da67c,_0x2e5c7e){return function(_0x798ff9){if(!_0x798ff9){_0x1da67c[_0xeccd('0x18')](0x194);}return _0x798ff9;};}function handleError(_0x3b0070,_0x48d74f){_0x48d74f=_0x48d74f||0x1f4;return function(_0x555f3e){logger[_0xeccd('0x24')](_0x555f3e[_0xeccd('0x25')]);if(_0x555f3e[_0xeccd('0x26')]){delete _0x555f3e['name'];}_0x3b0070[_0xeccd('0x19')](_0x48d74f)[_0xeccd('0x27')](_0x555f3e);};}exports[_0xeccd('0x28')]=function(_0x16c6ae,_0x1c1501){var _0xf0698b={},_0x167b13={},_0x1ee036={'count':0x0,'rows':[]};var _0x20c450=_[_0xeccd('0x29')](db[_0xeccd('0x2a')][_0xeccd('0x2b')],function(_0x4d5b2c){return{'name':_0x4d5b2c[_0xeccd('0x2c')],'type':_0x4d5b2c[_0xeccd('0x2d')][_0xeccd('0x2e')]};});_0x167b13[_0xeccd('0x2f')]=_['map'](_0x20c450,_0xeccd('0x26'));_0x167b13[_0xeccd('0x30')]=_['keys'](_0x16c6ae[_0xeccd('0x30')]);_0x167b13[_0xeccd('0x31')]=_[_0xeccd('0x32')](_0x167b13['model'],_0x167b13[_0xeccd('0x30')]);_0xf0698b[_0xeccd('0x33')]=_[_0xeccd('0x32')](_0x167b13[_0xeccd('0x2f')],qs[_0xeccd('0x34')](_0x16c6ae[_0xeccd('0x30')]['fields']));_0xf0698b[_0xeccd('0x33')]=_0xf0698b[_0xeccd('0x33')][_0xeccd('0x35')]?_0xf0698b[_0xeccd('0x33')]:_0x167b13[_0xeccd('0x2f')];if(!_0x16c6ae[_0xeccd('0x30')]['hasOwnProperty'](_0xeccd('0x36'))){_0xf0698b['limit']=qs[_0xeccd('0x1d')](_0x16c6ae[_0xeccd('0x30')][_0xeccd('0x1d')]);_0xf0698b[_0xeccd('0x1c')]=qs[_0xeccd('0x1c')](_0x16c6ae['query']['offset']);}_0xf0698b['order']=qs[_0xeccd('0x37')](_0x16c6ae['query'][_0xeccd('0x37')]);_0xf0698b['where']=qs[_0xeccd('0x31')](_[_0xeccd('0x38')](_0x16c6ae[_0xeccd('0x30')],_0x167b13[_0xeccd('0x31')]),_0x20c450);if(_0x16c6ae['query'][_0xeccd('0x39')]){_0xf0698b[_0xeccd('0x3a')]=_[_0xeccd('0x3b')](_0xf0698b[_0xeccd('0x3a')],{'$or':_[_0xeccd('0x29')](_0x20c450,function(_0x58d313){if(_0x58d313[_0xeccd('0x2d')]!=='VIRTUAL'){var _0xd7bc0f={};_0xd7bc0f[_0x58d313['name']]={'$like':'%'+_0x16c6ae[_0xeccd('0x30')][_0xeccd('0x39')]+'%'};return _0xd7bc0f;}})});}_0xf0698b=_[_0xeccd('0x3b')]({},_0xf0698b,_0x16c6ae[_0xeccd('0x3c')]);var _0x146edf={'where':_0xf0698b[_0xeccd('0x3a')]};return db[_0xeccd('0x2a')][_0xeccd('0x1b')](_0x146edf)[_0xeccd('0x22')](function(_0x20aafd){_0x1ee036[_0xeccd('0x1b')]=_0x20aafd;if(_0x16c6ae[_0xeccd('0x30')]['includeAll']){_0xf0698b['include']=[{'all':!![]}];}return db[_0xeccd('0x2a')][_0xeccd('0x3d')](_0xf0698b);})['then'](function(_0x15b5d8){_0x1ee036['rows']=_0x15b5d8;return _0x1ee036;})['then'](respondWithFilteredResult(_0x1c1501,_0xf0698b))[_0xeccd('0x3e')](handleError(_0x1c1501,null));};exports[_0xeccd('0x3f')]=function(_0x5466f1,_0x145122){var _0x5e0f6c={'raw':![],'where':{'id':_0x5466f1[_0xeccd('0x40')]['id']}},_0x5efabd={};_0x5efabd['model']=_[_0xeccd('0x41')](db[_0xeccd('0x2a')][_0xeccd('0x2b')]);_0x5efabd[_0xeccd('0x30')]=_[_0xeccd('0x41')](_0x5466f1[_0xeccd('0x30')]);_0x5efabd[_0xeccd('0x31')]=_[_0xeccd('0x32')](_0x5efabd[_0xeccd('0x2f')],_0x5efabd[_0xeccd('0x30')]);_0x5e0f6c['attributes']=_['intersection'](_0x5efabd['model'],qs[_0xeccd('0x34')](_0x5466f1[_0xeccd('0x30')][_0xeccd('0x34')]));_0x5e0f6c[_0xeccd('0x33')]=_0x5e0f6c['attributes'][_0xeccd('0x35')]?_0x5e0f6c['attributes']:_0x5efabd[_0xeccd('0x2f')];if(_0x5466f1[_0xeccd('0x30')][_0xeccd('0x42')]){_0x5e0f6c[_0xeccd('0x43')]=[{'all':!![]}];}_0x5e0f6c=_[_0xeccd('0x3b')]({},_0x5e0f6c,_0x5466f1[_0xeccd('0x3c')]);return db['Integration'][_0xeccd('0x44')](_0x5e0f6c)[_0xeccd('0x22')](handleEntityNotFound(_0x145122,null))[_0xeccd('0x22')](respondWithResult(_0x145122,null))[_0xeccd('0x3e')](handleError(_0x145122,null));};exports[_0xeccd('0x45')]=function(_0x3310bc,_0xddb2e8){return db[_0xeccd('0x2a')][_0xeccd('0x45')](_0x3310bc[_0xeccd('0x46')],{})['then'](respondWithResult(_0xddb2e8,0xc9))[_0xeccd('0x3e')](handleError(_0xddb2e8,null));};exports[_0xeccd('0x47')]=function(_0x35ad8d,_0x2ad65d){if(_0x35ad8d['body']['id']){delete _0x35ad8d[_0xeccd('0x46')]['id'];}return db[_0xeccd('0x2a')][_0xeccd('0x44')]({'where':{'id':_0x35ad8d[_0xeccd('0x40')]['id']}})[_0xeccd('0x22')](handleEntityNotFound(_0x2ad65d,null))[_0xeccd('0x22')](saveUpdates(_0x35ad8d['body'],null))[_0xeccd('0x22')](respondWithResult(_0x2ad65d,null))[_0xeccd('0x3e')](handleError(_0x2ad65d,null));};exports[_0xeccd('0x48')]=function(_0x249694,_0x305f6f){return db[_0xeccd('0x2a')][_0xeccd('0x44')]({'where':{'id':_0x249694[_0xeccd('0x40')]['id']}})[_0xeccd('0x22')](handleEntityNotFound(_0x305f6f,null))[_0xeccd('0x22')](removeEntity(_0x305f6f,null))[_0xeccd('0x3e')](handleError(_0x305f6f,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d27494e..fa88e0d 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 _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 +var _0x1180=['path','rimraf','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x385467,_0x298239){var _0x5ed67e=function(_0x4b252c){while(--_0x4b252c){_0x385467['push'](_0x385467['shift']());}};_0x5ed67e(++_0x298239);}(_0x1180,0xa2));var _0x0118=function(_0x244c31,_0x53995f){_0x244c31=_0x244c31-0x0;var _0x463885=_0x1180[_0x244c31];return _0x463885;};'use strict';var _=require(_0x0118('0x0'));var util=require(_0x0118('0x1'));var logger=require(_0x0118('0x2'))('api');var moment=require(_0x0118('0x3'));var BPromise=require(_0x0118('0x4'));var rp=require(_0x0118('0x5'));var fs=require('fs');var path=require(_0x0118('0x6'));var rimraf=require(_0x0118('0x7'));var config=require('../../config/environment');var attributes=require(_0x0118('0x8'));module[_0x0118('0x9')]=function(_0x26169f,_0xc5edcc){return _0x26169f[_0x0118('0xa')](_0x0118('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 08d8c7c..06b9e6f 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 _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 +var _0xe49a=['Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Integration,\x20%s,\x20%s','debug'];(function(_0x283fe6,_0x12604c){var _0xd8998=function(_0x13777b){while(--_0x13777b){_0x283fe6['push'](_0x283fe6['shift']());}};_0xd8998(++_0x12604c);}(_0xe49a,0xd7));var _0xae49=function(_0x4caf0b,_0x1f06b6){_0x4caf0b=_0x4caf0b-0x0;var _0x42ff72=_0xe49a[_0x4caf0b];return _0x42ff72;};'use strict';var _=require('lodash');var util=require(_0xae49('0x0'));var moment=require(_0xae49('0x1'));var BPromise=require(_0xae49('0x2'));var rs=require(_0xae49('0x3'));var fs=require('fs');var Redis=require(_0xae49('0x4'));var db=require(_0xae49('0x5'))['db'];var utils=require(_0xae49('0x6'));var logger=require('../../config/logger')(_0xae49('0x7'));var config=require(_0xae49('0x8'));var jayson=require(_0xae49('0x9'));var client=jayson['client'][_0xae49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x49eecf,_0x63a8be,_0x1e33f6){return new BPromise(function(_0x4480bf,_0x476f2a){return client[_0xae49('0xb')](_0x49eecf,_0x1e33f6)[_0xae49('0xc')](function(_0x408685){logger['info'](_0xae49('0xd'),_0x63a8be,'request\x20sent');logger[_0xae49('0xe')](_0xae49('0xf'),_0x63a8be,_0xae49('0x10'),JSON['stringify'](_0x408685));if(_0x408685[_0xae49('0x11')]){if(_0x408685[_0xae49('0x11')][_0xae49('0x12')]===0x1f4){logger[_0xae49('0x11')](_0xae49('0xd'),_0x63a8be,_0x408685[_0xae49('0x11')]['message']);return _0x476f2a(_0x408685['error'][_0xae49('0x13')]);}logger[_0xae49('0x11')](_0xae49('0xd'),_0x63a8be,_0x408685[_0xae49('0x11')][_0xae49('0x13')]);return _0x4480bf(_0x408685[_0xae49('0x11')][_0xae49('0x13')]);}else{logger[_0xae49('0x14')](_0xae49('0xd'),_0x63a8be,_0xae49('0x10'));_0x4480bf(_0x408685[_0xae49('0x15')]['message']);}})[_0xae49('0x16')](function(_0x2d5dcb){logger[_0xae49('0x11')]('Integration,\x20%s,\x20%s',_0x63a8be,_0x2d5dcb);_0x476f2a(_0x2d5dcb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 2c3736d..bde091f 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 _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 +var _0x742d=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x6e6158,_0x534892){var _0x366ca4=function(_0x2573d6){while(--_0x2573d6){_0x6e6158['push'](_0x6e6158['shift']());}};_0x366ca4(++_0x534892);}(_0x742d,0x66));var _0xd742=function(_0x203181,_0x25678e){_0x203181=_0x203181-0x0;var _0x334ffb=_0x742d[_0x203181];return _0x334ffb;};'use strict';var multer=require(_0xd742('0x0'));var util=require(_0xd742('0x1'));var path=require(_0xd742('0x2'));var timeout=require(_0xd742('0x3'));var express=require(_0xd742('0x4'));var router=express[_0xd742('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd742('0x6'));var config=require(_0xd742('0x7'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xd742('0x8')](),controller[_0xd742('0x9')]);router[_0xd742('0xa')](_0xd742('0xb'),auth[_0xd742('0x8')](),controller['describe']);router['get'](_0xd742('0xc'),auth[_0xd742('0x8')](),controller['show']);router['post']('/',auth[_0xd742('0x8')](),controller['create']);router[_0xd742('0xd')](_0xd742('0xc'),auth[_0xd742('0x8')](),controller[_0xd742('0xe')]);router[_0xd742('0xf')](_0xd742('0xc'),auth[_0xd742('0x8')](),controller[_0xd742('0x10')]);module[_0xd742('0x11')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index f0e1010..81279fb 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 _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 +var _0xedee=['DATE','BOOLEAN','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0xedee,0x101));var _0xeede=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xedee[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0xeede('0x0'));module['exports']={'integration':{'type':Sequelize[_0xeede('0x1')]},'eventChannel':{'type':Sequelize[_0xeede('0x1')]},'exitStatus':{'type':Sequelize[_0xeede('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xeede('0x2')]},'contacts':{'type':Sequelize[_0xeede('0x1')]},'uniqueid':{'type':Sequelize[_0xeede('0x1')]},'calleridnum':{'type':Sequelize[_0xeede('0x1')]},'calleridname':{'type':Sequelize[_0xeede('0x1')]},'queue':{'type':Sequelize[_0xeede('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xeede('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xeede('0x3')]},'holdtime':{'type':Sequelize[_0xeede('0x2')]},'agentcomplete':{'type':Sequelize[_0xeede('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xeede('0x3')]},'talktime':{'type':Sequelize[_0xeede('0x2')]},'agentacw':{'type':Sequelize[_0xeede('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xeede('0x2')]},'reason':{'type':Sequelize[_0xeede('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xeede('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xeede('0x3')]},'agentdump':{'type':Sequelize[_0xeede('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xeede('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeede('0x1')]},'channelstate':{'type':Sequelize[_0xeede('0x2')]},'channelstatedesc':{'type':Sequelize[_0xeede('0x1')]},'connectedlinenum':{'type':Sequelize[_0xeede('0x1')]},'connectedlinename':{'type':Sequelize[_0xeede('0x1')]},'language':{'type':Sequelize[_0xeede('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xeede('0x1')]},'exten':{'type':Sequelize[_0xeede('0x1')]},'priority':{'type':Sequelize[_0xeede('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xeede('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xeede('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xeede('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xeede('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xeede('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xeede('0x1')]},'destcontext':{'type':Sequelize[_0xeede('0x1')]},'destexten':{'type':Sequelize[_0xeede('0x1')]},'destpriority':{'type':Sequelize[_0xeede('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xeede('0x1')]},'subject':{'type':Sequelize[_0xeede('0x1')]},'from':{'type':Sequelize[_0xeede('0x1')]},'to':{'type':Sequelize[_0xeede('0x1')]},'cc':{'type':Sequelize[_0xeede('0x1')]},'attachment':{'type':Sequelize[_0xeede('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xeede('0x5')]},'status':{'type':Sequelize[_0xeede('0x6')]('SENT',_0xeede('0x7'),_0xeede('0x8'),_0xeede('0x9'))},'url':{'type':Sequelize[_0xeede('0x1')]},'app':{'type':Sequelize[_0xeede('0x1')]},'appdata':{'type':Sequelize[_0xeede('0x1')]},'projectId':{'type':Sequelize[_0xeede('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 576452d..0adfcab 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 _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 +var _0x9eab=['offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','index','map','IntegrationReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','sendStatus','status','end','count'];(function(_0x1ffa51,_0x160f27){var _0x21760c=function(_0x2c7e9f){while(--_0x2c7e9f){_0x1ffa51['push'](_0x1ffa51['shift']());}};_0x21760c(++_0x160f27);}(_0x9eab,0xfb));var _0xb9ea=function(_0x56ccae,_0x3d769b){_0x56ccae=_0x56ccae-0x0;var _0x4cc68a=_0x9eab[_0x56ccae];return _0x4cc68a;};'use strict';var pdf=require(_0xb9ea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb9ea('0x1'));var zipdir=require(_0xb9ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9ea('0x3'));var moment=require(_0xb9ea('0x4'));var BPromise=require(_0xb9ea('0x5'));var Mustache=require(_0xb9ea('0x6'));var util=require('util');var path=require(_0xb9ea('0x7'));var sox=require('sox');var csv=require(_0xb9ea('0x8'));var ejs=require(_0xb9ea('0x9'));var fs=require('fs');var _=require(_0xb9ea('0xa'));var squel=require(_0xb9ea('0xb'));var crypto=require(_0xb9ea('0xc'));var jsforce=require(_0xb9ea('0xd'));var deskjs=require(_0xb9ea('0xe'));var toCsv=require(_0xb9ea('0x8'));var querystring=require(_0xb9ea('0xf'));var Papa=require(_0xb9ea('0x10'));var Redis=require(_0xb9ea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb9ea('0x12'));var as=require(_0xb9ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9ea('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x230c9f,_0x3e742c){_0x3e742c=_0x3e742c||0xcc;return function(_0x2e99ee){if(_0x2e99ee){return _0x230c9f[_0xb9ea('0x15')](_0x3e742c);}return _0x230c9f[_0xb9ea('0x16')](_0x3e742c)[_0xb9ea('0x17')]();};}function respondWithResult(_0x2ec4c6,_0x6ed9d){_0x6ed9d=_0x6ed9d||0xc8;return function(_0x525b92){if(_0x525b92){return _0x2ec4c6[_0xb9ea('0x16')](_0x6ed9d)['json'](_0x525b92);}};}function respondWithFilteredResult(_0x34096a,_0x10533e){return function(_0x311bae){if(_0x311bae){var _0x1815af=_0x311bae[_0xb9ea('0x18')],_0x38b7e5=_0x10533e[_0xb9ea('0x19')],_0x3d4e71=_0x10533e['offset']+_0x10533e[_0xb9ea('0x1a')],_0x3e16fb;if(_0x3d4e71>=_0x1815af){_0x3d4e71=_0x1815af;_0x3e16fb=0xc8;}else{_0x3e16fb=0xce;}_0x34096a[_0xb9ea('0x16')](_0x3e16fb);return _0x34096a[_0xb9ea('0x1b')](_0xb9ea('0x1c'),_0x38b7e5+'-'+_0x3d4e71+'/'+_0x1815af)[_0xb9ea('0x1d')](_0x311bae);}return null;};}function patchUpdates(_0x435ef8){return function(_0x4137e6){try{jsonpatch[_0xb9ea('0x1e')](_0x4137e6,_0x435ef8,!![]);}catch(_0x4d95c0){return BPromise[_0xb9ea('0x1f')](_0x4d95c0);}return _0x4137e6['save']();};}function saveUpdates(_0x3d63da,_0x1608d5){return function(_0x20f115){if(_0x20f115){return _0x20f115[_0xb9ea('0x20')](_0x3d63da)['then'](function(_0x2c6664){return _0x2c6664;});}return null;};}function removeEntity(_0x38a31f,_0x28383a){return function(_0x1ea713){if(_0x1ea713){return _0x1ea713[_0xb9ea('0x21')]()[_0xb9ea('0x22')](function(){_0x38a31f[_0xb9ea('0x16')](0xcc)[_0xb9ea('0x17')]();});}};}function handleEntityNotFound(_0x2d94c2,_0x1afcd2){return function(_0x517e19){if(!_0x517e19){_0x2d94c2[_0xb9ea('0x15')](0x194);}return _0x517e19;};}function handleError(_0x35f878,_0x5c4f30){_0x5c4f30=_0x5c4f30||0x1f4;return function(_0x346b69){logger[_0xb9ea('0x23')](_0x346b69[_0xb9ea('0x24')]);if(_0x346b69['name']){delete _0x346b69[_0xb9ea('0x25')];}_0x35f878[_0xb9ea('0x16')](_0x5c4f30)['send'](_0x346b69);};}exports[_0xb9ea('0x26')]=function(_0x534eb2,_0x2d375f){var _0x23ef6f={},_0x2e94f5={},_0x22cb65={'count':0x0,'rows':[]};var _0x555722=_[_0xb9ea('0x27')](db[_0xb9ea('0x28')][_0xb9ea('0x29')],function(_0x573aab){return{'name':_0x573aab[_0xb9ea('0x2a')],'type':_0x573aab[_0xb9ea('0x2b')]['key']};});_0x2e94f5['model']=_[_0xb9ea('0x27')](_0x555722,_0xb9ea('0x25'));_0x2e94f5[_0xb9ea('0x2c')]=_[_0xb9ea('0x2d')](_0x534eb2[_0xb9ea('0x2c')]);_0x2e94f5[_0xb9ea('0x2e')]=_[_0xb9ea('0x2f')](_0x2e94f5[_0xb9ea('0x30')],_0x2e94f5[_0xb9ea('0x2c')]);_0x23ef6f[_0xb9ea('0x31')]=_['intersection'](_0x2e94f5[_0xb9ea('0x30')],qs[_0xb9ea('0x32')](_0x534eb2[_0xb9ea('0x2c')][_0xb9ea('0x32')]));_0x23ef6f[_0xb9ea('0x31')]=_0x23ef6f['attributes'][_0xb9ea('0x33')]?_0x23ef6f['attributes']:_0x2e94f5[_0xb9ea('0x30')];if(!_0x534eb2['query']['hasOwnProperty'](_0xb9ea('0x34'))){_0x23ef6f[_0xb9ea('0x1a')]=qs[_0xb9ea('0x1a')](_0x534eb2['query'][_0xb9ea('0x1a')]);_0x23ef6f[_0xb9ea('0x19')]=qs[_0xb9ea('0x19')](_0x534eb2['query'][_0xb9ea('0x19')]);}_0x23ef6f[_0xb9ea('0x35')]=qs[_0xb9ea('0x36')](_0x534eb2['query'][_0xb9ea('0x36')]);_0x23ef6f['where']=qs['filters'](_[_0xb9ea('0x37')](_0x534eb2[_0xb9ea('0x2c')],_0x2e94f5['filters']),_0x555722);if(_0x534eb2['query'][_0xb9ea('0x38')]){_0x23ef6f['where']=_['merge'](_0x23ef6f[_0xb9ea('0x39')],{'$or':_[_0xb9ea('0x27')](_0x555722,function(_0x402409){if(_0x402409[_0xb9ea('0x2b')]!=='VIRTUAL'){var _0x5b299a={};_0x5b299a[_0x402409['name']]={'$like':'%'+_0x534eb2[_0xb9ea('0x2c')][_0xb9ea('0x38')]+'%'};return _0x5b299a;}})});}_0x23ef6f=_[_0xb9ea('0x3a')]({},_0x23ef6f,_0x534eb2['options']);var _0xb0bcdf={'where':_0x23ef6f[_0xb9ea('0x39')]};return db[_0xb9ea('0x28')][_0xb9ea('0x18')](_0xb0bcdf)['then'](function(_0x53b34a){_0x22cb65['count']=_0x53b34a;if(_0x534eb2['query'][_0xb9ea('0x3b')]){_0x23ef6f[_0xb9ea('0x3c')]=[{'all':!![]}];}return db['IntegrationReport'][_0xb9ea('0x3d')](_0x23ef6f);})['then'](function(_0x13cb3b){_0x22cb65['rows']=_0x13cb3b;return _0x22cb65;})[_0xb9ea('0x22')](respondWithFilteredResult(_0x2d375f,_0x23ef6f))[_0xb9ea('0x3e')](handleError(_0x2d375f,null));};exports[_0xb9ea('0x3f')]=function(_0x2daad0,_0x29d43d){var _0x2fff74={'raw':![],'where':{'id':_0x2daad0[_0xb9ea('0x40')]['id']}},_0x4290aa={};_0x4290aa[_0xb9ea('0x30')]=_[_0xb9ea('0x2d')](db[_0xb9ea('0x28')]['rawAttributes']);_0x4290aa[_0xb9ea('0x2c')]=_[_0xb9ea('0x2d')](_0x2daad0[_0xb9ea('0x2c')]);_0x4290aa[_0xb9ea('0x2e')]=_[_0xb9ea('0x2f')](_0x4290aa[_0xb9ea('0x30')],_0x4290aa['query']);_0x2fff74[_0xb9ea('0x31')]=_[_0xb9ea('0x2f')](_0x4290aa[_0xb9ea('0x30')],qs[_0xb9ea('0x32')](_0x2daad0['query'][_0xb9ea('0x32')]));_0x2fff74[_0xb9ea('0x31')]=_0x2fff74['attributes'][_0xb9ea('0x33')]?_0x2fff74['attributes']:_0x4290aa[_0xb9ea('0x30')];if(_0x2daad0['query'][_0xb9ea('0x3b')]){_0x2fff74[_0xb9ea('0x3c')]=[{'all':!![]}];}_0x2fff74=_[_0xb9ea('0x3a')]({},_0x2fff74,_0x2daad0['options']);return db['IntegrationReport'][_0xb9ea('0x41')](_0x2fff74)['then'](handleEntityNotFound(_0x29d43d,null))[_0xb9ea('0x22')](respondWithResult(_0x29d43d,null))[_0xb9ea('0x3e')](handleError(_0x29d43d,null));};exports[_0xb9ea('0x42')]=function(_0x45c68a,_0x3227ab){return db[_0xb9ea('0x28')][_0xb9ea('0x42')](_0x45c68a['body'],{})['then'](respondWithResult(_0x3227ab,0xc9))['catch'](handleError(_0x3227ab,null));};exports[_0xb9ea('0x20')]=function(_0x101590,_0x59df85){if(_0x101590[_0xb9ea('0x43')]['id']){delete _0x101590[_0xb9ea('0x43')]['id'];}return db[_0xb9ea('0x28')]['find']({'where':{'id':_0x101590[_0xb9ea('0x40')]['id']}})[_0xb9ea('0x22')](handleEntityNotFound(_0x59df85,null))['then'](saveUpdates(_0x101590['body'],null))[_0xb9ea('0x22')](respondWithResult(_0x59df85,null))[_0xb9ea('0x3e')](handleError(_0x59df85,null));};exports['destroy']=function(_0x42ebfe,_0x2b87af){return db['IntegrationReport'][_0xb9ea('0x41')]({'where':{'id':_0x42ebfe[_0xb9ea('0x40')]['id']}})[_0xb9ea('0x22')](handleEntityNotFound(_0x2b87af,null))[_0xb9ea('0x22')](removeEntity(_0x2b87af,null))[_0xb9ea('0x3e')](handleError(_0x2b87af,null));};exports['describe']=function(_0x5a86cc,_0x323a94){return db[_0xb9ea('0x28')][_0xb9ea('0x44')]()['then'](respondWithResult(_0x323a94,null))['catch'](handleError(_0x323a94,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a6e689a..c4082fc 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 _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 +var _0xe276=['exports','define','util','../../config/logger','api','bluebird','path','../../config/environment','./integrationReport.attributes'];(function(_0x1e2845,_0x5921a5){var _0x5ab36a=function(_0x4468fb){while(--_0x4468fb){_0x1e2845['push'](_0x1e2845['shift']());}};_0x5ab36a(++_0x5921a5);}(_0xe276,0x1c4));var _0x6e27=function(_0x193a6e,_0x45dd00){_0x193a6e=_0x193a6e-0x0;var _0x599a9b=_0xe276[_0x193a6e];return _0x599a9b;};'use strict';var _=require('lodash');var util=require(_0x6e27('0x0'));var logger=require(_0x6e27('0x1'))(_0x6e27('0x2'));var moment=require('moment');var BPromise=require(_0x6e27('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6e27('0x4'));var rimraf=require('rimraf');var config=require(_0x6e27('0x5'));var attributes=require(_0x6e27('0x6'));module[_0x6e27('0x7')]=function(_0x1b2705,_0x185843){return _0x1b2705[_0x6e27('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','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 b820969..ce46d64 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 _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 +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(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x8603,0x190));var _0x3860=function(_0x22093a,_0xa7acf1){_0x22093a=_0x22093a-0x0;var _0x2f4989=_0x8603[_0x22093a];return _0x2f4989;};'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 8183742..98deeaa 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','exports','multer','util','path','connect-timeout'];(function(_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 +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x61e08d,_0x3b9657){var _0x5a7db5=function(_0xc83e2e){while(--_0xc83e2e){_0x61e08d['push'](_0x61e08d['shift']());}};_0x5a7db5(++_0x3b9657);}(_0x34e8,0x12c));var _0x834e=function(_0x151da9,_0x6a7262){_0x151da9=_0x151da9-0x0;var _0x38b031=_0x34e8[_0x151da9];return _0x38b031;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index ac9ec43..fbeac3c 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 _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 +var _0x9e12=['STRING','exports'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x9e12,0x12b));var _0x29e1=function(_0x34319a,_0x1509eb){_0x34319a=_0x34319a-0x0;var _0x8ff628=_0x9e12[_0x34319a];return _0x8ff628;};'use strict';var Sequelize=require('sequelize');module[_0x29e1('0x0')]={'name':{'type':Sequelize[_0x29e1('0x1')]},'description':{'type':Sequelize[_0x29e1('0x1')]},'interval':{'type':Sequelize[_0x29e1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 3f20f11..5d141fb 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 _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 +var _0xdcf4=['rows','show','params','includeAll','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','IntervalId','findOne','pick','getIntervals','addIntervals','sequelize','transaction','bulkCreate','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','status','end','offset','set','json','apply','save','update','destroy','then','Intervals','UserProfileResource','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','VIRTUAL','filter','merge','options','where','Interval','count','include','findAll'];(function(_0x3d71a6,_0x5c2721){var _0x249172=function(_0x4f4f26){while(--_0x4f4f26){_0x3d71a6['push'](_0x3d71a6['shift']());}};_0x249172(++_0x5c2721);}(_0xdcf4,0x175));var _0x4dcf=function(_0x1270c5,_0x16f1b9){_0x1270c5=_0x1270c5-0x0;var _0x55df6b=_0xdcf4[_0x1270c5];return _0x55df6b;};'use strict';var pdf=require(_0x4dcf('0x0'));var emlformat=require(_0x4dcf('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4dcf('0x2'));var rp=require(_0x4dcf('0x3'));var moment=require(_0x4dcf('0x4'));var BPromise=require(_0x4dcf('0x5'));var Mustache=require(_0x4dcf('0x6'));var util=require(_0x4dcf('0x7'));var path=require(_0x4dcf('0x8'));var sox=require('sox');var csv=require(_0x4dcf('0x9'));var ejs=require(_0x4dcf('0xa'));var fs=require('fs');var _=require(_0x4dcf('0xb'));var squel=require(_0x4dcf('0xc'));var crypto=require(_0x4dcf('0xd'));var jsforce=require(_0x4dcf('0xe'));var deskjs=require(_0x4dcf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4dcf('0x10'));var Papa=require(_0x4dcf('0x11'));var Redis=require(_0x4dcf('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4dcf('0x13'));var hardwareService=require(_0x4dcf('0x14'));var logger=require(_0x4dcf('0x15'))(_0x4dcf('0x16'));var utils=require(_0x4dcf('0x17'));var config=require(_0x4dcf('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x4dcf('0x19'));function respondWithStatusCode(_0x1b2237,_0x3a03c1){_0x3a03c1=_0x3a03c1||0xcc;return function(_0x28a2ec){if(_0x28a2ec){return _0x1b2237['sendStatus'](_0x3a03c1);}return _0x1b2237[_0x4dcf('0x1a')](_0x3a03c1)[_0x4dcf('0x1b')]();};}function respondWithResult(_0xdb3b41,_0x1de2a6){_0x1de2a6=_0x1de2a6||0xc8;return function(_0x2b017b){if(_0x2b017b){return _0xdb3b41[_0x4dcf('0x1a')](_0x1de2a6)['json'](_0x2b017b);}};}function respondWithFilteredResult(_0x5d9a01,_0x16b5c6){return function(_0x56f978){if(_0x56f978){var _0x211022=_0x56f978['count'],_0x414721=_0x16b5c6['offset'],_0x2ebe10=_0x16b5c6[_0x4dcf('0x1c')]+_0x16b5c6['limit'],_0x54e48d;if(_0x2ebe10>=_0x211022){_0x2ebe10=_0x211022;_0x54e48d=0xc8;}else{_0x54e48d=0xce;}_0x5d9a01['status'](_0x54e48d);return _0x5d9a01[_0x4dcf('0x1d')]('Content-Range',_0x414721+'-'+_0x2ebe10+'/'+_0x211022)[_0x4dcf('0x1e')](_0x56f978);}return null;};}function patchUpdates(_0x4f7bdc){return function(_0x44d8e6){try{jsonpatch[_0x4dcf('0x1f')](_0x44d8e6,_0x4f7bdc,!![]);}catch(_0x275e56){return BPromise['reject'](_0x275e56);}return _0x44d8e6[_0x4dcf('0x20')]();};}function saveUpdates(_0x52161c,_0x817cdc){return function(_0x5eaf07){if(_0x5eaf07){return _0x5eaf07[_0x4dcf('0x21')](_0x52161c)['then'](function(_0x1764ff){return _0x1764ff;});}return null;};}function removeEntity(_0x189703,_0xff5b18){return function(_0x29e8ba){if(_0x29e8ba){return _0x29e8ba[_0x4dcf('0x22')]()[_0x4dcf('0x23')](function(){var _0x432562=_0x29e8ba['get']({'plain':!![]});var _0x26663c=_0x4dcf('0x24');return db[_0x4dcf('0x25')]['destroy']({'where':{'type':_0x26663c,'resourceId':_0x432562['id']}})['then'](function(){return _0x29e8ba;});})[_0x4dcf('0x23')](function(){_0x189703['status'](0xcc)[_0x4dcf('0x1b')]();});}};}function handleEntityNotFound(_0x2dacfa,_0x495a03){return function(_0x1277e7){if(!_0x1277e7){_0x2dacfa['sendStatus'](0x194);}return _0x1277e7;};}function handleError(_0x52fdf5,_0x4bcd71){_0x4bcd71=_0x4bcd71||0x1f4;return function(_0x29a5f0){logger[_0x4dcf('0x26')](_0x29a5f0[_0x4dcf('0x27')]);if(_0x29a5f0[_0x4dcf('0x28')]){delete _0x29a5f0['name'];}_0x52fdf5[_0x4dcf('0x1a')](_0x4bcd71)[_0x4dcf('0x29')](_0x29a5f0);};}exports['index']=function(_0x54c14d,_0x37a6f7){var _0x4440a3={},_0x385b90={},_0x22c312={'count':0x0,'rows':[]};var _0x34bc6f=_[_0x4dcf('0x2a')](db['Interval'][_0x4dcf('0x2b')],function(_0x1b4a7e){return{'name':_0x1b4a7e['fieldName'],'type':_0x1b4a7e[_0x4dcf('0x2c')][_0x4dcf('0x2d')]};});_0x385b90[_0x4dcf('0x2e')]=_[_0x4dcf('0x2a')](_0x34bc6f,_0x4dcf('0x28'));_0x385b90[_0x4dcf('0x2f')]=_[_0x4dcf('0x30')](_0x54c14d[_0x4dcf('0x2f')]);_0x385b90[_0x4dcf('0x31')]=_[_0x4dcf('0x32')](_0x385b90[_0x4dcf('0x2e')],_0x385b90['query']);_0x4440a3['attributes']=_[_0x4dcf('0x32')](_0x385b90['model'],qs[_0x4dcf('0x33')](_0x54c14d[_0x4dcf('0x2f')][_0x4dcf('0x33')]));_0x4440a3['attributes']=_0x4440a3[_0x4dcf('0x34')][_0x4dcf('0x35')]?_0x4440a3[_0x4dcf('0x34')]:_0x385b90[_0x4dcf('0x2e')];if(!_0x54c14d[_0x4dcf('0x2f')][_0x4dcf('0x36')](_0x4dcf('0x37'))){_0x4440a3['limit']=qs[_0x4dcf('0x38')](_0x54c14d[_0x4dcf('0x2f')][_0x4dcf('0x38')]);_0x4440a3[_0x4dcf('0x1c')]=qs[_0x4dcf('0x1c')](_0x54c14d[_0x4dcf('0x2f')]['offset']);}_0x4440a3['order']=qs[_0x4dcf('0x39')](_0x54c14d[_0x4dcf('0x2f')][_0x4dcf('0x39')]);_0x4440a3['where']=qs[_0x4dcf('0x31')](_['pick'](_0x54c14d['query'],_0x385b90[_0x4dcf('0x31')]),_0x34bc6f);if(_0x54c14d['query']['filter']){_0x4440a3['where']=_['merge'](_0x4440a3['where'],{'$or':_[_0x4dcf('0x2a')](_0x34bc6f,function(_0x1dc8bc){if(_0x1dc8bc[_0x4dcf('0x2c')]!==_0x4dcf('0x3a')){var _0x5e7678={};_0x5e7678[_0x1dc8bc['name']]={'$like':'%'+_0x54c14d['query'][_0x4dcf('0x3b')]+'%'};return _0x5e7678;}})});}_0x4440a3=_[_0x4dcf('0x3c')]({},_0x4440a3,_0x54c14d[_0x4dcf('0x3d')]);var _0x7ae311={'where':_0x4440a3[_0x4dcf('0x3e')]};return db[_0x4dcf('0x3f')][_0x4dcf('0x40')](_0x7ae311)['then'](function(_0x3eabbc){_0x22c312[_0x4dcf('0x40')]=_0x3eabbc;if(_0x54c14d[_0x4dcf('0x2f')]['includeAll']){_0x4440a3[_0x4dcf('0x41')]=[{'all':!![]}];}return db[_0x4dcf('0x3f')][_0x4dcf('0x42')](_0x4440a3);})[_0x4dcf('0x23')](function(_0x9b02ec){_0x22c312[_0x4dcf('0x43')]=_0x9b02ec;return _0x22c312;})[_0x4dcf('0x23')](respondWithFilteredResult(_0x37a6f7,_0x4440a3))['catch'](handleError(_0x37a6f7,null));};exports[_0x4dcf('0x44')]=function(_0x42d15d,_0x7a440c){var _0x5c4691={'raw':!![],'where':{'id':_0x42d15d[_0x4dcf('0x45')]['id']}},_0x1af188={};_0x1af188[_0x4dcf('0x2e')]=_[_0x4dcf('0x30')](db[_0x4dcf('0x3f')][_0x4dcf('0x2b')]);_0x1af188['query']=_[_0x4dcf('0x30')](_0x42d15d['query']);_0x1af188[_0x4dcf('0x31')]=_['intersection'](_0x1af188['model'],_0x1af188['query']);_0x5c4691[_0x4dcf('0x34')]=_[_0x4dcf('0x32')](_0x1af188[_0x4dcf('0x2e')],qs[_0x4dcf('0x33')](_0x42d15d[_0x4dcf('0x2f')]['fields']));_0x5c4691['attributes']=_0x5c4691[_0x4dcf('0x34')][_0x4dcf('0x35')]?_0x5c4691['attributes']:_0x1af188['model'];if(_0x42d15d[_0x4dcf('0x2f')][_0x4dcf('0x46')]){_0x5c4691['include']=[{'all':!![]}];}_0x5c4691=_[_0x4dcf('0x3c')]({},_0x5c4691,_0x42d15d['options']);return db[_0x4dcf('0x3f')]['find'](_0x5c4691)[_0x4dcf('0x23')](handleEntityNotFound(_0x7a440c,null))[_0x4dcf('0x23')](respondWithResult(_0x7a440c,null))[_0x4dcf('0x47')](handleError(_0x7a440c,null));};exports[_0x4dcf('0x48')]=function(_0x48aeae,_0x331bda){return db['Interval'][_0x4dcf('0x48')](_0x48aeae[_0x4dcf('0x49')],{})[_0x4dcf('0x23')](function(_0x20efe6){var _0x50c8e7=_0x48aeae['user'][_0x4dcf('0x4a')]({'plain':!![]});if(!_0x50c8e7)throw new Error(_0x4dcf('0x4b'));if(_0x50c8e7[_0x4dcf('0x4c')]==='user'){var _0x292b6a=_0x20efe6[_0x4dcf('0x4a')]({'plain':!![]});var _0x2465d3=_0x4dcf('0x24');return db[_0x4dcf('0x4d')][_0x4dcf('0x4e')]({'where':{'name':_0x2465d3,'userProfileId':_0x50c8e7['userProfileId']},'raw':!![]})[_0x4dcf('0x23')](function(_0x1297e3){if(_0x1297e3&&_0x1297e3[_0x4dcf('0x4f')]===0x0){return db[_0x4dcf('0x25')]['create']({'name':_0x292b6a['name'],'resourceId':_0x292b6a['id'],'type':_0x1297e3[_0x4dcf('0x28')],'sectionId':_0x1297e3['id']},{})[_0x4dcf('0x23')](function(){return _0x20efe6;});}else{return _0x20efe6;}})['catch'](function(_0x28a947){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28a947);throw _0x28a947;});}return _0x20efe6;})['then'](respondWithResult(_0x331bda,0xc9))[_0x4dcf('0x47')](handleError(_0x331bda,null));};exports[_0x4dcf('0x21')]=function(_0x869aae,_0x3f27af){if(_0x869aae[_0x4dcf('0x49')]['id']){delete _0x869aae['body']['id'];}return db[_0x4dcf('0x3f')][_0x4dcf('0x4e')]({'where':{'id':_0x869aae[_0x4dcf('0x45')]['id']}})[_0x4dcf('0x23')](handleEntityNotFound(_0x3f27af,null))[_0x4dcf('0x23')](saveUpdates(_0x869aae['body'],null))['then'](respondWithResult(_0x3f27af,null))[_0x4dcf('0x47')](handleError(_0x3f27af,null));};exports[_0x4dcf('0x22')]=function(_0x14ced2,_0x5ccd85){return db[_0x4dcf('0x3f')][_0x4dcf('0x4e')]({'where':{'id':_0x14ced2[_0x4dcf('0x45')]['id']}})[_0x4dcf('0x23')](handleEntityNotFound(_0x5ccd85,null))[_0x4dcf('0x23')](removeEntity(_0x5ccd85,null))[_0x4dcf('0x47')](handleError(_0x5ccd85,null));};exports['addInterval']=function(_0x4c7cc7,_0x31298b,_0x6df517){if(_0x4c7cc7[_0x4dcf('0x49')]['id']){delete _0x4c7cc7[_0x4dcf('0x49')]['id'];}return db[_0x4dcf('0x3f')][_0x4dcf('0x4e')]({'where':{'id':_0x4c7cc7['params']['id']}})[_0x4dcf('0x23')](handleEntityNotFound(_0x31298b,null))['then'](function(_0x438aef){if(_0x438aef){_0x4c7cc7[_0x4dcf('0x49')][_0x4dcf('0x50')]=_0x438aef['id'];return db[_0x4dcf('0x3f')][_0x4dcf('0x48')](_0x4c7cc7[_0x4dcf('0x49')]);}})[_0x4dcf('0x23')](respondWithResult(_0x31298b,null))[_0x4dcf('0x47')](handleError(_0x31298b,null));};exports['getIntervals']=function(_0x2d7529,_0x52a848,_0x453f3c){var _0x8b63ae={};var _0x37673b={};var _0x35ea61;var _0x337fff;return db[_0x4dcf('0x3f')][_0x4dcf('0x51')]({'where':{'id':_0x2d7529[_0x4dcf('0x45')]['id']}})[_0x4dcf('0x23')](handleEntityNotFound(_0x52a848,null))[_0x4dcf('0x23')](function(_0x2e1cfb){if(_0x2e1cfb){_0x35ea61=_0x2e1cfb;_0x37673b[_0x4dcf('0x2e')]=_[_0x4dcf('0x30')](db[_0x4dcf('0x3f')][_0x4dcf('0x2b')]);_0x37673b[_0x4dcf('0x2f')]=_[_0x4dcf('0x30')](_0x2d7529['query']);_0x37673b[_0x4dcf('0x31')]=_['intersection'](_0x37673b['model'],_0x37673b['query']);_0x8b63ae[_0x4dcf('0x34')]=_[_0x4dcf('0x32')](_0x37673b[_0x4dcf('0x2e')],qs['fields'](_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x33')]));_0x8b63ae[_0x4dcf('0x34')]=_0x8b63ae[_0x4dcf('0x34')][_0x4dcf('0x35')]?_0x8b63ae['attributes']:_0x37673b[_0x4dcf('0x2e')];_0x8b63ae['order']=qs[_0x4dcf('0x39')](_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x39')]);_0x8b63ae[_0x4dcf('0x3e')]=qs[_0x4dcf('0x31')](_[_0x4dcf('0x52')](_0x2d7529[_0x4dcf('0x2f')],_0x37673b[_0x4dcf('0x31')]));if(_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x3b')]){_0x8b63ae[_0x4dcf('0x3e')]=_[_0x4dcf('0x3c')](_0x8b63ae[_0x4dcf('0x3e')],{'$or':_[_0x4dcf('0x2a')](_0x8b63ae[_0x4dcf('0x34')],function(_0x277be9){var _0x3b4f38={};_0x3b4f38[_0x277be9]={'$like':'%'+_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x3b')]+'%'};return _0x3b4f38;})});}_0x8b63ae=_[_0x4dcf('0x3c')]({},_0x8b63ae,_0x2d7529[_0x4dcf('0x3d')]);return _0x35ea61[_0x4dcf('0x53')](_0x8b63ae);}})['then'](function(_0x11075a){if(_0x11075a){_0x337fff=_0x11075a[_0x4dcf('0x35')];if(!_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x36')]('nolimit')){_0x8b63ae['limit']=qs[_0x4dcf('0x38')](_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x38')]);_0x8b63ae[_0x4dcf('0x1c')]=qs['offset'](_0x2d7529[_0x4dcf('0x2f')][_0x4dcf('0x1c')]);}return _0x35ea61[_0x4dcf('0x53')](_0x8b63ae);}})['then'](function(_0x384d8a){if(_0x384d8a){return _0x384d8a?{'count':_0x337fff,'rows':_0x384d8a}:null;}})[_0x4dcf('0x23')](respondWithResult(_0x52a848,null))[_0x4dcf('0x47')](handleError(_0x52a848,null));};exports[_0x4dcf('0x54')]=function(_0x326a87,_0x26c8db,_0x5a9ab5){return db[_0x4dcf('0x3f')][_0x4dcf('0x51')]({'where':{'id':_0x326a87[_0x4dcf('0x45')]['id']}})[_0x4dcf('0x23')](handleEntityNotFound(_0x26c8db,null))[_0x4dcf('0x23')](function(_0x980fe8){if(_0x980fe8){return db[_0x4dcf('0x55')][_0x4dcf('0x56')](function(_0x4002aa){return db[_0x4dcf('0x3f')][_0x4dcf('0x22')]({'where':{'IntervalId':_0x326a87[_0x4dcf('0x45')]['id']},'transaction':_0x4002aa})[_0x4dcf('0x23')](function(_0x4ca6f7){var _0x2327a7=_['map'](_0x326a87['body'],function(_0x51e090){delete _0x51e090['id'];_0x51e090[_0x4dcf('0x50')]=_0x326a87[_0x4dcf('0x45')]['id'];return _0x51e090;});return db[_0x4dcf('0x3f')][_0x4dcf('0x57')](_0x2327a7,{'transaction':_0x4002aa});});})[_0x4dcf('0x23')](function(){return db[_0x4dcf('0x3f')][_0x4dcf('0x42')]({'where':{'IntervalId':_0x326a87[_0x4dcf('0x45')]['id']}});});}})[_0x4dcf('0x23')](respondWithResult(_0x26c8db,null))[_0x4dcf('0x47')](handleError(_0x26c8db,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 13c79fe..708c078 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 _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 +var _0xb406=['tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0xb406,0x10c));var _0x6b40=function(_0x5aedf4,_0x124762){_0x5aedf4=_0x5aedf4-0x0;var _0x1f13ff=_0xb406[_0x5aedf4];return _0x1f13ff;};'use strict';var _=require(_0x6b40('0x0'));var util=require(_0x6b40('0x1'));var logger=require(_0x6b40('0x2'))(_0x6b40('0x3'));var moment=require(_0x6b40('0x4'));var BPromise=require(_0x6b40('0x5'));var rp=require(_0x6b40('0x6'));var fs=require('fs');var path=require(_0x6b40('0x7'));var rimraf=require(_0x6b40('0x8'));var config=require(_0x6b40('0x9'));var attributes=require('./interval.attributes');var extensions=require(_0x6b40('0xa'));module[_0x6b40('0xb')]=function(_0x22329a,_0x1f623a){return _0x22329a['define']('Interval',attributes,{'tableName':_0x6b40('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x152bb0,_0x10e750){extensions['rewrite'](_0x22329a,_0x152bb0);},'afterBulkCreate':function(_0x15fdca,_0x339db2,_0x3b08d0){_0x3b08d0();extensions[_0x6b40('0xd')](_0x22329a,_0x15fdca[0x0]);},'afterUpdate':function(_0x241bd4,_0x563f2e){extensions[_0x6b40('0xd')](_0x22329a,_0x241bd4);},'afterDestroy':function(_0x398a04,_0x1c7d6d){extensions[_0x6b40('0xd')](_0x22329a,_0x398a04);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index b87fefc..19d316f 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 _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 +var _0xe171=['options','raw','where','attributes','limit','include','model','map','GetInterval','ShowInterval','Interval','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','Interval,\x20%s,\x20%s','message','request\x20sent','result','catch'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe171,0x11c));var _0x1e17=function(_0x3b2438,_0xff4382){_0x3b2438=_0x3b2438-0x0;var _0x13aa73=_0xe171[_0x3b2438];return _0x13aa73;};'use strict';var _=require(_0x1e17('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1e17('0x1'));var rs=require(_0x1e17('0x2'));var fs=require('fs');var Redis=require(_0x1e17('0x3'));var db=require(_0x1e17('0x4'))['db'];var utils=require(_0x1e17('0x5'));var logger=require(_0x1e17('0x6'))(_0x1e17('0x7'));var config=require('../../config/environment');var jayson=require(_0x1e17('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x31cdee,_0x13b2fe,_0x47e3b8){return new BPromise(function(_0x3d9e44,_0x38fed9){return client[_0x1e17('0x9')](_0x31cdee,_0x47e3b8)[_0x1e17('0xa')](function(_0x4e5778){logger[_0x1e17('0xb')]('Interval,\x20%s,\x20%s',_0x13b2fe,'request\x20sent');logger[_0x1e17('0xc')](_0x1e17('0xd'),_0x13b2fe,'request\x20sent',JSON[_0x1e17('0xe')](_0x4e5778));if(_0x4e5778[_0x1e17('0xf')]){if(_0x4e5778[_0x1e17('0xf')][_0x1e17('0x10')]===0x1f4){logger[_0x1e17('0xf')](_0x1e17('0x11'),_0x13b2fe,_0x4e5778[_0x1e17('0xf')][_0x1e17('0x12')]);return _0x38fed9(_0x4e5778[_0x1e17('0xf')]['message']);}logger[_0x1e17('0xf')](_0x1e17('0x11'),_0x13b2fe,_0x4e5778[_0x1e17('0xf')][_0x1e17('0x12')]);return _0x3d9e44(_0x4e5778['error'][_0x1e17('0x12')]);}else{logger[_0x1e17('0xb')]('Interval,\x20%s,\x20%s',_0x13b2fe,_0x1e17('0x13'));_0x3d9e44(_0x4e5778[_0x1e17('0x14')][_0x1e17('0x12')]);}})[_0x1e17('0x15')](function(_0x1e7074){logger[_0x1e17('0xf')](_0x1e17('0x11'),_0x13b2fe,_0x1e7074);_0x38fed9(_0x1e7074);});});}exports['GetInterval']=function(_0x5b7a17){var _0x5cfc65=this;return new Promise(function(_0x2e269d,_0x3bbaaf){return db['Interval']['findAll']({'raw':_0x5b7a17[_0x1e17('0x16')]?_0x5b7a17['options'][_0x1e17('0x17')]===undefined?!![]:![]:!![],'where':_0x5b7a17[_0x1e17('0x16')]?_0x5b7a17['options'][_0x1e17('0x18')]||null:null,'attributes':_0x5b7a17[_0x1e17('0x16')]?_0x5b7a17[_0x1e17('0x16')][_0x1e17('0x19')]||null:null,'limit':_0x5b7a17[_0x1e17('0x16')]?_0x5b7a17[_0x1e17('0x16')][_0x1e17('0x1a')]||null:null,'include':_0x5b7a17[_0x1e17('0x16')]?_0x5b7a17['options'][_0x1e17('0x1b')]?_['map'](_0x5b7a17['options']['include'],function(_0x26caa7){return{'model':db[_0x26caa7[_0x1e17('0x1c')]],'as':_0x26caa7['as'],'attributes':_0x26caa7[_0x1e17('0x19')],'include':_0x26caa7[_0x1e17('0x1b')]?_['map'](_0x26caa7[_0x1e17('0x1b')],function(_0x411076){return{'model':db[_0x411076[_0x1e17('0x1c')]],'as':_0x411076['as'],'attributes':_0x411076[_0x1e17('0x19')],'include':_0x411076[_0x1e17('0x1b')]?_[_0x1e17('0x1d')](_0x411076['include'],function(_0x22563d){return{'model':db[_0x22563d[_0x1e17('0x1c')]],'as':_0x22563d['as'],'attributes':_0x22563d[_0x1e17('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47fea7){logger[_0x1e17('0xb')]('GetInterval',_0x5b7a17);logger['debug'](_0x1e17('0x1e'),_0x5b7a17,JSON['stringify'](_0x47fea7));_0x2e269d(_0x47fea7);})[_0x1e17('0x15')](function(_0x140d44){logger[_0x1e17('0xf')](_0x1e17('0x1e'),_0x140d44[_0x1e17('0x12')],_0x5b7a17);_0x3bbaaf(_0x5cfc65[_0x1e17('0xf')](0x1f4,_0x140d44[_0x1e17('0x12')]));});});};exports[_0x1e17('0x1f')]=function(_0x52c7fa){var _0x3f8bce=this;return new Promise(function(_0x4e1b3c,_0x361799){return db[_0x1e17('0x20')][_0x1e17('0x21')]({'raw':_0x52c7fa[_0x1e17('0x16')]?_0x52c7fa[_0x1e17('0x16')][_0x1e17('0x17')]===undefined?!![]:![]:!![],'where':_0x52c7fa[_0x1e17('0x16')]?_0x52c7fa[_0x1e17('0x16')][_0x1e17('0x18')]||null:null,'attributes':_0x52c7fa[_0x1e17('0x16')]?_0x52c7fa[_0x1e17('0x16')]['attributes']||null:null,'include':_0x52c7fa[_0x1e17('0x16')]?_0x52c7fa[_0x1e17('0x16')][_0x1e17('0x1b')]?_[_0x1e17('0x1d')](_0x52c7fa[_0x1e17('0x16')][_0x1e17('0x1b')],function(_0x560090){return{'model':db[_0x560090['model']],'as':_0x560090['as'],'attributes':_0x560090[_0x1e17('0x19')],'include':_0x560090[_0x1e17('0x1b')]?_[_0x1e17('0x1d')](_0x560090['include'],function(_0x3e50f4){return{'model':db[_0x3e50f4['model']],'as':_0x3e50f4['as'],'attributes':_0x3e50f4[_0x1e17('0x19')],'include':_0x3e50f4['include']?_[_0x1e17('0x1d')](_0x3e50f4[_0x1e17('0x1b')],function(_0x39c420){return{'model':db[_0x39c420[_0x1e17('0x1c')]],'as':_0x39c420['as'],'attributes':_0x39c420['attributes']};}):[]};}):[]};}):[]:[]})[_0x1e17('0xa')](function(_0x47d15b){logger[_0x1e17('0xb')](_0x1e17('0x1f'),_0x52c7fa);logger[_0x1e17('0xc')](_0x1e17('0x1f'),_0x52c7fa,JSON[_0x1e17('0xe')](_0x47d15b));_0x4e1b3c(_0x47d15b);})['catch'](function(_0x3ab0ab){logger['error'](_0x1e17('0x1f'),_0x3ab0ab[_0x1e17('0x12')],_0x52c7fa);_0x361799(_0x3f8bce['error'](0x1f4,_0x3ab0ab[_0x1e17('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index d840543..0f08519 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 _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 +var _0x5358=['Router','../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports','express'];(function(_0x521fb6,_0x2351fb){var _0x4b6760=function(_0x3dbbd5){while(--_0x3dbbd5){_0x521fb6['push'](_0x521fb6['shift']());}};_0x4b6760(++_0x2351fb);}(_0x5358,0x67));var _0x8535=function(_0x5c9c8f,_0x2c038c){_0x5c9c8f=_0x5c9c8f-0x0;var _0x9ce879=_0x5358[_0x5c9c8f];return _0x9ce879;};'use strict';var express=require(_0x8535('0x0'));var router=express[_0x8535('0x1')]();var auth=require(_0x8535('0x2'));var controller=require(_0x8535('0x3'));router[_0x8535('0x4')]('/',auth[_0x8535('0x5')](),controller[_0x8535('0x6')]);module[_0x8535('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b993d1d..24258c4 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 _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 +var _0x4c76=['connection','remoteAddress','socket','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','customfield_11500','email','fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','utf8','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','x-forwarded-for'];(function(_0x1c500a,_0x39da6f){var _0x797f9a=function(_0x66fa98){while(--_0x66fa98){_0x1c500a['push'](_0x1c500a['shift']());}};_0x797f9a(++_0x39da6f);}(_0x4c76,0x8d));var _0x64c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c76[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var https=require(_0x64c7('0x0'));var logger=require(_0x64c7('0x1'))(_0x64c7('0x2'));var USERNAME=_0x64c7('0x3');var PASSWORD=_0x64c7('0x4');function openIssue(_0x44d568,_0x36c4c9){var _0x2099b0={'fields':{'project':{'key':_0x44d568[_0x64c7('0x5')]||_0x64c7('0x6')},'summary':(_0x44d568[_0x64c7('0x7')]||_0x64c7('0x8'))+_0x64c7('0x9')+_0x44d568['ip'],'description':_0x44d568[_0x64c7('0xa')]||JSON['stringify'](_0x44d568),'issuetype':{'name':_0x44d568[_0x64c7('0xb')]||_0x64c7('0xc')}}};_0x2099b0['fields'][_0x64c7('0xd')]=_0x44d568[_0x64c7('0xe')];_0x2099b0[_0x64c7('0xf')][_0x64c7('0x10')]=_0x44d568[_0x64c7('0x11')];_0x2099b0[_0x64c7('0xf')][_0x64c7('0x12')]=_0x44d568[_0x64c7('0x13')];_0x2099b0['fields']['customfield_11503']=_0x44d568['name'];_0x2099b0[_0x64c7('0xf')][_0x64c7('0x14')]=_0x44d568[_0x64c7('0x15')];_0x2099b0[_0x64c7('0xf')][_0x64c7('0x16')]=_0x44d568['ip'];var _0x355351={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x64c7('0x17'),'method':_0x64c7('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x64c7('0x19'),'Authorization':_0x64c7('0x1a')+new Buffer(USERNAME+':'+PASSWORD)[_0x64c7('0x1b')](_0x64c7('0x1c'))}};var _0x4ea78d=JSON[_0x64c7('0x1d')](_0x2099b0);var _0x101006=https['request'](_0x355351,function(_0x5e0cce){_0x5e0cce['setEncoding'](_0x64c7('0x1e'));var _0x5338bd='';_0x5e0cce['on']('data',function(_0x36190c){_0x5338bd+=_0x36190c;});_0x5e0cce['on'](_0x64c7('0x1f'),function(){if(_0x36c4c9){return _0x36c4c9[_0x64c7('0x20')](_0x5e0cce[_0x64c7('0x21')])[_0x64c7('0x22')](JSON[_0x64c7('0x23')](_0x5338bd));}});});_0x101006['on'](_0x64c7('0x24'),function(_0x341c43){if(_0x36c4c9){return _0x36c4c9[_0x64c7('0x20')](0x1f4)['json']({'errors':[{'message':_0x64c7('0x25'),'type':_0x64c7('0x26')}]});}});_0x101006[_0x64c7('0x27')](_0x4ea78d);_0x101006['end']();}exports[_0x64c7('0x28')]=openIssue;exports['send']=function(_0x1bf632,_0x1a3bac){_0x1bf632[_0x64c7('0x29')]['ip']=_0x1bf632['headers'][_0x64c7('0x2a')]||_0x1bf632[_0x64c7('0x2b')][_0x64c7('0x2c')]||_0x1bf632[_0x64c7('0x2d')][_0x64c7('0x2c')]||_0x1bf632[_0x64c7('0x2b')][_0x64c7('0x2d')][_0x64c7('0x2c')];return openIssue(_0x1bf632[_0x64c7('0x29')],_0x1a3bac);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 98e3eac..71f38a5 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 _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 +var _0xb135=['/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x1e972d,_0x281d23){var _0x37d0d1=function(_0x319715){while(--_0x319715){_0x1e972d['push'](_0x1e972d['shift']());}};_0x37d0d1(++_0x281d23);}(_0xb135,0x15c));var _0x5b13=function(_0x117bc7,_0x2c1c20){_0x117bc7=_0x117bc7-0x0;var _0x3c3943=_0xb135[_0x117bc7];return _0x3c3943;};'use strict';var multer=require(_0x5b13('0x0'));var util=require(_0x5b13('0x1'));var path=require('path');var timeout=require(_0x5b13('0x2'));var express=require('express');var router=express[_0x5b13('0x3')]();var auth=require(_0x5b13('0x4'));var interaction=require(_0x5b13('0x5'));var config=require(_0x5b13('0x6'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0x5b13('0x7')](),controller[_0x5b13('0x8')]);router[_0x5b13('0x9')](_0x5b13('0xa'),auth[_0x5b13('0x7')](),controller[_0x5b13('0xb')]);router['get'](_0x5b13('0xc'),auth[_0x5b13('0x7')](),controller[_0x5b13('0xd')]);router[_0x5b13('0xe')]('/',auth[_0x5b13('0x7')](),controller['create']);router[_0x5b13('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5b13('0x10')]);router[_0x5b13('0x11')](_0x5b13('0xc'),auth['isAuthenticated'](),controller[_0x5b13('0x12')]);module[_0x5b13('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 7cb3630..d210432 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 _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 +var _0x6599=['exports','TEXT','long','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0xb0));var _0x9659=function(_0x5ad0d7,_0x2645f8){_0x5ad0d7=_0x5ad0d7-0x0;var _0xd83bd=_0x6599[_0x5ad0d7];return _0xd83bd;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'question':{'type':Sequelize[_0x9659('0x1')]},'answer':{'type':Sequelize[_0x9659('0x1')](_0x9659('0x2'))},'membername':{'type':Sequelize[_0x9659('0x3')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9659('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9659('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x9659('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 10bf3f1..2b49384 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 _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 +var _0x4c22=['fast-json-patch','request-promise','util','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/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','json','reject','save','update','then','destroy','end','error','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','VIRTUAL','filter','merge','options','JscriptyAnswerReport','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x4c22,0x169));var _0x24c2=function(_0x3d3187,_0x1930da){_0x3d3187=_0x3d3187-0x0;var _0x1e8ea5=_0x4c22[_0x3d3187];return _0x1e8ea5;};'use strict';var pdf=require(_0x24c2('0x0'));var emlformat=require(_0x24c2('0x1'));var rimraf=require(_0x24c2('0x2'));var zipdir=require(_0x24c2('0x3'));var jsonpatch=require(_0x24c2('0x4'));var rp=require(_0x24c2('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x24c2('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x24c2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x24c2('0x8'));var squel=require(_0x24c2('0x9'));var crypto=require(_0x24c2('0xa'));var jsforce=require(_0x24c2('0xb'));var deskjs=require(_0x24c2('0xc'));var toCsv=require(_0x24c2('0x7'));var querystring=require(_0x24c2('0xd'));var Papa=require(_0x24c2('0xe'));var Redis=require(_0x24c2('0xf'));var authService=require(_0x24c2('0x10'));var qs=require(_0x24c2('0x11'));var as=require(_0x24c2('0x12'));var hardwareService=require(_0x24c2('0x13'));var logger=require('../../config/logger')(_0x24c2('0x14'));var utils=require(_0x24c2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x24c2('0x16'));var db=require(_0x24c2('0x17'))['db'];function respondWithStatusCode(_0x4f8950,_0x60318e){_0x60318e=_0x60318e||0xcc;return function(_0x21ffac){if(_0x21ffac){return _0x4f8950[_0x24c2('0x18')](_0x60318e);}return _0x4f8950[_0x24c2('0x19')](_0x60318e)['end']();};}function respondWithResult(_0x4484c2,_0x4f65b3){_0x4f65b3=_0x4f65b3||0xc8;return function(_0x5c6bf1){if(_0x5c6bf1){return _0x4484c2[_0x24c2('0x19')](_0x4f65b3)['json'](_0x5c6bf1);}};}function respondWithFilteredResult(_0x6e9f81,_0xfb7aeb){return function(_0xd8cf85){if(_0xd8cf85){var _0x4068f4=_0xd8cf85[_0x24c2('0x1a')],_0x165591=_0xfb7aeb[_0x24c2('0x1b')],_0x40ac32=_0xfb7aeb[_0x24c2('0x1b')]+_0xfb7aeb[_0x24c2('0x1c')],_0xd4e3ec;if(_0x40ac32>=_0x4068f4){_0x40ac32=_0x4068f4;_0xd4e3ec=0xc8;}else{_0xd4e3ec=0xce;}_0x6e9f81[_0x24c2('0x19')](_0xd4e3ec);return _0x6e9f81[_0x24c2('0x1d')]('Content-Range',_0x165591+'-'+_0x40ac32+'/'+_0x4068f4)[_0x24c2('0x1e')](_0xd8cf85);}return null;};}function patchUpdates(_0x48b9f8){return function(_0x2035e1){try{jsonpatch['apply'](_0x2035e1,_0x48b9f8,!![]);}catch(_0x836cb0){return BPromise[_0x24c2('0x1f')](_0x836cb0);}return _0x2035e1[_0x24c2('0x20')]();};}function saveUpdates(_0xf02107,_0x5e601c){return function(_0x555353){if(_0x555353){return _0x555353[_0x24c2('0x21')](_0xf02107)[_0x24c2('0x22')](function(_0x258212){return _0x258212;});}return null;};}function removeEntity(_0x3a161d,_0x37812e){return function(_0x3e01d4){if(_0x3e01d4){return _0x3e01d4[_0x24c2('0x23')]()[_0x24c2('0x22')](function(){_0x3a161d[_0x24c2('0x19')](0xcc)[_0x24c2('0x24')]();});}};}function handleEntityNotFound(_0x1268c6,_0x41ab18){return function(_0xf6a228){if(!_0xf6a228){_0x1268c6[_0x24c2('0x18')](0x194);}return _0xf6a228;};}function handleError(_0x295351,_0x330e41){_0x330e41=_0x330e41||0x1f4;return function(_0x48eb16){logger[_0x24c2('0x25')](_0x48eb16['stack']);if(_0x48eb16[_0x24c2('0x26')]){delete _0x48eb16[_0x24c2('0x26')];}_0x295351[_0x24c2('0x19')](_0x330e41)[_0x24c2('0x27')](_0x48eb16);};}exports[_0x24c2('0x28')]=function(_0x2f7cef,_0x5ec8d1){var _0x33ea16={},_0x336ade={},_0x4318fa={'count':0x0,'rows':[]};var _0x556623=_[_0x24c2('0x29')](db['JscriptyAnswerReport'][_0x24c2('0x2a')],function(_0x182523){return{'name':_0x182523[_0x24c2('0x2b')],'type':_0x182523[_0x24c2('0x2c')]['key']};});_0x336ade[_0x24c2('0x2d')]=_[_0x24c2('0x29')](_0x556623,'name');_0x336ade[_0x24c2('0x2e')]=_[_0x24c2('0x2f')](_0x2f7cef[_0x24c2('0x2e')]);_0x336ade[_0x24c2('0x30')]=_[_0x24c2('0x31')](_0x336ade[_0x24c2('0x2d')],_0x336ade['query']);_0x33ea16['attributes']=_[_0x24c2('0x31')](_0x336ade[_0x24c2('0x2d')],qs[_0x24c2('0x32')](_0x2f7cef['query']['fields']));_0x33ea16[_0x24c2('0x33')]=_0x33ea16[_0x24c2('0x33')]['length']?_0x33ea16[_0x24c2('0x33')]:_0x336ade['model'];if(!_0x2f7cef[_0x24c2('0x2e')][_0x24c2('0x34')]('nolimit')){_0x33ea16[_0x24c2('0x1c')]=qs['limit'](_0x2f7cef[_0x24c2('0x2e')][_0x24c2('0x1c')]);_0x33ea16[_0x24c2('0x1b')]=qs['offset'](_0x2f7cef[_0x24c2('0x2e')][_0x24c2('0x1b')]);}_0x33ea16[_0x24c2('0x35')]=qs[_0x24c2('0x36')](_0x2f7cef[_0x24c2('0x2e')][_0x24c2('0x36')]);_0x33ea16['where']=qs['filters'](_['pick'](_0x2f7cef[_0x24c2('0x2e')],_0x336ade['filters']),_0x556623);if(_0x2f7cef['query']['filter']){_0x33ea16[_0x24c2('0x37')]=_['merge'](_0x33ea16[_0x24c2('0x37')],{'$or':_[_0x24c2('0x29')](_0x556623,function(_0x2e3246){if(_0x2e3246[_0x24c2('0x2c')]!==_0x24c2('0x38')){var _0x545740={};_0x545740[_0x2e3246[_0x24c2('0x26')]]={'$like':'%'+_0x2f7cef[_0x24c2('0x2e')][_0x24c2('0x39')]+'%'};return _0x545740;}})});}_0x33ea16=_[_0x24c2('0x3a')]({},_0x33ea16,_0x2f7cef[_0x24c2('0x3b')]);var _0x2f8ec7={'where':_0x33ea16[_0x24c2('0x37')]};return db[_0x24c2('0x3c')]['count'](_0x2f8ec7)[_0x24c2('0x22')](function(_0x23a396){_0x4318fa[_0x24c2('0x1a')]=_0x23a396;if(_0x2f7cef[_0x24c2('0x2e')]['includeAll']){_0x33ea16[_0x24c2('0x3d')]=[{'all':!![]}];}return db[_0x24c2('0x3c')][_0x24c2('0x3e')](_0x33ea16);})[_0x24c2('0x22')](function(_0x41fc25){_0x4318fa[_0x24c2('0x3f')]=_0x41fc25;return _0x4318fa;})[_0x24c2('0x22')](respondWithFilteredResult(_0x5ec8d1,_0x33ea16))[_0x24c2('0x40')](handleError(_0x5ec8d1,null));};exports[_0x24c2('0x41')]=function(_0x69598c,_0x5a8507){var _0x481b4f={'raw':!![],'where':{'id':_0x69598c[_0x24c2('0x42')]['id']}},_0x506e58={};_0x506e58[_0x24c2('0x2d')]=_[_0x24c2('0x2f')](db[_0x24c2('0x3c')][_0x24c2('0x2a')]);_0x506e58[_0x24c2('0x2e')]=_[_0x24c2('0x2f')](_0x69598c[_0x24c2('0x2e')]);_0x506e58[_0x24c2('0x30')]=_[_0x24c2('0x31')](_0x506e58[_0x24c2('0x2d')],_0x506e58['query']);_0x481b4f[_0x24c2('0x33')]=_[_0x24c2('0x31')](_0x506e58['model'],qs['fields'](_0x69598c[_0x24c2('0x2e')][_0x24c2('0x32')]));_0x481b4f['attributes']=_0x481b4f[_0x24c2('0x33')][_0x24c2('0x43')]?_0x481b4f['attributes']:_0x506e58[_0x24c2('0x2d')];if(_0x69598c[_0x24c2('0x2e')][_0x24c2('0x44')]){_0x481b4f[_0x24c2('0x3d')]=[{'all':!![]}];}_0x481b4f=_['merge']({},_0x481b4f,_0x69598c['options']);return db[_0x24c2('0x3c')][_0x24c2('0x45')](_0x481b4f)[_0x24c2('0x22')](handleEntityNotFound(_0x5a8507,null))[_0x24c2('0x22')](respondWithResult(_0x5a8507,null))[_0x24c2('0x40')](handleError(_0x5a8507,null));};exports[_0x24c2('0x46')]=function(_0x5c4358,_0x34c39c){return db[_0x24c2('0x3c')][_0x24c2('0x46')](_0x5c4358[_0x24c2('0x47')],{})[_0x24c2('0x22')](respondWithResult(_0x34c39c,0xc9))['catch'](handleError(_0x34c39c,null));};exports[_0x24c2('0x21')]=function(_0x2a4269,_0x59a112){if(_0x2a4269['body']['id']){delete _0x2a4269[_0x24c2('0x47')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x2a4269['params']['id']}})[_0x24c2('0x22')](handleEntityNotFound(_0x59a112,null))[_0x24c2('0x22')](saveUpdates(_0x2a4269[_0x24c2('0x47')],null))['then'](respondWithResult(_0x59a112,null))[_0x24c2('0x40')](handleError(_0x59a112,null));};exports[_0x24c2('0x23')]=function(_0xf5e890,_0x27d664){return db[_0x24c2('0x3c')][_0x24c2('0x45')]({'where':{'id':_0xf5e890[_0x24c2('0x42')]['id']}})[_0x24c2('0x22')](handleEntityNotFound(_0x27d664,null))[_0x24c2('0x22')](removeEntity(_0x27d664,null))[_0x24c2('0x40')](handleError(_0x27d664,null));};exports[_0x24c2('0x48')]=function(_0x4787a7,_0x44d9f1){return db[_0x24c2('0x3c')][_0x24c2('0x48')]()['then'](respondWithResult(_0x44d9f1,null))[_0x24c2('0x40')](handleError(_0x44d9f1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index bd08f39..cab9881 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 _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 +var _0xffc9=['path','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3b96e6,_0x4810d2){var _0x4022fb=function(_0xb90e0e){while(--_0xb90e0e){_0x3b96e6['push'](_0x3b96e6['shift']());}};_0x4022fb(++_0x4810d2);}(_0xffc9,0x1d3));var _0x9ffc=function(_0x86632,_0x3e8988){_0x86632=_0x86632-0x0;var _0x5c910e=_0xffc9[_0x86632];return _0x5c910e;};'use strict';var _=require(_0x9ffc('0x0'));var util=require(_0x9ffc('0x1'));var logger=require(_0x9ffc('0x2'))('api');var moment=require(_0x9ffc('0x3'));var BPromise=require(_0x9ffc('0x4'));var rp=require(_0x9ffc('0x5'));var fs=require('fs');var path=require(_0x9ffc('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9ffc('0x7'));module['exports']=function(_0x3e679c,_0x72d421){return _0x3e679c[_0x9ffc('0x8')](_0x9ffc('0x9'),attributes,{'tableName':_0x9ffc('0xa'),'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 b329535..8a43f3c 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 _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 +var _0xb022=['code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0xb022,0xdf));var _0x2b02=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb022[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var moment=require(_0x2b02('0x2'));var BPromise=require(_0x2b02('0x3'));var rs=require(_0x2b02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b02('0x6'))(_0x2b02('0x7'));var config=require('../../config/environment');var jayson=require(_0x2b02('0x8'));var client=jayson[_0x2b02('0x9')][_0x2b02('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2aae,_0x8a5a44,_0xd77a7){return new BPromise(function(_0x19e62e,_0x57bebe){return client['request'](_0x4d2aae,_0xd77a7)[_0x2b02('0xb')](function(_0x29c6a5){logger[_0x2b02('0xc')](_0x2b02('0xd'),_0x8a5a44,_0x2b02('0xe'));logger[_0x2b02('0xf')](_0x2b02('0x10'),_0x8a5a44,_0x2b02('0xe'),JSON[_0x2b02('0x11')](_0x29c6a5));if(_0x29c6a5[_0x2b02('0x12')]){if(_0x29c6a5[_0x2b02('0x12')][_0x2b02('0x13')]===0x1f4){logger[_0x2b02('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x8a5a44,_0x29c6a5['error'][_0x2b02('0x14')]);return _0x57bebe(_0x29c6a5['error']['message']);}logger[_0x2b02('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x8a5a44,_0x29c6a5['error'][_0x2b02('0x14')]);return _0x19e62e(_0x29c6a5[_0x2b02('0x12')][_0x2b02('0x14')]);}else{logger[_0x2b02('0xc')](_0x2b02('0xd'),_0x8a5a44,'request\x20sent');_0x19e62e(_0x29c6a5[_0x2b02('0x15')][_0x2b02('0x14')]);}})['catch'](function(_0x208ba9){logger['error'](_0x2b02('0xd'),_0x8a5a44,_0x208ba9);_0x57bebe(_0x208ba9);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7b7f5aa..3f6d7fc 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 _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 +var _0x4480=['update','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getSessions','30s','getSummary','post','create','/:id/clone','clone'];(function(_0xda753c,_0x19af58){var _0x557f55=function(_0x236ac6){while(--_0x236ac6){_0xda753c['push'](_0xda753c['shift']());}};_0x557f55(++_0x19af58);}(_0x4480,0x80));var _0x0448=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x4480[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0448('0x0'));var timeout=require('connect-timeout');var express=require(_0x0448('0x1'));var router=express[_0x0448('0x2')]();var auth=require(_0x0448('0x3'));var interaction=require(_0x0448('0x4'));var config=require(_0x0448('0x5'));var controller=require(_0x0448('0x6'));router['get']('/',auth[_0x0448('0x7')](),controller[_0x0448('0x8')]);router[_0x0448('0x9')](_0x0448('0xa'),auth[_0x0448('0x7')](),controller[_0x0448('0xb')]);router['get']('/:id/sessions',auth[_0x0448('0x7')](),controller[_0x0448('0xc')]);router[_0x0448('0x9')]('/:id/answers',auth[_0x0448('0x7')](),controller['getAnswers']);router[_0x0448('0x9')]('/:id/summary',auth[_0x0448('0x7')](),timeout(_0x0448('0xd')),controller[_0x0448('0xe')]);router[_0x0448('0xf')]('/',auth[_0x0448('0x7')](),controller[_0x0448('0x10')]);router[_0x0448('0xf')](_0x0448('0x11'),auth[_0x0448('0x7')](),controller[_0x0448('0x12')]);router['put'](_0x0448('0xa'),auth['isAuthenticated'](),controller[_0x0448('0x13')]);router['delete'](_0x0448('0xa'),auth[_0x0448('0x7')](),controller[_0x0448('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e8432b5..cecc649 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 _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 +var _0xa534=['lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x53f23d,_0x104326){var _0x37ca04=function(_0x3fa06c){while(--_0x3fa06c){_0x53f23d['push'](_0x53f23d['shift']());}};_0x37ca04(++_0x104326);}(_0xa534,0xa4));var _0x4a53=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa534[_0x2d2c16];return _0x53f2fb;};'use strict';var Sequelize=require(_0x4a53('0x0'));var _=require(_0x4a53('0x1'));var util=require('util');module[_0x4a53('0x2')]={'name':{'type':Sequelize[_0x4a53('0x3')],'unique':_0x4a53('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4a53('0x5')](_0x4a53('0x6')),'set':function(_0x315df9){if(_[_0x4a53('0x7')](_0x315df9)){this[_0x4a53('0x8')](_0x4a53('0x9'),JSON[_0x4a53('0xa')](_0x315df9));}else if(_['isString'](_0x315df9)){this[_0x4a53('0x8')](_0x4a53('0x9'),_0x315df9);}else{this[_0x4a53('0x8')](_0x4a53('0x9'),util['format'](_0x4a53('0xb'),this[_0x4a53('0xc')](_0x4a53('0x4'))||'',this[_0x4a53('0xc')](_0x4a53('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4a53('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4a53('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 e5eb0fd..b19a52d 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 _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 +var _0xc274=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','user','UserProfileSection','findOne','JscriptySessionReport','pick','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird'];(function(_0xbd9bf4,_0x518d00){var _0x444e8b=function(_0x24f883){while(--_0x24f883){_0xbd9bf4['push'](_0xbd9bf4['shift']());}};_0x444e8b(++_0x518d00);}(_0xc274,0x15b));var _0x4c27=function(_0x5a2490,_0x1ac0b5){_0x5a2490=_0x5a2490-0x0;var _0x368faa=_0xc274[_0x5a2490];return _0x368faa;};'use strict';var pdf=require(_0x4c27('0x0'));var emlformat=require(_0x4c27('0x1'));var rimraf=require(_0x4c27('0x2'));var zipdir=require(_0x4c27('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c27('0x4'));var moment=require(_0x4c27('0x5'));var BPromise=require(_0x4c27('0x6'));var Mustache=require(_0x4c27('0x7'));var util=require(_0x4c27('0x8'));var path=require(_0x4c27('0x9'));var sox=require(_0x4c27('0xa'));var csv=require(_0x4c27('0xb'));var ejs=require(_0x4c27('0xc'));var fs=require('fs');var _=require(_0x4c27('0xd'));var squel=require('squel');var crypto=require(_0x4c27('0xe'));var jsforce=require(_0x4c27('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x4c27('0xb'));var querystring=require(_0x4c27('0x10'));var Papa=require(_0x4c27('0x11'));var Redis=require('ioredis');var authService=require(_0x4c27('0x12'));var qs=require(_0x4c27('0x13'));var as=require(_0x4c27('0x14'));var hardwareService=require(_0x4c27('0x15'));var logger=require(_0x4c27('0x16'))(_0x4c27('0x17'));var utils=require(_0x4c27('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4c27('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc19b,_0x41970d){_0x41970d=_0x41970d||0xcc;return function(_0x5ed156){if(_0x5ed156){return _0x3cc19b[_0x4c27('0x1a')](_0x41970d);}return _0x3cc19b['status'](_0x41970d)[_0x4c27('0x1b')]();};}function respondWithResult(_0x61efe9,_0x5c6d03){_0x5c6d03=_0x5c6d03||0xc8;return function(_0x2eff4e){if(_0x2eff4e){return _0x61efe9[_0x4c27('0x1c')](_0x5c6d03)[_0x4c27('0x1d')](_0x2eff4e);}};}function respondWithFilteredResult(_0x23b355,_0x2135c5){return function(_0xfc2316){if(_0xfc2316){var _0x55ffda=_0xfc2316[_0x4c27('0x1e')],_0x45ce88=_0x2135c5[_0x4c27('0x1f')],_0x446dbc=_0x2135c5[_0x4c27('0x1f')]+_0x2135c5[_0x4c27('0x20')],_0x562147;if(_0x446dbc>=_0x55ffda){_0x446dbc=_0x55ffda;_0x562147=0xc8;}else{_0x562147=0xce;}_0x23b355[_0x4c27('0x1c')](_0x562147);return _0x23b355[_0x4c27('0x21')](_0x4c27('0x22'),_0x45ce88+'-'+_0x446dbc+'/'+_0x55ffda)[_0x4c27('0x1d')](_0xfc2316);}return null;};}function patchUpdates(_0x13459d){return function(_0x538c40){try{jsonpatch['apply'](_0x538c40,_0x13459d,!![]);}catch(_0x2aa8f9){return BPromise[_0x4c27('0x23')](_0x2aa8f9);}return _0x538c40['save']();};}function saveUpdates(_0x5662da,_0x53bf40){return function(_0x4254ed){if(_0x4254ed){return _0x4254ed[_0x4c27('0x24')](_0x5662da)[_0x4c27('0x25')](function(_0x585b20){return _0x585b20;});}return null;};}function removeEntity(_0x23cfc5,_0x558cef){return function(_0x5f3ce5){if(_0x5f3ce5){return _0x5f3ce5[_0x4c27('0x26')]()[_0x4c27('0x25')](function(){var _0x2d3f60=_0x5f3ce5[_0x4c27('0x27')]({'plain':!![]});var _0x379566=_0x4c27('0x28');return db[_0x4c27('0x29')][_0x4c27('0x26')]({'where':{'type':_0x379566,'resourceId':_0x2d3f60['id']}})[_0x4c27('0x25')](function(){return _0x5f3ce5;});})[_0x4c27('0x25')](function(){_0x23cfc5[_0x4c27('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fd87b,_0x498a11){return function(_0x1e8bc0){if(!_0x1e8bc0){_0x4fd87b[_0x4c27('0x1a')](0x194);}return _0x1e8bc0;};}function handleError(_0x59cdee,_0x13e5b4){_0x13e5b4=_0x13e5b4||0x1f4;return function(_0xd747a8){logger[_0x4c27('0x2a')](_0xd747a8[_0x4c27('0x2b')]);if(_0xd747a8[_0x4c27('0x2c')]){delete _0xd747a8[_0x4c27('0x2c')];}_0x59cdee[_0x4c27('0x1c')](_0x13e5b4)['send'](_0xd747a8);};}exports[_0x4c27('0x2d')]=function(_0xf4d4dd,_0xb6361b){var _0x1fd858={},_0x57c09={},_0x185513={'count':0x0,'rows':[]};var _0x24d318=_[_0x4c27('0x2e')](db['JscriptyProject'][_0x4c27('0x2f')],function(_0x3b3e45){return{'name':_0x3b3e45[_0x4c27('0x30')],'type':_0x3b3e45[_0x4c27('0x31')][_0x4c27('0x32')]};});_0x57c09[_0x4c27('0x33')]=_['map'](_0x24d318,_0x4c27('0x2c'));_0x57c09[_0x4c27('0x34')]=_[_0x4c27('0x35')](_0xf4d4dd[_0x4c27('0x34')]);_0x57c09['filters']=_[_0x4c27('0x36')](_0x57c09['model'],_0x57c09[_0x4c27('0x34')]);_0x1fd858[_0x4c27('0x37')]=_[_0x4c27('0x36')](_0x57c09['model'],qs[_0x4c27('0x38')](_0xf4d4dd[_0x4c27('0x34')]['fields']));_0x1fd858[_0x4c27('0x37')]=_0x1fd858[_0x4c27('0x37')][_0x4c27('0x39')]?_0x1fd858[_0x4c27('0x37')]:_0x57c09[_0x4c27('0x33')];if(!_0xf4d4dd[_0x4c27('0x34')][_0x4c27('0x3a')](_0x4c27('0x3b'))){_0x1fd858[_0x4c27('0x20')]=qs[_0x4c27('0x20')](_0xf4d4dd[_0x4c27('0x34')]['limit']);_0x1fd858[_0x4c27('0x1f')]=qs[_0x4c27('0x1f')](_0xf4d4dd[_0x4c27('0x34')][_0x4c27('0x1f')]);}_0x1fd858[_0x4c27('0x3c')]=qs[_0x4c27('0x3d')](_0xf4d4dd[_0x4c27('0x34')][_0x4c27('0x3d')]);_0x1fd858[_0x4c27('0x3e')]=qs[_0x4c27('0x3f')](_['pick'](_0xf4d4dd['query'],_0x57c09['filters']),_0x24d318);if(_0xf4d4dd['query'][_0x4c27('0x40')]){_0x1fd858[_0x4c27('0x3e')]=_[_0x4c27('0x41')](_0x1fd858['where'],{'$or':_['map'](_0x24d318,function(_0x209a04){if(_0x209a04[_0x4c27('0x31')]!==_0x4c27('0x42')){var _0x4f2b7d={};_0x4f2b7d[_0x209a04[_0x4c27('0x2c')]]={'$like':'%'+_0xf4d4dd[_0x4c27('0x34')][_0x4c27('0x40')]+'%'};return _0x4f2b7d;}})});}_0x1fd858=_[_0x4c27('0x41')]({},_0x1fd858,_0xf4d4dd['options']);var _0x2c1c4c={'where':_0x1fd858['where']};return db[_0x4c27('0x43')][_0x4c27('0x1e')](_0x2c1c4c)[_0x4c27('0x25')](function(_0x475a0c){_0x185513[_0x4c27('0x1e')]=_0x475a0c;if(_0xf4d4dd[_0x4c27('0x34')][_0x4c27('0x44')]){_0x1fd858[_0x4c27('0x45')]=[{'all':!![]}];}return db[_0x4c27('0x43')][_0x4c27('0x46')](_0x1fd858);})[_0x4c27('0x25')](function(_0x302392){_0x185513[_0x4c27('0x47')]=_0x302392;return _0x185513;})['then'](respondWithFilteredResult(_0xb6361b,_0x1fd858))[_0x4c27('0x48')](handleError(_0xb6361b,null));};exports[_0x4c27('0x49')]=function(_0x3f48dd,_0x4a5ff4){var _0x50ca4f={'raw':![],'where':{'id':_0x3f48dd[_0x4c27('0x4a')]['id']}},_0x5c7fe5={};_0x5c7fe5[_0x4c27('0x33')]=_[_0x4c27('0x35')](db['JscriptyProject'][_0x4c27('0x2f')]);_0x5c7fe5[_0x4c27('0x34')]=_['keys'](_0x3f48dd[_0x4c27('0x34')]);_0x5c7fe5[_0x4c27('0x3f')]=_[_0x4c27('0x36')](_0x5c7fe5['model'],_0x5c7fe5[_0x4c27('0x34')]);_0x50ca4f[_0x4c27('0x37')]=_['intersection'](_0x5c7fe5['model'],qs[_0x4c27('0x38')](_0x3f48dd[_0x4c27('0x34')]['fields']));_0x50ca4f[_0x4c27('0x37')]=_0x50ca4f[_0x4c27('0x37')]['length']?_0x50ca4f[_0x4c27('0x37')]:_0x5c7fe5[_0x4c27('0x33')];if(_0x3f48dd['query'][_0x4c27('0x44')]){_0x50ca4f[_0x4c27('0x45')]=[{'all':!![]}];}_0x50ca4f=_[_0x4c27('0x41')]({},_0x50ca4f,_0x3f48dd[_0x4c27('0x4b')]);return db[_0x4c27('0x43')][_0x4c27('0x4c')](_0x50ca4f)[_0x4c27('0x25')](handleEntityNotFound(_0x4a5ff4,null))['then'](respondWithResult(_0x4a5ff4,null))['catch'](handleError(_0x4a5ff4,null));};exports[_0x4c27('0x4d')]=function(_0x483051,_0x23ccd7){return db[_0x4c27('0x43')][_0x4c27('0x4d')](_0x483051[_0x4c27('0x4e')],{})[_0x4c27('0x25')](function(_0x61b2b9){var _0x5023ce=_0x483051['user']['get']({'plain':!![]});if(!_0x5023ce)throw new Error(_0x4c27('0x4f'));if(_0x5023ce[_0x4c27('0x50')]==='user'){var _0x36dae5=_0x61b2b9[_0x4c27('0x27')]({'plain':!![]});var _0xe0d4d2='Projects';return db['UserProfileSection'][_0x4c27('0x4c')]({'where':{'name':_0xe0d4d2,'userProfileId':_0x5023ce[_0x4c27('0x51')]},'raw':!![]})[_0x4c27('0x25')](function(_0x2a5b91){if(_0x2a5b91&&_0x2a5b91[_0x4c27('0x52')]===0x0){return db[_0x4c27('0x29')][_0x4c27('0x4d')]({'name':_0x36dae5[_0x4c27('0x2c')],'resourceId':_0x36dae5['id'],'type':_0x2a5b91['name'],'sectionId':_0x2a5b91['id']},{})[_0x4c27('0x25')](function(){return _0x61b2b9;});}else{return _0x61b2b9;}})[_0x4c27('0x48')](function(_0x427c56){logger[_0x4c27('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x427c56);throw _0x427c56;});}return _0x61b2b9;})[_0x4c27('0x25')](respondWithResult(_0x23ccd7,0xc9))[_0x4c27('0x48')](handleError(_0x23ccd7,null));};exports[_0x4c27('0x53')]=function(_0x3ac9f1,_0x3a10a8){var _0x24429b={'where':{'id':_0x3ac9f1[_0x4c27('0x4a')]['id']}},_0x458f53={};_0x458f53[_0x4c27('0x33')]=_[_0x4c27('0x35')](db[_0x4c27('0x43')][_0x4c27('0x2f')]);_0x24429b['attributes']=_[_0x4c27('0x36')](_0x458f53[_0x4c27('0x33')],qs['fields'](_0x3ac9f1[_0x4c27('0x34')][_0x4c27('0x38')]));_0x24429b['attributes']=_0x24429b[_0x4c27('0x37')][_0x4c27('0x39')]?_0x24429b[_0x4c27('0x37')]:_0x458f53[_0x4c27('0x33')];if(_0x3ac9f1[_0x4c27('0x34')]['includeAll']){_0x24429b[_0x4c27('0x45')]=[{'all':!![]}];}_0x24429b=_['merge']({},_0x24429b,_0x3ac9f1[_0x4c27('0x4b')]);return db[_0x4c27('0x43')][_0x4c27('0x4c')](_0x24429b)[_0x4c27('0x25')](handleEntityNotFound(_0x3a10a8,null))[_0x4c27('0x25')](function(_0x21f224){if(_0x21f224){var _0x191e1e=_0x21f224[_0x4c27('0x27')]({'plain':!![]});_0x191e1e=qs['omit'](_0x191e1e,['id',_0x4c27('0x54'),_0x4c27('0x55')]);_0x3ac9f1['body']=_[_0x4c27('0x56')](_0x3ac9f1[_0x4c27('0x4e')],['id','createdAt',_0x4c27('0x55')]);return db[_0x4c27('0x43')][_0x4c27('0x4d')](_[_0x4c27('0x41')](_0x191e1e,_0x3ac9f1[_0x4c27('0x4e')]),{'include':_0x3ac9f1['query'][_0x4c27('0x44')]?[{'all':!![]}]:undefined})[_0x4c27('0x25')](function(_0x51de63){var _0xf183f=_0x3ac9f1[_0x4c27('0x57')][_0x4c27('0x27')]({'plain':!![]});if(!_0xf183f)throw new Error(_0x4c27('0x4f'));if(_0xf183f['role']===_0x4c27('0x57')){var _0x1b6b84=_0x51de63[_0x4c27('0x27')]({'plain':!![]});var _0x287a5d=_0x4c27('0x28');return db[_0x4c27('0x58')][_0x4c27('0x4c')]({'where':{'name':_0x287a5d,'userProfileId':_0xf183f[_0x4c27('0x51')]},'raw':!![]})['then'](function(_0x6c30f2){if(_0x6c30f2&&_0x6c30f2[_0x4c27('0x52')]===0x0){return db[_0x4c27('0x29')][_0x4c27('0x4d')]({'name':_0x1b6b84[_0x4c27('0x2c')],'resourceId':_0x1b6b84['id'],'type':_0x6c30f2['name'],'sectionId':_0x6c30f2['id']},{})[_0x4c27('0x25')](function(){return _0x51de63;});}else{return _0x51de63;}})[_0x4c27('0x48')](function(_0x26b6b5){logger[_0x4c27('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26b6b5);throw _0x26b6b5;});}return _0x51de63;});}})[_0x4c27('0x25')](respondWithResult(_0x3a10a8,0xc9))['catch'](handleError(_0x3a10a8,null));};exports[_0x4c27('0x24')]=function(_0x367234,_0x2e2614){if(_0x367234[_0x4c27('0x4e')]['id']){delete _0x367234['body']['id'];}return db[_0x4c27('0x43')][_0x4c27('0x4c')]({'where':{'id':_0x367234['params']['id']}})['then'](handleEntityNotFound(_0x2e2614,null))[_0x4c27('0x25')](saveUpdates(_0x367234[_0x4c27('0x4e')],null))[_0x4c27('0x25')](respondWithResult(_0x2e2614,null))[_0x4c27('0x48')](handleError(_0x2e2614,null));};exports[_0x4c27('0x26')]=function(_0x48cc99,_0x3c80d8){return db['JscriptyProject'][_0x4c27('0x4c')]({'where':{'id':_0x48cc99[_0x4c27('0x4a')]['id']}})[_0x4c27('0x25')](handleEntityNotFound(_0x3c80d8,null))['then'](removeEntity(_0x3c80d8,null))[_0x4c27('0x48')](handleError(_0x3c80d8,null));};exports['getSessions']=function(_0x287078,_0x343a75,_0x17a732){var _0x16b8f1={'raw':!![],'where':{}};var _0x5ed24b={};var _0x2eee48={'count':0x0,'rows':[]};return db[_0x4c27('0x43')][_0x4c27('0x59')]({'where':{'id':_0x287078[_0x4c27('0x4a')]['id']}})[_0x4c27('0x25')](handleEntityNotFound(_0x343a75,null))[_0x4c27('0x25')](function(_0x49ade0){if(_0x49ade0){_0x5ed24b[_0x4c27('0x33')]=_['keys'](db[_0x4c27('0x5a')]['rawAttributes']);_0x5ed24b[_0x4c27('0x34')]=_[_0x4c27('0x35')](_0x287078[_0x4c27('0x34')]);_0x5ed24b['filters']=_[_0x4c27('0x36')](_0x5ed24b[_0x4c27('0x33')],_0x5ed24b[_0x4c27('0x34')]);_0x16b8f1[_0x4c27('0x37')]=_[_0x4c27('0x36')](_0x5ed24b[_0x4c27('0x33')],qs[_0x4c27('0x38')](_0x287078[_0x4c27('0x34')]['fields']));_0x16b8f1[_0x4c27('0x37')]=_0x16b8f1[_0x4c27('0x37')][_0x4c27('0x39')]?_0x16b8f1[_0x4c27('0x37')]:_0x5ed24b['model'];if(!_0x287078[_0x4c27('0x34')][_0x4c27('0x3a')](_0x4c27('0x3b'))){_0x16b8f1[_0x4c27('0x20')]=qs[_0x4c27('0x20')](_0x287078['query'][_0x4c27('0x20')]);_0x16b8f1['offset']=qs[_0x4c27('0x1f')](_0x287078['query'][_0x4c27('0x1f')]);}_0x16b8f1['order']=qs['sort'](_0x287078[_0x4c27('0x34')][_0x4c27('0x3d')]);_0x16b8f1[_0x4c27('0x3e')]=qs[_0x4c27('0x3f')](_[_0x4c27('0x5b')](_0x287078['query'],_0x5ed24b[_0x4c27('0x3f')]));_0x16b8f1[_0x4c27('0x3e')][_0x4c27('0x5c')]=_0x49ade0['id'];if(_0x287078[_0x4c27('0x34')][_0x4c27('0x40')]){_0x16b8f1[_0x4c27('0x3e')]=_['merge'](_0x16b8f1[_0x4c27('0x3e')],{'$or':_['map'](_0x16b8f1['attributes'],function(_0x5f12e5){var _0x47aa70={};_0x47aa70[_0x5f12e5]={'$like':'%'+_0x287078[_0x4c27('0x34')]['filter']+'%'};return _0x47aa70;})});}_0x16b8f1=_[_0x4c27('0x41')]({},_0x16b8f1,_0x287078[_0x4c27('0x4b')]);return db[_0x4c27('0x5a')][_0x4c27('0x1e')]({'where':_0x16b8f1['where']})[_0x4c27('0x25')](function(_0x5cd5f3){_0x2eee48[_0x4c27('0x1e')]=_0x5cd5f3;if(_0x287078[_0x4c27('0x34')][_0x4c27('0x44')]){_0x16b8f1[_0x4c27('0x45')]=[{'all':!![]}];}return db[_0x4c27('0x5a')]['findAll'](_0x16b8f1);})['then'](function(_0x4df23d){_0x2eee48[_0x4c27('0x47')]=_0x4df23d;return _0x2eee48;});}})[_0x4c27('0x25')](respondWithFilteredResult(_0x343a75,_0x16b8f1))[_0x4c27('0x48')](handleError(_0x343a75,null));};exports['getAnswers']=function(_0x400725,_0x4a389c,_0x534a52){var _0x4d1a3a={'raw':!![],'where':{}};var _0x27bf58={};var _0x52539b={'count':0x0,'rows':[]};return db[_0x4c27('0x43')]['findOne']({'where':{'id':_0x400725[_0x4c27('0x4a')]['id']}})[_0x4c27('0x25')](handleEntityNotFound(_0x4a389c,null))['then'](function(_0x586782){if(_0x586782){_0x27bf58[_0x4c27('0x33')]=_[_0x4c27('0x35')](db[_0x4c27('0x5d')][_0x4c27('0x2f')]);_0x27bf58[_0x4c27('0x34')]=_[_0x4c27('0x35')](_0x400725['query']);_0x27bf58['filters']=_['intersection'](_0x27bf58['model'],_0x27bf58[_0x4c27('0x34')]);_0x4d1a3a[_0x4c27('0x37')]=_[_0x4c27('0x36')](_0x27bf58[_0x4c27('0x33')],qs['fields'](_0x400725[_0x4c27('0x34')][_0x4c27('0x38')]));_0x4d1a3a[_0x4c27('0x37')]=_0x4d1a3a['attributes']['length']?_0x4d1a3a[_0x4c27('0x37')]:_0x27bf58['model'];if(!_0x400725['query'][_0x4c27('0x3a')](_0x4c27('0x3b'))){_0x4d1a3a['limit']=qs['limit'](_0x400725['query'][_0x4c27('0x20')]);_0x4d1a3a[_0x4c27('0x1f')]=qs[_0x4c27('0x1f')](_0x400725[_0x4c27('0x34')][_0x4c27('0x1f')]);}_0x4d1a3a['order']=qs[_0x4c27('0x3d')](_0x400725['query'][_0x4c27('0x3d')]);_0x4d1a3a[_0x4c27('0x3e')]=qs[_0x4c27('0x3f')](_[_0x4c27('0x5b')](_0x400725[_0x4c27('0x34')],_0x27bf58[_0x4c27('0x3f')]));_0x4d1a3a[_0x4c27('0x3e')]['ProjectId']=_0x586782['id'];if(_0x400725[_0x4c27('0x34')][_0x4c27('0x40')]){_0x4d1a3a[_0x4c27('0x3e')]=_[_0x4c27('0x41')](_0x4d1a3a['where'],{'$or':_[_0x4c27('0x2e')](_0x4d1a3a[_0x4c27('0x37')],function(_0x1c0d86){var _0x54ac5a={};_0x54ac5a[_0x1c0d86]={'$like':'%'+_0x400725[_0x4c27('0x34')][_0x4c27('0x40')]+'%'};return _0x54ac5a;})});}_0x4d1a3a=_['merge']({},_0x4d1a3a,_0x400725[_0x4c27('0x4b')]);return db[_0x4c27('0x5d')][_0x4c27('0x1e')]({'where':_0x4d1a3a[_0x4c27('0x3e')]})[_0x4c27('0x25')](function(_0x3ada5d){_0x52539b[_0x4c27('0x1e')]=_0x3ada5d;if(_0x400725[_0x4c27('0x34')][_0x4c27('0x44')]){_0x4d1a3a['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x4c27('0x46')](_0x4d1a3a);})[_0x4c27('0x25')](function(_0x107ea3){_0x52539b[_0x4c27('0x47')]=_0x107ea3;return _0x52539b;});}})['then'](respondWithFilteredResult(_0x4a389c,_0x4d1a3a))[_0x4c27('0x48')](handleError(_0x4a389c,null));};function char(_0x2239ab){return _0x4c27('0x5e')===typeof _0x2239ab?String[_0x4c27('0x5f')]['apply'](null,arguments):_0x2239ab;}function needsEncapsulation(_0x678991){return!!_0x678991&&(_0x678991[_0x4c27('0x60')]()[_0x4c27('0x61')](char(0xd))>=0x0||_0x678991[_0x4c27('0x60')]()[_0x4c27('0x61')](char(0xa))>=0x0||_0x678991[_0x4c27('0x60')]()[_0x4c27('0x61')](char(0x2c))>=0x0||_0x678991[_0x4c27('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x256a17){var _0x199d35=char(0x22),_0x33ccb0='\x5c'+char(0x22),_0x49f95c=_0x256a17[_0x4c27('0x60')]()[_0x4c27('0x62')](new RegExp(_0x199d35,'g'),_0x33ccb0);return _0x199d35+_0x49f95c+_0x199d35;}exports['getSummary']=function(_0x2d6a56,_0x6b9a98,_0x3261df){var _0x1bf53b,_0x49c76b;var _0x6762ed={'where':{'ProjectId':_0x2d6a56[_0x4c27('0x4a')]['id']}};if(_0x2d6a56[_0x4c27('0x34')][_0x4c27('0x63')]){_0x6762ed[_0x4c27('0x3e')][_0x4c27('0x64')]=JSON[_0x4c27('0x65')](_0x2d6a56['query']['startTime']);}return db[_0x4c27('0x5a')][_0x4c27('0x46')](_0x6762ed)[_0x4c27('0x25')](handleEntityNotFound(_0x6b9a98,null))[_0x4c27('0x25')](function(_0x4771a2){if(_0x4771a2){_0x1bf53b=_0x4771a2;return db['JscriptyQuestionReport'][_0x4c27('0x46')]({'where':{'SessionId':{'$in':_['map'](_0x1bf53b,'id')},'ProjectId':_0x2d6a56[_0x4c27('0x4a')]['id']},'order':_0x4c27('0x66')});}})[_0x4c27('0x25')](handleEntityNotFound(_0x6b9a98,null))['then'](function(_0xbdb4b6){if(_0xbdb4b6){_0x49c76b=_0xbdb4b6;var _0x292943={};for(var _0x2f5e8c=0x0,_0x64f65=_0x49c76b[_0x4c27('0x39')];_0x2f5e8c<_0x64f65;_0x2f5e8c++){if(!_0x292943[_0x4c27('0x3a')](_0x49c76b[_0x2f5e8c][_0x4c27('0x67')])){_0x292943[_0x49c76b[_0x2f5e8c]['questionId']]=needsEncapsulation(_0x49c76b[_0x2f5e8c][_0x4c27('0x68')])?encapsulate(_0x49c76b[_0x2f5e8c][_0x4c27('0x68')]):_0x49c76b[_0x2f5e8c][_0x4c27('0x68')];}}var _0x19ed7e=[],_0xc02d12={};for(var _0x2276c5=0x0,_0xb3c05d=_0x1bf53b[_0x4c27('0x39')];_0x2276c5<_0xb3c05d;_0x2276c5++){_0xc02d12={'ProjectId':_0x2d6a56[_0x4c27('0x4a')]['id'],'SessionId':_0x1bf53b[_0x2276c5]['id'],'StartTime':moment(_0x1bf53b[_0x2276c5][_0x4c27('0x64')])[_0x4c27('0x69')](_0x4c27('0x6a'))};for(var _0x613730=0x0,_0xc27a33=_0x49c76b[_0x4c27('0x39')];_0x613730<_0xc27a33;_0x613730++){if(_0x49c76b[_0x613730][_0x4c27('0x6b')]==_0x1bf53b[_0x2276c5]['id']&&_0x292943['hasOwnProperty'](_0x49c76b[_0x613730][_0x4c27('0x67')])){_0xc02d12[_0x292943[_0x49c76b[_0x613730][_0x4c27('0x67')]]]=_0x49c76b[_0x613730][_0x4c27('0x6c')];}}for(var _0xa0c48d in _0x292943){if(!_0xc02d12[_0x4c27('0x3a')](_0x292943[_0xa0c48d])){_0xc02d12[_0x292943[_0xa0c48d]]=null;}}_0x19ed7e[_0x4c27('0x6d')](_0xc02d12);}return _0x19ed7e;}})[_0x4c27('0x25')](function(_0x49ca99){if(!_[_0x4c27('0x6e')](_0x49ca99)){var _0x55d35f=toCsv(_0x49ca99);var _0x1b55f5=Date[_0x4c27('0x6f')]();fs[_0x4c27('0x70')](util[_0x4c27('0x69')](_0x4c27('0x71'),_0x2d6a56[_0x4c27('0x4a')]['id'],_0x1b55f5),_0x55d35f);_0x6b9a98[_0x4c27('0x72')]('Content-disposition',_0x4c27('0x73')+util['format'](_0x4c27('0x74'),_0x2d6a56[_0x4c27('0x4a')]['id'],_0x1b55f5));_0x6b9a98['setHeader']('Content-type','text/csv');return _0x6b9a98[_0x4c27('0x75')](util['format'](_0x4c27('0x71'),_0x2d6a56[_0x4c27('0x4a')]['id'],_0x1b55f5));}else{return _0x6b9a98[_0x4c27('0x1a')](0xcc);}})[_0x4c27('0x48')](handleError(_0x6b9a98,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index ad49b34..bb0ffdc 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 _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 +var _0xe1b9=['bluebird','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0xe1b9,0x68));var _0x9e1b=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xe1b9[_0x344a3f];return _0x264712;};'use strict';var _=require('lodash');var util=require(_0x9e1b('0x0'));var logger=require(_0x9e1b('0x1'))(_0x9e1b('0x2'));var moment=require(_0x9e1b('0x3'));var BPromise=require(_0x9e1b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e1b('0x5'));var rimraf=require(_0x9e1b('0x6'));var config=require(_0x9e1b('0x7'));var attributes=require(_0x9e1b('0x8'));module[_0x9e1b('0x9')]=function(_0x464401,_0x4d1b57){return _0x464401['define'](_0x9e1b('0xa'),attributes,{'tableName':_0x9e1b('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 5fead25..3a6b4da 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 _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 +var _0x7c7c=['then','info','JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c7c,0x186));var _0xc7c7=function(_0x1789c0,_0x269207){_0x1789c0=_0x1789c0-0x0;var _0x4f6ffa=_0x7c7c[_0x1789c0];return _0x4f6ffa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc7c7('0x0'));var BPromise=require(_0xc7c7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7c7('0x2'));var db=require(_0xc7c7('0x3'))['db'];var utils=require(_0xc7c7('0x4'));var logger=require(_0xc7c7('0x5'))(_0xc7c7('0x6'));var config=require(_0xc7c7('0x7'));var jayson=require(_0xc7c7('0x8'));var client=jayson['client'][_0xc7c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x22aac6,_0x3200de,_0x40b5f4){return new BPromise(function(_0x1ad156,_0x1d9f6e){return client['request'](_0x22aac6,_0x40b5f4)[_0xc7c7('0xa')](function(_0x4ea044){logger[_0xc7c7('0xb')](_0xc7c7('0xc'),_0x3200de,'request\x20sent');logger[_0xc7c7('0xd')](_0xc7c7('0xe'),_0x3200de,'request\x20sent',JSON[_0xc7c7('0xf')](_0x4ea044));if(_0x4ea044[_0xc7c7('0x10')]){if(_0x4ea044['error']['code']===0x1f4){logger[_0xc7c7('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x3200de,_0x4ea044['error'][_0xc7c7('0x11')]);return _0x1d9f6e(_0x4ea044['error'][_0xc7c7('0x11')]);}logger[_0xc7c7('0x10')](_0xc7c7('0xc'),_0x3200de,_0x4ea044[_0xc7c7('0x10')][_0xc7c7('0x11')]);return _0x1ad156(_0x4ea044[_0xc7c7('0x10')]['message']);}else{logger[_0xc7c7('0xb')](_0xc7c7('0xc'),_0x3200de,'request\x20sent');_0x1ad156(_0x4ea044[_0xc7c7('0x12')][_0xc7c7('0x11')]);}})[_0xc7c7('0x13')](function(_0x403773){logger[_0xc7c7('0x10')](_0xc7c7('0xc'),_0x3200de,_0x403773);_0x1d9f6e(_0x403773);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 9d8cc9c..9ebd9c9 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 _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 +var _0x60ca=['create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x9729d7,_0x1b79a8){var _0x3c4ac6=function(_0x401ba6){while(--_0x401ba6){_0x9729d7['push'](_0x9729d7['shift']());}};_0x3c4ac6(++_0x1b79a8);}(_0x60ca,0x92));var _0xa60c=function(_0x2cd587,_0x51906c){_0x2cd587=_0x2cd587-0x0;var _0x2e2677=_0x60ca[_0x2cd587];return _0x2e2677;};'use strict';var multer=require(_0xa60c('0x0'));var util=require(_0xa60c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa60c('0x2'));var router=express[_0xa60c('0x3')]();var auth=require(_0xa60c('0x4'));var interaction=require(_0xa60c('0x5'));var config=require('../../config/environment');var controller=require(_0xa60c('0x6'));router[_0xa60c('0x7')]('/',auth[_0xa60c('0x8')](),controller[_0xa60c('0x9')]);router['get'](_0xa60c('0xa'),auth[_0xa60c('0x8')](),controller['describe']);router['get'](_0xa60c('0xb'),auth[_0xa60c('0x8')](),controller[_0xa60c('0xc')]);router[_0xa60c('0xd')]('/',auth[_0xa60c('0x8')](),controller[_0xa60c('0xe')]);router[_0xa60c('0xf')](_0xa60c('0xb'),auth['isAuthenticated'](),controller[_0xa60c('0x10')]);router[_0xa60c('0x11')](_0xa60c('0xb'),auth[_0xa60c('0x8')](),controller[_0xa60c('0x12')]);module[_0xa60c('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 98c53db..1099620 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 _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 +var _0xe3d4=['exports','TEXT','STRING'];(function(_0x57e546,_0x33cef6){var _0x37efc0=function(_0x12dc1d){while(--_0x12dc1d){_0x57e546['push'](_0x57e546['shift']());}};_0x37efc0(++_0x33cef6);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x335201,_0x314d57){_0x335201=_0x335201-0x0;var _0x39b053=_0xe3d4[_0x335201];return _0x39b053;};'use strict';var Sequelize=require('sequelize');module[_0x4e3d('0x0')]={'question':{'type':Sequelize[_0x4e3d('0x1')]},'answer':{'type':Sequelize[_0x4e3d('0x1')]('long')},'membername':{'type':Sequelize[_0x4e3d('0x2')]},'projectname':{'type':Sequelize[_0x4e3d('0x2')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4e3d('0x2')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4e3d('0x2')]},'questionId':{'type':Sequelize[_0x4e3d('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 25238f3..403880c 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 _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 +var _0x7287=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','destroy','then','error','name','send','index','JscriptyQuestionReport','type','key','map','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x3c1296,_0x5bde2d){var _0x21ca75=function(_0x3dc7a7){while(--_0x3dc7a7){_0x3c1296['push'](_0x3c1296['shift']());}};_0x21ca75(++_0x5bde2d);}(_0x7287,0x7b));var _0x7728=function(_0x4517bc,_0x3ec207){_0x4517bc=_0x4517bc-0x0;var _0x3d09ea=_0x7287[_0x4517bc];return _0x3d09ea;};'use strict';var pdf=require(_0x7728('0x0'));var emlformat=require(_0x7728('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7728('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7728('0x3'));var moment=require(_0x7728('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7728('0x5'));var util=require(_0x7728('0x6'));var path=require(_0x7728('0x7'));var sox=require(_0x7728('0x8'));var csv=require(_0x7728('0x9'));var ejs=require(_0x7728('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7728('0xb'));var jsforce=require(_0x7728('0xc'));var deskjs=require(_0x7728('0xd'));var toCsv=require(_0x7728('0x9'));var querystring=require(_0x7728('0xe'));var Papa=require(_0x7728('0xf'));var Redis=require(_0x7728('0x10'));var authService=require(_0x7728('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7728('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7728('0x13'))(_0x7728('0x14'));var utils=require(_0x7728('0x15'));var config=require(_0x7728('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7728('0x17'))['db'];function respondWithStatusCode(_0x8ffaea,_0x5daf15){_0x5daf15=_0x5daf15||0xcc;return function(_0x439d99){if(_0x439d99){return _0x8ffaea[_0x7728('0x18')](_0x5daf15);}return _0x8ffaea[_0x7728('0x19')](_0x5daf15)[_0x7728('0x1a')]();};}function respondWithResult(_0x4d18cc,_0x9baa68){_0x9baa68=_0x9baa68||0xc8;return function(_0x4635b7){if(_0x4635b7){return _0x4d18cc['status'](_0x9baa68)[_0x7728('0x1b')](_0x4635b7);}};}function respondWithFilteredResult(_0x1c9f5b,_0x22a948){return function(_0xcdd2d4){if(_0xcdd2d4){var _0x5c8d11=_0xcdd2d4[_0x7728('0x1c')],_0x13214f=_0x22a948['offset'],_0x553036=_0x22a948[_0x7728('0x1d')]+_0x22a948[_0x7728('0x1e')],_0x1a713f;if(_0x553036>=_0x5c8d11){_0x553036=_0x5c8d11;_0x1a713f=0xc8;}else{_0x1a713f=0xce;}_0x1c9f5b[_0x7728('0x19')](_0x1a713f);return _0x1c9f5b[_0x7728('0x1f')]('Content-Range',_0x13214f+'-'+_0x553036+'/'+_0x5c8d11)[_0x7728('0x1b')](_0xcdd2d4);}return null;};}function patchUpdates(_0x4fbeff){return function(_0x9ea787){try{jsonpatch[_0x7728('0x20')](_0x9ea787,_0x4fbeff,!![]);}catch(_0x3063a4){return BPromise[_0x7728('0x21')](_0x3063a4);}return _0x9ea787['save']();};}function saveUpdates(_0x358f5d,_0x10dc1d){return function(_0x211f4d){if(_0x211f4d){return _0x211f4d[_0x7728('0x22')](_0x358f5d)['then'](function(_0x36c3d7){return _0x36c3d7;});}return null;};}function removeEntity(_0x2406c7,_0x1c2928){return function(_0x3bc9e6){if(_0x3bc9e6){return _0x3bc9e6[_0x7728('0x23')]()[_0x7728('0x24')](function(){_0x2406c7[_0x7728('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b112b,_0x1c37a2){return function(_0x21bdd6){if(!_0x21bdd6){_0x4b112b['sendStatus'](0x194);}return _0x21bdd6;};}function handleError(_0x3563f3,_0x1c1a96){_0x1c1a96=_0x1c1a96||0x1f4;return function(_0x59a4d7){logger[_0x7728('0x25')](_0x59a4d7['stack']);if(_0x59a4d7[_0x7728('0x26')]){delete _0x59a4d7[_0x7728('0x26')];}_0x3563f3[_0x7728('0x19')](_0x1c1a96)[_0x7728('0x27')](_0x59a4d7);};}exports[_0x7728('0x28')]=function(_0x436de9,_0x4cc889){var _0xd3fefa={},_0x143dda={},_0x37806c={'count':0x0,'rows':[]};var _0x5cf23c=_['map'](db[_0x7728('0x29')]['rawAttributes'],function(_0x32c01a){return{'name':_0x32c01a['fieldName'],'type':_0x32c01a[_0x7728('0x2a')][_0x7728('0x2b')]};});_0x143dda['model']=_[_0x7728('0x2c')](_0x5cf23c,_0x7728('0x26'));_0x143dda[_0x7728('0x2d')]=_['keys'](_0x436de9[_0x7728('0x2d')]);_0x143dda[_0x7728('0x2e')]=_[_0x7728('0x2f')](_0x143dda[_0x7728('0x30')],_0x143dda['query']);_0xd3fefa['attributes']=_['intersection'](_0x143dda['model'],qs['fields'](_0x436de9[_0x7728('0x2d')][_0x7728('0x31')]));_0xd3fefa['attributes']=_0xd3fefa['attributes'][_0x7728('0x32')]?_0xd3fefa[_0x7728('0x33')]:_0x143dda[_0x7728('0x30')];if(!_0x436de9['query'][_0x7728('0x34')]('nolimit')){_0xd3fefa[_0x7728('0x1e')]=qs[_0x7728('0x1e')](_0x436de9[_0x7728('0x2d')][_0x7728('0x1e')]);_0xd3fefa['offset']=qs[_0x7728('0x1d')](_0x436de9[_0x7728('0x2d')][_0x7728('0x1d')]);}_0xd3fefa['order']=qs[_0x7728('0x35')](_0x436de9[_0x7728('0x2d')][_0x7728('0x35')]);_0xd3fefa[_0x7728('0x36')]=qs[_0x7728('0x2e')](_[_0x7728('0x37')](_0x436de9['query'],_0x143dda[_0x7728('0x2e')]),_0x5cf23c);if(_0x436de9['query'][_0x7728('0x38')]){_0xd3fefa[_0x7728('0x36')]=_['merge'](_0xd3fefa['where'],{'$or':_[_0x7728('0x2c')](_0x5cf23c,function(_0x403ef6){if(_0x403ef6[_0x7728('0x2a')]!==_0x7728('0x39')){var _0x233958={};_0x233958[_0x403ef6[_0x7728('0x26')]]={'$like':'%'+_0x436de9['query'][_0x7728('0x38')]+'%'};return _0x233958;}})});}_0xd3fefa=_[_0x7728('0x3a')]({},_0xd3fefa,_0x436de9[_0x7728('0x3b')]);var _0x4daf0c={'where':_0xd3fefa[_0x7728('0x36')]};return db[_0x7728('0x29')][_0x7728('0x1c')](_0x4daf0c)[_0x7728('0x24')](function(_0x45a798){_0x37806c[_0x7728('0x1c')]=_0x45a798;if(_0x436de9[_0x7728('0x2d')][_0x7728('0x3c')]){_0xd3fefa['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x7728('0x3d')](_0xd3fefa);})[_0x7728('0x24')](function(_0x388c4e){_0x37806c[_0x7728('0x3e')]=_0x388c4e;return _0x37806c;})[_0x7728('0x24')](respondWithFilteredResult(_0x4cc889,_0xd3fefa))[_0x7728('0x3f')](handleError(_0x4cc889,null));};exports[_0x7728('0x40')]=function(_0xa27430,_0x21e091){var _0x365276={'raw':!![],'where':{'id':_0xa27430['params']['id']}},_0x27f029={};_0x27f029['model']=_[_0x7728('0x41')](db[_0x7728('0x29')][_0x7728('0x42')]);_0x27f029[_0x7728('0x2d')]=_[_0x7728('0x41')](_0xa27430[_0x7728('0x2d')]);_0x27f029[_0x7728('0x2e')]=_['intersection'](_0x27f029[_0x7728('0x30')],_0x27f029[_0x7728('0x2d')]);_0x365276['attributes']=_['intersection'](_0x27f029[_0x7728('0x30')],qs['fields'](_0xa27430['query'][_0x7728('0x31')]));_0x365276[_0x7728('0x33')]=_0x365276[_0x7728('0x33')][_0x7728('0x32')]?_0x365276['attributes']:_0x27f029['model'];if(_0xa27430[_0x7728('0x2d')][_0x7728('0x3c')]){_0x365276[_0x7728('0x43')]=[{'all':!![]}];}_0x365276=_[_0x7728('0x3a')]({},_0x365276,_0xa27430[_0x7728('0x3b')]);return db[_0x7728('0x29')][_0x7728('0x44')](_0x365276)[_0x7728('0x24')](handleEntityNotFound(_0x21e091,null))[_0x7728('0x24')](respondWithResult(_0x21e091,null))[_0x7728('0x3f')](handleError(_0x21e091,null));};exports['create']=function(_0x3a96b9,_0x50d4fa){return db[_0x7728('0x29')][_0x7728('0x45')](_0x3a96b9[_0x7728('0x46')],{})[_0x7728('0x24')](respondWithResult(_0x50d4fa,0xc9))[_0x7728('0x3f')](handleError(_0x50d4fa,null));};exports['update']=function(_0x27dcef,_0x14ff2a){if(_0x27dcef[_0x7728('0x46')]['id']){delete _0x27dcef[_0x7728('0x46')]['id'];}return db['JscriptyQuestionReport'][_0x7728('0x44')]({'where':{'id':_0x27dcef['params']['id']}})['then'](handleEntityNotFound(_0x14ff2a,null))['then'](saveUpdates(_0x27dcef[_0x7728('0x46')],null))[_0x7728('0x24')](respondWithResult(_0x14ff2a,null))[_0x7728('0x3f')](handleError(_0x14ff2a,null));};exports[_0x7728('0x23')]=function(_0x117f47,_0x5ec815){return db[_0x7728('0x29')]['find']({'where':{'id':_0x117f47['params']['id']}})['then'](handleEntityNotFound(_0x5ec815,null))[_0x7728('0x24')](removeEntity(_0x5ec815,null))['catch'](handleError(_0x5ec815,null));};exports['describe']=function(_0x29c649,_0x4661bb){return db['JscriptyQuestionReport'][_0x7728('0x47')]()[_0x7728('0x24')](respondWithResult(_0x4661bb,null))[_0x7728('0x3f')](handleError(_0x4661bb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 83ca916..c3d766d 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 _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 +var _0xda17=['path','../../config/environment','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x52dc3a,_0x3a43b5){var _0x3d8164=function(_0x1a6340){while(--_0x1a6340){_0x52dc3a['push'](_0x52dc3a['shift']());}};_0x3d8164(++_0x3a43b5);}(_0xda17,0x139));var _0x7da1=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xda17[_0x2b7764];return _0x848dcb;};'use strict';var _=require(_0x7da1('0x0'));var util=require(_0x7da1('0x1'));var logger=require(_0x7da1('0x2'))('api');var moment=require(_0x7da1('0x3'));var BPromise=require(_0x7da1('0x4'));var rp=require(_0x7da1('0x5'));var fs=require('fs');var path=require(_0x7da1('0x6'));var rimraf=require('rimraf');var config=require(_0x7da1('0x7'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0x7da1('0x8')]=function(_0x14205a,_0x18c8f4){return _0x14205a['define'](_0x7da1('0x9'),attributes,{'tableName':_0x7da1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index e4437db..19f3b59 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 _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 +var _0xc586=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x3f4d7f,_0x29dcfb){var _0x1a1e57=function(_0x195640){while(--_0x195640){_0x3f4d7f['push'](_0x3f4d7f['shift']());}};_0x1a1e57(++_0x29dcfb);}(_0xc586,0xfe));var _0x6c58=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc586[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x6c58('0x0'));var util=require(_0x6c58('0x1'));var moment=require(_0x6c58('0x2'));var BPromise=require(_0x6c58('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c58('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c58('0x5'));var logger=require(_0x6c58('0x6'))(_0x6c58('0x7'));var config=require(_0x6c58('0x8'));var jayson=require(_0x6c58('0x9'));var client=jayson[_0x6c58('0xa')][_0x6c58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcb3833,_0x376707,_0x10b5dc){return new BPromise(function(_0x38f2f5,_0x1030d8){return client[_0x6c58('0xc')](_0xcb3833,_0x10b5dc)[_0x6c58('0xd')](function(_0x573759){logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x376707,_0x6c58('0xe'));logger[_0x6c58('0xf')](_0x6c58('0x10'),_0x376707,_0x6c58('0xe'),JSON[_0x6c58('0x11')](_0x573759));if(_0x573759[_0x6c58('0x12')]){if(_0x573759[_0x6c58('0x12')][_0x6c58('0x13')]===0x1f4){logger[_0x6c58('0x12')](_0x6c58('0x14'),_0x376707,_0x573759['error'][_0x6c58('0x15')]);return _0x1030d8(_0x573759[_0x6c58('0x12')][_0x6c58('0x15')]);}logger[_0x6c58('0x12')](_0x6c58('0x14'),_0x376707,_0x573759[_0x6c58('0x12')][_0x6c58('0x15')]);return _0x38f2f5(_0x573759[_0x6c58('0x12')][_0x6c58('0x15')]);}else{logger[_0x6c58('0x16')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x376707,_0x6c58('0xe'));_0x38f2f5(_0x573759[_0x6c58('0x17')][_0x6c58('0x15')]);}})[_0x6c58('0x18')](function(_0x5451c6){logger[_0x6c58('0x12')](_0x6c58('0x14'),_0x376707,_0x5451c6);_0x1030d8(_0x5451c6);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 51c841a..5e89a92 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 _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 +var _0x56e6=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','multer','util','path'];(function(_0x5a2d1e,_0x18b7f5){var _0x5479df=function(_0xf6ba3){while(--_0xf6ba3){_0x5a2d1e['push'](_0x5a2d1e['shift']());}};_0x5479df(++_0x18b7f5);}(_0x56e6,0x6b));var _0x656e=function(_0x56543f,_0x5ccd60){_0x56543f=_0x56543f-0x0;var _0x37b066=_0x56e6[_0x56543f];return _0x37b066;};'use strict';var multer=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var path=require(_0x656e('0x2'));var timeout=require(_0x656e('0x3'));var express=require(_0x656e('0x4'));var router=express[_0x656e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x656e('0x6'));var config=require(_0x656e('0x7'));var controller=require(_0x656e('0x8'));router[_0x656e('0x9')]('/',auth[_0x656e('0xa')](),controller[_0x656e('0xb')]);router[_0x656e('0x9')]('/describe',auth[_0x656e('0xa')](),controller[_0x656e('0xc')]);router[_0x656e('0x9')](_0x656e('0xd'),auth[_0x656e('0xa')](),controller[_0x656e('0xe')]);router[_0x656e('0x9')](_0x656e('0xf'),auth[_0x656e('0xa')](),controller[_0x656e('0x10')]);router[_0x656e('0x11')]('/',auth[_0x656e('0xa')](),controller[_0x656e('0x12')]);router[_0x656e('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x656e('0x14')]);router[_0x656e('0x15')](_0x656e('0xd'),auth[_0x656e('0xa')](),controller['destroy']);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 4a8e6fd..cd4c4db 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 _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 +var _0xfaa2=['sequelize','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','moment'];(function(_0x1f70ee,_0x412fb4){var _0x361003=function(_0x499156){while(--_0x499156){_0x1f70ee['push'](_0x1f70ee['shift']());}};_0x361003(++_0x412fb4);}(_0xfaa2,0x1e5));var _0x2faa=function(_0x4cb37a,_0x1e875c){_0x4cb37a=_0x4cb37a-0x0;var _0xda0e30=_0xfaa2[_0x4cb37a];return _0xda0e30;};'use strict';var moment=require(_0x2faa('0x0'));var Sequelize=require(_0x2faa('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x52dba7){this[_0x2faa('0x2')](_0x2faa('0x3'),_0x52dba7);this['setDataValue'](_0x2faa('0x4'),moment()[_0x2faa('0x5')](_0x2faa('0x6')));}},'endtime':{'type':Sequelize[_0x2faa('0x7')]},'membername':{'type':Sequelize[_0x2faa('0x8')]},'projectname':{'type':Sequelize[_0x2faa('0x8')]},'queue':{'type':Sequelize[_0x2faa('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2faa('0x8')]},'calleridnum':{'type':Sequelize[_0x2faa('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 0b5895d..a3a3a26 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 _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 +var _0xdc8e=['find','create','body','getQuestions','findOne','JscriptyQuestionReport','pick','SessionId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','limit','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys'];(function(_0x5818e7,_0x1c1cc5){var _0x8fe372=function(_0x523578){while(--_0x523578){_0x5818e7['push'](_0x5818e7['shift']());}};_0x8fe372(++_0x1c1cc5);}(_0xdc8e,0x141));var _0xedc8=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0xdc8e[_0x1aa3fe];return _0x163cee;};'use strict';var pdf=require(_0xedc8('0x0'));var emlformat=require(_0xedc8('0x1'));var rimraf=require(_0xedc8('0x2'));var zipdir=require(_0xedc8('0x3'));var jsonpatch=require(_0xedc8('0x4'));var rp=require(_0xedc8('0x5'));var moment=require(_0xedc8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xedc8('0x7'));var util=require(_0xedc8('0x8'));var path=require('path');var sox=require(_0xedc8('0x9'));var csv=require(_0xedc8('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xedc8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xedc8('0xa'));var querystring=require(_0xedc8('0xc'));var Papa=require(_0xedc8('0xd'));var Redis=require('ioredis');var authService=require(_0xedc8('0xe'));var qs=require(_0xedc8('0xf'));var as=require(_0xedc8('0x10'));var hardwareService=require(_0xedc8('0x11'));var logger=require(_0xedc8('0x12'))(_0xedc8('0x13'));var utils=require('../../config/utils');var config=require(_0xedc8('0x14'));var licenseUtil=require(_0xedc8('0x15'));var db=require(_0xedc8('0x16'))['db'];function respondWithStatusCode(_0x29e1e2,_0x46cc5d){_0x46cc5d=_0x46cc5d||0xcc;return function(_0x229c74){if(_0x229c74){return _0x29e1e2[_0xedc8('0x17')](_0x46cc5d);}return _0x29e1e2[_0xedc8('0x18')](_0x46cc5d)[_0xedc8('0x19')]();};}function respondWithResult(_0x47d2aa,_0x52b9fc){_0x52b9fc=_0x52b9fc||0xc8;return function(_0x4d5d14){if(_0x4d5d14){return _0x47d2aa[_0xedc8('0x18')](_0x52b9fc)['json'](_0x4d5d14);}};}function respondWithFilteredResult(_0x2b86e9,_0x1272d9){return function(_0x16a8ae){if(_0x16a8ae){var _0x54b026=_0x16a8ae[_0xedc8('0x1a')],_0x107a84=_0x1272d9['offset'],_0x389518=_0x1272d9['offset']+_0x1272d9[_0xedc8('0x1b')],_0x4a8620;if(_0x389518>=_0x54b026){_0x389518=_0x54b026;_0x4a8620=0xc8;}else{_0x4a8620=0xce;}_0x2b86e9['status'](_0x4a8620);return _0x2b86e9['set']('Content-Range',_0x107a84+'-'+_0x389518+'/'+_0x54b026)[_0xedc8('0x1c')](_0x16a8ae);}return null;};}function patchUpdates(_0x487ea5){return function(_0x20805b){try{jsonpatch[_0xedc8('0x1d')](_0x20805b,_0x487ea5,!![]);}catch(_0x188608){return BPromise[_0xedc8('0x1e')](_0x188608);}return _0x20805b[_0xedc8('0x1f')]();};}function saveUpdates(_0x82356c,_0x4a2c12){return function(_0x319d8d){if(_0x319d8d){return _0x319d8d[_0xedc8('0x20')](_0x82356c)[_0xedc8('0x21')](function(_0x1aaa7a){return _0x1aaa7a;});}return null;};}function removeEntity(_0xbd7a0b,_0x22f714){return function(_0x49b0c2){if(_0x49b0c2){return _0x49b0c2[_0xedc8('0x22')]()[_0xedc8('0x21')](function(){_0xbd7a0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44a577,_0x5770cd){return function(_0x35c79f){if(!_0x35c79f){_0x44a577['sendStatus'](0x194);}return _0x35c79f;};}function handleError(_0xe1160b,_0x5a7589){_0x5a7589=_0x5a7589||0x1f4;return function(_0x206762){logger[_0xedc8('0x23')](_0x206762[_0xedc8('0x24')]);if(_0x206762[_0xedc8('0x25')]){delete _0x206762[_0xedc8('0x25')];}_0xe1160b[_0xedc8('0x18')](_0x5a7589)[_0xedc8('0x26')](_0x206762);};}exports[_0xedc8('0x27')]=function(_0x5d06a4,_0x1bff73){var _0x348b03={},_0x4f609b={},_0x4098d7={'count':0x0,'rows':[]};var _0x393fb5=_[_0xedc8('0x28')](db[_0xedc8('0x29')][_0xedc8('0x2a')],function(_0x1c8e4d){return{'name':_0x1c8e4d['fieldName'],'type':_0x1c8e4d[_0xedc8('0x2b')][_0xedc8('0x2c')]};});_0x4f609b[_0xedc8('0x2d')]=_[_0xedc8('0x28')](_0x393fb5,_0xedc8('0x25'));_0x4f609b[_0xedc8('0x2e')]=_['keys'](_0x5d06a4['query']);_0x4f609b['filters']=_[_0xedc8('0x2f')](_0x4f609b[_0xedc8('0x2d')],_0x4f609b[_0xedc8('0x2e')]);_0x348b03['attributes']=_[_0xedc8('0x2f')](_0x4f609b[_0xedc8('0x2d')],qs[_0xedc8('0x30')](_0x5d06a4[_0xedc8('0x2e')][_0xedc8('0x30')]));_0x348b03['attributes']=_0x348b03[_0xedc8('0x31')][_0xedc8('0x32')]?_0x348b03['attributes']:_0x4f609b[_0xedc8('0x2d')];if(!_0x5d06a4['query'][_0xedc8('0x33')](_0xedc8('0x34'))){_0x348b03[_0xedc8('0x1b')]=qs['limit'](_0x5d06a4[_0xedc8('0x2e')][_0xedc8('0x1b')]);_0x348b03[_0xedc8('0x35')]=qs[_0xedc8('0x35')](_0x5d06a4[_0xedc8('0x2e')]['offset']);}_0x348b03[_0xedc8('0x36')]=qs[_0xedc8('0x37')](_0x5d06a4[_0xedc8('0x2e')][_0xedc8('0x37')]);_0x348b03[_0xedc8('0x38')]=qs[_0xedc8('0x39')](_['pick'](_0x5d06a4[_0xedc8('0x2e')],_0x4f609b[_0xedc8('0x39')]),_0x393fb5);if(_0x5d06a4[_0xedc8('0x2e')]['filter']){_0x348b03[_0xedc8('0x38')]=_[_0xedc8('0x3a')](_0x348b03[_0xedc8('0x38')],{'$or':_[_0xedc8('0x28')](_0x393fb5,function(_0x2ed1a9){if(_0x2ed1a9[_0xedc8('0x2b')]!==_0xedc8('0x3b')){var _0x5738ba={};_0x5738ba[_0x2ed1a9[_0xedc8('0x25')]]={'$like':'%'+_0x5d06a4[_0xedc8('0x2e')][_0xedc8('0x3c')]+'%'};return _0x5738ba;}})});}_0x348b03=_[_0xedc8('0x3a')]({},_0x348b03,_0x5d06a4[_0xedc8('0x3d')]);var _0x397f35={'where':_0x348b03[_0xedc8('0x38')]};return db[_0xedc8('0x29')][_0xedc8('0x1a')](_0x397f35)['then'](function(_0x1a649c){_0x4098d7[_0xedc8('0x1a')]=_0x1a649c;if(_0x5d06a4['query'][_0xedc8('0x3e')]){_0x348b03[_0xedc8('0x3f')]=[{'all':!![]}];}return db[_0xedc8('0x29')]['findAll'](_0x348b03);})[_0xedc8('0x21')](function(_0x1a918f){_0x4098d7[_0xedc8('0x40')]=_0x1a918f;return _0x4098d7;})[_0xedc8('0x21')](respondWithFilteredResult(_0x1bff73,_0x348b03))[_0xedc8('0x41')](handleError(_0x1bff73,null));};exports[_0xedc8('0x42')]=function(_0xe49214,_0x37514d){var _0x2e7f66={'raw':!![],'where':{'id':_0xe49214[_0xedc8('0x43')]['id']}},_0x32d296={};_0x32d296[_0xedc8('0x2d')]=_[_0xedc8('0x44')](db[_0xedc8('0x29')]['rawAttributes']);_0x32d296[_0xedc8('0x2e')]=_[_0xedc8('0x44')](_0xe49214[_0xedc8('0x2e')]);_0x32d296[_0xedc8('0x39')]=_[_0xedc8('0x2f')](_0x32d296['model'],_0x32d296[_0xedc8('0x2e')]);_0x2e7f66[_0xedc8('0x31')]=_[_0xedc8('0x2f')](_0x32d296['model'],qs[_0xedc8('0x30')](_0xe49214['query']['fields']));_0x2e7f66[_0xedc8('0x31')]=_0x2e7f66[_0xedc8('0x31')]['length']?_0x2e7f66[_0xedc8('0x31')]:_0x32d296[_0xedc8('0x2d')];if(_0xe49214[_0xedc8('0x2e')][_0xedc8('0x3e')]){_0x2e7f66[_0xedc8('0x3f')]=[{'all':!![]}];}_0x2e7f66=_[_0xedc8('0x3a')]({},_0x2e7f66,_0xe49214[_0xedc8('0x3d')]);return db['JscriptySessionReport'][_0xedc8('0x45')](_0x2e7f66)['then'](handleEntityNotFound(_0x37514d,null))['then'](respondWithResult(_0x37514d,null))[_0xedc8('0x41')](handleError(_0x37514d,null));};exports[_0xedc8('0x46')]=function(_0x5308ab,_0x536c0e){return db[_0xedc8('0x29')][_0xedc8('0x46')](_0x5308ab[_0xedc8('0x47')],{})[_0xedc8('0x21')](respondWithResult(_0x536c0e,0xc9))['catch'](handleError(_0x536c0e,null));};exports[_0xedc8('0x20')]=function(_0x57c33b,_0x332097){if(_0x57c33b[_0xedc8('0x47')]['id']){delete _0x57c33b[_0xedc8('0x47')]['id'];}return db[_0xedc8('0x29')][_0xedc8('0x45')]({'where':{'id':_0x57c33b['params']['id']}})[_0xedc8('0x21')](handleEntityNotFound(_0x332097,null))[_0xedc8('0x21')](saveUpdates(_0x57c33b[_0xedc8('0x47')],null))['then'](respondWithResult(_0x332097,null))[_0xedc8('0x41')](handleError(_0x332097,null));};exports[_0xedc8('0x22')]=function(_0x39e00c,_0x33e411){return db[_0xedc8('0x29')][_0xedc8('0x45')]({'where':{'id':_0x39e00c['params']['id']}})[_0xedc8('0x21')](handleEntityNotFound(_0x33e411,null))['then'](removeEntity(_0x33e411,null))['catch'](handleError(_0x33e411,null));};exports['describe']=function(_0x19ab56,_0x1f301f){return db['JscriptySessionReport']['describe']()[_0xedc8('0x21')](respondWithResult(_0x1f301f,null))[_0xedc8('0x41')](handleError(_0x1f301f,null));};exports[_0xedc8('0x48')]=function(_0x3aad96,_0x54e4fc,_0x2a15ab){var _0x1af9af={'raw':!![],'where':{}};var _0x3e8c18={};var _0x505a07={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xedc8('0x49')]({'where':{'id':_0x3aad96[_0xedc8('0x43')]['id']}})[_0xedc8('0x21')](handleEntityNotFound(_0x54e4fc,null))[_0xedc8('0x21')](function(_0x143f49){if(_0x143f49){_0x3e8c18[_0xedc8('0x2d')]=_[_0xedc8('0x44')](db[_0xedc8('0x4a')][_0xedc8('0x2a')]);_0x3e8c18[_0xedc8('0x2e')]=_[_0xedc8('0x44')](_0x3aad96[_0xedc8('0x2e')]);_0x3e8c18[_0xedc8('0x39')]=_[_0xedc8('0x2f')](_0x3e8c18[_0xedc8('0x2d')],_0x3e8c18['query']);_0x1af9af[_0xedc8('0x31')]=_[_0xedc8('0x2f')](_0x3e8c18[_0xedc8('0x2d')],qs[_0xedc8('0x30')](_0x3aad96[_0xedc8('0x2e')][_0xedc8('0x30')]));_0x1af9af[_0xedc8('0x31')]=_0x1af9af['attributes']['length']?_0x1af9af['attributes']:_0x3e8c18[_0xedc8('0x2d')];if(!_0x3aad96[_0xedc8('0x2e')]['hasOwnProperty']('nolimit')){_0x1af9af[_0xedc8('0x1b')]=qs[_0xedc8('0x1b')](_0x3aad96[_0xedc8('0x2e')][_0xedc8('0x1b')]);_0x1af9af['offset']=qs[_0xedc8('0x35')](_0x3aad96[_0xedc8('0x2e')][_0xedc8('0x35')]);}_0x1af9af['order']=qs[_0xedc8('0x37')](_0x3aad96[_0xedc8('0x2e')][_0xedc8('0x37')]);_0x1af9af[_0xedc8('0x38')]=qs[_0xedc8('0x39')](_[_0xedc8('0x4b')](_0x3aad96[_0xedc8('0x2e')],_0x3e8c18[_0xedc8('0x39')]));_0x1af9af[_0xedc8('0x38')][_0xedc8('0x4c')]=_0x143f49['id'];if(_0x3aad96['query'][_0xedc8('0x3c')]){_0x1af9af[_0xedc8('0x38')]=_[_0xedc8('0x3a')](_0x1af9af[_0xedc8('0x38')],{'$or':_[_0xedc8('0x28')](_0x1af9af[_0xedc8('0x31')],function(_0x19827c){var _0x1c4096={};_0x1c4096[_0x19827c]={'$like':'%'+_0x3aad96[_0xedc8('0x2e')]['filter']+'%'};return _0x1c4096;})});}_0x1af9af=_[_0xedc8('0x3a')]({},_0x1af9af,_0x3aad96[_0xedc8('0x3d')]);return db['JscriptyQuestionReport'][_0xedc8('0x1a')]({'where':_0x1af9af[_0xedc8('0x38')]})[_0xedc8('0x21')](function(_0x415559){_0x505a07['count']=_0x415559;if(_0x3aad96[_0xedc8('0x2e')][_0xedc8('0x3e')]){_0x1af9af[_0xedc8('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xedc8('0x4d')](_0x1af9af);})[_0xedc8('0x21')](function(_0x207170){_0x505a07[_0xedc8('0x40')]=_0x207170;return _0x505a07;});}})[_0xedc8('0x21')](respondWithFilteredResult(_0x54e4fc,_0x1af9af))[_0xedc8('0x41')](handleError(_0x54e4fc,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index ec0264f..7a9963a 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 _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 +var _0xb1b0=['api','moment','bluebird','request-promise','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger'];(function(_0x190aee,_0x3646e7){var _0x9779ff=function(_0x4a035c){while(--_0x4a035c){_0x190aee['push'](_0x190aee['shift']());}};_0x9779ff(++_0x3646e7);}(_0xb1b0,0x1c6));var _0x0b1b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb1b0[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x0b1b('0x0'));var logger=require(_0x0b1b('0x1'))(_0x0b1b('0x2'));var moment=require(_0x0b1b('0x3'));var BPromise=require(_0x0b1b('0x4'));var rp=require(_0x0b1b('0x5'));var fs=require('fs');var path=require(_0x0b1b('0x6'));var rimraf=require(_0x0b1b('0x7'));var config=require('../../config/environment');var attributes=require(_0x0b1b('0x8'));module[_0x0b1b('0x9')]=function(_0x41eb89,_0x7047a1){return _0x41eb89['define'](_0x0b1b('0xa'),attributes,{'tableName':_0x0b1b('0xb'),'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 9e35268..996626c 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 _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 +var _0x3d2e=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x22a6fa,_0x23f6f3){var _0x4e18ea=function(_0x69ae7c){while(--_0x69ae7c){_0x22a6fa['push'](_0x22a6fa['shift']());}};_0x4e18ea(++_0x23f6f3);}(_0x3d2e,0x169));var _0xe3d2=function(_0x4f5801,_0x16902a){_0x4f5801=_0x4f5801-0x0;var _0x302670=_0x3d2e[_0x4f5801];return _0x302670;};'use strict';var _=require('lodash');var util=require(_0xe3d2('0x0'));var moment=require(_0xe3d2('0x1'));var BPromise=require(_0xe3d2('0x2'));var rs=require(_0xe3d2('0x3'));var fs=require('fs');var Redis=require(_0xe3d2('0x4'));var db=require(_0xe3d2('0x5'))['db'];var utils=require(_0xe3d2('0x6'));var logger=require(_0xe3d2('0x7'))('rpc');var config=require(_0xe3d2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe3d2('0x9')][_0xe3d2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b342c,_0x246038,_0x47c818){return new BPromise(function(_0x4bb2d0,_0x52cdb7){return client[_0xe3d2('0xb')](_0x1b342c,_0x47c818)['then'](function(_0x23ff9c){logger['info'](_0xe3d2('0xc'),_0x246038,_0xe3d2('0xd'));logger[_0xe3d2('0xe')](_0xe3d2('0xf'),_0x246038,'request\x20sent',JSON['stringify'](_0x23ff9c));if(_0x23ff9c[_0xe3d2('0x10')]){if(_0x23ff9c[_0xe3d2('0x10')][_0xe3d2('0x11')]===0x1f4){logger['error'](_0xe3d2('0xc'),_0x246038,_0x23ff9c[_0xe3d2('0x10')][_0xe3d2('0x12')]);return _0x52cdb7(_0x23ff9c[_0xe3d2('0x10')][_0xe3d2('0x12')]);}logger[_0xe3d2('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x246038,_0x23ff9c[_0xe3d2('0x10')][_0xe3d2('0x12')]);return _0x4bb2d0(_0x23ff9c[_0xe3d2('0x10')][_0xe3d2('0x12')]);}else{logger['info'](_0xe3d2('0xc'),_0x246038,'request\x20sent');_0x4bb2d0(_0x23ff9c[_0xe3d2('0x13')][_0xe3d2('0x12')]);}})[_0xe3d2('0x14')](function(_0x13b5e2){logger[_0xe3d2('0x10')](_0xe3d2('0xc'),_0x246038,_0x13b5e2);_0x52cdb7(_0x13b5e2);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index e1a0cf8..c284d0d 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 _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 +var _0xf006=['multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports'];(function(_0xbc583a,_0x48a918){var _0x4e4c9c=function(_0x308ffe){while(--_0x308ffe){_0xbc583a['push'](_0xbc583a['shift']());}};_0x4e4c9c(++_0x48a918);}(_0xf006,0x78));var _0x6f00=function(_0x3d70b8,_0x134c6a){_0x3d70b8=_0x3d70b8-0x0;var _0x411581=_0xf006[_0x3d70b8];return _0x411581;};'use strict';var multer=require(_0x6f00('0x0'));var util=require(_0x6f00('0x1'));var path=require(_0x6f00('0x2'));var timeout=require(_0x6f00('0x3'));var express=require('express');var router=express[_0x6f00('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x6f00('0x5'));var config=require(_0x6f00('0x6'));var controller=require(_0x6f00('0x7'));router[_0x6f00('0x8')]('/',controller[_0x6f00('0x9')]);router[_0x6f00('0xa')](_0x6f00('0xb'),auth[_0x6f00('0xc')](),controller[_0x6f00('0xd')]);module[_0x6f00('0xe')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 5abd188..e9455a5 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 _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 +var _0x6d38=['exports','TEXT','STRING'];(function(_0x112198,_0x52c556){var _0x21b4b3=function(_0x24b17f){while(--_0x24b17f){_0x112198['push'](_0x112198['shift']());}};_0x21b4b3(++_0x52c556);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6d38[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'license':{'type':Sequelize[_0x86d3('0x1')]},'data1':{'type':Sequelize[_0x86d3('0x2')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 bd3b468..7f9e61d 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 _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 +var _0xf611=['update','then','destroy','stack','name','send','model','keys','rawAttributes','query','attributes','intersection','fields','options','getLicense','body','License','params','checkLicense','eml-format','rimraf','zip-dir','bluebird','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x50cd41,_0x4874a7){var _0x399475=function(_0x1946da){while(--_0x1946da){_0x50cd41['push'](_0x50cd41['shift']());}};_0x399475(++_0x4874a7);}(_0xf611,0x7b));var _0x1f61=function(_0x571dbc,_0x400df9){_0x571dbc=_0x571dbc-0x0;var _0x55043c=_0xf611[_0x571dbc];return _0x55043c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1f61('0x0'));var rimraf=require(_0x1f61('0x1'));var zipdir=require(_0x1f61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f61('0x3'));var Mustache=require('mustache');var util=require(_0x1f61('0x4'));var path=require(_0x1f61('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1f61('0x6'));var fs=require('fs');var _=require(_0x1f61('0x7'));var squel=require(_0x1f61('0x8'));var crypto=require(_0x1f61('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1f61('0xa'));var toCsv=require(_0x1f61('0xb'));var querystring=require(_0x1f61('0xc'));var Papa=require('papaparse');var Redis=require(_0x1f61('0xd'));var authService=require(_0x1f61('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1f61('0xf'));var logger=require(_0x1f61('0x10'))(_0x1f61('0x11'));var utils=require(_0x1f61('0x12'));var config=require(_0x1f61('0x13'));var licenseUtil=require(_0x1f61('0x14'));var db=require(_0x1f61('0x15'))['db'];function respondWithStatusCode(_0x37cb71,_0x486473){_0x486473=_0x486473||0xcc;return function(_0x39d9bf){if(_0x39d9bf){return _0x37cb71[_0x1f61('0x16')](_0x486473);}return _0x37cb71[_0x1f61('0x17')](_0x486473)[_0x1f61('0x18')]();};}function respondWithResult(_0xd9b707,_0xe7ad5c){_0xe7ad5c=_0xe7ad5c||0xc8;return function(_0x206c0d){if(_0x206c0d){return _0xd9b707[_0x1f61('0x17')](_0xe7ad5c)[_0x1f61('0x19')](_0x206c0d);}};}function respondWithFilteredResult(_0x22bb50,_0x17fd3b){return function(_0x246530){if(_0x246530){var _0x45df7f=_0x246530[_0x1f61('0x1a')],_0x294df2=_0x17fd3b[_0x1f61('0x1b')],_0x3e6ef5=_0x17fd3b[_0x1f61('0x1b')]+_0x17fd3b[_0x1f61('0x1c')],_0x3a3a5a;if(_0x3e6ef5>=_0x45df7f){_0x3e6ef5=_0x45df7f;_0x3a3a5a=0xc8;}else{_0x3a3a5a=0xce;}_0x22bb50[_0x1f61('0x17')](_0x3a3a5a);return _0x22bb50['set'](_0x1f61('0x1d'),_0x294df2+'-'+_0x3e6ef5+'/'+_0x45df7f)[_0x1f61('0x19')](_0x246530);}return null;};}function patchUpdates(_0x5dc6af){return function(_0x568be7){try{jsonpatch[_0x1f61('0x1e')](_0x568be7,_0x5dc6af,!![]);}catch(_0x43f643){return BPromise[_0x1f61('0x1f')](_0x43f643);}return _0x568be7[_0x1f61('0x20')]();};}function saveUpdates(_0x994383,_0x3df30f){return function(_0x206584){if(_0x206584){return _0x206584[_0x1f61('0x21')](_0x994383)[_0x1f61('0x22')](function(_0x8f8f48){return _0x8f8f48;});}return null;};}function removeEntity(_0x485c0d,_0x2768c){return function(_0x5de4c9){if(_0x5de4c9){return _0x5de4c9[_0x1f61('0x23')]()['then'](function(){_0x485c0d[_0x1f61('0x17')](0xcc)[_0x1f61('0x18')]();});}};}function handleEntityNotFound(_0x4008c0,_0x4ceb8d){return function(_0x484556){if(!_0x484556){_0x4008c0[_0x1f61('0x16')](0x194);}return _0x484556;};}function handleError(_0x50a298,_0x177436){_0x177436=_0x177436||0x1f4;return function(_0x19945e){logger['error'](_0x19945e[_0x1f61('0x24')]);if(_0x19945e['name']){delete _0x19945e[_0x1f61('0x25')];}_0x50a298[_0x1f61('0x17')](_0x177436)[_0x1f61('0x26')](_0x19945e);};}var utilLicense=require(_0x1f61('0x14'));exports['index']=function(_0x41ccee,_0x2099da){var _0x27abe5={'raw':!![],'where':{'id':0x1}},_0x31dab2={};_0x31dab2[_0x1f61('0x27')]=_[_0x1f61('0x28')](db['License'][_0x1f61('0x29')]);_0x31dab2[_0x1f61('0x2a')]=_[_0x1f61('0x28')](_0x41ccee[_0x1f61('0x2a')]);_0x31dab2['filters']=_['intersection'](_0x31dab2[_0x1f61('0x27')],_0x31dab2['query']);_0x27abe5[_0x1f61('0x2b')]=_[_0x1f61('0x2c')](_0x31dab2[_0x1f61('0x27')],qs[_0x1f61('0x2d')](_0x41ccee[_0x1f61('0x2a')][_0x1f61('0x2d')]));_0x27abe5[_0x1f61('0x2b')]=_0x27abe5[_0x1f61('0x2b')]['length']?_0x27abe5[_0x1f61('0x2b')]:_0x31dab2[_0x1f61('0x27')];_0x27abe5=_['merge']({},_0x27abe5,_0x41ccee[_0x1f61('0x2e')]);return utilLicense[_0x1f61('0x2f')](_0x27abe5)['then'](respondWithResult(_0x2099da,null))['catch'](handleError(_0x2099da,null));};exports[_0x1f61('0x21')]=function(_0x2d6264,_0x4d535c){if(_0x2d6264[_0x1f61('0x30')]['id']){delete _0x2d6264[_0x1f61('0x30')]['id'];}return db[_0x1f61('0x31')]['find']({'where':{'id':_0x2d6264[_0x1f61('0x32')]['id']}})[_0x1f61('0x22')](handleEntityNotFound(_0x4d535c,null))[_0x1f61('0x22')](function(_0x548338){var _0x237066=_0x548338['get']({'plain':!![]});return utilLicense[_0x1f61('0x33')](_0x237066,_0x2d6264['body']['key']);})[_0x1f61('0x22')](function(_0x824a42){if(!_0x824a42['demo']){return saveUpdates(_0x2d6264[_0x1f61('0x30')],null);}return _0x824a42;})[_0x1f61('0x22')](respondWithResult(_0x4d535c,null))['catch'](handleError(_0x4d535c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d5c5aad..9b1076c 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 _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 +var _0x1a75=['license','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x48cef2,_0x42ee56){var _0x2fefe0=function(_0x4af536){while(--_0x4af536){_0x48cef2['push'](_0x48cef2['shift']());}};_0x2fefe0(++_0x42ee56);}(_0x1a75,0x6d));var _0x51a7=function(_0x5c0aea,_0x134ba3){_0x5c0aea=_0x5c0aea-0x0;var _0x16602c=_0x1a75[_0x5c0aea];return _0x16602c;};'use strict';var _=require('lodash');var util=require(_0x51a7('0x0'));var logger=require(_0x51a7('0x1'))(_0x51a7('0x2'));var moment=require('moment');var BPromise=require(_0x51a7('0x3'));var rp=require(_0x51a7('0x4'));var fs=require('fs');var path=require(_0x51a7('0x5'));var rimraf=require(_0x51a7('0x6'));var config=require(_0x51a7('0x7'));var attributes=require(_0x51a7('0x8'));module[_0x51a7('0x9')]=function(_0x563934,_0x377849){return _0x563934[_0x51a7('0xa')]('License',attributes,{'tableName':_0x51a7('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 09dc2ab..cf57f02 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 _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 +var _0x0102=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../config/environment','jayson/promise','client','http','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0102,0x186));var _0x2010=function(_0x357333,_0x799636){_0x357333=_0x357333-0x0;var _0x42e70a=_0x0102[_0x357333];return _0x42e70a;};'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);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b2f1141..23a96a4 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 _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 +var _0x0298=['./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','create','addInteraction','addApplications','send','addAgents','delete','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x13c5db,_0x5e0149){var _0x35e17b=function(_0x19a469){while(--_0x19a469){_0x13c5db['push'](_0x13c5db['shift']());}};_0x35e17b(++_0x5e0149);}(_0x0298,0x1bb));var _0x8029=function(_0x33dc75,_0x425795){_0x33dc75=_0x33dc75-0x0;var _0x1a227d=_0x0298[_0x33dc75];return _0x1a227d;};'use strict';var multer=require(_0x8029('0x0'));var util=require(_0x8029('0x1'));var path=require(_0x8029('0x2'));var timeout=require(_0x8029('0x3'));var express=require(_0x8029('0x4'));var router=express[_0x8029('0x5')]();var auth=require(_0x8029('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8029('0x7'));var controller=require(_0x8029('0x8'));router[_0x8029('0x9')]('/',auth[_0x8029('0xa')](),controller[_0x8029('0xb')]);router[_0x8029('0x9')](_0x8029('0xc'),auth[_0x8029('0xa')](),controller['describe']);router[_0x8029('0x9')](_0x8029('0xd'),auth[_0x8029('0xa')](),controller[_0x8029('0xe')]);router['get']('/:id/dispositions',auth[_0x8029('0xa')](),controller[_0x8029('0xf')]);router[_0x8029('0x9')]('/:id/canned_answers',auth[_0x8029('0xa')](),controller['getAnswers']);router['get'](_0x8029('0x10'),auth[_0x8029('0xa')](),controller[_0x8029('0x11')]);router[_0x8029('0x9')](_0x8029('0x12'),auth['isAuthenticated'](),controller[_0x8029('0x13')]);router[_0x8029('0x9')](_0x8029('0x14'),auth[_0x8029('0xa')](),controller['getInteractions']);router[_0x8029('0x9')](_0x8029('0x15'),auth[_0x8029('0xa')](),controller[_0x8029('0x16')]);router[_0x8029('0x9')](_0x8029('0x17'),auth[_0x8029('0xa')](),controller['getMessages']);router[_0x8029('0x9')](_0x8029('0x18'),auth[_0x8029('0xa')](),controller[_0x8029('0x19')]);router['get']('/:id/users',auth[_0x8029('0xa')](),controller[_0x8029('0x1a')]);router[_0x8029('0x1b')](_0x8029('0x1c'),auth[_0x8029('0xa')](),controller[_0x8029('0x1d')]);router['post'](_0x8029('0x1e'),auth[_0x8029('0xa')](),controller['addAnswer']);router[_0x8029('0x1b')]('/',auth['isAuthenticated'](),controller[_0x8029('0x1f')]);router[_0x8029('0x1b')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller['addImap']);router[_0x8029('0x1b')](_0x8029('0x12'),auth[_0x8029('0xa')](),controller['addSmtp']);router[_0x8029('0x1b')](_0x8029('0x14'),auth[_0x8029('0xa')](),controller[_0x8029('0x20')]);router['post'](_0x8029('0x15'),auth[_0x8029('0xa')](),controller[_0x8029('0x21')]);router[_0x8029('0x1b')]('/:id/send',auth[_0x8029('0xa')](),controller[_0x8029('0x22')]);router[_0x8029('0x1b')]('/:id/users',auth[_0x8029('0xa')](),controller[_0x8029('0x23')]);router['put'](_0x8029('0xd'),auth[_0x8029('0xa')](),controller['update']);router['delete'](_0x8029('0x1c'),auth[_0x8029('0xa')](),controller['removeDispositions']);router['delete'](_0x8029('0x1e'),auth[_0x8029('0xa')](),controller['removeAnswers']);router[_0x8029('0x24')](_0x8029('0x10'),auth[_0x8029('0xa')](),controller[_0x8029('0x25')]);router[_0x8029('0x24')](_0x8029('0x12'),auth['isAuthenticated'](),controller['removeSmtp']);router['delete'](_0x8029('0xd'),auth[_0x8029('0xa')](),controller[_0x8029('0x26')]);router[_0x8029('0x24')]('/:id/users',auth[_0x8029('0xa')](),controller[_0x8029('0x27')]);module[_0x8029('0x28')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d4a74f0..235da21 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 _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 +var _0x8e56=['setDataValue','mandatoryDisposition','exports','STRING','TEXT','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x42a935,_0x5dbc15){var _0x42321f=function(_0x7ac6e9){while(--_0x7ac6e9){_0x42a935['push'](_0x42a935['shift']());}};_0x42321f(++_0x5dbc15);}(_0x8e56,0x18e));var _0x68e5=function(_0x41048b,_0x582d7c){_0x41048b=_0x41048b-0x0;var _0xaa2010=_0x8e56[_0x41048b];return _0xaa2010;};'use strict';var Sequelize=require('sequelize');module[_0x68e5('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x68e5('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x68e5('0x2')]},'markAsUnread':{'type':Sequelize[_0x68e5('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x68e5('0x1')],'allowNull':![],'defaultValue':_0x68e5('0x4')},'fontSize':{'type':Sequelize[_0x68e5('0x5')](0x2)[_0x68e5('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x68e5('0x2')],'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[_0x68e5('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x68e5('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x68e5('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x68e5('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x68e5('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x68e5('0x3')],'defaultValue':![],'comment':_0x68e5('0x7'),'set':function(_0x643f85){if(!_0x643f85)this['setDataValue'](_0x68e5('0x8'),null);this[_0x68e5('0x9')](_0x68e5('0xa'),_0x643f85);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 2d6f881..ac3848f 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 _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 +var _0x1eef=['includeAll','include','findAll','rows','show','params','Imap','options','find','body','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','order','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','create','key','isNil','active','description','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','role','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','send','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','List','ListId','subject','attach','out','messageId','Interaction','verifySmtp','pass','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','juice','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','index','MailServerIn','MailServerOut','Smtp','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','pick','filter','where','merge','VIRTUAL','count'];(function(_0x5c86a6,_0x29da53){var _0x27ad34=function(_0x41428b){while(--_0x41428b){_0x5c86a6['push'](_0x5c86a6['shift']());}};_0x27ad34(++_0x29da53);}(_0x1eef,0x134));var _0xf1ee=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x1eef[_0x36d203];return _0x2f9e62;};'use strict';var pdf=require(_0xf1ee('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf1ee('0x1'));var zipdir=require(_0xf1ee('0x2'));var jsonpatch=require(_0xf1ee('0x3'));var rp=require(_0xf1ee('0x4'));var moment=require(_0xf1ee('0x5'));var BPromise=require(_0xf1ee('0x6'));var Mustache=require('mustache');var util=require(_0xf1ee('0x7'));var path=require(_0xf1ee('0x8'));var sox=require(_0xf1ee('0x9'));var csv=require('to-csv');var ejs=require(_0xf1ee('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xf1ee('0xb'));var jsforce=require(_0xf1ee('0xc'));var deskjs=require(_0xf1ee('0xd'));var toCsv=require(_0xf1ee('0xe'));var querystring=require(_0xf1ee('0xf'));var Papa=require(_0xf1ee('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xf1ee('0x11'));var Redis=require('ioredis');var authService=require(_0xf1ee('0x12'));var qs=require(_0xf1ee('0x13'));var as=require(_0xf1ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf1ee('0x15'));var utils=require('../../config/utils');var config=require(_0xf1ee('0x16'));var licenseUtil=require(_0xf1ee('0x17'));var db=require(_0xf1ee('0x18'))['db'];config['redis']=_[_0xf1ee('0x19')](config[_0xf1ee('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf1ee('0x1a')]));require('./mailAccount.socket')[_0xf1ee('0x1b')](socket);var jayson=require(_0xf1ee('0x1c'));var client=jayson[_0xf1ee('0x1d')][_0xf1ee('0x1e')]({'port':0x232b});function respondWithRpcPromise(_0x4a99a9,_0x492784,_0x17dfd1,_0x275573){return new BPromise(function(_0x33c7fe,_0x27ba65){var _0x5c0d08=_0x275573||client;return _0x5c0d08[_0xf1ee('0x1f')](_0x4a99a9,_0x17dfd1)[_0xf1ee('0x20')](function(_0x3702df){logger[_0xf1ee('0x21')](_0xf1ee('0x22'),_0x492784,'request\x20sent');logger[_0xf1ee('0x23')](_0xf1ee('0x24'),_0x492784,_0xf1ee('0x25'),JSON[_0xf1ee('0x26')](_0x3702df));if(_0x3702df[_0xf1ee('0x27')]){if(_0x3702df[_0xf1ee('0x27')][_0xf1ee('0x28')]===0x1f4){logger[_0xf1ee('0x27')](_0xf1ee('0x22'),_0x492784,_0x3702df[_0xf1ee('0x27')][_0xf1ee('0x29')]);return _0x27ba65(_0x3702df[_0xf1ee('0x27')]['message']);}logger['error'](_0xf1ee('0x22'),_0x492784,_0x3702df[_0xf1ee('0x27')][_0xf1ee('0x29')]);return _0x33c7fe(_0x3702df[_0xf1ee('0x27')][_0xf1ee('0x29')]);}else{logger['info'](_0xf1ee('0x22'),_0x492784,_0xf1ee('0x25'));_0x33c7fe(_0x3702df[_0xf1ee('0x2a')][_0xf1ee('0x29')]);}})[_0xf1ee('0x2b')](function(_0x245b84){logger[_0xf1ee('0x27')]('MailAccount,\x20%s,\x20%s',_0x492784,_0x245b84);_0x27ba65(_0x245b84);});});}function respondWithStatusCode(_0x39cfe5,_0x4becc1){_0x4becc1=_0x4becc1||0xcc;return function(_0x16d77c){if(_0x16d77c){return _0x39cfe5[_0xf1ee('0x2c')](_0x4becc1);}return _0x39cfe5[_0xf1ee('0x2d')](_0x4becc1)[_0xf1ee('0x2e')]();};}function respondWithResult(_0x1e67af,_0x30fdf1){_0x30fdf1=_0x30fdf1||0xc8;return function(_0x12a2c9){if(_0x12a2c9){return _0x1e67af['status'](_0x30fdf1)[_0xf1ee('0x2f')](_0x12a2c9);}};}function respondWithFilteredResult(_0x4bb3d1,_0x1029cd){return function(_0x5b0f97){if(_0x5b0f97){var _0x5b5dea=_0x5b0f97['count'],_0x197990=_0x1029cd[_0xf1ee('0x30')],_0x50e6bd=_0x1029cd['offset']+_0x1029cd['limit'],_0x540b90;if(_0x50e6bd>=_0x5b5dea){_0x50e6bd=_0x5b5dea;_0x540b90=0xc8;}else{_0x540b90=0xce;}_0x4bb3d1[_0xf1ee('0x2d')](_0x540b90);return _0x4bb3d1[_0xf1ee('0x31')](_0xf1ee('0x32'),_0x197990+'-'+_0x50e6bd+'/'+_0x5b5dea)[_0xf1ee('0x2f')](_0x5b0f97);}return null;};}function patchUpdates(_0x103264){return function(_0x2d8e10){try{jsonpatch['apply'](_0x2d8e10,_0x103264,!![]);}catch(_0x3a1a6c){return BPromise[_0xf1ee('0x33')](_0x3a1a6c);}return _0x2d8e10[_0xf1ee('0x34')]();};}function saveUpdates(_0x32c38b,_0x20115c){return function(_0x3d3c02){if(_0x3d3c02){return _0x3d3c02[_0xf1ee('0x35')](_0x32c38b)[_0xf1ee('0x20')](function(_0x3fb22b){return _0x3fb22b;});}return null;};}function removeEntity(_0x1446fa,_0x3da49e){return function(_0x3108eb){if(_0x3108eb){return _0x3108eb[_0xf1ee('0x36')]()[_0xf1ee('0x20')](function(){var _0xf36782=_0x3108eb[_0xf1ee('0x37')]({'plain':!![]});var _0x4ba72e=_0xf1ee('0x38');return db[_0xf1ee('0x39')][_0xf1ee('0x36')]({'where':{'type':_0x4ba72e,'resourceId':_0xf36782['id']}})[_0xf1ee('0x20')](function(){return _0x3108eb;});})['then'](function(){_0x1446fa['status'](0xcc)[_0xf1ee('0x2e')]();});}};}function handleEntityNotFound(_0x58d6bf,_0x368d4){return function(_0x3f9b9c){if(!_0x3f9b9c){_0x58d6bf[_0xf1ee('0x2c')](0x194);}return _0x3f9b9c;};}function handleError(_0x49b234,_0x30ef71){_0x30ef71=_0x30ef71||0x1f4;return function(_0x5b11e9){logger[_0xf1ee('0x27')](_0x5b11e9[_0xf1ee('0x3a')]);if(_0x5b11e9[_0xf1ee('0x3b')]){delete _0x5b11e9[_0xf1ee('0x3b')];}_0x49b234[_0xf1ee('0x2d')](_0x30ef71)['send'](_0x5b11e9);};}exports[_0xf1ee('0x3c')]=function(_0xd9519,_0x23a695){var _0x5255ba={'include':[{'model':db[_0xf1ee('0x3d')],'as':'Imap'},{'model':db[_0xf1ee('0x3e')],'as':_0xf1ee('0x3f')},{'model':db[_0xf1ee('0x40')],'as':_0xf1ee('0x41')}]},_0x8cdbb9={},_0x21fc35={'count':0x0,'rows':[]};var _0x5de70b=_[_0xf1ee('0x42')](db[_0xf1ee('0x43')][_0xf1ee('0x44')],function(_0xc896cd){return{'name':_0xc896cd[_0xf1ee('0x45')],'type':_0xc896cd[_0xf1ee('0x46')]['key']};});_0x8cdbb9[_0xf1ee('0x47')]=_['map'](_0x5de70b,'name');_0x8cdbb9[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0xd9519[_0xf1ee('0x48')]);_0x8cdbb9[_0xf1ee('0x4a')]=_[_0xf1ee('0x4b')](_0x8cdbb9[_0xf1ee('0x47')],_0x8cdbb9[_0xf1ee('0x48')]);_0x5255ba[_0xf1ee('0x4c')]=_[_0xf1ee('0x4b')](_0x8cdbb9[_0xf1ee('0x47')],qs[_0xf1ee('0x4d')](_0xd9519[_0xf1ee('0x48')]['fields']));_0x5255ba[_0xf1ee('0x4c')]=_0x5255ba['attributes'][_0xf1ee('0x4e')]?_0x5255ba[_0xf1ee('0x4c')]:_0x8cdbb9[_0xf1ee('0x47')];if(!_0xd9519[_0xf1ee('0x48')][_0xf1ee('0x4f')](_0xf1ee('0x50'))){_0x5255ba[_0xf1ee('0x51')]=qs[_0xf1ee('0x51')](_0xd9519[_0xf1ee('0x48')][_0xf1ee('0x51')]);_0x5255ba['offset']=qs[_0xf1ee('0x30')](_0xd9519[_0xf1ee('0x48')][_0xf1ee('0x30')]);}_0x5255ba['order']=qs['sort'](_0xd9519[_0xf1ee('0x48')]['sort']);_0x5255ba['where']=qs[_0xf1ee('0x4a')](_[_0xf1ee('0x52')](_0xd9519['query'],_0x8cdbb9[_0xf1ee('0x4a')]),_0x5de70b);if(_0xd9519[_0xf1ee('0x48')][_0xf1ee('0x53')]){_0x5255ba[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x5255ba[_0xf1ee('0x54')],{'$or':_[_0xf1ee('0x42')](_0x5de70b,function(_0x5b193f){if(_0x5b193f[_0xf1ee('0x46')]!==_0xf1ee('0x56')){var _0x33aba7={};_0x33aba7[_0x5b193f[_0xf1ee('0x3b')]]={'$like':'%'+_0xd9519[_0xf1ee('0x48')][_0xf1ee('0x53')]+'%'};return _0x33aba7;}})});}_0x5255ba=_[_0xf1ee('0x55')]({},_0x5255ba,_0xd9519['options']);var _0x36c9b2={'where':_0x5255ba['where']};return db[_0xf1ee('0x43')]['count'](_0x36c9b2)[_0xf1ee('0x20')](function(_0x4e957f){_0x21fc35[_0xf1ee('0x57')]=_0x4e957f;if(_0xd9519['query'][_0xf1ee('0x58')]){_0x5255ba[_0xf1ee('0x59')]=[{'all':!![]}];}return db['MailAccount'][_0xf1ee('0x5a')](_0x5255ba);})[_0xf1ee('0x20')](function(_0x29d49d){_0x21fc35[_0xf1ee('0x5b')]=_0x29d49d;return _0x21fc35;})[_0xf1ee('0x20')](respondWithFilteredResult(_0x23a695,_0x5255ba))[_0xf1ee('0x2b')](handleError(_0x23a695,null));};exports[_0xf1ee('0x5c')]=function(_0x569622,_0x4472a5){var _0x518717={'raw':![],'where':{'id':_0x569622[_0xf1ee('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xf1ee('0x5e')},{'model':db[_0xf1ee('0x3e')],'as':_0xf1ee('0x3f')},{'model':db[_0xf1ee('0x40')],'as':_0xf1ee('0x41')}]},_0x4c3c3e={};_0x4c3c3e[_0xf1ee('0x47')]=_[_0xf1ee('0x49')](db[_0xf1ee('0x43')]['rawAttributes']);_0x4c3c3e['query']=_[_0xf1ee('0x49')](_0x569622['query']);_0x4c3c3e[_0xf1ee('0x4a')]=_['intersection'](_0x4c3c3e['model'],_0x4c3c3e[_0xf1ee('0x48')]);_0x518717[_0xf1ee('0x4c')]=_[_0xf1ee('0x4b')](_0x4c3c3e['model'],qs[_0xf1ee('0x4d')](_0x569622[_0xf1ee('0x48')][_0xf1ee('0x4d')]));_0x518717['attributes']=_0x518717['attributes']['length']?_0x518717[_0xf1ee('0x4c')]:_0x4c3c3e['model'];if(_0x569622[_0xf1ee('0x48')]['includeAll']){_0x518717[_0xf1ee('0x59')]=[{'all':!![]}];}_0x518717=_[_0xf1ee('0x55')]({},_0x518717,_0x569622[_0xf1ee('0x5f')]);return db['MailAccount'][_0xf1ee('0x60')](_0x518717)[_0xf1ee('0x20')](handleEntityNotFound(_0x4472a5,null))[_0xf1ee('0x20')](respondWithResult(_0x4472a5,null))[_0xf1ee('0x2b')](handleError(_0x4472a5,null));};exports[_0xf1ee('0x35')]=function(_0x2740a3,_0x164f61){if(_0x2740a3[_0xf1ee('0x61')]['id']){delete _0x2740a3[_0xf1ee('0x61')]['id'];}return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0x2740a3['params']['id']},'include':[{'model':db[_0xf1ee('0x3d')],'as':_0xf1ee('0x5e')},{'model':db[_0xf1ee('0x3e')],'as':_0xf1ee('0x3f')},{'model':db['Pause'],'as':_0xf1ee('0x41')}]})[_0xf1ee('0x20')](handleEntityNotFound(_0x164f61,null))[_0xf1ee('0x20')](saveUpdates(_0x2740a3['body'],null))[_0xf1ee('0x20')](function(_0x59c35d){if(_0x59c35d&&_0x2740a3[_0xf1ee('0x61')][_0xf1ee('0x5e')]){return db[_0xf1ee('0x3d')][_0xf1ee('0x35')](_0x2740a3['body'][_0xf1ee('0x5e')],{'where':{'MailAccountId':_0x59c35d['id']}})[_0xf1ee('0x20')](function(){return _0x59c35d;});}return _0x59c35d;})[_0xf1ee('0x20')](function(_0x1bd508){if(_0x1bd508&&_0x2740a3[_0xf1ee('0x61')][_0xf1ee('0x3f')]){return db[_0xf1ee('0x3e')]['update'](_0x2740a3[_0xf1ee('0x61')][_0xf1ee('0x3f')],{'where':{'MailAccountId':_0x1bd508['id']}})['then'](function(){return _0x1bd508;});}return _0x1bd508;})['then'](respondWithResult(_0x164f61,null))[_0xf1ee('0x2b')](handleError(_0x164f61,null));};exports[_0xf1ee('0x62')]=function(_0x4f2b1a,_0x14829d){return db[_0xf1ee('0x43')][_0xf1ee('0x62')]()[_0xf1ee('0x20')](respondWithResult(_0x14829d,null))[_0xf1ee('0x2b')](handleError(_0x14829d,null));};exports[_0xf1ee('0x63')]=function(_0x34170a,_0x42c4c5,_0x3d25da){if(_0x34170a[_0xf1ee('0x61')]['id']){delete _0x34170a[_0xf1ee('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x34170a[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x42c4c5,null))[_0xf1ee('0x20')](function(_0x25b1d9){if(_0x25b1d9){_0x34170a['body'][_0xf1ee('0x64')]=_0x25b1d9['id'];return db['Disposition']['create'](_0x34170a[_0xf1ee('0x61')]);}})[_0xf1ee('0x20')](respondWithResult(_0x42c4c5,null))[_0xf1ee('0x2b')](handleError(_0x42c4c5,null));};exports[_0xf1ee('0x65')]=function(_0x52fbac,_0x59d5a7,_0x4018ba){var _0x374911={'raw':![],'where':{}};var _0x183027={};var _0x5ae709={'count':0x0,'rows':[]};return db[_0xf1ee('0x43')][_0xf1ee('0x66')]({'where':{'id':_0x52fbac[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x59d5a7,null))[_0xf1ee('0x20')](function(_0x250787){if(_0x250787){_0x183027[_0xf1ee('0x47')]=_[_0xf1ee('0x49')](db[_0xf1ee('0x67')][_0xf1ee('0x44')]);_0x183027[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0x52fbac[_0xf1ee('0x48')]);_0x183027['filters']=_[_0xf1ee('0x4b')](_0x183027[_0xf1ee('0x47')],_0x183027['query']);_0x374911[_0xf1ee('0x4c')]=_[_0xf1ee('0x4b')](_0x183027[_0xf1ee('0x47')],qs['fields'](_0x52fbac[_0xf1ee('0x48')][_0xf1ee('0x4d')]));_0x374911[_0xf1ee('0x4c')]=_0x374911[_0xf1ee('0x4c')][_0xf1ee('0x4e')]?_0x374911['attributes']:_0x183027[_0xf1ee('0x47')];if(!_0x52fbac[_0xf1ee('0x48')][_0xf1ee('0x4f')](_0xf1ee('0x50'))){_0x374911[_0xf1ee('0x51')]=qs[_0xf1ee('0x51')](_0x52fbac[_0xf1ee('0x48')][_0xf1ee('0x51')]);_0x374911[_0xf1ee('0x30')]=qs[_0xf1ee('0x30')](_0x52fbac[_0xf1ee('0x48')][_0xf1ee('0x30')]);}_0x374911[_0xf1ee('0x68')]=qs['sort'](_0x52fbac[_0xf1ee('0x48')][_0xf1ee('0x69')]);_0x374911['where']=qs['filters'](_[_0xf1ee('0x52')](_0x52fbac[_0xf1ee('0x48')],_0x183027[_0xf1ee('0x4a')]));_0x374911[_0xf1ee('0x54')][_0xf1ee('0x64')]=_0x250787['id'];if(_0x52fbac['query'][_0xf1ee('0x53')]){_0x374911[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x374911[_0xf1ee('0x54')],{'$or':_['map'](_0x374911[_0xf1ee('0x4c')],function(_0x18515b){var _0x30f239={};_0x30f239[_0x18515b]={'$like':'%'+_0x52fbac['query'][_0xf1ee('0x53')]+'%'};return _0x30f239;})});}_0x374911=_[_0xf1ee('0x55')]({},_0x374911,_0x52fbac[_0xf1ee('0x5f')]);return db[_0xf1ee('0x67')][_0xf1ee('0x57')]({'where':_0x374911['where']})[_0xf1ee('0x20')](function(_0xed7eba){_0x5ae709['count']=_0xed7eba;if(_0x52fbac[_0xf1ee('0x48')]['includeAll']){_0x374911[_0xf1ee('0x59')]=[{'all':!![]}];}return db[_0xf1ee('0x67')][_0xf1ee('0x5a')](_0x374911);})['then'](function(_0x4ca6e7){_0x5ae709[_0xf1ee('0x5b')]=_0x4ca6e7;return _0x5ae709;});}})[_0xf1ee('0x20')](respondWithFilteredResult(_0x59d5a7,_0x374911))[_0xf1ee('0x2b')](handleError(_0x59d5a7,null));};exports[_0xf1ee('0x6a')]=function(_0xc82c4c,_0x3af981,_0x2fc607){return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0xc82c4c[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x3af981,null))[_0xf1ee('0x20')](function(_0x32362b){if(_0x32362b){return _0x32362b[_0xf1ee('0x6a')](_0xc82c4c[_0xf1ee('0x48')][_0xf1ee('0x6b')]);}})[_0xf1ee('0x20')](respondWithStatusCode(_0x3af981,null))[_0xf1ee('0x2b')](handleError(_0x3af981,null));};exports[_0xf1ee('0x6c')]=function(_0x3b8a2d,_0x138163,_0xe8e13c){if(_0x3b8a2d['body']['id']){delete _0x3b8a2d[_0xf1ee('0x61')]['id'];}return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0x3b8a2d[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x138163,null))[_0xf1ee('0x20')](function(_0x132752){if(_0x132752){_0x3b8a2d[_0xf1ee('0x61')][_0xf1ee('0x64')]=_0x132752['id'];return db[_0xf1ee('0x6d')]['create'](_0x3b8a2d[_0xf1ee('0x61')]);}})[_0xf1ee('0x20')](respondWithResult(_0x138163,null))[_0xf1ee('0x2b')](handleError(_0x138163,null));};exports[_0xf1ee('0x6e')]=function(_0x61a8f2,_0x3ca86b,_0x37ea01){var _0x2aabdb={'raw':![],'where':{}};var _0x134b26={};var _0x3130d9={'count':0x0,'rows':[]};return db[_0xf1ee('0x43')]['findOne']({'where':{'id':_0x61a8f2[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x3ca86b,null))[_0xf1ee('0x20')](function(_0x8f2b15){if(_0x8f2b15){_0x134b26[_0xf1ee('0x47')]=_[_0xf1ee('0x49')](db[_0xf1ee('0x6d')][_0xf1ee('0x44')]);_0x134b26[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0x61a8f2['query']);_0x134b26[_0xf1ee('0x4a')]=_[_0xf1ee('0x4b')](_0x134b26[_0xf1ee('0x47')],_0x134b26[_0xf1ee('0x48')]);_0x2aabdb[_0xf1ee('0x4c')]=_[_0xf1ee('0x4b')](_0x134b26['model'],qs[_0xf1ee('0x4d')](_0x61a8f2['query'][_0xf1ee('0x4d')]));_0x2aabdb['attributes']=_0x2aabdb[_0xf1ee('0x4c')]['length']?_0x2aabdb[_0xf1ee('0x4c')]:_0x134b26[_0xf1ee('0x47')];if(!_0x61a8f2[_0xf1ee('0x48')][_0xf1ee('0x4f')](_0xf1ee('0x50'))){_0x2aabdb[_0xf1ee('0x51')]=qs[_0xf1ee('0x51')](_0x61a8f2[_0xf1ee('0x48')][_0xf1ee('0x51')]);_0x2aabdb[_0xf1ee('0x30')]=qs[_0xf1ee('0x30')](_0x61a8f2[_0xf1ee('0x48')][_0xf1ee('0x30')]);}_0x2aabdb[_0xf1ee('0x68')]=qs['sort'](_0x61a8f2[_0xf1ee('0x48')][_0xf1ee('0x69')]);_0x2aabdb['where']=qs['filters'](_[_0xf1ee('0x52')](_0x61a8f2[_0xf1ee('0x48')],_0x134b26['filters']));_0x2aabdb[_0xf1ee('0x54')][_0xf1ee('0x64')]=_0x8f2b15['id'];if(_0x61a8f2['query'][_0xf1ee('0x53')]){_0x2aabdb[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x2aabdb[_0xf1ee('0x54')],{'$or':_[_0xf1ee('0x42')](_0x2aabdb[_0xf1ee('0x4c')],function(_0x380f64){var _0x4fb8d5={};_0x4fb8d5[_0x380f64]={'$like':'%'+_0x61a8f2[_0xf1ee('0x48')][_0xf1ee('0x53')]+'%'};return _0x4fb8d5;})});}_0x2aabdb=_[_0xf1ee('0x55')]({},_0x2aabdb,_0x61a8f2['options']);return db[_0xf1ee('0x6d')][_0xf1ee('0x57')]({'where':_0x2aabdb[_0xf1ee('0x54')]})[_0xf1ee('0x20')](function(_0x59b747){_0x3130d9['count']=_0x59b747;if(_0x61a8f2[_0xf1ee('0x48')][_0xf1ee('0x58')]){_0x2aabdb[_0xf1ee('0x59')]=[{'all':!![]}];}return db[_0xf1ee('0x6d')][_0xf1ee('0x5a')](_0x2aabdb);})[_0xf1ee('0x20')](function(_0x41f371){_0x3130d9[_0xf1ee('0x5b')]=_0x41f371;return _0x3130d9;});}})[_0xf1ee('0x20')](respondWithFilteredResult(_0x3ca86b,_0x2aabdb))[_0xf1ee('0x2b')](handleError(_0x3ca86b,null));};exports[_0xf1ee('0x6f')]=function(_0x2127ee,_0x3e7125,_0x3b3524){return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0x2127ee[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x3e7125,null))['then'](function(_0x143afa){if(_0x143afa){return _0x143afa['removeAnswers'](_0x2127ee[_0xf1ee('0x48')][_0xf1ee('0x6b')]);}})[_0xf1ee('0x20')](respondWithStatusCode(_0x3e7125,null))[_0xf1ee('0x2b')](handleError(_0x3e7125,null));};exports[_0xf1ee('0x70')]=function(_0xc52476,_0x2a0392){var _0x228d4c={'name':_0xc52476[_0xf1ee('0x61')]['name'],'key':_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x71')],'email':_0xc52476[_0xf1ee('0x61')]['email'],'ListId':_0xc52476[_0xf1ee('0x61')]['ListId'],'active':!_[_0xf1ee('0x72')](_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x73')])?_0xc52476['body'][_0xf1ee('0x73')]:!![],'description':_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x74')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x75')])){if(_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x76')]){_0x228d4c[_0xf1ee('0x5e')][_0xf1ee('0x77')]=_0x228d4c[_0xf1ee('0x3f')][_0xf1ee('0x77')]=_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x78')];_0x228d4c['Imap'][_0xf1ee('0x79')]=_0x228d4c['Smtp']['pass']=_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x7a')];}else{_0x228d4c[_0xf1ee('0x5e')][_0xf1ee('0x7b')]=_0x228d4c['Smtp'][_0xf1ee('0x7b')]=![];}_0x228d4c['Imap']['host']=_0xc52476['body'][_0xf1ee('0x5e')][_0xf1ee('0x7c')];_0x228d4c[_0xf1ee('0x5e')][_0xf1ee('0x7d')]=_0xc52476[_0xf1ee('0x61')]['Imap'][_0xf1ee('0x7d')];_0x228d4c[_0xf1ee('0x3f')][_0xf1ee('0x7c')]=_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x3f')][_0xf1ee('0x7c')];_0x228d4c[_0xf1ee('0x3f')][_0xf1ee('0x7d')]=_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x3f')]['port'];}else{_0x228d4c[_0xf1ee('0x5e')][_0xf1ee('0x7e')]=_0x228d4c[_0xf1ee('0x3f')][_0xf1ee('0x7e')]=_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x75')];_0x228d4c[_0xf1ee('0x5e')][_0xf1ee('0x77')]=_0x228d4c[_0xf1ee('0x3f')]['user']=_0xc52476[_0xf1ee('0x61')][_0xf1ee('0x78')];_0x228d4c[_0xf1ee('0x5e')][_0xf1ee('0x79')]=_0x228d4c[_0xf1ee('0x3f')]['pass']=_0xc52476['body'][_0xf1ee('0x7a')];}return db['MailAccount'][_0xf1ee('0x70')](_0x228d4c,{'include':[{'model':db[_0xf1ee('0x3e')],'as':'Smtp'},{'model':db[_0xf1ee('0x3d')],'as':'Imap'}]})['then'](function(_0x5a5807){var _0x1f8bc1=_0xc52476[_0xf1ee('0x77')]['get']({'plain':!![]});if(!_0x1f8bc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f8bc1[_0xf1ee('0x7f')]==='user'){var _0x364c5e=_0x5a5807[_0xf1ee('0x37')]({'plain':!![]});return db['UserProfileSection'][_0xf1ee('0x60')]({'where':{'name':_0xf1ee('0x38'),'userProfileId':_0x1f8bc1[_0xf1ee('0x80')]},'raw':!![]})['then'](function(_0x108c4f){if(_0x108c4f&&_0x108c4f[_0xf1ee('0x81')]===0x0){return db[_0xf1ee('0x39')]['create']({'name':_0x364c5e[_0xf1ee('0x3b')],'resourceId':_0x364c5e['id'],'type':_0x108c4f[_0xf1ee('0x3b')],'sectionId':_0x108c4f['id']},{})[_0xf1ee('0x20')](function(){return _0x5a5807;});}else{return _0x5a5807;}})[_0xf1ee('0x2b')](function(_0x55e6b2){logger[_0xf1ee('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55e6b2);throw _0x55e6b2;});}return _0x5a5807;})[_0xf1ee('0x20')](respondWithResult(_0x2a0392,0xc9))['catch'](handleError(_0x2a0392,null));};exports[_0xf1ee('0x82')]=function(_0x205377,_0x40900c,_0x4d2b09){return db[_0xf1ee('0x43')][_0xf1ee('0x66')]({'where':{'id':_0x205377['params']['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x40900c,null))[_0xf1ee('0x20')](function(_0x3b52e5){if(_0x3b52e5){return _0x3b52e5['getImap']();}return null;})[_0xf1ee('0x20')](respondWithResult(_0x40900c,null))[_0xf1ee('0x2b')](handleError(_0x40900c,null));};exports[_0xf1ee('0x83')]=function(_0x1cd716,_0x35dbb5,_0x4bdc4e){if(_0x1cd716[_0xf1ee('0x61')]['id']){delete _0x1cd716[_0xf1ee('0x61')]['id'];}return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0x1cd716[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x35dbb5,null))[_0xf1ee('0x20')](function(_0x45cb33){if(_0x45cb33){_0x1cd716[_0xf1ee('0x61')][_0xf1ee('0x64')]=_0x45cb33['id'];return db[_0xf1ee('0x3d')][_0xf1ee('0x70')](_0x1cd716[_0xf1ee('0x61')]);}})[_0xf1ee('0x20')](respondWithResult(_0x35dbb5,null))[_0xf1ee('0x2b')](handleError(_0x35dbb5,null));};exports[_0xf1ee('0x84')]=function(_0x3e9ca3,_0x51b077,_0xae3ac6){return db[_0xf1ee('0x43')][_0xf1ee('0x66')]({'where':{'id':_0x3e9ca3[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x51b077,null))[_0xf1ee('0x20')](function(_0x23ca77){if(_0x23ca77){return _0x23ca77[_0xf1ee('0x85')](null);}return null;})[_0xf1ee('0x20')](respondWithStatusCode(_0x51b077,null))[_0xf1ee('0x2b')](handleError(_0x51b077,null));};exports[_0xf1ee('0x86')]=function(_0x578676,_0x4907a1,_0x482c9f){return db[_0xf1ee('0x43')][_0xf1ee('0x66')]({'where':{'id':_0x578676[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x4907a1,null))[_0xf1ee('0x20')](function(_0x47991f){if(_0x47991f){return _0x47991f['getSmtp']();}return null;})['then'](respondWithResult(_0x4907a1,null))[_0xf1ee('0x2b')](handleError(_0x4907a1,null));};exports[_0xf1ee('0x87')]=function(_0x4dd3fe,_0x30dc4e,_0x192eaa){if(_0x4dd3fe[_0xf1ee('0x61')]['id']){delete _0x4dd3fe[_0xf1ee('0x61')]['id'];}return db[_0xf1ee('0x43')]['find']({'where':{'id':_0x4dd3fe[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x30dc4e,null))[_0xf1ee('0x20')](function(_0x5ebb2f){if(_0x5ebb2f){_0x4dd3fe[_0xf1ee('0x61')]['MailAccountId']=_0x5ebb2f['id'];return db[_0xf1ee('0x3e')][_0xf1ee('0x70')](_0x4dd3fe[_0xf1ee('0x61')]);}})['then'](respondWithResult(_0x30dc4e,null))[_0xf1ee('0x2b')](handleError(_0x30dc4e,null));};exports[_0xf1ee('0x88')]=function(_0x49e99d,_0x399895,_0x3dbebb){return db[_0xf1ee('0x43')][_0xf1ee('0x66')]({'where':{'id':_0x49e99d[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x399895,null))[_0xf1ee('0x20')](function(_0x27998b){if(_0x27998b){return _0x27998b['setSmtp'](null);}return null;})[_0xf1ee('0x20')](respondWithStatusCode(_0x399895,null))['catch'](handleError(_0x399895,null));};exports[_0xf1ee('0x89')]=function(_0x6c0ab6,_0x327051,_0x5c1924){return db[_0xf1ee('0x8a')][_0xf1ee('0x60')]({'where':{'id':_0x6c0ab6['params']['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x327051,null))[_0xf1ee('0x20')](function(_0x43763b){if(_0x43763b){return _0x43763b[_0xf1ee('0x89')](_0x6c0ab6[_0xf1ee('0x61')][_0xf1ee('0x6b')],_[_0xf1ee('0x8b')](_0x6c0ab6[_0xf1ee('0x61')],[_0xf1ee('0x6b'),'id'])||{});}})[_0xf1ee('0x20')](respondWithResult(_0x327051,null))[_0xf1ee('0x2b')](handleError(_0x327051,null));};exports[_0xf1ee('0x8c')]=function(_0x1dbad7,_0x3f7814,_0x3badbf){var _0x2edee8={'raw':![],'where':{}};var _0x6fb820={};var _0x59a6eb={'count':0x0,'rows':[]};return db['MailAccount'][_0xf1ee('0x66')]({'where':{'id':_0x1dbad7[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x3f7814,null))['then'](function(_0x31d2da){if(_0x31d2da){_0x6fb820[_0xf1ee('0x47')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x6fb820[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0x1dbad7[_0xf1ee('0x48')]);_0x6fb820[_0xf1ee('0x4a')]=_[_0xf1ee('0x4b')](_0x6fb820[_0xf1ee('0x47')],_0x6fb820[_0xf1ee('0x48')]);_0x2edee8[_0xf1ee('0x4c')]=_['intersection'](_0x6fb820[_0xf1ee('0x47')],qs[_0xf1ee('0x4d')](_0x1dbad7[_0xf1ee('0x48')]['fields']));_0x2edee8[_0xf1ee('0x4c')]=_0x2edee8[_0xf1ee('0x4c')]['length']?_0x2edee8[_0xf1ee('0x4c')]:_0x6fb820[_0xf1ee('0x47')];if(!_0x1dbad7[_0xf1ee('0x48')]['hasOwnProperty'](_0xf1ee('0x50'))){_0x2edee8[_0xf1ee('0x51')]=qs['limit'](_0x1dbad7[_0xf1ee('0x48')][_0xf1ee('0x51')]);_0x2edee8[_0xf1ee('0x30')]=qs[_0xf1ee('0x30')](_0x1dbad7[_0xf1ee('0x48')][_0xf1ee('0x30')]);}_0x2edee8[_0xf1ee('0x68')]=qs[_0xf1ee('0x69')](_0x1dbad7[_0xf1ee('0x48')][_0xf1ee('0x69')]);_0x2edee8['where']=qs[_0xf1ee('0x4a')](_[_0xf1ee('0x52')](_0x1dbad7[_0xf1ee('0x48')],_0x6fb820[_0xf1ee('0x4a')]));_0x2edee8[_0xf1ee('0x54')][_0xf1ee('0x64')]=_0x31d2da['id'];if(_0x1dbad7[_0xf1ee('0x48')][_0xf1ee('0x53')]){_0x2edee8[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x2edee8['where'],{'$or':_[_0xf1ee('0x42')](_0x2edee8[_0xf1ee('0x4c')],function(_0x43917b){var _0xc88e17={};_0xc88e17[_0x43917b]={'$like':'%'+_0x1dbad7[_0xf1ee('0x48')]['filter']+'%'};return _0xc88e17;})});}_0x2edee8=_[_0xf1ee('0x55')]({},_0x2edee8,_0x1dbad7['options']);return db[_0xf1ee('0x8a')][_0xf1ee('0x57')]({'where':_0x2edee8[_0xf1ee('0x54')]})[_0xf1ee('0x20')](function(_0x28763a){_0x59a6eb[_0xf1ee('0x57')]=_0x28763a;if(_0x1dbad7[_0xf1ee('0x48')]['includeAll']){_0x2edee8[_0xf1ee('0x59')]=[{'model':db[_0xf1ee('0x8d')],'as':'Contact','required':![]},{'model':db[_0xf1ee('0x8e')],'as':_0xf1ee('0x8f'),'attributes':['name',_0xf1ee('0x90'),_0xf1ee('0x91')],'required':![]},{'model':db['Tag'],'as':_0xf1ee('0x92'),'attributes':['id',_0xf1ee('0x3b'),'color'],'where':_0x1dbad7['query'][_0xf1ee('0x93')]?{'id':_0x1dbad7['query'][_0xf1ee('0x93')]}:undefined,'required':_0x1dbad7[_0xf1ee('0x48')][_0xf1ee('0x93')]?!![]:![]}];}return db['MailInteraction'][_0xf1ee('0x5a')](_0x2edee8);})[_0xf1ee('0x20')](function(_0x1ced91){_0x59a6eb['rows']=_0x1ced91;return _0x59a6eb;});}})[_0xf1ee('0x20')](respondWithFilteredResult(_0x3f7814,_0x2edee8))[_0xf1ee('0x2b')](handleError(_0x3f7814,null));};exports[_0xf1ee('0x94')]=function(_0x4ec7b3,_0x25eb05,_0x57fb98){return db['MailAccount'][_0xf1ee('0x66')]({'where':{'id':_0x4ec7b3[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x25eb05,null))['then'](function(_0x2bc39e){if(_0x2bc39e){return db[_0xf1ee('0x95')][_0xf1ee('0x96')](function(_0x54d713){return db[_0xf1ee('0x97')][_0xf1ee('0x36')]({'where':{'MailAccountId':_0x4ec7b3[_0xf1ee('0x5d')]['id']},'transaction':_0x54d713})[_0xf1ee('0x20')](function(_0x30bd0d){var _0x46fa42=_[_0xf1ee('0x42')](_0x4ec7b3[_0xf1ee('0x61')],function(_0x13b90b){_0x13b90b[_0xf1ee('0x64')]=_0x4ec7b3[_0xf1ee('0x5d')]['id'];return _0x13b90b;});return db['MailApplication'][_0xf1ee('0x98')](_0x46fa42,{'transaction':_0x54d713});});})[_0xf1ee('0x20')](function(){return db[_0xf1ee('0x97')][_0xf1ee('0x99')]({'where':{'MailAccountId':_0x4ec7b3['params']['id']},'order':'priority'});});}})[_0xf1ee('0x20')](respondWithResult(_0x25eb05,null))[_0xf1ee('0x2b')](handleError(_0x25eb05,null));};exports[_0xf1ee('0x9a')]=function(_0xbbc73a,_0x1db9e4,_0x35726e){var _0x15e589={};var _0x2cdaf1={};var _0x2b91f0;var _0x593b7c;return db[_0xf1ee('0x43')][_0xf1ee('0x66')]({'where':{'id':_0xbbc73a[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x1db9e4,null))[_0xf1ee('0x20')](function(_0x236175){if(_0x236175){_0x2b91f0=_0x236175;_0x2cdaf1[_0xf1ee('0x47')]=_[_0xf1ee('0x49')](db[_0xf1ee('0x97')][_0xf1ee('0x44')]);_0x2cdaf1[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0xbbc73a[_0xf1ee('0x48')]);_0x2cdaf1[_0xf1ee('0x4a')]=_[_0xf1ee('0x4b')](_0x2cdaf1[_0xf1ee('0x47')],_0x2cdaf1[_0xf1ee('0x48')]);_0x15e589[_0xf1ee('0x4c')]=_[_0xf1ee('0x4b')](_0x2cdaf1[_0xf1ee('0x47')],qs['fields'](_0xbbc73a[_0xf1ee('0x48')][_0xf1ee('0x4d')]));_0x15e589[_0xf1ee('0x4c')]=_0x15e589[_0xf1ee('0x4c')][_0xf1ee('0x4e')]?_0x15e589[_0xf1ee('0x4c')]:_0x2cdaf1[_0xf1ee('0x47')];_0x15e589[_0xf1ee('0x68')]=qs[_0xf1ee('0x69')](_0xbbc73a[_0xf1ee('0x48')][_0xf1ee('0x69')]);_0x15e589[_0xf1ee('0x54')]=qs[_0xf1ee('0x4a')](_[_0xf1ee('0x52')](_0xbbc73a[_0xf1ee('0x48')],_0x2cdaf1[_0xf1ee('0x4a')]));if(_0xbbc73a[_0xf1ee('0x48')][_0xf1ee('0x53')]){_0x15e589['where']=_['merge'](_0x15e589['where'],{'$or':_[_0xf1ee('0x42')](_0x15e589[_0xf1ee('0x4c')],function(_0x12ca86){var _0x259956={};_0x259956[_0x12ca86]={'$like':'%'+_0xbbc73a[_0xf1ee('0x48')]['filter']+'%'};return _0x259956;})});}_0x15e589=_[_0xf1ee('0x55')]({},_0x15e589,_0xbbc73a[_0xf1ee('0x5f')]);return _0x2b91f0[_0xf1ee('0x9a')](_0x15e589);}})[_0xf1ee('0x20')](function(_0x3225fc){if(_0x3225fc){_0x593b7c=_0x3225fc[_0xf1ee('0x4e')];if(!_0xbbc73a['query'][_0xf1ee('0x4f')]('nolimit')){_0x15e589['limit']=qs[_0xf1ee('0x51')](_0xbbc73a[_0xf1ee('0x48')][_0xf1ee('0x51')]);_0x15e589[_0xf1ee('0x30')]=qs[_0xf1ee('0x30')](_0xbbc73a[_0xf1ee('0x48')][_0xf1ee('0x30')]);}return _0x2b91f0['getApplications'](_0x15e589);}})[_0xf1ee('0x20')](function(_0x5a14fc){if(_0x5a14fc){return _0x5a14fc?{'count':_0x593b7c,'rows':_0x5a14fc}:null;}})[_0xf1ee('0x20')](respondWithResult(_0x1db9e4,null))[_0xf1ee('0x2b')](handleError(_0x1db9e4,null));};exports['getMessages']=function(_0x1e885e,_0x45b3b7,_0x132f3e){var _0x426f8d={'raw':!![],'where':{}};var _0x36ac40={};var _0x24b1ab={'count':0x0,'rows':[]};return db[_0xf1ee('0x43')]['findOne']({'where':{'id':_0x1e885e[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x45b3b7,null))[_0xf1ee('0x20')](function(_0x375c65){if(_0x375c65){_0x36ac40[_0xf1ee('0x47')]=_['keys'](db['MailMessage'][_0xf1ee('0x44')]);_0x36ac40[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0x1e885e[_0xf1ee('0x48')]);_0x36ac40[_0xf1ee('0x4a')]=_[_0xf1ee('0x4b')](_0x36ac40[_0xf1ee('0x47')],_0x36ac40[_0xf1ee('0x48')]);_0x426f8d[_0xf1ee('0x4c')]=_[_0xf1ee('0x4b')](_0x36ac40['model'],qs[_0xf1ee('0x4d')](_0x1e885e[_0xf1ee('0x48')]['fields']));_0x426f8d[_0xf1ee('0x4c')]=_0x426f8d['attributes'][_0xf1ee('0x4e')]?_0x426f8d[_0xf1ee('0x4c')]:_0x36ac40[_0xf1ee('0x47')];if(!_0x1e885e['query']['hasOwnProperty']('nolimit')){_0x426f8d[_0xf1ee('0x51')]=qs[_0xf1ee('0x51')](_0x1e885e[_0xf1ee('0x48')]['limit']);_0x426f8d[_0xf1ee('0x30')]=qs['offset'](_0x1e885e[_0xf1ee('0x48')][_0xf1ee('0x30')]);}_0x426f8d[_0xf1ee('0x68')]=qs[_0xf1ee('0x69')](_0x1e885e[_0xf1ee('0x48')][_0xf1ee('0x69')]);_0x426f8d[_0xf1ee('0x54')]=qs[_0xf1ee('0x4a')](_[_0xf1ee('0x52')](_0x1e885e[_0xf1ee('0x48')],_0x36ac40[_0xf1ee('0x4a')]));_0x426f8d[_0xf1ee('0x54')]['MailAccountId']=_0x375c65['id'];if(_0x1e885e[_0xf1ee('0x48')]['filter']){_0x426f8d[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x426f8d[_0xf1ee('0x54')],{'$or':_[_0xf1ee('0x42')](_0x426f8d[_0xf1ee('0x4c')],function(_0x1cc27b){var _0x4df413={};_0x4df413[_0x1cc27b]={'$like':'%'+_0x1e885e[_0xf1ee('0x48')][_0xf1ee('0x53')]+'%'};return _0x4df413;})});}if(_0x1e885e[_0xf1ee('0x48')]['$gte']){var _0x11dd89=_0x1e885e[_0xf1ee('0x48')][_0xf1ee('0x9b')][_0xf1ee('0x9c')](',');var _0x26fb18={};_0x26fb18[_0x11dd89[0x0]]={'$gte':moment(_0x11dd89[0x1])[_0xf1ee('0x9d')](_0xf1ee('0x9e'))};_0x426f8d[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x426f8d[_0xf1ee('0x54')],_0x26fb18);}_0x426f8d=_[_0xf1ee('0x55')]({},_0x426f8d,_0x1e885e[_0xf1ee('0x5f')]);return db[_0xf1ee('0x9f')][_0xf1ee('0x57')]({'where':_0x426f8d[_0xf1ee('0x54')]})[_0xf1ee('0x20')](function(_0x376686){_0x24b1ab[_0xf1ee('0x57')]=_0x376686;if(_0x1e885e[_0xf1ee('0x48')]['includeAll']){_0x426f8d[_0xf1ee('0x59')]=[{'all':!![]}];}return db[_0xf1ee('0x9f')][_0xf1ee('0x5a')](_0x426f8d);})[_0xf1ee('0x20')](function(_0x26e6b7){if(_0x1e885e[_0xf1ee('0x48')][_0xf1ee('0xa0')]==='true'){for(var _0x53277f=0x0;_0x53277f<_0x26e6b7['length'];_0x53277f++){_0x26e6b7[_0x53277f][_0xf1ee('0x61')]=juice(_0x26e6b7[_0x53277f][_0xf1ee('0x61')]);}}_0x24b1ab[_0xf1ee('0x5b')]=_0x26e6b7;return _0x24b1ab;});}})['then'](respondWithFilteredResult(_0x45b3b7,_0x426f8d))[_0xf1ee('0x2b')](handleError(_0x45b3b7,null));};exports[_0xf1ee('0xa1')]=function(_0x3b58b0,_0x4ab902,_0x749603){var _0x5ba754,_0x5d38de={},_0x28a0d3;if(_0x3b58b0[_0xf1ee('0x61')]['to']){_0x28a0d3=_0x3b58b0['body']['to'][_0xf1ee('0x9c')](',')[0x0];}return db['MailAccount'][_0xf1ee('0x60')]({'where':{'id':_0x3b58b0[_0xf1ee('0x5d')]['id']},'include':[{'model':db[_0xf1ee('0xa2')],'as':'List','include':[{'model':db[_0xf1ee('0x8d')],'as':_0xf1ee('0xa3'),'where':{'email':_0x28a0d3},'limit':0x1,'order':[[_0xf1ee('0xa4'),_0xf1ee('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0xf1ee('0x3f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x4ab902,null))[_0xf1ee('0x20')](function(_0x1e67f3){if(_0x1e67f3){_0x5ba754=_0x1e67f3;if(_0x1e67f3['Smtp']){if(_['isNil'](_0x3b58b0[_0xf1ee('0x61')]['from'])){_0x3b58b0['body'][_0xf1ee('0xa6')]=util[_0xf1ee('0x9d')](_0xf1ee('0xa7'),_0x1e67f3[_0xf1ee('0x3b')],_0x1e67f3[_0xf1ee('0xa8')]||_0x1e67f3[_0xf1ee('0x3f')][_0xf1ee('0x77')]);}if(_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xa9')]&&_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xa9')][_0xf1ee('0x4e')]){for(var _0x2699bc=0x0;_0x2699bc<_0x3b58b0['body'][_0xf1ee('0xa9')][_0xf1ee('0x4e')];_0x2699bc+=0x1){_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xa9')][_0x2699bc]={'filename':_0x3b58b0[_0xf1ee('0x61')]['attachments'][_0x2699bc][_0xf1ee('0x3b')],'path':path[_0xf1ee('0xaa')](config['root'],_0xf1ee('0xab'),_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xa9')][_0x2699bc][_0xf1ee('0xac')])};}}var _0x1721bd={'tls':{'rejectUnauthorized':![]}};if(_[_0xf1ee('0x72')](_0x1e67f3[_0xf1ee('0x3f')]['service'])){if(_0x1e67f3['Smtp']['authentication']){_0x1721bd[_0xf1ee('0xad')]={'user':_0x1e67f3['Smtp'][_0xf1ee('0x77')],'pass':_0x1e67f3[_0xf1ee('0x3f')]['pass']};}_0x1721bd[_0xf1ee('0x7c')]=_0x1e67f3['Smtp'][_0xf1ee('0x7c')];_0x1721bd['port']=_0x1e67f3[_0xf1ee('0x3f')][_0xf1ee('0x7d')];_0x1721bd[_0xf1ee('0xae')]=_0x1e67f3[_0xf1ee('0x3f')]['secure'];}else{_0x1721bd[_0xf1ee('0x7e')]=_0x1e67f3[_0xf1ee('0x3f')][_0xf1ee('0x7e')];_0x1721bd[_0xf1ee('0xad')]={'user':_0x1e67f3[_0xf1ee('0x3f')][_0xf1ee('0x77')],'pass':_0x1e67f3[_0xf1ee('0x3f')]['pass']};}return respondWithRpcPromise(_0xf1ee('0xaf'),_0xf1ee('0xb0'),{'account':_0x1721bd,'message':_0x3b58b0[_0xf1ee('0x61')]});}else{throw new Error(_0xf1ee('0xb1'));}}})[_0xf1ee('0x20')](function(_0x4ad555){if(_0x4ad555){_0x5d38de=_0x4ad555;if(_0x5ba754['List']){if(_0x5ba754[_0xf1ee('0xb2')]['Contacts'][_0xf1ee('0x4e')]){return _0x5ba754[_0xf1ee('0xb2')][_0xf1ee('0xa3')][0x0];}else{return db[_0xf1ee('0x8d')][_0xf1ee('0x70')](_['defaults'](_0x3b58b0['body'],{'firstName':_0x3b58b0[_0xf1ee('0x61')]['to'],'email':_0x3b58b0[_0xf1ee('0x61')]['to'],'phone':_0x3b58b0[_0xf1ee('0x61')]['to'],'ListId':_0x5ba754[_0xf1ee('0xb3')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xf1ee('0x20')](function(_0x53c5d9){if(_0x53c5d9){var _0x17c4a2={'UserId':_0x3b58b0[_0xf1ee('0x77')]['id'],'ContactId':_0x53c5d9['id'],'MailAccountId':_0x5ba754['id'],'inReplyTo':_0x5d38de['messageId'],'to':_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xa6')],'cc':_0x3b58b0['body']['cc'],'subject':_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xb4')],'attach':_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xb5')],'firstMsgDirection':_0xf1ee('0xb6'),'lastMsgAt':moment()[_0xf1ee('0x9d')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0x61')],'Messages':[_['merge'](_0x3b58b0[_0xf1ee('0x61')],{'messageId':_0x5d38de[_0xf1ee('0xb7')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5ba754['id'],'UserId':_0x3b58b0['user']['id'],'ContactId':_0x53c5d9['id']})]};if(_0x3b58b0[_0xf1ee('0x61')][_0xf1ee('0xb8')]){_0x17c4a2=_['merge'](_0x17c4a2,_0x3b58b0[_0xf1ee('0x61')]['Interaction']);}return db[_0xf1ee('0x8a')]['create'](_0x17c4a2,{'include':[{'model':db[_0xf1ee('0x9f')],'as':'Messages'}]});}})[_0xf1ee('0x20')](respondWithResult(_0x4ab902,null))['catch'](handleError(_0x4ab902,null));};exports[_0xf1ee('0xb9')]=function(_0xdb4803,_0x568e3d,_0x5578ec){return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0xdb4803[_0xf1ee('0x5d')]['id']},'include':[{'model':db[_0xf1ee('0x3e')],'as':_0xf1ee('0x3f'),'raw':!![]}]})[_0xf1ee('0x20')](handleEntityNotFound(_0x568e3d,null))[_0xf1ee('0x20')](function(_0xc2db81){if(_0xc2db81&&_0xc2db81[_0xf1ee('0x3f')]){var _0x2a7a85={'id':_0xc2db81['id'],'tls':{'rejectUnauthorized':![]}};if(_0xc2db81[_0xf1ee('0x3f')][_0xf1ee('0x7e')]){_0x2a7a85['service']=_0xc2db81[_0xf1ee('0x3f')][_0xf1ee('0x7e')];}else{_0x2a7a85[_0xf1ee('0x7c')]=_0xc2db81[_0xf1ee('0x3f')][_0xf1ee('0x7c')];_0x2a7a85[_0xf1ee('0x7d')]=_0xc2db81[_0xf1ee('0x3f')][_0xf1ee('0x7d')];_0x2a7a85[_0xf1ee('0xae')]=_0xc2db81[_0xf1ee('0x3f')][_0xf1ee('0xae')];}if(_0xc2db81['Smtp'][_0xf1ee('0x7b')]){_0x2a7a85['auth']={'user':_0xc2db81[_0xf1ee('0x3f')][_0xf1ee('0x77')],'pass':_0xc2db81['Smtp'][_0xf1ee('0xba')]};}return respondWithRpcPromise(_0xf1ee('0xbb'),'verifySmtp',{'account':_0x2a7a85});}})[_0xf1ee('0x20')](respondWithResult(_0x568e3d,null))[_0xf1ee('0x2b')](handleError(_0x568e3d,null));};exports[_0xf1ee('0x36')]=function(_0x4fecf7,_0x30fed0){return db[_0xf1ee('0x43')]['find']({'where':{'id':_0x4fecf7['params']['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x30fed0,null))[_0xf1ee('0x20')](function(_0x280a37){if(_0x280a37&&_0x280a37['service']){throw new db[(_0xf1ee('0xbc'))][(_0xf1ee('0xbd'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x280a37;})[_0xf1ee('0x20')](removeEntity(_0x30fed0,null))[_0xf1ee('0x2b')](handleError(_0x30fed0,null));};exports[_0xf1ee('0xbe')]=function(_0x456586,_0x2a803d,_0x6ae20c){return db[_0xf1ee('0x43')][_0xf1ee('0x60')]({'where':{'id':_0x456586['params']['id']}})['then'](handleEntityNotFound(_0x2a803d,null))[_0xf1ee('0x20')](function(_0x4fc2f0){if(_0x4fc2f0){return _0x4fc2f0[_0xf1ee('0xbe')](_0x456586[_0xf1ee('0x61')][_0xf1ee('0x6b')],_[_0xf1ee('0x8b')](_0x456586['body'],[_0xf1ee('0x6b'),'id'])||{})[_0xf1ee('0xbf')](function(_0x2c8dd0){for(var _0x1fea35=0x0;_0x1fea35<_0x456586[_0xf1ee('0x61')][_0xf1ee('0x6b')]['length'];_0x1fea35+=0x1){socket[_0xf1ee('0xc0')](_0xf1ee('0xc1'),{'UserId':_0x456586['body'][_0xf1ee('0x6b')][_0x1fea35],'MailAccountId':_0x456586[_0xf1ee('0x5d')]['id']});}return _0x2c8dd0;});}})['then'](respondWithResult(_0x2a803d,null))[_0xf1ee('0x2b')](handleError(_0x2a803d,null));};exports[_0xf1ee('0xc2')]=function(_0x9cbd0b,_0x35c98f,_0xf60484){return db['MailAccount'][_0xf1ee('0x60')]({'where':{'id':_0x9cbd0b[_0xf1ee('0x5d')]['id']}})[_0xf1ee('0x20')](handleEntityNotFound(_0x35c98f,null))[_0xf1ee('0x20')](function(_0x53fb81){if(_0x53fb81){return _0x53fb81[_0xf1ee('0xc2')](_0x9cbd0b[_0xf1ee('0x48')][_0xf1ee('0x6b')])[_0xf1ee('0x20')](function(){if(_[_0xf1ee('0xc3')](_0x9cbd0b[_0xf1ee('0x48')]['ids'])){for(var _0x3d1a3d=0x0;_0x3d1a3d<_0x9cbd0b['query'][_0xf1ee('0x6b')]['length'];_0x3d1a3d+=0x1){socket[_0xf1ee('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x9cbd0b[_0xf1ee('0x48')][_0xf1ee('0x6b')][_0x3d1a3d]),'MailAccountId':Number(_0x9cbd0b[_0xf1ee('0x5d')]['id'])});}}else{socket[_0xf1ee('0xc0')](_0xf1ee('0xc4'),{'UserId':Number(_0x9cbd0b[_0xf1ee('0x48')][_0xf1ee('0x6b')]),'MailAccountId':Number(_0x9cbd0b[_0xf1ee('0x5d')]['id'])});}});}})[_0xf1ee('0x20')](respondWithStatusCode(_0x35c98f,null))[_0xf1ee('0x2b')](handleError(_0x35c98f,null));};exports[_0xf1ee('0xc5')]=function(_0x373d27,_0x1baa27,_0x544766){var _0x1328f7={};var _0x3c71db={};var _0x346d6d;var _0x2a954f;return db[_0xf1ee('0x43')]['findOne']({'where':{'id':_0x373d27[_0xf1ee('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1baa27,null))[_0xf1ee('0x20')](function(_0x3493f3){if(_0x3493f3){_0x346d6d=_0x3493f3;_0x3c71db['model']=_['keys'](db[_0xf1ee('0x8e')][_0xf1ee('0x44')]);_0x3c71db[_0xf1ee('0x48')]=_[_0xf1ee('0x49')](_0x373d27['query']);_0x3c71db['filters']=_[_0xf1ee('0x4b')](_0x3c71db[_0xf1ee('0x47')],_0x3c71db[_0xf1ee('0x48')]);_0x1328f7[_0xf1ee('0x4c')]=_['intersection'](_0x3c71db['model'],qs[_0xf1ee('0x4d')](_0x373d27[_0xf1ee('0x48')][_0xf1ee('0x4d')]));_0x1328f7[_0xf1ee('0x4c')]=_0x1328f7[_0xf1ee('0x4c')][_0xf1ee('0x4e')]?_0x1328f7[_0xf1ee('0x4c')]:_0x3c71db['model'];_0x1328f7['order']=qs[_0xf1ee('0x69')](_0x373d27['query']['sort']);_0x1328f7[_0xf1ee('0x54')]=qs[_0xf1ee('0x4a')](_[_0xf1ee('0x52')](_0x373d27[_0xf1ee('0x48')],_0x3c71db[_0xf1ee('0x4a')]));if(_0x373d27[_0xf1ee('0x48')][_0xf1ee('0x53')]){_0x1328f7[_0xf1ee('0x54')]=_[_0xf1ee('0x55')](_0x1328f7[_0xf1ee('0x54')],{'$or':_[_0xf1ee('0x42')](_0x1328f7['attributes'],function(_0x600abc){var _0x5bfe62={};_0x5bfe62[_0x600abc]={'$like':'%'+_0x373d27['query'][_0xf1ee('0x53')]+'%'};return _0x5bfe62;})});}_0x1328f7=_['merge']({},_0x1328f7,_0x373d27[_0xf1ee('0x5f')]);return _0x346d6d['getAgents'](_0x1328f7);}})['then'](function(_0x2ac2bf){if(_0x2ac2bf){_0x2a954f=_0x2ac2bf['length'];if(!_0x373d27[_0xf1ee('0x48')][_0xf1ee('0x4f')](_0xf1ee('0x50'))){_0x1328f7[_0xf1ee('0x51')]=qs[_0xf1ee('0x51')](_0x373d27[_0xf1ee('0x48')][_0xf1ee('0x51')]);_0x1328f7[_0xf1ee('0x30')]=qs[_0xf1ee('0x30')](_0x373d27['query'][_0xf1ee('0x30')]);}return _0x346d6d['getAgents'](_0x1328f7);}})[_0xf1ee('0x20')](function(_0x31d591){if(_0x31d591){return _0x31d591?{'count':_0x2a954f,'rows':_0x31d591}:null;}})[_0xf1ee('0x20')](respondWithResult(_0x1baa27,null))[_0xf1ee('0x2b')](handleError(_0x1baa27,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 8db7424..c85f724 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 _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 +var _0x9fb1=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9fb1,0xe6));var _0x19fb=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x9fb1[_0x1beef3];return _0x5af964;};'use strict';var EventEmitter=require(_0x19fb('0x0'));var MailAccount=require(_0x19fb('0x1'))['db'][_0x19fb('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x19fb('0x3')](0x0);var events={'afterCreate':_0x19fb('0x4'),'afterUpdate':_0x19fb('0x5'),'afterDestroy':_0x19fb('0x6')};function emitEvent(_0x20134e){return function(_0x67af83,_0x5cf30f,_0x1ad96c){MailAccountEvents[_0x19fb('0x7')](_0x20134e+':'+_0x67af83['id'],_0x67af83);MailAccountEvents[_0x19fb('0x7')](_0x20134e,_0x67af83);_0x1ad96c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x19fb('0x8')](e,emitEvent(event));}}module[_0x19fb('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 52496c7..cabdcf1 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 _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 +var _0x0c53=['MailAccount','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailAccount.attributes','exports','define'];(function(_0x4596ca,_0x406b0f){var _0x39c663=function(_0x2ff35a){while(--_0x2ff35a){_0x4596ca['push'](_0x4596ca['shift']());}};_0x39c663(++_0x406b0f);}(_0x0c53,0x1e1));var _0x30c5=function(_0xec344a,_0x5a2288){_0xec344a=_0xec344a-0x0;var _0x57f429=_0x0c53[_0xec344a];return _0x57f429;};'use strict';var _=require(_0x30c5('0x0'));var util=require(_0x30c5('0x1'));var logger=require('../../config/logger')(_0x30c5('0x2'));var moment=require(_0x30c5('0x3'));var BPromise=require(_0x30c5('0x4'));var rp=require(_0x30c5('0x5'));var fs=require('fs');var path=require(_0x30c5('0x6'));var rimraf=require('rimraf');var config=require(_0x30c5('0x7'));var attributes=require(_0x30c5('0x8'));module[_0x30c5('0x9')]=function(_0x5508f7,_0x3e7c18){return _0x5508f7[_0x30c5('0xa')](_0x30c5('0xb'),attributes,{'tableName':'mail_accounts','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 42a87ad..8046145 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 _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 +var _0xc820=['priority','asc','autoclose','push','length','close','Contacts','create','contact','messageId','generate','subject','attach','format','inReplyTo','Contact\x20not\x20found','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','originTo','originCc','Attachments','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','GetMailAccount','findAll','options','raw','attributes','limit','include','map','model','ShowMailAccount','MailAccount','where','stringify','catch','NotifyMailAccount','body','difference','keys','CmContact','updatedAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','List','DESC','MailApplication','Applications','Smtp','get','applications','orderBy'];(function(_0x53d0b9,_0x367cb9){var _0xc97e61=function(_0x155dc7){while(--_0x155dc7){_0x53d0b9['push'](_0x53d0b9['shift']());}};_0xc97e61(++_0x367cb9);}(_0xc820,0x13f));var _0x0c82=function(_0xa2bcdd,_0x2304c9){_0xa2bcdd=_0xa2bcdd-0x0;var _0x3232c1=_0xc820[_0xa2bcdd];return _0x3232c1;};'use strict';var _=require('lodash');var util=require(_0x0c82('0x0'));var moment=require(_0x0c82('0x1'));var BPromise=require(_0x0c82('0x2'));var rs=require(_0x0c82('0x3'));var fs=require('fs');var Redis=require(_0x0c82('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c82('0x5'));var logger=require('../../config/logger')(_0x0c82('0x6'));var config=require(_0x0c82('0x7'));var jayson=require(_0x0c82('0x8'));var client=jayson[_0x0c82('0x9')][_0x0c82('0xa')]({'port':0x232c});config[_0x0c82('0xb')]=_[_0x0c82('0xc')](config[_0x0c82('0xb')],{'host':_0x0c82('0xd'),'port':0x18eb});var socket=require(_0x0c82('0xe'))(new Redis(config[_0x0c82('0xb')]));require(_0x0c82('0xf'))[_0x0c82('0x10')](socket);function respondWithRpcPromise(_0x39f084,_0x4d14b1,_0x8c568){return new BPromise(function(_0xc0790d,_0x6a8d30){return client[_0x0c82('0x11')](_0x39f084,_0x8c568)[_0x0c82('0x12')](function(_0xc9ad4f){logger[_0x0c82('0x13')](_0x0c82('0x14'),_0x4d14b1,_0x0c82('0x15'));logger[_0x0c82('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4d14b1,_0x0c82('0x15'),JSON['stringify'](_0xc9ad4f));if(_0xc9ad4f['error']){if(_0xc9ad4f[_0x0c82('0x17')][_0x0c82('0x18')]===0x1f4){logger[_0x0c82('0x17')](_0x0c82('0x14'),_0x4d14b1,_0xc9ad4f[_0x0c82('0x17')]['message']);return _0x6a8d30(_0xc9ad4f[_0x0c82('0x17')][_0x0c82('0x19')]);}logger[_0x0c82('0x17')]('MailAccount,\x20%s,\x20%s',_0x4d14b1,_0xc9ad4f[_0x0c82('0x17')]['message']);return _0xc0790d(_0xc9ad4f[_0x0c82('0x17')][_0x0c82('0x19')]);}else{logger[_0x0c82('0x13')]('MailAccount,\x20%s,\x20%s',_0x4d14b1,'request\x20sent');_0xc0790d(_0xc9ad4f[_0x0c82('0x1a')][_0x0c82('0x19')]);}})['catch'](function(_0xf45a81){logger['error'](_0x0c82('0x14'),_0x4d14b1,_0xf45a81);_0x6a8d30(_0xf45a81);});});}exports[_0x0c82('0x1b')]=function(_0x54ebad){var _0x38c7f6=this;return new Promise(function(_0x49db4c,_0x3ec9aa){return db['MailAccount'][_0x0c82('0x1c')]({'raw':_0x54ebad[_0x0c82('0x1d')]?_0x54ebad['options'][_0x0c82('0x1e')]===undefined?!![]:![]:!![],'where':_0x54ebad[_0x0c82('0x1d')]?_0x54ebad[_0x0c82('0x1d')]['where']||null:null,'attributes':_0x54ebad[_0x0c82('0x1d')]?_0x54ebad[_0x0c82('0x1d')][_0x0c82('0x1f')]||null:null,'limit':_0x54ebad[_0x0c82('0x1d')]?_0x54ebad['options'][_0x0c82('0x20')]||null:null,'include':_0x54ebad[_0x0c82('0x1d')]?_0x54ebad[_0x0c82('0x1d')][_0x0c82('0x21')]?_[_0x0c82('0x22')](_0x54ebad[_0x0c82('0x1d')][_0x0c82('0x21')],function(_0x590553){return{'model':db[_0x590553[_0x0c82('0x23')]],'as':_0x590553['as'],'attributes':_0x590553[_0x0c82('0x1f')],'include':_0x590553['include']?_[_0x0c82('0x22')](_0x590553['include'],function(_0x51bfc3){return{'model':db[_0x51bfc3[_0x0c82('0x23')]],'as':_0x51bfc3['as'],'attributes':_0x51bfc3[_0x0c82('0x1f')],'include':_0x51bfc3[_0x0c82('0x21')]?_[_0x0c82('0x22')](_0x51bfc3[_0x0c82('0x21')],function(_0x16e074){return{'model':db[_0x16e074['model']],'as':_0x16e074['as'],'attributes':_0x16e074[_0x0c82('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x548e98){logger[_0x0c82('0x13')]('GetMailAccount',_0x54ebad);logger['debug'](_0x0c82('0x1b'),_0x54ebad,JSON['stringify'](_0x548e98));_0x49db4c(_0x548e98);})['catch'](function(_0x566e08){logger[_0x0c82('0x17')](_0x0c82('0x1b'),_0x566e08[_0x0c82('0x19')],_0x54ebad);_0x3ec9aa(_0x38c7f6[_0x0c82('0x17')](0x1f4,_0x566e08[_0x0c82('0x19')]));});});};exports[_0x0c82('0x24')]=function(_0x2bbcbf){var _0x3ceea0=this;return new Promise(function(_0xfb61b8,_0x10cbfe){return db[_0x0c82('0x25')]['find']({'raw':_0x2bbcbf['options']?_0x2bbcbf[_0x0c82('0x1d')][_0x0c82('0x1e')]===undefined?!![]:![]:!![],'where':_0x2bbcbf[_0x0c82('0x1d')]?_0x2bbcbf[_0x0c82('0x1d')][_0x0c82('0x26')]||null:null,'attributes':_0x2bbcbf[_0x0c82('0x1d')]?_0x2bbcbf[_0x0c82('0x1d')]['attributes']||null:null,'include':_0x2bbcbf[_0x0c82('0x1d')]?_0x2bbcbf[_0x0c82('0x1d')]['include']?_[_0x0c82('0x22')](_0x2bbcbf['options']['include'],function(_0x14c044){return{'model':db[_0x14c044['model']],'as':_0x14c044['as'],'attributes':_0x14c044['attributes'],'include':_0x14c044[_0x0c82('0x21')]?_[_0x0c82('0x22')](_0x14c044[_0x0c82('0x21')],function(_0xaf3f1b){return{'model':db[_0xaf3f1b[_0x0c82('0x23')]],'as':_0xaf3f1b['as'],'attributes':_0xaf3f1b[_0x0c82('0x1f')],'include':_0xaf3f1b['include']?_['map'](_0xaf3f1b[_0x0c82('0x21')],function(_0x32597d){return{'model':db[_0x32597d[_0x0c82('0x23')]],'as':_0x32597d['as'],'attributes':_0x32597d['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c82('0x12')](function(_0x39eebb){logger['info'](_0x0c82('0x24'),_0x2bbcbf);logger[_0x0c82('0x16')]('ShowMailAccount',_0x2bbcbf,JSON[_0x0c82('0x27')](_0x39eebb));_0xfb61b8(_0x39eebb);})[_0x0c82('0x28')](function(_0x41a569){logger[_0x0c82('0x17')]('ShowMailAccount',_0x41a569[_0x0c82('0x19')],_0x2bbcbf);_0x10cbfe(_0x3ceea0[_0x0c82('0x17')](0x1f4,_0x41a569[_0x0c82('0x19')]));});});};exports[_0x0c82('0x29')]=function(_0x3c8103){var _0x2fa180=this;return new Promise(function(_0x46c789,_0x5a7242){var _0x24e35c={'body':_0x3c8103[_0x0c82('0x2a')],'channel':'mail'};var _0x1ad7f5=_[_0x0c82('0x2b')](_[_0x0c82('0x2c')](db[_0x0c82('0x2d')]['rawAttributes']),['createdAt',_0x0c82('0x2e'),'CompanyId',_0x0c82('0x2f')]);var _0xe53ca2=![];if(_0x3c8103[_0x0c82('0x2a')]['id']){delete _0x3c8103['body']['id'];}if(_['isNil'](_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x30')])){return _0x5a7242(_0x2fa180[_0x0c82('0x17')](0x1f4,_0x0c82('0x31')));}if(_[_0x0c82('0x32')](_0x3c8103['body']['body'])||_0x3c8103[_0x0c82('0x2a')]['body']===''){return _0x5a7242(_0x2fa180['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0c82('0x32')](_0x3c8103[_0x0c82('0x2a')]['mapKey'])){return _0x5a7242(_0x2fa180[_0x0c82('0x17')](0x1f4,_0x0c82('0x33')+_0x1ad7f5));}if(!_[_0x0c82('0x34')](_0x1ad7f5,_0x3c8103['body']['mapKey'])){return _0x5a7242(_0x2fa180[_0x0c82('0x17')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1ad7f5));}var _0x28d415={};_0x28d415[_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x35')]]=_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x30')];return db[_0x0c82('0x25')][_0x0c82('0x36')]({'where':{'id':_0x3c8103[_0x0c82('0x37')]['id']},'include':[{'model':db[_0x0c82('0x38')],'as':_0x0c82('0x39'),'include':[{'model':db[_0x0c82('0x2d')],'as':'Contacts','where':_0x28d415,'limit':0x1,'order':[['updatedAt',_0x0c82('0x3a')]]}]},{'model':db[_0x0c82('0x3b')],'as':_0x0c82('0x3c')},{'model':db['MailServerOut'],'as':_0x0c82('0x3d')}]})[_0x0c82('0x12')](function(_0x37e7d8){if(_0x37e7d8&&_0x37e7d8['List']){var _0x482de3=_0x37e7d8[_0x0c82('0x3e')]({'plain':!![]});_0x24e35c[_0x0c82('0x37')]=_['omit'](_0x482de3,[_0x0c82('0x3c'),'List']);_0x24e35c[_0x0c82('0x3f')]=_0x482de3[_0x0c82('0x3c')];_0x24e35c['list']=_0x482de3[_0x0c82('0x39')];_0x24e35c[_0x0c82('0x3f')]=_[_0x0c82('0x40')](_0x24e35c[_0x0c82('0x3f')],[_0x0c82('0x41')],[_0x0c82('0x42')]);if(_0x24e35c['account']&&_0x24e35c['account'][_0x0c82('0x43')]){_0x24e35c[_0x0c82('0x3f')][_0x0c82('0x44')]({'id':0x0,'priority':_0x24e35c[_0x0c82('0x3f')][_0x0c82('0x45')]+0x1,'app':_0x0c82('0x46'),'appdata':_0x0c82('0x43'),'interval':'*,*,*,*'});}if(_0x24e35c['account'][_0x0c82('0x3c')]){delete _0x24e35c['account'][_0x0c82('0x3c')];}if(_0x24e35c[_0x0c82('0x37')]['List']){delete _0x24e35c[_0x0c82('0x37')][_0x0c82('0x39')];}if(_0x482de3[_0x0c82('0x39')][_0x0c82('0x47')]['length']){return _0x482de3[_0x0c82('0x39')][_0x0c82('0x47')][0x0];}var _0x401a3c=_[_0x0c82('0xc')](_0x3c8103[_0x0c82('0x2a')],{'firstName':_0x3c8103['body'][_0x0c82('0x30')],'ListId':_0x482de3[_0x0c82('0x2f')]});_0x401a3c[_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x35')]]=_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x30')];return db[_0x0c82('0x2d')][_0x0c82('0x48')](_0x401a3c);}else{throw new Error('List\x20not\x20found');}})[_0x0c82('0x12')](function(_0x9986f5){_0x24e35c[_0x0c82('0x49')]=_0x9986f5;if(_0x9986f5){if(!_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4a')]){_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4a')]=rs[_0x0c82('0x4b')]()+'\x20'+_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x30')];}var _0x5a0407={'ContactId':_0x9986f5['id'],'MailAccountId':_0x3c8103[_0x0c82('0x37')]['id'],'inReplyTo':_0x3c8103[_0x0c82('0x2a')]['message'][_0x0c82('0x4a')],'to':_0x3c8103['body']['message']['from'],'cc':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')]['cc'],'subject':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4c')],'attach':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4d')],'lastMsgAt':moment()[_0x0c82('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x3c8103[_0x0c82('0x2a')]['body']};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x3c8103['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x0c82('0x4a')],'where':{'messageId':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4f')]}}]})[_0x0c82('0x12')](function(_0x589d6d){if(_0x589d6d){return[_0x589d6d,![]];}return db['MailInteraction']['create'](_0x5a0407)[_0x0c82('0x12')](function(_0x52c168){return[_0x52c168,!![]];});});}else{throw new Error(_0x0c82('0x50'));}})['spread'](function(_0x573cb2,_0x37d13c){if(_0x573cb2){_0xe53ca2=_0x37d13c;if(!_0x37d13c){return _0x573cb2[_0x0c82('0x51')]({'inReplyTo':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')]['messageId'],'to':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x30')],'cc':_0x3c8103['body'][_0x0c82('0x19')]['cc'],'subject':_0x3c8103['body'][_0x0c82('0x19')][_0x0c82('0x4c')],'attach':_0x573cb2[_0x0c82('0x4d')]?_0x573cb2['attach']:_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4d')],'substatus':null,'substatusAt':moment()[_0x0c82('0x4e')](_0x0c82('0x52')),'lastMsgAt':moment()[_0x0c82('0x4e')](_0x0c82('0x52')),'lastMsgDirection':'in','lastMsgBody':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x2a')]});}else{return _0x573cb2;}}})[_0x0c82('0x12')](function(_0x1f8c33){_0x24e35c[_0x0c82('0x53')]=_0x1f8c33[_0x0c82('0x3e')]({'plain':!![]});_0x24e35c['interaction'][_0x0c82('0x54')]=_0xe53ca2;return db['MailMessage']['create']({'body':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x2a')],'MailAccountId':_0x3c8103[_0x0c82('0x37')]['id'],'MailInteractionId':_0x1f8c33['id'],'direction':'in','ContactId':_0x24e35c[_0x0c82('0x49')]['id'],'messageId':_0x3c8103['body'][_0x0c82('0x19')][_0x0c82('0x4a')],'from':_0x3c8103[_0x0c82('0x2a')]['message'][_0x0c82('0x30')],'to':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')]['to'],'cc':_0x3c8103['body']['message']['cc'],'subject':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4c')],'attach':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x4d')],'Attachments':_0x3c8103[_0x0c82('0x2a')]['message']['attachments'],'originTo':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x55')],'originCc':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')][_0x0c82('0x56')],'bcc':_0x3c8103[_0x0c82('0x2a')][_0x0c82('0x19')]['bcc']},{'include':[{'model':db['Attachment'],'as':_0x0c82('0x57')}]});})[_0x0c82('0x12')](function(_0x2bd532){_0x24e35c[_0x0c82('0x19')]=_0x2bd532;if(_0x24e35c[_0x0c82('0x53')][_0x0c82('0x58')]){return db[_0x0c82('0x59')]['find']({'attributes':['id','name'],'where':{'id':_0x24e35c[_0x0c82('0x53')]['UserId']}})[_0x0c82('0x12')](function(_0x348bd0){if(_0x348bd0){_0x24e35c[_0x0c82('0x3f')][_0x0c82('0x5a')]({'id':0x0,'priority':0x0,'app':_0x0c82('0x5b'),'appdata':_0x348bd0['name']+','+(_0x24e35c[_0x0c82('0x37')][_0x0c82('0x5c')]||0xa),'interval':_0x0c82('0x5d')});}return respondWithRpcPromise(_0x0c82('0x5e'),_0x0c82('0x5f'),_0x24e35c);});}return respondWithRpcPromise(_0x0c82('0x5e'),'startRouting',_0x24e35c);})[_0x0c82('0x12')](function(_0x1ac7f3){_0x46c789(_0x1ac7f3);})[_0x0c82('0x28')](function(_0x199a46){_0x5a7242(_0x2fa180[_0x0c82('0x17')](0x1f4,_0x199a46[_0x0c82('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9fbcf2d..b96eec2 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 _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 +var _0x34aa=['update','emit','removeListener','register','length','./mailAccount.events','remove'];(function(_0x29fcaf,_0x20c943){var _0x4adcb2=function(_0x59e82a){while(--_0x59e82a){_0x29fcaf['push'](_0x29fcaf['shift']());}};_0x4adcb2(++_0x20c943);}(_0x34aa,0x171));var _0xa34a=function(_0x810025,_0x34bb04){_0x810025=_0x810025-0x0;var _0x4dbc81=_0x34aa[_0x810025];return _0x4dbc81;};'use strict';var MailAccountEvents=require(_0xa34a('0x0'));var events=['save',_0xa34a('0x1'),_0xa34a('0x2')];function createListener(_0xbb3857,_0x1fc924){return function(_0x496e55){_0x1fc924[_0xa34a('0x3')](_0xbb3857,_0x496e55);};}function removeListener(_0x30f3a2,_0x284561){return function(){MailAccountEvents[_0xa34a('0x4')](_0x30f3a2,_0x284561);};}exports[_0xa34a('0x5')]=function(_0x475f8f){for(var _0x27349c=0x0,_0x43f9ea=events[_0xa34a('0x6')];_0x27349c<_0x43f9ea;_0x27349c++){var _0x45f2b4=events[_0x27349c];var _0x467864=createListener('mailAccount:'+_0x45f2b4,_0x475f8f);MailAccountEvents['on'](_0x45f2b4,_0x467864);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 2d9feec..0ea45d6 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 _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 +var _0x0713=['/:id','isAuthenticated','show','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','get'];(function(_0x301ee2,_0x3ef260){var _0x235e98=function(_0x410b7e){while(--_0x410b7e){_0x301ee2['push'](_0x301ee2['shift']());}};_0x235e98(++_0x3ef260);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')](_0x3071('0x8'),auth[_0x3071('0x9')](),controller[_0x3071('0xa')]);router[_0x3071('0xb')](_0x3071('0x8'),auth[_0x3071('0x9')](),controller[_0x3071('0xc')]);router[_0x3071('0xd')](_0x3071('0x8'),auth[_0x3071('0x9')](),controller['destroy']);module[_0x3071('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 c94f4ca..4b039f1 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 _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 +var _0x1e9b=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x1a72b5,_0x1507d9){var _0x269d36=function(_0x8a7d18){while(--_0x8a7d18){_0x1a72b5['push'](_0x1a72b5['shift']());}};_0x269d36(++_0x1507d9);}(_0x1e9b,0xec));var _0xb1e9=function(_0x47c39a,_0x165a5d){_0x47c39a=_0x47c39a-0x0;var _0x590928=_0x1e9b[_0x47c39a];return _0x590928;};'use strict';var Sequelize=require(_0xb1e9('0x0'));module[_0xb1e9('0x1')]={'priority':{'type':Sequelize[_0xb1e9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb1e9('0x3')],'allowNull':![],'defaultValue':_0xb1e9('0x4')},'appdata':{'type':Sequelize[_0xb1e9('0x5')]()},'description':{'type':Sequelize[_0xb1e9('0x3')]},'interval':{'type':Sequelize[_0xb1e9('0x3')],'defaultValue':_0xb1e9('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c0ec395..e58e7ef 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 _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 +var _0xeae6=['end','json','offset','limit','set','Content-Range','apply','update','then','sendStatus','error','stack','name','send','params','model','MailApplication','rawAttributes','keys','filters','intersection','query','attributes','length','includeAll','include','merge','catch','body','find','html-pdf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x5a48dc,_0x4065b2){var _0x16d6a3=function(_0x2a5721){while(--_0x2a5721){_0x5a48dc['push'](_0x5a48dc['shift']());}};_0x16d6a3(++_0x4065b2);}(_0xeae6,0x156));var _0x6eae=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeae6[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x6eae('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6eae('0x1'));var jsonpatch=require(_0x6eae('0x2'));var rp=require(_0x6eae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6eae('0x4'));var path=require(_0x6eae('0x5'));var sox=require('sox');var csv=require(_0x6eae('0x6'));var ejs=require(_0x6eae('0x7'));var fs=require('fs');var _=require(_0x6eae('0x8'));var squel=require(_0x6eae('0x9'));var crypto=require(_0x6eae('0xa'));var jsforce=require(_0x6eae('0xb'));var deskjs=require(_0x6eae('0xc'));var toCsv=require(_0x6eae('0x6'));var querystring=require(_0x6eae('0xd'));var Papa=require('papaparse');var Redis=require(_0x6eae('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eae('0xf'));var logger=require(_0x6eae('0x10'))(_0x6eae('0x11'));var utils=require('../../config/utils');var config=require(_0x6eae('0x12'));var licenseUtil=require(_0x6eae('0x13'));var db=require(_0x6eae('0x14'))['db'];function respondWithStatusCode(_0x3f03a7,_0x2083a8){_0x2083a8=_0x2083a8||0xcc;return function(_0x2f8726){if(_0x2f8726){return _0x3f03a7['sendStatus'](_0x2083a8);}return _0x3f03a7[_0x6eae('0x15')](_0x2083a8)[_0x6eae('0x16')]();};}function respondWithResult(_0xf96a83,_0xeaf99d){_0xeaf99d=_0xeaf99d||0xc8;return function(_0x9e669b){if(_0x9e669b){return _0xf96a83[_0x6eae('0x15')](_0xeaf99d)[_0x6eae('0x17')](_0x9e669b);}};}function respondWithFilteredResult(_0x749dfd,_0x290ea9){return function(_0x5f024a){if(_0x5f024a){var _0x463595=_0x5f024a['count'],_0x343275=_0x290ea9[_0x6eae('0x18')],_0x4375df=_0x290ea9[_0x6eae('0x18')]+_0x290ea9[_0x6eae('0x19')],_0x4e590a;if(_0x4375df>=_0x463595){_0x4375df=_0x463595;_0x4e590a=0xc8;}else{_0x4e590a=0xce;}_0x749dfd[_0x6eae('0x15')](_0x4e590a);return _0x749dfd[_0x6eae('0x1a')](_0x6eae('0x1b'),_0x343275+'-'+_0x4375df+'/'+_0x463595)['json'](_0x5f024a);}return null;};}function patchUpdates(_0x42af06){return function(_0x4a24ce){try{jsonpatch[_0x6eae('0x1c')](_0x4a24ce,_0x42af06,!![]);}catch(_0x44754d){return BPromise['reject'](_0x44754d);}return _0x4a24ce['save']();};}function saveUpdates(_0x3a9c37,_0x596391){return function(_0x1a958e){if(_0x1a958e){return _0x1a958e[_0x6eae('0x1d')](_0x3a9c37)[_0x6eae('0x1e')](function(_0x1da9b5){return _0x1da9b5;});}return null;};}function removeEntity(_0x45a96f,_0xf18853){return function(_0x3d04fd){if(_0x3d04fd){return _0x3d04fd['destroy']()['then'](function(){_0x45a96f['status'](0xcc)[_0x6eae('0x16')]();});}};}function handleEntityNotFound(_0x38a0e8,_0x1afb8f){return function(_0x18a14c){if(!_0x18a14c){_0x38a0e8[_0x6eae('0x1f')](0x194);}return _0x18a14c;};}function handleError(_0x1fa232,_0x49a487){_0x49a487=_0x49a487||0x1f4;return function(_0xea346d){logger[_0x6eae('0x20')](_0xea346d[_0x6eae('0x21')]);if(_0xea346d['name']){delete _0xea346d[_0x6eae('0x22')];}_0x1fa232[_0x6eae('0x15')](_0x49a487)[_0x6eae('0x23')](_0xea346d);};}exports['show']=function(_0x43c0ed,_0x5609b5){var _0xc75365={'raw':!![],'where':{'id':_0x43c0ed[_0x6eae('0x24')]['id']}},_0x9cca2a={};_0x9cca2a[_0x6eae('0x25')]=_['keys'](db[_0x6eae('0x26')][_0x6eae('0x27')]);_0x9cca2a['query']=_[_0x6eae('0x28')](_0x43c0ed['query']);_0x9cca2a[_0x6eae('0x29')]=_[_0x6eae('0x2a')](_0x9cca2a['model'],_0x9cca2a[_0x6eae('0x2b')]);_0xc75365[_0x6eae('0x2c')]=_[_0x6eae('0x2a')](_0x9cca2a[_0x6eae('0x25')],qs['fields'](_0x43c0ed[_0x6eae('0x2b')]['fields']));_0xc75365[_0x6eae('0x2c')]=_0xc75365[_0x6eae('0x2c')][_0x6eae('0x2d')]?_0xc75365[_0x6eae('0x2c')]:_0x9cca2a[_0x6eae('0x25')];if(_0x43c0ed[_0x6eae('0x2b')][_0x6eae('0x2e')]){_0xc75365[_0x6eae('0x2f')]=[{'all':!![]}];}_0xc75365=_[_0x6eae('0x30')]({},_0xc75365,_0x43c0ed['options']);return db['MailApplication']['find'](_0xc75365)['then'](handleEntityNotFound(_0x5609b5,null))[_0x6eae('0x1e')](respondWithResult(_0x5609b5,null))[_0x6eae('0x31')](handleError(_0x5609b5,null));};exports[_0x6eae('0x1d')]=function(_0x1d0e71,_0x2db92f){if(_0x1d0e71[_0x6eae('0x32')]['id']){delete _0x1d0e71['body']['id'];}return db[_0x6eae('0x26')][_0x6eae('0x33')]({'where':{'id':_0x1d0e71[_0x6eae('0x24')]['id']}})[_0x6eae('0x1e')](handleEntityNotFound(_0x2db92f,null))[_0x6eae('0x1e')](saveUpdates(_0x1d0e71[_0x6eae('0x32')],null))[_0x6eae('0x1e')](respondWithResult(_0x2db92f,null))[_0x6eae('0x31')](handleError(_0x2db92f,null));};exports['destroy']=function(_0x53486b,_0x14054e){return db[_0x6eae('0x26')][_0x6eae('0x33')]({'where':{'id':_0x53486b[_0x6eae('0x24')]['id']}})[_0x6eae('0x1e')](handleEntityNotFound(_0x14054e,null))[_0x6eae('0x1e')](removeEntity(_0x14054e,null))[_0x6eae('0x31')](handleError(_0x14054e,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 6a9da63..268b918 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 _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 +var _0x7e22=['define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x4b5c23,_0x101faa){var _0x262cfd=function(_0x48aa2a){while(--_0x48aa2a){_0x4b5c23['push'](_0x4b5c23['shift']());}};_0x262cfd(++_0x101faa);}(_0x7e22,0x1d8));var _0x27e2=function(_0x47f0f9,_0x222288){_0x47f0f9=_0x47f0f9-0x0;var _0xdeeafd=_0x7e22[_0x47f0f9];return _0xdeeafd;};'use strict';var _=require(_0x27e2('0x0'));var util=require('util');var logger=require(_0x27e2('0x1'))(_0x27e2('0x2'));var moment=require(_0x27e2('0x3'));var BPromise=require(_0x27e2('0x4'));var rp=require(_0x27e2('0x5'));var fs=require('fs');var path=require(_0x27e2('0x6'));var rimraf=require('rimraf');var config=require(_0x27e2('0x7'));var attributes=require('./mailApplication.attributes');module[_0x27e2('0x8')]=function(_0x350996,_0x3eb3cd){return _0x350996[_0x27e2('0x9')]('MailApplication',attributes,{'tableName':_0x27e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x27e2('0xb'),'collate':_0x27e2('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 8ac4d3e..4a2e3ae 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 _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 +var _0xf47c=['where','attributes','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','MailApplication,\x20%s,\x20%s','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','UpdateMailApplication','MailApplication','update','body','options'];(function(_0x513fb3,_0x212f6b){var _0x3af72d=function(_0x27e70d){while(--_0x27e70d){_0x513fb3['push'](_0x513fb3['shift']());}};_0x3af72d(++_0x212f6b);}(_0xf47c,0x198));var _0xcf47=function(_0x1fbcdd,_0x4db350){_0x1fbcdd=_0x1fbcdd-0x0;var _0x3eaf1b=_0xf47c[_0x1fbcdd];return _0x3eaf1b;};'use strict';var _=require(_0xcf47('0x0'));var util=require(_0xcf47('0x1'));var moment=require(_0xcf47('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf47('0x3'));var db=require(_0xcf47('0x4'))['db'];var utils=require(_0xcf47('0x5'));var logger=require(_0xcf47('0x6'))(_0xcf47('0x7'));var config=require(_0xcf47('0x8'));var jayson=require(_0xcf47('0x9'));var client=jayson['client'][_0xcf47('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x275bfb,_0x579ecf,_0x4da5e9){return new BPromise(function(_0x4b979c,_0xf35d17){return client['request'](_0x275bfb,_0x4da5e9)[_0xcf47('0xb')](function(_0x266dd0){logger[_0xcf47('0xc')](_0xcf47('0xd'),_0x579ecf,'request\x20sent');logger[_0xcf47('0xe')](_0xcf47('0xf'),_0x579ecf,_0xcf47('0x10'),JSON[_0xcf47('0x11')](_0x266dd0));if(_0x266dd0['error']){if(_0x266dd0['error'][_0xcf47('0x12')]===0x1f4){logger[_0xcf47('0x13')]('MailApplication,\x20%s,\x20%s',_0x579ecf,_0x266dd0['error'][_0xcf47('0x14')]);return _0xf35d17(_0x266dd0[_0xcf47('0x13')][_0xcf47('0x14')]);}logger['error'](_0xcf47('0xd'),_0x579ecf,_0x266dd0[_0xcf47('0x13')][_0xcf47('0x14')]);return _0x4b979c(_0x266dd0[_0xcf47('0x13')][_0xcf47('0x14')]);}else{logger[_0xcf47('0xc')](_0xcf47('0xd'),_0x579ecf,_0xcf47('0x10'));_0x4b979c(_0x266dd0['result'][_0xcf47('0x14')]);}})[_0xcf47('0x15')](function(_0x178485){logger[_0xcf47('0x13')](_0xcf47('0xd'),_0x579ecf,_0x178485);_0xf35d17(_0x178485);});});}exports[_0xcf47('0x16')]=function(_0x5872){var _0x4088fd=this;return new Promise(function(_0x224c25,_0x42c60c){return db[_0xcf47('0x17')][_0xcf47('0x18')](_0x5872[_0xcf47('0x19')],{'raw':_0x5872[_0xcf47('0x1a')]?_0x5872[_0xcf47('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5872['options']?_0x5872['options'][_0xcf47('0x1b')]||null:null,'attributes':_0x5872[_0xcf47('0x1a')]?_0x5872[_0xcf47('0x1a')][_0xcf47('0x1c')]||null:null,'limit':_0x5872[_0xcf47('0x1a')]?_0x5872['options']['limit']||null:null})[_0xcf47('0xb')](function(_0x48df03){logger[_0xcf47('0xc')](_0xcf47('0x16'),_0x5872);logger[_0xcf47('0xe')](_0xcf47('0x16'),_0x5872,JSON[_0xcf47('0x11')](_0x48df03));_0x224c25(_0x48df03);})[_0xcf47('0x15')](function(_0x757d67){logger[_0xcf47('0x13')](_0xcf47('0x16'),_0x757d67[_0xcf47('0x14')],_0x5872);_0x42c60c(_0x4088fd[_0xcf47('0x13')](0x1f4,_0x757d67[_0xcf47('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1035328..1cca106 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 _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 +var _0x1cc7=['../../config/environment','index','/describe','isAuthenticated','describe','get','/:id','show','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','multer','util','path','../../components/auth/service','../../components/interaction/service'];(function(_0x64b0d2,_0xbf5599){var _0x560c11=function(_0x3ca474){while(--_0x3ca474){_0x64b0d2['push'](_0x64b0d2['shift']());}};_0x560c11(++_0xbf5599);}(_0x1cc7,0x15a));var _0x71cc=function(_0x1f1755,_0x3b38fa){_0x1f1755=_0x1f1755-0x0;var _0x14363e=_0x1cc7[_0x1f1755];return _0x14363e;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x71cc('0x3'));var interaction=require(_0x71cc('0x4'));var config=require(_0x71cc('0x5'));var controller=require('./mailInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x71cc('0x6')]);router['get'](_0x71cc('0x7'),auth[_0x71cc('0x8')](),controller[_0x71cc('0x9')]);router[_0x71cc('0xa')](_0x71cc('0xb'),auth['isAuthenticated'](),controller[_0x71cc('0xc')]);router[_0x71cc('0xa')](_0x71cc('0xd'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/download',auth[_0x71cc('0x8')](),controller[_0x71cc('0xe')]);router[_0x71cc('0xf')]('/',auth['isAuthenticated'](),controller[_0x71cc('0x10')]);router['post'](_0x71cc('0xd'),auth['isAuthenticated'](),controller[_0x71cc('0x11')]);router['post'](_0x71cc('0x12'),auth[_0x71cc('0x8')](),interaction[_0x71cc('0x13')](_0x71cc('0x14'),_0x71cc('0x15')),controller['addTags']);router[_0x71cc('0x16')](_0x71cc('0xb'),auth[_0x71cc('0x8')](),interaction[_0x71cc('0x13')](_0x71cc('0x14'),_0x71cc('0x17')),controller[_0x71cc('0x18')]);router['delete'](_0x71cc('0xb'),auth[_0x71cc('0x8')](),interaction[_0x71cc('0x13')](_0x71cc('0x14'),_0x71cc('0x19')),controller[_0x71cc('0x1a')]);router['delete'](_0x71cc('0x12'),auth[_0x71cc('0x8')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 9311e33..9ad694b 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 _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 +var _0x0e89=['ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x4fb318,_0x222514){var _0x224a06=function(_0x2185b2){while(--_0x2185b2){_0x4fb318['push'](_0x4fb318['shift']());}};_0x224a06(++_0x222514);}(_0x0e89,0x12e));var _0x90e8=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0e89[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x90e8('0x0'));var iconv=require(_0x90e8('0x1'));module[_0x90e8('0x2')]={'closed':{'type':Sequelize[_0x90e8('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x90e8('0x4')]},'disposition':{'type':Sequelize[_0x90e8('0x5')]},'secondDisposition':{'type':Sequelize[_0x90e8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x90e8('0x5')]},'note':{'type':Sequelize[_0x90e8('0x5')]},'inReplyTo':{'type':Sequelize[_0x90e8('0x5')](0x1fe)},'to':{'type':Sequelize[_0x90e8('0x5')]},'cc':{'type':Sequelize[_0x90e8('0x6')](_0x90e8('0x7'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x90e8('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x90e8('0x4')]},'substatus':{'type':Sequelize[_0x90e8('0x5')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x90e8('0x8')]('in',_0x90e8('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x90e8('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x90e8('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x90e8('0x6')](_0x90e8('0x7'))},'lastMsgText':{'type':Sequelize[_0x90e8('0x6')](_0x90e8('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index fd915ce..b50789b 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 _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 +var _0x955f=['root','server','files','tmp','transcript-%d-%s.zip','attachments','Attachment','Attachments','Messages','bcc','subject','get','mkdirSync','headers','Bcc','basename','readFileSync','message%d.eml','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','count','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','select','field','color','from','u.id','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','text','start','some','compact','MailAccountId','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','resolve','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','toString','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.disposition','i.secondDisposition','i.substatus','i.to','i.MailAccountId','i.UserId','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','MailInteractionId','Setting','enableEmailPreview','all','rows','show','params','includeAll','include','options','create','body','destroy','addMessage','MailMessage','ids','omit','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','addTags','setTags','findAll','emit','removeTags','download','unix','join'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0x955f,0x1eb));var _0xf955=function(_0x1377cc,_0x566d8a){_0x1377cc=_0x1377cc-0x0;var _0x16242e=_0x955f[_0x1377cc];return _0x16242e;};'use strict';var pdf=require(_0xf955('0x0'));var emlformat=require(_0xf955('0x1'));var rimraf=require(_0xf955('0x2'));var zipdir=require(_0xf955('0x3'));var jsonpatch=require(_0xf955('0x4'));var rp=require('request-promise');var moment=require(_0xf955('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf955('0x6'));var path=require('path');var sox=require(_0xf955('0x7'));var csv=require(_0xf955('0x8'));var ejs=require(_0xf955('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf955('0xa'));var crypto=require(_0xf955('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf955('0xc'));var toCsv=require(_0xf955('0x8'));var querystring=require(_0xf955('0xd'));var Papa=require(_0xf955('0xe'));var htmlToText=require(_0xf955('0xf'));var juice=require(_0xf955('0x10'));var Redis=require(_0xf955('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf955('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf955('0x13'));var logger=require(_0xf955('0x14'))(_0xf955('0x15'));var utils=require('../../config/utils');var config=require(_0xf955('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf955('0x17'))['db'];config['redis']=_[_0xf955('0x18')](config[_0xf955('0x19')],{'host':_0xf955('0x1a'),'port':0x18eb});var socket=require(_0xf955('0x1b'))(new Redis(config[_0xf955('0x19')]));require(_0xf955('0x1c'))[_0xf955('0x1d')](socket);function respondWithStatusCode(_0x2783f2,_0x3c6af7){_0x3c6af7=_0x3c6af7||0xcc;return function(_0x24e75c){if(_0x24e75c){return _0x2783f2['sendStatus'](_0x3c6af7);}return _0x2783f2[_0xf955('0x1e')](_0x3c6af7)['end']();};}function respondWithResult(_0x3139d5,_0x3a814f){_0x3a814f=_0x3a814f||0xc8;return function(_0x2f881b){if(_0x2f881b){return _0x3139d5[_0xf955('0x1e')](_0x3a814f)['json'](_0x2f881b);}};}function respondWithFilteredResult(_0x5ac6cb,_0x1e20d1){return function(_0xe6de5c){if(_0xe6de5c){var _0x3c49c0=_0xe6de5c[_0xf955('0x1f')],_0x4d7b5b=_0x1e20d1[_0xf955('0x20')],_0xb71daf=_0x1e20d1[_0xf955('0x20')]+_0x1e20d1['limit'],_0x3576fa;if(_0xb71daf>=_0x3c49c0){_0xb71daf=_0x3c49c0;_0x3576fa=0xc8;}else{_0x3576fa=0xce;}_0x5ac6cb[_0xf955('0x1e')](_0x3576fa);return _0x5ac6cb[_0xf955('0x21')](_0xf955('0x22'),_0x4d7b5b+'-'+_0xb71daf+'/'+_0x3c49c0)['json'](_0xe6de5c);}return null;};}function patchUpdates(_0x43a5f2){return function(_0x5daa73){try{jsonpatch[_0xf955('0x23')](_0x5daa73,_0x43a5f2,!![]);}catch(_0x43b078){return BPromise[_0xf955('0x24')](_0x43b078);}return _0x5daa73[_0xf955('0x25')]();};}function saveUpdates(_0x160071,_0x565641){return function(_0x25f4f2){if(_0x25f4f2){return _0x25f4f2[_0xf955('0x26')](_0x160071)[_0xf955('0x27')](function(_0x13a1a7){return _0x13a1a7;});}return null;};}function removeEntity(_0x17dec2,_0x102e36){return function(_0x1f87f6){if(_0x1f87f6){return _0x1f87f6['destroy']()[_0xf955('0x27')](function(){_0x17dec2[_0xf955('0x1e')](0xcc)[_0xf955('0x28')]();});}};}function handleEntityNotFound(_0x406632,_0x2dcd55){return function(_0x13a86d){if(!_0x13a86d){_0x406632[_0xf955('0x29')](0x194);}return _0x13a86d;};}function handleError(_0x51f3ab,_0x3caea6){_0x3caea6=_0x3caea6||0x1f4;return function(_0x145098){logger[_0xf955('0x2a')](_0x145098[_0xf955('0x2b')]);if(_0x145098[_0xf955('0x2c')]){delete _0x145098[_0xf955('0x2c')];}_0x51f3ab['status'](_0x3caea6)[_0xf955('0x2d')](_0x145098);};}function getInteractionUsers(_0x1e5d37,_0x4ec3e8){return new BPromise(function(_0x256df5,_0x2c8df1){try{if(_0x4ec3e8[_0x1e5d37['id']]){_0x1e5d37[_0xf955('0x2e')]=_[_0xf955('0x2f')](_0x4ec3e8[_0x1e5d37['id']],function(_0x59bfb5){return{'id':_0x59bfb5['id'],'fullname':_0x59bfb5[_0xf955('0x30')]};});}}catch(_0x518fb3){_0x2c8df1(_0x518fb3);}_0x256df5(_0x1e5d37);});}function getInteractionTags(_0x227104,_0x2c222a){return new BPromise(function(_0x44eacf,_0x4069fe){try{if(_0x227104[_0xf955('0x31')]){_0x227104[_0xf955('0x32')]=[];_0x227104[_0xf955('0x31')][_0xf955('0x33')](',')['forEach'](function(_0x45e913){_0x227104[_0xf955('0x32')][_0xf955('0x34')](_0x2c222a[_0x45e913]);});}delete _0x227104[_0xf955('0x31')];}catch(_0x4fea0c){_0x4069fe(_0x4fea0c);}_0x44eacf(_0x227104);});}function getLastMessageText(_0x23c848){return new BPromise(function(_0x31dad5,_0x3c81bc){return db[_0xf955('0x35')][_0xf955('0x36')]({'where':{'id':_0x23c848['id']},'attributes':['lastMsgBody','lastMsgText'],'raw':!![]})['then'](function(_0x2626cb){if(!_0x2626cb[_0xf955('0x37')]){_0x23c848[_0xf955('0x37')]=_[_0xf955('0x38')](htmlToText[_0xf955('0x39')](_0x2626cb[_0xf955('0x3a')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x23c848['lastMsgText']=_0x2626cb[_0xf955('0x37')];}_0x31dad5(_0x23c848);})['catch'](function(_0x8f842f){_0x3c81bc(_0x8f842f);});});}function updateMailInteraction(_0x2371e4,_0xe33ef2,_0x51762d,_0x60a421){return new BPromise(function(_0x4bef80,_0x2bc1a0){return getInteractionUsers(_0x2371e4,_0x51762d)[_0xf955('0x27')](function(_0x2ebd6c){return getInteractionTags(_0x2ebd6c,_0xe33ef2);})[_0xf955('0x27')](function(_0x52ab07){if(_0x60a421){_0x4bef80(getLastMessageText(_0x52ab07));}else{_0x4bef80(_0x52ab07);}})[_0xf955('0x3b')](function(_0x118c92){_0x2bc1a0(_0x118c92);});});}exports['index']=function(_0x430e12,_0x460aa7){var _0x79016b={},_0x547ed9={},_0x292e53={'count':0x0,'rows':[]};var _0xffe510=_[_0xf955('0x2f')](db['MailInteraction'][_0xf955('0x3c')],function(_0x195faa){return{'name':_0x195faa[_0xf955('0x3d')],'type':_0x195faa[_0xf955('0x3e')][_0xf955('0x3f')]};});_0x547ed9[_0xf955('0x40')]=_[_0xf955('0x2f')](_0xffe510,_0xf955('0x2c'));_0x547ed9['query']=_[_0xf955('0x41')](_0x430e12[_0xf955('0x42')]);_0x547ed9[_0xf955('0x43')]=_[_0xf955('0x44')](_0x547ed9[_0xf955('0x40')],_0x547ed9[_0xf955('0x42')]);_0x79016b[_0xf955('0x45')]=_[_0xf955('0x44')](_0x547ed9[_0xf955('0x40')],qs[_0xf955('0x46')](_0x430e12[_0xf955('0x42')][_0xf955('0x46')]));_0x79016b[_0xf955('0x45')]=_0x79016b[_0xf955('0x45')][_0xf955('0x47')]?_0x79016b[_0xf955('0x45')]:_0x547ed9[_0xf955('0x40')];if(!_0x430e12[_0xf955('0x42')][_0xf955('0x48')]('nolimit')){_0x79016b[_0xf955('0x49')]=qs[_0xf955('0x49')](_0x430e12[_0xf955('0x42')]['limit']);_0x79016b[_0xf955('0x20')]=qs['offset'](_0x430e12[_0xf955('0x42')]['offset']);}_0x79016b[_0xf955('0x4a')]=qs[_0xf955('0x4b')](_0x430e12[_0xf955('0x42')][_0xf955('0x4b')]);_0x79016b['where']=qs[_0xf955('0x43')](_[_0xf955('0x4c')](_0x430e12[_0xf955('0x42')],_0x547ed9['filters']),_0xffe510);var _0x5e98ae=[];var _0x1bd760=squel[_0xf955('0x4d')]()[_0xf955('0x4e')]('id')[_0xf955('0x4e')]('name')[_0xf955('0x4e')](_0xf955('0x4f'))[_0xf955('0x50')]('tools_tags');var _0x388e59=squel['select']()[_0xf955('0x4e')](_0xf955('0x51'))[_0xf955('0x4e')]('u.fullname')[_0xf955('0x4e')](_0xf955('0x52'))[_0xf955('0x50')](_0xf955('0x53'),'ui')['left_join'](_0xf955('0x54'),'u',_0xf955('0x55'));var _0x1c6d76=squel[_0xf955('0x4d')]()[_0xf955('0x50')]('mail_interactions','i')[_0xf955('0x56')]('cm_contacts','c',_0xf955('0x57'))['left_join'](_0xf955('0x54'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xf955('0x58'),'a',_0xf955('0x59'))['left_join'](_0xf955('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')['left_join']('mail_interaction_has_tags','it','it.MailInteractionId\x20=\x20i.id')[_0xf955('0x56')](_0xf955('0x5b'),'t','t.id\x20=\x20it.TagId');var _0x4c4b6d=squel[_0xf955('0x5c')]();var _0x17fc93=[];var _0x460052=squel[_0xf955('0x5c')]();var _0x1b7b21;if(_0x430e12[_0xf955('0x42')][_0xf955('0x5d')]){_0x1b7b21=as[_0xf955('0x5e')](_0x430e12[_0xf955('0x42')][_0xf955('0x5d')]);var _0x1b7b73=_0x1b7b21[_0xf955('0x5f')];for(var _0x47a3a6=0x0;_0x47a3a6<_0x1b7b21[_0xf955('0x60')][_0xf955('0x47')];_0x47a3a6++){var _0x1d0e0c=_0x1b7b21[_0xf955('0x60')][_0x47a3a6];var _0x3242fe='i';var _0x4dc34b=_[_0xf955('0x61')](_0xffe510,[_0xf955('0x2c'),_0x1d0e0c[_0xf955('0x4e')]]);if(!_0x4dc34b){switch(_0x1d0e0c[_0xf955('0x4e')]){case _0xf955('0x62'):if(_0x1d0e0c[_0xf955('0x63')]==0x1){_0x1c6d76[_0xf955('0x64')]('`'+_0x1d0e0c[_0xf955('0x4e')]+_0xf955('0x65'));}else{_0x1c6d76[_0xf955('0x64')]('`'+_0x1d0e0c['field']+_0xf955('0x66'));}break;case _0xf955('0x67'):if(_0x1d0e0c[_0xf955('0x68')]===_0xf955('0x69')){if(_0x1d0e0c[_0xf955('0x63')][_0xf955('0x33')]('\x20')[_0xf955('0x47')]>0x1){_0x4c4b6d[_0x1b7b73](_0xf955('0x6a'),qs[_0xf955('0x6b')](_0x1d0e0c[_0xf955('0x63')]),null);}else{var _0x40efb1='%'+_0x1d0e0c[_0xf955('0x63')]+'%';_0x4c4b6d[_0x1b7b73]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x40efb1,_0x40efb1,_0x40efb1);}}else{_0x4dc34b=_[_0xf955('0x61')](_0xffe510,[_0xf955('0x2c'),_0xf955('0x6c')]);_0x1d0e0c[_0xf955('0x4e')]=_0xf955('0x6c');_0x34f52a=as[_0xf955('0x6d')](_0x3242fe,_0x4dc34b[_0xf955('0x3e')],_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a['text'],_0x34f52a['value']['start'],_0x34f52a[_0xf955('0x63')]['end']);}break;case'Tag':var _0x3cfc25=_0x1d0e0c['value'][_0xf955('0x33')](',')[_0xf955('0x2f')](function(_0x158469){return Number(_0x158469);});_0x3cfc25[_0xf955('0x6e')](function(_0x4c88ae){_0x460052['or'](_0xf955('0x6f'),'%,'+_0x4c88ae+',%');});_0x17fc93=_[_0xf955('0x70')](_0x17fc93,_0x3cfc25);break;case _0xf955('0x71'):if(_0x1d0e0c[_0xf955('0x68')]===_0xf955('0x69')){_0x4c4b6d[_0x1b7b73]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1d0e0c[_0xf955('0x63')]+'%',null);}else{_0x4dc34b=_['find'](_0xffe510,[_0xf955('0x2c'),_0xf955('0x72')]);_0x1d0e0c[_0xf955('0x4e')]='UserId';_0x34f52a=as[_0xf955('0x6d')](_0x3242fe,_0x4dc34b[_0xf955('0x3e')],_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a[_0xf955('0x73')],_0x34f52a[_0xf955('0x63')][_0xf955('0x74')],_0x34f52a[_0xf955('0x63')][_0xf955('0x28')]);}break;case'plainBody':_0x34f52a=as['buildExpression']('me',null,_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a[_0xf955('0x73')],_0x34f52a[_0xf955('0x63')][_0xf955('0x74')],_0x34f52a[_0xf955('0x63')][_0xf955('0x28')]);break;}}else{var _0x34f52a=as[_0xf955('0x6d')](_0x3242fe,_0x4dc34b[_0xf955('0x3e')],_0x1d0e0c);_0x4c4b6d[_0x1b7b73](_0x34f52a[_0xf955('0x73')],_0x34f52a[_0xf955('0x63')][_0xf955('0x74')],_0x34f52a['value'][_0xf955('0x28')]);}}}else{var _0x4916c3=_(_0x430e12[_0xf955('0x42')])['keys']()['map'](function(_0x4210af){return _[_0xf955('0x75')](_0xffe510,['name',_0x4210af])?_0x4210af:undefined;})[_0xf955('0x76')]()[_0xf955('0x63')]();if(!_['isEmpty'](_0x4916c3)){_0x4916c3['forEach'](function(_0x1e418){if(_0x1e418===_0xf955('0x77')){_0x1c6d76[_0xf955('0x78')]('i.MailAccountId\x20IN\x20?',[][_0xf955('0x79')](_0x430e12[_0xf955('0x42')][_0x1e418]));}else if(_0x1e418===_0xf955('0x7a')){var _0x356be7=JSON[_0xf955('0x7b')](_0x430e12[_0xf955('0x42')][_0x1e418])[_0xf955('0x7c')];var _0xf1e40b=JSON['parse'](_0x430e12[_0xf955('0x42')][_0x1e418])[_0xf955('0x7d')];_0x1c6d76['where'](_0xf955('0x7e'),_0x356be7,_0xf1e40b);}else{if(_0x430e12[_0xf955('0x42')][_0x1e418]===_0xf955('0x7f')){_0x1c6d76[_0xf955('0x78')]('i.'+_0x1e418+'\x20IS\x20NULL');}else{_0x1c6d76[_0xf955('0x78')]('i.'+_0x1e418+_0xf955('0x80'),_0x430e12['query'][_0x1e418]);}}});}if(_0x430e12['query'][_0xf955('0x81')]){if(_0x430e12[_0xf955('0x42')][_0xf955('0x81')]==0x1){_0x1c6d76[_0xf955('0x64')]('`unreadMessages`\x20=\x200');}else{_0x1c6d76[_0xf955('0x64')](_0xf955('0x82'));}}if(_0x430e12[_0xf955('0x42')][_0xf955('0x83')]){_0x17fc93=_[_0xf955('0x84')](_0x430e12[_0xf955('0x42')][_0xf955('0x83')])?_0x430e12[_0xf955('0x42')][_0xf955('0x83')]:new Array(_0x430e12[_0xf955('0x42')][_0xf955('0x83')]);_0x17fc93[_0xf955('0x6e')](function(_0x4254a2){_0x460052['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4254a2+',%');});}if(_0x430e12[_0xf955('0x42')][_0xf955('0x85')]){var _0x1d9469=_0x430e12[_0xf955('0x42')]['filter'][_0xf955('0x86')]('\x5c','\x5c\x5c')[_0xf955('0x86')](/'/g,'\x27\x27');if(qs[_0xf955('0x87')](_0x1d9469)){_0x4c4b6d['or'](_0xf955('0x88'),_0x1d9469+'%');}else if(qs[_0xf955('0x89')](_0x1d9469)){_0x4c4b6d['or'](_0xf955('0x8a'),_0x1d9469+'%');}else{_0x4c4b6d['or'](_0xf955('0x8b'),qs[_0xf955('0x6b')](_0x1d9469))['or'](_0xf955('0x8c'),qs[_0xf955('0x6b')](_0x1d9469));}}}_0x1c6d76[_0xf955('0x78')](_0x4c4b6d);_0x1c6d76['group'](_0xf955('0x8d'));var _0x1c8c8a={'type':db[_0xf955('0x8e')][_0xf955('0x8f')][_0xf955('0x90')],'raw':!![]};var _0xaeaffb=_0x1c6d76[_0xf955('0x91')]();_0xaeaffb['field'](_0xf955('0x8d'));_0xaeaffb['field'](_0xf955('0x92'),'unreadMessages');if(_0x79016b[_0xf955('0x4a')]){_0x79016b[_0xf955('0x4a')][_0xf955('0x6e')](function(_0x147b5c){var _0x6da71d=_0x147b5c[0x0]===_0xf955('0x93')?_0x147b5c[0x0]:'i.'+_0x147b5c[0x0];_0x1c6d76['order'](_0x6da71d,_0x147b5c[0x1]===_0xf955('0x94')?![]:!![]);});}if(!_[_0xf955('0x95')](_0x17fc93)){_0x1c6d76[_0xf955('0x64')](_0x460052);_0xaeaffb['where']('t.id\x20IN\x20?',_0x17fc93);}BPromise[_0xf955('0x96')]()[_0xf955('0x27')](function(){if(!_0x1b7b21){if(_0x430e12[_0xf955('0x42')]['MailAccountId'])return;_0xaeaffb[_0xf955('0x78')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x1c6d76[_0xf955('0x78')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x430e12[_0xf955('0x97')][_0xf955('0x98')]!==_0xf955('0x99'))return;return _0x430e12['user'][_0xf955('0x9a')]({'attributes':['id'],'raw':!![]})[_0xf955('0x27')](function(_0x2cd1bd){if(_['isEmpty'](_0x2cd1bd)){_0xaeaffb[_0xf955('0x78')](_0xf955('0x9b'));_0x1c6d76[_0xf955('0x78')](_0xf955('0x9b'));}else{_0xaeaffb[_0xf955('0x78')](_0xf955('0x9c'),_[_0xf955('0x2f')](_0x2cd1bd,'id'));_0x1c6d76['where'](_0xf955('0x9c'),_[_0xf955('0x2f')](_0x2cd1bd,'id'));}});})[_0xf955('0x27')](function(){if(_0x430e12[_0xf955('0x97')][_0xf955('0x98')]==='agent'&&!_0x1b7b21&&!_0x430e12[_0xf955('0x42')][_0xf955('0x77')])return[];return db['sequelize']['query'](_0xaeaffb[_0xf955('0x9d')](),_0x1c8c8a);})[_0xf955('0x27')](function(_0x3bd458){_0x292e53[_0xf955('0x1f')]=_0x3bd458['length'];if(_0x292e53[_0xf955('0x1f')]===0x0)return[];return db['sequelize']['query'](_0x1bd760[_0xf955('0x9d')](),_0x1c8c8a)[_0xf955('0x27')](function(_0x526e1b){_0x5e98ae=_['keyBy'](_0x526e1b,'id');_0x1c8c8a=_[_0xf955('0x9e')](_0x1c8c8a,{'model':db[_0xf955('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x430e12[_0xf955('0x42')]['fields']){_0x79016b['attributes'][_0xf955('0x6e')](function(_0xe8b4a){_0x1c6d76[_0xf955('0x4e')]('i.'+_0xe8b4a);});}else{_0x1c6d76['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1c6d76['field'](_0xf955('0x9f'),'Account.key');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa0'),_0xf955('0xa1'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa2'),'contactName');_0x1c6d76[_0xf955('0x4e')](_0xf955('0x8d'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa3'));_0x1c6d76['field'](_0xf955('0xa4'));_0x1c6d76[_0xf955('0x4e')]('i.closed');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa5'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa6'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa7'));_0x1c6d76['field']('i.lastMsgDirection');_0x1c6d76[_0xf955('0x4e')]('i.subject');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa8'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xa9'));_0x1c6d76['field']('i.thirdDisposition');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xaa'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xab'));_0x1c6d76[_0xf955('0x4e')]('i.ContactId');_0x1c6d76[_0xf955('0x4e')](_0xf955('0xac'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xad'));_0x1c6d76['field']('c.firstName',_0xf955('0xae'));_0x1c6d76[_0xf955('0x4e')]('c.lastName',_0xf955('0xaf'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb0'),_0xf955('0xb1'));_0x1c6d76['field'](_0xf955('0xb2'),_0xf955('0xb3'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb4'),_0xf955('0xb5'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb6'),'Contact.fax');_0x1c6d76['field']('o.fullname',_0xf955('0xb7'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xb8'),_0xf955('0xb9'));_0x1c6d76[_0xf955('0x4e')](_0xf955('0xba'),_0xf955('0x31'));}if(_0x79016b['limit'])_0x1c6d76[_0xf955('0x49')](_0x79016b[_0xf955('0x49')]);if(_0x79016b['offset'])_0x1c6d76[_0xf955('0x20')](_0x79016b[_0xf955('0x20')]);return db[_0xf955('0xbb')][_0xf955('0x42')](_0x1c6d76[_0xf955('0x9d')](),_0x1c8c8a);})[_0xf955('0x27')](function(_0x30e770){_0x388e59[_0xf955('0x78')]('ui.MailInteractionId\x20IN\x20?',_['map'](_0x30e770,'id'));return db['sequelize'][_0xf955('0x42')](_0x388e59[_0xf955('0x9d')](),_0x1c8c8a)[_0xf955('0x27')](function(_0x3ed082){var _0x68e55=_['groupBy'](_0x3ed082,_0xf955('0xbc'));var _0x22f34c=[];return db[_0xf955('0xbd')][_0xf955('0x36')]({'attributes':[_0xf955('0xbe')],'raw':!![]})[_0xf955('0x27')](function(_0x11f6f8){var _0x436d73=_0x11f6f8[_0xf955('0xbe')];_0x30e770['forEach'](function(_0x3c7c36){_0x22f34c['push'](updateMailInteraction(_0x3c7c36,_0x5e98ae,_0x68e55,_0x436d73));});return BPromise[_0xf955('0xbf')](_0x22f34c);});});});})[_0xf955('0x27')](function(_0x864af8){_0x292e53[_0xf955('0xc0')]=_0x864af8;return _0x292e53;})[_0xf955('0x27')](respondWithFilteredResult(_0x460aa7,_0x79016b))[_0xf955('0x3b')](handleError(_0x460aa7,null));};exports[_0xf955('0xc1')]=function(_0x4b8cde,_0x1ef189){var _0x4bb590={'raw':![],'where':{'id':_0x4b8cde[_0xf955('0xc2')]['id']}},_0x222df2={};_0x222df2['model']=_[_0xf955('0x41')](db[_0xf955('0x35')][_0xf955('0x3c')]);_0x222df2[_0xf955('0x42')]=_[_0xf955('0x41')](_0x4b8cde[_0xf955('0x42')]);_0x222df2[_0xf955('0x43')]=_['intersection'](_0x222df2[_0xf955('0x40')],_0x222df2[_0xf955('0x42')]);_0x4bb590['attributes']=_[_0xf955('0x44')](_0x222df2[_0xf955('0x40')],qs['fields'](_0x4b8cde['query'][_0xf955('0x46')]));_0x4bb590[_0xf955('0x45')]=_0x4bb590[_0xf955('0x45')]['length']?_0x4bb590[_0xf955('0x45')]:_0x222df2[_0xf955('0x40')];if(_0x4b8cde[_0xf955('0x42')][_0xf955('0xc3')]){_0x4bb590[_0xf955('0xc4')]=[{'all':!![]}];}_0x4bb590=_[_0xf955('0x9e')]({},_0x4bb590,_0x4b8cde[_0xf955('0xc5')]);return db[_0xf955('0x35')][_0xf955('0x61')](_0x4bb590)[_0xf955('0x27')](handleEntityNotFound(_0x1ef189,null))[_0xf955('0x27')](respondWithResult(_0x1ef189,null))[_0xf955('0x3b')](handleError(_0x1ef189,null));};exports[_0xf955('0xc6')]=function(_0x1e608e,_0x490981){return db['MailInteraction'][_0xf955('0xc6')](_0x1e608e[_0xf955('0xc7')],{})[_0xf955('0x27')](respondWithResult(_0x490981,0xc9))[_0xf955('0x3b')](handleError(_0x490981,null));};exports[_0xf955('0x26')]=function(_0x4954ba,_0x161d06){if(_0x4954ba[_0xf955('0xc7')]['id']){delete _0x4954ba['body']['id'];}return db[_0xf955('0x35')][_0xf955('0x61')]({'where':{'id':_0x4954ba[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x161d06,null))['then'](saveUpdates(_0x4954ba[_0xf955('0xc7')],null))['then'](respondWithResult(_0x161d06,null))[_0xf955('0x3b')](handleError(_0x161d06,null));};exports[_0xf955('0xc8')]=function(_0x29e08b,_0xe9f9a8){return db['MailInteraction'][_0xf955('0x61')]({'where':{'id':_0x29e08b[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0xe9f9a8,null))[_0xf955('0x27')](removeEntity(_0xe9f9a8,null))[_0xf955('0x3b')](handleError(_0xe9f9a8,null));};exports['describe']=function(_0x12e6aa,_0x1f38db){return db[_0xf955('0x35')]['describe']()[_0xf955('0x27')](respondWithResult(_0x1f38db,null))[_0xf955('0x3b')](handleError(_0x1f38db,null));};exports[_0xf955('0xc9')]=function(_0x218493,_0x19665c,_0x437020){return db[_0xf955('0xca')]['find']({'where':{'id':_0x218493['params']['id']}})['then'](handleEntityNotFound(_0x19665c,null))[_0xf955('0x27')](function(_0x441833){if(_0x441833){return _0x441833['addMessage'](_0x218493[_0xf955('0xc7')][_0xf955('0xcb')],_[_0xf955('0xcc')](_0x218493['body'],[_0xf955('0xcb'),'id'])||{});}})[_0xf955('0x27')](respondWithResult(_0x19665c,null))['catch'](handleError(_0x19665c,null));};exports['getMessages']=function(_0x3033c7,_0x8eae44,_0x184581){var _0x30baa1={'raw':![],'where':{}};var _0x189377={};var _0x5b6f67={'count':0x0,'rows':[]};return db[_0xf955('0x35')][_0xf955('0x36')]({'where':{'id':_0x3033c7[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x8eae44,null))[_0xf955('0x27')](function(_0x480d95){if(_0x480d95){_0x189377[_0xf955('0x40')]=_[_0xf955('0x41')](db[_0xf955('0xca')][_0xf955('0x3c')]);_0x189377['query']=_[_0xf955('0x41')](_0x3033c7[_0xf955('0x42')]);_0x189377[_0xf955('0x43')]=_[_0xf955('0x44')](_0x189377[_0xf955('0x40')],_0x189377['query']);_0x30baa1[_0xf955('0x45')]=_[_0xf955('0x44')](_0x189377['model'],qs[_0xf955('0x46')](_0x3033c7[_0xf955('0x42')][_0xf955('0x46')]));_0x30baa1[_0xf955('0x45')]=_0x30baa1[_0xf955('0x45')][_0xf955('0x47')]?_0x30baa1[_0xf955('0x45')]:_0x189377[_0xf955('0x40')];if(!_0x3033c7[_0xf955('0x42')][_0xf955('0x48')]('nolimit')){_0x30baa1['limit']=qs[_0xf955('0x49')](_0x3033c7[_0xf955('0x42')][_0xf955('0x49')]);_0x30baa1[_0xf955('0x20')]=qs['offset'](_0x3033c7[_0xf955('0x42')][_0xf955('0x20')]);}_0x30baa1['order']=qs['sort'](_0x3033c7[_0xf955('0x42')][_0xf955('0x4b')]);_0x30baa1[_0xf955('0x78')]=qs[_0xf955('0x43')](_['pick'](_0x3033c7[_0xf955('0x42')],_0x189377[_0xf955('0x43')]));_0x30baa1[_0xf955('0x78')][_0xf955('0xbc')]=_0x480d95['id'];if(_0x3033c7[_0xf955('0x42')][_0xf955('0x85')]){_0x30baa1[_0xf955('0x78')]=_[_0xf955('0x9e')](_0x30baa1['where'],{'$or':_[_0xf955('0x2f')](_0x30baa1[_0xf955('0x45')],function(_0x3edceb){var _0x26478e={};_0x26478e[_0x3edceb]={'$like':'%'+_0x3033c7[_0xf955('0x42')][_0xf955('0x85')]+'%'};return _0x26478e;})});}if(_0x3033c7[_0xf955('0x42')][_0xf955('0x7c')]){var _0x1f17fb=_0x3033c7[_0xf955('0x42')]['$gte'][_0xf955('0x33')](',');var _0x1cccb2={};_0x1cccb2[_0x1f17fb[0x0]]={'$gte':moment(_0x1f17fb[0x1])[_0xf955('0xcd')](_0xf955('0xce'))};_0x30baa1[_0xf955('0x78')]=_[_0xf955('0x9e')](_0x30baa1[_0xf955('0x78')],_0x1cccb2);}_0x30baa1=_['merge']({},_0x30baa1,_0x3033c7[_0xf955('0xc5')]);return db['MailMessage'][_0xf955('0x1f')]({'where':_0x30baa1[_0xf955('0x78')]})[_0xf955('0x27')](function(_0x209200){_0x5b6f67[_0xf955('0x1f')]=_0x209200;if(_0x3033c7[_0xf955('0x42')][_0xf955('0xc3')]){_0x30baa1[_0xf955('0xc4')]=[{'all':!![]}];}return db[_0xf955('0xca')]['findAll'](_0x30baa1);})[_0xf955('0x27')](function(_0x2d79a0){if(_0x3033c7[_0xf955('0x42')][_0xf955('0xcf')]===_0xf955('0xd0')){for(var _0x2099ea=0x0;_0x2099ea<_0x2d79a0['length'];_0x2099ea++){_0x2d79a0[_0x2099ea][_0xf955('0xc7')]=juice(_0x2d79a0[_0x2099ea][_0xf955('0xc7')]);}}_0x5b6f67[_0xf955('0xc0')]=_0x2d79a0;return _0x5b6f67;});}})['then'](respondWithFilteredResult(_0x8eae44,_0x30baa1))[_0xf955('0x3b')](handleError(_0x8eae44,null));};exports[_0xf955('0xd1')]=function(_0x2e5554,_0x40dcdd,_0x3b3c0e){return db[_0xf955('0x35')]['find']({'where':{'id':_0x2e5554[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x40dcdd,null))[_0xf955('0x27')](function(_0x42e3eb){if(_0x42e3eb){return _0x42e3eb[_0xf955('0xd2')](_0x2e5554[_0xf955('0xc7')]['ids'],_[_0xf955('0xcc')](_0x2e5554['body'],['ids','id'])||{})['spread'](function(){return db['Tag'][_0xf955('0xd3')]({'attributes':['id','name',_0xf955('0x4f')],'where':{'id':_0x2e5554[_0xf955('0xc7')]['ids']}});})[_0xf955('0x27')](function(_0x5bbb80){socket[_0xf955('0xd4')]('mailInteractionTags:save',{'id':Number(_0x2e5554[_0xf955('0xc2')]['id']),'tags':_0x5bbb80||[]});return{'id':Number(_0x2e5554[_0xf955('0xc2')]['id']),'tags':_0x5bbb80||[]};});}})[_0xf955('0x27')](respondWithResult(_0x40dcdd,null))[_0xf955('0x3b')](handleError(_0x40dcdd,null));};exports['removeTags']=function(_0x15b32a,_0x5d1c27,_0x3c7e80){return db[_0xf955('0x35')][_0xf955('0x61')]({'where':{'id':_0x15b32a[_0xf955('0xc2')]['id']}})[_0xf955('0x27')](handleEntityNotFound(_0x5d1c27,null))[_0xf955('0x27')](function(_0x1cc042){if(_0x1cc042){return _0x1cc042[_0xf955('0xd5')](_0x15b32a[_0xf955('0x42')][_0xf955('0xcb')]);}})['then'](respondWithStatusCode(_0x5d1c27,null))[_0xf955('0x3b')](handleError(_0x5d1c27,null));};exports[_0xf955('0xd6')]=function(_0x444e24,_0x2fb11a){var _0x438cbc=moment()[_0xf955('0xd7')]()[_0xf955('0x9d')]();var _0x57c0c3=path[_0xf955('0xd8')](config[_0xf955('0xd9')],_0xf955('0xda'),_0xf955('0xdb'),_0xf955('0xdc'));var _0x2b68b3=path[_0xf955('0xd8')](config[_0xf955('0xd9')],_0xf955('0xda'),_0xf955('0xdb'),'attachments');var _0x1620ec=path[_0xf955('0xd8')](_0x57c0c3,_0x438cbc);var _0x2b3deb=util[_0xf955('0xcd')](_0xf955('0xdd'),_0x444e24[_0xf955('0xc2')]['id'],_0x438cbc);var _0x20a400=path[_0xf955('0xd8')](_0x57c0c3,_0x2b3deb);var _0x5d1f3d=[];if(_0x444e24[_0xf955('0x42')][_0xf955('0xde')]){_0x5d1f3d[_0xf955('0x34')]({'model':db[_0xf955('0xdf')],'as':_0xf955('0xe0'),'raw':!![]});}var _0x29d54d=[{'model':db[_0xf955('0xca')],'as':_0xf955('0xe1'),'attributes':['id','body','from','to','cc',_0xf955('0xe2'),_0xf955('0xe3'),_0xf955('0x7a')],'where':{'secret':![]},'order':qs[_0xf955('0x4b')]('id'),'include':_0x5d1f3d}];return db['MailInteraction']['find']({'where':{'id':_0x444e24[_0xf955('0xc2')]['id']},'include':_0x29d54d})[_0xf955('0x27')](handleEntityNotFound(_0x2fb11a,null))['then'](function(_0x35c679){if(_0x35c679&&_0x35c679[_0xf955('0xe1')]){var _0x46e341=_0x35c679[_0xf955('0xe4')]({'plain':!![]});fs[_0xf955('0xe5')](_0x1620ec);return BPromise['each'](_0x46e341[_0xf955('0xe1')],function(_0x306858,_0x3a3826){var _0x106640={'from':_0x306858[_0xf955('0x50')],'to':_0x306858['to'],'subject':_0x306858['subject'],'html':_0x306858[_0xf955('0xc7')],'headers':{'Date':moment(_0x306858['createdAt'])[_0xf955('0xcd')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x306858['cc']){_0x106640[_0xf955('0xe6')]['Cc']=_0x306858['cc'];}if(_0x306858[_0xf955('0xe2')]){_0x106640[_0xf955('0xe6')][_0xf955('0xe7')]=_0x306858[_0xf955('0xe2')];}return new BPromise(function(_0x23fa36,_0x85661f){if(_0x306858[_0xf955('0xe0')]){for(var _0x421b76=0x0;_0x421b76<_0x306858[_0xf955('0xe0')]['length'];_0x421b76++){var _0x598132=_0x306858[_0xf955('0xe0')][_0x421b76];var _0x29d79f=path[_0xf955('0xd8')](_0x2b68b3,_0x598132[_0xf955('0xe8')]);if(fs['existsSync'](_0x29d79f)){_0x106640['attachments'][_0xf955('0x34')]({'name':_0x598132['name'],'contentType':_0x598132['type'],'data':fs[_0xf955('0xe9')](_0x29d79f)});}}}emlformat['build'](_0x106640,function(_0x2f8e43,_0x1ed1e1){if(_0x2f8e43)return _0x85661f(_0x2f8e43);fs['writeFileSync'](path['join'](_0x1620ec,util[_0xf955('0xcd')](_0xf955('0xea'),_0x3a3826)),_0x1ed1e1);return _0x23fa36(_0x1ed1e1);});});})[_0xf955('0x27')](function(){return new BPromise(function(_0x58495b,_0x30e0a1){zipdir(_0x1620ec,{'saveTo':_0x20a400},function(_0x5cbf1e,_0x143bfd){if(_0x5cbf1e)return _0x30e0a1(_0x5cbf1e);return _0x58495b(_0x143bfd);});})['then'](function(){return new BPromise(function(_0x5a5d7e,_0x591585){rimraf(_0x1620ec,function(_0x1505ba){if(_0x1505ba)_0x591585(_0x1505ba);return _0x5a5d7e();});});})[_0xf955('0x27')](function(){return _0x2fb11a[_0xf955('0xd6')](_0x20a400,_0x2b3deb,function(_0x4a84e0){if(_0x4a84e0){console['log'](_0xf955('0xeb'),_0x4a84e0);}else{fs['unlinkSync'](_0x20a400);}});});});}else{return _0x2fb11a[_0xf955('0x29')](0xc8);}})['catch'](handleError(_0x2fb11a,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 6814bde..256a366 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 _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 +var _0xed9d=['catch','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','emit'];(function(_0x32b56b,_0x2ff149){var _0x856a25=function(_0x23991e){while(--_0x23991e){_0x32b56b['push'](_0x32b56b['shift']());}};_0x856a25(++_0x2ff149);}(_0xed9d,0x146));var _0xded9=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xed9d[_0x30ae5e];return _0x1f2e93;};'use strict';var EventEmitter=require(_0xded9('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xded9('0x1'))['db'][_0xded9('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xded9('0x3')](0x0);var events={'afterCreate':_0xded9('0x4'),'afterUpdate':_0xded9('0x5'),'afterDestroy':_0xded9('0x6')};function emitEvent(_0x2cb32c){return function(_0xd6a9b3,_0x41ec3a,_0x16438f){_0xd6a9b3[_0xded9('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0xb727b0){_0xd6a9b3[_0xded9('0x8')](_0xded9('0x9'),_0xb727b0['map'](function(_0x176fae){return{'id':_0x176fae['id']};}));return MailMessage[_0xded9('0xa')]({'where':{'MailInteractionId':_0xd6a9b3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xded9('0xb')](function(_0x4a4750){_0xd6a9b3[_0xded9('0x8')](_0xded9('0xc'),_0x4a4750['length']);MailInteractionEvents[_0xded9('0xd')](_0x2cb32c+':'+_0xd6a9b3['id'],_0xd6a9b3);MailInteractionEvents[_0xded9('0xd')](_0x2cb32c,_0xd6a9b3);_0x16438f(null);})[_0xded9('0xe')](_0x16438f(null));};}for(var e in events){if(events[_0xded9('0xf')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xded9('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 1faa183..b06d972 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 _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 +var _0x70e0=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','mail_interactions','fti_mail_interactions','subject','FULLTEXT','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','substatusAt','get','MailMessage'];(function(_0x132b2b,_0x3741f5){var _0x386e2f=function(_0x5e826d){while(--_0x5e826d){_0x132b2b['push'](_0x132b2b['shift']());}};_0x386e2f(++_0x3741f5);}(_0x70e0,0x17b));var _0x070e=function(_0x1e29c4,_0x49524d){_0x1e29c4=_0x1e29c4-0x0;var _0x48dcd3=_0x70e0[_0x1e29c4];return _0x48dcd3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('MailInteraction',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0xa'),'to'],'type':_0x070e('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x111743,_0x68a09e,_0x11ffa8){if(_0x111743['substatus']){_0x111743['substatusAt']=moment()[_0x070e('0xc')](_0x070e('0xd'));}if(_0x111743[_0x070e('0xe')]){_0x111743[_0x070e('0xf')]=moment()[_0x070e('0xc')](_0x070e('0xd'));}_0x11ffa8(null,_0x68a09e);},'beforeUpdate':function(_0x25cfe1,_0x1baa12,_0x39d2b9){if(_0x25cfe1[_0x070e('0x10')](_0x070e('0x11'))){_0x25cfe1['substatusAt']=_0x25cfe1['substatus']?moment()[_0x070e('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x25cfe1['changed']('closed')){_0x25cfe1[_0x070e('0xf')]=moment()[_0x070e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x25cfe1['substatus']=null;_0x25cfe1[_0x070e('0x12')]=null;}_0x39d2b9(null,_0x25cfe1);},'afterUpdate':function(_0xeae1a5,_0x180897,_0x19d9da){var _0x5bc71e=_0x46fe68['models'];var _0x17e2e4=_0xeae1a5[_0x070e('0x13')]({'plain':!![]});if(_0x17e2e4[_0x070e('0xe')]){return _0x5bc71e[_0x070e('0x14')][_0x070e('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x17e2e4['id']}})['then'](function(){_0x19d9da();})[_0x070e('0x16')](function(_0x168dc6){_0x19d9da(_0x168dc6);});}else{_0x19d9da();}}},'charset':_0x070e('0x17'),'collate':_0x070e('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index b5902ac..2239456 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 _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 +var _0x6308=['info','result','catch','MailInteraction','update','body','raw','options','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x49630d,_0x1a9f1d){var _0x4a38f7=function(_0x2d09f9){while(--_0x2d09f9){_0x49630d['push'](_0x49630d['shift']());}};_0x4a38f7(++_0x1a9f1d);}(_0x6308,0x1f2));var _0x8630=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x6308[_0x279d37];return _0x530173;};'use strict';var _=require(_0x8630('0x0'));var util=require('util');var moment=require(_0x8630('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8630('0x2'));var db=require(_0x8630('0x3'))['db'];var utils=require(_0x8630('0x4'));var logger=require(_0x8630('0x5'))(_0x8630('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8630('0x7')]['http']({'port':0x232a});config[_0x8630('0x8')]=_[_0x8630('0x9')](config[_0x8630('0x8')],{'host':_0x8630('0xa'),'port':0x18eb});var socket=require(_0x8630('0xb'))(new Redis(config[_0x8630('0x8')]));require('./mailInteraction.socket')[_0x8630('0xc')](socket);function respondWithRpcPromise(_0x5726fd,_0x3dc3c8,_0x399bb0){return new BPromise(function(_0x2155fd,_0x48c93c){return client[_0x8630('0xd')](_0x5726fd,_0x399bb0)[_0x8630('0xe')](function(_0x3ec6aa){logger['info'](_0x8630('0xf'),_0x3dc3c8,_0x8630('0x10'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3dc3c8,_0x8630('0x10'),JSON[_0x8630('0x11')](_0x3ec6aa));if(_0x3ec6aa['error']){if(_0x3ec6aa[_0x8630('0x12')]['code']===0x1f4){logger[_0x8630('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3dc3c8,_0x3ec6aa[_0x8630('0x12')]['message']);return _0x48c93c(_0x3ec6aa['error'][_0x8630('0x13')]);}logger[_0x8630('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3dc3c8,_0x3ec6aa['error'][_0x8630('0x13')]);return _0x2155fd(_0x3ec6aa['error'][_0x8630('0x13')]);}else{logger[_0x8630('0x14')](_0x8630('0xf'),_0x3dc3c8,_0x8630('0x10'));_0x2155fd(_0x3ec6aa[_0x8630('0x15')][_0x8630('0x13')]);}})[_0x8630('0x16')](function(_0x39edd5){logger[_0x8630('0x12')]('MailInteraction,\x20%s,\x20%s',_0x3dc3c8,_0x39edd5);_0x48c93c(_0x39edd5);});});}exports['UpdateMailInteraction']=function(_0x2730c0){var _0x1a773c=this;return new Promise(function(_0x557e74,_0x5cff5c){return db[_0x8630('0x17')][_0x8630('0x18')](_0x2730c0[_0x8630('0x19')],{'raw':_0x2730c0['options']?_0x2730c0['options'][_0x8630('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2730c0['options']?_0x2730c0[_0x8630('0x1b')][_0x8630('0x1c')]||null:null,'attributes':_0x2730c0[_0x8630('0x1b')]?_0x2730c0[_0x8630('0x1b')]['attributes']||null:null,'limit':_0x2730c0[_0x8630('0x1b')]?_0x2730c0[_0x8630('0x1b')][_0x8630('0x1d')]||null:null})[_0x8630('0xe')](function(_0x41871a){logger[_0x8630('0x14')](_0x8630('0x1e'),_0x2730c0);logger['debug']('UpdateMailInteraction',_0x2730c0,JSON[_0x8630('0x11')](_0x41871a));_0x557e74(_0x41871a);})[_0x8630('0x16')](function(_0x439b33){logger[_0x8630('0x12')](_0x8630('0x1e'),_0x439b33[_0x8630('0x13')],_0x2730c0);_0x5cff5c(_0x1a773c[_0x8630('0x12')](0x1f4,_0x439b33[_0x8630('0x13')]));});});};exports[_0x8630('0x1f')]=function(_0x357c15){return new Promise(function(_0x221841,_0x41f74c){return db[_0x8630('0x17')][_0x8630('0x20')]({'where':_0x357c15[_0x8630('0x1b')]?_0x357c15[_0x8630('0x1b')][_0x8630('0x1c')]||null:null})['then'](function(_0x3521a2){if(_0x3521a2){return _0x3521a2[_0x8630('0x21')](_0x357c15[_0x8630('0x19')][_0x8630('0x22')],_['omit'](_0x357c15[_0x8630('0x19')],[_0x8630('0x22'),'id'])||{});}})[_0x8630('0x23')](function(_0x18e62b){logger[_0x8630('0x14')](_0x8630('0x24'),_0x357c15);logger['debug'](_0x8630('0x24'),_0x357c15,JSON[_0x8630('0x11')](_0x18e62b));_0x221841(_0x18e62b);})[_0x8630('0x16')](function(_0x4a970e){logger[_0x8630('0x12')](_0x8630('0x24'),_0x4a970e[_0x8630('0x13')],_0x357c15);_0x41f74c(_this[_0x8630('0x12')](0x1f4,_0x4a970e[_0x8630('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 1376607..459805a 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 _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 +var _0xdd2d=['remove','update','emit','length','mailInteraction:','save'];(function(_0x27f8b5,_0x238f96){var _0x3b801d=function(_0x2a21e2){while(--_0x2a21e2){_0x27f8b5['push'](_0x27f8b5['shift']());}};_0x3b801d(++_0x238f96);}(_0xdd2d,0x71));var _0xddd2=function(_0xb23399,_0x4491ec){_0xb23399=_0xb23399-0x0;var _0x25aa61=_0xdd2d[_0xb23399];return _0x25aa61;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xddd2('0x0'),_0xddd2('0x1'),_0xddd2('0x2')];function createListener(_0x4e4792,_0xdea5e2){return function(_0x60bb3d){_0xdea5e2[_0xddd2('0x3')](_0x4e4792,_0x60bb3d);};}function removeListener(_0x2ad759,_0x26d34f){return function(){MailInteractionEvents['removeListener'](_0x2ad759,_0x26d34f);};}exports['register']=function(_0xa9283c){for(var _0xcd4a1d=0x0,_0x136cb6=events[_0xddd2('0x4')];_0xcd4a1d<_0x136cb6;_0xcd4a1d++){var _0xf3d63a=events[_0xcd4a1d];var _0x1189ec=createListener(_0xddd2('0x5')+_0xf3d63a,_0xa9283c);MailInteractionEvents['on'](_0xf3d63a,_0x1189ec);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6ed30d8..b1734d9 100644 --- a/server/api/mailMessage/index.js +++ b/server/api/mailMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c5a=['isAuthenticated','get','/describe','/:id','show','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_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 +var _0xf3cd=['accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put','update','/:id/accept'];(function(_0xed5669,_0x42e4dc){var _0x380601=function(_0x518d75){while(--_0x518d75){_0xed5669['push'](_0xed5669['shift']());}};_0x380601(++_0x42e4dc);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0xf3cd[_0x2cdec6];return _0xa36703;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xdf3c('0x6'));var config=require(_0xdf3c('0x7'));var controller=require(_0xdf3c('0x8'));router['get']('/',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xa')]);router[_0xdf3c('0xb')](_0xdf3c('0xc'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0xd')]);router['get'](_0xdf3c('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xdf3c('0xb')](_0xdf3c('0xf'),auth['isAuthenticated'](),controller[_0xdf3c('0x10')]);router[_0xdf3c('0x11')]('/',auth[_0xdf3c('0x9')](),interaction[_0xdf3c('0x12')](_0xdf3c('0x13'),_0xdf3c('0x14')),controller[_0xdf3c('0x15')]);router[_0xdf3c('0x16')]('/:id',auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x17')]);router[_0xdf3c('0x16')](_0xdf3c('0x18'),auth['isAuthenticated'](),controller[_0xdf3c('0x19')]);router[_0xdf3c('0x16')](_0xdf3c('0x1a'),auth['isAuthenticated'](),controller[_0xdf3c('0x1b')]);router[_0xdf3c('0x1c')](_0xdf3c('0xe'),auth[_0xdf3c('0x9')](),controller[_0xdf3c('0x1d')]);module[_0xdf3c('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4ba2372..3bf4778 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 _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 +var _0x288a=['BOOLEAN','out','STRING','DATE','INTEGER','lodash','exports','TEXT','long'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x288a,0x188));var _0xa288=function(_0x436695,_0x39c6bd){_0x436695=_0x436695-0x0;var _0x4a2731=_0x288a[_0x436695];return _0x4a2731;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa288('0x0'));module[_0xa288('0x1')]={'body':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium')},'read':{'type':Sequelize[_0xa288('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa288('0x5')),'defaultValue':_0xa288('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa288('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3'))},'cc':{'type':Sequelize[_0xa288('0x2')]('long')},'bcc':{'type':Sequelize[_0xa288('0x2')](_0xa288('0x3'))},'subject':{'type':Sequelize[_0xa288('0x2')]},'sentAt':{'type':Sequelize[_0xa288('0x7')]},'attach':{'type':Sequelize[_0xa288('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa288('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa288('0x7')]},'originTo':{'type':Sequelize[_0xa288('0x2')]('long')},'originCc':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2192575..414e5f6 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(_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 +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(_0x164488,_0x1a7b2a){var _0x432bc7=function(_0x5c5784){while(--_0x5c5784){_0x164488['push'](_0x164488['shift']());}};_0x432bc7(++_0x1a7b2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 75015da..2200bc6 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 _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 +var _0x6c1e=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6c1e,0x1c7));var _0xe6c1=function(_0x5c57e8,_0x35997a){_0x5c57e8=_0x5c57e8-0x0;var _0x4224f8=_0x6c1e[_0x5c57e8];return _0x4224f8;};'use strict';var EventEmitter=require(_0xe6c1('0x0'));var MailMessage=require(_0xe6c1('0x1'))['db'][_0xe6c1('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe6c1('0x3')](0x0);var events={'afterCreate':_0xe6c1('0x4'),'afterUpdate':'update','afterDestroy':_0xe6c1('0x5')};function emitEvent(_0x6822b5){return function(_0x5a761e,_0x3eae1f,_0x2cd466){MailMessageEvents['emit'](_0x6822b5+':'+_0x5a761e['id'],_0x5a761e);MailMessageEvents[_0xe6c1('0x6')](_0x6822b5,_0x5a761e);_0x2cd466(null);};}for(var e in events){if(events[_0xe6c1('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xe6c1('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 20a1c2d..cb00b95 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 _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 +var _0xa51b=['mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','get','direction','toLowerCase','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage'];(function(_0x5384a1,_0x5ecf55){var _0x10879f=function(_0x638ea4){while(--_0x638ea4){_0x5384a1['push'](_0x5384a1['shift']());}};_0x10879f(++_0x5ecf55);}(_0xa51b,0x9d));var _0xba51=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0xa51b[_0x207a02];return _0xd995c3;};'use strict';var _=require(_0xba51('0x0'));var util=require('util');var logger=require(_0xba51('0x1'))(_0xba51('0x2'));var moment=require(_0xba51('0x3'));var BPromise=require(_0xba51('0x4'));var rp=require(_0xba51('0x5'));var htmlToText=require(_0xba51('0x6'));var fs=require('fs');var path=require(_0xba51('0x7'));var rimraf=require(_0xba51('0x8'));var config=require(_0xba51('0x9'));var attributes=require(_0xba51('0xa'));module['exports']=function(_0x58c7a2,_0x25e510){return _0x58c7a2[_0xba51('0xb')](_0xba51('0xc'),attributes,{'tableName':_0xba51('0xd'),'paranoid':![],'indexes':[{'name':_0xba51('0xe'),'fields':['messageId']},{'name':_0xba51('0xf'),'fields':[_0xba51('0x10'),_0xba51('0x11')],'type':_0xba51('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2b07ce,_0x4b4934,_0x534f7e){if(_0x2b07ce['body']){_0x2b07ce['plainBody']=htmlToText['fromString'](_0x2b07ce[_0xba51('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x534f7e(null,_0x4b4934);},'afterCreate':function(_0x57a3b3,_0x542e10,_0x81518c){var _0x39d41e=_0x58c7a2['models'];var _0x3ceaf4=_0x57a3b3[_0xba51('0x14')]({'plain':!![]});if(_0x3ceaf4['direction']['toLowerCase']()==='in'||_0x3ceaf4[_0xba51('0x15')][_0xba51('0x16')]()==='out'&&!_0x3ceaf4[_0xba51('0x17')]&&!_['isNil'](_0x3ceaf4[_0xba51('0x18')])){_0x39d41e[_0xba51('0x19')][_0xba51('0x1a')]({'where':{'id':_0x3ceaf4[_0xba51('0x1b')]}})[_0xba51('0x1c')](function(_0x1e38fd){if(_0x1e38fd){_0x1e38fd[_0xba51('0x1d')]({'lastMsgAt':_0x3ceaf4[_0xba51('0x1e')],'lastMsgDirection':_0x3ceaf4[_0xba51('0x15')][_0xba51('0x16')](),'lastMsgBody':_0x3ceaf4[_0xba51('0x13')]});}})['catch'](function(_0x2bad92){console[_0xba51('0x1f')](_0x2bad92);});}_0x81518c();}},'charset':_0xba51('0x20'),'collate':_0xba51('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 6355013..f70ac9f 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 _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 +var _0x396d=['client','http','defaults','redis','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','body','options','raw','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4ace20,_0x12a5a1){var _0x1ebfac=function(_0x394f34){while(--_0x394f34){_0x4ace20['push'](_0x4ace20['shift']());}};_0x1ebfac(++_0x12a5a1);}(_0x396d,0x97));var _0xd396=function(_0x5c382f,_0x2067c5){_0x5c382f=_0x5c382f-0x0;var _0x8ba7fd=_0x396d[_0x5c382f];return _0x8ba7fd;};'use strict';var _=require('lodash');var util=require(_0xd396('0x0'));var moment=require(_0xd396('0x1'));var BPromise=require(_0xd396('0x2'));var rs=require(_0xd396('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd396('0x4'))['db'];var utils=require(_0xd396('0x5'));var logger=require(_0xd396('0x6'))('rpc');var config=require(_0xd396('0x7'));var jayson=require(_0xd396('0x8'));var client=jayson[_0xd396('0x9')][_0xd396('0xa')]({'port':0x232a});config['redis']=_[_0xd396('0xb')](config[_0xd396('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd396('0xd'))['register'](socket);function respondWithRpcPromise(_0xe39e67,_0x30ab98,_0x3a67d9){return new BPromise(function(_0x136a71,_0x259609){return client[_0xd396('0xe')](_0xe39e67,_0x3a67d9)[_0xd396('0xf')](function(_0x504268){logger[_0xd396('0x10')](_0xd396('0x11'),_0x30ab98,_0xd396('0x12'));logger[_0xd396('0x13')](_0xd396('0x14'),_0x30ab98,_0xd396('0x12'),JSON[_0xd396('0x15')](_0x504268));if(_0x504268[_0xd396('0x16')]){if(_0x504268[_0xd396('0x16')][_0xd396('0x17')]===0x1f4){logger['error'](_0xd396('0x11'),_0x30ab98,_0x504268['error'][_0xd396('0x18')]);return _0x259609(_0x504268[_0xd396('0x16')][_0xd396('0x18')]);}logger[_0xd396('0x16')](_0xd396('0x11'),_0x30ab98,_0x504268[_0xd396('0x16')]['message']);return _0x136a71(_0x504268[_0xd396('0x16')][_0xd396('0x18')]);}else{logger[_0xd396('0x10')](_0xd396('0x11'),_0x30ab98,'request\x20sent');_0x136a71(_0x504268[_0xd396('0x19')][_0xd396('0x18')]);}})[_0xd396('0x1a')](function(_0xdcdc8c){logger['error'](_0xd396('0x11'),_0x30ab98,_0xdcdc8c);_0x259609(_0xdcdc8c);});});}exports[_0xd396('0x1b')]=function(_0x42d4be){var _0xdb6d8b=this;return new Promise(function(_0x2a3e84,_0x1a3c12){return db['MailMessage'][_0xd396('0x1c')](_0x42d4be[_0xd396('0x1d')],{'raw':_0x42d4be[_0xd396('0x1e')]?_0x42d4be[_0xd396('0x1e')][_0xd396('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x5f0bb3){logger[_0xd396('0x10')](_0xd396('0x1b'),_0x42d4be);logger[_0xd396('0x13')](_0xd396('0x1b'),_0x42d4be,JSON[_0xd396('0x15')](_0x5f0bb3));_0x2a3e84(_0x5f0bb3);})[_0xd396('0x1a')](function(_0x3b47d3){logger['error'](_0xd396('0x1b'),_0x3b47d3[_0xd396('0x18')],_0x42d4be);_0x1a3c12(_0xdb6d8b[_0xd396('0x16')](0x1f4,_0x3b47d3[_0xd396('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index e81b762..2b0956f 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 _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 +var _0x7a59=['length','mailMessage:','./mailMessage.events','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a59,0x16e));var _0x97a5=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x7a59[_0x4ed520];return _0x4415a6;};'use strict';var MailMessageEvents=require(_0x97a5('0x0'));var events=['save','remove',_0x97a5('0x1')];function createListener(_0xe6f28a,_0x23919f){return function(_0xdc5cf1){_0x23919f[_0x97a5('0x2')](_0xe6f28a,_0xdc5cf1);};}function removeListener(_0x5e2db0,_0x3ba155){return function(){MailMessageEvents[_0x97a5('0x3')](_0x5e2db0,_0x3ba155);};}exports[_0x97a5('0x4')]=function(_0x48201b){for(var _0x438520=0x0,_0x52d32f=events[_0x97a5('0x5')];_0x438520<_0x52d32f;_0x438520++){var _0x2c0efa=events[_0x438520];var _0x27e8a6=createListener(_0x97a5('0x6')+_0x2c0efa,_0x48201b);MailMessageEvents['on'](_0x2c0efa,_0x27e8a6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 1ffcbd8..81eeae4 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 _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 +var _0x5696=['removeTeams','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x5696,0x1c2));var _0x6569=function(_0x4119e3,_0x3d2502){_0x4119e3=_0x4119e3-0x0;var _0x523ed5=_0x5696[_0x4119e3];return _0x523ed5;};'use strict';var multer=require('multer');var util=require(_0x6569('0x0'));var path=require(_0x6569('0x1'));var timeout=require(_0x6569('0x2'));var express=require(_0x6569('0x3'));var router=express[_0x6569('0x4')]();var auth=require(_0x6569('0x5'));var interaction=require(_0x6569('0x6'));var config=require(_0x6569('0x7'));var controller=require(_0x6569('0x8'));router[_0x6569('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6569('0x9')](_0x6569('0xa'),auth[_0x6569('0xb')](),controller[_0x6569('0xc')]);router[_0x6569('0x9')](_0x6569('0xd'),auth[_0x6569('0xb')](),controller[_0x6569('0xe')]);router[_0x6569('0x9')]('/:id/members',auth[_0x6569('0xb')](),controller[_0x6569('0xf')]);router[_0x6569('0x9')](_0x6569('0x10'),auth[_0x6569('0xb')](),controller[_0x6569('0x11')]);router[_0x6569('0x9')](_0x6569('0x12'),auth[_0x6569('0xb')](),controller[_0x6569('0x13')]);router[_0x6569('0x14')]('/',auth[_0x6569('0xb')](),controller['create']);router[_0x6569('0x14')](_0x6569('0x10'),auth[_0x6569('0xb')](),controller['addTeams']);router[_0x6569('0x14')](_0x6569('0x12'),auth[_0x6569('0xb')](),controller[_0x6569('0x15')]);router[_0x6569('0x16')](_0x6569('0xd'),auth[_0x6569('0xb')](),controller[_0x6569('0x17')]);router[_0x6569('0x18')]('/:id',auth[_0x6569('0xb')](),controller[_0x6569('0x19')]);router[_0x6569('0x18')](_0x6569('0x10'),auth['isAuthenticated'](),controller[_0x6569('0x1a')]);router[_0x6569('0x18')](_0x6569('0x12'),auth[_0x6569('0xb')](),controller['removeAgents']);module[_0x6569('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b2eae97..a2b6205 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 _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 +var _0x896e=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x48a836,_0xa1d010){var _0x249dc8=function(_0x2a95a0){while(--_0x2a95a0){_0x48a836['push'](_0x48a836['shift']());}};_0x249dc8(++_0xa1d010);}(_0x896e,0x1e9));var _0xe896=function(_0x37fd33,_0x2c315e){_0x37fd33=_0x37fd33-0x0;var _0x566305=_0x896e[_0x37fd33];return _0x566305;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe896('0x2')]},'timeout':{'type':Sequelize[_0xe896('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe896('0x5')](_0xe896('0x6'),_0xe896('0x7'),_0xe896('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 95cd76f..136805d 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 _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 +var _0x8952=['send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','where','filters','pick','merge','VIRTUAL','filter','MailQueue','includeAll','include','rows','params','length','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','MailQueueId','findAll','User','UserId','agent','mailPause','updatedAt','createdAt','format','SIP','getTeams','nolimit','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./mailQueue.socket','register','sendStatus','status','end','json','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','error','name'];(function(_0x22cb15,_0xd19206){var _0x3844b4=function(_0x3c68fb){while(--_0x3c68fb){_0x22cb15['push'](_0x22cb15['shift']());}};_0x3844b4(++_0xd19206);}(_0x8952,0x17e));var _0x2895=function(_0x3099a3,_0xee4527){_0x3099a3=_0x3099a3-0x0;var _0x314262=_0x8952[_0x3099a3];return _0x314262;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2895('0x0'));var rimraf=require(_0x2895('0x1'));var zipdir=require(_0x2895('0x2'));var jsonpatch=require(_0x2895('0x3'));var rp=require(_0x2895('0x4'));var moment=require('moment');var BPromise=require(_0x2895('0x5'));var Mustache=require(_0x2895('0x6'));var util=require(_0x2895('0x7'));var path=require('path');var sox=require(_0x2895('0x8'));var csv=require(_0x2895('0x9'));var ejs=require(_0x2895('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x9'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];config[_0x2895('0x15')]=_['defaults'](config[_0x2895('0x15')],{'host':_0x2895('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2895('0x17'))[_0x2895('0x18')](socket);function respondWithStatusCode(_0x5777a0,_0x2198c3){_0x2198c3=_0x2198c3||0xcc;return function(_0xd8192e){if(_0xd8192e){return _0x5777a0[_0x2895('0x19')](_0x2198c3);}return _0x5777a0[_0x2895('0x1a')](_0x2198c3)[_0x2895('0x1b')]();};}function respondWithResult(_0x2627e6,_0x6a5c7e){_0x6a5c7e=_0x6a5c7e||0xc8;return function(_0x31bb7f){if(_0x31bb7f){return _0x2627e6[_0x2895('0x1a')](_0x6a5c7e)[_0x2895('0x1c')](_0x31bb7f);}};}function respondWithFilteredResult(_0x10a1bf,_0x183b05){return function(_0xbf8b63){if(_0xbf8b63){var _0x2cb505=_0xbf8b63[_0x2895('0x1d')],_0x155124=_0x183b05['offset'],_0x184d11=_0x183b05['offset']+_0x183b05['limit'],_0x2fe8fe;if(_0x184d11>=_0x2cb505){_0x184d11=_0x2cb505;_0x2fe8fe=0xc8;}else{_0x2fe8fe=0xce;}_0x10a1bf[_0x2895('0x1a')](_0x2fe8fe);return _0x10a1bf[_0x2895('0x1e')](_0x2895('0x1f'),_0x155124+'-'+_0x184d11+'/'+_0x2cb505)['json'](_0xbf8b63);}return null;};}function patchUpdates(_0x2813a3){return function(_0x190b79){try{jsonpatch[_0x2895('0x20')](_0x190b79,_0x2813a3,!![]);}catch(_0x19228e){return BPromise[_0x2895('0x21')](_0x19228e);}return _0x190b79['save']();};}function saveUpdates(_0x30c6c3,_0x5e93a4){return function(_0x5671fa){if(_0x5671fa){return _0x5671fa[_0x2895('0x22')](_0x30c6c3)[_0x2895('0x23')](function(_0x6f8ad4){return _0x6f8ad4;});}return null;};}function removeEntity(_0x511286,_0x4e884f){return function(_0x3a72fa){if(_0x3a72fa){return _0x3a72fa[_0x2895('0x24')]()[_0x2895('0x23')](function(){var _0x4a21cf=_0x3a72fa[_0x2895('0x25')]({'plain':!![]});var _0x3690ce='MailQueues';return db[_0x2895('0x26')][_0x2895('0x24')]({'where':{'type':_0x3690ce,'resourceId':_0x4a21cf['id']}})[_0x2895('0x23')](function(){return _0x3a72fa;});})['then'](function(){_0x511286[_0x2895('0x1a')](0xcc)[_0x2895('0x1b')]();});}};}function handleEntityNotFound(_0x5eedfc,_0x21f549){return function(_0x501898){if(!_0x501898){_0x5eedfc['sendStatus'](0x194);}return _0x501898;};}function handleError(_0x18a935,_0x4ee2cc){_0x4ee2cc=_0x4ee2cc||0x1f4;return function(_0xfa4f85){logger[_0x2895('0x27')](_0xfa4f85['stack']);if(_0xfa4f85['name']){delete _0xfa4f85[_0x2895('0x28')];}_0x18a935[_0x2895('0x1a')](_0x4ee2cc)[_0x2895('0x29')](_0xfa4f85);};}exports[_0x2895('0x2a')]=function(_0x14d150,_0xa61689){var _0x34e110={},_0x546514={},_0x133f86={'count':0x0,'rows':[]};var _0xd45db5=_[_0x2895('0x2b')](db['MailQueue'][_0x2895('0x2c')],function(_0x458a55){return{'name':_0x458a55[_0x2895('0x2d')],'type':_0x458a55[_0x2895('0x2e')]['key']};});_0x546514[_0x2895('0x2f')]=_[_0x2895('0x2b')](_0xd45db5,_0x2895('0x28'));_0x546514[_0x2895('0x30')]=_[_0x2895('0x31')](_0x14d150['query']);_0x546514['filters']=_[_0x2895('0x32')](_0x546514[_0x2895('0x2f')],_0x546514['query']);_0x34e110[_0x2895('0x33')]=_['intersection'](_0x546514[_0x2895('0x2f')],qs[_0x2895('0x34')](_0x14d150['query'][_0x2895('0x34')]));_0x34e110['attributes']=_0x34e110[_0x2895('0x33')]['length']?_0x34e110['attributes']:_0x546514[_0x2895('0x2f')];if(!_0x14d150[_0x2895('0x30')][_0x2895('0x35')]('nolimit')){_0x34e110[_0x2895('0x36')]=qs[_0x2895('0x36')](_0x14d150[_0x2895('0x30')][_0x2895('0x36')]);_0x34e110[_0x2895('0x37')]=qs[_0x2895('0x37')](_0x14d150[_0x2895('0x30')][_0x2895('0x37')]);}_0x34e110[_0x2895('0x38')]=qs[_0x2895('0x39')](_0x14d150['query'][_0x2895('0x39')]);_0x34e110[_0x2895('0x3a')]=qs[_0x2895('0x3b')](_[_0x2895('0x3c')](_0x14d150[_0x2895('0x30')],_0x546514[_0x2895('0x3b')]),_0xd45db5);if(_0x14d150[_0x2895('0x30')]['filter']){_0x34e110['where']=_[_0x2895('0x3d')](_0x34e110[_0x2895('0x3a')],{'$or':_[_0x2895('0x2b')](_0xd45db5,function(_0xed4fe0){if(_0xed4fe0[_0x2895('0x2e')]!==_0x2895('0x3e')){var _0x493947={};_0x493947[_0xed4fe0['name']]={'$like':'%'+_0x14d150[_0x2895('0x30')][_0x2895('0x3f')]+'%'};return _0x493947;}})});}_0x34e110=_['merge']({},_0x34e110,_0x14d150['options']);var _0x2a0eaf={'where':_0x34e110[_0x2895('0x3a')]};return db[_0x2895('0x40')][_0x2895('0x1d')](_0x2a0eaf)[_0x2895('0x23')](function(_0x3e1d16){_0x133f86['count']=_0x3e1d16;if(_0x14d150[_0x2895('0x30')][_0x2895('0x41')]){_0x34e110[_0x2895('0x42')]=[{'all':!![]}];}return db[_0x2895('0x40')]['findAll'](_0x34e110);})[_0x2895('0x23')](function(_0x1ffcc0){_0x133f86[_0x2895('0x43')]=_0x1ffcc0;return _0x133f86;})[_0x2895('0x23')](respondWithFilteredResult(_0xa61689,_0x34e110))['catch'](handleError(_0xa61689,null));};exports['show']=function(_0x46580f,_0x19ce85){var _0x371186={'raw':!![],'where':{'id':_0x46580f[_0x2895('0x44')]['id']}},_0x3c6d2c={};_0x3c6d2c['model']=_['keys'](db[_0x2895('0x40')][_0x2895('0x2c')]);_0x3c6d2c[_0x2895('0x30')]=_[_0x2895('0x31')](_0x46580f[_0x2895('0x30')]);_0x3c6d2c[_0x2895('0x3b')]=_[_0x2895('0x32')](_0x3c6d2c['model'],_0x3c6d2c[_0x2895('0x30')]);_0x371186[_0x2895('0x33')]=_[_0x2895('0x32')](_0x3c6d2c[_0x2895('0x2f')],qs[_0x2895('0x34')](_0x46580f[_0x2895('0x30')][_0x2895('0x34')]));_0x371186[_0x2895('0x33')]=_0x371186['attributes'][_0x2895('0x45')]?_0x371186[_0x2895('0x33')]:_0x3c6d2c[_0x2895('0x2f')];if(_0x46580f['query'][_0x2895('0x41')]){_0x371186[_0x2895('0x42')]=[{'all':!![]}];}_0x371186=_['merge']({},_0x371186,_0x46580f[_0x2895('0x46')]);return db[_0x2895('0x40')][_0x2895('0x47')](_0x371186)[_0x2895('0x23')](handleEntityNotFound(_0x19ce85,null))[_0x2895('0x23')](respondWithResult(_0x19ce85,null))[_0x2895('0x48')](handleError(_0x19ce85,null));};exports[_0x2895('0x49')]=function(_0x5f13c4,_0x20ec59){return db[_0x2895('0x40')]['create'](_0x5f13c4['body'],{})['then'](function(_0x212a1f){var _0xe552b6=_0x5f13c4[_0x2895('0x4a')][_0x2895('0x25')]({'plain':!![]});if(!_0xe552b6)throw new Error(_0x2895('0x4b'));if(_0xe552b6[_0x2895('0x4c')]===_0x2895('0x4a')){var _0x7df911=_0x212a1f[_0x2895('0x25')]({'plain':!![]});var _0x3d043c=_0x2895('0x4d');return db[_0x2895('0x4e')][_0x2895('0x47')]({'where':{'name':_0x3d043c,'userProfileId':_0xe552b6[_0x2895('0x4f')]},'raw':!![]})[_0x2895('0x23')](function(_0x3c1135){if(_0x3c1135&&_0x3c1135[_0x2895('0x50')]===0x0){return db[_0x2895('0x26')][_0x2895('0x49')]({'name':_0x7df911[_0x2895('0x28')],'resourceId':_0x7df911['id'],'type':_0x3c1135[_0x2895('0x28')],'sectionId':_0x3c1135['id']},{})[_0x2895('0x23')](function(){return _0x212a1f;});}else{return _0x212a1f;}})[_0x2895('0x48')](function(_0x44b0c2){logger[_0x2895('0x27')](_0x2895('0x51'),_0x44b0c2);throw _0x44b0c2;});}return _0x212a1f;})[_0x2895('0x23')](respondWithResult(_0x20ec59,0xc9))[_0x2895('0x48')](handleError(_0x20ec59,null));};exports[_0x2895('0x22')]=function(_0x4128f1,_0x6ea75f){if(_0x4128f1['body']['id']){delete _0x4128f1[_0x2895('0x52')]['id'];}return db[_0x2895('0x40')][_0x2895('0x47')]({'where':{'id':_0x4128f1[_0x2895('0x44')]['id']}})[_0x2895('0x23')](handleEntityNotFound(_0x6ea75f,null))[_0x2895('0x23')](saveUpdates(_0x4128f1['body'],null))[_0x2895('0x23')](respondWithResult(_0x6ea75f,null))['catch'](handleError(_0x6ea75f,null));};exports[_0x2895('0x24')]=function(_0x2fed1c,_0x319795){return db[_0x2895('0x40')][_0x2895('0x47')]({'where':{'id':_0x2fed1c['params']['id']}})['then'](handleEntityNotFound(_0x319795,null))[_0x2895('0x23')](removeEntity(_0x319795,null))[_0x2895('0x48')](handleError(_0x319795,null));};exports[_0x2895('0x53')]=function(_0x5c76aa,_0x258f69){return db['MailQueue'][_0x2895('0x53')]()['then'](respondWithResult(_0x258f69,null))['catch'](handleError(_0x258f69,null));};exports['getMembers']=function(_0x58cfd6,_0x36177d,_0x2ff725){var _0x402e00={'raw':!![],'where':{}},_0x4336c={},_0x421b09;return db[_0x2895('0x40')][_0x2895('0x54')]({'where':{'id':_0x58cfd6['params']['id']}})[_0x2895('0x23')](handleEntityNotFound(_0x36177d,null))[_0x2895('0x23')](function(_0x5b742b){if(_0x5b742b){_0x421b09=_0x5b742b[_0x2895('0x25')]({'plain':!![]});_0x4336c['model']=_['keys'](db[_0x2895('0x55')][_0x2895('0x2c')]);_0x4336c['query']=_[_0x2895('0x31')](_0x58cfd6[_0x2895('0x30')]);_0x4336c[_0x2895('0x3b')]=_[_0x2895('0x32')](_0x4336c['model'],_0x4336c[_0x2895('0x30')]);_0x402e00['attributes']=_[_0x2895('0x32')](_0x4336c['model'],qs['fields'](_0x58cfd6[_0x2895('0x30')]['fields']));_0x402e00[_0x2895('0x33')]=_0x402e00[_0x2895('0x33')][_0x2895('0x45')]?_0x402e00['attributes']:_0x4336c[_0x2895('0x2f')];if(!_0x58cfd6[_0x2895('0x30')]['hasOwnProperty']('nolimit')){_0x402e00[_0x2895('0x36')]=qs[_0x2895('0x36')](_0x58cfd6['query'][_0x2895('0x36')]);_0x402e00['offset']=qs['offset'](_0x58cfd6[_0x2895('0x30')][_0x2895('0x37')]);}_0x402e00[_0x2895('0x38')]=qs['sort'](_0x58cfd6[_0x2895('0x30')][_0x2895('0x39')]);_0x402e00[_0x2895('0x3a')]=qs[_0x2895('0x3b')](_[_0x2895('0x3c')](_0x58cfd6[_0x2895('0x30')],_0x4336c[_0x2895('0x3b')]));_0x402e00['where'][_0x2895('0x56')]=_0x5b742b['id'];if(_0x58cfd6[_0x2895('0x30')][_0x2895('0x3f')]){_0x402e00[_0x2895('0x3a')]=_[_0x2895('0x3d')](_0x402e00[_0x2895('0x3a')],{'$or':_[_0x2895('0x2b')](_0x402e00[_0x2895('0x33')],function(_0x481464){var _0x19c207={};_0x19c207[_0x481464]={'$like':'%'+_0x58cfd6[_0x2895('0x30')][_0x2895('0x3f')]+'%'};return _0x19c207;})});}_0x402e00=_[_0x2895('0x3d')]({},_0x402e00,_0x58cfd6[_0x2895('0x46')]);return db[_0x2895('0x55')][_0x2895('0x57')](_0x402e00);}})[_0x2895('0x23')](function(_0x35ae08){if(_0x35ae08){return db[_0x2895('0x58')]['findAndCountAll']({'where':{'id':_[_0x2895('0x2b')](_0x35ae08,_0x2895('0x59')),'role':_0x2895('0x5a')},'attributes':['id',_0x2895('0x28'),_0x2895('0x5b'),_0x2895('0x5c'),_0x2895('0x5d')]});}})[_0x2895('0x23')](function(_0x203609){if(_0x203609){return{'count':_0x203609[_0x2895('0x1d')],'rows':_['map'](_0x203609[_0x2895('0x43')],function(_0xa271b6){return{'membername':_0xa271b6[_0x2895('0x28')],'UserId':_0xa271b6['id'],'queue_name':_0x421b09[_0x2895('0x28')],'MailQueueId':_0x421b09['id'],'interface':util[_0x2895('0x5e')]('%s/%s',_0x2895('0x5f'),_0xa271b6[_0x2895('0x28')]),'penalty':0x0,'paused':_0xa271b6['mailPause'],'createdAt':_0xa271b6['createdAt'],'updatedAt':_0xa271b6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2895('0x23')](respondWithFilteredResult(_0x36177d,_0x402e00))[_0x2895('0x48')](handleError(_0x36177d,null));};exports[_0x2895('0x60')]=function(_0x22cbc4,_0x31e21a,_0x48c014){var _0x5e6a1f={};var _0x2edb26={};var _0x580796;var _0x422b67;return db['MailQueue'][_0x2895('0x54')]({'where':{'id':_0x22cbc4[_0x2895('0x44')]['id']}})['then'](handleEntityNotFound(_0x31e21a,null))[_0x2895('0x23')](function(_0x684e29){if(_0x684e29){_0x580796=_0x684e29;_0x2edb26[_0x2895('0x2f')]=_[_0x2895('0x31')](db['Team']['rawAttributes']);_0x2edb26[_0x2895('0x30')]=_['keys'](_0x22cbc4['query']);_0x2edb26[_0x2895('0x3b')]=_[_0x2895('0x32')](_0x2edb26[_0x2895('0x2f')],_0x2edb26[_0x2895('0x30')]);_0x5e6a1f['attributes']=_[_0x2895('0x32')](_0x2edb26[_0x2895('0x2f')],qs[_0x2895('0x34')](_0x22cbc4[_0x2895('0x30')][_0x2895('0x34')]));_0x5e6a1f[_0x2895('0x33')]=_0x5e6a1f[_0x2895('0x33')][_0x2895('0x45')]?_0x5e6a1f[_0x2895('0x33')]:_0x2edb26[_0x2895('0x2f')];_0x5e6a1f[_0x2895('0x38')]=qs[_0x2895('0x39')](_0x22cbc4['query'][_0x2895('0x39')]);_0x5e6a1f[_0x2895('0x3a')]=qs[_0x2895('0x3b')](_['pick'](_0x22cbc4[_0x2895('0x30')],_0x2edb26[_0x2895('0x3b')]));if(_0x22cbc4['query'][_0x2895('0x3f')]){_0x5e6a1f[_0x2895('0x3a')]=_[_0x2895('0x3d')](_0x5e6a1f['where'],{'$or':_[_0x2895('0x2b')](_0x5e6a1f[_0x2895('0x33')],function(_0x1774e8){var _0x3fc6a1={};_0x3fc6a1[_0x1774e8]={'$like':'%'+_0x22cbc4['query'][_0x2895('0x3f')]+'%'};return _0x3fc6a1;})});}_0x5e6a1f=_[_0x2895('0x3d')]({},_0x5e6a1f,_0x22cbc4[_0x2895('0x46')]);return _0x580796['getTeams'](_0x5e6a1f);}})[_0x2895('0x23')](function(_0x4e2f47){if(_0x4e2f47){_0x422b67=_0x4e2f47[_0x2895('0x45')];if(!_0x22cbc4[_0x2895('0x30')][_0x2895('0x35')](_0x2895('0x61'))){_0x5e6a1f['limit']=qs[_0x2895('0x36')](_0x22cbc4[_0x2895('0x30')][_0x2895('0x36')]);_0x5e6a1f['offset']=qs[_0x2895('0x37')](_0x22cbc4['query'][_0x2895('0x37')]);}return _0x580796[_0x2895('0x60')](_0x5e6a1f);}})['then'](function(_0x4f65e7){if(_0x4f65e7){return _0x4f65e7?{'count':_0x422b67,'rows':_0x4f65e7}:null;}})[_0x2895('0x23')](respondWithResult(_0x31e21a,null))[_0x2895('0x48')](handleError(_0x31e21a,null));};exports['addTeams']=function(_0x17b607,_0x3ecb62,_0x5a6b19){var _0x337ef9=_0x17b607[_0x2895('0x52')][_0x2895('0x62')];return db[_0x2895('0x63')][_0x2895('0x57')]({'where':{'id':_0x337ef9},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2895('0x64'),'attributes':['id',_0x2895('0x28'),_0x2895('0x65'),_0x2895('0x66'),_0x2895('0x67')],'raw':!![]}]})['then'](function(_0x3d414d){if(_0x3d414d){var _0x289c14=_[_0x2895('0x68')](_0x3d414d,function(_0x1cc5f6){var _0x5d5048=_0x1cc5f6[_0x2895('0x25')]({'plain':!![]});return _0x5d5048[_0x2895('0x64')];});return db[_0x2895('0x40')][_0x2895('0x47')]({'where':{'id':_0x17b607['params']['id']}})[_0x2895('0x23')](function(_0x3ab611){return db[_0x2895('0x69')][_0x2895('0x6a')](function(_0x2e0623){return _0x3ab611[_0x2895('0x6b')](_0x337ef9,{'transaction':_0x2e0623})['then'](function(){return BPromise[_0x2895('0x6c')](_0x289c14,function(_0x25d249){return db[_0x2895('0x55')]['findOrCreate']({'where':{'UserId':_0x25d249['id'],'MailQueueId':_0x17b607['params']['id']},'transaction':_0x2e0623});});})[_0x2895('0x23')](function(){_0x289c14[_0x2895('0x6d')](function(_0x1fa0c5){socket[_0x2895('0x6e')](_0x2895('0x6f'),{'UserId':_0x1fa0c5['id'],'MailQueueId':_0x3ab611['id']});});});});});}})['then'](respondWithStatusCode(_0x3ecb62,null))[_0x2895('0x48')](handleError(_0x3ecb62,null));};exports[_0x2895('0x70')]=function(_0x3f2e65,_0x5da9af,_0x5c0937){return db[_0x2895('0x63')][_0x2895('0x57')]({'where':{'id':_0x3f2e65[_0x2895('0x30')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2895('0x58')],'as':_0x2895('0x64'),'attributes':['id'],'raw':!![]}]})[_0x2895('0x23')](handleEntityNotFound(_0x5da9af,null))[_0x2895('0x23')](function(_0x5180fd){var _0x38e721=_[_0x2895('0x2b')](_0x5180fd,'id');var _0x71d436=[];var _0x3b9920=[];var _0x4ec870=squel[_0x2895('0x71')]();_0x4ec870[_0x2895('0x72')](_0x2895('0x73'))[_0x2895('0x74')](_0x2895('0x75'),'tq')[_0x2895('0x76')](_0x2895('0x77'),'ut',_0x2895('0x78'))[_0x2895('0x3a')]('MailQueueId\x20=\x20?',_0x3f2e65['params']['id']);for(var _0x4b8c0f=0x0;_0x4b8c0f<_0x5180fd['length'];_0x4b8c0f+=0x1){let _0x440fbf=_0x5180fd[_0x4b8c0f];for(var _0x858463=0x0;_0x858463<_0x440fbf[_0x2895('0x64')][_0x2895('0x45')];_0x858463+=0x1){let _0x227d11=_0x440fbf[_0x2895('0x64')][_0x858463];var _0x8278ab=_0x4ec870[_0x2895('0x79')]();_0x8278ab[_0x2895('0x3a')](_0x2895('0x7a'),_0x227d11['id']);_0x3b9920[_0x2895('0x7b')](db[_0x2895('0x69')][_0x2895('0x30')](_0x8278ab[_0x2895('0x7c')](),{'type':db['sequelize'][_0x2895('0x7d')][_0x2895('0x7e')]})[_0x2895('0x23')](function(_0x5a651e){if(_0x5a651e['length']===0x1){return _0x227d11['id'];}else{var _0x1e167c=_[_0x2895('0x7f')](_['map'](_0x5a651e,_0x2895('0x80')),function(_0x58fca3){return _[_0x2895('0x81')](_0x38e721,_0x58fca3);});if(_0x1e167c){return _0x227d11['id'];}}}));}}return BPromise[_0x2895('0x82')](_0x3b9920)[_0x2895('0x23')](function(_0xe06543){_0x71d436=_(_0x71d436)[_0x2895('0x83')](_0xe06543)[_0x2895('0x84')]()[_0x2895('0x85')]();return db['MailQueue'][_0x2895('0x47')]({'where':{'id':_0x3f2e65[_0x2895('0x44')]['id']}})['then'](function(_0x2bb3d1){return db[_0x2895('0x69')]['transaction'](function(_0x1cf787){return _0x2bb3d1[_0x2895('0x70')](_0x3f2e65[_0x2895('0x30')][_0x2895('0x62')],{'transaction':_0x1cf787})[_0x2895('0x23')](function(){if(!_[_0x2895('0x86')](_0x71d436)){return _0x2bb3d1[_0x2895('0x87')](_0x71d436,{'transaction':_0x1cf787});}})[_0x2895('0x23')](function(){_0x71d436[_0x2895('0x6d')](function(_0x305511){socket[_0x2895('0x6e')](_0x2895('0x88'),{'UserId':_0x305511,'MailQueueId':_0x2bb3d1['id']});});});});});});})[_0x2895('0x23')](respondWithStatusCode(_0x5da9af,null))[_0x2895('0x48')](handleError(_0x5da9af,null));};exports['addAgents']=function(_0x257949,_0x70965c,_0x7151bc){return db[_0x2895('0x40')][_0x2895('0x47')]({'where':{'id':_0x257949[_0x2895('0x44')]['id']}})[_0x2895('0x23')](handleEntityNotFound(_0x70965c,null))['then'](function(_0x17055a){if(_0x17055a){return _0x17055a['addAgents'](_0x257949[_0x2895('0x52')]['ids'],_[_0x2895('0x89')](_0x257949[_0x2895('0x52')],[_0x2895('0x62'),'id'])||{})[_0x2895('0x8a')](function(_0xf7a53c){for(var _0x509bb9=0x0;_0x509bb9<_0x257949[_0x2895('0x52')][_0x2895('0x62')][_0x2895('0x45')];_0x509bb9+=0x1){socket[_0x2895('0x6e')](_0x2895('0x6f'),{'UserId':_0x257949[_0x2895('0x52')][_0x2895('0x62')][_0x509bb9],'MailQueueId':_0x257949['params']['id']});}return _0xf7a53c;});}})[_0x2895('0x23')](respondWithResult(_0x70965c,null))[_0x2895('0x48')](handleError(_0x70965c,null));};exports[_0x2895('0x87')]=function(_0x4b7c11,_0x5201ed,_0x335da0){return db[_0x2895('0x40')][_0x2895('0x47')]({'where':{'id':_0x4b7c11['params']['id']}})[_0x2895('0x23')](handleEntityNotFound(_0x5201ed,null))[_0x2895('0x23')](function(_0x43752d){if(_0x43752d){return _0x43752d[_0x2895('0x87')](_0x4b7c11[_0x2895('0x30')][_0x2895('0x62')])[_0x2895('0x23')](function(){if(_[_0x2895('0x8b')](_0x4b7c11[_0x2895('0x30')][_0x2895('0x62')])){for(var _0x311026=0x0;_0x311026<_0x4b7c11[_0x2895('0x30')][_0x2895('0x62')][_0x2895('0x45')];_0x311026+=0x1){socket[_0x2895('0x6e')](_0x2895('0x88'),{'UserId':Number(_0x4b7c11[_0x2895('0x30')][_0x2895('0x62')][_0x311026]),'MailQueueId':Number(_0x4b7c11[_0x2895('0x44')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4b7c11[_0x2895('0x30')][_0x2895('0x62')]),'MailQueueId':Number(_0x4b7c11[_0x2895('0x44')]['id'])});}});}})[_0x2895('0x23')](respondWithStatusCode(_0x5201ed,null))[_0x2895('0x48')](handleError(_0x5201ed,null));};exports[_0x2895('0x8c')]=function(_0x518f6d,_0x5d5376,_0x51b96a){var _0x40d48c={};var _0x4f0b85={};var _0x210c05;var _0x34710c;return db[_0x2895('0x40')]['findOne']({'where':{'id':_0x518f6d[_0x2895('0x44')]['id']}})[_0x2895('0x23')](handleEntityNotFound(_0x5d5376,null))[_0x2895('0x23')](function(_0x5ecadc){if(_0x5ecadc){_0x210c05=_0x5ecadc;_0x4f0b85[_0x2895('0x2f')]=_[_0x2895('0x31')](db[_0x2895('0x58')][_0x2895('0x2c')]);_0x4f0b85[_0x2895('0x30')]=_[_0x2895('0x31')](_0x518f6d[_0x2895('0x30')]);_0x4f0b85[_0x2895('0x3b')]=_['intersection'](_0x4f0b85[_0x2895('0x2f')],_0x4f0b85[_0x2895('0x30')]);_0x40d48c[_0x2895('0x33')]=_[_0x2895('0x32')](_0x4f0b85['model'],qs['fields'](_0x518f6d[_0x2895('0x30')][_0x2895('0x34')]));_0x40d48c[_0x2895('0x33')]=_0x40d48c[_0x2895('0x33')][_0x2895('0x45')]?_0x40d48c[_0x2895('0x33')]:_0x4f0b85['model'];_0x40d48c[_0x2895('0x38')]=qs[_0x2895('0x39')](_0x518f6d[_0x2895('0x30')][_0x2895('0x39')]);_0x40d48c['where']=qs[_0x2895('0x3b')](_['pick'](_0x518f6d['query'],_0x4f0b85['filters']));if(_0x518f6d[_0x2895('0x30')]['filter']){_0x40d48c['where']=_['merge'](_0x40d48c['where'],{'$or':_['map'](_0x40d48c[_0x2895('0x33')],function(_0x16e646){var _0x25969b={};_0x25969b[_0x16e646]={'$like':'%'+_0x518f6d[_0x2895('0x30')]['filter']+'%'};return _0x25969b;})});}_0x40d48c=_['merge']({},_0x40d48c,_0x518f6d['options']);return _0x210c05[_0x2895('0x8c')](_0x40d48c);}})[_0x2895('0x23')](function(_0x2ee836){if(_0x2ee836){_0x34710c=_0x2ee836[_0x2895('0x45')];if(!_0x518f6d[_0x2895('0x30')][_0x2895('0x35')](_0x2895('0x61'))){_0x40d48c[_0x2895('0x36')]=qs['limit'](_0x518f6d[_0x2895('0x30')][_0x2895('0x36')]);_0x40d48c[_0x2895('0x37')]=qs['offset'](_0x518f6d[_0x2895('0x30')]['offset']);}return _0x210c05[_0x2895('0x8c')](_0x40d48c);}})[_0x2895('0x23')](function(_0x1a096f){if(_0x1a096f){return _0x1a096f?{'count':_0x34710c,'rows':_0x1a096f}:null;}})[_0x2895('0x23')](respondWithResult(_0x5d5376,null))['catch'](handleError(_0x5d5376,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 70b515b..4b0dcda 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 _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 +var _0x0f2a=['update','remove','emit','hasOwnProperty','hook','exports','events','MailQueue','save'];(function(_0x157e8e,_0x2461ba){var _0x2b06b5=function(_0x49ee6f){while(--_0x49ee6f){_0x157e8e['push'](_0x157e8e['shift']());}};_0x2b06b5(++_0x2461ba);}(_0x0f2a,0x72));var _0xa0f2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0f2a[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xa0f2('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xa0f2('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa0f2('0x2'),'afterUpdate':_0xa0f2('0x3'),'afterDestroy':_0xa0f2('0x4')};function emitEvent(_0x22ea4d){return function(_0xeec55f,_0x18eff5,_0x4b2694){MailQueueEvents[_0xa0f2('0x5')](_0x22ea4d+':'+_0xeec55f['id'],_0xeec55f);MailQueueEvents[_0xa0f2('0x5')](_0x22ea4d,_0xeec55f);_0x4b2694(null);};}for(var e in events){if(events[_0xa0f2('0x6')](e)){var event=events[e];MailQueue[_0xa0f2('0x7')](e,emitEvent(event));}}module[_0xa0f2('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index a485bbb..9d65928 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 _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 +var _0x258c=['bluebird','path','rimraf','./mailQueue.attributes','exports','define','mail_queues','util','../../config/logger','api','moment'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x258c,0x130));var _0xc258=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x258c[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var util=require(_0xc258('0x0'));var logger=require(_0xc258('0x1'))(_0xc258('0x2'));var moment=require(_0xc258('0x3'));var BPromise=require(_0xc258('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc258('0x5'));var rimraf=require(_0xc258('0x6'));var config=require('../../config/environment');var attributes=require(_0xc258('0x7'));module[_0xc258('0x8')]=function(_0x5e46e6,_0x2fa5dd){return _0x5e46e6[_0xc258('0x9')]('MailQueue',attributes,{'tableName':_0xc258('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 968bee9..6a3e611 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 _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 +var _0x1623=['code','message','catch','GetMailQueue','MailQueue','options','raw','limit','include','model','attributes','map','then','ShowMailQueue','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x8a7e8c,_0x3ff6a8){var _0x24def3=function(_0x5533cc){while(--_0x5533cc){_0x8a7e8c['push'](_0x8a7e8c['shift']());}};_0x24def3(++_0x3ff6a8);}(_0x1623,0x112));var _0x3162=function(_0x1f3153,_0x3ed3eb){_0x1f3153=_0x1f3153-0x0;var _0xa336bd=_0x1623[_0x1f3153];return _0xa336bd;};'use strict';var _=require('lodash');var util=require(_0x3162('0x0'));var moment=require(_0x3162('0x1'));var BPromise=require(_0x3162('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require(_0x3162('0x6'))(_0x3162('0x7'));var config=require(_0x3162('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3162('0x9')]({'port':0x232a});config[_0x3162('0xa')]=_[_0x3162('0xb')](config[_0x3162('0xa')],{'host':_0x3162('0xc'),'port':0x18eb});var socket=require(_0x3162('0xd'))(new Redis(config[_0x3162('0xa')]));require(_0x3162('0xe'))['register'](socket);function respondWithRpcPromise(_0x677a1e,_0x20486b,_0x22ab40){return new BPromise(function(_0xbe2eef,_0x8fabfb){return client[_0x3162('0xf')](_0x677a1e,_0x22ab40)['then'](function(_0x2e52dd){logger[_0x3162('0x10')](_0x3162('0x11'),_0x20486b,_0x3162('0x12'));logger[_0x3162('0x13')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x20486b,_0x3162('0x12'),JSON[_0x3162('0x14')](_0x2e52dd));if(_0x2e52dd['error']){if(_0x2e52dd[_0x3162('0x15')][_0x3162('0x16')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x20486b,_0x2e52dd[_0x3162('0x15')][_0x3162('0x17')]);return _0x8fabfb(_0x2e52dd[_0x3162('0x15')][_0x3162('0x17')]);}logger[_0x3162('0x15')](_0x3162('0x11'),_0x20486b,_0x2e52dd['error'][_0x3162('0x17')]);return _0xbe2eef(_0x2e52dd[_0x3162('0x15')]['message']);}else{logger[_0x3162('0x10')](_0x3162('0x11'),_0x20486b,_0x3162('0x12'));_0xbe2eef(_0x2e52dd['result'][_0x3162('0x17')]);}})[_0x3162('0x18')](function(_0xaca747){logger[_0x3162('0x15')]('MailQueue,\x20%s,\x20%s',_0x20486b,_0xaca747);_0x8fabfb(_0xaca747);});});}exports[_0x3162('0x19')]=function(_0x1ed7c6){var _0x110230=this;return new Promise(function(_0x539b6a,_0x5a8ffb){return db[_0x3162('0x1a')]['findAll']({'raw':_0x1ed7c6[_0x3162('0x1b')]?_0x1ed7c6[_0x3162('0x1b')][_0x3162('0x1c')]===undefined?!![]:![]:!![],'where':_0x1ed7c6[_0x3162('0x1b')]?_0x1ed7c6['options']['where']||null:null,'attributes':_0x1ed7c6[_0x3162('0x1b')]?_0x1ed7c6['options']['attributes']||null:null,'limit':_0x1ed7c6[_0x3162('0x1b')]?_0x1ed7c6[_0x3162('0x1b')][_0x3162('0x1d')]||null:null,'include':_0x1ed7c6[_0x3162('0x1b')]?_0x1ed7c6[_0x3162('0x1b')][_0x3162('0x1e')]?_['map'](_0x1ed7c6[_0x3162('0x1b')][_0x3162('0x1e')],function(_0xb49a94){return{'model':db[_0xb49a94[_0x3162('0x1f')]],'as':_0xb49a94['as'],'attributes':_0xb49a94[_0x3162('0x20')],'include':_0xb49a94[_0x3162('0x1e')]?_[_0x3162('0x21')](_0xb49a94[_0x3162('0x1e')],function(_0x5e2f1b){return{'model':db[_0x5e2f1b['model']],'as':_0x5e2f1b['as'],'attributes':_0x5e2f1b['attributes'],'include':_0x5e2f1b[_0x3162('0x1e')]?_[_0x3162('0x21')](_0x5e2f1b[_0x3162('0x1e')],function(_0xff50b0){return{'model':db[_0xff50b0['model']],'as':_0xff50b0['as'],'attributes':_0xff50b0[_0x3162('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3162('0x22')](function(_0xd0d616){logger['info']('GetMailQueue',_0x1ed7c6);logger[_0x3162('0x13')](_0x3162('0x19'),_0x1ed7c6,JSON['stringify'](_0xd0d616));_0x539b6a(_0xd0d616);})[_0x3162('0x18')](function(_0x2595c7){logger['error'](_0x3162('0x19'),_0x2595c7[_0x3162('0x17')],_0x1ed7c6);_0x5a8ffb(_0x110230[_0x3162('0x15')](0x1f4,_0x2595c7[_0x3162('0x17')]));});});};exports[_0x3162('0x23')]=function(_0x2d177d){var _0x41896f=this;return new Promise(function(_0x5dba14,_0x357201){return db[_0x3162('0x1a')]['find']({'raw':_0x2d177d['options']?_0x2d177d[_0x3162('0x1b')][_0x3162('0x1c')]===undefined?!![]:![]:!![],'where':_0x2d177d[_0x3162('0x1b')]?_0x2d177d[_0x3162('0x1b')][_0x3162('0x24')]||null:null,'attributes':_0x2d177d[_0x3162('0x1b')]?_0x2d177d[_0x3162('0x1b')][_0x3162('0x20')]||null:null,'include':_0x2d177d[_0x3162('0x1b')]?_0x2d177d[_0x3162('0x1b')][_0x3162('0x1e')]?_[_0x3162('0x21')](_0x2d177d['options'][_0x3162('0x1e')],function(_0x1279e2){return{'model':db[_0x1279e2['model']],'as':_0x1279e2['as'],'attributes':_0x1279e2[_0x3162('0x20')],'include':_0x1279e2['include']?_[_0x3162('0x21')](_0x1279e2['include'],function(_0x275129){return{'model':db[_0x275129[_0x3162('0x1f')]],'as':_0x275129['as'],'attributes':_0x275129['attributes'],'include':_0x275129[_0x3162('0x1e')]?_[_0x3162('0x21')](_0x275129[_0x3162('0x1e')],function(_0x10b97b){return{'model':db[_0x10b97b[_0x3162('0x1f')]],'as':_0x10b97b['as'],'attributes':_0x10b97b[_0x3162('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3162('0x22')](function(_0x448781){logger['info'](_0x3162('0x23'),_0x2d177d);logger[_0x3162('0x13')](_0x3162('0x23'),_0x2d177d,JSON['stringify'](_0x448781));_0x5dba14(_0x448781);})[_0x3162('0x18')](function(_0x2e3597){logger['error'](_0x3162('0x23'),_0x2e3597['message'],_0x2d177d);_0x357201(_0x41896f[_0x3162('0x15')](0x1f4,_0x2e3597[_0x3162('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 2dfc5a3..04c13b0 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 _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 +var _0xc8e0=['./mailQueue.events','emit','register','length','mailQueue:'];(function(_0x571c00,_0x3ae028){var _0x2887df=function(_0x5ebe70){while(--_0x5ebe70){_0x571c00['push'](_0x571c00['shift']());}};_0x2887df(++_0x3ae028);}(_0xc8e0,0x1a4));var _0x0c8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc8e0[_0x2641f9];return _0x585741;};'use strict';var MailQueueEvents=require(_0x0c8e('0x0'));var events=['save','remove','update'];function createListener(_0x5095a7,_0x557f68){return function(_0x3c27c0){_0x557f68[_0x0c8e('0x1')](_0x5095a7,_0x3c27c0);};}function removeListener(_0xc35151,_0x1752f9){return function(){MailQueueEvents['removeListener'](_0xc35151,_0x1752f9);};}exports[_0x0c8e('0x2')]=function(_0x1f1100){for(var _0x32548f=0x0,_0x15a227=events[_0x0c8e('0x3')];_0x32548f<_0x15a227;_0x32548f++){var _0x3eb683=events[_0x32548f];var _0x2906e3=createListener(_0x0c8e('0x4')+_0x3eb683,_0x1f1100);MailQueueEvents['on'](_0x3eb683,_0x2906e3);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6058c2b..0386067 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 _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 +var _0x2102=['isAuthenticated','/describe','describe','/:id','post','create','update','destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x1b7ce0,_0x415f0e){var _0x52a474=function(_0x3f956d){while(--_0x3f956d){_0x1b7ce0['push'](_0x1b7ce0['shift']());}};_0x52a474(++_0x415f0e);}(_0x2102,0x109));var _0x2210=function(_0xfb0272,_0x480702){_0xfb0272=_0xfb0272-0x0;var _0x35c196=_0x2102[_0xfb0272];return _0x35c196;};'use strict';var multer=require('multer');var util=require(_0x2210('0x0'));var path=require('path');var timeout=require(_0x2210('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x2210('0x2'));var interaction=require(_0x2210('0x3'));var config=require(_0x2210('0x4'));var controller=require(_0x2210('0x5'));router[_0x2210('0x6')]('/',auth[_0x2210('0x7')](),controller['index']);router[_0x2210('0x6')](_0x2210('0x8'),auth[_0x2210('0x7')](),controller[_0x2210('0x9')]);router['get'](_0x2210('0xa'),auth[_0x2210('0x7')](),controller['show']);router[_0x2210('0xb')]('/',auth[_0x2210('0x7')](),controller[_0x2210('0xc')]);router['put'](_0x2210('0xa'),auth[_0x2210('0x7')](),controller[_0x2210('0xd')]);router['delete'](_0x2210('0xa'),auth[_0x2210('0x7')](),controller[_0x2210('0xe')]);module[_0x2210('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 5d72aa4..6ce3d09 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 _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 +var _0x0b8b=['STRING','sequelize','exports','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b8b,0x159));var _0xb0b8=function(_0x9d1971,_0x50b82e){_0x9d1971=_0x9d1971-0x0;var _0x203469=_0x0b8b[_0x9d1971];return _0x203469;};'use strict';var moment=require('moment');var Sequelize=require(_0xb0b8('0x0'));module[_0xb0b8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb0b8('0x2')]},'leaveAt':{'type':Sequelize[_0xb0b8('0x2')]},'acceptAt':{'type':Sequelize[_0xb0b8('0x2')]},'exitAt':{'type':Sequelize[_0xb0b8('0x2')]},'reason':{'type':Sequelize[_0xb0b8('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f1918a9..e8591f5 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 _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 +var _0x8e7b=['MailQueueReport','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','find','create','body','params','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8e7b,0xee));var _0xb8e7=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x8e7b[_0x500419];return _0x241c1a;};'use strict';var pdf=require(_0xb8e7('0x0'));var emlformat=require(_0xb8e7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb8e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8e7('0x3'));var moment=require(_0xb8e7('0x4'));var BPromise=require(_0xb8e7('0x5'));var Mustache=require(_0xb8e7('0x6'));var util=require(_0xb8e7('0x7'));var path=require(_0xb8e7('0x8'));var sox=require('sox');var csv=require(_0xb8e7('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb8e7('0xa'));var squel=require('squel');var crypto=require(_0xb8e7('0xb'));var jsforce=require(_0xb8e7('0xc'));var deskjs=require(_0xb8e7('0xd'));var toCsv=require(_0xb8e7('0x9'));var querystring=require(_0xb8e7('0xe'));var Papa=require(_0xb8e7('0xf'));var Redis=require(_0xb8e7('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8e7('0x11'));var logger=require(_0xb8e7('0x12'))('api');var utils=require(_0xb8e7('0x13'));var config=require(_0xb8e7('0x14'));var licenseUtil=require(_0xb8e7('0x15'));var db=require(_0xb8e7('0x16'))['db'];function respondWithStatusCode(_0x578f23,_0x36f16c){_0x36f16c=_0x36f16c||0xcc;return function(_0x18cd98){if(_0x18cd98){return _0x578f23[_0xb8e7('0x17')](_0x36f16c);}return _0x578f23['status'](_0x36f16c)[_0xb8e7('0x18')]();};}function respondWithResult(_0x53aab8,_0x1eae37){_0x1eae37=_0x1eae37||0xc8;return function(_0x1ced3b){if(_0x1ced3b){return _0x53aab8[_0xb8e7('0x19')](_0x1eae37)[_0xb8e7('0x1a')](_0x1ced3b);}};}function respondWithFilteredResult(_0x571d67,_0x2eaa54){return function(_0x1164d3){if(_0x1164d3){var _0x286a38=_0x1164d3[_0xb8e7('0x1b')],_0x5d9ac8=_0x2eaa54['offset'],_0x1098ed=_0x2eaa54[_0xb8e7('0x1c')]+_0x2eaa54[_0xb8e7('0x1d')],_0x289cf2;if(_0x1098ed>=_0x286a38){_0x1098ed=_0x286a38;_0x289cf2=0xc8;}else{_0x289cf2=0xce;}_0x571d67[_0xb8e7('0x19')](_0x289cf2);return _0x571d67[_0xb8e7('0x1e')]('Content-Range',_0x5d9ac8+'-'+_0x1098ed+'/'+_0x286a38)[_0xb8e7('0x1a')](_0x1164d3);}return null;};}function patchUpdates(_0x395002){return function(_0x5b11a1){try{jsonpatch[_0xb8e7('0x1f')](_0x5b11a1,_0x395002,!![]);}catch(_0x21c903){return BPromise[_0xb8e7('0x20')](_0x21c903);}return _0x5b11a1[_0xb8e7('0x21')]();};}function saveUpdates(_0x197da6,_0x5afee8){return function(_0xf333fa){if(_0xf333fa){return _0xf333fa[_0xb8e7('0x22')](_0x197da6)[_0xb8e7('0x23')](function(_0x536ffb){return _0x536ffb;});}return null;};}function removeEntity(_0x478849,_0x30577){return function(_0x4b35bf){if(_0x4b35bf){return _0x4b35bf['destroy']()[_0xb8e7('0x23')](function(){_0x478849[_0xb8e7('0x19')](0xcc)[_0xb8e7('0x18')]();});}};}function handleEntityNotFound(_0x4d5705,_0xbe4f2b){return function(_0x2c7e47){if(!_0x2c7e47){_0x4d5705['sendStatus'](0x194);}return _0x2c7e47;};}function handleError(_0x308959,_0x2f92c9){_0x2f92c9=_0x2f92c9||0x1f4;return function(_0x4ef3d6){logger[_0xb8e7('0x24')](_0x4ef3d6[_0xb8e7('0x25')]);if(_0x4ef3d6[_0xb8e7('0x26')]){delete _0x4ef3d6[_0xb8e7('0x26')];}_0x308959['status'](_0x2f92c9)[_0xb8e7('0x27')](_0x4ef3d6);};}exports[_0xb8e7('0x28')]=function(_0x1ffdf6,_0x5d57da){var _0x157642={},_0x10f923={},_0x4f4020={'count':0x0,'rows':[]};var _0x33b208=_[_0xb8e7('0x29')](db[_0xb8e7('0x2a')][_0xb8e7('0x2b')],function(_0x2de6fe){return{'name':_0x2de6fe[_0xb8e7('0x2c')],'type':_0x2de6fe[_0xb8e7('0x2d')]['key']};});_0x10f923['model']=_[_0xb8e7('0x29')](_0x33b208,_0xb8e7('0x26'));_0x10f923[_0xb8e7('0x2e')]=_['keys'](_0x1ffdf6['query']);_0x10f923[_0xb8e7('0x2f')]=_[_0xb8e7('0x30')](_0x10f923['model'],_0x10f923[_0xb8e7('0x2e')]);_0x157642[_0xb8e7('0x31')]=_[_0xb8e7('0x30')](_0x10f923[_0xb8e7('0x32')],qs[_0xb8e7('0x33')](_0x1ffdf6['query'][_0xb8e7('0x33')]));_0x157642[_0xb8e7('0x31')]=_0x157642['attributes'][_0xb8e7('0x34')]?_0x157642[_0xb8e7('0x31')]:_0x10f923[_0xb8e7('0x32')];if(!_0x1ffdf6[_0xb8e7('0x2e')]['hasOwnProperty'](_0xb8e7('0x35'))){_0x157642[_0xb8e7('0x1d')]=qs[_0xb8e7('0x1d')](_0x1ffdf6[_0xb8e7('0x2e')][_0xb8e7('0x1d')]);_0x157642[_0xb8e7('0x1c')]=qs[_0xb8e7('0x1c')](_0x1ffdf6[_0xb8e7('0x2e')]['offset']);}_0x157642[_0xb8e7('0x36')]=qs[_0xb8e7('0x37')](_0x1ffdf6[_0xb8e7('0x2e')][_0xb8e7('0x37')]);_0x157642[_0xb8e7('0x38')]=qs[_0xb8e7('0x2f')](_[_0xb8e7('0x39')](_0x1ffdf6['query'],_0x10f923[_0xb8e7('0x2f')]),_0x33b208);if(_0x1ffdf6['query']['filter']){_0x157642[_0xb8e7('0x38')]=_[_0xb8e7('0x3a')](_0x157642[_0xb8e7('0x38')],{'$or':_[_0xb8e7('0x29')](_0x33b208,function(_0x5d332a){if(_0x5d332a[_0xb8e7('0x2d')]!=='VIRTUAL'){var _0x1c388d={};_0x1c388d[_0x5d332a[_0xb8e7('0x26')]]={'$like':'%'+_0x1ffdf6['query'][_0xb8e7('0x3b')]+'%'};return _0x1c388d;}})});}_0x157642=_[_0xb8e7('0x3a')]({},_0x157642,_0x1ffdf6[_0xb8e7('0x3c')]);var _0x52707a={'where':_0x157642[_0xb8e7('0x38')]};return db[_0xb8e7('0x2a')][_0xb8e7('0x1b')](_0x52707a)['then'](function(_0x4616ae){_0x4f4020['count']=_0x4616ae;if(_0x1ffdf6['query'][_0xb8e7('0x3d')]){_0x157642['include']=[{'all':!![]}];}return db['MailQueueReport'][_0xb8e7('0x3e')](_0x157642);})['then'](function(_0x1585dd){_0x4f4020[_0xb8e7('0x3f')]=_0x1585dd;return _0x4f4020;})[_0xb8e7('0x23')](respondWithFilteredResult(_0x5d57da,_0x157642))[_0xb8e7('0x40')](handleError(_0x5d57da,null));};exports['show']=function(_0x5b1504,_0x35673e){var _0x5a0806={'raw':!![],'where':{'id':_0x5b1504['params']['id']}},_0x59ff0c={};_0x59ff0c[_0xb8e7('0x32')]=_['keys'](db['MailQueueReport'][_0xb8e7('0x2b')]);_0x59ff0c[_0xb8e7('0x2e')]=_['keys'](_0x5b1504[_0xb8e7('0x2e')]);_0x59ff0c[_0xb8e7('0x2f')]=_[_0xb8e7('0x30')](_0x59ff0c['model'],_0x59ff0c[_0xb8e7('0x2e')]);_0x5a0806[_0xb8e7('0x31')]=_[_0xb8e7('0x30')](_0x59ff0c[_0xb8e7('0x32')],qs[_0xb8e7('0x33')](_0x5b1504[_0xb8e7('0x2e')][_0xb8e7('0x33')]));_0x5a0806[_0xb8e7('0x31')]=_0x5a0806['attributes'][_0xb8e7('0x34')]?_0x5a0806[_0xb8e7('0x31')]:_0x59ff0c[_0xb8e7('0x32')];if(_0x5b1504[_0xb8e7('0x2e')][_0xb8e7('0x3d')]){_0x5a0806['include']=[{'all':!![]}];}_0x5a0806=_['merge']({},_0x5a0806,_0x5b1504[_0xb8e7('0x3c')]);return db['MailQueueReport'][_0xb8e7('0x41')](_0x5a0806)[_0xb8e7('0x23')](handleEntityNotFound(_0x35673e,null))[_0xb8e7('0x23')](respondWithResult(_0x35673e,null))[_0xb8e7('0x40')](handleError(_0x35673e,null));};exports['create']=function(_0x54f779,_0x1b244c){return db[_0xb8e7('0x2a')][_0xb8e7('0x42')](_0x54f779[_0xb8e7('0x43')],{})[_0xb8e7('0x23')](respondWithResult(_0x1b244c,0xc9))[_0xb8e7('0x40')](handleError(_0x1b244c,null));};exports[_0xb8e7('0x22')]=function(_0x4333e2,_0x558c55){if(_0x4333e2['body']['id']){delete _0x4333e2['body']['id'];}return db[_0xb8e7('0x2a')][_0xb8e7('0x41')]({'where':{'id':_0x4333e2[_0xb8e7('0x44')]['id']}})[_0xb8e7('0x23')](handleEntityNotFound(_0x558c55,null))[_0xb8e7('0x23')](saveUpdates(_0x4333e2['body'],null))[_0xb8e7('0x23')](respondWithResult(_0x558c55,null))[_0xb8e7('0x40')](handleError(_0x558c55,null));};exports['destroy']=function(_0x40d7b4,_0x502905){return db[_0xb8e7('0x2a')][_0xb8e7('0x41')]({'where':{'id':_0x40d7b4[_0xb8e7('0x44')]['id']}})[_0xb8e7('0x23')](handleEntityNotFound(_0x502905,null))['then'](removeEntity(_0x502905,null))['catch'](handleError(_0x502905,null));};exports[_0xb8e7('0x45')]=function(_0x13fed0,_0x36b9ab){return db[_0xb8e7('0x2a')][_0xb8e7('0x45')]()[_0xb8e7('0x23')](respondWithResult(_0x36b9ab,null))[_0xb8e7('0x40')](handleError(_0x36b9ab,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index bad4391..0cdaa04 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 _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 +var _0x8169=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8169,0x1b0));var _0x9816=function(_0x2af352,_0x20b539){_0x2af352=_0x2af352-0x0;var _0x38ab74=_0x8169[_0x2af352];return _0x38ab74;};'use strict';var _=require(_0x9816('0x0'));var util=require(_0x9816('0x1'));var logger=require(_0x9816('0x2'))(_0x9816('0x3'));var moment=require(_0x9816('0x4'));var BPromise=require(_0x9816('0x5'));var rp=require(_0x9816('0x6'));var fs=require('fs');var path=require(_0x9816('0x7'));var rimraf=require(_0x9816('0x8'));var config=require(_0x9816('0x9'));var attributes=require(_0x9816('0xa'));module[_0x9816('0xb')]=function(_0x47ee35,_0x3c8ebc){return _0x47ee35[_0x9816('0xc')](_0x9816('0xd'),attributes,{'tableName':_0x9816('0xe'),'paranoid':![],'indexes':[{'name':_0x9816('0xf'),'fields':[_0x9816('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 33a8b7e..0b4ccca 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 _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 +var _0x5e6a=['http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateMailQueueReport','MailQueueReport','body','options','catch','UpdateMailQueueReport','update','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1f0e34,_0x8176ac){var _0x526b51=function(_0x41790a){while(--_0x41790a){_0x1f0e34['push'](_0x1f0e34['shift']());}};_0x526b51(++_0x8176ac);}(_0x5e6a,0x136));var _0xa5e6=function(_0x2d06ef,_0x2b609d){_0x2d06ef=_0x2d06ef-0x0;var _0x5ea499=_0x5e6a[_0x2d06ef];return _0x5ea499;};'use strict';var _=require(_0xa5e6('0x0'));var util=require(_0xa5e6('0x1'));var moment=require(_0xa5e6('0x2'));var BPromise=require('bluebird');var rs=require(_0xa5e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa5e6('0x4'));var logger=require(_0xa5e6('0x5'))(_0xa5e6('0x6'));var config=require(_0xa5e6('0x7'));var jayson=require(_0xa5e6('0x8'));var client=jayson['client'][_0xa5e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452add,_0x81122,_0x1872bb){return new BPromise(function(_0x578f5b,_0x355ffb){return client[_0xa5e6('0xa')](_0x452add,_0x1872bb)[_0xa5e6('0xb')](function(_0x1884b2){logger[_0xa5e6('0xc')](_0xa5e6('0xd'),_0x81122,_0xa5e6('0xe'));logger[_0xa5e6('0xf')](_0xa5e6('0x10'),_0x81122,_0xa5e6('0xe'),JSON[_0xa5e6('0x11')](_0x1884b2));if(_0x1884b2[_0xa5e6('0x12')]){if(_0x1884b2[_0xa5e6('0x12')]['code']===0x1f4){logger[_0xa5e6('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x81122,_0x1884b2['error'][_0xa5e6('0x13')]);return _0x355ffb(_0x1884b2[_0xa5e6('0x12')][_0xa5e6('0x13')]);}logger[_0xa5e6('0x12')](_0xa5e6('0xd'),_0x81122,_0x1884b2[_0xa5e6('0x12')][_0xa5e6('0x13')]);return _0x578f5b(_0x1884b2['error']['message']);}else{logger['info'](_0xa5e6('0xd'),_0x81122,_0xa5e6('0xe'));_0x578f5b(_0x1884b2[_0xa5e6('0x14')][_0xa5e6('0x13')]);}})['catch'](function(_0x1654e6){logger[_0xa5e6('0x12')](_0xa5e6('0xd'),_0x81122,_0x1654e6);_0x355ffb(_0x1654e6);});});}exports[_0xa5e6('0x15')]=function(_0x8a566f){var _0xa035d=this;return new Promise(function(_0x6d32fc,_0x46eb46){return db[_0xa5e6('0x16')]['create'](_0x8a566f[_0xa5e6('0x17')],{'raw':_0x8a566f[_0xa5e6('0x18')]?_0x8a566f['options']['raw']===undefined?!![]:![]:!![]})[_0xa5e6('0xb')](function(_0x26a48d){logger['info'](_0xa5e6('0x15'),_0x8a566f);logger['debug']('CreateMailQueueReport',_0x8a566f,JSON[_0xa5e6('0x11')](_0x26a48d));_0x6d32fc(_0x26a48d);})[_0xa5e6('0x19')](function(_0x3960e4){logger['error'](_0xa5e6('0x15'),_0x3960e4[_0xa5e6('0x13')],_0x8a566f);_0x46eb46(_0xa035d[_0xa5e6('0x12')](0x1f4,_0x3960e4[_0xa5e6('0x13')]));});});};exports[_0xa5e6('0x1a')]=function(_0x917eaf){var _0x29b2d2=this;return new Promise(function(_0x17ec2d,_0x116687){return db[_0xa5e6('0x16')][_0xa5e6('0x1b')](_0x917eaf[_0xa5e6('0x17')],{'raw':_0x917eaf[_0xa5e6('0x18')]?_0x917eaf['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x917eaf[_0xa5e6('0x18')]?_0x917eaf[_0xa5e6('0x18')]['where']||null:null,'attributes':_0x917eaf[_0xa5e6('0x18')]?_0x917eaf[_0xa5e6('0x18')]['attributes']||null:null,'limit':_0x917eaf[_0xa5e6('0x18')]?_0x917eaf[_0xa5e6('0x18')][_0xa5e6('0x1c')]||null:null})['then'](function(_0x2f8664){logger[_0xa5e6('0xc')](_0xa5e6('0x1a'),_0x917eaf);logger[_0xa5e6('0xf')](_0xa5e6('0x1a'),_0x917eaf,JSON[_0xa5e6('0x11')](_0x2f8664));_0x17ec2d(_0x2f8664);})[_0xa5e6('0x19')](function(_0x480f35){logger[_0xa5e6('0x12')]('UpdateMailQueueReport',_0x480f35[_0xa5e6('0x13')],_0x917eaf);_0x116687(_0x29b2d2[_0xa5e6('0x12')](0x1f4,_0x480f35[_0xa5e6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index cb2c7a5..a2d77a7 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 _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 +var _0x1e91=['util','path','connect-timeout','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x12aa8e,_0x5ca7ea){var _0x24f792=function(_0x3b7e71){while(--_0x3b7e71){_0x12aa8e['push'](_0x12aa8e['shift']());}};_0x24f792(++_0x5ca7ea);}(_0x1e91,0x117));var _0x11e9=function(_0x4bf497,_0x30f242){_0x4bf497=_0x4bf497-0x0;var _0xb5f818=_0x1e91[_0x4bf497];return _0xb5f818;};'use strict';var multer=require(_0x11e9('0x0'));var util=require(_0x11e9('0x1'));var path=require(_0x11e9('0x2'));var timeout=require(_0x11e9('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x11e9('0x4'));var config=require(_0x11e9('0x5'));module[_0x11e9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index e50e052..1317688 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 _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 +var _0x9b38=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN','username'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x9b38,0x10c));var _0x89b3=function(_0x403e7f,_0x4912f0){_0x403e7f=_0x403e7f-0x0;var _0x18eef0=_0x9b38[_0x403e7f];return _0x18eef0;};'use strict';var Sequelize=require(_0x89b3('0x0'));module[_0x89b3('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x89b3('0x2')]},'authentication':{'type':Sequelize[_0x89b3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x89b3('0x2')],'unique':_0x89b3('0x4')},'password':{'type':Sequelize[_0x89b3('0x2')]},'port':{'type':Sequelize[_0x89b3('0x5')]},'tls':{'type':Sequelize[_0x89b3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x89b3('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x89b3('0x5')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 657d29d..3083b92 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 _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 +var _0x4e81=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x4e81,0x1bc));var _0x14e8=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x4e81[_0x545bed];return _0x16c79c;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var logger=require(_0x14e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14e8('0x3'));var fs=require('fs');var path=require(_0x14e8('0x4'));var rimraf=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var attributes=require(_0x14e8('0x7'));module[_0x14e8('0x8')]=function(_0x56a266,_0x57c79b){return _0x56a266[_0x14e8('0x9')](_0x14e8('0xa'),attributes,{'tableName':_0x14e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index b78b3a8..b6b2aa5 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 _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 +var _0xcd5e=['map','model','GetMailServerIn','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','MailServerIn','findAll','options','raw','attributes','limit','include'];(function(_0x420e5c,_0x2c0e26){var _0x1b699a=function(_0x557f62){while(--_0x557f62){_0x420e5c['push'](_0x420e5c['shift']());}};_0x1b699a(++_0x2c0e26);}(_0xcd5e,0x9e));var _0xecd5=function(_0x226fbd,_0x35407d){_0x226fbd=_0x226fbd-0x0;var _0x5ca330=_0xcd5e[_0x226fbd];return _0x5ca330;};'use strict';var _=require(_0xecd5('0x0'));var util=require('util');var moment=require(_0xecd5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecd5('0x2'));var db=require(_0xecd5('0x3'))['db'];var utils=require(_0xecd5('0x4'));var logger=require(_0xecd5('0x5'))(_0xecd5('0x6'));var config=require('../../config/environment');var jayson=require(_0xecd5('0x7'));var client=jayson[_0xecd5('0x8')][_0xecd5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59b4df,_0x317a46,_0x1937a8){return new BPromise(function(_0x5b04f0,_0x3e550e){return client[_0xecd5('0xa')](_0x59b4df,_0x1937a8)[_0xecd5('0xb')](function(_0x31dcc0){logger[_0xecd5('0xc')](_0xecd5('0xd'),_0x317a46,'request\x20sent');logger[_0xecd5('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x317a46,_0xecd5('0xf'),JSON['stringify'](_0x31dcc0));if(_0x31dcc0[_0xecd5('0x10')]){if(_0x31dcc0[_0xecd5('0x10')][_0xecd5('0x11')]===0x1f4){logger['error'](_0xecd5('0xd'),_0x317a46,_0x31dcc0[_0xecd5('0x10')][_0xecd5('0x12')]);return _0x3e550e(_0x31dcc0[_0xecd5('0x10')][_0xecd5('0x12')]);}logger[_0xecd5('0x10')](_0xecd5('0xd'),_0x317a46,_0x31dcc0['error'][_0xecd5('0x12')]);return _0x5b04f0(_0x31dcc0[_0xecd5('0x10')]['message']);}else{logger[_0xecd5('0xc')](_0xecd5('0xd'),_0x317a46,'request\x20sent');_0x5b04f0(_0x31dcc0[_0xecd5('0x13')][_0xecd5('0x12')]);}})[_0xecd5('0x14')](function(_0x372d53){logger[_0xecd5('0x10')](_0xecd5('0xd'),_0x317a46,_0x372d53);_0x3e550e(_0x372d53);});});}exports['GetMailServerIn']=function(_0x42b8d3){var _0x13e87b=this;return new Promise(function(_0x35c3c3,_0x4a62b0){return db[_0xecd5('0x15')][_0xecd5('0x16')]({'raw':_0x42b8d3['options']?_0x42b8d3[_0xecd5('0x17')][_0xecd5('0x18')]===undefined?!![]:![]:!![],'where':_0x42b8d3[_0xecd5('0x17')]?_0x42b8d3[_0xecd5('0x17')]['where']||null:null,'attributes':_0x42b8d3[_0xecd5('0x17')]?_0x42b8d3['options'][_0xecd5('0x19')]||null:null,'limit':_0x42b8d3[_0xecd5('0x17')]?_0x42b8d3[_0xecd5('0x17')][_0xecd5('0x1a')]||null:null,'include':_0x42b8d3[_0xecd5('0x17')]?_0x42b8d3[_0xecd5('0x17')][_0xecd5('0x1b')]?_[_0xecd5('0x1c')](_0x42b8d3['options'][_0xecd5('0x1b')],function(_0x37a6c0){return{'model':db[_0x37a6c0['model']],'as':_0x37a6c0['as'],'attributes':_0x37a6c0[_0xecd5('0x19')],'include':_0x37a6c0['include']?_[_0xecd5('0x1c')](_0x37a6c0[_0xecd5('0x1b')],function(_0x4d03a5){return{'model':db[_0x4d03a5[_0xecd5('0x1d')]],'as':_0x4d03a5['as'],'attributes':_0x4d03a5[_0xecd5('0x19')],'include':_0x4d03a5[_0xecd5('0x1b')]?_['map'](_0x4d03a5[_0xecd5('0x1b')],function(_0x408310){return{'model':db[_0x408310[_0xecd5('0x1d')]],'as':_0x408310['as'],'attributes':_0x408310[_0xecd5('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12e867){logger[_0xecd5('0xc')](_0xecd5('0x1e'),_0x42b8d3);logger['debug'](_0xecd5('0x1e'),_0x42b8d3,JSON['stringify'](_0x12e867));_0x35c3c3(_0x12e867);})[_0xecd5('0x14')](function(_0x47708d){logger[_0xecd5('0x10')](_0xecd5('0x1e'),_0x47708d[_0xecd5('0x12')],_0x42b8d3);_0x4a62b0(_0x13e87b[_0xecd5('0x10')](0x1f4,_0x47708d[_0xecd5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0081d8e..729501e 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 _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 +var _0x0c17=['show','post','create','put','update','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x40e6ab,_0x5e3c1b){var _0xbaf5f9=function(_0x20d4b9){while(--_0x20d4b9){_0x40e6ab['push'](_0x40e6ab['shift']());}};_0xbaf5f9(++_0x5e3c1b);}(_0x0c17,0xe7));var _0x70c1=function(_0x30ab14,_0x225a5e){_0x30ab14=_0x30ab14-0x0;var _0x34b9ef=_0x0c17[_0x30ab14];return _0x34b9ef;};'use strict';var multer=require(_0x70c1('0x0'));var util=require(_0x70c1('0x1'));var path=require(_0x70c1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x70c1('0x3'));var interaction=require(_0x70c1('0x4'));var config=require('../../config/environment');var controller=require('./mailServerOut.controller');router[_0x70c1('0x5')]('/',auth[_0x70c1('0x6')](),controller[_0x70c1('0x7')]);router[_0x70c1('0x5')](_0x70c1('0x8'),auth['isAuthenticated'](),controller[_0x70c1('0x9')]);router[_0x70c1('0xa')]('/',auth['isAuthenticated'](),controller[_0x70c1('0xb')]);router[_0x70c1('0xc')]('/:id',auth[_0x70c1('0x6')](),controller[_0x70c1('0xd')]);router['delete']('/:id',auth[_0x70c1('0x6')](),controller['destroy']);module[_0x70c1('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 2ffe4a6..1aa7acc 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 _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 +var _0x34f0=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x3513a0,_0x3bdc88){var _0x2bdeb9=function(_0x37f06d){while(--_0x37f06d){_0x3513a0['push'](_0x3513a0['shift']());}};_0x2bdeb9(++_0x3bdc88);}(_0x34f0,0x13b));var _0x034f=function(_0x5ed2bf,_0x28895e){_0x5ed2bf=_0x5ed2bf-0x0;var _0x23d092=_0x34f0[_0x5ed2bf];return _0x23d092;};'use strict';var Sequelize=require(_0x034f('0x0'));module[_0x034f('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x034f('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x034f('0x2')]},'port':{'type':Sequelize[_0x034f('0x3')]},'secure':{'type':Sequelize[_0x034f('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x034f('0x2')]},'authentication':{'type':Sequelize[_0x034f('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index f7d3c23..409be26 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 _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 +var _0x29b5=['fieldName','type','key','keys','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailServerOut','rawAttributes'];(function(_0x362126,_0x556968){var _0xf39f59=function(_0x24e9b7){while(--_0x24e9b7){_0x362126['push'](_0x362126['shift']());}};_0xf39f59(++_0x556968);}(_0x29b5,0xb7));var _0x529b=function(_0x5618d3,_0x14e350){_0x5618d3=_0x5618d3-0x0;var _0x579cb3=_0x29b5[_0x5618d3];return _0x579cb3;};'use strict';var pdf=require(_0x529b('0x0'));var emlformat=require(_0x529b('0x1'));var rimraf=require(_0x529b('0x2'));var zipdir=require(_0x529b('0x3'));var jsonpatch=require(_0x529b('0x4'));var rp=require('request-promise');var moment=require(_0x529b('0x5'));var BPromise=require(_0x529b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x529b('0x7'));var sox=require('sox');var csv=require(_0x529b('0x8'));var ejs=require(_0x529b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x529b('0xa'));var crypto=require(_0x529b('0xb'));var jsforce=require(_0x529b('0xc'));var deskjs=require(_0x529b('0xd'));var toCsv=require(_0x529b('0x8'));var querystring=require(_0x529b('0xe'));var Papa=require(_0x529b('0xf'));var Redis=require(_0x529b('0x10'));var authService=require(_0x529b('0x11'));var qs=require(_0x529b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x529b('0x13'));var logger=require(_0x529b('0x14'))(_0x529b('0x15'));var utils=require(_0x529b('0x16'));var config=require(_0x529b('0x17'));var licenseUtil=require(_0x529b('0x18'));var db=require(_0x529b('0x19'))['db'];function respondWithStatusCode(_0x1222b1,_0x1b71d6){_0x1b71d6=_0x1b71d6||0xcc;return function(_0x10e91b){if(_0x10e91b){return _0x1222b1[_0x529b('0x1a')](_0x1b71d6);}return _0x1222b1[_0x529b('0x1b')](_0x1b71d6)[_0x529b('0x1c')]();};}function respondWithResult(_0x39abb3,_0x16f839){_0x16f839=_0x16f839||0xc8;return function(_0x3c59c1){if(_0x3c59c1){return _0x39abb3['status'](_0x16f839)[_0x529b('0x1d')](_0x3c59c1);}};}function respondWithFilteredResult(_0x246a47,_0x44934b){return function(_0x128803){if(_0x128803){var _0x365706=_0x128803[_0x529b('0x1e')],_0x5d8c33=_0x44934b[_0x529b('0x1f')],_0x22bb0d=_0x44934b[_0x529b('0x1f')]+_0x44934b[_0x529b('0x20')],_0x9ec93f;if(_0x22bb0d>=_0x365706){_0x22bb0d=_0x365706;_0x9ec93f=0xc8;}else{_0x9ec93f=0xce;}_0x246a47[_0x529b('0x1b')](_0x9ec93f);return _0x246a47[_0x529b('0x21')](_0x529b('0x22'),_0x5d8c33+'-'+_0x22bb0d+'/'+_0x365706)[_0x529b('0x1d')](_0x128803);}return null;};}function patchUpdates(_0x32c77d){return function(_0xa83bb){try{jsonpatch[_0x529b('0x23')](_0xa83bb,_0x32c77d,!![]);}catch(_0xf6de77){return BPromise[_0x529b('0x24')](_0xf6de77);}return _0xa83bb[_0x529b('0x25')]();};}function saveUpdates(_0x1c2d6a,_0x2263d6){return function(_0x1c26b5){if(_0x1c26b5){return _0x1c26b5[_0x529b('0x26')](_0x1c2d6a)[_0x529b('0x27')](function(_0x2ea323){return _0x2ea323;});}return null;};}function removeEntity(_0x882ac2,_0x339123){return function(_0x21bc8f){if(_0x21bc8f){return _0x21bc8f[_0x529b('0x28')]()[_0x529b('0x27')](function(){_0x882ac2[_0x529b('0x1b')](0xcc)[_0x529b('0x1c')]();});}};}function handleEntityNotFound(_0x1f607f,_0x37b9b0){return function(_0x47bb5d){if(!_0x47bb5d){_0x1f607f[_0x529b('0x1a')](0x194);}return _0x47bb5d;};}function handleError(_0xd6e4e,_0x18fc01){_0x18fc01=_0x18fc01||0x1f4;return function(_0x2722a4){logger[_0x529b('0x29')](_0x2722a4['stack']);if(_0x2722a4[_0x529b('0x2a')]){delete _0x2722a4[_0x529b('0x2a')];}_0xd6e4e[_0x529b('0x1b')](_0x18fc01)[_0x529b('0x2b')](_0x2722a4);};}exports[_0x529b('0x2c')]=function(_0x335917,_0x32fbbc){var _0x14cf60={},_0xcd2467={},_0x532805={'count':0x0,'rows':[]};var _0x4ab617=_[_0x529b('0x2d')](db[_0x529b('0x2e')][_0x529b('0x2f')],function(_0x4d07cf){return{'name':_0x4d07cf[_0x529b('0x30')],'type':_0x4d07cf[_0x529b('0x31')][_0x529b('0x32')]};});_0xcd2467['model']=_['map'](_0x4ab617,_0x529b('0x2a'));_0xcd2467['query']=_[_0x529b('0x33')](_0x335917[_0x529b('0x34')]);_0xcd2467[_0x529b('0x35')]=_['intersection'](_0xcd2467['model'],_0xcd2467[_0x529b('0x34')]);_0x14cf60[_0x529b('0x36')]=_[_0x529b('0x37')](_0xcd2467[_0x529b('0x38')],qs['fields'](_0x335917[_0x529b('0x34')][_0x529b('0x39')]));_0x14cf60['attributes']=_0x14cf60[_0x529b('0x36')][_0x529b('0x3a')]?_0x14cf60[_0x529b('0x36')]:_0xcd2467[_0x529b('0x38')];if(!_0x335917['query'][_0x529b('0x3b')](_0x529b('0x3c'))){_0x14cf60[_0x529b('0x20')]=qs[_0x529b('0x20')](_0x335917[_0x529b('0x34')][_0x529b('0x20')]);_0x14cf60['offset']=qs[_0x529b('0x1f')](_0x335917[_0x529b('0x34')][_0x529b('0x1f')]);}_0x14cf60[_0x529b('0x3d')]=qs['sort'](_0x335917['query'][_0x529b('0x3e')]);_0x14cf60['where']=qs[_0x529b('0x35')](_[_0x529b('0x3f')](_0x335917[_0x529b('0x34')],_0xcd2467[_0x529b('0x35')]),_0x4ab617);if(_0x335917[_0x529b('0x34')][_0x529b('0x40')]){_0x14cf60[_0x529b('0x41')]=_[_0x529b('0x42')](_0x14cf60[_0x529b('0x41')],{'$or':_[_0x529b('0x2d')](_0x4ab617,function(_0xaf4d43){if(_0xaf4d43[_0x529b('0x31')]!=='VIRTUAL'){var _0x4bbb95={};_0x4bbb95[_0xaf4d43[_0x529b('0x2a')]]={'$like':'%'+_0x335917[_0x529b('0x34')][_0x529b('0x40')]+'%'};return _0x4bbb95;}})});}_0x14cf60=_[_0x529b('0x42')]({},_0x14cf60,_0x335917[_0x529b('0x43')]);var _0x1bdd86={'where':_0x14cf60[_0x529b('0x41')]};return db[_0x529b('0x2e')]['count'](_0x1bdd86)['then'](function(_0x7a6a49){_0x532805[_0x529b('0x1e')]=_0x7a6a49;if(_0x335917[_0x529b('0x34')][_0x529b('0x44')]){_0x14cf60[_0x529b('0x45')]=[{'all':!![]}];}return db[_0x529b('0x2e')]['findAll'](_0x14cf60);})['then'](function(_0x50e136){_0x532805[_0x529b('0x46')]=_0x50e136;return _0x532805;})[_0x529b('0x27')](respondWithFilteredResult(_0x32fbbc,_0x14cf60))[_0x529b('0x47')](handleError(_0x32fbbc,null));};exports[_0x529b('0x48')]=function(_0x3374b2,_0x23688b){var _0x4c2c71={'raw':!![],'where':{'id':_0x3374b2[_0x529b('0x49')]['id']}},_0x4056fe={};_0x4056fe[_0x529b('0x38')]=_[_0x529b('0x33')](db[_0x529b('0x2e')][_0x529b('0x2f')]);_0x4056fe['query']=_[_0x529b('0x33')](_0x3374b2['query']);_0x4056fe[_0x529b('0x35')]=_[_0x529b('0x37')](_0x4056fe[_0x529b('0x38')],_0x4056fe[_0x529b('0x34')]);_0x4c2c71['attributes']=_[_0x529b('0x37')](_0x4056fe[_0x529b('0x38')],qs[_0x529b('0x39')](_0x3374b2[_0x529b('0x34')]['fields']));_0x4c2c71['attributes']=_0x4c2c71[_0x529b('0x36')][_0x529b('0x3a')]?_0x4c2c71[_0x529b('0x36')]:_0x4056fe[_0x529b('0x38')];if(_0x3374b2['query'][_0x529b('0x44')]){_0x4c2c71[_0x529b('0x45')]=[{'all':!![]}];}_0x4c2c71=_['merge']({},_0x4c2c71,_0x3374b2[_0x529b('0x43')]);return db[_0x529b('0x2e')][_0x529b('0x4a')](_0x4c2c71)['then'](handleEntityNotFound(_0x23688b,null))[_0x529b('0x27')](respondWithResult(_0x23688b,null))['catch'](handleError(_0x23688b,null));};exports[_0x529b('0x4b')]=function(_0x2979a6,_0x21bb5f){return db[_0x529b('0x2e')][_0x529b('0x4b')](_0x2979a6[_0x529b('0x4c')],{})['then'](respondWithResult(_0x21bb5f,0xc9))[_0x529b('0x47')](handleError(_0x21bb5f,null));};exports[_0x529b('0x26')]=function(_0x5a6644,_0x20f573){if(_0x5a6644[_0x529b('0x4c')]['id']){delete _0x5a6644['body']['id'];}return db[_0x529b('0x2e')][_0x529b('0x4a')]({'where':{'id':_0x5a6644[_0x529b('0x49')]['id']}})[_0x529b('0x27')](handleEntityNotFound(_0x20f573,null))[_0x529b('0x27')](saveUpdates(_0x5a6644[_0x529b('0x4c')],null))[_0x529b('0x27')](respondWithResult(_0x20f573,null))[_0x529b('0x47')](handleError(_0x20f573,null));};exports[_0x529b('0x28')]=function(_0x186946,_0x319fee){return db[_0x529b('0x2e')]['find']({'where':{'id':_0x186946['params']['id']}})[_0x529b('0x27')](handleEntityNotFound(_0x319fee,null))['then'](removeEntity(_0x319fee,null))[_0x529b('0x47')](handleError(_0x319fee,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 4f45b6f..8a1575c 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 _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 +var _0x687b=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x5b7193,_0x304c69){var _0x4016af=function(_0x2e5b00){while(--_0x2e5b00){_0x5b7193['push'](_0x5b7193['shift']());}};_0x4016af(++_0x304c69);}(_0x687b,0x14a));var _0xb687=function(_0x18baf4,_0x33086b){_0x18baf4=_0x18baf4-0x0;var _0x278ed1=_0x687b[_0x18baf4];return _0x278ed1;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9b45df7..69aec10 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 _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 +var _0x3153=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','util','moment','bluebird'];(function(_0x2f5100,_0x565cbe){var _0x40c4bc=function(_0x525168){while(--_0x525168){_0x2f5100['push'](_0x2f5100['shift']());}};_0x40c4bc(++_0x565cbe);}(_0x3153,0xce));var _0x3315=function(_0xf7c970,_0x3e03a3){_0xf7c970=_0xf7c970-0x0;var _0x5d2ba3=_0x3153[_0xf7c970];return _0x5d2ba3;};'use strict';var _=require('lodash');var util=require(_0x3315('0x0'));var moment=require(_0x3315('0x1'));var BPromise=require(_0x3315('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3315('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3315('0x4'));var logger=require(_0x3315('0x5'))(_0x3315('0x6'));var config=require('../../config/environment');var jayson=require(_0x3315('0x7'));var client=jayson[_0x3315('0x8')][_0x3315('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4945c0,_0x5c8024,_0x28853b){return new BPromise(function(_0x1f3fb9,_0x2eb089){return client[_0x3315('0xa')](_0x4945c0,_0x28853b)['then'](function(_0x46e0ea){logger[_0x3315('0xb')](_0x3315('0xc'),_0x5c8024,'request\x20sent');logger[_0x3315('0xd')](_0x3315('0xe'),_0x5c8024,_0x3315('0xf'),JSON['stringify'](_0x46e0ea));if(_0x46e0ea[_0x3315('0x10')]){if(_0x46e0ea['error'][_0x3315('0x11')]===0x1f4){logger[_0x3315('0x10')]('MailServerOut,\x20%s,\x20%s',_0x5c8024,_0x46e0ea['error'][_0x3315('0x12')]);return _0x2eb089(_0x46e0ea[_0x3315('0x10')][_0x3315('0x12')]);}logger[_0x3315('0x10')](_0x3315('0xc'),_0x5c8024,_0x46e0ea[_0x3315('0x10')]['message']);return _0x1f3fb9(_0x46e0ea['error'][_0x3315('0x12')]);}else{logger[_0x3315('0xb')](_0x3315('0xc'),_0x5c8024,'request\x20sent');_0x1f3fb9(_0x46e0ea['result'][_0x3315('0x12')]);}})['catch'](function(_0x2f9b2f){logger[_0x3315('0x10')](_0x3315('0xc'),_0x5c8024,_0x2f9b2f);_0x2eb089(_0x2f9b2f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 35bf450..3e7bad2 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 _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 +var _0x40a7=['describe','show','post','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','/describe'];(function(_0x336ed4,_0x4be457){var _0x5003c3=function(_0x375ade){while(--_0x375ade){_0x336ed4['push'](_0x336ed4['shift']());}};_0x5003c3(++_0x4be457);}(_0x40a7,0xd9));var _0x740a=function(_0xc6bc6f,_0x154804){_0xc6bc6f=_0xc6bc6f-0x0;var _0x1044bd=_0x40a7[_0xc6bc6f];return _0x1044bd;};'use strict';var multer=require('multer');var util=require(_0x740a('0x0'));var path=require(_0x740a('0x1'));var timeout=require(_0x740a('0x2'));var express=require(_0x740a('0x3'));var router=express[_0x740a('0x4')]();var auth=require(_0x740a('0x5'));var interaction=require(_0x740a('0x6'));var config=require('../../config/environment');var controller=require(_0x740a('0x7'));router[_0x740a('0x8')]('/',auth[_0x740a('0x9')](),controller['index']);router['get'](_0x740a('0xa'),auth[_0x740a('0x9')](),controller[_0x740a('0xb')]);router[_0x740a('0x8')]('/:id',auth[_0x740a('0x9')](),controller[_0x740a('0xc')]);router[_0x740a('0xd')]('/',auth[_0x740a('0x9')](),controller['create']);router[_0x740a('0xe')](_0x740a('0xf'),auth[_0x740a('0x9')](),controller[_0x740a('0x10')]);router[_0x740a('0x11')](_0x740a('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x740a('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index c305da3..45aa1be 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 _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 +var _0xf954=['STRING','name','sequelize','exports'];(function(_0x1c2421,_0x1c152c){var _0x5867b2=function(_0x16e49c){while(--_0x16e49c){_0x1c2421['push'](_0x1c2421['shift']());}};_0x5867b2(++_0x1c152c);}(_0xf954,0x10e));var _0x4f95=function(_0x4f0456,_0x795c81){_0x4f0456=_0x4f0456-0x0;var _0x52caea=_0xf954[_0x4f0456];return _0x52caea;};'use strict';var Sequelize=require(_0x4f95('0x0'));module[_0x4f95('0x1')]={'name':{'type':Sequelize[_0x4f95('0x2')],'unique':_0x4f95('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f95('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 6c13b93..5d68970 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 _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 +var _0x81c2=['send','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name'];(function(_0x53acd1,_0x1f6126){var _0x2b324a=function(_0x1597a6){while(--_0x1597a6){_0x53acd1['push'](_0x53acd1['shift']());}};_0x2b324a(++_0x1f6126);}(_0x81c2,0xff));var _0x281c=function(_0x49dd98,_0x8dc77f){_0x49dd98=_0x49dd98-0x0;var _0x590ce3=_0x81c2[_0x49dd98];return _0x590ce3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x281c('0x0'));var rimraf=require(_0x281c('0x1'));var zipdir=require(_0x281c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x281c('0x3'));var moment=require(_0x281c('0x4'));var BPromise=require(_0x281c('0x5'));var Mustache=require(_0x281c('0x6'));var util=require('util');var path=require(_0x281c('0x7'));var sox=require(_0x281c('0x8'));var csv=require(_0x281c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x281c('0xa'));var squel=require(_0x281c('0xb'));var crypto=require(_0x281c('0xc'));var jsforce=require(_0x281c('0xd'));var deskjs=require(_0x281c('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x281c('0xf'));var Redis=require(_0x281c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x281c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x281c('0x12'));var logger=require(_0x281c('0x13'))(_0x281c('0x14'));var utils=require(_0x281c('0x15'));var config=require(_0x281c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a567d,_0x1f522e){_0x1f522e=_0x1f522e||0xcc;return function(_0x562db7){if(_0x562db7){return _0x1a567d[_0x281c('0x17')](_0x1f522e);}return _0x1a567d[_0x281c('0x18')](_0x1f522e)[_0x281c('0x19')]();};}function respondWithResult(_0x564b4c,_0x47bd0e){_0x47bd0e=_0x47bd0e||0xc8;return function(_0x25359a){if(_0x25359a){return _0x564b4c[_0x281c('0x18')](_0x47bd0e)[_0x281c('0x1a')](_0x25359a);}};}function respondWithFilteredResult(_0x20f44d,_0x2e60d0){return function(_0x131ce7){if(_0x131ce7){var _0xf2fb71=_0x131ce7[_0x281c('0x1b')],_0x14fc09=_0x2e60d0[_0x281c('0x1c')],_0x56777d=_0x2e60d0[_0x281c('0x1c')]+_0x2e60d0[_0x281c('0x1d')],_0x252a15;if(_0x56777d>=_0xf2fb71){_0x56777d=_0xf2fb71;_0x252a15=0xc8;}else{_0x252a15=0xce;}_0x20f44d[_0x281c('0x18')](_0x252a15);return _0x20f44d[_0x281c('0x1e')](_0x281c('0x1f'),_0x14fc09+'-'+_0x56777d+'/'+_0xf2fb71)[_0x281c('0x1a')](_0x131ce7);}return null;};}function patchUpdates(_0x7a5345){return function(_0x2b4d30){try{jsonpatch[_0x281c('0x20')](_0x2b4d30,_0x7a5345,!![]);}catch(_0x408fd2){return BPromise[_0x281c('0x21')](_0x408fd2);}return _0x2b4d30[_0x281c('0x22')]();};}function saveUpdates(_0x1f0533,_0x3395ad){return function(_0x53c772){if(_0x53c772){return _0x53c772[_0x281c('0x23')](_0x1f0533)['then'](function(_0x5bd458){return _0x5bd458;});}return null;};}function removeEntity(_0x451425,_0xdab49f){return function(_0x163c60){if(_0x163c60){return _0x163c60[_0x281c('0x24')]()[_0x281c('0x25')](function(){_0x451425[_0x281c('0x18')](0xcc)[_0x281c('0x19')]();});}};}function handleEntityNotFound(_0x1b41b1,_0x3149e5){return function(_0x4964ed){if(!_0x4964ed){_0x1b41b1[_0x281c('0x17')](0x194);}return _0x4964ed;};}function handleError(_0x4ef198,_0x31034b){_0x31034b=_0x31034b||0x1f4;return function(_0x4ed7ff){logger[_0x281c('0x26')](_0x4ed7ff[_0x281c('0x27')]);if(_0x4ed7ff['name']){delete _0x4ed7ff[_0x281c('0x28')];}_0x4ef198[_0x281c('0x18')](_0x31034b)[_0x281c('0x29')](_0x4ed7ff);};}exports['index']=function(_0x2f4b79,_0x307738){var _0xd522cf={},_0x29372f={},_0x4b6a03={'count':0x0,'rows':[]};var _0x1a6eb6=_[_0x281c('0x2a')](db[_0x281c('0x2b')][_0x281c('0x2c')],function(_0xf870d5){return{'name':_0xf870d5[_0x281c('0x2d')],'type':_0xf870d5[_0x281c('0x2e')][_0x281c('0x2f')]};});_0x29372f[_0x281c('0x30')]=_[_0x281c('0x2a')](_0x1a6eb6,_0x281c('0x28'));_0x29372f['query']=_[_0x281c('0x31')](_0x2f4b79[_0x281c('0x32')]);_0x29372f[_0x281c('0x33')]=_['intersection'](_0x29372f['model'],_0x29372f['query']);_0xd522cf[_0x281c('0x34')]=_[_0x281c('0x35')](_0x29372f['model'],qs[_0x281c('0x36')](_0x2f4b79[_0x281c('0x32')][_0x281c('0x36')]));_0xd522cf[_0x281c('0x34')]=_0xd522cf[_0x281c('0x34')][_0x281c('0x37')]?_0xd522cf[_0x281c('0x34')]:_0x29372f[_0x281c('0x30')];if(!_0x2f4b79[_0x281c('0x32')][_0x281c('0x38')](_0x281c('0x39'))){_0xd522cf['limit']=qs[_0x281c('0x1d')](_0x2f4b79[_0x281c('0x32')][_0x281c('0x1d')]);_0xd522cf['offset']=qs[_0x281c('0x1c')](_0x2f4b79[_0x281c('0x32')][_0x281c('0x1c')]);}_0xd522cf[_0x281c('0x3a')]=qs['sort'](_0x2f4b79['query']['sort']);_0xd522cf[_0x281c('0x3b')]=qs[_0x281c('0x33')](_[_0x281c('0x3c')](_0x2f4b79[_0x281c('0x32')],_0x29372f[_0x281c('0x33')]),_0x1a6eb6);if(_0x2f4b79[_0x281c('0x32')][_0x281c('0x3d')]){_0xd522cf[_0x281c('0x3b')]=_[_0x281c('0x3e')](_0xd522cf['where'],{'$or':_[_0x281c('0x2a')](_0x1a6eb6,function(_0x2347d9){if(_0x2347d9[_0x281c('0x2e')]!==_0x281c('0x3f')){var _0x954005={};_0x954005[_0x2347d9['name']]={'$like':'%'+_0x2f4b79['query'][_0x281c('0x3d')]+'%'};return _0x954005;}})});}_0xd522cf=_[_0x281c('0x3e')]({},_0xd522cf,_0x2f4b79[_0x281c('0x40')]);var _0x6367b0={'where':_0xd522cf[_0x281c('0x3b')]};return db[_0x281c('0x2b')]['count'](_0x6367b0)[_0x281c('0x25')](function(_0x4a3c51){_0x4b6a03[_0x281c('0x1b')]=_0x4a3c51;if(_0x2f4b79[_0x281c('0x32')][_0x281c('0x41')]){_0xd522cf[_0x281c('0x42')]=[{'all':!![]}];}return db[_0x281c('0x2b')]['findAll'](_0xd522cf);})[_0x281c('0x25')](function(_0x3ceda5){_0x4b6a03[_0x281c('0x43')]=_0x3ceda5;return _0x4b6a03;})[_0x281c('0x25')](respondWithFilteredResult(_0x307738,_0xd522cf))[_0x281c('0x44')](handleError(_0x307738,null));};exports['show']=function(_0x4b62c0,_0x543114){var _0x3bbbd8={'raw':!![],'where':{'id':_0x4b62c0[_0x281c('0x45')]['id']}},_0x1faa9c={};_0x1faa9c['model']=_[_0x281c('0x31')](db[_0x281c('0x2b')][_0x281c('0x2c')]);_0x1faa9c[_0x281c('0x32')]=_[_0x281c('0x31')](_0x4b62c0['query']);_0x1faa9c[_0x281c('0x33')]=_[_0x281c('0x35')](_0x1faa9c[_0x281c('0x30')],_0x1faa9c[_0x281c('0x32')]);_0x3bbbd8[_0x281c('0x34')]=_[_0x281c('0x35')](_0x1faa9c['model'],qs[_0x281c('0x36')](_0x4b62c0[_0x281c('0x32')][_0x281c('0x36')]));_0x3bbbd8[_0x281c('0x34')]=_0x3bbbd8[_0x281c('0x34')]['length']?_0x3bbbd8['attributes']:_0x1faa9c[_0x281c('0x30')];if(_0x4b62c0[_0x281c('0x32')][_0x281c('0x41')]){_0x3bbbd8[_0x281c('0x42')]=[{'all':!![]}];}_0x3bbbd8=_[_0x281c('0x3e')]({},_0x3bbbd8,_0x4b62c0['options']);return db[_0x281c('0x2b')][_0x281c('0x46')](_0x3bbbd8)[_0x281c('0x25')](handleEntityNotFound(_0x543114,null))['then'](respondWithResult(_0x543114,null))[_0x281c('0x44')](handleError(_0x543114,null));};exports[_0x281c('0x47')]=function(_0x46ad1e,_0x309c59){return db[_0x281c('0x2b')]['create'](_0x46ad1e[_0x281c('0x48')],{})[_0x281c('0x25')](respondWithResult(_0x309c59,0xc9))[_0x281c('0x44')](handleError(_0x309c59,null));};exports[_0x281c('0x23')]=function(_0x29b8a1,_0x26d022){if(_0x29b8a1[_0x281c('0x48')]['id']){delete _0x29b8a1[_0x281c('0x48')]['id'];}return db[_0x281c('0x2b')][_0x281c('0x46')]({'where':{'id':_0x29b8a1[_0x281c('0x45')]['id']}})[_0x281c('0x25')](handleEntityNotFound(_0x26d022,null))[_0x281c('0x25')](saveUpdates(_0x29b8a1['body'],null))[_0x281c('0x25')](respondWithResult(_0x26d022,null))[_0x281c('0x44')](handleError(_0x26d022,null));};exports['destroy']=function(_0x18b76b,_0x12ec85){return db[_0x281c('0x2b')][_0x281c('0x46')]({'where':{'id':_0x18b76b[_0x281c('0x45')]['id']}})['then'](handleEntityNotFound(_0x12ec85,null))[_0x281c('0x25')](removeEntity(_0x12ec85,null))['catch'](handleError(_0x12ec85,null));};exports['describe']=function(_0x630ed3,_0x5c7de1){return db[_0x281c('0x2b')][_0x281c('0x49')]()[_0x281c('0x25')](respondWithResult(_0x5c7de1,null))[_0x281c('0x44')](handleError(_0x5c7de1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 23309f0..7707132 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 _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 +var _0x9582=['bluebird','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment'];(function(_0xf83592,_0x3c1233){var _0x5da488=function(_0x37bc7a){while(--_0x37bc7a){_0xf83592['push'](_0xf83592['shift']());}};_0x5da488(++_0x3c1233);}(_0x9582,0x95));var _0x2958=function(_0x35a78a,_0x215904){_0x35a78a=_0x35a78a-0x0;var _0x502859=_0x9582[_0x35a78a];return _0x502859;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var logger=require(_0x2958('0x2'))(_0x2958('0x3'));var moment=require(_0x2958('0x4'));var BPromise=require(_0x2958('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2958('0x6'));var rimraf=require(_0x2958('0x7'));var config=require(_0x2958('0x8'));var attributes=require(_0x2958('0x9'));module[_0x2958('0xa')]=function(_0xbde128,_0x88ffaa){return _0xbde128[_0x2958('0xb')](_0x2958('0xc'),attributes,{'tableName':_0x2958('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 1007277..a49852e 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 _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 +var _0xb903=['http','request','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','MailSubstatus,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x527716,_0x5c8055){var _0x1ecfa4=function(_0x1408b5){while(--_0x1408b5){_0x527716['push'](_0x527716['shift']());}};_0x1ecfa4(++_0x5c8055);}(_0xb903,0x185));var _0x3b90=function(_0x13b5b6,_0x3b3399){_0x13b5b6=_0x13b5b6-0x0;var _0xdeae95=_0xb903[_0x13b5b6];return _0xdeae95;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('MailSubstatus,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 32d7bec..dbb67cf 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 _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 +var _0x8151=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','post','create','put','update','/:id','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xdba480,_0x59b3fe){var _0x5cf64a=function(_0x5db11d){while(--_0x5db11d){_0xdba480['push'](_0xdba480['shift']());}};_0x5cf64a(++_0x59b3fe);}(_0x8151,0x9b));var _0x1815=function(_0x3386fd,_0x8596f4){_0x3386fd=_0x3386fd-0x0;var _0x19e6f6=_0x8151[_0x3386fd];return _0x19e6f6;};'use strict';var multer=require(_0x1815('0x0'));var util=require('util');var path=require(_0x1815('0x1'));var timeout=require(_0x1815('0x2'));var express=require(_0x1815('0x3'));var router=express[_0x1815('0x4')]();var auth=require(_0x1815('0x5'));var interaction=require(_0x1815('0x6'));var config=require(_0x1815('0x7'));var controller=require(_0x1815('0x8'));router[_0x1815('0x9')]('/',auth[_0x1815('0xa')](),controller[_0x1815('0xb')]);router[_0x1815('0x9')]('/describe',auth[_0x1815('0xa')](),controller[_0x1815('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1815('0xd')]('/',auth[_0x1815('0xa')](),controller[_0x1815('0xe')]);router[_0x1815('0xf')]('/:id',auth[_0x1815('0xa')](),controller[_0x1815('0x10')]);router['delete'](_0x1815('0x11'),auth[_0x1815('0xa')](),controller[_0x1815('0x12')]);module[_0x1815('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index faf29d6..21bfe73 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 _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 +var _0xfe5b=['exports','STRING','ENUM','account','queue','DATE','NOW','sequelize'];(function(_0x20c757,_0x4581e9){var _0x262043=function(_0x4d8fcf){while(--_0x4d8fcf){_0x20c757['push'](_0x20c757['shift']());}};_0x262043(++_0x4581e9);}(_0xfe5b,0x167));var _0xbfe5=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xfe5b[_0x31cb5f];return _0x586042;};'use strict';var moment=require('moment');var Sequelize=require(_0xbfe5('0x0'));module[_0xbfe5('0x1')]={'uniqueid':{'type':Sequelize[_0xbfe5('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbfe5('0x3')](_0xbfe5('0x4'),'agent',_0xbfe5('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xbfe5('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbfe5('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index cdd44b8..e11aeaf 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 _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 +var _0xc42c=['send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4fda88,_0x1a4d19){var _0xe37511=function(_0x51f461){while(--_0x51f461){_0x4fda88['push'](_0x4fda88['shift']());}};_0xe37511(++_0x1a4d19);}(_0xc42c,0x13e));var _0xcc42=function(_0x656f5c,_0x91ffe7){_0x656f5c=_0x656f5c-0x0;var _0x2beab5=_0xc42c[_0x656f5c];return _0x2beab5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcc42('0x0'));var rimraf=require(_0xcc42('0x1'));var zipdir=require(_0xcc42('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcc42('0x3'));var Mustache=require(_0xcc42('0x4'));var util=require(_0xcc42('0x5'));var path=require(_0xcc42('0x6'));var sox=require(_0xcc42('0x7'));var csv=require(_0xcc42('0x8'));var ejs=require(_0xcc42('0x9'));var fs=require('fs');var _=require(_0xcc42('0xa'));var squel=require(_0xcc42('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcc42('0xc'));var toCsv=require(_0xcc42('0x8'));var querystring=require('querystring');var Papa=require(_0xcc42('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcc42('0xe'));var as=require(_0xcc42('0xf'));var hardwareService=require(_0xcc42('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xcc42('0x11'));var config=require(_0xcc42('0x12'));var licenseUtil=require(_0xcc42('0x13'));var db=require(_0xcc42('0x14'))['db'];function respondWithStatusCode(_0x429ccf,_0x57da88){_0x57da88=_0x57da88||0xcc;return function(_0x89228f){if(_0x89228f){return _0x429ccf['sendStatus'](_0x57da88);}return _0x429ccf[_0xcc42('0x15')](_0x57da88)['end']();};}function respondWithResult(_0x3832b7,_0x527df6){_0x527df6=_0x527df6||0xc8;return function(_0xc66e4){if(_0xc66e4){return _0x3832b7[_0xcc42('0x15')](_0x527df6)[_0xcc42('0x16')](_0xc66e4);}};}function respondWithFilteredResult(_0xe3eb1c,_0x260ff0){return function(_0x34f385){if(_0x34f385){var _0x422a49=_0x34f385[_0xcc42('0x17')],_0x2b39d2=_0x260ff0[_0xcc42('0x18')],_0x38dca5=_0x260ff0[_0xcc42('0x18')]+_0x260ff0[_0xcc42('0x19')],_0x40a6da;if(_0x38dca5>=_0x422a49){_0x38dca5=_0x422a49;_0x40a6da=0xc8;}else{_0x40a6da=0xce;}_0xe3eb1c[_0xcc42('0x15')](_0x40a6da);return _0xe3eb1c[_0xcc42('0x1a')](_0xcc42('0x1b'),_0x2b39d2+'-'+_0x38dca5+'/'+_0x422a49)['json'](_0x34f385);}return null;};}function patchUpdates(_0x1d7450){return function(_0x328e67){try{jsonpatch[_0xcc42('0x1c')](_0x328e67,_0x1d7450,!![]);}catch(_0x1d93e6){return BPromise['reject'](_0x1d93e6);}return _0x328e67[_0xcc42('0x1d')]();};}function saveUpdates(_0x3925e7,_0x424b9c){return function(_0x126839){if(_0x126839){return _0x126839[_0xcc42('0x1e')](_0x3925e7)[_0xcc42('0x1f')](function(_0x3a731e){return _0x3a731e;});}return null;};}function removeEntity(_0x446e7c,_0x596a9c){return function(_0x337cb6){if(_0x337cb6){return _0x337cb6[_0xcc42('0x20')]()['then'](function(){_0x446e7c[_0xcc42('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1314,_0x5bf43c){return function(_0xd4ba80){if(!_0xd4ba80){_0x5f1314[_0xcc42('0x21')](0x194);}return _0xd4ba80;};}function handleError(_0x6df4ad,_0x800212){_0x800212=_0x800212||0x1f4;return function(_0x505978){logger[_0xcc42('0x22')](_0x505978[_0xcc42('0x23')]);if(_0x505978['name']){delete _0x505978[_0xcc42('0x24')];}_0x6df4ad[_0xcc42('0x15')](_0x800212)[_0xcc42('0x25')](_0x505978);};}exports[_0xcc42('0x26')]=function(_0x16c87a,_0x10c637){var _0x198d04={},_0x592479={},_0x53a403={'count':0x0,'rows':[]};var _0x9daf6c=_[_0xcc42('0x27')](db[_0xcc42('0x28')][_0xcc42('0x29')],function(_0x313b6d){return{'name':_0x313b6d[_0xcc42('0x2a')],'type':_0x313b6d[_0xcc42('0x2b')][_0xcc42('0x2c')]};});_0x592479[_0xcc42('0x2d')]=_[_0xcc42('0x27')](_0x9daf6c,_0xcc42('0x24'));_0x592479[_0xcc42('0x2e')]=_[_0xcc42('0x2f')](_0x16c87a[_0xcc42('0x2e')]);_0x592479[_0xcc42('0x30')]=_['intersection'](_0x592479[_0xcc42('0x2d')],_0x592479[_0xcc42('0x2e')]);_0x198d04[_0xcc42('0x31')]=_[_0xcc42('0x32')](_0x592479[_0xcc42('0x2d')],qs[_0xcc42('0x33')](_0x16c87a[_0xcc42('0x2e')][_0xcc42('0x33')]));_0x198d04[_0xcc42('0x31')]=_0x198d04['attributes'][_0xcc42('0x34')]?_0x198d04[_0xcc42('0x31')]:_0x592479['model'];if(!_0x16c87a['query'][_0xcc42('0x35')](_0xcc42('0x36'))){_0x198d04[_0xcc42('0x19')]=qs[_0xcc42('0x19')](_0x16c87a[_0xcc42('0x2e')][_0xcc42('0x19')]);_0x198d04[_0xcc42('0x18')]=qs['offset'](_0x16c87a[_0xcc42('0x2e')][_0xcc42('0x18')]);}_0x198d04[_0xcc42('0x37')]=qs[_0xcc42('0x38')](_0x16c87a[_0xcc42('0x2e')][_0xcc42('0x38')]);_0x198d04[_0xcc42('0x39')]=qs['filters'](_[_0xcc42('0x3a')](_0x16c87a[_0xcc42('0x2e')],_0x592479['filters']),_0x9daf6c);if(_0x16c87a[_0xcc42('0x2e')]['filter']){_0x198d04[_0xcc42('0x39')]=_[_0xcc42('0x3b')](_0x198d04[_0xcc42('0x39')],{'$or':_[_0xcc42('0x27')](_0x9daf6c,function(_0x3cddc3){if(_0x3cddc3[_0xcc42('0x2b')]!=='VIRTUAL'){var _0x3a0e83={};_0x3a0e83[_0x3cddc3[_0xcc42('0x24')]]={'$like':'%'+_0x16c87a[_0xcc42('0x2e')][_0xcc42('0x3c')]+'%'};return _0x3a0e83;}})});}_0x198d04=_['merge']({},_0x198d04,_0x16c87a[_0xcc42('0x3d')]);var _0x3b0b3d={'where':_0x198d04[_0xcc42('0x39')]};return db['MailTransferReport']['count'](_0x3b0b3d)[_0xcc42('0x1f')](function(_0x4b83df){_0x53a403['count']=_0x4b83df;if(_0x16c87a[_0xcc42('0x2e')][_0xcc42('0x3e')]){_0x198d04[_0xcc42('0x3f')]=[{'all':!![]}];}return db[_0xcc42('0x28')][_0xcc42('0x40')](_0x198d04);})[_0xcc42('0x1f')](function(_0x11abf1){_0x53a403[_0xcc42('0x41')]=_0x11abf1;return _0x53a403;})[_0xcc42('0x1f')](respondWithFilteredResult(_0x10c637,_0x198d04))[_0xcc42('0x42')](handleError(_0x10c637,null));};exports[_0xcc42('0x43')]=function(_0xdb7ac7,_0x5f5d11){var _0x75f332={'raw':!![],'where':{'id':_0xdb7ac7[_0xcc42('0x44')]['id']}},_0x107b44={};_0x107b44[_0xcc42('0x2d')]=_[_0xcc42('0x2f')](db[_0xcc42('0x28')][_0xcc42('0x29')]);_0x107b44[_0xcc42('0x2e')]=_['keys'](_0xdb7ac7['query']);_0x107b44[_0xcc42('0x30')]=_[_0xcc42('0x32')](_0x107b44[_0xcc42('0x2d')],_0x107b44[_0xcc42('0x2e')]);_0x75f332['attributes']=_[_0xcc42('0x32')](_0x107b44[_0xcc42('0x2d')],qs['fields'](_0xdb7ac7[_0xcc42('0x2e')]['fields']));_0x75f332[_0xcc42('0x31')]=_0x75f332[_0xcc42('0x31')][_0xcc42('0x34')]?_0x75f332[_0xcc42('0x31')]:_0x107b44[_0xcc42('0x2d')];if(_0xdb7ac7['query'][_0xcc42('0x3e')]){_0x75f332[_0xcc42('0x3f')]=[{'all':!![]}];}_0x75f332=_[_0xcc42('0x3b')]({},_0x75f332,_0xdb7ac7['options']);return db['MailTransferReport'][_0xcc42('0x45')](_0x75f332)[_0xcc42('0x1f')](handleEntityNotFound(_0x5f5d11,null))['then'](respondWithResult(_0x5f5d11,null))[_0xcc42('0x42')](handleError(_0x5f5d11,null));};exports['create']=function(_0x3fade9,_0x53ed4d){return db[_0xcc42('0x28')]['create'](_0x3fade9[_0xcc42('0x46')],{})[_0xcc42('0x1f')](respondWithResult(_0x53ed4d,0xc9))[_0xcc42('0x42')](handleError(_0x53ed4d,null));};exports[_0xcc42('0x1e')]=function(_0x2a2361,_0x53e753){if(_0x2a2361[_0xcc42('0x46')]['id']){delete _0x2a2361[_0xcc42('0x46')]['id'];}return db[_0xcc42('0x28')][_0xcc42('0x45')]({'where':{'id':_0x2a2361['params']['id']}})[_0xcc42('0x1f')](handleEntityNotFound(_0x53e753,null))['then'](saveUpdates(_0x2a2361[_0xcc42('0x46')],null))[_0xcc42('0x1f')](respondWithResult(_0x53e753,null))[_0xcc42('0x42')](handleError(_0x53e753,null));};exports[_0xcc42('0x20')]=function(_0x48f650,_0x24e51c){return db[_0xcc42('0x28')][_0xcc42('0x45')]({'where':{'id':_0x48f650[_0xcc42('0x44')]['id']}})[_0xcc42('0x1f')](handleEntityNotFound(_0x24e51c,null))[_0xcc42('0x1f')](removeEntity(_0x24e51c,null))[_0xcc42('0x42')](handleError(_0x24e51c,null));};exports['describe']=function(_0x4173ae,_0x26fa58){return db['MailTransferReport']['describe']()[_0xcc42('0x1f')](respondWithResult(_0x26fa58,null))[_0xcc42('0x42')](handleError(_0x26fa58,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e8d8e22..88a68a9 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 _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 +var _0x8736=['report_mail_transfer','util','../../config/logger','api','moment','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x8736,0xbf));var _0x6873=function(_0x566afa,_0x3e0e4d){_0x566afa=_0x566afa-0x0;var _0x28f150=_0x8736[_0x566afa];return _0x28f150;};'use strict';var _=require('lodash');var util=require(_0x6873('0x0'));var logger=require(_0x6873('0x1'))(_0x6873('0x2'));var moment=require(_0x6873('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6873('0x4'));var attributes=require(_0x6873('0x5'));module[_0x6873('0x6')]=function(_0x49e9a7,_0x4a31ca){return _0x49e9a7[_0x6873('0x7')](_0x6873('0x8'),attributes,{'tableName':_0x6873('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index fef692b..19a9eb7 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 _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 +var _0xc8b4=['code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x146b81,_0x1d1eb9){var _0x33e5b5=function(_0x292150){while(--_0x292150){_0x146b81['push'](_0x146b81['shift']());}};_0x33e5b5(++_0x1d1eb9);}(_0xc8b4,0x153));var _0x4c8b=function(_0x157fb5,_0x4c58b8){_0x157fb5=_0x157fb5-0x0;var _0x21d4e7=_0xc8b4[_0x157fb5];return _0x21d4e7;};'use strict';var _=require('lodash');var util=require(_0x4c8b('0x0'));var moment=require(_0x4c8b('0x1'));var BPromise=require('bluebird');var rs=require(_0x4c8b('0x2'));var fs=require('fs');var Redis=require(_0x4c8b('0x3'));var db=require(_0x4c8b('0x4'))['db'];var utils=require(_0x4c8b('0x5'));var logger=require(_0x4c8b('0x6'))(_0x4c8b('0x7'));var config=require(_0x4c8b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4c8b('0x9')][_0x4c8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3772a6,_0x5e4a78,_0x54a3fe){return new BPromise(function(_0x415b56,_0x19c79b){return client['request'](_0x3772a6,_0x54a3fe)[_0x4c8b('0xb')](function(_0x4fe39f){logger[_0x4c8b('0xc')](_0x4c8b('0xd'),_0x5e4a78,_0x4c8b('0xe'));logger['debug'](_0x4c8b('0xf'),_0x5e4a78,_0x4c8b('0xe'),JSON[_0x4c8b('0x10')](_0x4fe39f));if(_0x4fe39f[_0x4c8b('0x11')]){if(_0x4fe39f[_0x4c8b('0x11')][_0x4c8b('0x12')]===0x1f4){logger[_0x4c8b('0x11')](_0x4c8b('0xd'),_0x5e4a78,_0x4fe39f['error'][_0x4c8b('0x13')]);return _0x19c79b(_0x4fe39f[_0x4c8b('0x11')][_0x4c8b('0x13')]);}logger[_0x4c8b('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x5e4a78,_0x4fe39f['error'][_0x4c8b('0x13')]);return _0x415b56(_0x4fe39f[_0x4c8b('0x11')][_0x4c8b('0x13')]);}else{logger[_0x4c8b('0xc')](_0x4c8b('0xd'),_0x5e4a78,'request\x20sent');_0x415b56(_0x4fe39f['result'][_0x4c8b('0x13')]);}})[_0x4c8b('0x14')](function(_0x20a9ed){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5e4a78,_0x20a9ed);_0x19c79b(_0x20a9ed);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 154fc68..07dce7e 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 _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 +var _0xe524=['index','/:id','show','post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated'];(function(_0x2077b5,_0x34670c){var _0x292c92=function(_0x4c16c6){while(--_0x4c16c6){_0x2077b5['push'](_0x2077b5['shift']());}};_0x292c92(++_0x34670c);}(_0xe524,0x8d));var _0x4e52=function(_0x10766a,_0x2ecf29){_0x10766a=_0x10766a-0x0;var _0x78d1e0=_0xe524[_0x10766a];return _0x78d1e0;};'use strict';var multer=require(_0x4e52('0x0'));var util=require(_0x4e52('0x1'));var path=require(_0x4e52('0x2'));var timeout=require('connect-timeout');var express=require(_0x4e52('0x3'));var router=express[_0x4e52('0x4')]();var auth=require(_0x4e52('0x5'));var interaction=require(_0x4e52('0x6'));var config=require(_0x4e52('0x7'));var controller=require(_0x4e52('0x8'));router[_0x4e52('0x9')]('/',auth[_0x4e52('0xa')](),controller[_0x4e52('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4e52('0x9')](_0x4e52('0xc'),auth[_0x4e52('0xa')](),controller[_0x4e52('0xd')]);router[_0x4e52('0xe')]('/',auth['isAuthenticated'](),controller[_0x4e52('0xf')]);router[_0x4e52('0x10')]('/:id',auth[_0x4e52('0xa')](),controller[_0x4e52('0x11')]);router['delete'](_0x4e52('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x4e52('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 6412c9e..34d9784 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 _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 +var _0x00b7=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x00b7,0x1ae));var _0x700b=function(_0x105342,_0x5fb601){_0x105342=_0x105342-0x0;var _0x52b1d9=_0x00b7[_0x105342];return _0x52b1d9;};'use strict';var Sequelize=require(_0x700b('0x0'));var moment=require('moment');module[_0x700b('0x1')]={'channel':{'type':Sequelize[_0x700b('0x2')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x700b('0x2')]},'type':{'type':Sequelize[_0x700b('0x2')],'defaultValue':_0x700b('0x3'),'comment':_0x700b('0x4')},'duration':{'type':Sequelize[_0x700b('0x5')]},'enterAt':{'type':Sequelize[_0x700b('0x6')]},'exitAt':{'type':Sequelize[_0x700b('0x6')],'set':function(_0x5b921b){var _0x1b2c6f=moment(_0x5b921b);var _0x276bec=moment(this[_0x700b('0x7')](_0x700b('0x8')));var _0x499f7b=_0x1b2c6f[_0x700b('0x9')](_0x276bec,_0x700b('0xa'));this[_0x700b('0xb')](_0x700b('0xc'),_0x5b921b);this[_0x700b('0xb')](_0x700b('0xd'),_0x499f7b||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x700b('0x2')],'comment':_0x700b('0xe')},'data3':{'type':Sequelize[_0x700b('0x2')],'comment':_0x700b('0xf')},'data4':{'type':Sequelize[_0x700b('0x2')],'comment':_0x700b('0x10')},'data5':{'type':Sequelize[_0x700b('0x2')],'comment':_0x700b('0x11')},'role':{'type':Sequelize[_0x700b('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x700b('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 2f3d0e9..bcaccc1 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 _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 +var _0xe677=['../../mysqldb','sendStatus','status','end','json','count','limit','Content-Range','apply','save','then','destroy','error','stack','name','index','MemberReport','rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x56bcb4,_0x32e741){var _0x316893=function(_0x452ff2){while(--_0x452ff2){_0x56bcb4['push'](_0x56bcb4['shift']());}};_0x316893(++_0x32e741);}(_0xe677,0x1a7));var _0x7e67=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0xe677[_0x27d958];return _0x53e63e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7e67('0x0'));var rimraf=require(_0x7e67('0x1'));var zipdir=require(_0x7e67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7e67('0x3'));var moment=require(_0x7e67('0x4'));var BPromise=require(_0x7e67('0x5'));var Mustache=require(_0x7e67('0x6'));var util=require('util');var path=require(_0x7e67('0x7'));var sox=require(_0x7e67('0x8'));var csv=require(_0x7e67('0x9'));var ejs=require(_0x7e67('0xa'));var fs=require('fs');var _=require(_0x7e67('0xb'));var squel=require('squel');var crypto=require(_0x7e67('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7e67('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7e67('0xe'));var Papa=require(_0x7e67('0xf'));var Redis=require('ioredis');var authService=require(_0x7e67('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7e67('0x11'));var logger=require('../../config/logger')(_0x7e67('0x12'));var utils=require(_0x7e67('0x13'));var config=require(_0x7e67('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7e67('0x15'))['db'];function respondWithStatusCode(_0x4fc232,_0x2ca5ed){_0x2ca5ed=_0x2ca5ed||0xcc;return function(_0x5d2637){if(_0x5d2637){return _0x4fc232[_0x7e67('0x16')](_0x2ca5ed);}return _0x4fc232[_0x7e67('0x17')](_0x2ca5ed)[_0x7e67('0x18')]();};}function respondWithResult(_0x373a62,_0x43a306){_0x43a306=_0x43a306||0xc8;return function(_0xfe833b){if(_0xfe833b){return _0x373a62[_0x7e67('0x17')](_0x43a306)[_0x7e67('0x19')](_0xfe833b);}};}function respondWithFilteredResult(_0x5c0c31,_0x4e9a96){return function(_0x480f3b){if(_0x480f3b){var _0x1d5342=_0x480f3b[_0x7e67('0x1a')],_0x27d6ab=_0x4e9a96['offset'],_0x41b824=_0x4e9a96['offset']+_0x4e9a96[_0x7e67('0x1b')],_0x4a524d;if(_0x41b824>=_0x1d5342){_0x41b824=_0x1d5342;_0x4a524d=0xc8;}else{_0x4a524d=0xce;}_0x5c0c31[_0x7e67('0x17')](_0x4a524d);return _0x5c0c31['set'](_0x7e67('0x1c'),_0x27d6ab+'-'+_0x41b824+'/'+_0x1d5342)[_0x7e67('0x19')](_0x480f3b);}return null;};}function patchUpdates(_0x51d46a){return function(_0xade2dc){try{jsonpatch[_0x7e67('0x1d')](_0xade2dc,_0x51d46a,!![]);}catch(_0x163d2e){return BPromise['reject'](_0x163d2e);}return _0xade2dc[_0x7e67('0x1e')]();};}function saveUpdates(_0x43af96,_0x3474ed){return function(_0x1a0dd8){if(_0x1a0dd8){return _0x1a0dd8['update'](_0x43af96)[_0x7e67('0x1f')](function(_0x4976c){return _0x4976c;});}return null;};}function removeEntity(_0x3772c9,_0x3fee2b){return function(_0x3b8f63){if(_0x3b8f63){return _0x3b8f63[_0x7e67('0x20')]()[_0x7e67('0x1f')](function(){_0x3772c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f205f,_0x1fdd9a){return function(_0x42f83e){if(!_0x42f83e){_0x5f205f['sendStatus'](0x194);}return _0x42f83e;};}function handleError(_0x131d64,_0x53fc46){_0x53fc46=_0x53fc46||0x1f4;return function(_0xcc5aeb){logger[_0x7e67('0x21')](_0xcc5aeb[_0x7e67('0x22')]);if(_0xcc5aeb[_0x7e67('0x23')]){delete _0xcc5aeb[_0x7e67('0x23')];}_0x131d64[_0x7e67('0x17')](_0x53fc46)['send'](_0xcc5aeb);};}exports[_0x7e67('0x24')]=function(_0x27a503,_0x1229c4){var _0x4b7818={},_0x481c34={},_0x522b35={'count':0x0,'rows':[]};var _0x22d412=_['map'](db[_0x7e67('0x25')][_0x7e67('0x26')],function(_0x153400){return{'name':_0x153400[_0x7e67('0x27')],'type':_0x153400['type'][_0x7e67('0x28')]};});_0x481c34[_0x7e67('0x29')]=_[_0x7e67('0x2a')](_0x22d412,_0x7e67('0x23'));_0x481c34['query']=_[_0x7e67('0x2b')](_0x27a503['query']);_0x481c34[_0x7e67('0x2c')]=_[_0x7e67('0x2d')](_0x481c34[_0x7e67('0x29')],_0x481c34[_0x7e67('0x2e')]);_0x4b7818[_0x7e67('0x2f')]=_['intersection'](_0x481c34[_0x7e67('0x29')],qs[_0x7e67('0x30')](_0x27a503[_0x7e67('0x2e')][_0x7e67('0x30')]));_0x4b7818[_0x7e67('0x2f')]=_0x4b7818[_0x7e67('0x2f')][_0x7e67('0x31')]?_0x4b7818[_0x7e67('0x2f')]:_0x481c34[_0x7e67('0x29')];if(!_0x27a503[_0x7e67('0x2e')][_0x7e67('0x32')](_0x7e67('0x33'))){_0x4b7818['limit']=qs['limit'](_0x27a503[_0x7e67('0x2e')][_0x7e67('0x1b')]);_0x4b7818[_0x7e67('0x34')]=qs[_0x7e67('0x34')](_0x27a503[_0x7e67('0x2e')][_0x7e67('0x34')]);}_0x4b7818[_0x7e67('0x35')]=qs[_0x7e67('0x36')](_0x27a503[_0x7e67('0x2e')][_0x7e67('0x36')]);_0x4b7818[_0x7e67('0x37')]=qs[_0x7e67('0x2c')](_[_0x7e67('0x38')](_0x27a503[_0x7e67('0x2e')],_0x481c34['filters']),_0x22d412);if(_0x27a503[_0x7e67('0x2e')][_0x7e67('0x39')]){_0x4b7818['where']=_[_0x7e67('0x3a')](_0x4b7818[_0x7e67('0x37')],{'$or':_[_0x7e67('0x2a')](_0x22d412,function(_0x186ce2){if(_0x186ce2[_0x7e67('0x3b')]!==_0x7e67('0x3c')){var _0x15a915={};_0x15a915[_0x186ce2[_0x7e67('0x23')]]={'$like':'%'+_0x27a503[_0x7e67('0x2e')][_0x7e67('0x39')]+'%'};return _0x15a915;}})});}_0x4b7818=_[_0x7e67('0x3a')]({},_0x4b7818,_0x27a503[_0x7e67('0x3d')]);var _0x4a7119={'where':_0x4b7818['where']};return db[_0x7e67('0x25')][_0x7e67('0x1a')](_0x4a7119)['then'](function(_0x3bb43e){_0x522b35[_0x7e67('0x1a')]=_0x3bb43e;if(_0x27a503[_0x7e67('0x2e')][_0x7e67('0x3e')]){_0x4b7818[_0x7e67('0x3f')]=[{'all':!![]}];}return db[_0x7e67('0x25')][_0x7e67('0x40')](_0x4b7818);})[_0x7e67('0x1f')](function(_0x431243){_0x522b35[_0x7e67('0x41')]=_0x431243;return _0x522b35;})['then'](respondWithFilteredResult(_0x1229c4,_0x4b7818))[_0x7e67('0x42')](handleError(_0x1229c4,null));};exports[_0x7e67('0x43')]=function(_0x27c1bc,_0x4ea5a0){var _0x6b4d0f={'raw':!![],'where':{'id':_0x27c1bc[_0x7e67('0x44')]['id']}},_0x44bc30={};_0x44bc30['model']=_[_0x7e67('0x2b')](db[_0x7e67('0x25')][_0x7e67('0x26')]);_0x44bc30[_0x7e67('0x2e')]=_[_0x7e67('0x2b')](_0x27c1bc[_0x7e67('0x2e')]);_0x44bc30[_0x7e67('0x2c')]=_[_0x7e67('0x2d')](_0x44bc30[_0x7e67('0x29')],_0x44bc30[_0x7e67('0x2e')]);_0x6b4d0f['attributes']=_['intersection'](_0x44bc30[_0x7e67('0x29')],qs['fields'](_0x27c1bc[_0x7e67('0x2e')]['fields']));_0x6b4d0f['attributes']=_0x6b4d0f[_0x7e67('0x2f')][_0x7e67('0x31')]?_0x6b4d0f['attributes']:_0x44bc30[_0x7e67('0x29')];if(_0x27c1bc['query'][_0x7e67('0x3e')]){_0x6b4d0f['include']=[{'all':!![]}];}_0x6b4d0f=_[_0x7e67('0x3a')]({},_0x6b4d0f,_0x27c1bc[_0x7e67('0x3d')]);return db[_0x7e67('0x25')][_0x7e67('0x45')](_0x6b4d0f)[_0x7e67('0x1f')](handleEntityNotFound(_0x4ea5a0,null))[_0x7e67('0x1f')](respondWithResult(_0x4ea5a0,null))[_0x7e67('0x42')](handleError(_0x4ea5a0,null));};exports[_0x7e67('0x46')]=function(_0x25e661,_0x476e97){return db[_0x7e67('0x25')][_0x7e67('0x46')](_0x25e661[_0x7e67('0x47')],{})[_0x7e67('0x1f')](respondWithResult(_0x476e97,0xc9))['catch'](handleError(_0x476e97,null));};exports[_0x7e67('0x48')]=function(_0x1c4641,_0x2187b0){if(_0x1c4641[_0x7e67('0x47')]['id']){delete _0x1c4641['body']['id'];}return db['MemberReport'][_0x7e67('0x45')]({'where':{'id':_0x1c4641[_0x7e67('0x44')]['id']}})[_0x7e67('0x1f')](handleEntityNotFound(_0x2187b0,null))[_0x7e67('0x1f')](saveUpdates(_0x1c4641[_0x7e67('0x47')],null))[_0x7e67('0x1f')](respondWithResult(_0x2187b0,null))['catch'](handleError(_0x2187b0,null));};exports[_0x7e67('0x20')]=function(_0x122fc7,_0x52c819){return db[_0x7e67('0x25')][_0x7e67('0x45')]({'where':{'id':_0x122fc7['params']['id']}})['then'](handleEntityNotFound(_0x52c819,null))['then'](removeEntity(_0x52c819,null))['catch'](handleError(_0x52c819,null));};exports[_0x7e67('0x49')]=function(_0x152d13,_0x4678e8){return db[_0x7e67('0x25')][_0x7e67('0x49')]()[_0x7e67('0x1f')](respondWithResult(_0x4678e8,null))[_0x7e67('0x42')](handleError(_0x4678e8,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 678a8c3..70706ae 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 _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 +var _0xf229=['../../config/logger','moment','request-promise','path','./memberReport.attributes','exports','define','report_member','membername_interface','lodash','util'];(function(_0x3b0e38,_0x231369){var _0x61585f=function(_0x3f2efa){while(--_0x3f2efa){_0x3b0e38['push'](_0x3b0e38['shift']());}};_0x61585f(++_0x231369);}(_0xf229,0xda));var _0x9f22=function(_0x28aef6,_0x1333e5){_0x28aef6=_0x28aef6-0x0;var _0x5af756=_0xf229[_0x28aef6];return _0x5af756;};'use strict';var _=require(_0x9f22('0x0'));var util=require(_0x9f22('0x1'));var logger=require(_0x9f22('0x2'))('api');var moment=require(_0x9f22('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f22('0x4'));var fs=require('fs');var path=require(_0x9f22('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f22('0x6'));module[_0x9f22('0x7')]=function(_0x12b9f9,_0x5d0586){return _0x12b9f9[_0x9f22('0x8')]('MemberReport',attributes,{'tableName':_0x9f22('0x9'),'paranoid':![],'indexes':[{'name':_0x9f22('0xa'),'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 257bb29..cdd1756 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 _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 +var _0x92b7=['include','stringify','catch','body','CreateMemberReport','UpdateMemberReport','update','where','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMemberReport','MemberReport','options','raw','attributes','map','model'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x92b7,0x121));var _0x792b=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x92b7[_0x366e99];return _0x180bbe;};'use strict';var _=require(_0x792b('0x0'));var util=require('util');var moment=require(_0x792b('0x1'));var BPromise=require('bluebird');var rs=require(_0x792b('0x2'));var fs=require('fs');var Redis=require(_0x792b('0x3'));var db=require(_0x792b('0x4'))['db'];var utils=require(_0x792b('0x5'));var logger=require(_0x792b('0x6'))(_0x792b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x792b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355c2d,_0x1452cd,_0x505a3a){return new BPromise(function(_0x1a337c,_0x438e43){return client['request'](_0x355c2d,_0x505a3a)[_0x792b('0x9')](function(_0x43ecbf){logger[_0x792b('0xa')](_0x792b('0xb'),_0x1452cd,_0x792b('0xc'));logger[_0x792b('0xd')](_0x792b('0xe'),_0x1452cd,_0x792b('0xc'),JSON['stringify'](_0x43ecbf));if(_0x43ecbf[_0x792b('0xf')]){if(_0x43ecbf['error'][_0x792b('0x10')]===0x1f4){logger[_0x792b('0xf')](_0x792b('0xb'),_0x1452cd,_0x43ecbf[_0x792b('0xf')][_0x792b('0x11')]);return _0x438e43(_0x43ecbf[_0x792b('0xf')][_0x792b('0x11')]);}logger['error'](_0x792b('0xb'),_0x1452cd,_0x43ecbf[_0x792b('0xf')]['message']);return _0x1a337c(_0x43ecbf[_0x792b('0xf')]['message']);}else{logger[_0x792b('0xa')](_0x792b('0xb'),_0x1452cd,'request\x20sent');_0x1a337c(_0x43ecbf[_0x792b('0x12')]['message']);}})['catch'](function(_0xf2f58){logger[_0x792b('0xf')]('MemberReport,\x20%s,\x20%s',_0x1452cd,_0xf2f58);_0x438e43(_0xf2f58);});});}exports[_0x792b('0x13')]=function(_0x445fc3){var _0x509ae1=this;return new Promise(function(_0x4868f5,_0x49272e){return db[_0x792b('0x14')]['findAll']({'raw':_0x445fc3[_0x792b('0x15')]?_0x445fc3[_0x792b('0x15')][_0x792b('0x16')]===undefined?!![]:![]:!![],'where':_0x445fc3[_0x792b('0x15')]?_0x445fc3[_0x792b('0x15')]['where']||null:null,'attributes':_0x445fc3[_0x792b('0x15')]?_0x445fc3[_0x792b('0x15')][_0x792b('0x17')]||null:null,'limit':_0x445fc3[_0x792b('0x15')]?_0x445fc3[_0x792b('0x15')]['limit']||null:null,'include':_0x445fc3[_0x792b('0x15')]?_0x445fc3['options']['include']?_[_0x792b('0x18')](_0x445fc3[_0x792b('0x15')]['include'],function(_0x4e2b42){return{'model':db[_0x4e2b42[_0x792b('0x19')]],'as':_0x4e2b42['as'],'attributes':_0x4e2b42['attributes'],'include':_0x4e2b42['include']?_[_0x792b('0x18')](_0x4e2b42['include'],function(_0xb00943){return{'model':db[_0xb00943[_0x792b('0x19')]],'as':_0xb00943['as'],'attributes':_0xb00943['attributes'],'include':_0xb00943[_0x792b('0x1a')]?_[_0x792b('0x18')](_0xb00943[_0x792b('0x1a')],function(_0x1f26cd){return{'model':db[_0x1f26cd['model']],'as':_0x1f26cd['as'],'attributes':_0x1f26cd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b3d72){logger[_0x792b('0xa')](_0x792b('0x13'),_0x445fc3);logger['debug'](_0x792b('0x13'),_0x445fc3,JSON[_0x792b('0x1b')](_0x1b3d72));_0x4868f5(_0x1b3d72);})[_0x792b('0x1c')](function(_0x302c83){logger['error'](_0x792b('0x13'),_0x302c83['message'],_0x445fc3);_0x49272e(_0x509ae1[_0x792b('0xf')](0x1f4,_0x302c83[_0x792b('0x11')]));});});};exports['CreateMemberReport']=function(_0x4e66cb){var _0x94e8f7=this;return new Promise(function(_0x43d8a2,_0x19afb7){return db[_0x792b('0x14')]['create'](_0x4e66cb[_0x792b('0x1d')],{'raw':_0x4e66cb['options']?_0x4e66cb['options'][_0x792b('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x43751e){logger[_0x792b('0xa')](_0x792b('0x1e'),_0x4e66cb);logger[_0x792b('0xd')](_0x792b('0x1e'),_0x4e66cb,JSON[_0x792b('0x1b')](_0x43751e));_0x43d8a2(_0x43751e);})[_0x792b('0x1c')](function(_0x8832a){logger[_0x792b('0xf')]('CreateMemberReport',_0x8832a[_0x792b('0x11')],_0x4e66cb);_0x19afb7(_0x94e8f7[_0x792b('0xf')](0x1f4,_0x8832a[_0x792b('0x11')]));});});};exports[_0x792b('0x1f')]=function(_0x1e5bf3){var _0x51eada=this;return new Promise(function(_0x43b0ee,_0x5a2a45){return db[_0x792b('0x14')][_0x792b('0x20')](_0x1e5bf3[_0x792b('0x1d')],{'raw':_0x1e5bf3[_0x792b('0x15')]?_0x1e5bf3[_0x792b('0x15')][_0x792b('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e5bf3[_0x792b('0x15')]?_0x1e5bf3[_0x792b('0x15')][_0x792b('0x21')]||null:null,'attributes':_0x1e5bf3[_0x792b('0x15')]?_0x1e5bf3[_0x792b('0x15')][_0x792b('0x17')]||null:null,'limit':_0x1e5bf3[_0x792b('0x15')]?_0x1e5bf3[_0x792b('0x15')][_0x792b('0x22')]||null:null})[_0x792b('0x9')](function(_0xe0091e){logger[_0x792b('0xa')](_0x792b('0x1f'),_0x1e5bf3);logger[_0x792b('0xd')](_0x792b('0x1f'),_0x1e5bf3,JSON[_0x792b('0x1b')](_0xe0091e));_0x43b0ee(_0xe0091e);})[_0x792b('0x1c')](function(_0x59265){logger[_0x792b('0xf')](_0x792b('0x1f'),_0x59265['message'],_0x1e5bf3);_0x5a2a45(_0x51eada['error'](0x1f4,_0x59265[_0x792b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 5f0b583..528cfa8 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 _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 +var _0x087b=['index','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get'];(function(_0x55ff09,_0x3f7801){var _0x1cfc05=function(_0x1bc8b6){while(--_0x1bc8b6){_0x55ff09['push'](_0x55ff09['shift']());}};_0x1cfc05(++_0x3f7801);}(_0x087b,0x11a));var _0xb087=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x087b[_0x17928f];return _0x500b63;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var auth=require(_0xb087('0x3'));var interaction=require(_0xb087('0x4'));var config=require(_0xb087('0x5'));var controller=require(_0xb087('0x6'));router[_0xb087('0x7')]('/',controller[_0xb087('0x8')]);module[_0xb087('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d183c76..065e9a8 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 _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 +var _0x6629=['STRING','version','sequelize','exports'];(function(_0x3d2c2b,_0x45a883){var _0x4b9d32=function(_0xcb161c){while(--_0xcb161c){_0x3d2c2b['push'](_0x3d2c2b['shift']());}};_0x4b9d32(++_0x45a883);}(_0x6629,0x11a));var _0x9662=function(_0x27444a,_0x4f075c){_0x27444a=_0x27444a-0x0;var _0x42efcb=_0x6629[_0x27444a];return _0x42efcb;};'use strict';var Sequelize=require(_0x9662('0x0'));module[_0x9662('0x1')]={'version':{'type':Sequelize[_0x9662('0x2')],'unique':_0x9662('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 083f1cc..5464850 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 _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 +var _0x2ebc=['set','Content-Range','json','apply','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','merge','VIRTUAL','options','includeAll','findAll','rows','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit'];(function(_0x1df00e,_0x4a5ccb){var _0x47b3ff=function(_0x338a04){while(--_0x338a04){_0x1df00e['push'](_0x1df00e['shift']());}};_0x47b3ff(++_0x4a5ccb);}(_0x2ebc,0x195));var _0xc2eb=function(_0x10fdad,_0x24a80b){_0x10fdad=_0x10fdad-0x0;var _0x66cb65=_0x2ebc[_0x10fdad];return _0x66cb65;};'use strict';var pdf=require(_0xc2eb('0x0'));var emlformat=require(_0xc2eb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc2eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc2eb('0x3'));var moment=require(_0xc2eb('0x4'));var BPromise=require(_0xc2eb('0x5'));var Mustache=require(_0xc2eb('0x6'));var util=require(_0xc2eb('0x7'));var path=require(_0xc2eb('0x8'));var sox=require(_0xc2eb('0x9'));var csv=require(_0xc2eb('0xa'));var ejs=require(_0xc2eb('0xb'));var fs=require('fs');var _=require(_0xc2eb('0xc'));var squel=require(_0xc2eb('0xd'));var crypto=require('crypto');var jsforce=require(_0xc2eb('0xe'));var deskjs=require(_0xc2eb('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc2eb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc2eb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc2eb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2eb('0x13'))(_0xc2eb('0x14'));var utils=require('../../config/utils');var config=require(_0xc2eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc2eb('0x16'))['db'];function respondWithStatusCode(_0x46cdde,_0x5c2390){_0x5c2390=_0x5c2390||0xcc;return function(_0x13080b){if(_0x13080b){return _0x46cdde[_0xc2eb('0x17')](_0x5c2390);}return _0x46cdde[_0xc2eb('0x18')](_0x5c2390)[_0xc2eb('0x19')]();};}function respondWithResult(_0x8856ba,_0x535c3b){_0x535c3b=_0x535c3b||0xc8;return function(_0x189872){if(_0x189872){return _0x8856ba['status'](_0x535c3b)['json'](_0x189872);}};}function respondWithFilteredResult(_0x55504f,_0x17af1e){return function(_0x10d0b7){if(_0x10d0b7){var _0x211fc5=_0x10d0b7[_0xc2eb('0x1a')],_0x467a15=_0x17af1e[_0xc2eb('0x1b')],_0x4a9f0c=_0x17af1e[_0xc2eb('0x1b')]+_0x17af1e[_0xc2eb('0x1c')],_0x78f9af;if(_0x4a9f0c>=_0x211fc5){_0x4a9f0c=_0x211fc5;_0x78f9af=0xc8;}else{_0x78f9af=0xce;}_0x55504f[_0xc2eb('0x18')](_0x78f9af);return _0x55504f[_0xc2eb('0x1d')](_0xc2eb('0x1e'),_0x467a15+'-'+_0x4a9f0c+'/'+_0x211fc5)[_0xc2eb('0x1f')](_0x10d0b7);}return null;};}function patchUpdates(_0x6aafdc){return function(_0xb4afdd){try{jsonpatch[_0xc2eb('0x20')](_0xb4afdd,_0x6aafdc,!![]);}catch(_0x42833b){return BPromise[_0xc2eb('0x21')](_0x42833b);}return _0xb4afdd[_0xc2eb('0x22')]();};}function saveUpdates(_0x1e5773,_0x2b2a22){return function(_0x5e895d){if(_0x5e895d){return _0x5e895d['update'](_0x1e5773)['then'](function(_0x175765){return _0x175765;});}return null;};}function removeEntity(_0x26532c,_0x1c1a1d){return function(_0x56dc57){if(_0x56dc57){return _0x56dc57[_0xc2eb('0x23')]()[_0xc2eb('0x24')](function(){_0x26532c[_0xc2eb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30df15,_0x3c760b){return function(_0x7d07bf){if(!_0x7d07bf){_0x30df15[_0xc2eb('0x17')](0x194);}return _0x7d07bf;};}function handleError(_0x2aa422,_0x34556a){_0x34556a=_0x34556a||0x1f4;return function(_0x5ddf79){logger[_0xc2eb('0x25')](_0x5ddf79['stack']);if(_0x5ddf79[_0xc2eb('0x26')]){delete _0x5ddf79[_0xc2eb('0x26')];}_0x2aa422[_0xc2eb('0x18')](_0x34556a)[_0xc2eb('0x27')](_0x5ddf79);};}exports[_0xc2eb('0x28')]=function(_0x219a54,_0x4a06df){var _0x448193={},_0x36bf5f={},_0x1b2782={'count':0x0,'rows':[]};var _0x4fcfe2=_[_0xc2eb('0x29')](db['Migration'][_0xc2eb('0x2a')],function(_0x2577f0){return{'name':_0x2577f0[_0xc2eb('0x2b')],'type':_0x2577f0[_0xc2eb('0x2c')][_0xc2eb('0x2d')]};});_0x36bf5f[_0xc2eb('0x2e')]=_[_0xc2eb('0x29')](_0x4fcfe2,'name');_0x36bf5f[_0xc2eb('0x2f')]=_[_0xc2eb('0x30')](_0x219a54[_0xc2eb('0x2f')]);_0x36bf5f[_0xc2eb('0x31')]=_['intersection'](_0x36bf5f['model'],_0x36bf5f[_0xc2eb('0x2f')]);_0x448193[_0xc2eb('0x32')]=_['intersection'](_0x36bf5f[_0xc2eb('0x2e')],qs[_0xc2eb('0x33')](_0x219a54[_0xc2eb('0x2f')]['fields']));_0x448193[_0xc2eb('0x32')]=_0x448193[_0xc2eb('0x32')][_0xc2eb('0x34')]?_0x448193[_0xc2eb('0x32')]:_0x36bf5f[_0xc2eb('0x2e')];if(!_0x219a54[_0xc2eb('0x2f')]['hasOwnProperty'](_0xc2eb('0x35'))){_0x448193[_0xc2eb('0x1c')]=qs[_0xc2eb('0x1c')](_0x219a54['query']['limit']);_0x448193['offset']=qs[_0xc2eb('0x1b')](_0x219a54[_0xc2eb('0x2f')][_0xc2eb('0x1b')]);}_0x448193['order']=qs[_0xc2eb('0x36')](_0x219a54['query'][_0xc2eb('0x36')]);_0x448193[_0xc2eb('0x37')]=qs[_0xc2eb('0x31')](_['pick'](_0x219a54[_0xc2eb('0x2f')],_0x36bf5f[_0xc2eb('0x31')]),_0x4fcfe2);if(_0x219a54[_0xc2eb('0x2f')]['filter']){_0x448193['where']=_[_0xc2eb('0x38')](_0x448193['where'],{'$or':_[_0xc2eb('0x29')](_0x4fcfe2,function(_0x10fab9){if(_0x10fab9[_0xc2eb('0x2c')]!==_0xc2eb('0x39')){var _0xf20973={};_0xf20973[_0x10fab9[_0xc2eb('0x26')]]={'$like':'%'+_0x219a54[_0xc2eb('0x2f')]['filter']+'%'};return _0xf20973;}})});}_0x448193=_['merge']({},_0x448193,_0x219a54[_0xc2eb('0x3a')]);var _0x2e7ddc={'where':_0x448193[_0xc2eb('0x37')]};return db['Migration'][_0xc2eb('0x1a')](_0x2e7ddc)[_0xc2eb('0x24')](function(_0x26d352){_0x1b2782['count']=_0x26d352;if(_0x219a54[_0xc2eb('0x2f')][_0xc2eb('0x3b')]){_0x448193['include']=[{'all':!![]}];}return db['Migration'][_0xc2eb('0x3c')](_0x448193);})['then'](function(_0x411542){_0x1b2782[_0xc2eb('0x3d')]=_0x411542;return _0x1b2782;})[_0xc2eb('0x24')](respondWithFilteredResult(_0x4a06df,_0x448193))['catch'](handleError(_0x4a06df,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index bc15bf7..7970c8e 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 _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 +var _0x6b6c=['path','rimraf','./migration.attributes','exports','define','Migration','migrations','lodash','request-promise'];(function(_0x44a669,_0x423c34){var _0xe9bcd2=function(_0x53cad6){while(--_0x53cad6){_0x44a669['push'](_0x44a669['shift']());}};_0xe9bcd2(++_0x423c34);}(_0x6b6c,0x1e4));var _0xc6b6=function(_0x3c60ea,_0x23ca02){_0x3c60ea=_0x3c60ea-0x0;var _0xbd9bf=_0x6b6c[_0x3c60ea];return _0xbd9bf;};'use strict';var _=require(_0xc6b6('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc6b6('0x1'));var fs=require('fs');var path=require(_0xc6b6('0x2'));var rimraf=require(_0xc6b6('0x3'));var config=require('../../config/environment');var attributes=require(_0xc6b6('0x4'));module[_0xc6b6('0x5')]=function(_0x2388b1,_0x113f6f){return _0x2388b1[_0xc6b6('0x6')](_0xc6b6('0x7'),attributes,{'tableName':_0xc6b6('0x8'),'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 30fbc0b..cf11347 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 _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 +var _0x518b=['info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','http','then'];(function(_0x35d06a,_0x81abc0){var _0x3cf8a5=function(_0x2693f){while(--_0x2693f){_0x35d06a['push'](_0x35d06a['shift']());}};_0x3cf8a5(++_0x81abc0);}(_0x518b,0x15b));var _0xb518=function(_0x6fc0ad,_0x428839){_0x6fc0ad=_0x6fc0ad-0x0;var _0x3f894c=_0x518b[_0x6fc0ad];return _0x3f894c;};'use strict';var _=require(_0xb518('0x0'));var util=require(_0xb518('0x1'));var moment=require(_0xb518('0x2'));var BPromise=require(_0xb518('0x3'));var rs=require(_0xb518('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb518('0x5'))(_0xb518('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb518('0x7')][_0xb518('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17d6b9,_0x1ee23d,_0x7f21a2){return new BPromise(function(_0x47e3a0,_0x334fa5){return client['request'](_0x17d6b9,_0x7f21a2)[_0xb518('0x9')](function(_0x5002e3){logger[_0xb518('0xa')]('Migration,\x20%s,\x20%s',_0x1ee23d,_0xb518('0xb'));logger[_0xb518('0xc')](_0xb518('0xd'),_0x1ee23d,_0xb518('0xb'),JSON[_0xb518('0xe')](_0x5002e3));if(_0x5002e3[_0xb518('0xf')]){if(_0x5002e3[_0xb518('0xf')][_0xb518('0x10')]===0x1f4){logger[_0xb518('0xf')](_0xb518('0x11'),_0x1ee23d,_0x5002e3[_0xb518('0xf')][_0xb518('0x12')]);return _0x334fa5(_0x5002e3[_0xb518('0xf')]['message']);}logger[_0xb518('0xf')](_0xb518('0x11'),_0x1ee23d,_0x5002e3[_0xb518('0xf')][_0xb518('0x12')]);return _0x47e3a0(_0x5002e3['error']['message']);}else{logger[_0xb518('0xa')](_0xb518('0x11'),_0x1ee23d,'request\x20sent');_0x47e3a0(_0x5002e3[_0xb518('0x13')]['message']);}})[_0xb518('0x14')](function(_0x51ae68){logger[_0xb518('0xf')](_0xb518('0x11'),_0x1ee23d,_0x51ae68);_0x334fa5(_0x51ae68);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 95a74ac..8b250e7 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 _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 +var _0x7f52=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','index','isAuthenticated','show','create','put','/:id'];(function(_0x48cd1c,_0x215cce){var _0x90bae6=function(_0x6790ff){while(--_0x6790ff){_0x48cd1c['push'](_0x48cd1c['shift']());}};_0x90bae6(++_0x215cce);}(_0x7f52,0x1cc));var _0x27f5=function(_0x552fc5,_0x54972e){_0x552fc5=_0x552fc5-0x0;var _0x3ae584=_0x7f52[_0x552fc5];return _0x3ae584;};'use strict';var multer=require(_0x27f5('0x0'));var util=require(_0x27f5('0x1'));var path=require(_0x27f5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x27f5('0x3')]();var auth=require(_0x27f5('0x4'));var interaction=require(_0x27f5('0x5'));var config=require(_0x27f5('0x6'));var controller=require(_0x27f5('0x7'));router[_0x27f5('0x8')]('/',auth['isAuthenticated'](),controller[_0x27f5('0x9')]);router[_0x27f5('0x8')]('/:id',auth[_0x27f5('0xa')](),controller[_0x27f5('0xb')]);router['post']('/',auth[_0x27f5('0xa')](),controller[_0x27f5('0xc')]);router[_0x27f5('0xd')](_0x27f5('0xe'),auth[_0x27f5('0xa')](),controller[_0x27f5('0xf')]);router[_0x27f5('0x10')](_0x27f5('0xe'),auth[_0x27f5('0xa')](),controller[_0x27f5('0x11')]);module[_0x27f5('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 5ff43c3..62e1f6b 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(_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 +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x4702cb,_0x2ea9a2){var _0x461c1a=function(_0x2edb63){while(--_0x2edb63){_0x4702cb['push'](_0x4702cb['shift']());}};_0x461c1a(++_0x2ea9a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 e977657..c50e7d4 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 _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 +var _0x46d8=['fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','show','params','keys','include','find','create','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','TURN','server/files/templates/turn_multiple.ejs','render','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/network.ejs','toLowerCase','sequelize','transaction','join','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','eml-format','rimraf','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','json','limit','status','Content-Range','reject','save','update','destroy','end','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','query','intersection','model','attributes'];(function(_0xb5f875,_0x4993e3){var _0x27d659=function(_0x5b494b){while(--_0x5b494b){_0xb5f875['push'](_0xb5f875['shift']());}};_0x27d659(++_0x4993e3);}(_0x46d8,0x16b));var _0x846d=function(_0x1f9ee0,_0x2152a2){_0x1f9ee0=_0x1f9ee0-0x0;var _0x4274b5=_0x46d8[_0x1f9ee0];return _0x4274b5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x846d('0x0'));var rimraf=require(_0x846d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x846d('0x2'));var BPromise=require(_0x846d('0x3'));var Mustache=require(_0x846d('0x4'));var util=require(_0x846d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x846d('0x6'));var ejs=require(_0x846d('0x7'));var fs=require('fs');var _=require(_0x846d('0x8'));var squel=require(_0x846d('0x9'));var crypto=require(_0x846d('0xa'));var jsforce=require(_0x846d('0xb'));var deskjs=require(_0x846d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x846d('0xd'));var Papa=require(_0x846d('0xe'));var Redis=require(_0x846d('0xf'));var authService=require(_0x846d('0x10'));var qs=require(_0x846d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x846d('0x12'));var logger=require('../../config/logger')(_0x846d('0x13'));var utils=require(_0x846d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x846d('0x15'));var db=require(_0x846d('0x16'))['db'];var jayson=require(_0x846d('0x17'));var client=jayson[_0x846d('0x18')][_0x846d('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x383da6,_0x239efd,_0x14af27,_0x58b317){return new BPromise(function(_0x9f6b,_0x51dd64){var _0x490903=_0x58b317||client;return _0x490903[_0x846d('0x1a')](_0x383da6,_0x14af27)[_0x846d('0x1b')](function(_0x5c91f3){logger[_0x846d('0x1c')](_0x846d('0x1d'),_0x239efd,'request\x20sent');logger[_0x846d('0x1e')](_0x846d('0x1f'),_0x239efd,_0x846d('0x20'),JSON[_0x846d('0x21')](_0x5c91f3));if(_0x5c91f3['error']){if(_0x5c91f3['error'][_0x846d('0x22')]===0x1f4){logger[_0x846d('0x23')]('Network,\x20%s,\x20%s',_0x239efd,_0x5c91f3['error'][_0x846d('0x24')]);return _0x51dd64(_0x5c91f3[_0x846d('0x23')]['message']);}logger['error'](_0x846d('0x1d'),_0x239efd,_0x5c91f3[_0x846d('0x23')][_0x846d('0x24')]);return _0x9f6b(_0x5c91f3[_0x846d('0x23')][_0x846d('0x24')]);}else{logger['info']('Network,\x20%s,\x20%s',_0x239efd,_0x846d('0x20'));_0x9f6b(_0x5c91f3[_0x846d('0x25')][_0x846d('0x24')]);}})[_0x846d('0x26')](function(_0x55734f){logger[_0x846d('0x23')](_0x846d('0x1d'),_0x239efd,_0x55734f);_0x51dd64(_0x55734f);});});}function respondWithStatusCode(_0x496a17,_0x1a19f9){_0x1a19f9=_0x1a19f9||0xcc;return function(_0x13eb84){if(_0x13eb84){return _0x496a17['sendStatus'](_0x1a19f9);}return _0x496a17['status'](_0x1a19f9)['end']();};}function respondWithResult(_0x26a8ce,_0x14b8c7){_0x14b8c7=_0x14b8c7||0xc8;return function(_0x56d606){if(_0x56d606){return _0x26a8ce['status'](_0x14b8c7)[_0x846d('0x27')](_0x56d606);}};}function respondWithFilteredResult(_0x4a3fa,_0x4b656d){return function(_0x40e7d0){if(_0x40e7d0){var _0x2df39c=_0x40e7d0['count'],_0x3b9a06=_0x4b656d['offset'],_0x1df540=_0x4b656d['offset']+_0x4b656d[_0x846d('0x28')],_0x20886d;if(_0x1df540>=_0x2df39c){_0x1df540=_0x2df39c;_0x20886d=0xc8;}else{_0x20886d=0xce;}_0x4a3fa[_0x846d('0x29')](_0x20886d);return _0x4a3fa['set'](_0x846d('0x2a'),_0x3b9a06+'-'+_0x1df540+'/'+_0x2df39c)['json'](_0x40e7d0);}return null;};}function patchUpdates(_0x507d2e){return function(_0x45cdf0){try{jsonpatch['apply'](_0x45cdf0,_0x507d2e,!![]);}catch(_0x2e6ee8){return BPromise[_0x846d('0x2b')](_0x2e6ee8);}return _0x45cdf0[_0x846d('0x2c')]();};}function saveUpdates(_0x51b47b,_0x5a5025){return function(_0x395350){if(_0x395350){return _0x395350[_0x846d('0x2d')](_0x51b47b)[_0x846d('0x1b')](function(_0x49b816){return _0x49b816;});}return null;};}function removeEntity(_0x496e1a,_0x2d1aa1){return function(_0x318669){if(_0x318669){return _0x318669[_0x846d('0x2e')]()[_0x846d('0x1b')](function(){_0x496e1a[_0x846d('0x29')](0xcc)[_0x846d('0x2f')]();});}};}function handleEntityNotFound(_0x41b649,_0x4fa705){return function(_0x29a9c5){if(!_0x29a9c5){_0x41b649[_0x846d('0x30')](0x194);}return _0x29a9c5;};}function handleError(_0x379026,_0x1c6fae){_0x1c6fae=_0x1c6fae||0x1f4;return function(_0x5e5a4f){logger[_0x846d('0x23')](_0x5e5a4f[_0x846d('0x31')]);if(_0x5e5a4f[_0x846d('0x32')]){delete _0x5e5a4f['name'];}_0x379026[_0x846d('0x29')](_0x1c6fae)['send'](_0x5e5a4f);};}exports[_0x846d('0x33')]=function(_0x455fff,_0x2f741c){var _0x3f7494={},_0x361e79={},_0x518ed9={'count':0x0,'rows':[]};var _0xa1bf7c=_[_0x846d('0x34')](db[_0x846d('0x35')][_0x846d('0x36')],function(_0x32715b){return{'name':_0x32715b[_0x846d('0x37')],'type':_0x32715b[_0x846d('0x38')]['key']};});_0x361e79['model']=_[_0x846d('0x34')](_0xa1bf7c,_0x846d('0x32'));_0x361e79[_0x846d('0x39')]=_['keys'](_0x455fff[_0x846d('0x39')]);_0x361e79['filters']=_[_0x846d('0x3a')](_0x361e79[_0x846d('0x3b')],_0x361e79['query']);_0x3f7494[_0x846d('0x3c')]=_[_0x846d('0x3a')](_0x361e79['model'],qs['fields'](_0x455fff[_0x846d('0x39')][_0x846d('0x3d')]));_0x3f7494[_0x846d('0x3c')]=_0x3f7494[_0x846d('0x3c')]['length']?_0x3f7494[_0x846d('0x3c')]:_0x361e79[_0x846d('0x3b')];if(!_0x455fff[_0x846d('0x39')][_0x846d('0x3e')](_0x846d('0x3f'))){_0x3f7494[_0x846d('0x28')]=qs[_0x846d('0x28')](_0x455fff[_0x846d('0x39')][_0x846d('0x28')]);_0x3f7494[_0x846d('0x40')]=qs[_0x846d('0x40')](_0x455fff[_0x846d('0x39')]['offset']);}_0x3f7494[_0x846d('0x41')]=qs[_0x846d('0x42')](_0x455fff['query'][_0x846d('0x42')]);_0x3f7494[_0x846d('0x43')]=qs[_0x846d('0x44')](_['pick'](_0x455fff[_0x846d('0x39')],_0x361e79[_0x846d('0x44')]),_0xa1bf7c);if(_0x455fff[_0x846d('0x39')][_0x846d('0x45')]){_0x3f7494[_0x846d('0x43')]=_[_0x846d('0x46')](_0x3f7494['where'],{'$or':_['map'](_0xa1bf7c,function(_0x3e4fae){if(_0x3e4fae['type']!==_0x846d('0x47')){var _0x25bfea={};_0x25bfea[_0x3e4fae['name']]={'$like':'%'+_0x455fff[_0x846d('0x39')][_0x846d('0x45')]+'%'};return _0x25bfea;}})});}_0x3f7494=_[_0x846d('0x46')]({},_0x3f7494,_0x455fff[_0x846d('0x48')]);var _0x423840={'where':_0x3f7494[_0x846d('0x43')]};return db[_0x846d('0x35')][_0x846d('0x49')](_0x423840)[_0x846d('0x1b')](function(_0x4341ce){_0x518ed9[_0x846d('0x49')]=_0x4341ce;if(_0x455fff['query'][_0x846d('0x4a')]){_0x3f7494['include']=[{'all':!![]}];}return db[_0x846d('0x35')][_0x846d('0x4b')](_0x3f7494);})[_0x846d('0x1b')](function(_0x4828c8){_0x518ed9[_0x846d('0x4c')]=_0x4828c8;return _0x518ed9;})[_0x846d('0x1b')](respondWithFilteredResult(_0x2f741c,_0x3f7494))['catch'](handleError(_0x2f741c,null));};exports[_0x846d('0x4d')]=function(_0x3cab12,_0x1cebef){var _0x32f5de={'raw':!![],'where':{'id':_0x3cab12[_0x846d('0x4e')]['id']}},_0x19603e={};_0x19603e['model']=_['keys'](db['Network']['rawAttributes']);_0x19603e['query']=_[_0x846d('0x4f')](_0x3cab12['query']);_0x19603e[_0x846d('0x44')]=_[_0x846d('0x3a')](_0x19603e[_0x846d('0x3b')],_0x19603e[_0x846d('0x39')]);_0x32f5de['attributes']=_['intersection'](_0x19603e[_0x846d('0x3b')],qs[_0x846d('0x3d')](_0x3cab12[_0x846d('0x39')][_0x846d('0x3d')]));_0x32f5de[_0x846d('0x3c')]=_0x32f5de[_0x846d('0x3c')]['length']?_0x32f5de[_0x846d('0x3c')]:_0x19603e[_0x846d('0x3b')];if(_0x3cab12[_0x846d('0x39')]['includeAll']){_0x32f5de[_0x846d('0x50')]=[{'all':!![]}];}_0x32f5de=_['merge']({},_0x32f5de,_0x3cab12[_0x846d('0x48')]);return db[_0x846d('0x35')][_0x846d('0x51')](_0x32f5de)[_0x846d('0x1b')](handleEntityNotFound(_0x1cebef,null))[_0x846d('0x1b')](respondWithResult(_0x1cebef,null))['catch'](handleError(_0x1cebef,null));};exports[_0x846d('0x52')]=function(_0x56dedb,_0x5192ce,_0x107260){var _0x7a6e32;return db['sequelize']['transaction'](function(_0x5398e7){return db[_0x846d('0x35')][_0x846d('0x52')](_0x56dedb[_0x846d('0x53')],{'raw':!![]})[_0x846d('0x1b')](function(_0x134426){_0x7a6e32=_0x134426;return db[_0x846d('0x35')][_0x846d('0x4b')]({'where':{'type':_0x56dedb[_0x846d('0x53')][_0x846d('0x38')]},'raw':!![]});})[_0x846d('0x1b')](function(_0x20909c){if(_0x7a6e32['type'][_0x846d('0x54')]()==_0x846d('0x55')){var _0x5d7c4f=fs[_0x846d('0x56')](path['join'](config[_0x846d('0x57')],_0x846d('0x58')),_0x846d('0x59'));var _0x19145d=ejs['render'](_0x5d7c4f,{'networks':_0x20909c||[]});fs['writeFileSync'](_0x846d('0x5a'),_0x19145d);return respondWithRpcPromise('Reload',_0x846d('0x52'),{'module':'res_stun_monitor.so'});}else if(_0x7a6e32[_0x846d('0x38')][_0x846d('0x54')]()==_0x846d('0x5b')){var _0x4f0c0a=fs[_0x846d('0x56')](path['join'](config[_0x846d('0x57')],_0x846d('0x5c')),_0x846d('0x59'));var _0x2f60dd=ejs[_0x846d('0x5d')](_0x4f0c0a,{'networks':_0x20909c||[]});fs[_0x846d('0x5e')](_0x846d('0x5f'),_0x2f60dd);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x52'),{'module':_0x846d('0x61')});}else{var _0xc025a7=fs['readFileSync'](path['join'](config[_0x846d('0x57')],_0x846d('0x62')),_0x846d('0x59'));var _0x20f90e=ejs[_0x846d('0x5d')](_0xc025a7,{'networks':_0x20909c||[]});fs[_0x846d('0x5e')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x56dedb[_0x846d('0x53')][_0x846d('0x38')][_0x846d('0x63')]()),_0x20f90e);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x52'),{'module':'chan_sip.so'});}return null;})[_0x846d('0x1b')](function(){return _0x7a6e32;});})[_0x846d('0x1b')](respondWithResult(_0x5192ce,0xc9))['catch'](handleError(_0x5192ce,null));};exports[_0x846d('0x2d')]=function(_0x15f8f7,_0x46cf75,_0x1cffce){var _0x164bc3;return db[_0x846d('0x64')][_0x846d('0x65')](function(_0x1bd8eb){return db['Network'][_0x846d('0x51')]({'where':{'id':_0x15f8f7[_0x846d('0x4e')]['id']}})[_0x846d('0x1b')](handleEntityNotFound(_0x46cf75,null))[_0x846d('0x1b')](saveUpdates(_0x15f8f7['body'],null))[_0x846d('0x1b')](function(_0x556da7){if(_0x556da7){_0x164bc3=_0x556da7;return db['Network']['findAll']({'where':{'type':_0x164bc3[_0x846d('0x38')]},'raw':!![]});}return null;})[_0x846d('0x1b')](function(_0x1154b7){if(_0x164bc3[_0x846d('0x38')][_0x846d('0x54')]()=='STUN'){var _0x1912bc=fs['readFileSync'](path[_0x846d('0x66')](config[_0x846d('0x57')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1e84b7=ejs[_0x846d('0x5d')](_0x1912bc,{'networks':_0x1154b7||[]});fs[_0x846d('0x5e')](_0x846d('0x5a'),_0x1e84b7);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x2d'),{'module':_0x846d('0x61')});}else if(_0x164bc3[_0x846d('0x38')][_0x846d('0x54')]()=='TURN'){var _0x1631bf=fs['readFileSync'](path[_0x846d('0x66')](config[_0x846d('0x57')],_0x846d('0x5c')),_0x846d('0x59'));var _0x2e5b15=ejs[_0x846d('0x5d')](_0x1631bf,{'networks':_0x1154b7||[]});fs['writeFileSync'](_0x846d('0x5f'),_0x2e5b15);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x2d'),{'module':'res_stun_monitor.so'});}else{var _0x3bd61f=fs['readFileSync'](path['join'](config[_0x846d('0x57')],'server/files/templates/network.ejs'),_0x846d('0x59'));var _0x93796a=ejs[_0x846d('0x5d')](_0x3bd61f,{'networks':_0x1154b7||[]});fs[_0x846d('0x5e')](util[_0x846d('0x67')](_0x846d('0x68'),_0x15f8f7[_0x846d('0x53')][_0x846d('0x38')][_0x846d('0x63')]()),_0x93796a);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x2d'),{'module':_0x846d('0x69')});}return null;})['then'](function(_0x26313c){if(_0x26313c){return _0x164bc3;}return null;});})['then'](respondWithResult(_0x46cf75,null))[_0x846d('0x26')](handleError(_0x46cf75,null));};exports[_0x846d('0x2e')]=function(_0x411b13,_0xcd368f,_0x3db873){var _0x33a84c;return db[_0x846d('0x35')][_0x846d('0x51')]({'where':{'id':_0x411b13[_0x846d('0x4e')]['id']}})[_0x846d('0x1b')](function(_0xe42daf){_0x33a84c=_0xe42daf;return _0xe42daf;})[_0x846d('0x1b')](handleEntityNotFound(_0xcd368f,null))[_0x846d('0x1b')](removeEntity(_0xcd368f,null))['then'](function(){if(_0x33a84c){return db[_0x846d('0x35')][_0x846d('0x4b')]({'where':{'type':_0x33a84c[_0x846d('0x38')]},'raw':!![]});}})[_0x846d('0x1b')](function(_0x579d64){if(_0x33a84c[_0x846d('0x38')][_0x846d('0x54')]()==_0x846d('0x55')){var _0x449067=fs[_0x846d('0x56')](path['join'](config[_0x846d('0x57')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x1aa385=ejs['render'](_0x449067,{'networks':_0x579d64||[]});fs[_0x846d('0x5e')](_0x846d('0x5a'),_0x1aa385);return respondWithRpcPromise('Reload',_0x846d('0x2e'),{'module':_0x846d('0x61')});}else if(_0x33a84c['type'][_0x846d('0x54')]()=='TURN'){var _0x50c0ff=fs[_0x846d('0x56')](path[_0x846d('0x66')](config[_0x846d('0x57')],_0x846d('0x5c')),_0x846d('0x59'));var _0x478eac=ejs[_0x846d('0x5d')](_0x50c0ff,{'networks':_0x579d64||[]});fs[_0x846d('0x5e')](_0x846d('0x5f'),_0x478eac);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x2e'),{'module':_0x846d('0x61')});}else{var _0x444d14=fs[_0x846d('0x56')](path[_0x846d('0x66')](config[_0x846d('0x57')],_0x846d('0x62')),_0x846d('0x59'));var _0x33e111=ejs[_0x846d('0x5d')](_0x444d14,{'networks':_0x579d64||[]});fs[_0x846d('0x5e')](util[_0x846d('0x67')](_0x846d('0x68'),_0x411b13['body'][_0x846d('0x38')][_0x846d('0x63')]()),_0x33e111);return respondWithRpcPromise(_0x846d('0x60'),_0x846d('0x2e'),{'module':_0x846d('0x69')});}return null;})[_0x846d('0x26')](handleError(_0xcd368f,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 17b86f5..9bf7ae5 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 _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 +var _0x54d7=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network'];(function(_0x2b51a1,_0x188dcd){var _0x36cfe8=function(_0x503eff){while(--_0x503eff){_0x2b51a1['push'](_0x2b51a1['shift']());}};_0x36cfe8(++_0x188dcd);}(_0x54d7,0x1b3));var _0x754d=function(_0x4f873c,_0x14b401){_0x4f873c=_0x4f873c-0x0;var _0x1bfdb4=_0x54d7[_0x4f873c];return _0x1bfdb4;};'use strict';var _=require(_0x754d('0x0'));var util=require(_0x754d('0x1'));var logger=require(_0x754d('0x2'))(_0x754d('0x3'));var moment=require(_0x754d('0x4'));var BPromise=require(_0x754d('0x5'));var rp=require(_0x754d('0x6'));var fs=require('fs');var path=require(_0x754d('0x7'));var rimraf=require(_0x754d('0x8'));var config=require(_0x754d('0x9'));var attributes=require(_0x754d('0xa'));module[_0x754d('0xb')]=function(_0x23b956,_0x1646ef){return _0x23b956[_0x754d('0xc')](_0x754d('0xd'),attributes,{'tableName':_0x754d('0xe'),'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 6b005a0..6dc8fbd 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 _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 +var _0xef18=['request\x20sent','debug','stringify','error','code','message','result','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Network,\x20%s,\x20%s'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xef18,0x97));var _0x8ef1=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0xef18[_0x4ab3fb];return _0x34fe1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8ef1('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ef1('0x1'));var db=require(_0x8ef1('0x2'))['db'];var utils=require(_0x8ef1('0x3'));var logger=require(_0x8ef1('0x4'))(_0x8ef1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ef1('0x6')][_0x8ef1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xc8ece3,_0x488fee,_0xb9b351){return new BPromise(function(_0x2dd5fb,_0x58cdcb){return client[_0x8ef1('0x8')](_0xc8ece3,_0xb9b351)[_0x8ef1('0x9')](function(_0x4137d9){logger['info'](_0x8ef1('0xa'),_0x488fee,_0x8ef1('0xb'));logger[_0x8ef1('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x488fee,_0x8ef1('0xb'),JSON[_0x8ef1('0xd')](_0x4137d9));if(_0x4137d9[_0x8ef1('0xe')]){if(_0x4137d9[_0x8ef1('0xe')][_0x8ef1('0xf')]===0x1f4){logger[_0x8ef1('0xe')](_0x8ef1('0xa'),_0x488fee,_0x4137d9['error'][_0x8ef1('0x10')]);return _0x58cdcb(_0x4137d9[_0x8ef1('0xe')]['message']);}logger[_0x8ef1('0xe')](_0x8ef1('0xa'),_0x488fee,_0x4137d9['error'][_0x8ef1('0x10')]);return _0x2dd5fb(_0x4137d9[_0x8ef1('0xe')][_0x8ef1('0x10')]);}else{logger['info'](_0x8ef1('0xa'),_0x488fee,_0x8ef1('0xb'));_0x2dd5fb(_0x4137d9[_0x8ef1('0x11')][_0x8ef1('0x10')]);}})['catch'](function(_0x295f9a){logger[_0x8ef1('0xe')]('Network,\x20%s,\x20%s',_0x488fee,_0x295f9a);_0x58cdcb(_0x295f9a);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 491bd96..610576f 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 _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 +var _0x454d=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','post','sendNotification'];(function(_0x19d17a,_0x178c40){var _0x27780c=function(_0x122c2f){while(--_0x122c2f){_0x19d17a['push'](_0x19d17a['shift']());}};_0x27780c(++_0x178c40);}(_0x454d,0x12d));var _0xd454=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0x454d[_0x5651ef];return _0x392fba;};'use strict';var multer=require(_0xd454('0x0'));var util=require('util');var path=require(_0xd454('0x1'));var timeout=require(_0xd454('0x2'));var express=require(_0xd454('0x3'));var router=express[_0xd454('0x4')]();var auth=require(_0xd454('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd454('0x6'));var controller=require('./notification.controller');router[_0xd454('0x7')]('/',auth['isAuthenticated'](),controller[_0xd454('0x8')]);module[_0xd454('0x9')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 92bfa55..baeeb13 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 _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 +var _0x3cfe=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x4e247c,_0x3b5b50){var _0x3a05a0=function(_0x330bbe){while(--_0x330bbe){_0x4e247c['push'](_0x4e247c['shift']());}};_0x3a05a0(++_0x3b5b50);}(_0x3cfe,0x81));var _0xe3cf=function(_0x315ad6,_0x4fcf81){_0x315ad6=_0x315ad6-0x0;var _0x2e90a0=_0x3cfe[_0x315ad6];return _0x2e90a0;};'use strict';var Sequelize=require(_0xe3cf('0x0'));module[_0xe3cf('0x1')]={'body':{'type':Sequelize[_0xe3cf('0x2')]},'senderName':{'type':Sequelize[_0xe3cf('0x3')]},'recipientsId':{'type':Sequelize[_0xe3cf('0x2')]},'recipientsDescription':{'type':Sequelize[_0xe3cf('0x3')]},'beep':{'type':Sequelize[_0xe3cf('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 541f803..ab3c009 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 _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 +var _0x63e3=['../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./notification.socket','register','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','save','error','stack','send','sendNotification','body','hasOwnProperty','text','ValidationError','TemplateId','Sequelize','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','chatqueue','faxqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','transaction','Notification','create','forEach','recipient','emit','notification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','view','startCase','User','union','ids','queue','Queue','all','flatten','catch','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x63e3,0x16c));var _0x363e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x63e3[_0x432682];return _0x463d05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x363e('0x0'));var rimraf=require(_0x363e('0x1'));var zipdir=require(_0x363e('0x2'));var jsonpatch=require(_0x363e('0x3'));var rp=require('request-promise');var moment=require(_0x363e('0x4'));var BPromise=require(_0x363e('0x5'));var Mustache=require(_0x363e('0x6'));var util=require('util');var path=require('path');var sox=require(_0x363e('0x7'));var csv=require(_0x363e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x363e('0x9'));var squel=require(_0x363e('0xa'));var crypto=require(_0x363e('0xb'));var jsforce=require(_0x363e('0xc'));var deskjs=require(_0x363e('0xd'));var toCsv=require(_0x363e('0x8'));var querystring=require('querystring');var Papa=require(_0x363e('0xe'));var Redis=require('ioredis');var authService=require(_0x363e('0xf'));var qs=require(_0x363e('0x10'));var as=require(_0x363e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x363e('0x12'))(_0x363e('0x13'));var utils=require(_0x363e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x363e('0x15'));var db=require(_0x363e('0x16'))['db'];config['redis']=_[_0x363e('0x17')](config['redis'],{'host':_0x363e('0x18'),'port':0x18eb});var socket=require(_0x363e('0x19'))(new Redis(config['redis']));require(_0x363e('0x1a'))[_0x363e('0x1b')](socket);function respondWithStatusCode(_0x575074,_0x27c94d){_0x27c94d=_0x27c94d||0xcc;return function(_0x168a01){if(_0x168a01){return _0x575074[_0x363e('0x1c')](_0x27c94d);}return _0x575074['status'](_0x27c94d)[_0x363e('0x1d')]();};}function respondWithResult(_0x3d14d2,_0x495526){_0x495526=_0x495526||0xc8;return function(_0x3ade82){if(_0x3ade82){return _0x3d14d2[_0x363e('0x1e')](_0x495526)[_0x363e('0x1f')](_0x3ade82);}};}function respondWithFilteredResult(_0x457d95,_0x5948c0){return function(_0x2f2af8){if(_0x2f2af8){var _0x4406ad=_0x2f2af8['count'],_0x3fb05b=_0x5948c0[_0x363e('0x20')],_0x5fe44a=_0x5948c0[_0x363e('0x20')]+_0x5948c0[_0x363e('0x21')],_0x51ea50;if(_0x5fe44a>=_0x4406ad){_0x5fe44a=_0x4406ad;_0x51ea50=0xc8;}else{_0x51ea50=0xce;}_0x457d95[_0x363e('0x1e')](_0x51ea50);return _0x457d95[_0x363e('0x22')](_0x363e('0x23'),_0x3fb05b+'-'+_0x5fe44a+'/'+_0x4406ad)[_0x363e('0x1f')](_0x2f2af8);}return null;};}function patchUpdates(_0x84d793){return function(_0x58d0e9){try{jsonpatch[_0x363e('0x24')](_0x58d0e9,_0x84d793,!![]);}catch(_0x2660f7){return BPromise['reject'](_0x2660f7);}return _0x58d0e9[_0x363e('0x25')]();};}function saveUpdates(_0x12314a,_0x250f7d){return function(_0x48e524){if(_0x48e524){return _0x48e524['update'](_0x12314a)['then'](function(_0x2748fd){return _0x2748fd;});}return null;};}function removeEntity(_0xf5a45b,_0xe0fa8b){return function(_0x494400){if(_0x494400){return _0x494400['destroy']()['then'](function(){_0xf5a45b[_0x363e('0x1e')](0xcc)[_0x363e('0x1d')]();});}};}function handleEntityNotFound(_0x2cbdd9,_0x460f87){return function(_0x2d7fbe){if(!_0x2d7fbe){_0x2cbdd9[_0x363e('0x1c')](0x194);}return _0x2d7fbe;};}function handleError(_0x41862d,_0x364eb0){_0x364eb0=_0x364eb0||0x1f4;return function(_0x2538ce){logger[_0x363e('0x26')](_0x2538ce[_0x363e('0x27')]);if(_0x2538ce['name']){delete _0x2538ce['name'];}_0x41862d[_0x363e('0x1e')](_0x364eb0)[_0x363e('0x28')](_0x2538ce);};}exports[_0x363e('0x29')]=function(_0x36a4cb,_0x2aae41,_0x27c78c){if(!_0x36a4cb[_0x363e('0x2a')][_0x363e('0x2b')](_0x363e('0x2c'))&&!_0x36a4cb['body']['hasOwnProperty']('TemplateId')){throw new db['Sequelize'][(_0x363e('0x2d'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x36a4cb['body'][_0x363e('0x2b')](_0x363e('0x2e'))&&!_0x36a4cb[_0x363e('0x2a')][_0x363e('0x2b')]('view')){throw new db[(_0x363e('0x2f'))][(_0x363e('0x2d'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x36a4cb[_0x363e('0x2a')][_0x363e('0x2b')](_0x363e('0x30'))){throw new db[(_0x363e('0x2f'))][(_0x363e('0x2d'))](_0x363e('0x31'));}else{try{var _0x2b89ff=JSON[_0x363e('0x32')](_0x36a4cb[_0x363e('0x2a')][_0x363e('0x30')]);}catch(_0x933a37){logger[_0x363e('0x26')](_0x933a37);throw new db[(_0x363e('0x2f'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x538151=[_0x363e('0x33'),_0x363e('0x34'),'mailqueue','openchannelqueue',_0x363e('0x35'),_0x363e('0x36'),_0x363e('0x37'),_0x363e('0x38'),_0x363e('0x39')];if(_[_0x363e('0x3a')](_0x2b89ff,function(_0x4d37d0){return!_[_0x363e('0x3b')](_0x538151,_0x4d37d0[_0x363e('0x3c')][_0x363e('0x3d')]());})){throw new db[(_0x363e('0x2f'))]['ValidationError'](_0x363e('0x3e'));}}}var _0x10468d={};_0x10468d['senderName']=_0x36a4cb[_0x363e('0x2a')][_0x363e('0x2b')](_0x363e('0x3f'))?_0x36a4cb['body'][_0x363e('0x3f')]:_0x36a4cb[_0x363e('0x39')][_0x363e('0x40')];_0x10468d[_0x363e('0x41')]=_[_0x363e('0x42')](_0x36a4cb['body'][_0x363e('0x41')])?null:_0x36a4cb['body']['recipientsDescription'];_0x10468d[_0x363e('0x43')]=_0x36a4cb['body'][_0x363e('0x43')]||![];_0x10468d[_0x363e('0x44')]=_0x36a4cb['user']['id'];return getContent(_0x36a4cb['body'])[_0x363e('0x45')](function(_0x34aa0a){_0x10468d['body']=_0x34aa0a;return getRecipients(_0x2b89ff);})[_0x363e('0x45')](function(_0x3ea717){_0x10468d[_0x363e('0x46')]=_[_0x363e('0x47')](_0x3ea717)[_0x363e('0x48')](',');return db[_0x363e('0x49')][_0x363e('0x4a')](function(_0x3e75cb){return db[_0x363e('0x4b')][_0x363e('0x4c')](_0x10468d,{'raw':!![],'transaction':_0x3e75cb})[_0x363e('0x45')](function(_0x113cfd){var _0x24fafe={'sender':_0x10468d[_0x363e('0x3f')],'description':_0x10468d[_0x363e('0x41')],'content':_0x10468d['body'],'beep':_0x10468d[_0x363e('0x43')]};_0x3ea717[_0x363e('0x4d')](function(_0x1f2139){_0x24fafe[_0x363e('0x4e')]=_0x1f2139;socket[_0x363e('0x4f')](_0x363e('0x50'),_0x24fafe);});return _0x113cfd;});});})['then'](respondWithResult(_0x2aae41,0xc9))['catch'](handleError(_0x2aae41,null));};function getContent(_0x375e28){return new BPromise(function(_0x32d2d6,_0x173a97){if(_0x375e28[_0x363e('0x2c')]){_0x32d2d6(_0x375e28[_0x363e('0x2c')]);return;}return db['Template'][_0x363e('0x51')]({'attributes':[_0x363e('0x52')],'where':{'id':_0x375e28[_0x363e('0x2e')]},'raw':!![]})[_0x363e('0x45')](function(_0x3c8ee5){if(!_0x3c8ee5)throw new db[(_0x363e('0x2f'))][(_0x363e('0x2d'))](_0x363e('0x53'));var _0x234381=Mustache['render'](_0x3c8ee5['html'],_0x375e28[_0x363e('0x54')]);_0x32d2d6(_0x234381);})['catch'](function(_0x439df2){_0x173a97(_0x439df2);});});}function getRecipients(_0x5a22ef){return new BPromise(function(_0xda8f26,_0x2c0303){var _0x35c61b=[];var _0x596782=[];_0x5a22ef[_0x363e('0x4d')](function(_0x44b7c1){var _0x3554b9=_[_0x363e('0x55')](_0x44b7c1['model'][_0x363e('0x3d')]());if(_0x3554b9===_0x363e('0x56')){_0x35c61b=_[_0x363e('0x57')](_0x35c61b,_0x44b7c1[_0x363e('0x58')]);}else{if(_[_0x363e('0x3b')](_0x3554b9,_0x363e('0x59')))_0x3554b9=_0x3554b9['replace']('queue',_0x363e('0x5a'));_0x44b7c1[_0x363e('0x58')][_0x363e('0x4d')](function(_0x2323fa){_0x596782['push'](getAgents(_0x3554b9,_0x2323fa));});}});return BPromise[_0x363e('0x5b')](_0x596782)[_0x363e('0x45')](function(_0x456539){_0x35c61b=_[_0x363e('0x57')](_0x35c61b,_[_0x363e('0x5c')](_0x456539));_0xda8f26(_0x35c61b);})[_0x363e('0x5d')](function(_0x3b5bb2){_0x2c0303(_0x3b5bb2);});});}function getAgents(_0x4dbbf2,_0x158856){return new BPromise(function(_0x998b87,_0x32142a){return db[_0x4dbbf2][_0x363e('0x51')]({'where':{'id':_0x158856}})[_0x363e('0x45')](function(_0x2de2d3){return _0x2de2d3[_0x363e('0x5e')]({'attributes':['id'],'raw':!![]})[_0x363e('0x45')](function(_0x2af1aa){var _0x490002=_[_0x363e('0x5f')](_0x2af1aa,'id');_0x998b87(_0x490002);});})[_0x363e('0x5d')](function(_0x2113c2){_0x32142a(_0x2113c2);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index c9275ae..478fb34 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 _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 +var _0x0b0e=['Notification','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x5b69a4,_0xaa4d48){var _0x57cc73=function(_0x125d6e){while(--_0x125d6e){_0x5b69a4['push'](_0x5b69a4['shift']());}};_0x57cc73(++_0xaa4d48);}(_0x0b0e,0x187));var _0xe0b0=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0x0b0e[_0x139b63];return _0x2493f2;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var Notification=require('../../mysqldb')['db'][_0xe0b0('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe0b0('0x2'),'afterUpdate':_0xe0b0('0x3'),'afterDestroy':_0xe0b0('0x4')};function emitEvent(_0x25153a){return function(_0x28040c,_0x38a058,_0x399e67){NotificationEvents[_0xe0b0('0x5')](_0x25153a+':'+_0x28040c['id'],_0x28040c);NotificationEvents[_0xe0b0('0x5')](_0x25153a,_0x28040c);_0x399e67(null);};}for(var e in events){if(events[_0xe0b0('0x6')](e)){var event=events[e];Notification[_0xe0b0('0x7')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file diff --git a/server/api/notification/notification.model.js b/server/api/notification/notification.model.js index 477a70b..6afb533 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 _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 +var _0x7e46=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./notification.attributes','define','Notification','utf8mb4','utf8mb4_unicode_ci'];(function(_0x17bb4,_0x432fe8){var _0x15b643=function(_0x574c2a){while(--_0x574c2a){_0x17bb4['push'](_0x17bb4['shift']());}};_0x15b643(++_0x432fe8);}(_0x7e46,0x197));var _0x67e4=function(_0x2f9816,_0x520514){_0x2f9816=_0x2f9816-0x0;var _0x58a8bc=_0x7e46[_0x2f9816];return _0x58a8bc;};'use strict';var _=require('lodash');var util=require(_0x67e4('0x0'));var logger=require(_0x67e4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x67e4('0x2'));var rp=require(_0x67e4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67e4('0x4'));var config=require(_0x67e4('0x5'));var attributes=require(_0x67e4('0x6'));module['exports']=function(_0x35a96e,_0x5166c0){return _0x35a96e[_0x67e4('0x7')](_0x67e4('0x8'),attributes,{'tableName':'notifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x67e4('0x9'),'collate':_0x67e4('0xa')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index e064fd7..e022be0 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 _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 +var _0xe71c=['../../config/logger','rpc','jayson/promise','client','http','redis','./notification.socket','register','request','then','info','Notification,\x20%s,\x20%s','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x49837e,_0x208c5f){var _0x2eeadd=function(_0x29dac2){while(--_0x29dac2){_0x49837e['push'](_0x49837e['shift']());}};_0x2eeadd(++_0x208c5f);}(_0xe71c,0x133));var _0xce71=function(_0x287a47,_0x2f731c){_0x287a47=_0x287a47-0x0;var _0x3fb726=_0xe71c[_0x287a47];return _0x3fb726;};'use strict';var _=require(_0xce71('0x0'));var util=require(_0xce71('0x1'));var moment=require('moment');var BPromise=require(_0xce71('0x2'));var rs=require(_0xce71('0x3'));var fs=require('fs');var Redis=require(_0xce71('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce71('0x5'))(_0xce71('0x6'));var config=require('../../config/environment');var jayson=require(_0xce71('0x7'));var client=jayson[_0xce71('0x8')][_0xce71('0x9')]({'port':0x232a});config[_0xce71('0xa')]=_['defaults'](config[_0xce71('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce71('0xb'))[_0xce71('0xc')](socket);function respondWithRpcPromise(_0x334fac,_0x536b6d,_0xc1a942){return new BPromise(function(_0x35fc77,_0x5c1475){return client[_0xce71('0xd')](_0x334fac,_0xc1a942)[_0xce71('0xe')](function(_0x385053){logger[_0xce71('0xf')](_0xce71('0x10'),_0x536b6d,'request\x20sent');logger[_0xce71('0x11')](_0xce71('0x12'),_0x536b6d,'request\x20sent',JSON[_0xce71('0x13')](_0x385053));if(_0x385053[_0xce71('0x14')]){if(_0x385053[_0xce71('0x14')][_0xce71('0x15')]===0x1f4){logger[_0xce71('0x14')](_0xce71('0x10'),_0x536b6d,_0x385053[_0xce71('0x14')][_0xce71('0x16')]);return _0x5c1475(_0x385053['error']['message']);}logger['error'](_0xce71('0x10'),_0x536b6d,_0x385053[_0xce71('0x14')][_0xce71('0x16')]);return _0x35fc77(_0x385053[_0xce71('0x14')][_0xce71('0x16')]);}else{logger[_0xce71('0xf')](_0xce71('0x10'),_0x536b6d,_0xce71('0x17'));_0x35fc77(_0x385053[_0xce71('0x18')][_0xce71('0x16')]);}})[_0xce71('0x19')](function(_0x2f2625){logger['error'](_0xce71('0x10'),_0x536b6d,_0x2f2625);_0x5c1475(_0x2f2625);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index 2327773..833f882 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 _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 +var _0x94f6=['length','notification:','./notification.events','remove','update','emit','removeListener'];(function(_0x448b31,_0x3680f8){var _0x49798b=function(_0x1a46ef){while(--_0x1a46ef){_0x448b31['push'](_0x448b31['shift']());}};_0x49798b(++_0x3680f8);}(_0x94f6,0x1bb));var _0x694f=function(_0x38eb23,_0x1e6ba6){_0x38eb23=_0x38eb23-0x0;var _0x145319=_0x94f6[_0x38eb23];return _0x145319;};'use strict';var NotificationEvents=require(_0x694f('0x0'));var events=['save',_0x694f('0x1'),_0x694f('0x2')];function createListener(_0x2b4b07,_0x3b0620){return function(_0x180046){_0x3b0620[_0x694f('0x3')](_0x2b4b07,_0x180046);};}function removeListener(_0x50ad56,_0x4ce180){return function(){NotificationEvents[_0x694f('0x4')](_0x50ad56,_0x4ce180);};}exports['register']=function(_0x208be5){for(var _0x38e701=0x0,_0x2fd3de=events[_0x694f('0x5')];_0x38e701<_0x2fd3de;_0x38e701++){var _0x1aef16=events[_0x38e701];var _0x47edb2=createListener(_0x694f('0x6')+_0x1aef16,_0x208be5);NotificationEvents['on'](_0x1aef16,_0x47edb2);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 61066eb..a8f4ed6 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 _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 +var _0x8b13=['getAgents','post','create','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','update','destroy','delete','removeAnswers','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users'];(function(_0x1fe381,_0x576d72){var _0xaaa6d6=function(_0x304709){while(--_0x304709){_0x1fe381['push'](_0x1fe381['shift']());}};_0xaaa6d6(++_0x576d72);}(_0x8b13,0x9f));var _0x38b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8b13[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x38b1('0x0'));var path=require(_0x38b1('0x1'));var timeout=require(_0x38b1('0x2'));var express=require(_0x38b1('0x3'));var router=express[_0x38b1('0x4')]();var auth=require(_0x38b1('0x5'));var interaction=require(_0x38b1('0x6'));var config=require('../../config/environment');var controller=require(_0x38b1('0x7'));router[_0x38b1('0x8')]('/',auth[_0x38b1('0x9')](),controller[_0x38b1('0xa')]);router[_0x38b1('0x8')](_0x38b1('0xb'),auth[_0x38b1('0x9')](),controller['describe']);router['get'](_0x38b1('0xc'),auth[_0x38b1('0x9')](),controller['show']);router[_0x38b1('0x8')](_0x38b1('0xd'),auth[_0x38b1('0x9')](),controller[_0x38b1('0xe')]);router['get'](_0x38b1('0xf'),auth['isAuthenticated'](),controller[_0x38b1('0x10')]);router[_0x38b1('0x8')](_0x38b1('0x11'),auth[_0x38b1('0x9')](),controller[_0x38b1('0x12')]);router[_0x38b1('0x8')](_0x38b1('0x13'),auth[_0x38b1('0x9')](),controller['getInteractions']);router['get'](_0x38b1('0x14'),auth['isAuthenticated'](),controller[_0x38b1('0x15')]);router[_0x38b1('0x16')]('/',auth[_0x38b1('0x9')](),controller[_0x38b1('0x17')]);router[_0x38b1('0x16')](_0x38b1('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x38b1('0x16')](_0x38b1('0xf'),auth[_0x38b1('0x9')](),controller[_0x38b1('0x18')]);router[_0x38b1('0x16')](_0x38b1('0x19'),controller[_0x38b1('0x1a')]);router[_0x38b1('0x16')](_0x38b1('0x11'),auth[_0x38b1('0x9')](),controller['addApplications']);router[_0x38b1('0x16')](_0x38b1('0x14'),auth[_0x38b1('0x9')](),controller[_0x38b1('0x1b')]);router['post'](_0x38b1('0x1c'),auth['isAuthenticated'](),controller[_0x38b1('0x1d')]);router[_0x38b1('0x1e')](_0x38b1('0xc'),auth[_0x38b1('0x9')](),controller[_0x38b1('0x1f')]);router['delete']('/:id',auth[_0x38b1('0x9')](),controller[_0x38b1('0x20')]);router[_0x38b1('0x21')](_0x38b1('0xd'),auth[_0x38b1('0x9')](),controller['removeDispositions']);router[_0x38b1('0x21')](_0x38b1('0xf'),auth['isAuthenticated'](),controller[_0x38b1('0x22')]);router[_0x38b1('0x21')](_0x38b1('0x14'),auth[_0x38b1('0x9')](),controller['removeAgents']);module[_0x38b1('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 58b0dc2..887ae70 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 _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 +var _0xe6da=['exports','STRING','name','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','mandatoryDispositionPauseId','setDataValue','sequelize'];(function(_0x148d29,_0x81493){var _0x49820d=function(_0x3557dd){while(--_0x3557dd){_0x148d29['push'](_0x148d29['shift']());}};_0x49820d(++_0x81493);}(_0xe6da,0x6d));var _0xae6d=function(_0x1e06f1,_0x266faf){_0x1e06f1=_0x1e06f1-0x0;var _0x382a4a=_0xe6da[_0x1e06f1];return _0x382a4a;};'use strict';var Sequelize=require(_0xae6d('0x0'));var rs=require('randomstring');module[_0xae6d('0x1')]={'name':{'type':Sequelize[_0xae6d('0x2')],'unique':_0xae6d('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xae6d('0x2')]},'token':{'type':Sequelize[_0xae6d('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xae6d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xae6d('0x4')],'defaultValue':function(){return _0xae6d('0x5');}},'notificationSound':{'type':Sequelize[_0xae6d('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xae6d('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xae6d('0x2')]},'queueTransfer':{'type':Sequelize[_0xae6d('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xae6d('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xae6d('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xae6d('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xae6d('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e6c56){if(!_0x1e6c56)this['setDataValue'](_0xae6d('0x9'),null);this[_0xae6d('0xa')]('mandatoryDisposition',_0x1e6c56);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 43b5ba7..36a0776 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 _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 +var _0xf3f6=['rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','length','order','sort','pick','removeDispositions','addAnswer','OpenchannelAccountId','CannedAnswer','removeAnswers','notify','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','defaults','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','User','internal','Tag','Tags','color','tag','addAgents','ids','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','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','../../config/license/util','../../mysqldb','redis','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','json','offset','limit','status','Content-Range','apply','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount'];(function(_0x3f22cf,_0x1bb66e){var _0x27a021=function(_0x329da4){while(--_0x329da4){_0x3f22cf['push'](_0x3f22cf['shift']());}};_0x27a021(++_0x1bb66e);}(_0xf3f6,0x7b));var _0x6f3f=function(_0x2115c1,_0x2dc168){_0x2115c1=_0x2115c1-0x0;var _0x5806ed=_0xf3f6[_0x2115c1];return _0x5806ed;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6f3f('0x0'));var rimraf=require(_0x6f3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f3f('0x2'));var rp=require('request-promise');var moment=require(_0x6f3f('0x3'));var BPromise=require(_0x6f3f('0x4'));var Mustache=require('mustache');var util=require(_0x6f3f('0x5'));var path=require('path');var sox=require(_0x6f3f('0x6'));var csv=require(_0x6f3f('0x7'));var ejs=require(_0x6f3f('0x8'));var fs=require('fs');var _=require(_0x6f3f('0x9'));var squel=require(_0x6f3f('0xa'));var crypto=require('crypto');var jsforce=require(_0x6f3f('0xb'));var deskjs=require(_0x6f3f('0xc'));var toCsv=require(_0x6f3f('0x7'));var querystring=require(_0x6f3f('0xd'));var Papa=require(_0x6f3f('0xe'));var Redis=require(_0x6f3f('0xf'));var authService=require(_0x6f3f('0x10'));var qs=require(_0x6f3f('0x11'));var as=require(_0x6f3f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6f3f('0x13'));var utils=require(_0x6f3f('0x14'));var config=require(_0x6f3f('0x15'));var licenseUtil=require(_0x6f3f('0x16'));var db=require(_0x6f3f('0x17'))['db'];config[_0x6f3f('0x18')]=_['defaults'](config[_0x6f3f('0x18')],{'host':_0x6f3f('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f3f('0x18')]));require(_0x6f3f('0x1a'))[_0x6f3f('0x1b')](socket);var jayson=require(_0x6f3f('0x1c'));var client=jayson[_0x6f3f('0x1d')][_0x6f3f('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x6f3f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x9e9a65,_0x23db9b,_0x2ea3bc,_0x1d0456){return new BPromise(function(_0x42fb75,_0x1a926a){var _0x47aefd=_0x1d0456||client;return _0x47aefd[_0x6f3f('0x1f')](_0x9e9a65,_0x2ea3bc)[_0x6f3f('0x20')](function(_0x13a963){logger[_0x6f3f('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x23db9b,'request\x20sent');logger[_0x6f3f('0x22')](_0x6f3f('0x23'),_0x23db9b,_0x6f3f('0x24'),JSON[_0x6f3f('0x25')](_0x13a963));if(_0x13a963['error']){if(_0x13a963[_0x6f3f('0x26')][_0x6f3f('0x27')]===0x1f4){logger[_0x6f3f('0x26')](_0x6f3f('0x28'),_0x23db9b,_0x13a963['error'][_0x6f3f('0x29')]);return _0x1a926a(_0x13a963['error'][_0x6f3f('0x29')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x23db9b,_0x13a963[_0x6f3f('0x26')][_0x6f3f('0x29')]);return _0x42fb75(_0x13a963['error'][_0x6f3f('0x29')]);}else{logger[_0x6f3f('0x21')](_0x6f3f('0x28'),_0x23db9b,_0x6f3f('0x24'));_0x42fb75(_0x13a963['result']['message']);}})[_0x6f3f('0x2a')](function(_0x19f5fe){logger['error'](_0x6f3f('0x28'),_0x23db9b,_0x19f5fe);_0x1a926a(_0x19f5fe);});});}function respondWithStatusCode(_0x4611a6,_0x14859b){_0x14859b=_0x14859b||0xcc;return function(_0x5a1453){if(_0x5a1453){return _0x4611a6['sendStatus'](_0x14859b);}return _0x4611a6['status'](_0x14859b)['end']();};}function respondWithResult(_0x4b732e,_0xc5c88c){_0xc5c88c=_0xc5c88c||0xc8;return function(_0xfb122e){if(_0xfb122e){return _0x4b732e['status'](_0xc5c88c)[_0x6f3f('0x2b')](_0xfb122e);}};}function respondWithFilteredResult(_0x12d02c,_0x395f7b){return function(_0xf21651){if(_0xf21651){var _0x3b7b08=_0xf21651['count'],_0x543a97=_0x395f7b['offset'],_0x1a1a9e=_0x395f7b[_0x6f3f('0x2c')]+_0x395f7b[_0x6f3f('0x2d')],_0x1f8f3f;if(_0x1a1a9e>=_0x3b7b08){_0x1a1a9e=_0x3b7b08;_0x1f8f3f=0xc8;}else{_0x1f8f3f=0xce;}_0x12d02c[_0x6f3f('0x2e')](_0x1f8f3f);return _0x12d02c['set'](_0x6f3f('0x2f'),_0x543a97+'-'+_0x1a1a9e+'/'+_0x3b7b08)[_0x6f3f('0x2b')](_0xf21651);}return null;};}function patchUpdates(_0x25bf39){return function(_0x9237aa){try{jsonpatch[_0x6f3f('0x30')](_0x9237aa,_0x25bf39,!![]);}catch(_0x15fc2e){return BPromise[_0x6f3f('0x31')](_0x15fc2e);}return _0x9237aa[_0x6f3f('0x32')]();};}function saveUpdates(_0x5a070a,_0x400afc){return function(_0xc70a7a){if(_0xc70a7a){return _0xc70a7a[_0x6f3f('0x33')](_0x5a070a)[_0x6f3f('0x20')](function(_0x5600f9){return _0x5600f9;});}return null;};}function removeEntity(_0x4d7d10,_0x5b5136){return function(_0x37c15d){if(_0x37c15d){return _0x37c15d[_0x6f3f('0x34')]()['then'](function(){var _0x1c6d6a=_0x37c15d['get']({'plain':!![]});var _0x2a01c4=_0x6f3f('0x35');return db[_0x6f3f('0x36')][_0x6f3f('0x34')]({'where':{'type':_0x2a01c4,'resourceId':_0x1c6d6a['id']}})['then'](function(){return _0x37c15d;});})[_0x6f3f('0x20')](function(){_0x4d7d10[_0x6f3f('0x2e')](0xcc)[_0x6f3f('0x37')]();});}};}function handleEntityNotFound(_0x2ab8cc,_0x31a6bf){return function(_0x17b1cb){if(!_0x17b1cb){_0x2ab8cc[_0x6f3f('0x38')](0x194);}return _0x17b1cb;};}function handleError(_0x49ce65,_0x53fbd7){_0x53fbd7=_0x53fbd7||0x1f4;return function(_0x18e6d6){logger[_0x6f3f('0x26')](_0x18e6d6[_0x6f3f('0x39')]);if(_0x18e6d6[_0x6f3f('0x3a')]){delete _0x18e6d6[_0x6f3f('0x3a')];}_0x49ce65[_0x6f3f('0x2e')](_0x53fbd7)[_0x6f3f('0x3b')](_0x18e6d6);};}exports[_0x6f3f('0x3c')]=function(_0x29ab34,_0x42f5ae){var _0xed9da2={'include':[{'model':db[_0x6f3f('0x3d')],'as':_0x6f3f('0x3e')}]},_0x3cb0fe={},_0x2e9646={'count':0x0,'rows':[]};var _0x280626=_['map'](db[_0x6f3f('0x3f')][_0x6f3f('0x40')],function(_0x2dd296){return{'name':_0x2dd296['fieldName'],'type':_0x2dd296[_0x6f3f('0x41')][_0x6f3f('0x42')]};});_0x3cb0fe[_0x6f3f('0x43')]=_[_0x6f3f('0x44')](_0x280626,_0x6f3f('0x3a'));_0x3cb0fe[_0x6f3f('0x45')]=_[_0x6f3f('0x46')](_0x29ab34['query']);_0x3cb0fe['filters']=_[_0x6f3f('0x47')](_0x3cb0fe[_0x6f3f('0x43')],_0x3cb0fe[_0x6f3f('0x45')]);_0xed9da2[_0x6f3f('0x48')]=_[_0x6f3f('0x47')](_0x3cb0fe['model'],qs[_0x6f3f('0x49')](_0x29ab34[_0x6f3f('0x45')][_0x6f3f('0x49')]));_0xed9da2[_0x6f3f('0x48')]=_0xed9da2[_0x6f3f('0x48')]['length']?_0xed9da2[_0x6f3f('0x48')]:_0x3cb0fe['model'];if(!_0x29ab34['query'][_0x6f3f('0x4a')](_0x6f3f('0x4b'))){_0xed9da2[_0x6f3f('0x2d')]=qs['limit'](_0x29ab34[_0x6f3f('0x45')]['limit']);_0xed9da2[_0x6f3f('0x2c')]=qs['offset'](_0x29ab34[_0x6f3f('0x45')]['offset']);}_0xed9da2['order']=qs['sort'](_0x29ab34['query']['sort']);_0xed9da2[_0x6f3f('0x4c')]=qs[_0x6f3f('0x4d')](_['pick'](_0x29ab34[_0x6f3f('0x45')],_0x3cb0fe[_0x6f3f('0x4d')]),_0x280626);if(_0x29ab34[_0x6f3f('0x45')][_0x6f3f('0x4e')]){_0xed9da2['where']=_[_0x6f3f('0x4f')](_0xed9da2[_0x6f3f('0x4c')],{'$or':_['map'](_0x280626,function(_0x55f385){if(_0x55f385[_0x6f3f('0x41')]!==_0x6f3f('0x50')){var _0x12aa19={};_0x12aa19[_0x55f385['name']]={'$like':'%'+_0x29ab34[_0x6f3f('0x45')][_0x6f3f('0x4e')]+'%'};return _0x12aa19;}})});}_0xed9da2=_[_0x6f3f('0x4f')]({},_0xed9da2,_0x29ab34['options']);var _0x241ad5={'where':_0xed9da2[_0x6f3f('0x4c')]};return db[_0x6f3f('0x3f')][_0x6f3f('0x51')](_0x241ad5)[_0x6f3f('0x20')](function(_0x16292b){_0x2e9646[_0x6f3f('0x51')]=_0x16292b;if(_0x29ab34[_0x6f3f('0x45')][_0x6f3f('0x52')]){_0xed9da2[_0x6f3f('0x53')]=[{'all':!![]}];}return db[_0x6f3f('0x3f')][_0x6f3f('0x54')](_0xed9da2);})[_0x6f3f('0x20')](function(_0x9507d3){_0x2e9646[_0x6f3f('0x55')]=_0x9507d3;return _0x2e9646;})['then'](respondWithFilteredResult(_0x42f5ae,_0xed9da2))[_0x6f3f('0x2a')](handleError(_0x42f5ae,null));};exports['show']=function(_0x3b1048,_0x160637){var _0x26a58c={'raw':![],'where':{'id':_0x3b1048['params']['id']},'include':[{'model':db[_0x6f3f('0x3d')],'as':_0x6f3f('0x3e')}]},_0x1338f8={};_0x1338f8[_0x6f3f('0x43')]=_[_0x6f3f('0x46')](db[_0x6f3f('0x3f')][_0x6f3f('0x40')]);_0x1338f8[_0x6f3f('0x45')]=_[_0x6f3f('0x46')](_0x3b1048[_0x6f3f('0x45')]);_0x1338f8[_0x6f3f('0x4d')]=_[_0x6f3f('0x47')](_0x1338f8['model'],_0x1338f8['query']);_0x26a58c[_0x6f3f('0x48')]=_['intersection'](_0x1338f8['model'],qs[_0x6f3f('0x49')](_0x3b1048['query'][_0x6f3f('0x49')]));_0x26a58c[_0x6f3f('0x48')]=_0x26a58c[_0x6f3f('0x48')]['length']?_0x26a58c[_0x6f3f('0x48')]:_0x1338f8['model'];if(_0x3b1048[_0x6f3f('0x45')][_0x6f3f('0x52')]){_0x26a58c['include']=[{'all':!![]}];}_0x26a58c=_['merge']({},_0x26a58c,_0x3b1048[_0x6f3f('0x56')]);return db[_0x6f3f('0x3f')][_0x6f3f('0x57')](_0x26a58c)[_0x6f3f('0x20')](handleEntityNotFound(_0x160637,null))[_0x6f3f('0x20')](respondWithResult(_0x160637,null))[_0x6f3f('0x2a')](handleError(_0x160637,null));};exports[_0x6f3f('0x58')]=function(_0x23e257,_0xd6e66e){return db[_0x6f3f('0x3f')][_0x6f3f('0x58')](_0x23e257[_0x6f3f('0x59')],{})[_0x6f3f('0x20')](function(_0x3fc5c2){var _0x19dcdf=_0x23e257[_0x6f3f('0x5a')][_0x6f3f('0x5b')]({'plain':!![]});if(!_0x19dcdf)throw new Error(_0x6f3f('0x5c'));if(_0x19dcdf['role']===_0x6f3f('0x5a')){var _0x2140c5=_0x3fc5c2[_0x6f3f('0x5b')]({'plain':!![]});var _0x3dcd52='OpenchannelAccounts';return db[_0x6f3f('0x5d')][_0x6f3f('0x57')]({'where':{'name':_0x3dcd52,'userProfileId':_0x19dcdf[_0x6f3f('0x5e')]},'raw':!![]})[_0x6f3f('0x20')](function(_0x14ae80){if(_0x14ae80&&_0x14ae80[_0x6f3f('0x5f')]===0x0){return db[_0x6f3f('0x36')][_0x6f3f('0x58')]({'name':_0x2140c5['name'],'resourceId':_0x2140c5['id'],'type':_0x14ae80[_0x6f3f('0x3a')],'sectionId':_0x14ae80['id']},{})[_0x6f3f('0x20')](function(){return _0x3fc5c2;});}else{return _0x3fc5c2;}})[_0x6f3f('0x2a')](function(_0x5c098e){logger[_0x6f3f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c098e);throw _0x5c098e;});}return _0x3fc5c2;})[_0x6f3f('0x20')](respondWithResult(_0xd6e66e,0xc9))[_0x6f3f('0x2a')](handleError(_0xd6e66e,null));};exports['update']=function(_0x1ecdd4,_0x114b1c){if(_0x1ecdd4[_0x6f3f('0x59')]['id']){delete _0x1ecdd4[_0x6f3f('0x59')]['id'];}return db[_0x6f3f('0x3f')][_0x6f3f('0x57')]({'where':{'id':_0x1ecdd4['params']['id']},'include':[{'model':db[_0x6f3f('0x3d')],'as':_0x6f3f('0x3e')}]})[_0x6f3f('0x20')](handleEntityNotFound(_0x114b1c,null))[_0x6f3f('0x20')](saveUpdates(_0x1ecdd4['body'],null))[_0x6f3f('0x20')](respondWithResult(_0x114b1c,null))['catch'](handleError(_0x114b1c,null));};exports['destroy']=function(_0x2ac9b9,_0x49de82){return db[_0x6f3f('0x3f')][_0x6f3f('0x57')]({'where':{'id':_0x2ac9b9[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x49de82,null))[_0x6f3f('0x20')](removeEntity(_0x49de82,null))['catch'](handleError(_0x49de82,null));};exports['describe']=function(_0x15158f,_0x5ca90f){return db['OpenchannelAccount'][_0x6f3f('0x61')]()[_0x6f3f('0x20')](respondWithResult(_0x5ca90f,null))['catch'](handleError(_0x5ca90f,null));};exports[_0x6f3f('0x62')]=function(_0x217958,_0x3e7fbf,_0x3efc9e){if(_0x217958['body']['id']){delete _0x217958[_0x6f3f('0x59')]['id'];}return db[_0x6f3f('0x3f')]['find']({'where':{'id':_0x217958['params']['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x3e7fbf,null))[_0x6f3f('0x20')](function(_0x2c6219){if(_0x2c6219){_0x217958[_0x6f3f('0x59')]['OpenchannelAccountId']=_0x2c6219['id'];return db[_0x6f3f('0x63')]['create'](_0x217958[_0x6f3f('0x59')]);}})[_0x6f3f('0x20')](respondWithResult(_0x3e7fbf,null))[_0x6f3f('0x2a')](handleError(_0x3e7fbf,null));};exports[_0x6f3f('0x64')]=function(_0x54b7ff,_0x51b9a7,_0x32dd99){var _0x3e6c42={'raw':![],'where':{}};var _0x22bb2e={};var _0x4a7127={'count':0x0,'rows':[]};return db[_0x6f3f('0x3f')][_0x6f3f('0x65')]({'where':{'id':_0x54b7ff[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x51b9a7,null))['then'](function(_0x5e2e88){if(_0x5e2e88){_0x22bb2e[_0x6f3f('0x43')]=_[_0x6f3f('0x46')](db[_0x6f3f('0x63')]['rawAttributes']);_0x22bb2e[_0x6f3f('0x45')]=_[_0x6f3f('0x46')](_0x54b7ff[_0x6f3f('0x45')]);_0x22bb2e[_0x6f3f('0x4d')]=_[_0x6f3f('0x47')](_0x22bb2e[_0x6f3f('0x43')],_0x22bb2e[_0x6f3f('0x45')]);_0x3e6c42[_0x6f3f('0x48')]=_[_0x6f3f('0x47')](_0x22bb2e[_0x6f3f('0x43')],qs[_0x6f3f('0x49')](_0x54b7ff['query'][_0x6f3f('0x49')]));_0x3e6c42[_0x6f3f('0x48')]=_0x3e6c42['attributes'][_0x6f3f('0x66')]?_0x3e6c42['attributes']:_0x22bb2e[_0x6f3f('0x43')];if(!_0x54b7ff[_0x6f3f('0x45')][_0x6f3f('0x4a')](_0x6f3f('0x4b'))){_0x3e6c42['limit']=qs[_0x6f3f('0x2d')](_0x54b7ff['query']['limit']);_0x3e6c42['offset']=qs[_0x6f3f('0x2c')](_0x54b7ff[_0x6f3f('0x45')][_0x6f3f('0x2c')]);}_0x3e6c42[_0x6f3f('0x67')]=qs[_0x6f3f('0x68')](_0x54b7ff[_0x6f3f('0x45')]['sort']);_0x3e6c42[_0x6f3f('0x4c')]=qs['filters'](_[_0x6f3f('0x69')](_0x54b7ff[_0x6f3f('0x45')],_0x22bb2e[_0x6f3f('0x4d')]));_0x3e6c42['where']['OpenchannelAccountId']=_0x5e2e88['id'];if(_0x54b7ff[_0x6f3f('0x45')][_0x6f3f('0x4e')]){_0x3e6c42[_0x6f3f('0x4c')]=_['merge'](_0x3e6c42[_0x6f3f('0x4c')],{'$or':_[_0x6f3f('0x44')](_0x3e6c42[_0x6f3f('0x48')],function(_0x1ace7e){var _0xed0a75={};_0xed0a75[_0x1ace7e]={'$like':'%'+_0x54b7ff['query'][_0x6f3f('0x4e')]+'%'};return _0xed0a75;})});}_0x3e6c42=_[_0x6f3f('0x4f')]({},_0x3e6c42,_0x54b7ff[_0x6f3f('0x56')]);return db[_0x6f3f('0x63')][_0x6f3f('0x51')]({'where':_0x3e6c42['where']})[_0x6f3f('0x20')](function(_0x36d765){_0x4a7127['count']=_0x36d765;if(_0x54b7ff['query']['includeAll']){_0x3e6c42['include']=[{'all':!![]}];}return db[_0x6f3f('0x63')][_0x6f3f('0x54')](_0x3e6c42);})[_0x6f3f('0x20')](function(_0x11a935){_0x4a7127['rows']=_0x11a935;return _0x4a7127;});}})[_0x6f3f('0x20')](respondWithFilteredResult(_0x51b9a7,_0x3e6c42))[_0x6f3f('0x2a')](handleError(_0x51b9a7,null));};exports['removeDispositions']=function(_0x184550,_0x462870,_0x24eecc){return db['OpenchannelAccount'][_0x6f3f('0x57')]({'where':{'id':_0x184550[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x462870,null))[_0x6f3f('0x20')](function(_0x266819){if(_0x266819){return _0x266819[_0x6f3f('0x6a')](_0x184550['query']['ids']);}})['then'](respondWithStatusCode(_0x462870,null))['catch'](handleError(_0x462870,null));};exports[_0x6f3f('0x6b')]=function(_0x30293e,_0x2f2074,_0x441c38){if(_0x30293e[_0x6f3f('0x59')]['id']){delete _0x30293e[_0x6f3f('0x59')]['id'];}return db[_0x6f3f('0x3f')][_0x6f3f('0x57')]({'where':{'id':_0x30293e['params']['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x2f2074,null))[_0x6f3f('0x20')](function(_0x4d29bc){if(_0x4d29bc){_0x30293e[_0x6f3f('0x59')][_0x6f3f('0x6c')]=_0x4d29bc['id'];return db[_0x6f3f('0x6d')][_0x6f3f('0x58')](_0x30293e['body']);}})[_0x6f3f('0x20')](respondWithResult(_0x2f2074,null))[_0x6f3f('0x2a')](handleError(_0x2f2074,null));};exports['getAnswers']=function(_0x3b396d,_0x44f8f3,_0x35f72e){var _0x220835={'raw':![],'where':{}};var _0x43c512={};var _0xa693e6={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6f3f('0x65')]({'where':{'id':_0x3b396d[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x44f8f3,null))['then'](function(_0x181dc9){if(_0x181dc9){_0x43c512[_0x6f3f('0x43')]=_[_0x6f3f('0x46')](db[_0x6f3f('0x6d')][_0x6f3f('0x40')]);_0x43c512[_0x6f3f('0x45')]=_['keys'](_0x3b396d[_0x6f3f('0x45')]);_0x43c512['filters']=_[_0x6f3f('0x47')](_0x43c512[_0x6f3f('0x43')],_0x43c512['query']);_0x220835[_0x6f3f('0x48')]=_[_0x6f3f('0x47')](_0x43c512[_0x6f3f('0x43')],qs['fields'](_0x3b396d[_0x6f3f('0x45')]['fields']));_0x220835[_0x6f3f('0x48')]=_0x220835[_0x6f3f('0x48')]['length']?_0x220835[_0x6f3f('0x48')]:_0x43c512[_0x6f3f('0x43')];if(!_0x3b396d[_0x6f3f('0x45')][_0x6f3f('0x4a')]('nolimit')){_0x220835[_0x6f3f('0x2d')]=qs[_0x6f3f('0x2d')](_0x3b396d[_0x6f3f('0x45')][_0x6f3f('0x2d')]);_0x220835[_0x6f3f('0x2c')]=qs['offset'](_0x3b396d['query'][_0x6f3f('0x2c')]);}_0x220835['order']=qs[_0x6f3f('0x68')](_0x3b396d[_0x6f3f('0x45')][_0x6f3f('0x68')]);_0x220835[_0x6f3f('0x4c')]=qs[_0x6f3f('0x4d')](_['pick'](_0x3b396d[_0x6f3f('0x45')],_0x43c512['filters']));_0x220835[_0x6f3f('0x4c')][_0x6f3f('0x6c')]=_0x181dc9['id'];if(_0x3b396d[_0x6f3f('0x45')][_0x6f3f('0x4e')]){_0x220835[_0x6f3f('0x4c')]=_['merge'](_0x220835['where'],{'$or':_['map'](_0x220835[_0x6f3f('0x48')],function(_0x19cff7){var _0x258d73={};_0x258d73[_0x19cff7]={'$like':'%'+_0x3b396d[_0x6f3f('0x45')][_0x6f3f('0x4e')]+'%'};return _0x258d73;})});}_0x220835=_['merge']({},_0x220835,_0x3b396d[_0x6f3f('0x56')]);return db[_0x6f3f('0x6d')][_0x6f3f('0x51')]({'where':_0x220835['where']})[_0x6f3f('0x20')](function(_0x2814de){_0xa693e6[_0x6f3f('0x51')]=_0x2814de;if(_0x3b396d[_0x6f3f('0x45')]['includeAll']){_0x220835['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x6f3f('0x54')](_0x220835);})[_0x6f3f('0x20')](function(_0xd93d1f){_0xa693e6[_0x6f3f('0x55')]=_0xd93d1f;return _0xa693e6;});}})[_0x6f3f('0x20')](respondWithFilteredResult(_0x44f8f3,_0x220835))[_0x6f3f('0x2a')](handleError(_0x44f8f3,null));};exports[_0x6f3f('0x6e')]=function(_0x2dfa57,_0x2dc0b9,_0x9dca8f){return db[_0x6f3f('0x3f')][_0x6f3f('0x57')]({'where':{'id':_0x2dfa57[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x2dc0b9,null))[_0x6f3f('0x20')](function(_0x40774a){if(_0x40774a){return _0x40774a[_0x6f3f('0x6e')](_0x2dfa57[_0x6f3f('0x45')]['ids']);}})[_0x6f3f('0x20')](respondWithStatusCode(_0x2dc0b9,null))['catch'](handleError(_0x2dc0b9,null));};exports[_0x6f3f('0x6f')]=function(_0x113620,_0x4c245e,_0x3067d1){var _0x1a61a3={'body':_0x113620['body'],'channel':'openchannel'};var _0x2f54f6=[];var _0x9c4d6=[];var _0x106c36={};var _0x324054=![];return db[_0x6f3f('0x70')]['describe']()[_0x6f3f('0x20')](function(_0x49d39d){if(!_0x49d39d){throw new db[(_0x6f3f('0x71'))][(_0x6f3f('0x72'))](_0x6f3f('0x73'));}_0x2f54f6=_[_0x6f3f('0x74')](_['keys'](_0x49d39d),[_0x6f3f('0x75'),_0x6f3f('0x76')]);_0x9c4d6=_[_0x6f3f('0x74')](_[_0x6f3f('0x46')](_0x49d39d),['createdAt',_0x6f3f('0x76'),_0x6f3f('0x77'),_0x6f3f('0x78')]);if(_0x113620[_0x6f3f('0x59')]['id']){delete _0x113620['body']['id'];}if(_[_0x6f3f('0x79')](_0x113620[_0x6f3f('0x59')][_0x6f3f('0x7a')])){throw new db[(_0x6f3f('0x71'))][(_0x6f3f('0x72'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x113620[_0x6f3f('0x59')][_0x6f3f('0x59')])||_0x113620[_0x6f3f('0x59')][_0x6f3f('0x59')]===''){throw new db[(_0x6f3f('0x71'))][(_0x6f3f('0x72'))](_0x6f3f('0x7b'));}if(_['isNil'](_0x113620[_0x6f3f('0x59')][_0x6f3f('0x7c')])){throw new db[(_0x6f3f('0x71'))][(_0x6f3f('0x72'))](_0x6f3f('0x7d')+_0x9c4d6);}if(!_[_0x6f3f('0x7e')](_0x9c4d6,_0x113620[_0x6f3f('0x59')][_0x6f3f('0x7c')])){throw new db['Sequelize'][(_0x6f3f('0x72'))](_0x6f3f('0x7f')+_0x9c4d6);}_0x106c36[_0x113620['body'][_0x6f3f('0x7c')]]=_0x113620['body'][_0x6f3f('0x7a')];})[_0x6f3f('0x20')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x113620[_0x6f3f('0x60')]['id']},'include':[{'model':db[_0x6f3f('0x80')],'as':_0x6f3f('0x81'),'include':[{'model':db['CmContact'],'as':_0x6f3f('0x82'),'where':_0x106c36,'limit':0x1,'order':[[_0x6f3f('0x76'),_0x6f3f('0x83')]]}]},{'model':db['OpenchannelApplication'],'as':_0x6f3f('0x84')}]});})['then'](handleEntityNotFound(_0x4c245e,null))[_0x6f3f('0x20')](function(_0x2104f6){if(_0x2104f6&&_0x2104f6[_0x6f3f('0x81')]){_0x1a61a3[_0x6f3f('0x85')]=_0x2104f6;_0x1a61a3[_0x6f3f('0x86')]=_0x2104f6[_0x6f3f('0x84')];_0x1a61a3[_0x6f3f('0x87')]=_0x2104f6[_0x6f3f('0x81')];_0x1a61a3[_0x6f3f('0x86')]=_[_0x6f3f('0x88')](_0x1a61a3[_0x6f3f('0x86')],['priority'],[_0x6f3f('0x89')]);if(_0x1a61a3['account'][_0x6f3f('0x84')]){delete _0x1a61a3[_0x6f3f('0x85')][_0x6f3f('0x84')];}if(_0x1a61a3[_0x6f3f('0x85')][_0x6f3f('0x81')]&&_0x1a61a3[_0x6f3f('0x85')]['List'][_0x6f3f('0x82')]['length']){return _0x1a61a3[_0x6f3f('0x85')][_0x6f3f('0x81')][_0x6f3f('0x82')][0x0];}var _0x264cf0=_[_0x6f3f('0x8a')](_0x113620[_0x6f3f('0x59')],{'firstName':_0x113620['body'][_0x6f3f('0x7a')],'ListId':_0x2104f6['ListId']});_0x264cf0[_0x113620[_0x6f3f('0x59')][_0x6f3f('0x7c')]]=_0x113620['body'][_0x6f3f('0x7a')];return db[_0x6f3f('0x70')][_0x6f3f('0x58')](_0x264cf0,{'fields':_0x2f54f6,'raw':!![]});}})[_0x6f3f('0x20')](handleEntityNotFound(_0x4c245e,null))[_0x6f3f('0x20')](function(_0x29f1f0){_0x1a61a3[_0x6f3f('0x8b')]=_0x29f1f0;if(_0x29f1f0){var _0x586ca2={'ContactId':_0x29f1f0['id'],'OpenchannelAccountId':_0x113620['params']['id'],'from':(_0x29f1f0['firstName']||'')+'\x20'+(_0x29f1f0[_0x6f3f('0x8c')]||'')};var _0x8132a2={'OpenchannelAccountId':_0x113620[_0x6f3f('0x60')]['id'],'closed':![]};if(_0x113620['body'][_0x6f3f('0x8d')]){_0x8132a2[_0x6f3f('0x8d')]=_0x113620[_0x6f3f('0x59')][_0x6f3f('0x8d')];return db[_0x6f3f('0x8e')]['find']({'where':_0x8132a2})[_0x6f3f('0x20')](function(_0x849605){if(_0x849605){return[_0x849605,![]];}_0x586ca2[_0x6f3f('0x8d')]=_0x113620[_0x6f3f('0x59')]['threadId'];_0x586ca2[_0x6f3f('0x8f')]=_0x113620[_0x6f3f('0x59')][_0x6f3f('0x8f')];return db['OpenchannelInteraction'][_0x6f3f('0x58')](_0x586ca2)[_0x6f3f('0x20')](function(_0x47414a){return[_0x47414a,!![]];});});}else{_0x8132a2[_0x6f3f('0x8d')]=null;}_0x8132a2[_0x6f3f('0x90')]=_0x29f1f0['id'];return db['OpenchannelInteraction'][_0x6f3f('0x57')]({'where':_0x8132a2})[_0x6f3f('0x20')](function(_0x339b63){if(_0x339b63){return[_0x339b63,![]];}return db[_0x6f3f('0x8e')][_0x6f3f('0x58')](_0x586ca2)[_0x6f3f('0x20')](function(_0xf753eb){return[_0xf753eb,!![]];});});}})[_0x6f3f('0x91')](function(_0x19c800,_0x2011f7){if(_0x19c800){_0x324054=_0x2011f7;if(!_0x2011f7){var _0xa525e9={'from':(_0x1a61a3[_0x6f3f('0x8b')][_0x6f3f('0x92')]||'')+'\x20'+(_0x1a61a3[_0x6f3f('0x8b')][_0x6f3f('0x8c')]||'')};if(_0x113620[_0x6f3f('0x59')]['threadId']&&_0x113620['body'][_0x6f3f('0x93')]&&_0x113620['body'][_0x6f3f('0x8d')]!=_0x113620[_0x6f3f('0x59')]['messageId']){_0xa525e9[_0x6f3f('0x8d')]=_0x113620[_0x6f3f('0x59')][_0x6f3f('0x93')];}return _0x19c800['update'](_0xa525e9);}else{return _0x19c800;}}})['then'](function(_0x222bee){_0x1a61a3['interaction']=_0x222bee[_0x6f3f('0x5b')]({'plain':!![]});_0x1a61a3[_0x6f3f('0x94')][_0x6f3f('0x95')]=_0x324054;if(_0x1a61a3[_0x6f3f('0x94')][_0x6f3f('0x95')]){if(_0x1a61a3[_0x6f3f('0x85')]['autoclose']){_0x1a61a3[_0x6f3f('0x86')][_0x6f3f('0x96')]({'id':0x0,'priority':_0x1a61a3[_0x6f3f('0x86')][_0x6f3f('0x66')]+0x1,'app':_0x6f3f('0x97'),'appdata':'unmanaged','interval':_0x6f3f('0x98')});}}return db[_0x6f3f('0x99')]['create']({'body':_0x113620[_0x6f3f('0x59')][_0x6f3f('0x59')],'OpenchannelAccountId':_0x113620['params']['id'],'OpenchannelInteractionId':_0x222bee['id'],'direction':'in','ContactId':_0x1a61a3['contact']['id'],'AttachmentId':_0x113620[_0x6f3f('0x59')][_0x6f3f('0x9a')]});})[_0x6f3f('0x20')](function(_0x40c5c1){_0x1a61a3[_0x6f3f('0x29')]=_0x40c5c1;if(_0x1a61a3[_0x6f3f('0x94')][_0x6f3f('0x9b')]){return db['User'][_0x6f3f('0x57')]({'attributes':['id','name'],'where':{'id':_0x1a61a3[_0x6f3f('0x94')]['UserId']}})['then'](function(_0x4cd18c){if(_0x4cd18c){_0x1a61a3['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4cd18c[_0x6f3f('0x3a')]+','+(_0x1a61a3['account'][_0x6f3f('0x9c')]||0xa),'interval':'*,*,*,*'});_0x1a61a3['forcedOwnership']=![];}return respondWithRpcPromise(_0x6f3f('0x9d'),_0x6f3f('0x9e'),_0x1a61a3);});}return respondWithRpcPromise(_0x6f3f('0x9d'),_0x6f3f('0x9e'),_0x1a61a3);})[_0x6f3f('0x20')](function(_0x2fa495){respondWithRpcPromise(_0x6f3f('0x9f'),'EventManager',{'event':'notify','message':_0x2fa495},client9002);return _0x2fa495;})[_0x6f3f('0x20')](respondWithResult(_0x4c245e,null))['catch'](handleError(_0x4c245e,null));};exports[_0x6f3f('0xa0')]=function(_0x3e66e9,_0x404435,_0x3f7366){return db[_0x6f3f('0x3f')][_0x6f3f('0x65')]({'where':{'id':_0x3e66e9['params']['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x404435,null))['then'](function(_0xbfd6ad){if(_0xbfd6ad){return db[_0x6f3f('0xa1')][_0x6f3f('0xa2')](function(_0x3c6956){return db[_0x6f3f('0xa3')][_0x6f3f('0x34')]({'where':{'OpenchannelAccountId':_0x3e66e9[_0x6f3f('0x60')]['id']},'transaction':_0x3c6956})[_0x6f3f('0x20')](function(_0x1b3d6c){var _0x1949a9=_['map'](_0x3e66e9[_0x6f3f('0x59')],function(_0x3b6520){_0x3b6520[_0x6f3f('0x6c')]=_0x3e66e9['params']['id'];return _0x3b6520;});return db[_0x6f3f('0xa3')][_0x6f3f('0xa4')](_0x1949a9,{'transaction':_0x3c6956});});})[_0x6f3f('0x20')](function(){return db[_0x6f3f('0xa3')][_0x6f3f('0xa5')]({'where':{'OpenchannelAccountId':_0x3e66e9[_0x6f3f('0x60')]['id']},'order':_0x6f3f('0xa6')});});}})['then'](respondWithResult(_0x404435,null))['catch'](handleError(_0x404435,null));};exports[_0x6f3f('0xa7')]=function(_0x66eb2c,_0x36ea99,_0x4a633a){var _0x42b778={};var _0x4d8aae={};var _0x138663;var _0x16ad7e;return db[_0x6f3f('0x3f')]['findOne']({'where':{'id':_0x66eb2c['params']['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x36ea99,null))[_0x6f3f('0x20')](function(_0x4e1a06){if(_0x4e1a06){_0x138663=_0x4e1a06;_0x4d8aae[_0x6f3f('0x43')]=_[_0x6f3f('0x46')](db[_0x6f3f('0xa3')][_0x6f3f('0x40')]);_0x4d8aae[_0x6f3f('0x45')]=_['keys'](_0x66eb2c[_0x6f3f('0x45')]);_0x4d8aae[_0x6f3f('0x4d')]=_[_0x6f3f('0x47')](_0x4d8aae[_0x6f3f('0x43')],_0x4d8aae['query']);_0x42b778[_0x6f3f('0x48')]=_['intersection'](_0x4d8aae[_0x6f3f('0x43')],qs['fields'](_0x66eb2c[_0x6f3f('0x45')][_0x6f3f('0x49')]));_0x42b778[_0x6f3f('0x48')]=_0x42b778[_0x6f3f('0x48')][_0x6f3f('0x66')]?_0x42b778[_0x6f3f('0x48')]:_0x4d8aae[_0x6f3f('0x43')];_0x42b778[_0x6f3f('0x67')]=qs[_0x6f3f('0x68')](_0x66eb2c[_0x6f3f('0x45')][_0x6f3f('0x68')]);_0x42b778[_0x6f3f('0x4c')]=qs[_0x6f3f('0x4d')](_[_0x6f3f('0x69')](_0x66eb2c['query'],_0x4d8aae[_0x6f3f('0x4d')]));if(_0x66eb2c[_0x6f3f('0x45')]['filter']){_0x42b778[_0x6f3f('0x4c')]=_[_0x6f3f('0x4f')](_0x42b778[_0x6f3f('0x4c')],{'$or':_[_0x6f3f('0x44')](_0x42b778['attributes'],function(_0x4d1861){var _0x7d978d={};_0x7d978d[_0x4d1861]={'$like':'%'+_0x66eb2c[_0x6f3f('0x45')][_0x6f3f('0x4e')]+'%'};return _0x7d978d;})});}_0x42b778=_[_0x6f3f('0x4f')]({},_0x42b778,_0x66eb2c[_0x6f3f('0x56')]);return _0x138663[_0x6f3f('0xa7')](_0x42b778);}})[_0x6f3f('0x20')](function(_0x50658f){if(_0x50658f){_0x16ad7e=_0x50658f['length'];if(!_0x66eb2c[_0x6f3f('0x45')][_0x6f3f('0x4a')](_0x6f3f('0x4b'))){_0x42b778[_0x6f3f('0x2d')]=qs[_0x6f3f('0x2d')](_0x66eb2c[_0x6f3f('0x45')]['limit']);_0x42b778[_0x6f3f('0x2c')]=qs[_0x6f3f('0x2c')](_0x66eb2c[_0x6f3f('0x45')][_0x6f3f('0x2c')]);}return _0x138663[_0x6f3f('0xa7')](_0x42b778);}})[_0x6f3f('0x20')](function(_0x2ca853){if(_0x2ca853){return _0x2ca853?{'count':_0x16ad7e,'rows':_0x2ca853}:null;}})[_0x6f3f('0x20')](respondWithResult(_0x36ea99,null))[_0x6f3f('0x2a')](handleError(_0x36ea99,null));};exports[_0x6f3f('0xa8')]=function(_0x1acd14,_0x3802f6,_0x4595de){var _0x263f79={'raw':![],'where':{}};var _0x428912={};var _0x2c616f={'count':0x0,'rows':[]};return db[_0x6f3f('0x3f')][_0x6f3f('0x65')]({'where':{'id':_0x1acd14[_0x6f3f('0x60')]['id']}})['then'](handleEntityNotFound(_0x3802f6,null))[_0x6f3f('0x20')](function(_0x4bb6de){if(_0x4bb6de){_0x428912[_0x6f3f('0x43')]=_[_0x6f3f('0x46')](db[_0x6f3f('0x8e')]['rawAttributes']);_0x428912[_0x6f3f('0x45')]=_[_0x6f3f('0x46')](_0x1acd14[_0x6f3f('0x45')]);_0x428912['filters']=_['intersection'](_0x428912['model'],_0x428912[_0x6f3f('0x45')]);_0x263f79['attributes']=_['intersection'](_0x428912[_0x6f3f('0x43')],qs[_0x6f3f('0x49')](_0x1acd14[_0x6f3f('0x45')]['fields']));_0x263f79['attributes']=_0x263f79['attributes']['length']?_0x263f79[_0x6f3f('0x48')]:_0x428912[_0x6f3f('0x43')];if(!_0x1acd14[_0x6f3f('0x45')][_0x6f3f('0x4a')]('nolimit')){_0x263f79[_0x6f3f('0x2d')]=qs[_0x6f3f('0x2d')](_0x1acd14['query']['limit']);_0x263f79[_0x6f3f('0x2c')]=qs[_0x6f3f('0x2c')](_0x1acd14[_0x6f3f('0x45')][_0x6f3f('0x2c')]);}_0x263f79[_0x6f3f('0x67')]=qs[_0x6f3f('0x68')](_0x1acd14['query']['sort']);_0x263f79['where']=qs['filters'](_['pick'](_0x1acd14[_0x6f3f('0x45')],_0x428912[_0x6f3f('0x4d')]));_0x263f79[_0x6f3f('0x4c')][_0x6f3f('0x6c')]=_0x4bb6de['id'];if(_0x1acd14[_0x6f3f('0x45')][_0x6f3f('0x4e')]){_0x263f79[_0x6f3f('0x4c')]=_[_0x6f3f('0x4f')](_0x263f79[_0x6f3f('0x4c')],{'$or':_['map'](_0x263f79[_0x6f3f('0x48')],function(_0x177cb2){var _0x4165ba={};_0x4165ba[_0x177cb2]={'$like':'%'+_0x1acd14[_0x6f3f('0x45')][_0x6f3f('0x4e')]+'%'};return _0x4165ba;})});}_0x263f79=_[_0x6f3f('0x4f')]({},_0x263f79,_0x1acd14[_0x6f3f('0x56')]);return db[_0x6f3f('0x8e')][_0x6f3f('0x51')]({'where':_0x263f79[_0x6f3f('0x4c')]})[_0x6f3f('0x20')](function(_0x59ceaf){_0x2c616f[_0x6f3f('0x51')]=_0x59ceaf;if(_0x1acd14[_0x6f3f('0x45')][_0x6f3f('0x52')]){_0x263f79[_0x6f3f('0x53')]=[{'model':db[_0x6f3f('0x70')],'as':_0x6f3f('0xa9'),'required':![]},{'model':db[_0x6f3f('0xaa')],'as':'Owner','attributes':[_0x6f3f('0x3a'),'fullname',_0x6f3f('0xab')],'required':![]},{'model':db[_0x6f3f('0xac')],'as':_0x6f3f('0xad'),'attributes':['id','name',_0x6f3f('0xae')],'where':_0x1acd14[_0x6f3f('0x45')][_0x6f3f('0xaf')]?{'id':_0x1acd14['query'][_0x6f3f('0xaf')]}:undefined,'required':_0x1acd14['query'][_0x6f3f('0xaf')]?!![]:![]}];}return db[_0x6f3f('0x8e')][_0x6f3f('0x54')](_0x263f79);})[_0x6f3f('0x20')](function(_0x1100af){_0x2c616f[_0x6f3f('0x55')]=_0x1100af;return _0x2c616f;});}})[_0x6f3f('0x20')](respondWithFilteredResult(_0x3802f6,_0x263f79))[_0x6f3f('0x2a')](handleError(_0x3802f6,null));};exports[_0x6f3f('0xb0')]=function(_0x33418a,_0x779947,_0x1a5486){return db[_0x6f3f('0x3f')][_0x6f3f('0x57')]({'where':{'id':_0x33418a[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x779947,null))[_0x6f3f('0x20')](function(_0x508bc9){if(_0x508bc9){return _0x508bc9[_0x6f3f('0xb0')](_0x33418a[_0x6f3f('0x59')][_0x6f3f('0xb1')],_['omit'](_0x33418a[_0x6f3f('0x59')],['ids','id'])||{})[_0x6f3f('0x91')](function(_0x212578){for(var _0x51c6f3=0x0;_0x51c6f3<_0x33418a[_0x6f3f('0x59')][_0x6f3f('0xb1')][_0x6f3f('0x66')];_0x51c6f3+=0x1){socket[_0x6f3f('0xb2')](_0x6f3f('0xb3'),{'UserId':_0x33418a[_0x6f3f('0x59')][_0x6f3f('0xb1')][_0x51c6f3],'OpenchannelAccountId':_0x33418a[_0x6f3f('0x60')]['id']});}return _0x212578;});}})[_0x6f3f('0x20')](respondWithResult(_0x779947,null))[_0x6f3f('0x2a')](handleError(_0x779947,null));};exports[_0x6f3f('0xb4')]=function(_0x33363c,_0x29d4c6,_0x4dc186){return db['OpenchannelAccount'][_0x6f3f('0x57')]({'where':{'id':_0x33363c[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x29d4c6,null))[_0x6f3f('0x20')](function(_0x5bd10f){if(_0x5bd10f){return _0x5bd10f[_0x6f3f('0xb4')](_0x33363c['query'][_0x6f3f('0xb1')])[_0x6f3f('0x20')](function(){if(_[_0x6f3f('0xb5')](_0x33363c[_0x6f3f('0x45')][_0x6f3f('0xb1')])){for(var _0x5af036=0x0;_0x5af036<_0x33363c['query'][_0x6f3f('0xb1')][_0x6f3f('0x66')];_0x5af036+=0x1){socket['emit'](_0x6f3f('0xb6'),{'UserId':Number(_0x33363c[_0x6f3f('0x45')][_0x6f3f('0xb1')][_0x5af036]),'OpenchannelAccountId':Number(_0x33363c[_0x6f3f('0x60')]['id'])});}}else{socket['emit'](_0x6f3f('0xb6'),{'UserId':Number(_0x33363c[_0x6f3f('0x45')]['ids']),'OpenchannelAccountId':Number(_0x33363c[_0x6f3f('0x60')]['id'])});}});}})[_0x6f3f('0x20')](respondWithStatusCode(_0x29d4c6,null))[_0x6f3f('0x2a')](handleError(_0x29d4c6,null));};exports[_0x6f3f('0xb7')]=function(_0x33c954,_0x316326,_0x54a40e){var _0x413283={};var _0x2351ed={};var _0x20653e;var _0x44c0a1;return db[_0x6f3f('0x3f')]['findOne']({'where':{'id':_0x33c954[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x316326,null))[_0x6f3f('0x20')](function(_0x328c9e){if(_0x328c9e){_0x20653e=_0x328c9e;_0x2351ed[_0x6f3f('0x43')]=_[_0x6f3f('0x46')](db['User'][_0x6f3f('0x40')]);_0x2351ed[_0x6f3f('0x45')]=_[_0x6f3f('0x46')](_0x33c954[_0x6f3f('0x45')]);_0x2351ed[_0x6f3f('0x4d')]=_[_0x6f3f('0x47')](_0x2351ed[_0x6f3f('0x43')],_0x2351ed[_0x6f3f('0x45')]);_0x413283['attributes']=_['intersection'](_0x2351ed[_0x6f3f('0x43')],qs[_0x6f3f('0x49')](_0x33c954[_0x6f3f('0x45')][_0x6f3f('0x49')]));_0x413283['attributes']=_0x413283[_0x6f3f('0x48')]['length']?_0x413283[_0x6f3f('0x48')]:_0x2351ed[_0x6f3f('0x43')];_0x413283['order']=qs['sort'](_0x33c954['query']['sort']);_0x413283[_0x6f3f('0x4c')]=qs['filters'](_[_0x6f3f('0x69')](_0x33c954[_0x6f3f('0x45')],_0x2351ed[_0x6f3f('0x4d')]));if(_0x33c954[_0x6f3f('0x45')][_0x6f3f('0x4e')]){_0x413283[_0x6f3f('0x4c')]=_[_0x6f3f('0x4f')](_0x413283[_0x6f3f('0x4c')],{'$or':_[_0x6f3f('0x44')](_0x413283[_0x6f3f('0x48')],function(_0x83dc39){var _0x3ddf1d={};_0x3ddf1d[_0x83dc39]={'$like':'%'+_0x33c954[_0x6f3f('0x45')][_0x6f3f('0x4e')]+'%'};return _0x3ddf1d;})});}_0x413283=_['merge']({},_0x413283,_0x33c954['options']);return _0x20653e[_0x6f3f('0xb7')](_0x413283);}})[_0x6f3f('0x20')](function(_0x2e669f){if(_0x2e669f){_0x44c0a1=_0x2e669f[_0x6f3f('0x66')];if(!_0x33c954[_0x6f3f('0x45')][_0x6f3f('0x4a')]('nolimit')){_0x413283[_0x6f3f('0x2d')]=qs[_0x6f3f('0x2d')](_0x33c954[_0x6f3f('0x45')][_0x6f3f('0x2d')]);_0x413283[_0x6f3f('0x2c')]=qs[_0x6f3f('0x2c')](_0x33c954[_0x6f3f('0x45')][_0x6f3f('0x2c')]);}return _0x20653e['getAgents'](_0x413283);}})[_0x6f3f('0x20')](function(_0x517747){if(_0x517747){return _0x517747?{'count':_0x44c0a1,'rows':_0x517747}:null;}})['then'](respondWithResult(_0x316326,null))[_0x6f3f('0x2a')](handleError(_0x316326,null));};exports[_0x6f3f('0x3b')]=function(_0x502ede,_0x56b555,_0x55d6c8){var _0x2e2cca,_0xf5d310,_0x899f9f;if(_['isNil'](_0x502ede[_0x6f3f('0x59')][_0x6f3f('0x59')])||_0x502ede[_0x6f3f('0x59')][_0x6f3f('0x59')]===''){throw new db[(_0x6f3f('0x71'))][(_0x6f3f('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x502ede[_0x6f3f('0x59')]['to'])){}_0x2e2cca=_0x502ede['body']['to'];return db[_0x6f3f('0x3f')]['findOne']({'where':{'id':_0x502ede[_0x6f3f('0x60')]['id']}})[_0x6f3f('0x20')](handleEntityNotFound(_0x56b555,null))[_0x6f3f('0x20')](function(_0x2a1d9d){if(_0x2a1d9d){return db[_0x6f3f('0x3f')][_0x6f3f('0x57')]({'where':{'id':_0x2a1d9d['id']},'include':[{'model':db[_0x6f3f('0x80')],'as':_0x6f3f('0x81'),'include':[{'model':db[_0x6f3f('0x70')],'as':_0x6f3f('0x82'),'where':{[_0x2a1d9d['mapKey']]:_0x2e2cca},'limit':0x1,'order':[['updatedAt',_0x6f3f('0x83')]]}]}]})[_0x6f3f('0x20')](handleEntityNotFound(_0x56b555,null))['then'](function(_0x219420){if(_0x219420&&_0x219420[_0x6f3f('0x81')]){_0xf5d310=_0x219420[_0x6f3f('0x5b')]({'plain':!![]});if(_0xf5d310[_0x6f3f('0x81')]&&_0xf5d310['List'][_0x6f3f('0x82')][_0x6f3f('0x66')]){return _0xf5d310[_0x6f3f('0x81')][_0x6f3f('0x82')][0x0];}return db[_0x6f3f('0x70')][_0x6f3f('0x58')](_[_0x6f3f('0x8a')](_0x502ede[_0x6f3f('0x59')],{'firstName':_0x2e2cca,[_0x219420[_0x6f3f('0x7c')]]:_0x2e2cca,'phone':_0x2e2cca,'ListId':_0xf5d310[_0x6f3f('0x78')]}));}})[_0x6f3f('0x20')](handleEntityNotFound(_0x56b555,null))[_0x6f3f('0x20')](function(_0x4e1211){if(_0x4e1211){_0x899f9f=_0x4e1211;return db[_0x6f3f('0x8e')][_0x6f3f('0x57')]({'where':{'ContactId':_0x899f9f['id'],'closed':![],'OpenchannelAccountId':_0xf5d310['id']}})[_0x6f3f('0x20')](function(_0x41a9){if(_0x41a9){return[_0x41a9,![]];}return db[_0x6f3f('0x8e')]['create']({'UserId':_0x502ede[_0x6f3f('0x5a')]['id'],'ContactId':_0x899f9f['id'],'OpenchannelAccountId':_0xf5d310['id'],'lastMsgDirection':_0x6f3f('0xb8'),'Messages':[_['merge'](_0x502ede[_0x6f3f('0x59')],{'read':![],'body':_0x502ede[_0x6f3f('0x59')][_0x6f3f('0x59')],'OpenchannelAccountId':_0xf5d310['id'],'UserId':_0x502ede[_0x6f3f('0x5a')]['id'],'ContactId':_0x899f9f['id']})]},{'include':[{'model':db[_0x6f3f('0x99')],'as':_0x6f3f('0xb9')}]})[_0x6f3f('0x20')](function(_0x66363f){return[_0x66363f,!![]];});});}})['spread'](function(_0x13bba5,_0x4f4e47){if(_0x4f4e47){return _0x13bba5;}return db[_0x6f3f('0x99')][_0x6f3f('0x58')](_[_0x6f3f('0x4f')](_0x502ede['body'],{'read':![],'body':_0x502ede['body'][_0x6f3f('0x59')],'OpenchannelAccountId':_0xf5d310['id'],'OpenchannelInteractionId':_0x13bba5['id'],'UserId':_0x502ede[_0x6f3f('0x5a')]['id'],'ContactId':_0x899f9f['id']}))[_0x6f3f('0x20')](function(_0x4742cb){_0x13bba5[_0x6f3f('0xba')][_0x6f3f('0xb9')]=[];_0x13bba5[_0x6f3f('0xba')][_0x6f3f('0xb9')][_0x6f3f('0x96')](_0x4742cb[_0x6f3f('0xba')]);return _0x13bba5;});});}})[_0x6f3f('0x20')](respondWithResult(_0x56b555,null))['catch'](handleError(_0x56b555,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 6e79f71..4d81c7d 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 _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 +var _0xf0ec=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','hasOwnProperty','exports'];(function(_0x46ae5a,_0x2a38d0){var _0x434986=function(_0x22735d){while(--_0x22735d){_0x46ae5a['push'](_0x46ae5a['shift']());}};_0x434986(++_0x2a38d0);}(_0xf0ec,0x150));var _0xcf0e=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xf0ec[_0x3299d1];return _0x44356e;};'use strict';var EventEmitter=require(_0xcf0e('0x0'));var OpenchannelAccount=require(_0xcf0e('0x1'))['db'][_0xcf0e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xcf0e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf0e('0x4'),'afterDestroy':_0xcf0e('0x5')};function emitEvent(_0x37cba7){return function(_0x3b943d,_0x134958,_0x4699d1){OpenchannelAccountEvents['emit'](_0x37cba7+':'+_0x3b943d['id'],_0x3b943d);OpenchannelAccountEvents['emit'](_0x37cba7,_0x3b943d);_0x4699d1(null);};}for(var e in events){if(events[_0xcf0e('0x6')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xcf0e('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index a708419..4a5fb4f 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 _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 +var _0x0030=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','api','moment'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x0030,0x175));var _0x0003=function(_0x37198e,_0x4f0c69){_0x37198e=_0x37198e-0x0;var _0x42ccf1=_0x0030[_0x37198e];return _0x42ccf1;};'use strict';var _=require(_0x0003('0x0'));var util=require(_0x0003('0x1'));var logger=require('../../config/logger')(_0x0003('0x2'));var moment=require(_0x0003('0x3'));var BPromise=require(_0x0003('0x4'));var rp=require(_0x0003('0x5'));var fs=require('fs');var path=require(_0x0003('0x6'));var rimraf=require(_0x0003('0x7'));var config=require(_0x0003('0x8'));var attributes=require(_0x0003('0x9'));module[_0x0003('0xa')]=function(_0x3b404a,_0x5c9eac){return _0x3b404a[_0x0003('0xb')](_0x0003('0xc'),attributes,{'tableName':'openchannel_accounts','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 7181ecd..7d14c8f 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 _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 +var _0x9e61=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x474591,_0x637664){var _0x531688=function(_0x3d26ee){while(--_0x3d26ee){_0x474591['push'](_0x474591['shift']());}};_0x531688(++_0x637664);}(_0x9e61,0x149));var _0x19e6=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x9e61[_0x3070dc];return _0x431489;};'use strict';var _=require(_0x19e6('0x0'));var util=require(_0x19e6('0x1'));var moment=require(_0x19e6('0x2'));var BPromise=require(_0x19e6('0x3'));var rs=require(_0x19e6('0x4'));var fs=require('fs');var Redis=require(_0x19e6('0x5'));var db=require(_0x19e6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x19e6('0x7'))(_0x19e6('0x8'));var config=require(_0x19e6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x19e6('0xa')][_0x19e6('0xb')]({'port':0x232a});config[_0x19e6('0xc')]=_[_0x19e6('0xd')](config[_0x19e6('0xc')],{'host':_0x19e6('0xe'),'port':0x18eb});var socket=require(_0x19e6('0xf'))(new Redis(config[_0x19e6('0xc')]));require(_0x19e6('0x10'))[_0x19e6('0x11')](socket);function respondWithRpcPromise(_0x2dcdc4,_0x1f6bf6,_0x3b896b){return new BPromise(function(_0x4ceedb,_0x594ab3){return client['request'](_0x2dcdc4,_0x3b896b)[_0x19e6('0x12')](function(_0x3ae8b2){logger[_0x19e6('0x13')](_0x19e6('0x14'),_0x1f6bf6,_0x19e6('0x15'));logger[_0x19e6('0x16')](_0x19e6('0x17'),_0x1f6bf6,'request\x20sent',JSON[_0x19e6('0x18')](_0x3ae8b2));if(_0x3ae8b2['error']){if(_0x3ae8b2[_0x19e6('0x19')][_0x19e6('0x1a')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x1f6bf6,_0x3ae8b2[_0x19e6('0x19')][_0x19e6('0x1b')]);return _0x594ab3(_0x3ae8b2['error'][_0x19e6('0x1b')]);}logger[_0x19e6('0x19')](_0x19e6('0x14'),_0x1f6bf6,_0x3ae8b2[_0x19e6('0x19')][_0x19e6('0x1b')]);return _0x4ceedb(_0x3ae8b2[_0x19e6('0x19')][_0x19e6('0x1b')]);}else{logger[_0x19e6('0x13')](_0x19e6('0x14'),_0x1f6bf6,_0x19e6('0x15'));_0x4ceedb(_0x3ae8b2[_0x19e6('0x1c')][_0x19e6('0x1b')]);}})[_0x19e6('0x1d')](function(_0x3abc39){logger[_0x19e6('0x19')](_0x19e6('0x14'),_0x1f6bf6,_0x3abc39);_0x594ab3(_0x3abc39);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index fae1523..7ed3b7e 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 _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 +var _0x149b=['openchannelAccount:','./openchannelAccount.events','save','remove','update','register','length'];(function(_0x1fbf37,_0x98c6db){var _0x578424=function(_0x2c2976){while(--_0x2c2976){_0x1fbf37['push'](_0x1fbf37['shift']());}};_0x578424(++_0x98c6db);}(_0x149b,0xbe));var _0xb149=function(_0x5b03c7,_0x307c5d){_0x5b03c7=_0x5b03c7-0x0;var _0x156953=_0x149b[_0x5b03c7];return _0x156953;};'use strict';var OpenchannelAccountEvents=require(_0xb149('0x0'));var events=[_0xb149('0x1'),_0xb149('0x2'),_0xb149('0x3')];function createListener(_0x3fd1a7,_0x8f9a04){return function(_0x5b0462){_0x8f9a04['emit'](_0x3fd1a7,_0x5b0462);};}function removeListener(_0x234731,_0x41513f){return function(){OpenchannelAccountEvents['removeListener'](_0x234731,_0x41513f);};}exports[_0xb149('0x4')]=function(_0x430913){for(var _0x54d249=0x0,_0x3e959a=events[_0xb149('0x5')];_0x54d249<_0x3e959a;_0x54d249++){var _0x1d14aa=events[_0x54d249];var _0x47d55a=createListener(_0xb149('0x6')+_0x1d14aa,_0x430913);OpenchannelAccountEvents['on'](_0x1d14aa,_0x47d55a);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index da800a2..6e1880b 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 _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 +var _0xc786=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x1817b6,_0x908ad3){var _0x1edb7b=function(_0xe909c1){while(--_0xe909c1){_0x1817b6['push'](_0x1817b6['shift']());}};_0x1edb7b(++_0x908ad3);}(_0xc786,0x126));var _0x6c78=function(_0x55c7b6,_0x59ccf7){_0x55c7b6=_0x55c7b6-0x0;var _0x23c5f2=_0xc786[_0x55c7b6];return _0x23c5f2;};'use strict';var multer=require(_0x6c78('0x0'));var util=require(_0x6c78('0x1'));var path=require(_0x6c78('0x2'));var timeout=require(_0x6c78('0x3'));var express=require(_0x6c78('0x4'));var router=express['Router']();var auth=require(_0x6c78('0x5'));var interaction=require(_0x6c78('0x6'));var config=require(_0x6c78('0x7'));var controller=require(_0x6c78('0x8'));router[_0x6c78('0x9')]('/',auth[_0x6c78('0xa')](),controller['index']);router['get'](_0x6c78('0xb'),auth[_0x6c78('0xa')](),controller[_0x6c78('0xc')]);router[_0x6c78('0xd')]('/',auth[_0x6c78('0xa')](),controller[_0x6c78('0xe')]);router[_0x6c78('0xf')](_0x6c78('0xb'),auth[_0x6c78('0xa')](),controller[_0x6c78('0x10')]);router[_0x6c78('0x11')](_0x6c78('0xb'),auth[_0x6c78('0xa')](),controller[_0x6c78('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a82b314..41a60ea 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 _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 +var _0xdcb6=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x54b82e,_0x26c5c3){var _0x5cb859=function(_0x1358e7){while(--_0x1358e7){_0x54b82e['push'](_0x54b82e['shift']());}};_0x5cb859(++_0x26c5c3);}(_0xdcb6,0x196));var _0x6dcb=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xdcb6[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require('sequelize');module[_0x6dcb('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x6dcb('0x1')],'allowNull':![],'defaultValue':_0x6dcb('0x2')},'appdata':{'type':Sequelize[_0x6dcb('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6dcb('0x1')],'defaultValue':_0x6dcb('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c748d15..cec015b 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 _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 +var _0x526f=['count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','options','where','findAll','rows','catch','show','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json'];(function(_0x504f7b,_0x1ac4e0){var _0x2b0904=function(_0x28e51d){while(--_0x28e51d){_0x504f7b['push'](_0x504f7b['shift']());}};_0x2b0904(++_0x1ac4e0);}(_0x526f,0xc2));var _0xf526=function(_0x281046,_0x473c19){_0x281046=_0x281046-0x0;var _0x4db8cd=_0x526f[_0x281046];return _0x4db8cd;};'use strict';var pdf=require(_0xf526('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf526('0x1'));var zipdir=require(_0xf526('0x2'));var jsonpatch=require(_0xf526('0x3'));var rp=require(_0xf526('0x4'));var moment=require(_0xf526('0x5'));var BPromise=require(_0xf526('0x6'));var Mustache=require(_0xf526('0x7'));var util=require(_0xf526('0x8'));var path=require(_0xf526('0x9'));var sox=require(_0xf526('0xa'));var csv=require(_0xf526('0xb'));var ejs=require(_0xf526('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf526('0xd'));var crypto=require(_0xf526('0xe'));var jsforce=require(_0xf526('0xf'));var deskjs=require(_0xf526('0x10'));var toCsv=require(_0xf526('0xb'));var querystring=require(_0xf526('0x11'));var Papa=require(_0xf526('0x12'));var Redis=require('ioredis');var authService=require(_0xf526('0x13'));var qs=require(_0xf526('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf526('0x15'));var logger=require(_0xf526('0x16'))(_0xf526('0x17'));var utils=require(_0xf526('0x18'));var config=require(_0xf526('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xf526('0x1a'))['db'];function respondWithStatusCode(_0x1dbfd0,_0x33f952){_0x33f952=_0x33f952||0xcc;return function(_0x52cfb3){if(_0x52cfb3){return _0x1dbfd0[_0xf526('0x1b')](_0x33f952);}return _0x1dbfd0[_0xf526('0x1c')](_0x33f952)[_0xf526('0x1d')]();};}function respondWithResult(_0x1a46f7,_0x532240){_0x532240=_0x532240||0xc8;return function(_0x167c28){if(_0x167c28){return _0x1a46f7[_0xf526('0x1c')](_0x532240)[_0xf526('0x1e')](_0x167c28);}};}function respondWithFilteredResult(_0x428db1,_0x1f54db){return function(_0x43ea92){if(_0x43ea92){var _0x325bae=_0x43ea92[_0xf526('0x1f')],_0x5697f2=_0x1f54db[_0xf526('0x20')],_0xa13b7b=_0x1f54db[_0xf526('0x20')]+_0x1f54db[_0xf526('0x21')],_0x2aa5b5;if(_0xa13b7b>=_0x325bae){_0xa13b7b=_0x325bae;_0x2aa5b5=0xc8;}else{_0x2aa5b5=0xce;}_0x428db1[_0xf526('0x1c')](_0x2aa5b5);return _0x428db1[_0xf526('0x22')](_0xf526('0x23'),_0x5697f2+'-'+_0xa13b7b+'/'+_0x325bae)[_0xf526('0x1e')](_0x43ea92);}return null;};}function patchUpdates(_0x4bee1a){return function(_0x34536f){try{jsonpatch['apply'](_0x34536f,_0x4bee1a,!![]);}catch(_0x2ed57a){return BPromise['reject'](_0x2ed57a);}return _0x34536f[_0xf526('0x24')]();};}function saveUpdates(_0x3b392c,_0x429d11){return function(_0x5b95ba){if(_0x5b95ba){return _0x5b95ba[_0xf526('0x25')](_0x3b392c)[_0xf526('0x26')](function(_0x533473){return _0x533473;});}return null;};}function removeEntity(_0x2ca331,_0x4e1687){return function(_0x3d9e1d){if(_0x3d9e1d){return _0x3d9e1d[_0xf526('0x27')]()[_0xf526('0x26')](function(){_0x2ca331['status'](0xcc)[_0xf526('0x1d')]();});}};}function handleEntityNotFound(_0x301b79,_0x1314a3){return function(_0x9fe67b){if(!_0x9fe67b){_0x301b79['sendStatus'](0x194);}return _0x9fe67b;};}function handleError(_0x695eec,_0x37bacf){_0x37bacf=_0x37bacf||0x1f4;return function(_0xc86b39){logger[_0xf526('0x28')](_0xc86b39[_0xf526('0x29')]);if(_0xc86b39[_0xf526('0x2a')]){delete _0xc86b39[_0xf526('0x2a')];}_0x695eec[_0xf526('0x1c')](_0x37bacf)[_0xf526('0x2b')](_0xc86b39);};}exports[_0xf526('0x2c')]=function(_0x3cc4f4,_0x249c48){var _0x3f5c31={},_0x90e498={},_0x2a9acf={'count':0x0,'rows':[]};var _0x2b8157=_[_0xf526('0x2d')](db[_0xf526('0x2e')][_0xf526('0x2f')],function(_0x343769){return{'name':_0x343769[_0xf526('0x30')],'type':_0x343769['type'][_0xf526('0x31')]};});_0x90e498[_0xf526('0x32')]=_['map'](_0x2b8157,'name');_0x90e498[_0xf526('0x33')]=_[_0xf526('0x34')](_0x3cc4f4[_0xf526('0x33')]);_0x90e498['filters']=_[_0xf526('0x35')](_0x90e498[_0xf526('0x32')],_0x90e498[_0xf526('0x33')]);_0x3f5c31[_0xf526('0x36')]=_[_0xf526('0x35')](_0x90e498[_0xf526('0x32')],qs[_0xf526('0x37')](_0x3cc4f4[_0xf526('0x33')][_0xf526('0x37')]));_0x3f5c31[_0xf526('0x36')]=_0x3f5c31[_0xf526('0x36')][_0xf526('0x38')]?_0x3f5c31[_0xf526('0x36')]:_0x90e498['model'];if(!_0x3cc4f4[_0xf526('0x33')][_0xf526('0x39')](_0xf526('0x3a'))){_0x3f5c31[_0xf526('0x21')]=qs['limit'](_0x3cc4f4[_0xf526('0x33')][_0xf526('0x21')]);_0x3f5c31[_0xf526('0x20')]=qs[_0xf526('0x20')](_0x3cc4f4['query']['offset']);}_0x3f5c31[_0xf526('0x3b')]=qs[_0xf526('0x3c')](_0x3cc4f4[_0xf526('0x33')][_0xf526('0x3c')]);_0x3f5c31['where']=qs[_0xf526('0x3d')](_[_0xf526('0x3e')](_0x3cc4f4[_0xf526('0x33')],_0x90e498[_0xf526('0x3d')]),_0x2b8157);if(_0x3cc4f4[_0xf526('0x33')][_0xf526('0x3f')]){_0x3f5c31['where']=_[_0xf526('0x40')](_0x3f5c31['where'],{'$or':_['map'](_0x2b8157,function(_0x311902){if(_0x311902['type']!=='VIRTUAL'){var _0x32a02a={};_0x32a02a[_0x311902[_0xf526('0x2a')]]={'$like':'%'+_0x3cc4f4[_0xf526('0x33')][_0xf526('0x3f')]+'%'};return _0x32a02a;}})});}_0x3f5c31=_['merge']({},_0x3f5c31,_0x3cc4f4[_0xf526('0x41')]);var _0x32b74b={'where':_0x3f5c31[_0xf526('0x42')]};return db[_0xf526('0x2e')][_0xf526('0x1f')](_0x32b74b)[_0xf526('0x26')](function(_0x5f53c1){_0x2a9acf[_0xf526('0x1f')]=_0x5f53c1;if(_0x3cc4f4['query']['includeAll']){_0x3f5c31['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf526('0x43')](_0x3f5c31);})[_0xf526('0x26')](function(_0x4289da){_0x2a9acf[_0xf526('0x44')]=_0x4289da;return _0x2a9acf;})['then'](respondWithFilteredResult(_0x249c48,_0x3f5c31))[_0xf526('0x45')](handleError(_0x249c48,null));};exports[_0xf526('0x46')]=function(_0x3b807e,_0x1d0e45){var _0x861e22={'raw':!![],'where':{'id':_0x3b807e['params']['id']}},_0x3f23e1={};_0x3f23e1[_0xf526('0x32')]=_[_0xf526('0x34')](db[_0xf526('0x2e')]['rawAttributes']);_0x3f23e1['query']=_['keys'](_0x3b807e[_0xf526('0x33')]);_0x3f23e1[_0xf526('0x3d')]=_[_0xf526('0x35')](_0x3f23e1[_0xf526('0x32')],_0x3f23e1[_0xf526('0x33')]);_0x861e22[_0xf526('0x36')]=_[_0xf526('0x35')](_0x3f23e1[_0xf526('0x32')],qs[_0xf526('0x37')](_0x3b807e[_0xf526('0x33')][_0xf526('0x37')]));_0x861e22[_0xf526('0x36')]=_0x861e22[_0xf526('0x36')][_0xf526('0x38')]?_0x861e22['attributes']:_0x3f23e1[_0xf526('0x32')];if(_0x3b807e[_0xf526('0x33')]['includeAll']){_0x861e22['include']=[{'all':!![]}];}_0x861e22=_['merge']({},_0x861e22,_0x3b807e['options']);return db[_0xf526('0x2e')][_0xf526('0x47')](_0x861e22)[_0xf526('0x26')](handleEntityNotFound(_0x1d0e45,null))[_0xf526('0x26')](respondWithResult(_0x1d0e45,null))[_0xf526('0x45')](handleError(_0x1d0e45,null));};exports[_0xf526('0x48')]=function(_0xf432d6,_0x1b5a8a){return db[_0xf526('0x2e')]['create'](_0xf432d6[_0xf526('0x49')],{})['then'](respondWithResult(_0x1b5a8a,0xc9))[_0xf526('0x45')](handleError(_0x1b5a8a,null));};exports[_0xf526('0x25')]=function(_0x540937,_0x208706){if(_0x540937[_0xf526('0x49')]['id']){delete _0x540937[_0xf526('0x49')]['id'];}return db[_0xf526('0x2e')]['find']({'where':{'id':_0x540937[_0xf526('0x4a')]['id']}})[_0xf526('0x26')](handleEntityNotFound(_0x208706,null))[_0xf526('0x26')](saveUpdates(_0x540937[_0xf526('0x49')],null))[_0xf526('0x26')](respondWithResult(_0x208706,null))[_0xf526('0x45')](handleError(_0x208706,null));};exports['destroy']=function(_0x18a21c,_0x42e77f){return db[_0xf526('0x2e')][_0xf526('0x47')]({'where':{'id':_0x18a21c[_0xf526('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42e77f,null))[_0xf526('0x26')](removeEntity(_0x42e77f,null))[_0xf526('0x45')](handleError(_0x42e77f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 8f56d9c..1d7d67e 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 _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 +var _0x545a=['bluebird','rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x3452b1,_0x1fdc31){var _0x4a6a1f=function(_0x29306a){while(--_0x29306a){_0x3452b1['push'](_0x3452b1['shift']());}};_0x4a6a1f(++_0x1fdc31);}(_0x545a,0x125));var _0xa545=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x545a[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0xa545('0x0'));var util=require(_0xa545('0x1'));var logger=require(_0xa545('0x2'))(_0xa545('0x3'));var moment=require('moment');var BPromise=require(_0xa545('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa545('0x5'));var config=require(_0xa545('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0xa545('0x7')]=function(_0x2ef462,_0x1750c7){return _0x2ef462[_0xa545('0x8')]('OpenchannelApplication',attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa545('0x9'),'collate':_0xa545('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 283f4e1..360ffa7 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(_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 +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(_0x25cbb3,_0x1dde53){var _0x4a9027=function(_0xf4d312){while(--_0xf4d312){_0x25cbb3['push'](_0x25cbb3['shift']());}};_0x4a9027(++_0x1dde53);}(_0xb10b,0x12a));var _0xbb10=function(_0x3126b6,_0x450061){_0x3126b6=_0x3126b6-0x0;var _0x116531=_0xb10b[_0x3126b6];return _0x116531;};'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 f3b239a..6b27fb0 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 _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 +var _0x8970=['../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x595246,_0x47e53b){var _0x5e23c3=function(_0x5852a7){while(--_0x5852a7){_0x595246['push'](_0x595246['shift']());}};_0x5e23c3(++_0x47e53b);}(_0x8970,0xcc));var _0x0897=function(_0x2e919d,_0x297864){_0x2e919d=_0x2e919d-0x0;var _0x5443d4=_0x8970[_0x2e919d];return _0x5443d4;};'use strict';var multer=require(_0x0897('0x0'));var util=require('util');var path=require(_0x0897('0x1'));var timeout=require(_0x0897('0x2'));var express=require('express');var router=express[_0x0897('0x3')]();var auth=require(_0x0897('0x4'));var interaction=require(_0x0897('0x5'));var config=require(_0x0897('0x6'));var controller=require(_0x0897('0x7'));router[_0x0897('0x8')]('/',auth[_0x0897('0x9')](),controller['index']);router[_0x0897('0x8')]('/describe',auth[_0x0897('0x9')](),controller['describe']);router[_0x0897('0x8')](_0x0897('0xa'),auth[_0x0897('0x9')](),controller[_0x0897('0xb')]);router['get'](_0x0897('0xc'),auth[_0x0897('0x9')](),controller[_0x0897('0xd')]);router[_0x0897('0x8')](_0x0897('0xe'),auth[_0x0897('0x9')](),controller[_0x0897('0xf')]);router[_0x0897('0x10')]('/',auth[_0x0897('0x9')](),controller[_0x0897('0x11')]);router['post'](_0x0897('0xc'),auth[_0x0897('0x9')](),controller[_0x0897('0x12')]);router[_0x0897('0x10')](_0x0897('0x13'),auth[_0x0897('0x9')](),interaction['tracked'](_0x0897('0x14'),_0x0897('0x15')),controller[_0x0897('0x16')]);router[_0x0897('0x17')](_0x0897('0xa'),auth[_0x0897('0x9')](),interaction['tracked'](_0x0897('0x14'),_0x0897('0x18')),controller[_0x0897('0x19')]);router[_0x0897('0x1a')](_0x0897('0xa'),auth[_0x0897('0x9')](),interaction['tracked'](_0x0897('0x14'),_0x0897('0x1b')),controller[_0x0897('0x1c')]);router[_0x0897('0x1a')]('/:id/tags',auth[_0x0897('0x9')](),controller[_0x0897('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index bcf3158..a5ec67b 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 _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 +var _0xefa3=['STRING','out','sequelize','BOOLEAN','DATE'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xefa3,0x1e2));var _0x3efa=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xefa3[_0x4ce028];return _0x583d0c;};'use strict';var Sequelize=require(_0x3efa('0x0'));module['exports']={'closed':{'type':Sequelize[_0x3efa('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3efa('0x2')]},'disposition':{'type':Sequelize[_0x3efa('0x3')]},'secondDisposition':{'type':Sequelize[_0x3efa('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3efa('0x3')]},'note':{'type':Sequelize[_0x3efa('0x3')]},'read1stAt':{'type':Sequelize[_0x3efa('0x2')]},'threadId':{'type':Sequelize[_0x3efa('0x3')]},'externalUrl':{'type':Sequelize[_0x3efa('0x3')]},'lastMsgAt':{'type':Sequelize[_0x3efa('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3efa('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3efa('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 5307416..227e418 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 _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 +var _0x53e5=['then','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','select','field','color','from','tools_tags','u.id','user_has_openchannel_interactions','users','openchannel_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','UserId','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','tag','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','all','show','params','include','create','body','addMessage','OpenchannelMessage','ids','omit','findOne','pick','OpenchannelInteractionId','filter','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','Openchannel','YYYY-MM-DD','N.A.','closed','disposition','threadId','Private','basename','existsSync','createReadStream','pipe','direction','out','System','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','count','offset','apply','reject','save','update','destroy'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x53e5,0xca));var _0x553e=function(_0x305a57,_0x2d450e){_0x305a57=_0x305a57-0x0;var _0x346333=_0x53e5[_0x305a57];return _0x346333;};'use strict';var pdf=require(_0x553e('0x0'));var emlformat=require(_0x553e('0x1'));var rimraf=require(_0x553e('0x2'));var zipdir=require(_0x553e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x553e('0x4'));var moment=require(_0x553e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x553e('0x6'));var util=require(_0x553e('0x7'));var path=require('path');var sox=require(_0x553e('0x8'));var csv=require(_0x553e('0x9'));var ejs=require(_0x553e('0xa'));var fs=require('fs');var _=require(_0x553e('0xb'));var squel=require('squel');var crypto=require(_0x553e('0xc'));var jsforce=require(_0x553e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x553e('0x9'));var querystring=require(_0x553e('0xe'));var Papa=require(_0x553e('0xf'));var Redis=require('ioredis');var authService=require(_0x553e('0x10'));var qs=require(_0x553e('0x11'));var as=require(_0x553e('0x12'));var hardwareService=require(_0x553e('0x13'));var logger=require(_0x553e('0x14'))(_0x553e('0x15'));var utils=require(_0x553e('0x16'));var config=require(_0x553e('0x17'));var licenseUtil=require(_0x553e('0x18'));var db=require('../../mysqldb')['db'];config[_0x553e('0x19')]=_[_0x553e('0x1a')](config[_0x553e('0x19')],{'host':_0x553e('0x1b'),'port':0x18eb});var socket=require(_0x553e('0x1c'))(new Redis(config[_0x553e('0x19')]));require(_0x553e('0x1d'))[_0x553e('0x1e')](socket);function respondWithStatusCode(_0x407dd0,_0x4ddf77){_0x4ddf77=_0x4ddf77||0xcc;return function(_0x19b06a){if(_0x19b06a){return _0x407dd0[_0x553e('0x1f')](_0x4ddf77);}return _0x407dd0[_0x553e('0x20')](_0x4ddf77)[_0x553e('0x21')]();};}function respondWithResult(_0xe4164e,_0x301eac){_0x301eac=_0x301eac||0xc8;return function(_0x55f189){if(_0x55f189){return _0xe4164e[_0x553e('0x20')](_0x301eac)[_0x553e('0x22')](_0x55f189);}};}function respondWithFilteredResult(_0x4b3830,_0x4b8227){return function(_0x4e922e){if(_0x4e922e){var _0xfcac4b=_0x4e922e[_0x553e('0x23')],_0x43fc2d=_0x4b8227[_0x553e('0x24')],_0x50862e=_0x4b8227['offset']+_0x4b8227['limit'],_0x4acd78;if(_0x50862e>=_0xfcac4b){_0x50862e=_0xfcac4b;_0x4acd78=0xc8;}else{_0x4acd78=0xce;}_0x4b3830['status'](_0x4acd78);return _0x4b3830['set']('Content-Range',_0x43fc2d+'-'+_0x50862e+'/'+_0xfcac4b)[_0x553e('0x22')](_0x4e922e);}return null;};}function patchUpdates(_0x5332ce){return function(_0x36c279){try{jsonpatch[_0x553e('0x25')](_0x36c279,_0x5332ce,!![]);}catch(_0x4fab0f){return BPromise[_0x553e('0x26')](_0x4fab0f);}return _0x36c279[_0x553e('0x27')]();};}function saveUpdates(_0x4fe4fa,_0x2e1e00){return function(_0xbbd4d){if(_0xbbd4d){return _0xbbd4d[_0x553e('0x28')](_0x4fe4fa)['then'](function(_0x1ef5d1){return _0x1ef5d1;});}return null;};}function removeEntity(_0x30f1bf,_0x297349){return function(_0x38644f){if(_0x38644f){return _0x38644f[_0x553e('0x29')]()[_0x553e('0x2a')](function(){_0x30f1bf[_0x553e('0x20')](0xcc)[_0x553e('0x21')]();});}};}function handleEntityNotFound(_0x5662bf,_0x1d72e2){return function(_0x231ddf){if(!_0x231ddf){_0x5662bf[_0x553e('0x1f')](0x194);}return _0x231ddf;};}function handleError(_0x36171c,_0x216870){_0x216870=_0x216870||0x1f4;return function(_0x13e1f2){logger[_0x553e('0x2b')](_0x13e1f2[_0x553e('0x2c')]);if(_0x13e1f2[_0x553e('0x2d')]){delete _0x13e1f2[_0x553e('0x2d')];}_0x36171c[_0x553e('0x20')](_0x216870)[_0x553e('0x2e')](_0x13e1f2);};}function getInteractionUsers(_0x1ac272,_0x555236){return new BPromise(function(_0x28cefb,_0x292cab){try{if(_0x555236[_0x1ac272['id']]){_0x1ac272[_0x553e('0x2f')]=_[_0x553e('0x30')](_0x555236[_0x1ac272['id']],function(_0x289ca8){return{'id':_0x289ca8['id'],'fullname':_0x289ca8[_0x553e('0x31')]};});}}catch(_0x30b4f1){_0x292cab(_0x30b4f1);}_0x28cefb(_0x1ac272);});}function getInteractionTags(_0x2af300,_0x15d4dc){return new BPromise(function(_0xe430ed,_0x4652f6){try{if(_0x2af300[_0x553e('0x32')]){_0x2af300[_0x553e('0x33')]=[];_0x2af300['TagIds'][_0x553e('0x34')](',')[_0x553e('0x35')](function(_0x93b4e2){_0x2af300[_0x553e('0x33')][_0x553e('0x36')](_0x15d4dc[_0x93b4e2]);});}delete _0x2af300[_0x553e('0x32')];}catch(_0x177750){_0x4652f6(_0x177750);}_0xe430ed(_0x2af300);});}function updateOpenchannelInteraction(_0x1f7a0b,_0x437e21,_0x173a7c){return new BPromise(function(_0x1a0bd0,_0x27bbf3){return getInteractionUsers(_0x1f7a0b,_0x173a7c)[_0x553e('0x2a')](function(_0x5aefc4){return getInteractionTags(_0x5aefc4,_0x437e21);})['then'](function(_0x3def28){_0x1a0bd0(_0x3def28);})[_0x553e('0x37')](function(_0x2ff550){_0x27bbf3(_0x2ff550);});});}exports[_0x553e('0x38')]=function(_0x1dd1d9,_0x4f1ce9){var _0x44581e={},_0x380940={},_0x2d24a6={'count':0x0,'rows':[]};var _0x3d13a0=_[_0x553e('0x30')](db[_0x553e('0x39')][_0x553e('0x3a')],function(_0x4e4b07){return{'name':_0x4e4b07[_0x553e('0x3b')],'type':_0x4e4b07[_0x553e('0x3c')]['key']};});_0x380940[_0x553e('0x3d')]=_[_0x553e('0x30')](_0x3d13a0,_0x553e('0x2d'));_0x380940[_0x553e('0x3e')]=_[_0x553e('0x3f')](_0x1dd1d9[_0x553e('0x3e')]);_0x380940[_0x553e('0x40')]=_[_0x553e('0x41')](_0x380940[_0x553e('0x3d')],_0x380940[_0x553e('0x3e')]);_0x44581e['attributes']=_[_0x553e('0x41')](_0x380940[_0x553e('0x3d')],qs['fields'](_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x42')]));_0x44581e[_0x553e('0x43')]=_0x44581e[_0x553e('0x43')][_0x553e('0x44')]?_0x44581e[_0x553e('0x43')]:_0x380940[_0x553e('0x3d')];if(!_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x45')](_0x553e('0x46'))){_0x44581e['limit']=qs[_0x553e('0x47')](_0x1dd1d9['query'][_0x553e('0x47')]);_0x44581e[_0x553e('0x24')]=qs[_0x553e('0x24')](_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x24')]);}_0x44581e[_0x553e('0x48')]=qs[_0x553e('0x49')](_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x49')]);_0x44581e[_0x553e('0x4a')]=qs['filters'](_['pick'](_0x1dd1d9[_0x553e('0x3e')],_0x380940[_0x553e('0x40')]),_0x3d13a0);var _0x1d96ec=[];var _0x28e075=squel[_0x553e('0x4b')]()[_0x553e('0x4c')]('id')['field'](_0x553e('0x2d'))[_0x553e('0x4c')](_0x553e('0x4d'))[_0x553e('0x4e')](_0x553e('0x4f'));var _0x147c52=squel[_0x553e('0x4b')]()[_0x553e('0x4c')](_0x553e('0x50'))[_0x553e('0x4c')]('u.fullname')[_0x553e('0x4c')]('ui.OpenchannelInteractionId')[_0x553e('0x4e')](_0x553e('0x51'),'ui')['left_join'](_0x553e('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x37dfd5=squel[_0x553e('0x4b')]()[_0x553e('0x4e')](_0x553e('0x53'),'i')[_0x553e('0x54')](_0x553e('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x553e('0x54')]('users','o',_0x553e('0x56'))[_0x553e('0x54')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')[_0x553e('0x54')](_0x553e('0x57'),'me',_0x553e('0x58'))[_0x553e('0x54')](_0x553e('0x59'),'it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x553e('0x54')]('tools_tags','t',_0x553e('0x5a'));var _0x43bad4=squel['expr']();var _0x51b371=[];var _0x18e433=squel[_0x553e('0x5b')]();var _0x24700e;if(_0x1dd1d9[_0x553e('0x3e')]['search']){_0x24700e=as[_0x553e('0x5c')](_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x5d')]);var _0x135231=_0x24700e[_0x553e('0x5e')];for(var _0x27543f=0x0;_0x27543f<_0x24700e[_0x553e('0x5f')][_0x553e('0x44')];_0x27543f++){var _0x422171=_0x24700e[_0x553e('0x5f')][_0x27543f];var _0x258cb8='i';var _0x3d4c38=_[_0x553e('0x60')](_0x3d13a0,[_0x553e('0x2d'),_0x422171['field']]);if(!_0x3d4c38){switch(_0x422171['field']){case _0x553e('0x61'):if(_0x422171['value']==0x1){_0x37dfd5[_0x553e('0x62')]('`'+_0x422171[_0x553e('0x4c')]+_0x553e('0x63'));}else{_0x37dfd5['having']('`'+_0x422171[_0x553e('0x4c')]+'`\x20>\x200');}break;case _0x553e('0x64'):if(_0x422171[_0x553e('0x65')]===_0x553e('0x66')){if(_0x422171[_0x553e('0x67')][_0x553e('0x34')]('\x20')['length']>0x1){_0x43bad4[_0x135231](_0x553e('0x68'),qs[_0x553e('0x69')](_0x422171[_0x553e('0x67')]),null);}else{var _0x4f879a='%'+_0x422171[_0x553e('0x67')]+'%';_0x43bad4[_0x135231](_0x553e('0x6a'),_0x4f879a,_0x4f879a,_0x4f879a);}}else{_0x3d4c38=_[_0x553e('0x60')](_0x3d13a0,[_0x553e('0x2d'),_0x553e('0x6b')]);_0x422171[_0x553e('0x4c')]=_0x553e('0x6b');_0x1d5aa7=as[_0x553e('0x6c')](_0x258cb8,_0x3d4c38[_0x553e('0x3c')],_0x422171);_0x43bad4[_0x135231](_0x1d5aa7[_0x553e('0x6d')],_0x1d5aa7['value'][_0x553e('0x6e')],_0x1d5aa7[_0x553e('0x67')][_0x553e('0x21')]);}break;case _0x553e('0x6f'):var _0x2052ac=_0x422171[_0x553e('0x67')][_0x553e('0x34')](',')[_0x553e('0x30')](function(_0x3a7fb5){return Number(_0x3a7fb5);});_0x2052ac[_0x553e('0x35')](function(_0x4300f6){_0x18e433['or'](_0x553e('0x70'),'%,'+_0x4300f6+',%');});_0x51b371=_[_0x553e('0x71')](_0x51b371,_0x2052ac);break;case _0x553e('0x72'):if(_0x422171[_0x553e('0x65')]===_0x553e('0x66')){_0x43bad4[_0x135231]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x422171['value']+'%',null);}else{_0x3d4c38=_[_0x553e('0x60')](_0x3d13a0,[_0x553e('0x2d'),_0x553e('0x73')]);_0x422171[_0x553e('0x4c')]='UserId';_0x1d5aa7=as[_0x553e('0x6c')](_0x258cb8,_0x3d4c38['type'],_0x422171);_0x43bad4[_0x135231](_0x1d5aa7[_0x553e('0x6d')],_0x1d5aa7['value'][_0x553e('0x6e')],_0x1d5aa7['value'][_0x553e('0x21')]);}break;case'body':_0x1d5aa7=as[_0x553e('0x6c')]('me',null,_0x422171);_0x43bad4[_0x135231](_0x1d5aa7[_0x553e('0x6d')],_0x1d5aa7['value'][_0x553e('0x6e')],_0x1d5aa7['value']['end']);break;}}else{var _0x1d5aa7=as['buildExpression'](_0x258cb8,_0x3d4c38[_0x553e('0x3c')],_0x422171);_0x43bad4[_0x135231](_0x1d5aa7[_0x553e('0x6d')],_0x1d5aa7[_0x553e('0x67')][_0x553e('0x6e')],_0x1d5aa7[_0x553e('0x67')][_0x553e('0x21')]);}}}else{var _0x4819c8=_(_0x1dd1d9['query'])[_0x553e('0x3f')]()[_0x553e('0x30')](function(_0x1f7129){return _[_0x553e('0x74')](_0x3d13a0,[_0x553e('0x2d'),_0x1f7129])?_0x1f7129:undefined;})[_0x553e('0x75')]()[_0x553e('0x67')]();if(!_[_0x553e('0x76')](_0x4819c8)){_0x4819c8[_0x553e('0x35')](function(_0x2d9a2c){if(_0x2d9a2c===_0x553e('0x77')){_0x37dfd5[_0x553e('0x4a')](_0x553e('0x78'),[][_0x553e('0x79')](_0x1dd1d9['query'][_0x2d9a2c]));}else if(_0x2d9a2c===_0x553e('0x7a')){var _0x569e00=JSON[_0x553e('0x7b')](_0x1dd1d9[_0x553e('0x3e')][_0x2d9a2c])[_0x553e('0x7c')];var _0x50f2f4=JSON['parse'](_0x1dd1d9[_0x553e('0x3e')][_0x2d9a2c])[_0x553e('0x7d')];_0x37dfd5[_0x553e('0x4a')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x569e00,_0x50f2f4);}else{if(_0x1dd1d9[_0x553e('0x3e')][_0x2d9a2c]===_0x553e('0x7e')){_0x37dfd5[_0x553e('0x4a')]('i.'+_0x2d9a2c+_0x553e('0x7f'));}else{_0x37dfd5[_0x553e('0x4a')]('i.'+_0x2d9a2c+_0x553e('0x80'),_0x1dd1d9[_0x553e('0x3e')][_0x2d9a2c]);}}});}if(_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x81')]){if(_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x81')]==0x1){_0x37dfd5[_0x553e('0x62')]('`unreadMessages`\x20=\x200');}else{_0x37dfd5[_0x553e('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x1dd1d9['query'][_0x553e('0x82')]){_0x51b371=_['isArray'](_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x82')])?_0x1dd1d9['query'][_0x553e('0x82')]:new Array(_0x1dd1d9['query'][_0x553e('0x82')]);_0x51b371[_0x553e('0x35')](function(_0x5f1d93){_0x18e433['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5f1d93+',%');});}if(_0x1dd1d9[_0x553e('0x3e')]['filter']){var _0x5a4caa=_0x1dd1d9[_0x553e('0x3e')]['filter'][_0x553e('0x83')]('\x5c','\x5c\x5c')[_0x553e('0x83')](/'/g,'\x27\x27');if(qs[_0x553e('0x84')](_0x5a4caa)){_0x43bad4['or']('i.id\x20LIKE\x20?',_0x5a4caa+'%');}else{_0x43bad4['or'](_0x553e('0x85'),qs[_0x553e('0x69')](_0x5a4caa))['or'](_0x553e('0x86'),_0x5a4caa+'%')['or'](_0x553e('0x87'),_0x5a4caa+'%');}}}_0x37dfd5[_0x553e('0x4a')](_0x43bad4);_0x37dfd5[_0x553e('0x88')](_0x553e('0x89'));var _0x25922b={'type':db[_0x553e('0x8a')][_0x553e('0x8b')][_0x553e('0x8c')],'raw':!![]};var _0x228374=_0x37dfd5['clone']();_0x228374['field']('i.id');_0x228374['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x553e('0x61'));if(_0x44581e['order']){_0x44581e[_0x553e('0x48')]['forEach'](function(_0x5a8778){var _0x3a59f6=_0x5a8778[0x0]==='contactName'?_0x5a8778[0x0]:'i.'+_0x5a8778[0x0];_0x37dfd5['order'](_0x3a59f6,_0x5a8778[0x1]===_0x553e('0x8d')?![]:!![]);});}if(!_[_0x553e('0x76')](_0x51b371)){_0x37dfd5[_0x553e('0x62')](_0x18e433);_0x228374['where'](_0x553e('0x8e'),_0x51b371);}BPromise['resolve']()['then'](function(){if(!_0x24700e){if(_0x1dd1d9['query'][_0x553e('0x77')])return;_0x228374[_0x553e('0x4a')](_0x553e('0x8f'));_0x37dfd5[_0x553e('0x4a')](_0x553e('0x8f'));return;}if(_0x1dd1d9[_0x553e('0x90')][_0x553e('0x91')]!==_0x553e('0x92'))return;return _0x1dd1d9[_0x553e('0x90')][_0x553e('0x93')]({'attributes':['id'],'raw':!![]})[_0x553e('0x2a')](function(_0x547fb7){if(_['isEmpty'](_0x547fb7)){_0x228374[_0x553e('0x4a')](_0x553e('0x94'));_0x37dfd5[_0x553e('0x4a')](_0x553e('0x94'));}else{_0x228374[_0x553e('0x4a')](_0x553e('0x78'),_[_0x553e('0x30')](_0x547fb7,'id'));_0x37dfd5[_0x553e('0x4a')](_0x553e('0x78'),_['map'](_0x547fb7,'id'));}});})['then'](function(){if(_0x1dd1d9[_0x553e('0x90')][_0x553e('0x91')]===_0x553e('0x92')&&!_0x24700e&&!_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x77')])return[];return db['sequelize']['query'](_0x228374[_0x553e('0x95')](),_0x25922b);})[_0x553e('0x2a')](function(_0x5f431b){_0x2d24a6['count']=_0x5f431b['length'];if(_0x2d24a6[_0x553e('0x23')]===0x0)return[];return db[_0x553e('0x96')][_0x553e('0x3e')](_0x28e075[_0x553e('0x95')](),_0x25922b)[_0x553e('0x2a')](function(_0x4ec3f5){_0x1d96ec=_[_0x553e('0x97')](_0x4ec3f5,'id');_0x25922b=_[_0x553e('0x98')](_0x25922b,{'model':db[_0x553e('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1dd1d9[_0x553e('0x3e')][_0x553e('0x42')]){_0x44581e[_0x553e('0x43')][_0x553e('0x35')](function(_0x37c2c1){_0x37dfd5[_0x553e('0x4c')]('i.'+_0x37c2c1);});}else{_0x37dfd5[_0x553e('0x4c')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x553e('0x61'));_0x37dfd5[_0x553e('0x4c')]('a.key',_0x553e('0x99'));_0x37dfd5['field'](_0x553e('0x9a'),_0x553e('0x9b'));_0x37dfd5[_0x553e('0x4c')](_0x553e('0x9c'),_0x553e('0x9d'));_0x37dfd5[_0x553e('0x4c')](_0x553e('0x9e'));_0x37dfd5[_0x553e('0x4c')]('c.firstName',_0x553e('0x9f'));_0x37dfd5['field'](_0x553e('0xa0'),_0x553e('0xa1'));_0x37dfd5['field'](_0x553e('0xa2'),'Contact.email');_0x37dfd5['field'](_0x553e('0xa3'),_0x553e('0xa4'));_0x37dfd5['field'](_0x553e('0xa5'),_0x553e('0xa6'));_0x37dfd5[_0x553e('0x4c')](_0x553e('0xa7'),_0x553e('0xa8'));_0x37dfd5[_0x553e('0x4c')]('o.fullname',_0x553e('0xa9'));_0x37dfd5[_0x553e('0x4c')](_0x553e('0xaa'),_0x553e('0xab'));_0x37dfd5['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x553e('0x32'));}if(_0x44581e[_0x553e('0x47')])_0x37dfd5['limit'](_0x44581e[_0x553e('0x47')]);if(_0x44581e['offset'])_0x37dfd5['offset'](_0x44581e[_0x553e('0x24')]);return db['sequelize'][_0x553e('0x3e')](_0x37dfd5[_0x553e('0x95')](),_0x25922b);})[_0x553e('0x2a')](function(_0xc02dc2){_0x147c52['where'](_0x553e('0xac'),_[_0x553e('0x30')](_0xc02dc2,'id'));return db[_0x553e('0x96')][_0x553e('0x3e')](_0x147c52[_0x553e('0x95')](),_0x25922b)[_0x553e('0x2a')](function(_0x110e5a){var _0x260410=_['groupBy'](_0x110e5a,'OpenchannelInteractionId');var _0x477082=[];_0xc02dc2[_0x553e('0x35')](function(_0x87dfa3){_0x477082[_0x553e('0x36')](updateOpenchannelInteraction(_0x87dfa3,_0x1d96ec,_0x260410));});return BPromise[_0x553e('0xad')](_0x477082);});});})[_0x553e('0x2a')](function(_0x5ee538){_0x2d24a6['rows']=_0x5ee538;return _0x2d24a6;})[_0x553e('0x2a')](respondWithFilteredResult(_0x4f1ce9,_0x44581e))[_0x553e('0x37')](handleError(_0x4f1ce9,null));};exports[_0x553e('0xae')]=function(_0x2b2a31,_0xf482ee){var _0x34202e={};if(_0x2b2a31[_0x553e('0x3e')][_0x553e('0x3c')]&&_0x2b2a31[_0x553e('0x3e')][_0x553e('0x3c')]===_0x553e('0x4e')){_0x34202e['from']=_0x2b2a31['params']['id'];}else{_0x34202e['id']=_0x2b2a31[_0x553e('0xaf')]['id'];}var _0x242119={'raw':![],'where':_0x34202e},_0x5abf0d={};_0x5abf0d[_0x553e('0x3d')]=_[_0x553e('0x3f')](db[_0x553e('0x39')]['rawAttributes']);_0x5abf0d[_0x553e('0x3e')]=_['keys'](_0x2b2a31['query']);_0x5abf0d[_0x553e('0x40')]=_[_0x553e('0x41')](_0x5abf0d[_0x553e('0x3d')],_0x5abf0d[_0x553e('0x3e')]);_0x242119[_0x553e('0x43')]=_[_0x553e('0x41')](_0x5abf0d[_0x553e('0x3d')],qs[_0x553e('0x42')](_0x2b2a31['query']['fields']));_0x242119[_0x553e('0x43')]=_0x242119[_0x553e('0x43')][_0x553e('0x44')]?_0x242119[_0x553e('0x43')]:_0x5abf0d['model'];if(_0x2b2a31[_0x553e('0x3e')]['includeAll']){_0x242119[_0x553e('0xb0')]=[{'all':!![]}];}_0x242119=_['merge']({},_0x242119,_0x2b2a31['options']);return db['OpenchannelInteraction'][_0x553e('0x60')](_0x242119)[_0x553e('0x2a')](handleEntityNotFound(_0xf482ee,null))[_0x553e('0x2a')](respondWithResult(_0xf482ee,null))[_0x553e('0x37')](handleError(_0xf482ee,null));};exports[_0x553e('0xb1')]=function(_0x90e276,_0x61514f){return db[_0x553e('0x39')][_0x553e('0xb1')](_0x90e276[_0x553e('0xb2')],{})[_0x553e('0x2a')](respondWithResult(_0x61514f,0xc9))[_0x553e('0x37')](handleError(_0x61514f,null));};exports[_0x553e('0x28')]=function(_0x5a3634,_0xb07b0){if(_0x5a3634[_0x553e('0xb2')]['id']){delete _0x5a3634['body']['id'];}return db[_0x553e('0x39')][_0x553e('0x60')]({'where':{'id':_0x5a3634[_0x553e('0xaf')]['id']}})[_0x553e('0x2a')](handleEntityNotFound(_0xb07b0,null))[_0x553e('0x2a')](saveUpdates(_0x5a3634[_0x553e('0xb2')],null))[_0x553e('0x2a')](respondWithResult(_0xb07b0,null))[_0x553e('0x37')](handleError(_0xb07b0,null));};exports[_0x553e('0x29')]=function(_0x3a71d1,_0x5bdf9c){return db[_0x553e('0x39')]['find']({'where':{'id':_0x3a71d1[_0x553e('0xaf')]['id']}})[_0x553e('0x2a')](handleEntityNotFound(_0x5bdf9c,null))['then'](removeEntity(_0x5bdf9c,null))[_0x553e('0x37')](handleError(_0x5bdf9c,null));};exports['describe']=function(_0x1a1cce,_0x51bdcc){return db[_0x553e('0x39')]['describe']()['then'](respondWithResult(_0x51bdcc,null))['catch'](handleError(_0x51bdcc,null));};exports[_0x553e('0xb3')]=function(_0x1135b7,_0x2d2962,_0x16aabd){return db[_0x553e('0xb4')][_0x553e('0x60')]({'where':{'id':_0x1135b7['params']['id']}})[_0x553e('0x2a')](handleEntityNotFound(_0x2d2962,null))['then'](function(_0x220624){if(_0x220624){return _0x220624['addMessage'](_0x1135b7[_0x553e('0xb2')][_0x553e('0xb5')],_[_0x553e('0xb6')](_0x1135b7[_0x553e('0xb2')],[_0x553e('0xb5'),'id'])||{});}})[_0x553e('0x2a')](respondWithResult(_0x2d2962,null))['catch'](handleError(_0x2d2962,null));};exports['getMessages']=function(_0x54290d,_0x1359b2,_0xdbfeaf){var _0xdd110a={'raw':![],'where':{}};var _0x5df894={};var _0x43c577={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x553e('0xb7')]({'where':{'id':_0x54290d['params']['id']}})[_0x553e('0x2a')](handleEntityNotFound(_0x1359b2,null))[_0x553e('0x2a')](function(_0x564256){if(_0x564256){_0x5df894[_0x553e('0x3d')]=_[_0x553e('0x3f')](db['OpenchannelMessage']['rawAttributes']);_0x5df894[_0x553e('0x3e')]=_[_0x553e('0x3f')](_0x54290d['query']);_0x5df894['filters']=_[_0x553e('0x41')](_0x5df894[_0x553e('0x3d')],_0x5df894[_0x553e('0x3e')]);_0xdd110a[_0x553e('0x43')]=_[_0x553e('0x41')](_0x5df894[_0x553e('0x3d')],qs[_0x553e('0x42')](_0x54290d[_0x553e('0x3e')]['fields']));_0xdd110a[_0x553e('0x43')]=_0xdd110a[_0x553e('0x43')][_0x553e('0x44')]?_0xdd110a[_0x553e('0x43')]:_0x5df894[_0x553e('0x3d')];if(!_0x54290d['query'][_0x553e('0x45')](_0x553e('0x46'))){_0xdd110a[_0x553e('0x47')]=qs['limit'](_0x54290d[_0x553e('0x3e')][_0x553e('0x47')]);_0xdd110a[_0x553e('0x24')]=qs['offset'](_0x54290d[_0x553e('0x3e')]['offset']);}_0xdd110a[_0x553e('0x48')]=qs[_0x553e('0x49')](_0x54290d['query']['sort']);_0xdd110a[_0x553e('0x4a')]=qs[_0x553e('0x40')](_[_0x553e('0xb8')](_0x54290d[_0x553e('0x3e')],_0x5df894['filters']));_0xdd110a[_0x553e('0x4a')][_0x553e('0xb9')]=_0x564256['id'];if(_0x54290d[_0x553e('0x3e')]['filter']){_0xdd110a[_0x553e('0x4a')]=_[_0x553e('0x98')](_0xdd110a[_0x553e('0x4a')],{'$or':_[_0x553e('0x30')](_0xdd110a[_0x553e('0x43')],function(_0x370702){var _0x2a4058={};_0x2a4058[_0x370702]={'$like':'%'+_0x54290d['query'][_0x553e('0xba')]+'%'};return _0x2a4058;})});}if(_0x54290d[_0x553e('0x3e')][_0x553e('0x7c')]){var _0x43c681=_0x54290d[_0x553e('0x3e')][_0x553e('0x7c')][_0x553e('0x34')](',');var _0x136df5={};_0x136df5[_0x43c681[0x0]]={'$gte':moment(_0x43c681[0x1])[_0x553e('0xbb')](_0x553e('0xbc'))};_0xdd110a[_0x553e('0x4a')]=_[_0x553e('0x98')](_0xdd110a[_0x553e('0x4a')],_0x136df5);}_0xdd110a=_[_0x553e('0x98')]({},_0xdd110a,_0x54290d[_0x553e('0xbd')]);return db[_0x553e('0xb4')]['count']({'where':_0xdd110a[_0x553e('0x4a')]})[_0x553e('0x2a')](function(_0x4b7c50){_0x43c577[_0x553e('0x23')]=_0x4b7c50;if(_0x54290d[_0x553e('0x3e')][_0x553e('0xbe')]){_0xdd110a[_0x553e('0xb0')]=[{'all':!![]}];}return db[_0x553e('0xb4')]['findAll'](_0xdd110a);})[_0x553e('0x2a')](function(_0xe2fad5){_0x43c577[_0x553e('0xbf')]=_0xe2fad5;return _0x43c577;});}})[_0x553e('0x2a')](respondWithFilteredResult(_0x1359b2,_0xdd110a))['catch'](handleError(_0x1359b2,null));};exports[_0x553e('0xc0')]=function(_0x31547b,_0x1c9b5b,_0x40bc89){return db[_0x553e('0x39')][_0x553e('0x60')]({'where':{'id':_0x31547b[_0x553e('0xaf')]['id']}})[_0x553e('0x2a')](handleEntityNotFound(_0x1c9b5b,null))['then'](function(_0x1d8b56){if(_0x1d8b56){return _0x1d8b56[_0x553e('0xc1')](_0x31547b[_0x553e('0xb2')][_0x553e('0xb5')],_[_0x553e('0xb6')](_0x31547b['body'],[_0x553e('0xb5'),'id'])||{})[_0x553e('0xc2')](function(){return db[_0x553e('0x6f')][_0x553e('0xc3')]({'attributes':['id',_0x553e('0x2d'),_0x553e('0x4d')],'where':{'id':_0x31547b[_0x553e('0xb2')][_0x553e('0xb5')]}});})[_0x553e('0x2a')](function(_0x33061c){socket[_0x553e('0xc4')](_0x553e('0xc5'),{'id':Number(_0x31547b[_0x553e('0xaf')]['id']),'tags':_0x33061c||[]});return{'id':Number(_0x31547b[_0x553e('0xaf')]['id']),'tags':_0x33061c||[]};});}})[_0x553e('0x2a')](respondWithResult(_0x1c9b5b,null))[_0x553e('0x37')](handleError(_0x1c9b5b,null));};exports[_0x553e('0xc6')]=function(_0x271762,_0xc6bbe1,_0x25d498){return db['OpenchannelInteraction']['find']({'where':{'id':_0x271762[_0x553e('0xaf')]['id']}})[_0x553e('0x2a')](handleEntityNotFound(_0xc6bbe1,null))[_0x553e('0x2a')](function(_0x502f6d){if(_0x502f6d){return _0x502f6d['removeTags'](_0x271762['query']['ids']);}})['then'](respondWithStatusCode(_0xc6bbe1,null))[_0x553e('0x37')](handleError(_0xc6bbe1,null));};exports[_0x553e('0xc7')]=function(_0x389454,_0x283c59){var _0x1b22b9=moment()['unix']()[_0x553e('0x95')]();var _0x11215b=path[_0x553e('0xc8')](config[_0x553e('0xc9')],_0x553e('0xca'),'files',_0x553e('0xcb'));var _0x581b95=path[_0x553e('0xc8')](config[_0x553e('0xc9')],_0x553e('0xca'),_0x553e('0xcc'),_0x553e('0xcd'));var _0x27608c=path[_0x553e('0xc8')](_0x11215b,_0x1b22b9);var _0x5046b2=util[_0x553e('0xbb')](_0x553e('0xce'),_0x389454[_0x553e('0xaf')]['id'],_0x1b22b9);var _0x47fc94=path[_0x553e('0xc8')](_0x11215b,_0x5046b2);var _0x21e8cf=[];_0x21e8cf[_0x553e('0x36')]({'model':db[_0x553e('0x72')],'as':_0x553e('0x72'),'attributes':['id','fullname'],'raw':!![]});_0x21e8cf[_0x553e('0x36')]({'model':db[_0x553e('0xcf')],'as':_0x553e('0x64'),'attributes':['id',_0x553e('0xd0'),_0x553e('0xd1')],'raw':!![]});if(_0x389454[_0x553e('0x3e')][_0x553e('0xcd')]){_0x21e8cf['push']({'model':db[_0x553e('0xd2')],'as':_0x553e('0xd2'),'raw':!![]});}var _0x25456c=[{'model':db[_0x553e('0xb4')],'as':_0x553e('0xd3'),'attributes':['id',_0x553e('0xb2'),'createdAt','direction',_0x553e('0xd4'),'read'],'include':_0x21e8cf}];_0x25456c[_0x553e('0x36')]({'model':db[_0x553e('0xd5')],'as':_0x553e('0xd6'),'attributes':['id',_0x553e('0x2d')]});_0x25456c[_0x553e('0x36')]({'model':db['User'],'as':_0x553e('0xd7'),'attributes':['id',_0x553e('0x31')]});return db['OpenchannelInteraction'][_0x553e('0x60')]({'where':{'id':_0x389454[_0x553e('0xaf')]['id']},'include':_0x25456c})['then'](handleEntityNotFound(_0x283c59,null))['then'](function(_0x348666){if(_0x348666){var _0x25cf7d=_0x348666[_0x553e('0xd8')]({'plain':!![]});fs[_0x553e('0xd9')](_0x27608c);var _0x312a30={'format':'A4','border':_0x553e('0xda'),'header':{'height':_0x553e('0xdb'),'contents':{'first':_0x553e('0xdc')}},'footer':{'height':_0x553e('0xdd'),'contents':{'default':util[_0x553e('0xbb')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util['format']('%s\x20#%d',_0x553e('0xde'),_0x25cf7d['id']),moment()[_0x553e('0xbb')](_0x553e('0xdf'))[_0x553e('0x95')]())}}};var _0x36a325={'channel':_0x553e('0xde'),'account':_0x25cf7d[_0x553e('0xd6')]['name'],'agent':_0x25cf7d[_0x553e('0xd7')]?_0x25cf7d['Owner'][_0x553e('0x31')]:_0x553e('0xe0'),'createdAt':moment(_0x25cf7d[_0x553e('0x7a')])[_0x553e('0xbb')](_0x553e('0xbc'))[_0x553e('0x95')](),'closedAt':_0x25cf7d[_0x553e('0xe1')]?moment(_0x25cf7d['closedAt'])[_0x553e('0xbb')](_0x553e('0xbc'))[_0x553e('0x95')]():'','disposition':_0x25cf7d[_0x553e('0xe2')],'visibility':_0x25cf7d[_0x553e('0xe3')]?'Public':_0x553e('0xe4'),'messages':_(_0x25cf7d['Messages'])[_0x553e('0xba')]({'secret':![]})['map'](function(_0x1ddcef){if(_0x1ddcef[_0x553e('0xd2')]){var _0x328a92=path[_0x553e('0xc8')](_0x581b95,_0x1ddcef['Attachment'][_0x553e('0xe5')]);if(fs[_0x553e('0xe6')](_0x328a92)){fs[_0x553e('0xe7')](_0x328a92)[_0x553e('0xe8')](fs['createWriteStream'](path['join'](_0x27608c,_0x1ddcef[_0x553e('0xd2')]['basename'])));}}return{'date':moment(_0x1ddcef[_0x553e('0x7a')])[_0x553e('0xbb')](_0x553e('0xbc'))[_0x553e('0x95')](),'sender':_0x1ddcef[_0x553e('0xe9')]===_0x553e('0xea')?_0x1ddcef[_0x553e('0x72')]?_0x1ddcef[_0x553e('0x72')][_0x553e('0x31')]:_0x553e('0xeb'):_0x1ddcef[_0x553e('0x64')][_0x553e('0xd0')]+(_0x1ddcef[_0x553e('0x64')][_0x553e('0xd1')]?'\x20'+_0x1ddcef[_0x553e('0x64')][_0x553e('0xd1')]:''),'body':_0x1ddcef['Attachment']?_0x1ddcef[_0x553e('0xd2')][_0x553e('0xe5')]:_0x1ddcef['body'],'direction':_0x1ddcef[_0x553e('0xe9')]==='out'?'A':'C','secret':_0x1ddcef[_0x553e('0xd4')],'read':_0x1ddcef[_0x553e('0x81')],'attachment':_0x1ddcef[_0x553e('0xd2')]};})[_0x553e('0x67')]()};return ejs['renderFile'](path['join'](config[_0x553e('0xc9')],_0x553e('0xca'),_0x553e('0xec'),_0x553e('0xed')),{'interaction':_0x36a325})[_0x553e('0x2a')](function(_0x8d2906){return new BPromise(function(_0x4d1a6a,_0x1c3b13){pdf[_0x553e('0xb1')](_0x8d2906,_0x312a30)[_0x553e('0xee')](path[_0x553e('0xc8')](_0x27608c,_0x553e('0xef')+_0x25cf7d['id']+'-'+_0x1b22b9+_0x553e('0xf0')),function(_0x2f16fb,_0x121a21){if(_0x2f16fb)return _0x1c3b13(_0x2f16fb);_0x4d1a6a(_0x121a21);});});})[_0x553e('0x2a')](function(){return new BPromise(function(_0x1c0666,_0x103395){zipdir(_0x27608c,{'saveTo':_0x47fc94},function(_0x446aea,_0x4c20a6){if(_0x446aea)return _0x103395(_0x446aea);return _0x1c0666(_0x4c20a6);});})[_0x553e('0x2a')](function(){return new BPromise(function(_0x3a8ebe,_0x5cb489){rimraf(_0x27608c,function(_0x4af3d2){if(_0x4af3d2)_0x5cb489(_0x4af3d2);return _0x3a8ebe();});});})[_0x553e('0x2a')](function(){return _0x283c59[_0x553e('0xc7')](_0x47fc94,_0x5046b2,function(_0x3c67ff){if(_0x3c67ff){console[_0x553e('0xf1')](_0x553e('0xf2'),_0x3c67ff);}else{fs[_0x553e('0xf3')](_0x47fc94);}});});});}else{return _0x283c59[_0x553e('0x1f')](0xc8);}})[_0x553e('0x37')](handleError(_0x283c59,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 2349a34..48b3bb6 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 _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 +var _0xf5ae=['OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x203ef7,_0x22e5ca){var _0x2ae754=function(_0x29f1f7){while(--_0x29f1f7){_0x203ef7['push'](_0x203ef7['shift']());}};_0x2ae754(++_0x22e5ca);}(_0xf5ae,0x168));var _0xef5a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf5ae[_0x17d9e3];return _0x14192d;};'use strict';var EventEmitter=require(_0xef5a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xef5a('0x1')];var OpenchannelMessage=require(_0xef5a('0x2'))['db'][_0xef5a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xef5a('0x4')](0x0);var events={'afterCreate':_0xef5a('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4ae906){return function(_0x1ec050,_0x291d63,_0x2af64c){_0x1ec050[_0xef5a('0x6')]({'attributes':['id'],'raw':!![]})[_0xef5a('0x7')](function(_0x4df71f){_0x1ec050[_0xef5a('0x8')](_0xef5a('0x9'),_0x4df71f[_0xef5a('0xa')](function(_0x50eba3){return{'id':_0x50eba3['id']};}));return OpenchannelMessage[_0xef5a('0xb')]({'where':{'OpenchannelInteractionId':_0x1ec050['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef5a('0x7')](function(_0x1f8d71){_0x1ec050[_0xef5a('0x8')](_0xef5a('0xc'),_0x1f8d71[_0xef5a('0xd')]);OpenchannelInteractionEvents[_0xef5a('0xe')](_0x4ae906+':'+_0x1ec050['id'],_0x1ec050);OpenchannelInteractionEvents[_0xef5a('0xe')](_0x4ae906,_0x1ec050);_0x2af64c(null);})[_0xef5a('0xf')](_0x2af64c(null));};}for(var e in events){if(events[_0xef5a('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xef5a('0x11')](e,emitEvent(event));}}module[_0xef5a('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3d5090f..3db0b59 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 _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 +var _0x8958=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','request-promise','rimraf','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','changed'];(function(_0x3ed77b,_0x593624){var _0x2834a8=function(_0x26fb2a){while(--_0x26fb2a){_0x3ed77b['push'](_0x3ed77b['shift']());}};_0x2834a8(++_0x593624);}(_0x8958,0x93));var _0x8895=function(_0x103762,_0x39d529){_0x103762=_0x103762-0x0;var _0x24844e=_0x8958[_0x103762];return _0x24844e;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51376b,_0xe018b8,_0xc2be9f){if(_0x51376b[_0x8895('0x8')](_0x8895('0x9'))){_0x51376b[_0x8895('0xa')]=moment()[_0x8895('0xb')](_0x8895('0xc'));}_0xc2be9f(null,_0x51376b);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index f5ca8b8..71490b9 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 _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 +var _0x8262=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateOpenchannelInteraction','update','body','options','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','ids','omit','spread','AddTags','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x57584a,_0x2fdf68){var _0x6a5041=function(_0x254695){while(--_0x254695){_0x57584a['push'](_0x57584a['shift']());}};_0x6a5041(++_0x2fdf68);}(_0x8262,0x9d));var _0x2826=function(_0x2d97ef,_0x51040a){_0x2d97ef=_0x2d97ef-0x0;var _0x572156=_0x8262[_0x2d97ef];return _0x572156;};'use strict';var _=require(_0x2826('0x0'));var util=require(_0x2826('0x1'));var moment=require(_0x2826('0x2'));var BPromise=require(_0x2826('0x3'));var rs=require(_0x2826('0x4'));var fs=require('fs');var Redis=require(_0x2826('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2826('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2826('0x7'));var client=jayson[_0x2826('0x8')][_0x2826('0x9')]({'port':0x232a});config[_0x2826('0xa')]=_[_0x2826('0xb')](config[_0x2826('0xa')],{'host':_0x2826('0xc'),'port':0x18eb});var socket=require(_0x2826('0xd'))(new Redis(config[_0x2826('0xa')]));require('./openchannelInteraction.socket')[_0x2826('0xe')](socket);function respondWithRpcPromise(_0x2bda0a,_0x1ca0e0,_0x557d41){return new BPromise(function(_0x2a5f71,_0x415c8b){return client[_0x2826('0xf')](_0x2bda0a,_0x557d41)[_0x2826('0x10')](function(_0x23f048){logger[_0x2826('0x11')](_0x2826('0x12'),_0x1ca0e0,'request\x20sent');logger['debug'](_0x2826('0x13'),_0x1ca0e0,_0x2826('0x14'),JSON[_0x2826('0x15')](_0x23f048));if(_0x23f048[_0x2826('0x16')]){if(_0x23f048[_0x2826('0x16')]['code']===0x1f4){logger[_0x2826('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1ca0e0,_0x23f048['error'][_0x2826('0x17')]);return _0x415c8b(_0x23f048[_0x2826('0x16')][_0x2826('0x17')]);}logger[_0x2826('0x16')](_0x2826('0x12'),_0x1ca0e0,_0x23f048['error'][_0x2826('0x17')]);return _0x2a5f71(_0x23f048[_0x2826('0x16')][_0x2826('0x17')]);}else{logger[_0x2826('0x11')](_0x2826('0x12'),_0x1ca0e0,_0x2826('0x14'));_0x2a5f71(_0x23f048['result'][_0x2826('0x17')]);}})[_0x2826('0x18')](function(_0x21ee84){logger[_0x2826('0x16')](_0x2826('0x12'),_0x1ca0e0,_0x21ee84);_0x415c8b(_0x21ee84);});});}exports[_0x2826('0x19')]=function(_0x4f8aa2){var _0x131285=this;return new Promise(function(_0x388e3b,_0x749a7d){return db['OpenchannelInteraction'][_0x2826('0x1a')](_0x4f8aa2[_0x2826('0x1b')],{'raw':_0x4f8aa2[_0x2826('0x1c')]?_0x4f8aa2[_0x2826('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f8aa2[_0x2826('0x1c')]?_0x4f8aa2['options']['where']||null:null,'attributes':_0x4f8aa2[_0x2826('0x1c')]?_0x4f8aa2[_0x2826('0x1c')][_0x2826('0x1d')]||null:null,'limit':_0x4f8aa2[_0x2826('0x1c')]?_0x4f8aa2['options'][_0x2826('0x1e')]||null:null})[_0x2826('0x10')](function(_0x154ddc){logger[_0x2826('0x11')](_0x2826('0x19'),_0x4f8aa2);logger['debug'](_0x2826('0x19'),_0x4f8aa2,JSON[_0x2826('0x15')](_0x154ddc));_0x388e3b(_0x154ddc);})['catch'](function(_0x41b958){logger[_0x2826('0x16')](_0x2826('0x19'),_0x41b958[_0x2826('0x17')],_0x4f8aa2);_0x749a7d(_0x131285[_0x2826('0x16')](0x1f4,_0x41b958['message']));});});};exports[_0x2826('0x1f')]=function(_0x1bdd1f){return new Promise(function(_0xf0d3c5,_0x9aa894){return db[_0x2826('0x20')][_0x2826('0x21')]({'where':_0x1bdd1f[_0x2826('0x1c')]?_0x1bdd1f[_0x2826('0x1c')][_0x2826('0x22')]||null:null})[_0x2826('0x10')](function(_0x3c277f){if(_0x3c277f){return _0x3c277f[_0x2826('0x23')](_0x1bdd1f[_0x2826('0x1b')][_0x2826('0x24')],_[_0x2826('0x25')](_0x1bdd1f[_0x2826('0x1b')],['ids','id'])||{});}})[_0x2826('0x26')](function(_0x2af0d0){logger[_0x2826('0x11')](_0x2826('0x27'),_0x1bdd1f);logger[_0x2826('0x28')](_0x2826('0x27'),_0x1bdd1f,JSON[_0x2826('0x15')](_0x2af0d0));_0xf0d3c5(_0x2af0d0);})['catch'](function(_0x136309){logger[_0x2826('0x16')]('AddTags',_0x136309[_0x2826('0x17')],_0x1bdd1f);_0x9aa894(_this['error'](0x1f4,_0x136309[_0x2826('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 0b0d0cd..bd4b967 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 _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 +var _0xfa05=['length','remove','removeListener','register'];(function(_0x1cec84,_0x101ec2){var _0x12b7d3=function(_0x9679d8){while(--_0x9679d8){_0x1cec84['push'](_0x1cec84['shift']());}};_0x12b7d3(++_0x101ec2);}(_0xfa05,0x1a1));var _0x5fa0=function(_0x48b745,_0x4a3508){_0x48b745=_0x48b745-0x0;var _0x4660a0=_0xfa05[_0x48b745];return _0x4660a0;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x5fa0('0x0'),'update'];function createListener(_0x1f0ec9,_0xdb95c1){return function(_0x2e04ca){_0xdb95c1['emit'](_0x1f0ec9,_0x2e04ca);};}function removeListener(_0x38f988,_0x857b4f){return function(){OpenchannelInteractionEvents[_0x5fa0('0x1')](_0x38f988,_0x857b4f);};}exports[_0x5fa0('0x2')]=function(_0x1fe87a){for(var _0x242109=0x0,_0x2bcaff=events[_0x5fa0('0x3')];_0x242109<_0x2bcaff;_0x242109++){var _0x202891=events[_0x242109];var _0x1b0754=createListener('openchannelInteraction:'+_0x202891,_0x1fe87a);OpenchannelInteractionEvents['on'](_0x202891,_0x1b0754);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 7b7868f..fbc8b84 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 _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 +var _0x456e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/:id','show','openchannelmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x4bd289,_0x1b6a78){var _0x145f90=function(_0x32afc5){while(--_0x32afc5){_0x4bd289['push'](_0x4bd289['shift']());}};_0x145f90(++_0x1b6a78);}(_0x456e,0x10f));var _0xe456=function(_0xe81188,_0x5d8c99){_0xe81188=_0xe81188-0x0;var _0x1b5df8=_0x456e[_0xe81188];return _0x1b5df8;};'use strict';var multer=require(_0xe456('0x0'));var util=require('util');var path=require(_0xe456('0x1'));var timeout=require(_0xe456('0x2'));var express=require(_0xe456('0x3'));var router=express[_0xe456('0x4')]();var auth=require(_0xe456('0x5'));var interaction=require(_0xe456('0x6'));var config=require(_0xe456('0x7'));var controller=require(_0xe456('0x8'));router[_0xe456('0x9')]('/',auth[_0xe456('0xa')](),controller['index']);router[_0xe456('0x9')]('/describe',auth[_0xe456('0xa')](),controller['describe']);router['get'](_0xe456('0xb'),auth[_0xe456('0xa')](),controller[_0xe456('0xc')]);router['post']('/',auth[_0xe456('0xa')](),interaction['tracked']('openchannel',_0xe456('0xd')),controller[_0xe456('0xe')]);router[_0xe456('0xf')](_0xe456('0xb'),auth[_0xe456('0xa')](),controller[_0xe456('0x10')]);router['put'](_0xe456('0x11'),auth[_0xe456('0xa')](),controller[_0xe456('0x12')]);router[_0xe456('0xf')](_0xe456('0x13'),auth[_0xe456('0xa')](),controller['reject']);router[_0xe456('0x14')](_0xe456('0xb'),auth[_0xe456('0xa')](),controller[_0xe456('0x15')]);module[_0xe456('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 32d8e21..615ba86 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 _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 +var _0x24f5=['ENUM','out','DATE','STRING','exports','TEXT','medium'];(function(_0x2ba17a,_0x319cdf){var _0x2aa132=function(_0x5a0540){while(--_0x5a0540){_0x2ba17a['push'](_0x2ba17a['shift']());}};_0x2aa132(++_0x319cdf);}(_0x24f5,0x1bd));var _0x524f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24f5[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x524f('0x0')]={'body':{'type':Sequelize[_0x524f('0x1')](_0x524f('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x524f('0x3')]('in',_0x524f('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x524f('0x5')]},'providerName':{'type':Sequelize[_0x524f('0x6')]},'providerResponse':{'type':Sequelize[_0x524f('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 7dbdb58..6c118eb 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 _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 +var _0xd3ee=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','OpenchannelMessage','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','keys','include','find','create','body','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','get','OpenchannelInteractionId','isNil','read1stAt','role','null','acceptMessage','manual','interface','SIP/%s','channel','event','acceptmessage','reject','OpenchannelInteraction','interaction','stringify','RejectMessage','EventManager','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5d8942,_0x54804c){var _0x1bc352=function(_0x3cc8b3){while(--_0x3cc8b3){_0x5d8942['push'](_0x5d8942['shift']());}};_0x1bc352(++_0x54804c);}(_0xd3ee,0x167));var _0xed3e=function(_0x55754e,_0x286388){_0x55754e=_0x55754e-0x0;var _0x2e9948=_0xd3ee[_0x55754e];return _0x2e9948;};'use strict';var pdf=require(_0xed3e('0x0'));var emlformat=require(_0xed3e('0x1'));var rimraf=require(_0xed3e('0x2'));var zipdir=require(_0xed3e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed3e('0x4'));var moment=require(_0xed3e('0x5'));var BPromise=require(_0xed3e('0x6'));var Mustache=require(_0xed3e('0x7'));var util=require(_0xed3e('0x8'));var path=require(_0xed3e('0x9'));var sox=require(_0xed3e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xed3e('0xb'));var squel=require(_0xed3e('0xc'));var crypto=require('crypto');var jsforce=require(_0xed3e('0xd'));var deskjs=require(_0xed3e('0xe'));var toCsv=require(_0xed3e('0xf'));var querystring=require(_0xed3e('0x10'));var Papa=require(_0xed3e('0x11'));var Redis=require('ioredis');var authService=require(_0xed3e('0x12'));var qs=require(_0xed3e('0x13'));var as=require(_0xed3e('0x14'));var hardwareService=require(_0xed3e('0x15'));var logger=require(_0xed3e('0x16'))(_0xed3e('0x17'));var utils=require(_0xed3e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xed3e('0x19'));var db=require(_0xed3e('0x1a'))['db'];config[_0xed3e('0x1b')]=_[_0xed3e('0x1c')](config[_0xed3e('0x1b')],{'host':_0xed3e('0x1d'),'port':0x18eb});var socket=require(_0xed3e('0x1e'))(new Redis(config[_0xed3e('0x1b')]));require(_0xed3e('0x1f'))[_0xed3e('0x20')](socket);var jayson=require(_0xed3e('0x21'));var client=jayson['client'][_0xed3e('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xed3e('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x163a04,_0x3884e5,_0x410f72,_0x563e40){return new BPromise(function(_0x247016,_0x43295d){var _0x31f447=_0x563e40||client;return _0x31f447[_0xed3e('0x23')](_0x163a04,_0x410f72)[_0xed3e('0x24')](function(_0x4cdc0b){logger[_0xed3e('0x25')](_0xed3e('0x26'),_0x3884e5,_0xed3e('0x27'));logger[_0xed3e('0x28')](_0xed3e('0x29'),_0x3884e5,'request\x20sent',JSON['stringify'](_0x4cdc0b));if(_0x4cdc0b['error']){if(_0x4cdc0b['error'][_0xed3e('0x2a')]===0x1f4){logger[_0xed3e('0x2b')](_0xed3e('0x26'),_0x3884e5,_0x4cdc0b[_0xed3e('0x2b')][_0xed3e('0x2c')]);return _0x43295d(_0x4cdc0b[_0xed3e('0x2b')][_0xed3e('0x2c')]);}logger['error'](_0xed3e('0x26'),_0x3884e5,_0x4cdc0b[_0xed3e('0x2b')]['message']);return _0x247016(_0x4cdc0b[_0xed3e('0x2b')][_0xed3e('0x2c')]);}else{logger[_0xed3e('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3884e5,'request\x20sent');_0x247016(_0x4cdc0b[_0xed3e('0x2d')]['message']);}})[_0xed3e('0x2e')](function(_0x257856){logger[_0xed3e('0x2b')](_0xed3e('0x26'),_0x3884e5,_0x257856);_0x43295d(_0x257856);});});}function respondWithStatusCode(_0x1880b7,_0x5b88f9){_0x5b88f9=_0x5b88f9||0xcc;return function(_0x5940c3){if(_0x5940c3){return _0x1880b7[_0xed3e('0x2f')](_0x5b88f9);}return _0x1880b7[_0xed3e('0x30')](_0x5b88f9)[_0xed3e('0x31')]();};}function respondWithResult(_0x26b1d9,_0x5bf63c){_0x5bf63c=_0x5bf63c||0xc8;return function(_0x4e1955){if(_0x4e1955){return _0x26b1d9['status'](_0x5bf63c)[_0xed3e('0x32')](_0x4e1955);}};}function respondWithFilteredResult(_0x30b4dc,_0x355b41){return function(_0x388d19){if(_0x388d19){var _0x33b453=_0x388d19[_0xed3e('0x33')],_0x7d297a=_0x355b41[_0xed3e('0x34')],_0x248d87=_0x355b41['offset']+_0x355b41[_0xed3e('0x35')],_0x1beae8;if(_0x248d87>=_0x33b453){_0x248d87=_0x33b453;_0x1beae8=0xc8;}else{_0x1beae8=0xce;}_0x30b4dc[_0xed3e('0x30')](_0x1beae8);return _0x30b4dc[_0xed3e('0x36')](_0xed3e('0x37'),_0x7d297a+'-'+_0x248d87+'/'+_0x33b453)[_0xed3e('0x32')](_0x388d19);}return null;};}function patchUpdates(_0xcbce15){return function(_0x22a9ab){try{jsonpatch[_0xed3e('0x38')](_0x22a9ab,_0xcbce15,!![]);}catch(_0x19b688){return BPromise['reject'](_0x19b688);}return _0x22a9ab[_0xed3e('0x39')]();};}function saveUpdates(_0x58b103,_0x2bddfc){return function(_0x39324a){if(_0x39324a){return _0x39324a[_0xed3e('0x3a')](_0x58b103)[_0xed3e('0x24')](function(_0xffa67){return _0xffa67;});}return null;};}function removeEntity(_0x2f2753,_0x53ec36){return function(_0x1adab7){if(_0x1adab7){return _0x1adab7[_0xed3e('0x3b')]()[_0xed3e('0x24')](function(){_0x2f2753['status'](0xcc)[_0xed3e('0x31')]();});}};}function handleEntityNotFound(_0x5a964e,_0x53724b){return function(_0x31bbdd){if(!_0x31bbdd){_0x5a964e[_0xed3e('0x2f')](0x194);}return _0x31bbdd;};}function handleError(_0x13d5b2,_0x38abfc){_0x38abfc=_0x38abfc||0x1f4;return function(_0x4f5b96){logger[_0xed3e('0x2b')](_0x4f5b96[_0xed3e('0x3c')]);if(_0x4f5b96['name']){delete _0x4f5b96[_0xed3e('0x3d')];}_0x13d5b2[_0xed3e('0x30')](_0x38abfc)[_0xed3e('0x3e')](_0x4f5b96);};}exports[_0xed3e('0x3f')]=function(_0x4a78a4,_0x2bdcc5){var _0x103a7c={},_0xabb983={},_0x3b7a9e={'count':0x0,'rows':[]};var _0x3000b1=_['map'](db[_0xed3e('0x40')]['rawAttributes'],function(_0x51e04c){return{'name':_0x51e04c[_0xed3e('0x41')],'type':_0x51e04c[_0xed3e('0x42')][_0xed3e('0x43')]};});_0xabb983[_0xed3e('0x44')]=_[_0xed3e('0x45')](_0x3000b1,_0xed3e('0x3d'));_0xabb983[_0xed3e('0x46')]=_['keys'](_0x4a78a4[_0xed3e('0x46')]);_0xabb983[_0xed3e('0x47')]=_[_0xed3e('0x48')](_0xabb983[_0xed3e('0x44')],_0xabb983[_0xed3e('0x46')]);_0x103a7c[_0xed3e('0x49')]=_[_0xed3e('0x48')](_0xabb983[_0xed3e('0x44')],qs[_0xed3e('0x4a')](_0x4a78a4[_0xed3e('0x46')][_0xed3e('0x4a')]));_0x103a7c[_0xed3e('0x49')]=_0x103a7c[_0xed3e('0x49')][_0xed3e('0x4b')]?_0x103a7c[_0xed3e('0x49')]:_0xabb983[_0xed3e('0x44')];if(!_0x4a78a4[_0xed3e('0x46')][_0xed3e('0x4c')](_0xed3e('0x4d'))){_0x103a7c[_0xed3e('0x35')]=qs[_0xed3e('0x35')](_0x4a78a4[_0xed3e('0x46')]['limit']);_0x103a7c[_0xed3e('0x34')]=qs[_0xed3e('0x34')](_0x4a78a4[_0xed3e('0x46')][_0xed3e('0x34')]);}_0x103a7c[_0xed3e('0x4e')]=qs[_0xed3e('0x4f')](_0x4a78a4['query'][_0xed3e('0x4f')]);_0x103a7c[_0xed3e('0x50')]=qs[_0xed3e('0x47')](_[_0xed3e('0x51')](_0x4a78a4[_0xed3e('0x46')],_0xabb983['filters']),_0x3000b1);if(_0x4a78a4[_0xed3e('0x46')][_0xed3e('0x52')]){_0x103a7c['where']=_[_0xed3e('0x53')](_0x103a7c['where'],{'$or':_['map'](_0x3000b1,function(_0x44c7e5){if(_0x44c7e5[_0xed3e('0x42')]!==_0xed3e('0x54')){var _0x54b757={};_0x54b757[_0x44c7e5[_0xed3e('0x3d')]]={'$like':'%'+_0x4a78a4['query'][_0xed3e('0x52')]+'%'};return _0x54b757;}})});}_0x103a7c=_[_0xed3e('0x53')]({},_0x103a7c,_0x4a78a4['options']);var _0x50cdb4={'where':_0x103a7c[_0xed3e('0x50')]};return db['OpenchannelMessage'][_0xed3e('0x33')](_0x50cdb4)['then'](function(_0x4924c4){_0x3b7a9e[_0xed3e('0x33')]=_0x4924c4;if(_0x4a78a4[_0xed3e('0x46')][_0xed3e('0x55')]){_0x103a7c['include']=[{'all':!![]}];}return db['OpenchannelMessage'][_0xed3e('0x56')](_0x103a7c);})['then'](function(_0xf3749){_0x3b7a9e[_0xed3e('0x57')]=_0xf3749;return _0x3b7a9e;})[_0xed3e('0x24')](respondWithFilteredResult(_0x2bdcc5,_0x103a7c))[_0xed3e('0x2e')](handleError(_0x2bdcc5,null));};exports[_0xed3e('0x58')]=function(_0x1e6dca,_0x4721bf){var _0x4ec494={'raw':!![],'where':{'id':_0x1e6dca[_0xed3e('0x59')]['id']}},_0x42b539={};_0x42b539[_0xed3e('0x44')]=_['keys'](db[_0xed3e('0x40')][_0xed3e('0x5a')]);_0x42b539[_0xed3e('0x46')]=_[_0xed3e('0x5b')](_0x1e6dca[_0xed3e('0x46')]);_0x42b539[_0xed3e('0x47')]=_[_0xed3e('0x48')](_0x42b539[_0xed3e('0x44')],_0x42b539[_0xed3e('0x46')]);_0x4ec494[_0xed3e('0x49')]=_[_0xed3e('0x48')](_0x42b539[_0xed3e('0x44')],qs['fields'](_0x1e6dca[_0xed3e('0x46')][_0xed3e('0x4a')]));_0x4ec494[_0xed3e('0x49')]=_0x4ec494[_0xed3e('0x49')][_0xed3e('0x4b')]?_0x4ec494['attributes']:_0x42b539['model'];if(_0x1e6dca['query'][_0xed3e('0x55')]){_0x4ec494[_0xed3e('0x5c')]=[{'all':!![]}];}_0x4ec494=_[_0xed3e('0x53')]({},_0x4ec494,_0x1e6dca['options']);return db[_0xed3e('0x40')][_0xed3e('0x5d')](_0x4ec494)[_0xed3e('0x24')](handleEntityNotFound(_0x4721bf,null))[_0xed3e('0x24')](respondWithResult(_0x4721bf,null))['catch'](handleError(_0x4721bf,null));};exports[_0xed3e('0x5e')]=function(_0x41ef0b,_0x175a9e){return db[_0xed3e('0x40')][_0xed3e('0x5e')](_0x41ef0b[_0xed3e('0x5f')],{})[_0xed3e('0x24')](respondWithResult(_0x175a9e,0xc9))[_0xed3e('0x2e')](handleError(_0x175a9e,null));};exports[_0xed3e('0x3a')]=function(_0x402988,_0x330822){if(_0x402988[_0xed3e('0x5f')]['id']){delete _0x402988[_0xed3e('0x5f')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x402988['params']['id']}})[_0xed3e('0x24')](handleEntityNotFound(_0x330822,null))[_0xed3e('0x24')](saveUpdates(_0x402988[_0xed3e('0x5f')],null))[_0xed3e('0x24')](respondWithResult(_0x330822,null))[_0xed3e('0x2e')](handleError(_0x330822,null));};exports[_0xed3e('0x3b')]=function(_0x46f4f9,_0x46877b){return db['OpenchannelMessage'][_0xed3e('0x5d')]({'where':{'id':_0x46f4f9[_0xed3e('0x59')]['id']}})['then'](handleEntityNotFound(_0x46877b,null))[_0xed3e('0x24')](removeEntity(_0x46877b,null))['catch'](handleError(_0x46877b,null));};exports[_0xed3e('0x60')]=function(_0x3b7049,_0x3f1d51){return db['OpenchannelMessage']['describe']()[_0xed3e('0x24')](respondWithResult(_0x3f1d51,null))['catch'](handleError(_0x3f1d51,null));};var interaction_log=require('../../config/logger')(_0xed3e('0x61'));exports[_0xed3e('0x62')]=function(_0x3a9e2,_0x591a9e,_0x5d1c71){var _0xa7fc81={'agent':{},'channel':_0xed3e('0x63')};if(_0x3a9e2[_0xed3e('0x5f')]['id']){delete _0x3a9e2[_0xed3e('0x5f')]['id'];}_0x3a9e2[_0xed3e('0x5f')][_0xed3e('0x64')]=!![];_0x3a9e2[_0xed3e('0x5f')][_0xed3e('0x65')]=moment()[_0xed3e('0x66')](_0xed3e('0x67'));_0x3a9e2['body'][_0xed3e('0x68')]=_0x3a9e2[_0xed3e('0x5f')][_0xed3e('0x68')]||_0x3a9e2[_0xed3e('0x69')]['id'];_0xa7fc81[_0xed3e('0x6a')]['id']=_0x3a9e2['body'][_0xed3e('0x68')];return db[_0xed3e('0x40')][_0xed3e('0x5d')]({'where':{'id':_0x3a9e2['params']['id'],'UserId':null},'include':[{'model':db[_0xed3e('0x6b')],'as':'Contact'}]})[_0xed3e('0x24')](handleEntityNotFound(_0x591a9e,null))['then'](saveUpdates(_0x3a9e2[_0xed3e('0x5f')],null))['then'](function(_0x15175a){if(_0x15175a){_0xa7fc81[_0xed3e('0x2c')]=_0x15175a[_0xed3e('0x6c')]({'plain':!![]});return db['OpenchannelInteraction'][_0xed3e('0x5d')]({'where':{'id':_0x15175a[_0xed3e('0x6d')]}});}return null;})[_0xed3e('0x24')](handleEntityNotFound(_0x591a9e,null))[_0xed3e('0x24')](function(_0x2c530d){if(_0x2c530d){return _0x2c530d[_0xed3e('0x3a')]({'UserId':_0x3a9e2[_0xed3e('0x5f')][_0xed3e('0x68')],'read1stAt':_[_0xed3e('0x6e')](_0x2c530d[_0xed3e('0x6f')])?moment()[_0xed3e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x2b4bed){if(_0x2b4bed){_0xa7fc81['interaction']=_0x2b4bed[_0xed3e('0x6c')]({'plain':!![]});interaction_log[_0xed3e('0x25')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3a9e2[_0xed3e('0x69')]['id'],_0x3a9e2[_0xed3e('0x69')][_0xed3e('0x3d')],_0x3a9e2[_0xed3e('0x69')][_0xed3e('0x70')],_0xa7fc81['interaction']['id'],_0x3a9e2[_0xed3e('0x5f')]?JSON['stringify'](_0x3a9e2[_0xed3e('0x5f')]):_0xed3e('0x71'));return respondWithRpcPromise('AcceptMessage',_0xed3e('0x72'),_0xa7fc81);}return null;})[_0xed3e('0x24')](function(_0x2727f2){if(_0x2727f2){if(_0x3a9e2[_0xed3e('0x5f')][_0xed3e('0x73')]){_0xa7fc81[_0xed3e('0x2c')][_0xed3e('0x74')]=util['format'](_0xed3e('0x75'),_0x3a9e2[_0xed3e('0x69')][_0xed3e('0x3d')]);_0xa7fc81[_0xed3e('0x2c')][_0xed3e('0x76')]=_0xa7fc81['channel'];_0xa7fc81[_0xed3e('0x2c')][_0xed3e('0x77')]=_0xed3e('0x62');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xed3e('0x78'),'message':_0xa7fc81[_0xed3e('0x2c')]},client9002)[_0xed3e('0x24')](function(){return _0xa7fc81;});}return _0xa7fc81;}return null;})[_0xed3e('0x24')](respondWithResult(_0x591a9e,null))[_0xed3e('0x2e')](handleError(_0x591a9e,null));};var interaction_log=require(_0xed3e('0x16'))(_0xed3e('0x61'));exports[_0xed3e('0x79')]=function(_0x93e0e6,_0x21134b,_0x5a990e){var _0x4faae5={'agent':{},'channel':_0xed3e('0x63')};if(_0x93e0e6[_0xed3e('0x5f')]['id']){delete _0x93e0e6[_0xed3e('0x5f')]['id'];}_0x93e0e6[_0xed3e('0x5f')]['UserId']=_0x93e0e6[_0xed3e('0x5f')][_0xed3e('0x68')]||_0x93e0e6[_0xed3e('0x69')]['id'];_0x4faae5[_0xed3e('0x6a')]['id']=_0x93e0e6[_0xed3e('0x5f')][_0xed3e('0x68')];return db[_0xed3e('0x40')][_0xed3e('0x5d')]({'where':{'id':_0x93e0e6[_0xed3e('0x59')]['id'],'UserId':null}})[_0xed3e('0x24')](handleEntityNotFound(_0x21134b,null))[_0xed3e('0x24')](function(_0x573879){if(_0x573879){_0x4faae5[_0xed3e('0x2c')]=_0x573879[_0xed3e('0x6c')]({'plain':!![]});return db[_0xed3e('0x7a')]['find']({'where':{'id':_0x573879[_0xed3e('0x6d')]}});}return null;})[_0xed3e('0x24')](handleEntityNotFound(_0x21134b,null))[_0xed3e('0x24')](function(_0x1df6aa){if(_0x1df6aa){_0x4faae5[_0xed3e('0x7b')]=_0x1df6aa[_0xed3e('0x6c')]({'plain':!![]});interaction_log[_0xed3e('0x25')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x93e0e6[_0xed3e('0x69')]['id'],_0x93e0e6[_0xed3e('0x69')][_0xed3e('0x3d')],_0x93e0e6['user'][_0xed3e('0x70')],_0x4faae5[_0xed3e('0x7b')]['id'],_0x93e0e6[_0xed3e('0x5f')]?JSON[_0xed3e('0x7c')](_0x93e0e6[_0xed3e('0x5f')]):'null');return respondWithRpcPromise(_0xed3e('0x7d'),'rejectMessage',_0x4faae5);}return null;})[_0xed3e('0x24')](function(_0x19944c){if(_0x19944c){_0x19944c['message']['interface']=util[_0xed3e('0x66')]('SIP/%s',_0x93e0e6[_0xed3e('0x69')][_0xed3e('0x3d')]);_0x19944c[_0xed3e('0x2c')][_0xed3e('0x76')]=_0x4faae5['channel'];_0x19944c['message'][_0xed3e('0x77')]=_0xed3e('0x79');respondWithRpcPromise(_0xed3e('0x7e'),_0xed3e('0x7e'),{'event':_0xed3e('0x7f'),'message':_0x19944c[_0xed3e('0x2c')]},client9002);return _0x4faae5;}return null;})[_0xed3e('0x24')](respondWithResult(_0x21134b,null))['catch'](handleError(_0x21134b,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 1d5678c..56fd031 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 _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 +var _0xbe38=['events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty','hook'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xbe38,0x165));var _0x8be3=function(_0x35e7f5,_0x505458){_0x35e7f5=_0x35e7f5-0x0;var _0x21327e=_0xbe38[_0x35e7f5];return _0x21327e;};'use strict';var EventEmitter=require(_0x8be3('0x0'));var OpenchannelMessage=require(_0x8be3('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8be3('0x2')](0x0);var events={'afterCreate':_0x8be3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x237b39){return function(_0x4ac26f,_0x54c5d9,_0x491ccd){OpenchannelMessageEvents[_0x8be3('0x4')](_0x237b39+':'+_0x4ac26f['id'],_0x4ac26f);OpenchannelMessageEvents[_0x8be3('0x4')](_0x237b39,_0x4ac26f);_0x491ccd(null);};}for(var e in events){if(events[_0x8be3('0x5')](e)){var event=events[e];OpenchannelMessage[_0x8be3('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 158ddde..3d885c9 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 _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 +var _0x4c28=['request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','fti_openchannel_messages','FULLTEXT','toLowerCase','direction','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','error','secret','CmContact','OpenchannelAccount','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3c88da,_0x18631d){var _0x517e32=function(_0x441f61){while(--_0x441f61){_0x3c88da['push'](_0x3c88da['shift']());}};_0x517e32(++_0x18631d);}(_0x4c28,0x1b3));var _0x84c2=function(_0x5a9ba9,_0x316a7f){_0x5a9ba9=_0x5a9ba9-0x0;var _0x12e5df=_0x4c28[_0x5a9ba9];return _0x12e5df;};'use strict';var _=require(_0x84c2('0x0'));var util=require(_0x84c2('0x1'));var logger=require(_0x84c2('0x2'))(_0x84c2('0x3'));var moment=require(_0x84c2('0x4'));var BPromise=require(_0x84c2('0x5'));var rp=require(_0x84c2('0x6'));var fs=require('fs');var path=require(_0x84c2('0x7'));var rimraf=require(_0x84c2('0x8'));var config=require(_0x84c2('0x9'));var attributes=require(_0x84c2('0xa'));module['exports']=function(_0x287df9,_0x70db6e){return _0x287df9[_0x84c2('0xb')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x84c2('0xc'),'fields':['body'],'type':_0x84c2('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3dd25f,_0xd28b84,_0x16308f){var _0x203fe1=_0x287df9['models'];var _0x3ec13d=_0x3dd25f['get']({'plain':!![]});if(_0x3ec13d['direction'][_0x84c2('0xe')]()==='in'||_0x3ec13d[_0x84c2('0xf')]['toLowerCase']()===_0x84c2('0x10')&&!_0x3ec13d['secret']&&!_[_0x84c2('0x11')](_0x3ec13d[_0x84c2('0x12')])){_0x203fe1[_0x84c2('0x13')][_0x84c2('0x14')]({'where':{'id':_0x3ec13d[_0x84c2('0x15')]}})[_0x84c2('0x16')](function(_0x2285be){if(_0x2285be){_0x2285be[_0x84c2('0x17')]({'lastMsgAt':_0x3ec13d['createdAt'],'lastMsgDirection':_0x3ec13d['direction']['toLowerCase']()});}})[_0x84c2('0x18')](function(_0x2efa52){console[_0x84c2('0x19')](_0x2efa52);});}if(_0x3ec13d[_0x84c2('0xf')]===_0x84c2('0x10')&&!_0x3ec13d[_0x84c2('0x1a')]){var _0x428b88;_0x203fe1[_0x84c2('0x1b')]['describe']()[_0x84c2('0x16')](function(_0x39966f){return _0x203fe1[_0x84c2('0x1c')][_0x84c2('0x1d')]({'where':{'id':_0x3ec13d['OpenchannelAccountId']},'include':[{'model':_0x203fe1[_0x84c2('0x13')],'as':_0x84c2('0x1e'),'where':{'id':_0x3ec13d[_0x84c2('0x15')]},'limit':0x1,'include':[{'model':_0x203fe1[_0x84c2('0x1b')],'as':_0x84c2('0x1f'),'attributes':_[_0x84c2('0x20')](_0x39966f)}]}]});})[_0x84c2('0x16')](function(_0x150f1b){_0x428b88=_0x150f1b['get']({'plain':!![]});if(_0x428b88&&_0x428b88[_0x84c2('0x21')]){logger[_0x84c2('0x22')](_0x84c2('0x23'),_0x84c2('0x24'),util[_0x84c2('0x25')](_0x84c2('0x26'),_0x3ec13d['id'],_0x428b88[_0x84c2('0x21')]));if(_0x428b88[_0x84c2('0x1e')]&&_0x428b88[_0x84c2('0x1e')]['length']){_0x3ec13d[_0x84c2('0x27')]=_[_0x84c2('0x28')](_0x428b88['Interactions'][0x0],_0x84c2('0x1f'));_0x3ec13d['Contact']=_0x428b88['Interactions'][0x0]['Contact'];}var _0xd28b84={'method':_0x84c2('0x29'),'uri':encodeURI(_0x428b88[_0x84c2('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xd28b84[_0x84c2('0x2a')]){case _0x84c2('0x2b'):_0xd28b84['qs']=_0x3ec13d;break;case _0x84c2('0x29'):_0xd28b84[_0x84c2('0x2c')]=_0x3ec13d;break;}return rp(_0xd28b84)[_0x84c2('0x16')](function(_0x566519){logger['info']('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x84c2('0x25')](_0x84c2('0x2d'),_0x3ec13d['id'],_0x428b88[_0x84c2('0x21')]));if(_0x566519[_0x84c2('0x2c')]['threadId']&&_0x566519[_0x84c2('0x2c')][_0x84c2('0x2e')]!=_0x3ec13d[_0x84c2('0x27')]['threadId']){return _0x203fe1[_0x84c2('0x13')]['update']({'threadId':_0x566519[_0x84c2('0x2c')][_0x84c2('0x2e')]},{'logging':!![],'where':{'id':_0x3ec13d[_0x84c2('0x27')]['id']}});}else{return;}})[_0x84c2('0x16')](function(){return _0x3dd25f[_0x84c2('0x17')]({'read':!![]});})[_0x84c2('0x18')](function(_0xdceb0c){logger[_0x84c2('0x19')](_0x84c2('0x23'),_0x84c2('0x24'),util[_0x84c2('0x2f')](_0xdceb0c,{'showHidden':![],'depth':null}));_0x16308f();});}else{_0x16308f();}})[_0x84c2('0x30')](function(){_0x16308f();});}else{_0x16308f();}}},'charset':'utf8mb4','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 8fd6d4f..d3d186d 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(_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 +var _0xd8b0=['util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','./openchannelMessage.socket','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','create','options','lodash'];(function(_0x46b42d,_0x4f5bf8){var _0x4a566b=function(_0x193cb5){while(--_0x193cb5){_0x46b42d['push'](_0x46b42d['shift']());}};_0x4a566b(++_0x4f5bf8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});config[_0x0d8b('0x9')]=_['defaults'](config[_0x0d8b('0x9')],{'host':_0x0d8b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0d8b('0x9')]));require(_0x0d8b('0xb'))[_0x0d8b('0xc')](socket);function respondWithRpcPromise(_0x1f4800,_0x28ff7f,_0x1cac62){return new BPromise(function(_0x2c5e9e,_0x28f87c){return client['request'](_0x1f4800,_0x1cac62)[_0x0d8b('0xd')](function(_0x4e0269){logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));logger[_0x0d8b('0x11')](_0x0d8b('0x12'),_0x28ff7f,_0x0d8b('0x10'),JSON[_0x0d8b('0x13')](_0x4e0269));if(_0x4e0269[_0x0d8b('0x14')]){if(_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x15')]===0x1f4){logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x28f87c(_0x4e0269['error'][_0x0d8b('0x16')]);}logger[_0x0d8b('0x14')](_0x0d8b('0xf'),_0x28ff7f,_0x4e0269[_0x0d8b('0x14')][_0x0d8b('0x16')]);return _0x2c5e9e(_0x4e0269['error'][_0x0d8b('0x16')]);}else{logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x28ff7f,_0x0d8b('0x10'));_0x2c5e9e(_0x4e0269[_0x0d8b('0x17')][_0x0d8b('0x16')]);}})[_0x0d8b('0x18')](function(_0xa3612a){logger['error'](_0x0d8b('0xf'),_0x28ff7f,_0xa3612a);_0x28f87c(_0xa3612a);});});}exports[_0x0d8b('0x19')]=function(_0x196c0a){var _0x143372=this;return new Promise(function(_0x24e8ed,_0x5b709c){return db[_0x0d8b('0x1a')][_0x0d8b('0x1b')](_0x196c0a['body'],{'raw':_0x196c0a['options']?_0x196c0a[_0x0d8b('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5527d8){logger[_0x0d8b('0xe')](_0x0d8b('0x19'),_0x196c0a);logger[_0x0d8b('0x11')](_0x0d8b('0x19'),_0x196c0a,JSON[_0x0d8b('0x13')](_0x5527d8));_0x24e8ed(_0x5527d8);})[_0x0d8b('0x18')](function(_0x30980c){logger[_0x0d8b('0x14')](_0x0d8b('0x19'),_0x30980c['message'],_0x196c0a);_0x5b709c(_0x143372[_0x0d8b('0x14')](0x1f4,_0x30980c[_0x0d8b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 7ed71cb..a8f0238 100644 --- a/server/api/openchannelMessage/openchannelMessage.socket.js +++ b/server/api/openchannelMessage/openchannelMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac4a=['save','remove','update','removeListener','./openchannelMessage.events'];(function(_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 +var _0xf4eb=['removeListener','register','./openchannelMessage.events'];(function(_0x1170e5,_0xc0e250){var _0x3ec902=function(_0x55b2a9){while(--_0x55b2a9){_0x1170e5['push'](_0x1170e5['shift']());}};_0x3ec902(++_0xc0e250);}(_0xf4eb,0xec));var _0xbf4e=function(_0x583976,_0x3b2a75){_0x583976=_0x583976-0x0;var _0x512d84=_0xf4eb[_0x583976];return _0x512d84;};'use strict';var OpenchannelMessageEvents=require(_0xbf4e('0x0'));var events=['save','remove','update'];function createListener(_0x5ed5b9,_0xbbbf01){return function(_0x49d80e){_0xbbbf01['emit'](_0x5ed5b9,_0x49d80e);};}function removeListener(_0x2e3070,_0x1c7606){return function(){OpenchannelMessageEvents[_0xbf4e('0x1')](_0x2e3070,_0x1c7606);};}exports[_0xbf4e('0x2')]=function(_0xa4dcf5){for(var _0x2fcfed=0x0,_0x15b99f=events['length'];_0x2fcfed<_0x15b99f;_0x2fcfed++){var _0x449d55=events[_0x2fcfed];var _0x5013c2=createListener('openchannelMessage:'+_0x449d55,_0xa4dcf5);OpenchannelMessageEvents['on'](_0x449d55,_0x5013c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index e7d2579..c58bb38 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 _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 +var _0x3dba=['getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','exports','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/:id/members'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3dba,0x73));var _0xa3db=function(_0xdb810a,_0x3007f8){_0xdb810a=_0xdb810a-0x0;var _0x3954ba=_0x3dba[_0xdb810a];return _0x3954ba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa3db('0x0'));var express=require(_0xa3db('0x1'));var router=express['Router']();var auth=require(_0xa3db('0x2'));var interaction=require(_0xa3db('0x3'));var config=require(_0xa3db('0x4'));var controller=require(_0xa3db('0x5'));router[_0xa3db('0x6')]('/',auth[_0xa3db('0x7')](),controller[_0xa3db('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xa3db('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa3db('0x6')](_0xa3db('0x9'),auth[_0xa3db('0x7')](),controller[_0xa3db('0xa')]);router[_0xa3db('0x6')](_0xa3db('0xb'),auth[_0xa3db('0x7')](),controller[_0xa3db('0xc')]);router[_0xa3db('0x6')]('/:id/users',auth[_0xa3db('0x7')](),controller[_0xa3db('0xd')]);router[_0xa3db('0xe')]('/',auth[_0xa3db('0x7')](),controller[_0xa3db('0xf')]);router[_0xa3db('0xe')]('/:id/teams',auth['isAuthenticated'](),controller[_0xa3db('0x10')]);router[_0xa3db('0xe')]('/:id/users',auth[_0xa3db('0x7')](),controller[_0xa3db('0x11')]);router[_0xa3db('0x12')](_0xa3db('0x13'),auth[_0xa3db('0x7')](),controller[_0xa3db('0x14')]);router[_0xa3db('0x15')](_0xa3db('0x13'),auth[_0xa3db('0x7')](),controller['destroy']);router['delete'](_0xa3db('0xb'),auth[_0xa3db('0x7')](),controller[_0xa3db('0x16')]);router[_0xa3db('0x15')]('/:id/users',auth[_0xa3db('0x7')](),controller[_0xa3db('0x17')]);module[_0xa3db('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index bb83209..4d704fd 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 _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 +var _0xcaaf=['ENUM','beepall','sequelize','STRING','INTEGER'];(function(_0x5db190,_0x4071a7){var _0x125edd=function(_0x2079d5){while(--_0x2079d5){_0x5db190['push'](_0x5db190['shift']());}};_0x125edd(++_0x4071a7);}(_0xcaaf,0x66));var _0xfcaa=function(_0x37297e,_0x43b567){_0x37297e=_0x37297e-0x0;var _0x114c61=_0xcaaf[_0x37297e];return _0x114c61;};'use strict';var Sequelize=require(_0xfcaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcaa('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xfcaa('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcaa('0x3')]('rrmemory',_0xfcaa('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d09180c..2b80d7e 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 _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 +var _0x6121=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','ids','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','crypto','jsforce'];(function(_0x3de6fc,_0x12b3a6){var _0x216284=function(_0x7f6fb0){while(--_0x7f6fb0){_0x3de6fc['push'](_0x3de6fc['shift']());}};_0x216284(++_0x12b3a6);}(_0x6121,0x116));var _0x1612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6121[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x1612('0x0'));var emlformat=require(_0x1612('0x1'));var rimraf=require(_0x1612('0x2'));var zipdir=require(_0x1612('0x3'));var jsonpatch=require(_0x1612('0x4'));var rp=require(_0x1612('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1612('0x6'));var util=require(_0x1612('0x7'));var path=require(_0x1612('0x8'));var sox=require(_0x1612('0x9'));var csv=require('to-csv');var ejs=require(_0x1612('0xa'));var fs=require('fs');var _=require(_0x1612('0xb'));var squel=require('squel');var crypto=require(_0x1612('0xc'));var jsforce=require(_0x1612('0xd'));var deskjs=require(_0x1612('0xe'));var toCsv=require(_0x1612('0xf'));var querystring=require(_0x1612('0x10'));var Papa=require(_0x1612('0x11'));var Redis=require(_0x1612('0x12'));var authService=require(_0x1612('0x13'));var qs=require(_0x1612('0x14'));var as=require(_0x1612('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1612('0x16'))(_0x1612('0x17'));var utils=require(_0x1612('0x18'));var config=require(_0x1612('0x19'));var licenseUtil=require(_0x1612('0x1a'));var db=require('../../mysqldb')['db'];config[_0x1612('0x1b')]=_[_0x1612('0x1c')](config[_0x1612('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1612('0x1b')]));require(_0x1612('0x1d'))[_0x1612('0x1e')](socket);function respondWithStatusCode(_0x56159a,_0x1ab54b){_0x1ab54b=_0x1ab54b||0xcc;return function(_0xcd5be){if(_0xcd5be){return _0x56159a[_0x1612('0x1f')](_0x1ab54b);}return _0x56159a[_0x1612('0x20')](_0x1ab54b)[_0x1612('0x21')]();};}function respondWithResult(_0x51b5eb,_0x2ac228){_0x2ac228=_0x2ac228||0xc8;return function(_0x25a8f1){if(_0x25a8f1){return _0x51b5eb[_0x1612('0x20')](_0x2ac228)[_0x1612('0x22')](_0x25a8f1);}};}function respondWithFilteredResult(_0x536922,_0xd171aa){return function(_0xfd3659){if(_0xfd3659){var _0x18a590=_0xfd3659[_0x1612('0x23')],_0x4dfcd2=_0xd171aa[_0x1612('0x24')],_0x390ba7=_0xd171aa[_0x1612('0x24')]+_0xd171aa[_0x1612('0x25')],_0x3708ac;if(_0x390ba7>=_0x18a590){_0x390ba7=_0x18a590;_0x3708ac=0xc8;}else{_0x3708ac=0xce;}_0x536922[_0x1612('0x20')](_0x3708ac);return _0x536922[_0x1612('0x26')](_0x1612('0x27'),_0x4dfcd2+'-'+_0x390ba7+'/'+_0x18a590)[_0x1612('0x22')](_0xfd3659);}return null;};}function patchUpdates(_0x15339e){return function(_0x28c5cb){try{jsonpatch[_0x1612('0x28')](_0x28c5cb,_0x15339e,!![]);}catch(_0x799eac){return BPromise[_0x1612('0x29')](_0x799eac);}return _0x28c5cb[_0x1612('0x2a')]();};}function saveUpdates(_0x50f0e1,_0x1a3f12){return function(_0x3a1699){if(_0x3a1699){return _0x3a1699[_0x1612('0x2b')](_0x50f0e1)[_0x1612('0x2c')](function(_0x26b296){return _0x26b296;});}return null;};}function removeEntity(_0x58b860,_0xcece65){return function(_0x255acb){if(_0x255acb){return _0x255acb[_0x1612('0x2d')]()[_0x1612('0x2c')](function(){var _0x2260dd=_0x255acb[_0x1612('0x2e')]({'plain':!![]});var _0x508c89='OpenchannelQueues';return db['UserProfileResource'][_0x1612('0x2d')]({'where':{'type':_0x508c89,'resourceId':_0x2260dd['id']}})[_0x1612('0x2c')](function(){return _0x255acb;});})[_0x1612('0x2c')](function(){_0x58b860[_0x1612('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd2646c,_0x302a05){return function(_0x45f613){if(!_0x45f613){_0xd2646c['sendStatus'](0x194);}return _0x45f613;};}function handleError(_0x1567d1,_0x4f7203){_0x4f7203=_0x4f7203||0x1f4;return function(_0x21eee6){logger[_0x1612('0x2f')](_0x21eee6['stack']);if(_0x21eee6[_0x1612('0x30')]){delete _0x21eee6[_0x1612('0x30')];}_0x1567d1[_0x1612('0x20')](_0x4f7203)[_0x1612('0x31')](_0x21eee6);};}exports[_0x1612('0x32')]=function(_0x44959f,_0x4f05a2){var _0x174127={},_0x99471f={},_0x403b5c={'count':0x0,'rows':[]};var _0x2bde50=_[_0x1612('0x33')](db[_0x1612('0x34')][_0x1612('0x35')],function(_0x264550){return{'name':_0x264550[_0x1612('0x36')],'type':_0x264550[_0x1612('0x37')][_0x1612('0x38')]};});_0x99471f[_0x1612('0x39')]=_[_0x1612('0x33')](_0x2bde50,_0x1612('0x30'));_0x99471f[_0x1612('0x3a')]=_['keys'](_0x44959f['query']);_0x99471f['filters']=_['intersection'](_0x99471f['model'],_0x99471f[_0x1612('0x3a')]);_0x174127[_0x1612('0x3b')]=_['intersection'](_0x99471f['model'],qs[_0x1612('0x3c')](_0x44959f[_0x1612('0x3a')]['fields']));_0x174127['attributes']=_0x174127['attributes'][_0x1612('0x3d')]?_0x174127['attributes']:_0x99471f['model'];if(!_0x44959f[_0x1612('0x3a')]['hasOwnProperty'](_0x1612('0x3e'))){_0x174127['limit']=qs[_0x1612('0x25')](_0x44959f[_0x1612('0x3a')][_0x1612('0x25')]);_0x174127[_0x1612('0x24')]=qs[_0x1612('0x24')](_0x44959f[_0x1612('0x3a')][_0x1612('0x24')]);}_0x174127['order']=qs['sort'](_0x44959f['query'][_0x1612('0x3f')]);_0x174127[_0x1612('0x40')]=qs[_0x1612('0x41')](_[_0x1612('0x42')](_0x44959f[_0x1612('0x3a')],_0x99471f['filters']),_0x2bde50);if(_0x44959f[_0x1612('0x3a')]['filter']){_0x174127['where']=_['merge'](_0x174127[_0x1612('0x40')],{'$or':_[_0x1612('0x33')](_0x2bde50,function(_0x565891){if(_0x565891[_0x1612('0x37')]!=='VIRTUAL'){var _0x600dce={};_0x600dce[_0x565891['name']]={'$like':'%'+_0x44959f['query'][_0x1612('0x43')]+'%'};return _0x600dce;}})});}_0x174127=_[_0x1612('0x44')]({},_0x174127,_0x44959f[_0x1612('0x45')]);var _0x43da09={'where':_0x174127[_0x1612('0x40')]};return db['OpenchannelQueue'][_0x1612('0x23')](_0x43da09)[_0x1612('0x2c')](function(_0x38d8d1){_0x403b5c[_0x1612('0x23')]=_0x38d8d1;if(_0x44959f[_0x1612('0x3a')][_0x1612('0x46')]){_0x174127[_0x1612('0x47')]=[{'all':!![]}];}return db[_0x1612('0x34')][_0x1612('0x48')](_0x174127);})[_0x1612('0x2c')](function(_0x15f2ed){_0x403b5c[_0x1612('0x49')]=_0x15f2ed;return _0x403b5c;})[_0x1612('0x2c')](respondWithFilteredResult(_0x4f05a2,_0x174127))[_0x1612('0x4a')](handleError(_0x4f05a2,null));};exports[_0x1612('0x4b')]=function(_0xb6bc33,_0x67d29b){var _0x500e0e={'raw':!![],'where':{'id':_0xb6bc33[_0x1612('0x4c')]['id']}},_0x32b162={};_0x32b162[_0x1612('0x39')]=_[_0x1612('0x4d')](db['OpenchannelQueue'][_0x1612('0x35')]);_0x32b162[_0x1612('0x3a')]=_['keys'](_0xb6bc33[_0x1612('0x3a')]);_0x32b162[_0x1612('0x41')]=_[_0x1612('0x4e')](_0x32b162[_0x1612('0x39')],_0x32b162[_0x1612('0x3a')]);_0x500e0e[_0x1612('0x3b')]=_[_0x1612('0x4e')](_0x32b162[_0x1612('0x39')],qs['fields'](_0xb6bc33[_0x1612('0x3a')][_0x1612('0x3c')]));_0x500e0e[_0x1612('0x3b')]=_0x500e0e['attributes'][_0x1612('0x3d')]?_0x500e0e[_0x1612('0x3b')]:_0x32b162[_0x1612('0x39')];if(_0xb6bc33[_0x1612('0x3a')][_0x1612('0x46')]){_0x500e0e[_0x1612('0x47')]=[{'all':!![]}];}_0x500e0e=_[_0x1612('0x44')]({},_0x500e0e,_0xb6bc33[_0x1612('0x45')]);return db[_0x1612('0x34')][_0x1612('0x4f')](_0x500e0e)[_0x1612('0x2c')](handleEntityNotFound(_0x67d29b,null))['then'](respondWithResult(_0x67d29b,null))['catch'](handleError(_0x67d29b,null));};exports[_0x1612('0x50')]=function(_0x1ddb42,_0x10b92c){return db[_0x1612('0x34')][_0x1612('0x50')](_0x1ddb42[_0x1612('0x51')],{})[_0x1612('0x2c')](function(_0x501523){var _0x38fa09=_0x1ddb42[_0x1612('0x52')]['get']({'plain':!![]});if(!_0x38fa09)throw new Error(_0x1612('0x53'));if(_0x38fa09[_0x1612('0x54')]==='user'){var _0x4f8bcc=_0x501523[_0x1612('0x2e')]({'plain':!![]});var _0xb4d2c6='OpenchannelQueues';return db[_0x1612('0x55')][_0x1612('0x4f')]({'where':{'name':_0xb4d2c6,'userProfileId':_0x38fa09[_0x1612('0x56')]},'raw':!![]})[_0x1612('0x2c')](function(_0x1932ee){if(_0x1932ee&&_0x1932ee['autoAssociation']===0x0){return db[_0x1612('0x57')]['create']({'name':_0x4f8bcc[_0x1612('0x30')],'resourceId':_0x4f8bcc['id'],'type':_0x1932ee['name'],'sectionId':_0x1932ee['id']},{})[_0x1612('0x2c')](function(){return _0x501523;});}else{return _0x501523;}})[_0x1612('0x4a')](function(_0x54f64c){logger[_0x1612('0x2f')](_0x1612('0x58'),_0x54f64c);throw _0x54f64c;});}return _0x501523;})[_0x1612('0x2c')](respondWithResult(_0x10b92c,0xc9))[_0x1612('0x4a')](handleError(_0x10b92c,null));};exports[_0x1612('0x2b')]=function(_0x20752c,_0x34c9de){if(_0x20752c[_0x1612('0x51')]['id']){delete _0x20752c[_0x1612('0x51')]['id'];}return db[_0x1612('0x34')][_0x1612('0x4f')]({'where':{'id':_0x20752c['params']['id']}})[_0x1612('0x2c')](handleEntityNotFound(_0x34c9de,null))['then'](saveUpdates(_0x20752c[_0x1612('0x51')],null))['then'](respondWithResult(_0x34c9de,null))[_0x1612('0x4a')](handleError(_0x34c9de,null));};exports[_0x1612('0x2d')]=function(_0xb65f22,_0x5dc48f){return db[_0x1612('0x34')]['find']({'where':{'id':_0xb65f22[_0x1612('0x4c')]['id']}})[_0x1612('0x2c')](handleEntityNotFound(_0x5dc48f,null))[_0x1612('0x2c')](removeEntity(_0x5dc48f,null))[_0x1612('0x4a')](handleError(_0x5dc48f,null));};exports[_0x1612('0x59')]=function(_0x304d57,_0x2ee407){return db[_0x1612('0x34')][_0x1612('0x59')]()[_0x1612('0x2c')](respondWithResult(_0x2ee407,null))[_0x1612('0x4a')](handleError(_0x2ee407,null));};exports[_0x1612('0x5a')]=function(_0x554b88,_0x5f138f,_0x2b702b){var _0x496204={'raw':!![],'where':{}},_0x48618d={},_0x12b81b;return db[_0x1612('0x34')][_0x1612('0x5b')]({'where':{'id':_0x554b88['params']['id']}})[_0x1612('0x2c')](handleEntityNotFound(_0x5f138f,null))[_0x1612('0x2c')](function(_0x368cc1){if(_0x368cc1){_0x12b81b=_0x368cc1[_0x1612('0x2e')]({'plain':!![]});_0x48618d[_0x1612('0x39')]=_[_0x1612('0x4d')](db[_0x1612('0x5c')][_0x1612('0x35')]);_0x48618d[_0x1612('0x3a')]=_[_0x1612('0x4d')](_0x554b88['query']);_0x48618d[_0x1612('0x41')]=_[_0x1612('0x4e')](_0x48618d[_0x1612('0x39')],_0x48618d[_0x1612('0x3a')]);_0x496204[_0x1612('0x3b')]=_[_0x1612('0x4e')](_0x48618d[_0x1612('0x39')],qs[_0x1612('0x3c')](_0x554b88[_0x1612('0x3a')]['fields']));_0x496204[_0x1612('0x3b')]=_0x496204['attributes'][_0x1612('0x3d')]?_0x496204[_0x1612('0x3b')]:_0x48618d[_0x1612('0x39')];if(!_0x554b88[_0x1612('0x3a')][_0x1612('0x5d')](_0x1612('0x3e'))){_0x496204[_0x1612('0x25')]=qs[_0x1612('0x25')](_0x554b88[_0x1612('0x3a')][_0x1612('0x25')]);_0x496204[_0x1612('0x24')]=qs[_0x1612('0x24')](_0x554b88[_0x1612('0x3a')][_0x1612('0x24')]);}_0x496204[_0x1612('0x5e')]=qs[_0x1612('0x3f')](_0x554b88['query'][_0x1612('0x3f')]);_0x496204['where']=qs[_0x1612('0x41')](_['pick'](_0x554b88['query'],_0x48618d[_0x1612('0x41')]));_0x496204[_0x1612('0x40')]['OpenchannelQueueId']=_0x368cc1['id'];if(_0x554b88['query'][_0x1612('0x43')]){_0x496204['where']=_['merge'](_0x496204['where'],{'$or':_[_0x1612('0x33')](_0x496204[_0x1612('0x3b')],function(_0x28bcde){var _0x5e779a={};_0x5e779a[_0x28bcde]={'$like':'%'+_0x554b88['query']['filter']+'%'};return _0x5e779a;})});}_0x496204=_['merge']({},_0x496204,_0x554b88[_0x1612('0x45')]);return db[_0x1612('0x5c')][_0x1612('0x48')](_0x496204);}})['then'](function(_0x52d40d){if(_0x52d40d){return db[_0x1612('0x5f')][_0x1612('0x60')]({'where':{'id':_[_0x1612('0x33')](_0x52d40d,_0x1612('0x61')),'role':_0x1612('0x62')},'attributes':['id',_0x1612('0x30'),_0x1612('0x63'),_0x1612('0x64'),_0x1612('0x65')]});}})[_0x1612('0x2c')](function(_0x2ec138){if(_0x2ec138){return{'count':_0x2ec138[_0x1612('0x23')],'rows':_[_0x1612('0x33')](_0x2ec138[_0x1612('0x49')],function(_0x2aacdb){return{'membername':_0x2aacdb[_0x1612('0x30')],'UserId':_0x2aacdb['id'],'queue_name':_0x12b81b['name'],'OpenchannelQueueId':_0x12b81b['id'],'interface':util[_0x1612('0x66')](_0x1612('0x67'),_0x1612('0x68'),_0x2aacdb[_0x1612('0x30')]),'penalty':0x0,'paused':_0x2aacdb['openchannelPause'],'createdAt':_0x2aacdb[_0x1612('0x65')],'updatedAt':_0x2aacdb[_0x1612('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1612('0x2c')](respondWithFilteredResult(_0x5f138f,_0x496204))[_0x1612('0x4a')](handleError(_0x5f138f,null));};exports[_0x1612('0x69')]=function(_0x8fbd3d,_0x1808c7,_0x658262){var _0x4124d4={};var _0x160e25={};var _0x170824;var _0x5622f9;return db[_0x1612('0x34')][_0x1612('0x5b')]({'where':{'id':_0x8fbd3d[_0x1612('0x4c')]['id']}})[_0x1612('0x2c')](handleEntityNotFound(_0x1808c7,null))[_0x1612('0x2c')](function(_0x44432c){if(_0x44432c){_0x170824=_0x44432c;_0x160e25[_0x1612('0x39')]=_['keys'](db[_0x1612('0x6a')][_0x1612('0x35')]);_0x160e25[_0x1612('0x3a')]=_[_0x1612('0x4d')](_0x8fbd3d[_0x1612('0x3a')]);_0x160e25[_0x1612('0x41')]=_[_0x1612('0x4e')](_0x160e25[_0x1612('0x39')],_0x160e25[_0x1612('0x3a')]);_0x4124d4[_0x1612('0x3b')]=_[_0x1612('0x4e')](_0x160e25[_0x1612('0x39')],qs['fields'](_0x8fbd3d[_0x1612('0x3a')][_0x1612('0x3c')]));_0x4124d4[_0x1612('0x3b')]=_0x4124d4['attributes'][_0x1612('0x3d')]?_0x4124d4[_0x1612('0x3b')]:_0x160e25[_0x1612('0x39')];_0x4124d4[_0x1612('0x5e')]=qs[_0x1612('0x3f')](_0x8fbd3d[_0x1612('0x3a')][_0x1612('0x3f')]);_0x4124d4['where']=qs['filters'](_[_0x1612('0x42')](_0x8fbd3d[_0x1612('0x3a')],_0x160e25['filters']));if(_0x8fbd3d[_0x1612('0x3a')][_0x1612('0x43')]){_0x4124d4[_0x1612('0x40')]=_['merge'](_0x4124d4[_0x1612('0x40')],{'$or':_[_0x1612('0x33')](_0x4124d4[_0x1612('0x3b')],function(_0x447b0c){var _0x32316f={};_0x32316f[_0x447b0c]={'$like':'%'+_0x8fbd3d[_0x1612('0x3a')][_0x1612('0x43')]+'%'};return _0x32316f;})});}_0x4124d4=_['merge']({},_0x4124d4,_0x8fbd3d['options']);return _0x170824[_0x1612('0x69')](_0x4124d4);}})['then'](function(_0x5e4e9e){if(_0x5e4e9e){_0x5622f9=_0x5e4e9e[_0x1612('0x3d')];if(!_0x8fbd3d['query'][_0x1612('0x5d')](_0x1612('0x3e'))){_0x4124d4[_0x1612('0x25')]=qs[_0x1612('0x25')](_0x8fbd3d['query'][_0x1612('0x25')]);_0x4124d4['offset']=qs[_0x1612('0x24')](_0x8fbd3d[_0x1612('0x3a')][_0x1612('0x24')]);}return _0x170824[_0x1612('0x69')](_0x4124d4);}})[_0x1612('0x2c')](function(_0xde7437){if(_0xde7437){return _0xde7437?{'count':_0x5622f9,'rows':_0xde7437}:null;}})[_0x1612('0x2c')](respondWithResult(_0x1808c7,null))[_0x1612('0x4a')](handleError(_0x1808c7,null));};exports['addTeams']=function(_0xb6477b,_0x2bf962,_0x18df42){var _0x487006=_0xb6477b['body']['ids'];return db['Team']['findAll']({'where':{'id':_0x487006},'attributes':['id'],'include':[{'model':db[_0x1612('0x5f')],'as':_0x1612('0x6b'),'attributes':['id',_0x1612('0x30'),_0x1612('0x6c'),_0x1612('0x6d'),_0x1612('0x6e')],'raw':!![]}]})[_0x1612('0x2c')](function(_0x308f90){if(_0x308f90){var _0x59fb48=_['flatMap'](_0x308f90,function(_0x24b291){var _0x48a380=_0x24b291[_0x1612('0x2e')]({'plain':!![]});return _0x48a380[_0x1612('0x6b')];});return db[_0x1612('0x34')][_0x1612('0x4f')]({'where':{'id':_0xb6477b[_0x1612('0x4c')]['id']}})['then'](function(_0x300095){return db[_0x1612('0x6f')][_0x1612('0x70')](function(_0x47fad5){return _0x300095[_0x1612('0x71')](_0x487006,{'transaction':_0x47fad5})[_0x1612('0x2c')](function(){return BPromise[_0x1612('0x72')](_0x59fb48,function(_0x31ee3b){return db[_0x1612('0x5c')][_0x1612('0x73')]({'where':{'UserId':_0x31ee3b['id'],'OpenchannelQueueId':_0xb6477b[_0x1612('0x4c')]['id']},'transaction':_0x47fad5});});})[_0x1612('0x2c')](function(){_0x59fb48[_0x1612('0x74')](function(_0x2423a6){socket[_0x1612('0x75')](_0x1612('0x76'),{'UserId':_0x2423a6['id'],'OpenchannelQueueId':_0x300095['id']});});});});});}})[_0x1612('0x2c')](respondWithStatusCode(_0x2bf962,null))[_0x1612('0x4a')](handleError(_0x2bf962,null));};exports['removeTeams']=function(_0x3089d3,_0xbdb31a,_0x5f407c){return db['Team']['findAll']({'where':{'id':_0x3089d3[_0x1612('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1612('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x1612('0x2c')](handleEntityNotFound(_0xbdb31a,null))[_0x1612('0x2c')](function(_0x36df00){var _0x53a624=_[_0x1612('0x33')](_0x36df00,'id');var _0x4709b1=[];var _0x1e5bbb=[];var _0x3eb22a=squel[_0x1612('0x77')]();_0x3eb22a[_0x1612('0x78')](_0x1612('0x79'))[_0x1612('0x7a')](_0x1612('0x7b'),'tq')[_0x1612('0x7c')](_0x1612('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1612('0x40')](_0x1612('0x7e'),_0x3089d3['params']['id']);for(var _0xe5fe2b=0x0;_0xe5fe2b<_0x36df00[_0x1612('0x3d')];_0xe5fe2b+=0x1){let _0x20dad7=_0x36df00[_0xe5fe2b];for(var _0x594b60=0x0;_0x594b60<_0x20dad7[_0x1612('0x6b')][_0x1612('0x3d')];_0x594b60+=0x1){let _0x145d9c=_0x20dad7[_0x1612('0x6b')][_0x594b60];var _0x2b33ba=_0x3eb22a[_0x1612('0x7f')]();_0x2b33ba[_0x1612('0x40')](_0x1612('0x80'),_0x145d9c['id']);_0x1e5bbb[_0x1612('0x81')](db['sequelize'][_0x1612('0x3a')](_0x2b33ba['toString'](),{'type':db[_0x1612('0x6f')][_0x1612('0x82')]['SELECT']})['then'](function(_0x239516){if(_0x239516[_0x1612('0x3d')]===0x1){return _0x145d9c['id'];}else{var _0x4f6e15=_[_0x1612('0x83')](_[_0x1612('0x33')](_0x239516,_0x1612('0x84')),function(_0x67b2a){return _[_0x1612('0x85')](_0x53a624,_0x67b2a);});if(_0x4f6e15){return _0x145d9c['id'];}}}));}}return BPromise[_0x1612('0x86')](_0x1e5bbb)[_0x1612('0x2c')](function(_0x3f59b4){_0x4709b1=_(_0x4709b1)[_0x1612('0x87')](_0x3f59b4)[_0x1612('0x88')]()[_0x1612('0x89')]();return db['OpenchannelQueue'][_0x1612('0x4f')]({'where':{'id':_0x3089d3['params']['id']}})[_0x1612('0x2c')](function(_0x4144b4){return db['sequelize'][_0x1612('0x70')](function(_0x4d87d5){return _0x4144b4[_0x1612('0x8a')](_0x3089d3[_0x1612('0x3a')][_0x1612('0x8b')],{'transaction':_0x4d87d5})[_0x1612('0x2c')](function(){if(!_['isEmpty'](_0x4709b1)){return _0x4144b4[_0x1612('0x8c')](_0x4709b1,{'transaction':_0x4d87d5});}})[_0x1612('0x2c')](function(){_0x4709b1['forEach'](function(_0xd9b054){socket[_0x1612('0x75')](_0x1612('0x8d'),{'UserId':_0xd9b054,'OpenchannelQueueId':_0x4144b4['id']});});});});});});})[_0x1612('0x2c')](respondWithStatusCode(_0xbdb31a,null))[_0x1612('0x4a')](handleError(_0xbdb31a,null));};exports[_0x1612('0x8e')]=function(_0x6536b9,_0x2e0efa,_0x21a819){return db['OpenchannelQueue']['find']({'where':{'id':_0x6536b9[_0x1612('0x4c')]['id']}})[_0x1612('0x2c')](handleEntityNotFound(_0x2e0efa,null))[_0x1612('0x2c')](function(_0x2e715e){if(_0x2e715e){return _0x2e715e[_0x1612('0x8e')](_0x6536b9[_0x1612('0x51')][_0x1612('0x8b')],_[_0x1612('0x8f')](_0x6536b9['body'],[_0x1612('0x8b'),'id'])||{})[_0x1612('0x90')](function(_0x18f986){for(var _0x2b8e33=0x0;_0x2b8e33<_0x6536b9[_0x1612('0x51')]['ids'][_0x1612('0x3d')];_0x2b8e33+=0x1){socket['emit'](_0x1612('0x76'),{'UserId':_0x6536b9['body'][_0x1612('0x8b')][_0x2b8e33],'OpenchannelQueueId':_0x6536b9[_0x1612('0x4c')]['id']});}return _0x18f986;});}})[_0x1612('0x2c')](respondWithResult(_0x2e0efa,null))['catch'](handleError(_0x2e0efa,null));};exports[_0x1612('0x8c')]=function(_0x21d214,_0x36df1b,_0x3989b9){return db['OpenchannelQueue'][_0x1612('0x4f')]({'where':{'id':_0x21d214['params']['id']}})['then'](handleEntityNotFound(_0x36df1b,null))[_0x1612('0x2c')](function(_0x2578d9){if(_0x2578d9){return _0x2578d9[_0x1612('0x8c')](_0x21d214['query']['ids'])[_0x1612('0x2c')](function(){if(_['isArray'](_0x21d214['query'][_0x1612('0x8b')])){for(var _0x5e2e3e=0x0;_0x5e2e3e<_0x21d214[_0x1612('0x3a')]['ids'][_0x1612('0x3d')];_0x5e2e3e+=0x1){socket[_0x1612('0x75')]('userOpenchannelQueue:remove',{'UserId':Number(_0x21d214[_0x1612('0x3a')][_0x1612('0x8b')][_0x5e2e3e]),'OpenchannelQueueId':Number(_0x21d214[_0x1612('0x4c')]['id'])});}}else{socket[_0x1612('0x75')](_0x1612('0x8d'),{'UserId':Number(_0x21d214['query'][_0x1612('0x8b')]),'OpenchannelQueueId':Number(_0x21d214[_0x1612('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x36df1b,null))[_0x1612('0x4a')](handleError(_0x36df1b,null));};exports[_0x1612('0x91')]=function(_0x58448c,_0x44e287,_0x136245){var _0x9d4fd9={};var _0x3080a8={};var _0x2cedef;var _0x209361;return db[_0x1612('0x34')]['findOne']({'where':{'id':_0x58448c['params']['id']}})['then'](handleEntityNotFound(_0x44e287,null))[_0x1612('0x2c')](function(_0x336cee){if(_0x336cee){_0x2cedef=_0x336cee;_0x3080a8[_0x1612('0x39')]=_[_0x1612('0x4d')](db[_0x1612('0x5f')]['rawAttributes']);_0x3080a8[_0x1612('0x3a')]=_[_0x1612('0x4d')](_0x58448c['query']);_0x3080a8[_0x1612('0x41')]=_[_0x1612('0x4e')](_0x3080a8[_0x1612('0x39')],_0x3080a8['query']);_0x9d4fd9[_0x1612('0x3b')]=_[_0x1612('0x4e')](_0x3080a8[_0x1612('0x39')],qs[_0x1612('0x3c')](_0x58448c[_0x1612('0x3a')][_0x1612('0x3c')]));_0x9d4fd9[_0x1612('0x3b')]=_0x9d4fd9[_0x1612('0x3b')][_0x1612('0x3d')]?_0x9d4fd9[_0x1612('0x3b')]:_0x3080a8[_0x1612('0x39')];_0x9d4fd9[_0x1612('0x5e')]=qs[_0x1612('0x3f')](_0x58448c[_0x1612('0x3a')]['sort']);_0x9d4fd9[_0x1612('0x40')]=qs['filters'](_[_0x1612('0x42')](_0x58448c[_0x1612('0x3a')],_0x3080a8[_0x1612('0x41')]));if(_0x58448c['query'][_0x1612('0x43')]){_0x9d4fd9[_0x1612('0x40')]=_[_0x1612('0x44')](_0x9d4fd9[_0x1612('0x40')],{'$or':_['map'](_0x9d4fd9['attributes'],function(_0x2f1bdd){var _0x11e9d2={};_0x11e9d2[_0x2f1bdd]={'$like':'%'+_0x58448c[_0x1612('0x3a')]['filter']+'%'};return _0x11e9d2;})});}_0x9d4fd9=_[_0x1612('0x44')]({},_0x9d4fd9,_0x58448c[_0x1612('0x45')]);return _0x2cedef[_0x1612('0x91')](_0x9d4fd9);}})['then'](function(_0x4dcc11){if(_0x4dcc11){_0x209361=_0x4dcc11[_0x1612('0x3d')];if(!_0x58448c[_0x1612('0x3a')][_0x1612('0x5d')]('nolimit')){_0x9d4fd9[_0x1612('0x25')]=qs['limit'](_0x58448c[_0x1612('0x3a')][_0x1612('0x25')]);_0x9d4fd9['offset']=qs['offset'](_0x58448c[_0x1612('0x3a')][_0x1612('0x24')]);}return _0x2cedef['getAgents'](_0x9d4fd9);}})[_0x1612('0x2c')](function(_0x5e0379){if(_0x5e0379){return _0x5e0379?{'count':_0x209361,'rows':_0x5e0379}:null;}})['then'](respondWithResult(_0x44e287,null))['catch'](handleError(_0x44e287,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 1f52343..35a42fc 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 _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 +var _0x1f59=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','OpenchannelQueue'];(function(_0x69da39,_0x588a40){var _0x5b84b1=function(_0x394adf){while(--_0x394adf){_0x69da39['push'](_0x69da39['shift']());}};_0x5b84b1(++_0x588a40);}(_0x1f59,0x1a5));var _0x91f5=function(_0x28f5a7,_0x57df28){_0x28f5a7=_0x28f5a7-0x0;var _0x32bc9c=_0x1f59[_0x28f5a7];return _0x32bc9c;};'use strict';var EventEmitter=require(_0x91f5('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x91f5('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x91f5('0x2')](0x0);var events={'afterCreate':_0x91f5('0x3'),'afterUpdate':_0x91f5('0x4'),'afterDestroy':_0x91f5('0x5')};function emitEvent(_0x3697e2){return function(_0x2d2017,_0x37430c,_0x195b82){OpenchannelQueueEvents[_0x91f5('0x6')](_0x3697e2+':'+_0x2d2017['id'],_0x2d2017);OpenchannelQueueEvents['emit'](_0x3697e2,_0x2d2017);_0x195b82(null);};}for(var e in events){if(events[_0x91f5('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x91f5('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 04c1d71..bd403bf 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 _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 +var _0x7129=['../../config/logger','api','bluebird','request-promise','rimraf','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','util'];(function(_0x14a7f9,_0x11e29e){var _0x58dc89=function(_0x2017ea){while(--_0x2017ea){_0x14a7f9['push'](_0x14a7f9['shift']());}};_0x58dc89(++_0x11e29e);}(_0x7129,0x99));var _0x9712=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7129[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x9712('0x0'));var logger=require(_0x9712('0x1'))(_0x9712('0x2'));var moment=require('moment');var BPromise=require(_0x9712('0x3'));var rp=require(_0x9712('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9712('0x5'));var config=require('../../config/environment');var attributes=require(_0x9712('0x6'));module[_0x9712('0x7')]=function(_0x5b94a0,_0x22bd66){return _0x5b94a0[_0x9712('0x8')](_0x9712('0x9'),attributes,{'tableName':_0x9712('0xa'),'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 f605153..8e4c562 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 _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 +var _0xbc55=['./openchannelQueue.socket','register','then','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','OpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','stringify','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','redis','localhost','socket.io-emitter'];(function(_0x1833cd,_0x369128){var _0x4360ac=function(_0x377337){while(--_0x377337){_0x1833cd['push'](_0x1833cd['shift']());}};_0x4360ac(++_0x369128);}(_0xbc55,0xd1));var _0x5bc5=function(_0x2c2911,_0x507026){_0x2c2911=_0x2c2911-0x0;var _0x32f829=_0xbc55[_0x2c2911];return _0x32f829;};'use strict';var _=require(_0x5bc5('0x0'));var util=require(_0x5bc5('0x1'));var moment=require(_0x5bc5('0x2'));var BPromise=require(_0x5bc5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bc5('0x4'));var db=require(_0x5bc5('0x5'))['db'];var utils=require(_0x5bc5('0x6'));var logger=require(_0x5bc5('0x7'))(_0x5bc5('0x8'));var config=require('../../config/environment');var jayson=require(_0x5bc5('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x5bc5('0xa')],{'host':_0x5bc5('0xb'),'port':0x18eb});var socket=require(_0x5bc5('0xc'))(new Redis(config[_0x5bc5('0xa')]));require(_0x5bc5('0xd'))[_0x5bc5('0xe')](socket);function respondWithRpcPromise(_0x2c637e,_0x4da027,_0x8ed66e){return new BPromise(function(_0x8b72d6,_0x81aef1){return client['request'](_0x2c637e,_0x8ed66e)[_0x5bc5('0xf')](function(_0x59eae3){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x4da027,_0x5bc5('0x10'));logger[_0x5bc5('0x11')](_0x5bc5('0x12'),_0x4da027,_0x5bc5('0x10'),JSON['stringify'](_0x59eae3));if(_0x59eae3[_0x5bc5('0x13')]){if(_0x59eae3[_0x5bc5('0x13')]['code']===0x1f4){logger[_0x5bc5('0x13')](_0x5bc5('0x14'),_0x4da027,_0x59eae3[_0x5bc5('0x13')]['message']);return _0x81aef1(_0x59eae3['error'][_0x5bc5('0x15')]);}logger['error'](_0x5bc5('0x14'),_0x4da027,_0x59eae3[_0x5bc5('0x13')][_0x5bc5('0x15')]);return _0x8b72d6(_0x59eae3[_0x5bc5('0x13')]['message']);}else{logger[_0x5bc5('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x4da027,_0x5bc5('0x10'));_0x8b72d6(_0x59eae3[_0x5bc5('0x17')][_0x5bc5('0x15')]);}})[_0x5bc5('0x18')](function(_0x1d44c9){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4da027,_0x1d44c9);_0x81aef1(_0x1d44c9);});});}exports[_0x5bc5('0x19')]=function(_0x523d15){var _0xe4b3cb=this;return new Promise(function(_0x3afa50,_0x432b3b){return db[_0x5bc5('0x1a')][_0x5bc5('0x1b')]({'raw':_0x523d15[_0x5bc5('0x1c')]?_0x523d15[_0x5bc5('0x1c')][_0x5bc5('0x1d')]===undefined?!![]:![]:!![],'where':_0x523d15[_0x5bc5('0x1c')]?_0x523d15[_0x5bc5('0x1c')][_0x5bc5('0x1e')]||null:null,'attributes':_0x523d15[_0x5bc5('0x1c')]?_0x523d15[_0x5bc5('0x1c')][_0x5bc5('0x1f')]||null:null,'limit':_0x523d15[_0x5bc5('0x1c')]?_0x523d15[_0x5bc5('0x1c')]['limit']||null:null,'include':_0x523d15[_0x5bc5('0x1c')]?_0x523d15[_0x5bc5('0x1c')][_0x5bc5('0x20')]?_['map'](_0x523d15[_0x5bc5('0x1c')]['include'],function(_0xb6cc10){return{'model':db[_0xb6cc10['model']],'as':_0xb6cc10['as'],'attributes':_0xb6cc10['attributes'],'include':_0xb6cc10['include']?_[_0x5bc5('0x21')](_0xb6cc10[_0x5bc5('0x20')],function(_0x53a561){return{'model':db[_0x53a561['model']],'as':_0x53a561['as'],'attributes':_0x53a561['attributes'],'include':_0x53a561['include']?_[_0x5bc5('0x21')](_0x53a561['include'],function(_0x437184){return{'model':db[_0x437184[_0x5bc5('0x22')]],'as':_0x437184['as'],'attributes':_0x437184[_0x5bc5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5bc5('0xf')](function(_0x3a2071){logger[_0x5bc5('0x16')](_0x5bc5('0x19'),_0x523d15);logger[_0x5bc5('0x11')](_0x5bc5('0x19'),_0x523d15,JSON[_0x5bc5('0x23')](_0x3a2071));_0x3afa50(_0x3a2071);})[_0x5bc5('0x18')](function(_0x58664a){logger[_0x5bc5('0x13')](_0x5bc5('0x19'),_0x58664a[_0x5bc5('0x15')],_0x523d15);_0x432b3b(_0xe4b3cb[_0x5bc5('0x13')](0x1f4,_0x58664a[_0x5bc5('0x15')]));});});};exports[_0x5bc5('0x24')]=function(_0x4819c8){var _0x3d201f=this;return new Promise(function(_0x433036,_0x26e29a){return db[_0x5bc5('0x1a')]['find']({'raw':_0x4819c8[_0x5bc5('0x1c')]?_0x4819c8[_0x5bc5('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x4819c8['options']?_0x4819c8[_0x5bc5('0x1c')]['where']||null:null,'attributes':_0x4819c8[_0x5bc5('0x1c')]?_0x4819c8[_0x5bc5('0x1c')][_0x5bc5('0x1f')]||null:null,'include':_0x4819c8[_0x5bc5('0x1c')]?_0x4819c8['options'][_0x5bc5('0x20')]?_[_0x5bc5('0x21')](_0x4819c8['options']['include'],function(_0x9d1174){return{'model':db[_0x9d1174[_0x5bc5('0x22')]],'as':_0x9d1174['as'],'attributes':_0x9d1174['attributes'],'include':_0x9d1174[_0x5bc5('0x20')]?_[_0x5bc5('0x21')](_0x9d1174[_0x5bc5('0x20')],function(_0x332f85){return{'model':db[_0x332f85[_0x5bc5('0x22')]],'as':_0x332f85['as'],'attributes':_0x332f85[_0x5bc5('0x1f')],'include':_0x332f85['include']?_[_0x5bc5('0x21')](_0x332f85[_0x5bc5('0x20')],function(_0x2dcefb){return{'model':db[_0x2dcefb[_0x5bc5('0x22')]],'as':_0x2dcefb['as'],'attributes':_0x2dcefb[_0x5bc5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5bc5('0xf')](function(_0x5a5390){logger[_0x5bc5('0x16')](_0x5bc5('0x24'),_0x4819c8);logger[_0x5bc5('0x11')](_0x5bc5('0x24'),_0x4819c8,JSON[_0x5bc5('0x23')](_0x5a5390));_0x433036(_0x5a5390);})[_0x5bc5('0x18')](function(_0xebaa5){logger['error'](_0x5bc5('0x24'),_0xebaa5['message'],_0x4819c8);_0x26e29a(_0x3d201f[_0x5bc5('0x13')](0x1f4,_0xebaa5[_0x5bc5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6cf6ea0..c06be2a 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 _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 +var _0xca92=['openchannelQueue:','./openchannelQueue.events','remove','update','emit','removeListener','register','length'];(function(_0x5bccc0,_0x59e3a4){var _0xfccf8b=function(_0x34e7bc){while(--_0x34e7bc){_0x5bccc0['push'](_0x5bccc0['shift']());}};_0xfccf8b(++_0x59e3a4);}(_0xca92,0xd9));var _0x2ca9=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xca92[_0x18f64a];return _0x44687f;};'use strict';var OpenchannelQueueEvents=require(_0x2ca9('0x0'));var events=['save',_0x2ca9('0x1'),_0x2ca9('0x2')];function createListener(_0x139784,_0x5acdc9){return function(_0x16d3d6){_0x5acdc9[_0x2ca9('0x3')](_0x139784,_0x16d3d6);};}function removeListener(_0x59707e,_0x2c3320){return function(){OpenchannelQueueEvents[_0x2ca9('0x4')](_0x59707e,_0x2c3320);};}exports[_0x2ca9('0x5')]=function(_0xa4b016){for(var _0x5973d1=0x0,_0x44b496=events[_0x2ca9('0x6')];_0x5973d1<_0x44b496;_0x5973d1++){var _0x2d11e7=events[_0x5973d1];var _0x30d1bc=createListener(_0x2ca9('0x7')+_0x2d11e7,_0xa4b016);OpenchannelQueueEvents['on'](_0x2d11e7,_0x30d1bc);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index f8fc15f..a476081 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 _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 +var _0x2d32=['post','create','put','update','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show'];(function(_0x37fa90,_0x196e37){var _0x3b1a92=function(_0x2a7ea8){while(--_0x2a7ea8){_0x37fa90['push'](_0x37fa90['shift']());}};_0x3b1a92(++_0x196e37);}(_0x2d32,0xcb));var _0x22d3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x2d32[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0x22d3('0x0'));var path=require(_0x22d3('0x1'));var timeout=require('connect-timeout');var express=require(_0x22d3('0x2'));var router=express['Router']();var auth=require(_0x22d3('0x3'));var interaction=require(_0x22d3('0x4'));var config=require(_0x22d3('0x5'));var controller=require(_0x22d3('0x6'));router[_0x22d3('0x7')]('/',auth['isAuthenticated'](),controller[_0x22d3('0x8')]);router[_0x22d3('0x7')](_0x22d3('0x9'),auth[_0x22d3('0xa')](),controller['describe']);router[_0x22d3('0x7')](_0x22d3('0xb'),auth[_0x22d3('0xa')](),controller[_0x22d3('0xc')]);router[_0x22d3('0xd')]('/',auth[_0x22d3('0xa')](),controller[_0x22d3('0xe')]);router[_0x22d3('0xf')](_0x22d3('0xb'),auth[_0x22d3('0xa')](),controller[_0x22d3('0x10')]);router['delete'](_0x22d3('0xb'),auth[_0x22d3('0xa')](),controller[_0x22d3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 30bf51b..4c58be0 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 _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 +var _0xa22a=['DATE','sequelize','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa22a,0xd3));var _0xaa22=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa22a[_0x3947c9];return _0x2e7871;};'use strict';var moment=require('moment');var Sequelize=require(_0xaa22('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xaa22('0x1')]},'joinAt':{'type':Sequelize[_0xaa22('0x2')]},'leaveAt':{'type':Sequelize[_0xaa22('0x2')]},'acceptAt':{'type':Sequelize[_0xaa22('0x2')]},'exitAt':{'type':Sequelize[_0xaa22('0x2')]},'reason':{'type':Sequelize[_0xaa22('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a9bd161..b8c3f6c 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 _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 +var _0xcc8d=['Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','limit','offset','order','pick','filter','where','merge','type','options','includeAll','include','rows','catch','params','keys','intersection','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xcc8d,0xbb));var _0xdcc8=function(_0x381d3c,_0x4bc7d0){_0x381d3c=_0x381d3c-0x0;var _0x12542e=_0xcc8d[_0x381d3c];return _0x12542e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdcc8('0x0'));var rimraf=require(_0xdcc8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdcc8('0x2'));var moment=require(_0xdcc8('0x3'));var BPromise=require(_0xdcc8('0x4'));var Mustache=require(_0xdcc8('0x5'));var util=require(_0xdcc8('0x6'));var path=require(_0xdcc8('0x7'));var sox=require(_0xdcc8('0x8'));var csv=require('to-csv');var ejs=require(_0xdcc8('0x9'));var fs=require('fs');var _=require(_0xdcc8('0xa'));var squel=require(_0xdcc8('0xb'));var crypto=require(_0xdcc8('0xc'));var jsforce=require(_0xdcc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdcc8('0xe'));var querystring=require(_0xdcc8('0xf'));var Papa=require(_0xdcc8('0x10'));var Redis=require(_0xdcc8('0x11'));var authService=require(_0xdcc8('0x12'));var qs=require(_0xdcc8('0x13'));var as=require(_0xdcc8('0x14'));var hardwareService=require(_0xdcc8('0x15'));var logger=require(_0xdcc8('0x16'))(_0xdcc8('0x17'));var utils=require(_0xdcc8('0x18'));var config=require(_0xdcc8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcc8('0x1a'))['db'];function respondWithStatusCode(_0x37d3c1,_0x5d5554){_0x5d5554=_0x5d5554||0xcc;return function(_0x2b658e){if(_0x2b658e){return _0x37d3c1[_0xdcc8('0x1b')](_0x5d5554);}return _0x37d3c1[_0xdcc8('0x1c')](_0x5d5554)[_0xdcc8('0x1d')]();};}function respondWithResult(_0x583375,_0xe19af5){_0xe19af5=_0xe19af5||0xc8;return function(_0x446b5c){if(_0x446b5c){return _0x583375['status'](_0xe19af5)[_0xdcc8('0x1e')](_0x446b5c);}};}function respondWithFilteredResult(_0x54541f,_0x5f599){return function(_0x3dfd45){if(_0x3dfd45){var _0xc04807=_0x3dfd45[_0xdcc8('0x1f')],_0x33f2e5=_0x5f599['offset'],_0xb28298=_0x5f599['offset']+_0x5f599['limit'],_0x12ace8;if(_0xb28298>=_0xc04807){_0xb28298=_0xc04807;_0x12ace8=0xc8;}else{_0x12ace8=0xce;}_0x54541f['status'](_0x12ace8);return _0x54541f['set'](_0xdcc8('0x20'),_0x33f2e5+'-'+_0xb28298+'/'+_0xc04807)['json'](_0x3dfd45);}return null;};}function patchUpdates(_0xd07622){return function(_0x249f47){try{jsonpatch[_0xdcc8('0x21')](_0x249f47,_0xd07622,!![]);}catch(_0x3ed906){return BPromise[_0xdcc8('0x22')](_0x3ed906);}return _0x249f47['save']();};}function saveUpdates(_0x4a34a0,_0x35ec9b){return function(_0x433aee){if(_0x433aee){return _0x433aee[_0xdcc8('0x23')](_0x4a34a0)[_0xdcc8('0x24')](function(_0x42631f){return _0x42631f;});}return null;};}function removeEntity(_0x25e9e6,_0x4122a6){return function(_0x3d4554){if(_0x3d4554){return _0x3d4554[_0xdcc8('0x25')]()[_0xdcc8('0x24')](function(){_0x25e9e6[_0xdcc8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5400f7,_0x552b11){return function(_0x5e8ccf){if(!_0x5e8ccf){_0x5400f7[_0xdcc8('0x1b')](0x194);}return _0x5e8ccf;};}function handleError(_0x252d1e,_0x2a3b05){_0x2a3b05=_0x2a3b05||0x1f4;return function(_0x289ee9){logger[_0xdcc8('0x26')](_0x289ee9[_0xdcc8('0x27')]);if(_0x289ee9[_0xdcc8('0x28')]){delete _0x289ee9[_0xdcc8('0x28')];}_0x252d1e[_0xdcc8('0x1c')](_0x2a3b05)[_0xdcc8('0x29')](_0x289ee9);};}exports['index']=function(_0x61100f,_0x938201){var _0x4eaddd={},_0x4b4900={},_0x301d74={'count':0x0,'rows':[]};var _0x4ba68f=_[_0xdcc8('0x2a')](db[_0xdcc8('0x2b')][_0xdcc8('0x2c')],function(_0x25e80d){return{'name':_0x25e80d[_0xdcc8('0x2d')],'type':_0x25e80d['type'][_0xdcc8('0x2e')]};});_0x4b4900[_0xdcc8('0x2f')]=_[_0xdcc8('0x2a')](_0x4ba68f,_0xdcc8('0x28'));_0x4b4900['query']=_['keys'](_0x61100f[_0xdcc8('0x30')]);_0x4b4900[_0xdcc8('0x31')]=_['intersection'](_0x4b4900[_0xdcc8('0x2f')],_0x4b4900['query']);_0x4eaddd[_0xdcc8('0x32')]=_['intersection'](_0x4b4900[_0xdcc8('0x2f')],qs['fields'](_0x61100f[_0xdcc8('0x30')][_0xdcc8('0x33')]));_0x4eaddd[_0xdcc8('0x32')]=_0x4eaddd['attributes'][_0xdcc8('0x34')]?_0x4eaddd['attributes']:_0x4b4900[_0xdcc8('0x2f')];if(!_0x61100f[_0xdcc8('0x30')]['hasOwnProperty']('nolimit')){_0x4eaddd['limit']=qs[_0xdcc8('0x35')](_0x61100f[_0xdcc8('0x30')][_0xdcc8('0x35')]);_0x4eaddd[_0xdcc8('0x36')]=qs[_0xdcc8('0x36')](_0x61100f[_0xdcc8('0x30')][_0xdcc8('0x36')]);}_0x4eaddd[_0xdcc8('0x37')]=qs['sort'](_0x61100f[_0xdcc8('0x30')]['sort']);_0x4eaddd['where']=qs[_0xdcc8('0x31')](_[_0xdcc8('0x38')](_0x61100f['query'],_0x4b4900[_0xdcc8('0x31')]),_0x4ba68f);if(_0x61100f['query'][_0xdcc8('0x39')]){_0x4eaddd[_0xdcc8('0x3a')]=_[_0xdcc8('0x3b')](_0x4eaddd[_0xdcc8('0x3a')],{'$or':_[_0xdcc8('0x2a')](_0x4ba68f,function(_0x5c702a){if(_0x5c702a[_0xdcc8('0x3c')]!=='VIRTUAL'){var _0x324c7c={};_0x324c7c[_0x5c702a['name']]={'$like':'%'+_0x61100f[_0xdcc8('0x30')][_0xdcc8('0x39')]+'%'};return _0x324c7c;}})});}_0x4eaddd=_[_0xdcc8('0x3b')]({},_0x4eaddd,_0x61100f[_0xdcc8('0x3d')]);var _0x54c73a={'where':_0x4eaddd[_0xdcc8('0x3a')]};return db[_0xdcc8('0x2b')][_0xdcc8('0x1f')](_0x54c73a)[_0xdcc8('0x24')](function(_0x5dd21c){_0x301d74[_0xdcc8('0x1f')]=_0x5dd21c;if(_0x61100f['query'][_0xdcc8('0x3e')]){_0x4eaddd[_0xdcc8('0x3f')]=[{'all':!![]}];}return db[_0xdcc8('0x2b')]['findAll'](_0x4eaddd);})[_0xdcc8('0x24')](function(_0x5ce1fe){_0x301d74[_0xdcc8('0x40')]=_0x5ce1fe;return _0x301d74;})[_0xdcc8('0x24')](respondWithFilteredResult(_0x938201,_0x4eaddd))[_0xdcc8('0x41')](handleError(_0x938201,null));};exports['show']=function(_0x1bb502,_0x4d5c6a){var _0x58645a={'raw':!![],'where':{'id':_0x1bb502[_0xdcc8('0x42')]['id']}},_0x54af4d={};_0x54af4d['model']=_[_0xdcc8('0x43')](db['OpenchannelQueueReport'][_0xdcc8('0x2c')]);_0x54af4d[_0xdcc8('0x30')]=_[_0xdcc8('0x43')](_0x1bb502[_0xdcc8('0x30')]);_0x54af4d[_0xdcc8('0x31')]=_[_0xdcc8('0x44')](_0x54af4d[_0xdcc8('0x2f')],_0x54af4d['query']);_0x58645a['attributes']=_[_0xdcc8('0x44')](_0x54af4d[_0xdcc8('0x2f')],qs[_0xdcc8('0x33')](_0x1bb502['query'][_0xdcc8('0x33')]));_0x58645a[_0xdcc8('0x32')]=_0x58645a['attributes']['length']?_0x58645a[_0xdcc8('0x32')]:_0x54af4d[_0xdcc8('0x2f')];if(_0x1bb502[_0xdcc8('0x30')]['includeAll']){_0x58645a[_0xdcc8('0x3f')]=[{'all':!![]}];}_0x58645a=_[_0xdcc8('0x3b')]({},_0x58645a,_0x1bb502[_0xdcc8('0x3d')]);return db[_0xdcc8('0x2b')][_0xdcc8('0x45')](_0x58645a)['then'](handleEntityNotFound(_0x4d5c6a,null))[_0xdcc8('0x24')](respondWithResult(_0x4d5c6a,null))[_0xdcc8('0x41')](handleError(_0x4d5c6a,null));};exports[_0xdcc8('0x46')]=function(_0x22a24d,_0x1c2173){return db[_0xdcc8('0x2b')][_0xdcc8('0x46')](_0x22a24d[_0xdcc8('0x47')],{})[_0xdcc8('0x24')](respondWithResult(_0x1c2173,0xc9))[_0xdcc8('0x41')](handleError(_0x1c2173,null));};exports[_0xdcc8('0x23')]=function(_0x34654d,_0x520e79){if(_0x34654d[_0xdcc8('0x47')]['id']){delete _0x34654d[_0xdcc8('0x47')]['id'];}return db['OpenchannelQueueReport'][_0xdcc8('0x45')]({'where':{'id':_0x34654d[_0xdcc8('0x42')]['id']}})[_0xdcc8('0x24')](handleEntityNotFound(_0x520e79,null))[_0xdcc8('0x24')](saveUpdates(_0x34654d['body'],null))[_0xdcc8('0x24')](respondWithResult(_0x520e79,null))[_0xdcc8('0x41')](handleError(_0x520e79,null));};exports[_0xdcc8('0x25')]=function(_0x13485d,_0x1fcf87){return db[_0xdcc8('0x2b')][_0xdcc8('0x45')]({'where':{'id':_0x13485d[_0xdcc8('0x42')]['id']}})['then'](handleEntityNotFound(_0x1fcf87,null))[_0xdcc8('0x24')](removeEntity(_0x1fcf87,null))[_0xdcc8('0x41')](handleError(_0x1fcf87,null));};exports[_0xdcc8('0x48')]=function(_0x1b0f58,_0x5b394c){return db[_0xdcc8('0x2b')][_0xdcc8('0x48')]()[_0xdcc8('0x24')](respondWithResult(_0x5b394c,null))['catch'](handleError(_0x5b394c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 32fdf3d..688221f 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 _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 +var _0x649b=['request-promise','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','uniqueid','../../config/logger','api'];(function(_0x1c9c24,_0x2a517b){var _0x349c69=function(_0x259ff7){while(--_0x259ff7){_0x1c9c24['push'](_0x1c9c24['shift']());}};_0x349c69(++_0x2a517b);}(_0x649b,0x166));var _0xb649=function(_0x15da14,_0x3b8014){_0x15da14=_0x15da14-0x0;var _0x5cf224=_0x649b[_0x15da14];return _0x5cf224;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb649('0x0'))(_0xb649('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb649('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb649('0x3'));var config=require(_0xb649('0x4'));var attributes=require(_0xb649('0x5'));module['exports']=function(_0x2e0402,_0x1d0a04){return _0x2e0402[_0xb649('0x6')]('OpenchannelQueueReport',attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb649('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9a11b74..9e517f7 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 _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 +var _0x59bb=['request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','body','where','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x3f99e0,_0x504666){var _0x2c539c=function(_0x54d546){while(--_0x54d546){_0x3f99e0['push'](_0x3f99e0['shift']());}};_0x2c539c(++_0x504666);}(_0x59bb,0x1e0));var _0xb59b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x59bb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb59b('0x0'));var util=require(_0xb59b('0x1'));var moment=require(_0xb59b('0x2'));var BPromise=require(_0xb59b('0x3'));var rs=require(_0xb59b('0x4'));var fs=require('fs');var Redis=require(_0xb59b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb59b('0x6'));var logger=require(_0xb59b('0x7'))(_0xb59b('0x8'));var config=require(_0xb59b('0x9'));var jayson=require(_0xb59b('0xa'));var client=jayson[_0xb59b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c2a02,_0x256da9,_0x23e2c7){return new BPromise(function(_0x1f01af,_0x21b048){return client[_0xb59b('0xc')](_0x2c2a02,_0x23e2c7)[_0xb59b('0xd')](function(_0x47d2cf){logger[_0xb59b('0xe')](_0xb59b('0xf'),_0x256da9,_0xb59b('0x10'));logger[_0xb59b('0x11')](_0xb59b('0x12'),_0x256da9,_0xb59b('0x10'),JSON[_0xb59b('0x13')](_0x47d2cf));if(_0x47d2cf['error']){if(_0x47d2cf[_0xb59b('0x14')]['code']===0x1f4){logger[_0xb59b('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x256da9,_0x47d2cf['error'][_0xb59b('0x15')]);return _0x21b048(_0x47d2cf['error'][_0xb59b('0x15')]);}logger[_0xb59b('0x14')](_0xb59b('0xf'),_0x256da9,_0x47d2cf[_0xb59b('0x14')][_0xb59b('0x15')]);return _0x1f01af(_0x47d2cf[_0xb59b('0x14')][_0xb59b('0x15')]);}else{logger[_0xb59b('0xe')](_0xb59b('0xf'),_0x256da9,_0xb59b('0x10'));_0x1f01af(_0x47d2cf['result'][_0xb59b('0x15')]);}})[_0xb59b('0x16')](function(_0x265909){logger[_0xb59b('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x256da9,_0x265909);_0x21b048(_0x265909);});});}exports[_0xb59b('0x17')]=function(_0x58f486){var _0x50c598=this;return new Promise(function(_0x5850f2,_0xf477d6){return db[_0xb59b('0x18')]['create'](_0x58f486['body'],{'raw':_0x58f486[_0xb59b('0x19')]?_0x58f486[_0xb59b('0x19')][_0xb59b('0x1a')]===undefined?!![]:![]:!![]})[_0xb59b('0xd')](function(_0x2b9cde){logger[_0xb59b('0xe')]('CreateOpenchannelQueueReport',_0x58f486);logger[_0xb59b('0x11')](_0xb59b('0x17'),_0x58f486,JSON[_0xb59b('0x13')](_0x2b9cde));_0x5850f2(_0x2b9cde);})[_0xb59b('0x16')](function(_0x41cc50){logger[_0xb59b('0x14')](_0xb59b('0x17'),_0x41cc50[_0xb59b('0x15')],_0x58f486);_0xf477d6(_0x50c598[_0xb59b('0x14')](0x1f4,_0x41cc50[_0xb59b('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x47841f){var _0x43fdcc=this;return new Promise(function(_0x5d3994,_0x31bda5){return db[_0xb59b('0x18')]['update'](_0x47841f[_0xb59b('0x1b')],{'raw':_0x47841f['options']?_0x47841f[_0xb59b('0x19')][_0xb59b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47841f[_0xb59b('0x19')]?_0x47841f[_0xb59b('0x19')][_0xb59b('0x1c')]||null:null,'attributes':_0x47841f[_0xb59b('0x19')]?_0x47841f[_0xb59b('0x19')]['attributes']||null:null,'limit':_0x47841f['options']?_0x47841f[_0xb59b('0x19')][_0xb59b('0x1d')]||null:null})['then'](function(_0x595b8d){logger[_0xb59b('0xe')](_0xb59b('0x1e'),_0x47841f);logger[_0xb59b('0x11')](_0xb59b('0x1e'),_0x47841f,JSON['stringify'](_0x595b8d));_0x5d3994(_0x595b8d);})[_0xb59b('0x16')](function(_0x16fdef){logger[_0xb59b('0x14')]('UpdateOpenchannelQueueReport',_0x16fdef['message'],_0x47841f);_0x31bda5(_0x43fdcc['error'](0x1f4,_0x16fdef[_0xb59b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 97f97ac..6730c4a 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(_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 +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x2c9b79,_0x7cf58b){var _0x265032=function(_0x188a92){while(--_0x188a92){_0x2c9b79['push'](_0x2c9b79['shift']());}};_0x265032(++_0x7cf58b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 beb6716..42ec282 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 _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 +var _0x3e64=['queue','DATE','NOW','sequelize','exports','STRING','ENUM','agent'];(function(_0xd73e25,_0x24965a){var _0x144066=function(_0x38b1c2){while(--_0x38b1c2){_0xd73e25['push'](_0xd73e25['shift']());}};_0x144066(++_0x24965a);}(_0x3e64,0x83));var _0x43e6=function(_0x92dda1,_0x5348ca){_0x92dda1=_0x92dda1-0x0;var _0x17dee2=_0x3e64[_0x92dda1];return _0x17dee2;};'use strict';var moment=require('moment');var Sequelize=require(_0x43e6('0x0'));module[_0x43e6('0x1')]={'uniqueid':{'type':Sequelize[_0x43e6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x43e6('0x3')]('account',_0x43e6('0x4'),_0x43e6('0x5')),'allowNull':![],'defaultValue':_0x43e6('0x5')},'transferredAt':{'type':Sequelize[_0x43e6('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x43e6('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 141bd79..6cef552 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 _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 +var _0x67ba=['../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','destroy','stack','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','find','catch','create','body','update','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x3ccb52,_0x486342){var _0x263d21=function(_0x2b81c7){while(--_0x2b81c7){_0x3ccb52['push'](_0x3ccb52['shift']());}};_0x263d21(++_0x486342);}(_0x67ba,0x144));var _0xa67b=function(_0x2a7e4f,_0xf0e943){_0x2a7e4f=_0x2a7e4f-0x0;var _0x182173=_0x67ba[_0x2a7e4f];return _0x182173;};'use strict';var pdf=require(_0xa67b('0x0'));var emlformat=require(_0xa67b('0x1'));var rimraf=require(_0xa67b('0x2'));var zipdir=require(_0xa67b('0x3'));var jsonpatch=require(_0xa67b('0x4'));var rp=require(_0xa67b('0x5'));var moment=require(_0xa67b('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa67b('0x7'));var path=require(_0xa67b('0x8'));var sox=require(_0xa67b('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa67b('0xa'));var squel=require('squel');var crypto=require(_0xa67b('0xb'));var jsforce=require(_0xa67b('0xc'));var deskjs=require(_0xa67b('0xd'));var toCsv=require(_0xa67b('0xe'));var querystring=require('querystring');var Papa=require(_0xa67b('0xf'));var Redis=require(_0xa67b('0x10'));var authService=require(_0xa67b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa67b('0x12'));var hardwareService=require(_0xa67b('0x13'));var logger=require('../../config/logger')(_0xa67b('0x14'));var utils=require('../../config/utils');var config=require(_0xa67b('0x15'));var licenseUtil=require(_0xa67b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b0754,_0x12680c){_0x12680c=_0x12680c||0xcc;return function(_0x3a155a){if(_0x3a155a){return _0x3b0754[_0xa67b('0x17')](_0x12680c);}return _0x3b0754['status'](_0x12680c)[_0xa67b('0x18')]();};}function respondWithResult(_0x17cce7,_0xb95585){_0xb95585=_0xb95585||0xc8;return function(_0x1a354c){if(_0x1a354c){return _0x17cce7[_0xa67b('0x19')](_0xb95585)[_0xa67b('0x1a')](_0x1a354c);}};}function respondWithFilteredResult(_0x266faa,_0x296d7e){return function(_0x5abd6c){if(_0x5abd6c){var _0x2b97c9=_0x5abd6c[_0xa67b('0x1b')],_0x10b3f4=_0x296d7e[_0xa67b('0x1c')],_0x2e2daa=_0x296d7e[_0xa67b('0x1c')]+_0x296d7e[_0xa67b('0x1d')],_0x37161f;if(_0x2e2daa>=_0x2b97c9){_0x2e2daa=_0x2b97c9;_0x37161f=0xc8;}else{_0x37161f=0xce;}_0x266faa[_0xa67b('0x19')](_0x37161f);return _0x266faa[_0xa67b('0x1e')](_0xa67b('0x1f'),_0x10b3f4+'-'+_0x2e2daa+'/'+_0x2b97c9)[_0xa67b('0x1a')](_0x5abd6c);}return null;};}function patchUpdates(_0x2a9b27){return function(_0x16dd67){try{jsonpatch[_0xa67b('0x20')](_0x16dd67,_0x2a9b27,!![]);}catch(_0x5b0d10){return BPromise['reject'](_0x5b0d10);}return _0x16dd67['save']();};}function saveUpdates(_0x43dd8d,_0x4ce2ef){return function(_0x50791a){if(_0x50791a){return _0x50791a['update'](_0x43dd8d)['then'](function(_0xa244a7){return _0xa244a7;});}return null;};}function removeEntity(_0xe23749,_0x6bb527){return function(_0xc700c0){if(_0xc700c0){return _0xc700c0[_0xa67b('0x21')]()['then'](function(){_0xe23749[_0xa67b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fdc11,_0x19eae7){return function(_0x473785){if(!_0x473785){_0x4fdc11[_0xa67b('0x17')](0x194);}return _0x473785;};}function handleError(_0x56a482,_0x182507){_0x182507=_0x182507||0x1f4;return function(_0x57ad19){logger['error'](_0x57ad19[_0xa67b('0x22')]);if(_0x57ad19[_0xa67b('0x23')]){delete _0x57ad19[_0xa67b('0x23')];}_0x56a482[_0xa67b('0x19')](_0x182507)[_0xa67b('0x24')](_0x57ad19);};}exports['index']=function(_0x3db3b9,_0x253a45){var _0x2c2007={},_0x5b9bc2={},_0x5ee4f7={'count':0x0,'rows':[]};var _0x5d77b0=_[_0xa67b('0x25')](db[_0xa67b('0x26')][_0xa67b('0x27')],function(_0x4a7613){return{'name':_0x4a7613[_0xa67b('0x28')],'type':_0x4a7613[_0xa67b('0x29')][_0xa67b('0x2a')]};});_0x5b9bc2['model']=_[_0xa67b('0x25')](_0x5d77b0,_0xa67b('0x23'));_0x5b9bc2['query']=_[_0xa67b('0x2b')](_0x3db3b9[_0xa67b('0x2c')]);_0x5b9bc2[_0xa67b('0x2d')]=_['intersection'](_0x5b9bc2[_0xa67b('0x2e')],_0x5b9bc2['query']);_0x2c2007[_0xa67b('0x2f')]=_[_0xa67b('0x30')](_0x5b9bc2[_0xa67b('0x2e')],qs['fields'](_0x3db3b9[_0xa67b('0x2c')][_0xa67b('0x31')]));_0x2c2007['attributes']=_0x2c2007['attributes'][_0xa67b('0x32')]?_0x2c2007[_0xa67b('0x2f')]:_0x5b9bc2[_0xa67b('0x2e')];if(!_0x3db3b9[_0xa67b('0x2c')]['hasOwnProperty'](_0xa67b('0x33'))){_0x2c2007[_0xa67b('0x1d')]=qs[_0xa67b('0x1d')](_0x3db3b9[_0xa67b('0x2c')][_0xa67b('0x1d')]);_0x2c2007['offset']=qs[_0xa67b('0x1c')](_0x3db3b9['query'][_0xa67b('0x1c')]);}_0x2c2007['order']=qs['sort'](_0x3db3b9[_0xa67b('0x2c')]['sort']);_0x2c2007[_0xa67b('0x34')]=qs[_0xa67b('0x2d')](_[_0xa67b('0x35')](_0x3db3b9[_0xa67b('0x2c')],_0x5b9bc2[_0xa67b('0x2d')]),_0x5d77b0);if(_0x3db3b9[_0xa67b('0x2c')][_0xa67b('0x36')]){_0x2c2007[_0xa67b('0x34')]=_[_0xa67b('0x37')](_0x2c2007[_0xa67b('0x34')],{'$or':_['map'](_0x5d77b0,function(_0x2c9264){if(_0x2c9264[_0xa67b('0x29')]!==_0xa67b('0x38')){var _0x1e9e1c={};_0x1e9e1c[_0x2c9264[_0xa67b('0x23')]]={'$like':'%'+_0x3db3b9[_0xa67b('0x2c')]['filter']+'%'};return _0x1e9e1c;}})});}_0x2c2007=_['merge']({},_0x2c2007,_0x3db3b9[_0xa67b('0x39')]);var _0x2a20d3={'where':_0x2c2007[_0xa67b('0x34')]};return db[_0xa67b('0x26')]['count'](_0x2a20d3)[_0xa67b('0x3a')](function(_0xcabcd3){_0x5ee4f7[_0xa67b('0x1b')]=_0xcabcd3;if(_0x3db3b9[_0xa67b('0x2c')][_0xa67b('0x3b')]){_0x2c2007[_0xa67b('0x3c')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xa67b('0x3d')](_0x2c2007);})[_0xa67b('0x3a')](function(_0xb87312){_0x5ee4f7[_0xa67b('0x3e')]=_0xb87312;return _0x5ee4f7;})[_0xa67b('0x3a')](respondWithFilteredResult(_0x253a45,_0x2c2007))['catch'](handleError(_0x253a45,null));};exports['show']=function(_0x4bb897,_0x423e56){var _0x4a36e9={'raw':!![],'where':{'id':_0x4bb897[_0xa67b('0x3f')]['id']}},_0x58d1ae={};_0x58d1ae[_0xa67b('0x2e')]=_[_0xa67b('0x2b')](db[_0xa67b('0x26')]['rawAttributes']);_0x58d1ae[_0xa67b('0x2c')]=_[_0xa67b('0x2b')](_0x4bb897['query']);_0x58d1ae[_0xa67b('0x2d')]=_['intersection'](_0x58d1ae[_0xa67b('0x2e')],_0x58d1ae['query']);_0x4a36e9[_0xa67b('0x2f')]=_['intersection'](_0x58d1ae[_0xa67b('0x2e')],qs[_0xa67b('0x31')](_0x4bb897[_0xa67b('0x2c')]['fields']));_0x4a36e9[_0xa67b('0x2f')]=_0x4a36e9[_0xa67b('0x2f')][_0xa67b('0x32')]?_0x4a36e9[_0xa67b('0x2f')]:_0x58d1ae['model'];if(_0x4bb897[_0xa67b('0x2c')]['includeAll']){_0x4a36e9[_0xa67b('0x3c')]=[{'all':!![]}];}_0x4a36e9=_[_0xa67b('0x37')]({},_0x4a36e9,_0x4bb897[_0xa67b('0x39')]);return db['OpenchannelTransferReport'][_0xa67b('0x40')](_0x4a36e9)[_0xa67b('0x3a')](handleEntityNotFound(_0x423e56,null))[_0xa67b('0x3a')](respondWithResult(_0x423e56,null))[_0xa67b('0x41')](handleError(_0x423e56,null));};exports['create']=function(_0x3c2485,_0x5d3adc){return db[_0xa67b('0x26')][_0xa67b('0x42')](_0x3c2485[_0xa67b('0x43')],{})['then'](respondWithResult(_0x5d3adc,0xc9))[_0xa67b('0x41')](handleError(_0x5d3adc,null));};exports[_0xa67b('0x44')]=function(_0x12a1ed,_0x233486){if(_0x12a1ed[_0xa67b('0x43')]['id']){delete _0x12a1ed[_0xa67b('0x43')]['id'];}return db[_0xa67b('0x26')][_0xa67b('0x40')]({'where':{'id':_0x12a1ed['params']['id']}})[_0xa67b('0x3a')](handleEntityNotFound(_0x233486,null))[_0xa67b('0x3a')](saveUpdates(_0x12a1ed[_0xa67b('0x43')],null))[_0xa67b('0x3a')](respondWithResult(_0x233486,null))['catch'](handleError(_0x233486,null));};exports[_0xa67b('0x21')]=function(_0x4f6ce5,_0x25fd5a){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4f6ce5[_0xa67b('0x3f')]['id']}})[_0xa67b('0x3a')](handleEntityNotFound(_0x25fd5a,null))[_0xa67b('0x3a')](removeEntity(_0x25fd5a,null))[_0xa67b('0x41')](handleError(_0x25fd5a,null));};exports['describe']=function(_0x19a844,_0x27b5ac){return db[_0xa67b('0x26')]['describe']()[_0xa67b('0x3a')](respondWithResult(_0x27b5ac,null))[_0xa67b('0x41')](handleError(_0x27b5ac,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7b98163..89b771f 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 _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 +var _0x767b=['./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x767b,0x14b));var _0xb767=function(_0x3965a3,_0x4fcebb){_0x3965a3=_0x3965a3-0x0;var _0x55f51d=_0x767b[_0x3965a3];return _0x55f51d;};'use strict';var _=require(_0xb767('0x0'));var util=require(_0xb767('0x1'));var logger=require('../../config/logger')(_0xb767('0x2'));var moment=require('moment');var BPromise=require(_0xb767('0x3'));var rp=require(_0xb767('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb767('0x5'));var config=require(_0xb767('0x6'));var attributes=require(_0xb767('0x7'));module[_0xb767('0x8')]=function(_0x448da4,_0x52252b){return _0x448da4[_0xb767('0x9')](_0xb767('0xa'),attributes,{'tableName':_0xb767('0xb'),'paranoid':![],'indexes':[{'name':_0xb767('0xc'),'fields':[_0xb767('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2272364..7f6a5aa 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 _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 +var _0x372b=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x372b,0x18a));var _0xb372=function(_0x4ffc96,_0x144b7d){_0x4ffc96=_0x4ffc96-0x0;var _0xb735ea=_0x372b[_0x4ffc96];return _0xb735ea;};'use strict';var _=require(_0xb372('0x0'));var util=require(_0xb372('0x1'));var moment=require('moment');var BPromise=require(_0xb372('0x2'));var rs=require(_0xb372('0x3'));var fs=require('fs');var Redis=require(_0xb372('0x4'));var db=require(_0xb372('0x5'))['db'];var utils=require(_0xb372('0x6'));var logger=require(_0xb372('0x7'))('rpc');var config=require(_0xb372('0x8'));var jayson=require(_0xb372('0x9'));var client=jayson[_0xb372('0xa')][_0xb372('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39c4ac,_0x3a83ed,_0x1a6925){return new BPromise(function(_0x6a7a15,_0xefe498){return client[_0xb372('0xc')](_0x39c4ac,_0x1a6925)[_0xb372('0xd')](function(_0xf42a9b){logger['info'](_0xb372('0xe'),_0x3a83ed,_0xb372('0xf'));logger['debug'](_0xb372('0x10'),_0x3a83ed,_0xb372('0xf'),JSON['stringify'](_0xf42a9b));if(_0xf42a9b[_0xb372('0x11')]){if(_0xf42a9b[_0xb372('0x11')][_0xb372('0x12')]===0x1f4){logger['error'](_0xb372('0xe'),_0x3a83ed,_0xf42a9b[_0xb372('0x11')][_0xb372('0x13')]);return _0xefe498(_0xf42a9b[_0xb372('0x11')][_0xb372('0x13')]);}logger[_0xb372('0x11')](_0xb372('0xe'),_0x3a83ed,_0xf42a9b['error'][_0xb372('0x13')]);return _0x6a7a15(_0xf42a9b[_0xb372('0x11')]['message']);}else{logger[_0xb372('0x14')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x3a83ed,_0xb372('0xf'));_0x6a7a15(_0xf42a9b[_0xb372('0x15')][_0xb372('0x13')]);}})[_0xb372('0x16')](function(_0x1704b6){logger['error'](_0xb372('0xe'),_0x3a83ed,_0x1704b6);_0xefe498(_0x1704b6);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 3723707..a687a2e 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 _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 +var _0x1f23=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x405541,_0x2945cc){var _0x194a1e=function(_0x46fffe){while(--_0x46fffe){_0x405541['push'](_0x405541['shift']());}};_0x194a1e(++_0x2945cc);}(_0x1f23,0x87));var _0x31f2=function(_0x1e80c6,_0x8bf9e3){_0x1e80c6=_0x1e80c6-0x0;var _0x4bea55=_0x1f23[_0x1e80c6];return _0x4bea55;};'use strict';var multer=require(_0x31f2('0x0'));var util=require(_0x31f2('0x1'));var path=require(_0x31f2('0x2'));var timeout=require(_0x31f2('0x3'));var express=require(_0x31f2('0x4'));var router=express[_0x31f2('0x5')]();var auth=require(_0x31f2('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x31f2('0x7'));router[_0x31f2('0x8')]('/',auth[_0x31f2('0x9')](),controller[_0x31f2('0xa')]);router[_0x31f2('0x8')](_0x31f2('0xb'),auth['isAuthenticated'](),controller[_0x31f2('0xc')]);router[_0x31f2('0xd')]('/',auth[_0x31f2('0x9')](),controller[_0x31f2('0xe')]);router[_0x31f2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x31f2('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x31f2('0x11')]);module[_0x31f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 290d6b1..f6205f2 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 _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 +var _0xc4a3=['exports','STRING','name','sequelize'];(function(_0x7f5614,_0x5717ac){var _0x3ddde5=function(_0x1a15b2){while(--_0x1a15b2){_0x7f5614['push'](_0x7f5614['shift']());}};_0x3ddde5(++_0x5717ac);}(_0xc4a3,0x7f));var _0x3c4a=function(_0x44aee0,_0x38cb22){_0x44aee0=_0x44aee0-0x0;var _0x4b877f=_0xc4a3[_0x44aee0];return _0x4b877f;};'use strict';var Sequelize=require(_0x3c4a('0x0'));module[_0x3c4a('0x1')]={'name':{'type':Sequelize[_0x3c4a('0x2')],'unique':_0x3c4a('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3c4a('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 27b40c1..a86e094 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 _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 +var _0x040c=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','Pauses','end','error','stack','name','send','Pause','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','update','params'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x040c,0x9e));var _0xc040=function(_0x5be399,_0x15e8c5){_0x5be399=_0x5be399-0x0;var _0x534bb0=_0x040c[_0x5be399];return _0x534bb0;};'use strict';var pdf=require(_0xc040('0x0'));var emlformat=require(_0xc040('0x1'));var rimraf=require(_0xc040('0x2'));var zipdir=require(_0xc040('0x3'));var jsonpatch=require(_0xc040('0x4'));var rp=require(_0xc040('0x5'));var moment=require('moment');var BPromise=require(_0xc040('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc040('0x7'));var sox=require('sox');var csv=require(_0xc040('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc040('0x9'));var squel=require('squel');var crypto=require(_0xc040('0xa'));var jsforce=require(_0xc040('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc040('0x8'));var querystring=require('querystring');var Papa=require(_0xc040('0xc'));var Redis=require(_0xc040('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc040('0xe'));var as=require(_0xc040('0xf'));var hardwareService=require(_0xc040('0x10'));var logger=require(_0xc040('0x11'))(_0xc040('0x12'));var utils=require(_0xc040('0x13'));var config=require(_0xc040('0x14'));var licenseUtil=require(_0xc040('0x15'));var db=require(_0xc040('0x16'))['db'];function respondWithStatusCode(_0xcc8b28,_0x2ad058){_0x2ad058=_0x2ad058||0xcc;return function(_0x4c2004){if(_0x4c2004){return _0xcc8b28['sendStatus'](_0x2ad058);}return _0xcc8b28[_0xc040('0x17')](_0x2ad058)['end']();};}function respondWithResult(_0x5f5734,_0x450f54){_0x450f54=_0x450f54||0xc8;return function(_0xe853f5){if(_0xe853f5){return _0x5f5734[_0xc040('0x17')](_0x450f54)[_0xc040('0x18')](_0xe853f5);}};}function respondWithFilteredResult(_0x12765b,_0x3dbc59){return function(_0xd5946c){if(_0xd5946c){var _0x44f2f7=_0xd5946c[_0xc040('0x19')],_0x2eaf1d=_0x3dbc59[_0xc040('0x1a')],_0x1ff166=_0x3dbc59[_0xc040('0x1a')]+_0x3dbc59[_0xc040('0x1b')],_0xe8a1c9;if(_0x1ff166>=_0x44f2f7){_0x1ff166=_0x44f2f7;_0xe8a1c9=0xc8;}else{_0xe8a1c9=0xce;}_0x12765b[_0xc040('0x17')](_0xe8a1c9);return _0x12765b[_0xc040('0x1c')](_0xc040('0x1d'),_0x2eaf1d+'-'+_0x1ff166+'/'+_0x44f2f7)[_0xc040('0x18')](_0xd5946c);}return null;};}function patchUpdates(_0x6743d9){return function(_0x215d30){try{jsonpatch[_0xc040('0x1e')](_0x215d30,_0x6743d9,!![]);}catch(_0x4a505e){return BPromise[_0xc040('0x1f')](_0x4a505e);}return _0x215d30[_0xc040('0x20')]();};}function saveUpdates(_0x1924f9,_0x4aab38){return function(_0x4c0904){if(_0x4c0904){return _0x4c0904['update'](_0x1924f9)[_0xc040('0x21')](function(_0x16add4){return _0x16add4;});}return null;};}function removeEntity(_0x19087b,_0x2bcc41){return function(_0x1979ea){if(_0x1979ea){return _0x1979ea[_0xc040('0x22')]()[_0xc040('0x21')](function(){var _0xeeb03e=_0x1979ea['get']({'plain':!![]});var _0x8aa534=_0xc040('0x23');return db['UserProfileResource'][_0xc040('0x22')]({'where':{'type':_0x8aa534,'resourceId':_0xeeb03e['id']}})[_0xc040('0x21')](function(){return _0x1979ea;});})[_0xc040('0x21')](function(){_0x19087b['status'](0xcc)[_0xc040('0x24')]();});}};}function handleEntityNotFound(_0x4faa9a,_0x18f50a){return function(_0x49b3e7){if(!_0x49b3e7){_0x4faa9a['sendStatus'](0x194);}return _0x49b3e7;};}function handleError(_0x55c7ca,_0x223c2d){_0x223c2d=_0x223c2d||0x1f4;return function(_0x599475){logger[_0xc040('0x25')](_0x599475[_0xc040('0x26')]);if(_0x599475[_0xc040('0x27')]){delete _0x599475[_0xc040('0x27')];}_0x55c7ca['status'](_0x223c2d)[_0xc040('0x28')](_0x599475);};}exports['index']=function(_0x504570,_0x55335e){var _0x5bdee1={},_0x27b14a={},_0x2e28a9={'count':0x0,'rows':[]};var _0x2b46e4=_['map'](db[_0xc040('0x29')]['rawAttributes'],function(_0x452359){return{'name':_0x452359['fieldName'],'type':_0x452359[_0xc040('0x2a')]['key']};});_0x27b14a[_0xc040('0x2b')]=_[_0xc040('0x2c')](_0x2b46e4,_0xc040('0x27'));_0x27b14a[_0xc040('0x2d')]=_[_0xc040('0x2e')](_0x504570[_0xc040('0x2d')]);_0x27b14a[_0xc040('0x2f')]=_[_0xc040('0x30')](_0x27b14a['model'],_0x27b14a[_0xc040('0x2d')]);_0x5bdee1[_0xc040('0x31')]=_['intersection'](_0x27b14a[_0xc040('0x2b')],qs[_0xc040('0x32')](_0x504570[_0xc040('0x2d')][_0xc040('0x32')]));_0x5bdee1[_0xc040('0x31')]=_0x5bdee1['attributes'][_0xc040('0x33')]?_0x5bdee1['attributes']:_0x27b14a[_0xc040('0x2b')];if(!_0x504570[_0xc040('0x2d')][_0xc040('0x34')](_0xc040('0x35'))){_0x5bdee1['limit']=qs['limit'](_0x504570[_0xc040('0x2d')][_0xc040('0x1b')]);_0x5bdee1[_0xc040('0x1a')]=qs[_0xc040('0x1a')](_0x504570['query'][_0xc040('0x1a')]);}_0x5bdee1['order']=qs['sort'](_0x504570[_0xc040('0x2d')][_0xc040('0x36')]);_0x5bdee1['where']=qs[_0xc040('0x2f')](_['pick'](_0x504570[_0xc040('0x2d')],_0x27b14a['filters']),_0x2b46e4);if(_0x504570[_0xc040('0x2d')][_0xc040('0x37')]){_0x5bdee1[_0xc040('0x38')]=_[_0xc040('0x39')](_0x5bdee1['where'],{'$or':_[_0xc040('0x2c')](_0x2b46e4,function(_0x48bb0b){if(_0x48bb0b[_0xc040('0x2a')]!==_0xc040('0x3a')){var _0x3d3fc0={};_0x3d3fc0[_0x48bb0b[_0xc040('0x27')]]={'$like':'%'+_0x504570['query'][_0xc040('0x37')]+'%'};return _0x3d3fc0;}})});}_0x5bdee1=_[_0xc040('0x39')]({},_0x5bdee1,_0x504570[_0xc040('0x3b')]);var _0x2b4438={'where':_0x5bdee1[_0xc040('0x38')]};return db['Pause']['count'](_0x2b4438)['then'](function(_0x52d601){_0x2e28a9[_0xc040('0x19')]=_0x52d601;if(_0x504570[_0xc040('0x2d')][_0xc040('0x3c')]){_0x5bdee1[_0xc040('0x3d')]=[{'all':!![]}];}return db[_0xc040('0x29')][_0xc040('0x3e')](_0x5bdee1);})[_0xc040('0x21')](function(_0x54c405){_0x2e28a9[_0xc040('0x3f')]=_0x54c405;return _0x2e28a9;})[_0xc040('0x21')](respondWithFilteredResult(_0x55335e,_0x5bdee1))[_0xc040('0x40')](handleError(_0x55335e,null));};exports[_0xc040('0x41')]=function(_0x4d3a90,_0x5351b0){var _0x47949c={'raw':!![],'where':{'id':_0x4d3a90['params']['id']}},_0x2b1a39={};_0x2b1a39['model']=_[_0xc040('0x2e')](db[_0xc040('0x29')][_0xc040('0x42')]);_0x2b1a39[_0xc040('0x2d')]=_['keys'](_0x4d3a90['query']);_0x2b1a39[_0xc040('0x2f')]=_[_0xc040('0x30')](_0x2b1a39[_0xc040('0x2b')],_0x2b1a39[_0xc040('0x2d')]);_0x47949c[_0xc040('0x31')]=_[_0xc040('0x30')](_0x2b1a39['model'],qs[_0xc040('0x32')](_0x4d3a90[_0xc040('0x2d')][_0xc040('0x32')]));_0x47949c[_0xc040('0x31')]=_0x47949c[_0xc040('0x31')][_0xc040('0x33')]?_0x47949c[_0xc040('0x31')]:_0x2b1a39['model'];if(_0x4d3a90['query']['includeAll']){_0x47949c[_0xc040('0x3d')]=[{'all':!![]}];}_0x47949c=_[_0xc040('0x39')]({},_0x47949c,_0x4d3a90['options']);return db[_0xc040('0x29')][_0xc040('0x43')](_0x47949c)[_0xc040('0x21')](handleEntityNotFound(_0x5351b0,null))[_0xc040('0x21')](respondWithResult(_0x5351b0,null))[_0xc040('0x40')](handleError(_0x5351b0,null));};exports[_0xc040('0x44')]=function(_0x140751,_0x152a8d){return db['Pause'][_0xc040('0x44')](_0x140751[_0xc040('0x45')],{})[_0xc040('0x21')](function(_0x5eb5cd){var _0x13cbf7=_0x140751[_0xc040('0x46')][_0xc040('0x47')]({'plain':!![]});if(!_0x13cbf7)throw new Error(_0xc040('0x48'));if(_0x13cbf7['role']===_0xc040('0x46')){var _0xfecd24=_0x5eb5cd[_0xc040('0x47')]({'plain':!![]});var _0x487ab3='Pauses';return db[_0xc040('0x49')]['find']({'where':{'name':_0x487ab3,'userProfileId':_0x13cbf7[_0xc040('0x4a')]},'raw':!![]})[_0xc040('0x21')](function(_0xce8942){if(_0xce8942&&_0xce8942[_0xc040('0x4b')]===0x0){return db[_0xc040('0x4c')][_0xc040('0x44')]({'name':_0xfecd24[_0xc040('0x27')],'resourceId':_0xfecd24['id'],'type':_0xce8942[_0xc040('0x27')],'sectionId':_0xce8942['id']},{})['then'](function(){return _0x5eb5cd;});}else{return _0x5eb5cd;}})['catch'](function(_0xe5e736){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe5e736);throw _0xe5e736;});}return _0x5eb5cd;})[_0xc040('0x21')](respondWithResult(_0x152a8d,0xc9))['catch'](handleError(_0x152a8d,null));};exports[_0xc040('0x4d')]=function(_0x456300,_0x1e081c){if(_0x456300[_0xc040('0x45')]['id']){delete _0x456300[_0xc040('0x45')]['id'];}return db['Pause'][_0xc040('0x43')]({'where':{'id':_0x456300[_0xc040('0x4e')]['id']}})[_0xc040('0x21')](handleEntityNotFound(_0x1e081c,null))['then'](saveUpdates(_0x456300['body'],null))[_0xc040('0x21')](respondWithResult(_0x1e081c,null))[_0xc040('0x40')](handleError(_0x1e081c,null));};exports[_0xc040('0x22')]=function(_0x5e7b36,_0x389840){return db[_0xc040('0x29')]['find']({'where':{'id':_0x5e7b36['params']['id']}})['then'](handleEntityNotFound(_0x389840,null))[_0xc040('0x21')](removeEntity(_0x389840,null))[_0xc040('0x40')](handleError(_0x389840,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index eef5f7e..0102dda 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 _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 +var _0xba38=['exports','define','Pause','tools_pauses','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./pause.attributes'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xba38,0x190));var _0x8ba3=function(_0x2b407c,_0x3d26fa){_0x2b407c=_0x2b407c-0x0;var _0x153c36=_0xba38[_0x2b407c];return _0x153c36;};'use strict';var _=require('lodash');var util=require(_0x8ba3('0x0'));var logger=require(_0x8ba3('0x1'))(_0x8ba3('0x2'));var moment=require('moment');var BPromise=require(_0x8ba3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ba3('0x4'));var rimraf=require(_0x8ba3('0x5'));var config=require(_0x8ba3('0x6'));var attributes=require(_0x8ba3('0x7'));module[_0x8ba3('0x8')]=function(_0x1d18b7,_0x3edeae){return _0x1d18b7[_0x8ba3('0x9')](_0x8ba3('0xa'),attributes,{'tableName':_0x8ba3('0xb'),'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 a3b0251..b3e6ede 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 _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 +var _0x1427=['model','info','catch','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Pause,\x20%s,\x20%s','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ShowPause','Pause','options','raw','where','attributes','include'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x1427,0x7b));var _0x7142=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1427[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7142('0x0'));var moment=require(_0x7142('0x1'));var BPromise=require(_0x7142('0x2'));var rs=require(_0x7142('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7142('0x4'));var logger=require('../../config/logger')(_0x7142('0x5'));var config=require(_0x7142('0x6'));var jayson=require(_0x7142('0x7'));var client=jayson[_0x7142('0x8')][_0x7142('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1885f8,_0x11218e,_0x23b83b){return new BPromise(function(_0x2dbbf5,_0x6a795d){return client[_0x7142('0xa')](_0x1885f8,_0x23b83b)[_0x7142('0xb')](function(_0x3c4634){logger['info'](_0x7142('0xc'),_0x11218e,'request\x20sent');logger[_0x7142('0xd')](_0x7142('0xe'),_0x11218e,_0x7142('0xf'),JSON[_0x7142('0x10')](_0x3c4634));if(_0x3c4634['error']){if(_0x3c4634[_0x7142('0x11')][_0x7142('0x12')]===0x1f4){logger[_0x7142('0x11')](_0x7142('0xc'),_0x11218e,_0x3c4634['error'][_0x7142('0x13')]);return _0x6a795d(_0x3c4634[_0x7142('0x11')][_0x7142('0x13')]);}logger[_0x7142('0x11')](_0x7142('0xc'),_0x11218e,_0x3c4634[_0x7142('0x11')][_0x7142('0x13')]);return _0x2dbbf5(_0x3c4634['error'][_0x7142('0x13')]);}else{logger['info']('Pause,\x20%s,\x20%s',_0x11218e,'request\x20sent');_0x2dbbf5(_0x3c4634['result'][_0x7142('0x13')]);}})['catch'](function(_0x50d5fc){logger['error'](_0x7142('0xc'),_0x11218e,_0x50d5fc);_0x6a795d(_0x50d5fc);});});}exports[_0x7142('0x14')]=function(_0x5bf4a1){var _0x294672=this;return new Promise(function(_0x203095,_0x135675){return db[_0x7142('0x15')]['find']({'raw':_0x5bf4a1[_0x7142('0x16')]?_0x5bf4a1[_0x7142('0x16')][_0x7142('0x17')]===undefined?!![]:![]:!![],'where':_0x5bf4a1[_0x7142('0x16')]?_0x5bf4a1[_0x7142('0x16')][_0x7142('0x18')]||null:null,'attributes':_0x5bf4a1[_0x7142('0x16')]?_0x5bf4a1[_0x7142('0x16')][_0x7142('0x19')]||null:null,'include':_0x5bf4a1['options']?_0x5bf4a1[_0x7142('0x16')][_0x7142('0x1a')]?_['map'](_0x5bf4a1[_0x7142('0x16')][_0x7142('0x1a')],function(_0x54920d){return{'model':db[_0x54920d[_0x7142('0x1b')]],'as':_0x54920d['as'],'attributes':_0x54920d[_0x7142('0x19')],'include':_0x54920d[_0x7142('0x1a')]?_['map'](_0x54920d[_0x7142('0x1a')],function(_0x3f9c6e){return{'model':db[_0x3f9c6e[_0x7142('0x1b')]],'as':_0x3f9c6e['as'],'attributes':_0x3f9c6e['attributes'],'include':_0x3f9c6e[_0x7142('0x1a')]?_['map'](_0x3f9c6e[_0x7142('0x1a')],function(_0x123123){return{'model':db[_0x123123[_0x7142('0x1b')]],'as':_0x123123['as'],'attributes':_0x123123[_0x7142('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7142('0xb')](function(_0xd27565){logger[_0x7142('0x1c')](_0x7142('0x14'),_0x5bf4a1);logger['debug'](_0x7142('0x14'),_0x5bf4a1,JSON['stringify'](_0xd27565));_0x203095(_0xd27565);})[_0x7142('0x1d')](function(_0x4a0f7f){logger[_0x7142('0x11')](_0x7142('0x14'),_0x4a0f7f['message'],_0x5bf4a1);_0x135675(_0x294672[_0x7142('0x11')](0x1f4,_0x4a0f7f[_0x7142('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index ad5c3ba..8b611c5 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 _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 +var _0xb136=['now','single','upload','post','put','update','delete','multer','util','connect-timeout','express','../../components/auth/service','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname'];(function(_0x594ca3,_0x34672e){var _0x54916e=function(_0x54e7fc){while(--_0x54e7fc){_0x594ca3['push'](_0x594ca3['shift']());}};_0x54916e(++_0x34672e);}(_0xb136,0x1c9));var _0x6b13=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb136[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x6b13('0x0'));var util=require(_0x6b13('0x1'));var path=require('path');var timeout=require(_0x6b13('0x2'));var express=require(_0x6b13('0x3'));var router=express['Router']();var auth=require(_0x6b13('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b13('0x5'));router[_0x6b13('0x6')]('/',auth[_0x6b13('0x7')](),controller['index']);router[_0x6b13('0x6')](_0x6b13('0x8'),controller[_0x6b13('0x9')]);router[_0x6b13('0x6')](_0x6b13('0xa'),auth['isAuthenticated'](),controller[_0x6b13('0xb')]);router[_0x6b13('0x6')](_0x6b13('0xc'),auth['isAuthenticated'](),controller[_0x6b13('0xd')]);var upload=multer({'storage':multer[_0x6b13('0xe')]({'destination':function(_0x20ca83,_0x1a2dff,_0x43f7de){_0x43f7de(null,path[_0x6b13('0xf')](config[_0x6b13('0x10')],_0x6b13('0x11')));},'filename':function(_0x2dd12b,_0x533e10,_0x21c298){_0x533e10[_0x6b13('0x12')]=_0x533e10['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x21c298(null,util[_0x6b13('0x13')](_0x6b13('0x14'),path[_0x6b13('0x15')](_0x533e10[_0x6b13('0x12')],path[_0x6b13('0x16')](_0x533e10[_0x6b13('0x12')])),Date[_0x6b13('0x17')](),path[_0x6b13('0x16')](_0x533e10['originalname'])));}})});router['post']('/',upload[_0x6b13('0x18')]('file'),controller[_0x6b13('0x19')]);router[_0x6b13('0x1a')](_0x6b13('0x8'),controller['webhookPost']);router[_0x6b13('0x1b')](_0x6b13('0xa'),auth[_0x6b13('0x7')](),controller[_0x6b13('0x1c')]);router['delete'](_0x6b13('0xa'),auth[_0x6b13('0x7')](),controller[_0x6b13('0x1d')]);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 bece727..ee694ee 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 _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 +var _0x4a09=['ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING'];(function(_0x18522c,_0xa0b1fe){var _0x25f4f3=function(_0x5d5cd5){while(--_0x5d5cd5){_0x18522c['push'](_0x18522c['shift']());}};_0x25f4f3(++_0xa0b1fe);}(_0x4a09,0x106));var _0x94a0=function(_0x22be88,_0x715d8e){_0x22be88=_0x22be88-0x0;var _0x258938=_0x4a09[_0x22be88];return _0x258938;};'use strict';var Sequelize=require('sequelize');module[_0x94a0('0x0')]={'name':{'type':Sequelize[_0x94a0('0x1')]},'type':{'type':Sequelize[_0x94a0('0x2')](_0x94a0('0x3'),_0x94a0('0x4'))},'description':{'type':Sequelize[_0x94a0('0x5')]},'version':{'type':Sequelize[_0x94a0('0x5')]},'path':{'type':Sequelize[_0x94a0('0x1')],'comment':_0x94a0('0x6')},'active':{'type':Sequelize[_0x94a0('0x7')],'defaultValue':0x0,'comment':_0x94a0('0x8')},'sidebar':{'type':Sequelize[_0x94a0('0x2')]('adminOnly','agentOnly',_0x94a0('0x9'),_0x94a0('0xa')),'defaultValue':'always','comment':_0x94a0('0xb')},'icon':{'type':Sequelize[_0x94a0('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x94a0('0x1')]},'scriptName':{'type':Sequelize[_0x94a0('0x1')]},'scriptPath':{'type':Sequelize[_0x94a0('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 49654cd..1e23ff6 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 _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 +var _0x2a52=['destroy','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','find','download','join','root','server/files/plugins','format','basename','path','createWriteStream','zip','warning','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error','Plugin\x20not\x20found','%s.zip','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','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','parameters','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','method','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','querystring','archiver','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','then','get','Plugins','UserProfileResource'];(function(_0xbf2164,_0x5af147){var _0x3f10a2=function(_0x3d324d){while(--_0x3d324d){_0xbf2164['push'](_0xbf2164['shift']());}};_0x3f10a2(++_0x5af147);}(_0x2a52,0x80));var _0x22a5=function(_0x4571e2,_0x5f4b3e){_0x4571e2=_0x4571e2-0x0;var _0x23df0=_0x2a52[_0x4571e2];return _0x23df0;};'use strict';var pdf=require(_0x22a5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x22a5('0x1'));var zipdir=require(_0x22a5('0x2'));var jsonpatch=require(_0x22a5('0x3'));var rp=require(_0x22a5('0x4'));var moment=require(_0x22a5('0x5'));var BPromise=require(_0x22a5('0x6'));var Mustache=require('mustache');var util=require(_0x22a5('0x7'));var path=require('path');var sox=require(_0x22a5('0x8'));var csv=require(_0x22a5('0x9'));var ejs=require(_0x22a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x22a5('0xb'));var jsforce=require(_0x22a5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x22a5('0xd'));var Papa=require('papaparse');var extract=require('extract-zip');var rimraf=require(_0x22a5('0x1'));var archiver=require(_0x22a5('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x22a5('0xf'));var hardwareService=require(_0x22a5('0x10'));var logger=require(_0x22a5('0x11'))(_0x22a5('0x12'));var utils=require(_0x22a5('0x13'));var config=require(_0x22a5('0x14'));var licenseUtil=require(_0x22a5('0x15'));var db=require('../../mysqldb')['db'];config[_0x22a5('0x16')]=_[_0x22a5('0x17')](config[_0x22a5('0x16')],{'host':_0x22a5('0x18'),'port':0x18eb});var socket=require(_0x22a5('0x19'))(new Redis(config['redis']));require(_0x22a5('0x1a'))[_0x22a5('0x1b')](socket);function respondWithStatusCode(_0x58b817,_0x2e40c4){_0x2e40c4=_0x2e40c4||0xcc;return function(_0x1076a2){if(_0x1076a2){return _0x58b817[_0x22a5('0x1c')](_0x2e40c4);}return _0x58b817[_0x22a5('0x1d')](_0x2e40c4)[_0x22a5('0x1e')]();};}function respondWithResult(_0x497725,_0x2ab40a){_0x2ab40a=_0x2ab40a||0xc8;return function(_0x203475){if(_0x203475){return _0x497725['status'](_0x2ab40a)[_0x22a5('0x1f')](_0x203475);}};}function respondWithFilteredResult(_0x52a174,_0x3c4ea8){return function(_0x201d1d){if(_0x201d1d){var _0x2b0723=_0x201d1d['count'],_0x39445f=_0x3c4ea8['offset'],_0x49aa0a=_0x3c4ea8[_0x22a5('0x20')]+_0x3c4ea8[_0x22a5('0x21')],_0x447bad;if(_0x49aa0a>=_0x2b0723){_0x49aa0a=_0x2b0723;_0x447bad=0xc8;}else{_0x447bad=0xce;}_0x52a174[_0x22a5('0x1d')](_0x447bad);return _0x52a174[_0x22a5('0x22')]('Content-Range',_0x39445f+'-'+_0x49aa0a+'/'+_0x2b0723)[_0x22a5('0x1f')](_0x201d1d);}return null;};}function patchUpdates(_0x221fe6){return function(_0x368529){try{jsonpatch[_0x22a5('0x23')](_0x368529,_0x221fe6,!![]);}catch(_0xfecbff){return BPromise[_0x22a5('0x24')](_0xfecbff);}return _0x368529[_0x22a5('0x25')]();};}function saveUpdates(_0x195e16,_0x14fbec){return function(_0x29d1d9){if(_0x29d1d9){return _0x29d1d9[_0x22a5('0x26')](_0x195e16)[_0x22a5('0x27')](function(_0x2e2fab){return _0x2e2fab;});}return null;};}function removeEntity(_0x23696d,_0x2dab2c){return function(_0x55281d){if(_0x55281d){return _0x55281d['destroy']()['then'](function(){var _0xee0bfb=_0x55281d[_0x22a5('0x28')]({'plain':!![]});var _0xc1ef7=_0x22a5('0x29');return db[_0x22a5('0x2a')][_0x22a5('0x2b')]({'where':{'type':_0xc1ef7,'resourceId':_0xee0bfb['id']}})[_0x22a5('0x27')](function(){return _0x55281d;});})[_0x22a5('0x27')](function(){_0x23696d[_0x22a5('0x1d')](0xcc)[_0x22a5('0x1e')]();});}};}function handleEntityNotFound(_0xb54a45,_0x74f2c8){return function(_0x35edf6){if(!_0x35edf6){_0xb54a45[_0x22a5('0x1c')](0x194);}return _0x35edf6;};}function handleError(_0x1b6756,_0x334c23){_0x334c23=_0x334c23||0x1f4;return function(_0x1c66df){logger[_0x22a5('0x2c')](_0x1c66df[_0x22a5('0x2d')]);if(_0x1c66df[_0x22a5('0x2e')]){delete _0x1c66df[_0x22a5('0x2e')];}_0x1b6756[_0x22a5('0x1d')](_0x334c23)[_0x22a5('0x2f')](_0x1c66df);};}exports[_0x22a5('0x30')]=function(_0x694139,_0x487a21){var _0x3ff121={},_0x8b17ed={},_0x2cb824={'count':0x0,'rows':[]};var _0x3623f1=_[_0x22a5('0x31')](db[_0x22a5('0x32')][_0x22a5('0x33')],function(_0x3ea8ba){return{'name':_0x3ea8ba[_0x22a5('0x34')],'type':_0x3ea8ba[_0x22a5('0x35')][_0x22a5('0x36')]};});_0x8b17ed['model']=_[_0x22a5('0x31')](_0x3623f1,_0x22a5('0x2e'));_0x8b17ed['query']=_[_0x22a5('0x37')](_0x694139['query']);_0x8b17ed[_0x22a5('0x38')]=_[_0x22a5('0x39')](_0x8b17ed[_0x22a5('0x3a')],_0x8b17ed[_0x22a5('0x3b')]);_0x3ff121['attributes']=_[_0x22a5('0x39')](_0x8b17ed[_0x22a5('0x3a')],qs[_0x22a5('0x3c')](_0x694139['query'][_0x22a5('0x3c')]));_0x3ff121[_0x22a5('0x3d')]=_0x3ff121[_0x22a5('0x3d')][_0x22a5('0x3e')]?_0x3ff121[_0x22a5('0x3d')]:_0x8b17ed[_0x22a5('0x3a')];if(!_0x694139[_0x22a5('0x3b')][_0x22a5('0x3f')](_0x22a5('0x40'))){_0x3ff121[_0x22a5('0x21')]=qs[_0x22a5('0x21')](_0x694139[_0x22a5('0x3b')][_0x22a5('0x21')]);_0x3ff121[_0x22a5('0x20')]=qs[_0x22a5('0x20')](_0x694139[_0x22a5('0x3b')][_0x22a5('0x20')]);}_0x3ff121[_0x22a5('0x41')]=qs[_0x22a5('0x42')](_0x694139[_0x22a5('0x3b')][_0x22a5('0x42')]);_0x3ff121[_0x22a5('0x43')]=qs[_0x22a5('0x38')](_[_0x22a5('0x44')](_0x694139[_0x22a5('0x3b')],_0x8b17ed[_0x22a5('0x38')]),_0x3623f1);if(_0x694139[_0x22a5('0x3b')][_0x22a5('0x45')]){_0x3ff121[_0x22a5('0x43')]=_[_0x22a5('0x46')](_0x3ff121[_0x22a5('0x43')],{'$or':_[_0x22a5('0x31')](_0x3623f1,function(_0xc5e893){if(_0xc5e893['type']!==_0x22a5('0x47')){var _0x55febb={};_0x55febb[_0xc5e893[_0x22a5('0x2e')]]={'$like':'%'+_0x694139[_0x22a5('0x3b')]['filter']+'%'};return _0x55febb;}})});}_0x3ff121=_[_0x22a5('0x46')]({},_0x3ff121,_0x694139[_0x22a5('0x48')]);var _0x28480a={'where':_0x3ff121[_0x22a5('0x43')]};return db[_0x22a5('0x32')]['count'](_0x28480a)[_0x22a5('0x27')](function(_0x3666be){_0x2cb824[_0x22a5('0x49')]=_0x3666be;if(_0x694139['query'][_0x22a5('0x4a')]){_0x3ff121[_0x22a5('0x4b')]=[{'all':!![]}];}return db[_0x22a5('0x32')]['findAll'](_0x3ff121);})[_0x22a5('0x27')](function(_0x3ca5bf){_0x2cb824['rows']=_0x3ca5bf;return _0x2cb824;})[_0x22a5('0x27')](respondWithFilteredResult(_0x487a21,_0x3ff121))[_0x22a5('0x4c')](handleError(_0x487a21,null));};exports[_0x22a5('0x4d')]=function(_0x488d72,_0x4d927e){var _0x563f8e={'raw':!![],'where':{'id':_0x488d72[_0x22a5('0x4e')]['id']}},_0x52f937={};_0x52f937[_0x22a5('0x3a')]=_['keys'](db[_0x22a5('0x32')][_0x22a5('0x33')]);_0x52f937['query']=_[_0x22a5('0x37')](_0x488d72[_0x22a5('0x3b')]);_0x52f937[_0x22a5('0x38')]=_[_0x22a5('0x39')](_0x52f937[_0x22a5('0x3a')],_0x52f937[_0x22a5('0x3b')]);_0x563f8e['attributes']=_[_0x22a5('0x39')](_0x52f937[_0x22a5('0x3a')],qs[_0x22a5('0x3c')](_0x488d72[_0x22a5('0x3b')][_0x22a5('0x3c')]));_0x563f8e[_0x22a5('0x3d')]=_0x563f8e[_0x22a5('0x3d')][_0x22a5('0x3e')]?_0x563f8e[_0x22a5('0x3d')]:_0x52f937['model'];if(_0x488d72[_0x22a5('0x3b')][_0x22a5('0x4a')]){_0x563f8e[_0x22a5('0x4b')]=[{'all':!![]}];}_0x563f8e=_[_0x22a5('0x46')]({},_0x563f8e,_0x488d72[_0x22a5('0x48')]);return db[_0x22a5('0x32')][_0x22a5('0x4f')](_0x563f8e)[_0x22a5('0x27')](handleEntityNotFound(_0x4d927e,null))[_0x22a5('0x27')](respondWithResult(_0x4d927e,null))['catch'](handleError(_0x4d927e,null));};exports[_0x22a5('0x50')]=function(_0x5a0166,_0x360cb7,_0x6a88ab){return db[_0x22a5('0x32')][_0x22a5('0x4f')]({'where':{'id':_0x5a0166[_0x22a5('0x4e')]['id']},'attributes':[_0x22a5('0x2e'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x360cb7,null))[_0x22a5('0x27')](function(_0x108619){if(_0x108619){var _0x380066=path[_0x22a5('0x51')](config[_0x22a5('0x52')],_0x22a5('0x53'),util[_0x22a5('0x54')]('%s.zip',path[_0x22a5('0x55')](_0x108619[_0x22a5('0x56')])));var _0x5a0f7a=fs[_0x22a5('0x57')](_0x380066);var _0x5d46af=archiver(_0x22a5('0x58'),{'zlib':{'level':0x9}});_0x5d46af['on'](_0x22a5('0x59'),function(_0x1f8b6a){if(_0x1f8b6a['code']===_0x22a5('0x5a')){logger['error'](_0x1f8b6a);}else{throw new db['Sequelize']['Error'](_0x22a5('0x5b'));}});_0x5d46af['on'](_0x22a5('0x2c'),function(_0x195656){throw new db[(_0x22a5('0x5c'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x5d46af['pipe'](_0x5a0f7a);_0x5d46af[_0x22a5('0x5d')](_0x22a5('0x5e'),{'cwd':path[_0x22a5('0x51')](config[_0x22a5('0x52')],'server/files/plugins',path[_0x22a5('0x5f')](_0x108619[_0x22a5('0x56')])),'ignore':[path[_0x22a5('0x51')](path[_0x22a5('0x55')](_0x108619['path']),_0x22a5('0x60')),path['join'](path['basename'](_0x108619[_0x22a5('0x56')]),_0x22a5('0x61'))],'nodir':!![]})[_0x22a5('0x62')]();_0x5a0f7a['on'](_0x22a5('0x63'),function(){if(!fs[_0x22a5('0x64')](_0x380066)){throw new db[(_0x22a5('0x5c'))][(_0x22a5('0x65'))](_0x22a5('0x66'));}return _0x360cb7[_0x22a5('0x50')](_0x380066,util['format'](_0x22a5('0x67'),path['basename'](_0x108619['path'])),function(_0x2e53a4){if(_0x2e53a4){throw new db[(_0x22a5('0x5c'))][(_0x22a5('0x65'))](_0x22a5('0x68'));}fs[_0x22a5('0x69')](_0x380066);logger[_0x22a5('0x6a')](_0x22a5('0x6b'));logger['info'](_0x22a5('0x6c'));});});}return null;})[_0x22a5('0x4c')](handleError(_0x360cb7,null));};exports[_0x22a5('0x6d')]=function(_0x56cd37,_0x146b8e,_0x29554b){var _0x567fc7=path[_0x22a5('0x55')](_0x56cd37[_0x22a5('0x6e')][_0x22a5('0x6f')],path[_0x22a5('0x70')](_0x56cd37[_0x22a5('0x6e')][_0x22a5('0x6f')]));var _0x3503ce=path[_0x22a5('0x51')](config[_0x22a5('0x52')],'server/files/plugins',_0x56cd37['file']['filename']);var _0xd938e=path[_0x22a5('0x51')](config[_0x22a5('0x52')],_0x22a5('0x53'),_0x567fc7);logger[_0x22a5('0x6a')](_0x22a5('0x71'),_0x3503ce);logger[_0x22a5('0x6a')](_0x22a5('0x72'),_0xd938e);try{fs['chmodSync'](_0x3503ce,parseInt(_0x22a5('0x73'),0x8));extract(_0x3503ce,{'dir':_0xd938e},function(_0x2ecfb1){if(_0x2ecfb1){logger[_0x22a5('0x2c')](_0x2ecfb1);handleError(_0x2ecfb1,!![]);};var _0x35cafe=fs[_0x22a5('0x74')](_0xd938e);if(_0x35cafe[_0x22a5('0x3e')]>0x1){removeReferences(_0x3503ce,_0xd938e);logger[_0x22a5('0x2c')](_0x22a5('0x75'));return _0x29554b(new Error('Invalid\x20plugin\x20structure'));}var _0x145705=fs[_0x22a5('0x76')](path['join'](_0xd938e,_0x35cafe[0x0]));if(_0x145705[_0x22a5('0x77')]()){removeReferences(_0x3503ce,_0xd938e);logger['error'](_0x22a5('0x75'));return _0x29554b(new Error(_0x22a5('0x75')));}if(_0x145705[_0x22a5('0x78')]()){var _0x3d835d=fs[_0x22a5('0x74')](path[_0x22a5('0x51')](_0xd938e,_0x35cafe[0x0]));if(_0x3d835d['length']===0x0){removeReferences(_0x3503ce,_0xd938e);logger[_0x22a5('0x2c')](_0x22a5('0x75'));return _0x29554b(new Error('Invalid\x20plugin\x20structure'));}var _0x2da8a1=_0x3d835d[_0x22a5('0x79')](function(_0xe0fdf0){return _0xe0fdf0===_0x22a5('0x7a');});if(!_0x2da8a1){return _0x29554b(new Error(_0x22a5('0x7b')));}var _0x556daa=fs['readFileSync'](path[_0x22a5('0x51')](_0xd938e,_0x35cafe[0x0],_0x22a5('0x7a')));var _0x273cf2=JSON[_0x22a5('0x7c')](_0x556daa);if(_0x22a5('0x7d')==typeof _0x273cf2[_0x22a5('0x2e')]){return _0x29554b(new Error(_0x22a5('0x7e')));}if(_0x22a5('0x7d')==typeof _0x273cf2[_0x22a5('0x35')]){return _0x29554b(new Error(_0x22a5('0x7f')));}if(_0x22a5('0x7d')==typeof _0x273cf2['version']){return _0x29554b(new Error(_0x22a5('0x80')));}if(_0x22a5('0x7d')==typeof _0x273cf2['parameters']){return _0x29554b(new Error(_0x22a5('0x81')));}if(_0x273cf2[_0x22a5('0x35')]==='html'){if(_0x22a5('0x7d')==typeof _0x273cf2['parameters'][_0x22a5('0x82')]){return _0x29554b(new Error(_0x22a5('0x83')));}if(_0x22a5('0x7d')==typeof _0x273cf2['parameters']['views']['admin']&&_0x22a5('0x7d')==typeof _0x273cf2[_0x22a5('0x84')]['views'][_0x22a5('0x85')]){return _0x29554b(new Error(_0x22a5('0x86')));}}else if(_0x273cf2[_0x22a5('0x35')]===_0x22a5('0x87')){if(_0x22a5('0x7d')==typeof _0x273cf2[_0x22a5('0x84')][_0x22a5('0x88')]){return _0x29554b(new Error(_0x22a5('0x89')));}if(_0x22a5('0x7d')==typeof _0x273cf2[_0x22a5('0x84')][_0x22a5('0x8a')]){return _0x29554b(new Error(_0x22a5('0x8b')));}}else{return _0x29554b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xd75c8d=_0x273cf2[_0x22a5('0x2e')];var _0x515884=_0x273cf2[_0x22a5('0x8c')];var _0x3eab4c=_0x273cf2['type'];var _0x3c4dfe=_0x273cf2[_0x22a5('0x8d')]?_0x273cf2[_0x22a5('0x8d')]:'always';var _0x42cb4e=_0x273cf2[_0x22a5('0x8e')]?_0x273cf2[_0x22a5('0x8e')]:_0x22a5('0x8f');var _0xca298='';var _0x53b744='';var _0x32cfce='';var _0x26e21e='';var _0xaa2829=_0x273cf2['version'];if(_0x3eab4c==='html'){if(_0x22a5('0x7d')!=typeof _0x273cf2['parameters'][_0x22a5('0x82')][_0x22a5('0x90')]){var _0x43c17f=_0x273cf2[_0x22a5('0x84')][_0x22a5('0x82')][_0x22a5('0x90')];if(!/^(f|ht)tps?:\/\//i[_0x22a5('0x91')](_0x43c17f)){_0xca298=path[_0x22a5('0x51')](_0x22a5('0x92'),_0x567fc7,_0x35cafe[0x0],_0x43c17f);}else{_0xca298=_0x43c17f;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x22a5('0x7d')!=typeof _0x273cf2[_0x22a5('0x84')][_0x22a5('0x82')][_0x22a5('0x85')]){var _0x3174be=_0x273cf2['parameters']['views'][_0x22a5('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x22a5('0x91')](_0x3174be)){_0x53b744=path['join'](_0x22a5('0x92'),_0x567fc7,_0x35cafe[0x0],_0x3174be);}else{_0x53b744=_0x3174be;}}else{logger[_0x22a5('0x6a')](_0x22a5('0x93'));}}else if(_0x3eab4c===_0x22a5('0x87')){_0x32cfce=_0x273cf2[_0x22a5('0x84')][_0x22a5('0x88')];_0x26e21e=_0x273cf2['parameters'][_0x22a5('0x8a')];if(_0x22a5('0x7d')!=typeof _0x273cf2['parameters']['views']){if(_0x22a5('0x7d')!=typeof _0x273cf2[_0x22a5('0x84')][_0x22a5('0x82')][_0x22a5('0x90')]){var _0x43c17f=_0x273cf2[_0x22a5('0x84')]['views'][_0x22a5('0x90')];if(!/^(f|ht)tps?:\/\//i[_0x22a5('0x91')](_0x43c17f)){_0xca298=path['join'](_0x22a5('0x92'),_0x567fc7,_0x35cafe[0x0],_0x43c17f);}else{_0xca298=_0x43c17f;}}if(_0x22a5('0x7d')!=typeof _0x273cf2[_0x22a5('0x84')]['views']['agent']){var _0x3174be=_0x273cf2[_0x22a5('0x84')]['views'][_0x22a5('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x22a5('0x91')](_0x3174be)){_0x53b744=path[_0x22a5('0x51')](_0x22a5('0x92'),_0x567fc7,_0x35cafe[0x0],_0x3174be);}else{_0x53b744=_0x3174be;}}}}var _0x499e03={'name':_0xd75c8d,'description':_0x515884,'path':path['join'](_0x567fc7,_0x35cafe[0x0]),'type':_0x3eab4c,'sidebar':_0x3c4dfe,'icon':_0x42cb4e,'adminUrl':_0xca298,'agentUrl':_0x53b744,'scriptName':_0x32cfce,'scriptPath':_0x26e21e,'version':_0xaa2829};removeReferences(_0x3503ce,null);return db[_0x22a5('0x32')][_0x22a5('0x94')](_0x499e03)[_0x22a5('0x27')](function(_0x236d84){var _0x14b0a9={'role':_0x56cd37[_0x22a5('0x95')][_0x22a5('0x96')],'userProfileId':_0x56cd37[_0x22a5('0x95')]['userProfileId']};if(!_0x14b0a9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14b0a9['role']==='user'){var _0x5b3d69=_0x236d84[_0x22a5('0x28')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x22a5('0x29'),'userProfileId':_0x14b0a9['userProfileId']},'raw':!![]})[_0x22a5('0x27')](function(_0x19fe93){if(_0x19fe93&&_0x19fe93[_0x22a5('0x97')]===0x0){return db[_0x22a5('0x2a')][_0x22a5('0x94')]({'name':_0x5b3d69[_0x22a5('0x2e')],'resourceId':_0x5b3d69['id'],'type':_0x19fe93[_0x22a5('0x2e')],'sectionId':_0x19fe93['id']},{})[_0x22a5('0x27')](function(){return _0x236d84;});}else{return _0x236d84;}})['catch'](function(_0x3fa8f7){logger[_0x22a5('0x2c')](_0x22a5('0x98'),_0x3fa8f7);throw _0x3fa8f7;});}return _0x236d84;})['then'](respondWithResult(_0x146b8e,null))[_0x22a5('0x4c')](handleError(_0x146b8e,null));}});}catch(_0x22692e){_0x146b8e[_0x22a5('0x1d')](0x1f4)['send'](_0x22692e);}};function removeReferences(_0xfa495f,_0x3bcd32){try{if(_0xfa495f){fs[_0x22a5('0x69')](_0xfa495f);logger[_0x22a5('0x6a')]('Zip\x20archive\x20removed');}if(_0x3bcd32){rimraf(_0x3bcd32,function(){});logger['info'](_0x22a5('0x99'));}}catch(_0x5b9096){logger[_0x22a5('0x2c')](_0x5b9096);}}exports[_0x22a5('0x26')]=function(_0x428b23,_0x156e22,_0x187c0c){return db[_0x22a5('0x32')]['find']({'where':{'id':_0x428b23[_0x22a5('0x4e')]['id']}})[_0x22a5('0x27')](handleEntityNotFound(_0x156e22,null))[_0x22a5('0x27')](saveUpdates(_0x428b23[_0x22a5('0x95')],null))[_0x22a5('0x27')](respondWithResult(_0x156e22,null))[_0x22a5('0x4c')](handleError(_0x156e22,null));};exports[_0x22a5('0x9a')]=function(_0x33badc,_0x3bdfbc,_0xd79400){return db[_0x22a5('0x32')]['find']({'where':{'id':_0x33badc[_0x22a5('0x4e')]['id']}})[_0x22a5('0x27')](function(_0x2183ee){if(_0x2183ee){return _0x2183ee[_0x22a5('0x2b')]();}})['then'](function(_0x4cedb2){rimraf(path[_0x22a5('0x51')](config[_0x22a5('0x52')],_0x22a5('0x53'),path[_0x22a5('0x5f')](_0x4cedb2[_0x22a5('0x56')])),function(){});return _0x4cedb2;})['then'](handleEntityNotFound(_0x3bdfbc,null))[_0x22a5('0x27')](respondWithStatusCode(_0x3bdfbc,null))[_0x22a5('0x4c')](handleError(_0x3bdfbc,null));};exports[_0x22a5('0x9b')]=function(_0x2fbadb,_0x48682e,_0x2686c5){return BPromise['resolve']()[_0x22a5('0x27')](function(){if(!_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x56')]){throw new Error(_0x22a5('0x9c'));}if(!_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x9d')]){throw new Error(_0x22a5('0x9e'));}var _0x345b82=_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x9f')]?_0x2fbadb['query']['hostname']+':'+_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x9d')]:_0x22a5('0xa0')+_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x9d')];var _0x5c9c1d=_0x2fbadb[_0x22a5('0x3b')]['json']?_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x1f')]:!![];var _0x219c1b=_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0xa1')]?_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0xa1')]:null;var _0x4ab5d5={'method':_0x2fbadb['method'],'uri':util[_0x22a5('0x54')](_0x22a5('0xa2'),_0x345b82,_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x56')]),'json':_0x5c9c1d,'resolveWithFullResponse':!![],'encoding':_0x219c1b,'qs':_0x2fbadb[_0x22a5('0x3b')]};if(_0x2fbadb[_0x22a5('0xa3')]){_0x4ab5d5['headers']=_0x2fbadb['headers'];if(_0x4ab5d5['headers'][_0x22a5('0xa4')]){delete _0x4ab5d5[_0x22a5('0xa3')][_0x22a5('0xa4')];}}if(_0x4ab5d5['headers'][_0x22a5('0xa5')]){delete _0x4ab5d5[_0x22a5('0xa3')][_0x22a5('0xa5')];}return rp(_0x4ab5d5);})[_0x22a5('0x27')](function(_0x3f5d20){if(_0x3f5d20){_0x48682e[_0x22a5('0x22')](_0x3f5d20['headers']);logger[_0x22a5('0x6a')](_0x3f5d20[_0x22a5('0x95')]);if(_[_0x22a5('0xa6')](_0x2fbadb[_0x22a5('0x3b')][_0x22a5('0x56')],_0x22a5('0x50'))&&_0x3f5d20['statusCode']==0x1f4){return _0x48682e[_0x22a5('0x1c')](_0x3f5d20[_0x22a5('0xa7')]);}else{return _0x48682e[_0x22a5('0x1d')](_0x3f5d20['statusCode'])[_0x22a5('0x2f')](_0x3f5d20[_0x22a5('0x95')]);}}else{return _0x48682e[_0x22a5('0x1c')](0xc8);}})['catch'](handleError(_0x48682e,null));};exports[_0x22a5('0xa8')]=function(_0x53e5ab,_0x1f474a,_0x2bfa4e){return BPromise[_0x22a5('0xa9')]()['then'](function(){if(!_0x53e5ab[_0x22a5('0x3b')][_0x22a5('0x56')]){throw new Error(_0x22a5('0x9c'));}if(!_0x53e5ab['query'][_0x22a5('0x9d')]){throw new Error(_0x22a5('0x9e'));}var _0x294a65=_0x53e5ab[_0x22a5('0x3b')]['hostname']?_0x53e5ab[_0x22a5('0x3b')][_0x22a5('0x9f')]+':'+_0x53e5ab[_0x22a5('0x3b')][_0x22a5('0x9d')]:_0x22a5('0xa0')+_0x53e5ab[_0x22a5('0x3b')][_0x22a5('0x9d')];var _0x395803=_0x53e5ab['query'][_0x22a5('0x1f')]?_0x53e5ab[_0x22a5('0x3b')]['json']:!![];var _0x505a13=_0x53e5ab['query'][_0x22a5('0xa1')]?_0x53e5ab[_0x22a5('0x3b')][_0x22a5('0xa1')]:null;var _0x3a4966={'method':_0x53e5ab[_0x22a5('0xaa')],'uri':util['format'](_0x22a5('0xa2'),_0x294a65,_0x53e5ab[_0x22a5('0x3b')][_0x22a5('0x56')]),'json':_0x395803,'resolveWithFullResponse':!![],'encoding':_0x505a13,'body':_0x53e5ab[_0x22a5('0x95')]};if(_0x53e5ab[_0x22a5('0xa3')]){_0x3a4966[_0x22a5('0xa3')]=_0x53e5ab[_0x22a5('0xa3')];if(_0x3a4966[_0x22a5('0xa3')]['content-length']){delete _0x3a4966['headers'][_0x22a5('0xa4')];}}if(_0x3a4966[_0x22a5('0xa3')][_0x22a5('0xa5')]){delete _0x3a4966[_0x22a5('0xa3')]['content-type'];}return rp(_0x3a4966);})[_0x22a5('0x27')](function(_0x10737d){if(_0x10737d){_0x1f474a['set'](_0x10737d[_0x22a5('0xa3')]);logger[_0x22a5('0x6a')](_0x10737d[_0x22a5('0x95')]);return _0x1f474a[_0x22a5('0x1d')](_0x10737d[_0x22a5('0xa7')])[_0x22a5('0x2f')](_0x10737d['body']);}else{return _0x1f474a['sendStatus'](0xc8);}})[_0x22a5('0x4c')](handleError(_0x1f474a,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index d228116..a524d72 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 _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 +var _0x9536=['../../mysqldb','Plugin','setMaxListeners','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x9536,0x179));var _0x6953=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x9536[_0x5a7112];return _0x3147f7;};'use strict';var EventEmitter=require(_0x6953('0x0'));var Plugin=require(_0x6953('0x1'))['db'][_0x6953('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6953('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6953('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42fb54){return function(_0x3c32c7,_0x1dee7c,_0x3ba964){PluginEvents[_0x6953('0x5')](_0x42fb54+':'+_0x3c32c7['id'],_0x3c32c7);PluginEvents['emit'](_0x42fb54,_0x3c32c7);_0x3ba964(null);};}for(var e in events){if(events[_0x6953('0x6')](e)){var event=events[e];Plugin[_0x6953('0x7')](e,emitEvent(event));}}module[_0x6953('0x8')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 6e96486..75f10b9 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 _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 +var _0xb138=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x160433,_0x191d04){var _0x3eeccd=function(_0xc4ed37){while(--_0xc4ed37){_0x160433['push'](_0x160433['shift']());}};_0x3eeccd(++_0x191d04);}(_0xb138,0x1dd));var _0x8b13=function(_0x2510c0,_0x2bad14){_0x2510c0=_0x2510c0-0x0;var _0x190427=_0xb138[_0x2510c0];return _0x190427;};'use strict';var _=require(_0x8b13('0x0'));var util=require(_0x8b13('0x1'));var logger=require(_0x8b13('0x2'))(_0x8b13('0x3'));var moment=require(_0x8b13('0x4'));var BPromise=require(_0x8b13('0x5'));var rp=require(_0x8b13('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b13('0x7'));var config=require(_0x8b13('0x8'));var attributes=require(_0x8b13('0x9'));module['exports']=function(_0xd19a0f,_0x13f7bd){return _0xd19a0f['define'](_0x8b13('0xa'),attributes,{'tableName':_0x8b13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 91e95b3..2890f7a 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 _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 +var _0xf92e=['http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','request\x20sent','debug','stringify','error','Plugin,\x20%s,\x20%s','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x4fa4d7,_0x314ef8){var _0x432d05=function(_0x584f16){while(--_0x584f16){_0x4fa4d7['push'](_0x4fa4d7['shift']());}};_0x432d05(++_0x314ef8);}(_0xf92e,0xe4));var _0xef92=function(_0x1e872e,_0x27b90c){_0x1e872e=_0x1e872e-0x0;var _0x3ac02e=_0xf92e[_0x1e872e];return _0x3ac02e;};'use strict';var _=require('lodash');var util=require(_0xef92('0x0'));var moment=require(_0xef92('0x1'));var BPromise=require(_0xef92('0x2'));var rs=require(_0xef92('0x3'));var fs=require('fs');var Redis=require(_0xef92('0x4'));var db=require(_0xef92('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef92('0x6'))(_0xef92('0x7'));var config=require(_0xef92('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xef92('0x9')][_0xef92('0xa')]({'port':0x232a});config[_0xef92('0xb')]=_[_0xef92('0xc')](config['redis'],{'host':_0xef92('0xd'),'port':0x18eb});var socket=require(_0xef92('0xe'))(new Redis(config[_0xef92('0xb')]));require(_0xef92('0xf'))[_0xef92('0x10')](socket);function respondWithRpcPromise(_0x4ffbc8,_0x386eb1,_0x177c6d){return new BPromise(function(_0x2c1280,_0xdca316){return client[_0xef92('0x11')](_0x4ffbc8,_0x177c6d)[_0xef92('0x12')](function(_0x59eaee){logger[_0xef92('0x13')]('Plugin,\x20%s,\x20%s',_0x386eb1,_0xef92('0x14'));logger[_0xef92('0x15')]('Plugin,\x20%s,\x20%s,\x20%s',_0x386eb1,_0xef92('0x14'),JSON[_0xef92('0x16')](_0x59eaee));if(_0x59eaee[_0xef92('0x17')]){if(_0x59eaee[_0xef92('0x17')]['code']===0x1f4){logger[_0xef92('0x17')](_0xef92('0x18'),_0x386eb1,_0x59eaee['error'][_0xef92('0x19')]);return _0xdca316(_0x59eaee[_0xef92('0x17')][_0xef92('0x19')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x386eb1,_0x59eaee[_0xef92('0x17')][_0xef92('0x19')]);return _0x2c1280(_0x59eaee[_0xef92('0x17')][_0xef92('0x19')]);}else{logger[_0xef92('0x13')](_0xef92('0x18'),_0x386eb1,_0xef92('0x14'));_0x2c1280(_0x59eaee[_0xef92('0x1a')][_0xef92('0x19')]);}})[_0xef92('0x1b')](function(_0x165b3f){logger['error'](_0xef92('0x18'),_0x386eb1,_0x165b3f);_0xdca316(_0x165b3f);});});}exports['CreatePlugin']=function(_0x214340){var _0x2c0338=this;return new Promise(function(_0x58f67a,_0x22d5e8){return db[_0xef92('0x1c')][_0xef92('0x1d')](_0x214340[_0xef92('0x1e')],{'raw':_0x214340[_0xef92('0x1f')]?_0x214340[_0xef92('0x1f')][_0xef92('0x20')]===undefined?!![]:![]:!![]})[_0xef92('0x12')](function(_0x22c62a){logger['info'](_0xef92('0x21'),_0x214340);logger[_0xef92('0x15')](_0xef92('0x21'),_0x214340,JSON[_0xef92('0x16')](_0x22c62a));_0x58f67a(_0x22c62a);})[_0xef92('0x1b')](function(_0x502cde){logger['error']('CreatePlugin',_0x502cde[_0xef92('0x19')],_0x214340);_0x22d5e8(_0x2c0338[_0xef92('0x17')](0x1f4,_0x502cde[_0xef92('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b602988..4233701 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 _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 +var _0xaf79=['update','emit','length','plugin:','./plugin.events','save','remove'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaf79,0xe4));var _0x9af7=function(_0x5a8cc0,_0x2bf6ed){_0x5a8cc0=_0x5a8cc0-0x0;var _0xbf6bb5=_0xaf79[_0x5a8cc0];return _0xbf6bb5;};'use strict';var PluginEvents=require(_0x9af7('0x0'));var events=[_0x9af7('0x1'),_0x9af7('0x2'),_0x9af7('0x3')];function createListener(_0x1b8b7c,_0x19cc76){return function(_0x2659b6){_0x19cc76[_0x9af7('0x4')](_0x1b8b7c,_0x2659b6);};}function removeListener(_0x25b0d,_0x319f6a){return function(){PluginEvents['removeListener'](_0x25b0d,_0x319f6a);};}exports['register']=function(_0x598b25){for(var _0x293823=0x0,_0x27e1cc=events[_0x9af7('0x5')];_0x293823<_0x27e1cc;_0x293823++){var _0xfc58cc=events[_0x293823];var _0x1d2886=createListener(_0x9af7('0x6')+_0xfc58cc,_0x598b25);PluginEvents['on'](_0xfc58cc,_0x1d2886);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e7f6e02..485a82e 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 _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 +var _0x4d4c=['show','create','update','delete','destroy','exports','express','../../components/auth/service','./pm2.controller','get','isAuthenticated','index','/:id'];(function(_0x3b86ce,_0x104fbb){var _0x1eeba8=function(_0x1c2b83){while(--_0x1c2b83){_0x3b86ce['push'](_0x3b86ce['shift']());}};_0x1eeba8(++_0x104fbb);}(_0x4d4c,0xf0));var _0xc4d4=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0x4d4c[_0x4ee9cd];return _0x328a5b;};'use strict';var express=require(_0xc4d4('0x0'));var router=express['Router']();var auth=require(_0xc4d4('0x1'));var controller=require(_0xc4d4('0x2'));router[_0xc4d4('0x3')]('/',auth[_0xc4d4('0x4')](),controller[_0xc4d4('0x5')]);router[_0xc4d4('0x3')](_0xc4d4('0x6'),auth[_0xc4d4('0x4')](),controller[_0xc4d4('0x7')]);router['post']('/',auth[_0xc4d4('0x4')](),controller[_0xc4d4('0x8')]);router['put'](_0xc4d4('0x6'),auth['isAuthenticated'](),controller[_0xc4d4('0x9')]);router[_0xc4d4('0xa')](_0xc4d4('0x6'),auth[_0xc4d4('0x4')](),controller[_0xc4d4('0xb')]);module[_0xc4d4('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index ac64056..fe351aa 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 _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 +var _0xd52d=['send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','restart','Unknown\x20status','lodash','../../config/logger','api','child_process','exec','bluebird','status','json','error','name'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0xd52d,0x86));var _0xdd52=function(_0x444530,_0x3a9034){_0x444530=_0x444530-0x0;var _0x595c2e=_0xd52d[_0x444530];return _0x595c2e;};'use strict';var _=require(_0xdd52('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xdd52('0x1'))(_0xdd52('0x2'));var path=require('path');var exec=require(_0xdd52('0x3'))[_0xdd52('0x4')];var BPromise=require(_0xdd52('0x5'));function handleEntityNotFound(_0x1d2f53,_0x14e763){return function(_0xe5204f){if(!_0xe5204f){_0x1d2f53['sendStatus'](0x194);;}return _0xe5204f;};}function respondWithResult(_0x5b6bcb,_0x4ba8b0){_0x4ba8b0=_0x4ba8b0||0xc8;return function(_0x338cc2){if(_0x338cc2){return _0x5b6bcb[_0xdd52('0x6')](_0x4ba8b0)[_0xdd52('0x7')](_0x338cc2);}return null;};}function handleError(_0x2ae483,_0x404109){_0x404109=_0x404109||0x1f4;return function(_0x3ac583){logger[_0xdd52('0x8')](_0x3ac583['stack']);if(_0x3ac583['name']){delete _0x3ac583[_0xdd52('0x9')];}_0x2ae483[_0xdd52('0x6')](_0x404109)[_0xdd52('0xa')](_0x3ac583);};}function execChildProcess(){return new BPromise(function(_0x3620ab,_0x3b79a4){exec(_0xdd52('0xb'),function(_0x483c9c,_0x492061,_0x3d1596){logger[_0xdd52('0xc')](_0x492061);logger[_0xdd52('0xc')](_0x3d1596);if(_0x483c9c){logger['error'](_0x483c9c);return _0x3b79a4(_0x483c9c);}return _0x3620ab(_0x492061);});});}exports[_0xdd52('0xd')]=function(_0x279b00,_0x221285){return pm2[_0xdd52('0xe')]()[_0xdd52('0xf')](function(_0x3cdd8a){if(_0x3cdd8a){var _0x3f6eed=_[_0xdd52('0x10')](_0x3cdd8a,function(_0x8849e7){return _0x8849e7[_0xdd52('0x9')]===_0xdd52('0x11')||_0x8849e7[_0xdd52('0x9')]===_0xdd52('0x12');});return{'rows':_0x3f6eed,'count':_0x3f6eed[_0xdd52('0x13')]};}return null;})['then'](respondWithResult(_0x221285,null))[_0xdd52('0x14')](handleError(_0x221285,null));};exports[_0xdd52('0x15')]=function(_0x29f8c2,_0x1a4abd){return pm2[_0xdd52('0x16')](_0x29f8c2[_0xdd52('0x17')]['id'])['then'](respondWithResult(_0x1a4abd,null))[_0xdd52('0xf')](handleEntityNotFound(_0x1a4abd,null))[_0xdd52('0x14')](handleError(_0x1a4abd,null));};exports[_0xdd52('0x18')]=function(_0x782fa7,_0x465802){if(_0x782fa7[_0xdd52('0x19')][_0xdd52('0x9')]&&_0x782fa7['body'][_0xdd52('0x1a')]){var _0x3f66b6=path['join'](__dirname,_0xdd52('0x1b'),_0x782fa7[_0xdd52('0x19')][_0xdd52('0x1a')]);var _0xed8d60=process[_0xdd52('0x1c')]();process[_0xdd52('0x1d')](path['dirname'](_0x3f66b6));return execChildProcess()[_0xdd52('0xf')](function(_0x41adb9){process['chdir'](_0xed8d60);return pm2[_0xdd52('0x1e')]({'name':_0x782fa7['body'][_0xdd52('0x9')],'script':_0x3f66b6});})[_0xdd52('0xf')](function(_0x515341){pm2[_0xdd52('0x1f')]();return _0x515341[0x0];})[_0xdd52('0xf')](respondWithResult(_0x465802,0xc9))[_0xdd52('0x14')](handleError(_0x465802,null));}else{return _0x465802[_0xdd52('0x6')](0x1f4)[_0xdd52('0xa')]({'message':_0xdd52('0x20')});}};exports[_0xdd52('0x21')]=function(_0x224f6b,_0x23815e){if(_0x224f6b[_0xdd52('0x19')]['id']){delete _0x224f6b[_0xdd52('0x19')]['id'];}var _0x16d2c7={'online':_0xdd52('0x22'),'stopped':'stop'};if(_0x16d2c7['hasOwnProperty'](_0x224f6b[_0xdd52('0x19')][_0xdd52('0x6')])){return pm2[_0x16d2c7[_0x224f6b[_0xdd52('0x19')]['status']]](_0x224f6b[_0xdd52('0x17')]['id'])[_0xdd52('0xf')](respondWithResult(_0x23815e,0xc8))[_0xdd52('0x14')](handleError(_0x23815e,null));}else{return _0x23815e[_0xdd52('0x6')](0x1f4)[_0xdd52('0xa')]({'message':_0xdd52('0x23')});}};exports['destroy']=function(_0x61ad8,_0x13494f){if(_0x61ad8[_0xdd52('0x19')]['id']){delete _0x61ad8[_0xdd52('0x19')]['id'];}if(_0x61ad8[_0xdd52('0x17')]['id']){return pm2['delete'](_0x61ad8[_0xdd52('0x17')]['id'])[_0xdd52('0xf')](function(_0xbe29b0){pm2[_0xdd52('0x1f')]();return _0xbe29b0[0x0];})[_0xdd52('0xf')](respondWithResult(_0x13494f,null))[_0xdd52('0x14')](handleError(_0x13494f,null));}else{return _0x13494f[_0xdd52('0x6')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bb48925..58d7bda 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 _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 +var _0xafc8=['../../components/interaction/service','../../config/environment','multer','path','express','../../components/auth/service'];(function(_0x342654,_0x17fbdb){var _0x379370=function(_0x33336f){while(--_0x33336f){_0x342654['push'](_0x342654['shift']());}};_0x379370(++_0x17fbdb);}(_0xafc8,0x7a));var _0x8afc=function(_0x3370c3,_0x543ac2){_0x3370c3=_0x3370c3-0x0;var _0x45aca8=_0xafc8[_0x3370c3];return _0x45aca8;};'use strict';var multer=require(_0x8afc('0x0'));var util=require('util');var path=require(_0x8afc('0x1'));var timeout=require('connect-timeout');var express=require(_0x8afc('0x2'));var router=express['Router']();var auth=require(_0x8afc('0x3'));var interaction=require(_0x8afc('0x4'));var config=require(_0x8afc('0x5'));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 92fc586..a5b4453 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 _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 +var _0x5dd0=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x13da72,_0xb1728e){var _0x3138d3=function(_0x10d420){while(--_0x10d420){_0x13da72['push'](_0x13da72['shift']());}};_0x3138d3(++_0xb1728e);}(_0x5dd0,0x163));var _0x05dd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5dd0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x05dd('0x0'));module[_0x05dd('0x1')]={'state':{'type':Sequelize[_0x05dd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x05dd('0x3')]},'scheduledat':{'type':Sequelize[_0x05dd('0x4')]},'uniqueid':{'type':Sequelize[_0x05dd('0x3')]},'starttime':{'type':Sequelize[_0x05dd('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x05dd('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x05dd('0x3')]},'campaigntype':{'type':Sequelize[_0x05dd('0x3')]},'membername':{'type':Sequelize[_0x05dd('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index b22cc07..ed5aba7 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 _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 +var _0x0b49=['bluebird','path','rimraf','./reportAgentPreview.attributes','define','report_agent_preview','lodash','util','../../config/logger','api'];(function(_0x1a1ffd,_0xb0a1be){var _0x109a2c=function(_0x3404d0){while(--_0x3404d0){_0x1a1ffd['push'](_0x1a1ffd['shift']());}};_0x109a2c(++_0xb0a1be);}(_0x0b49,0xb0));var _0x90b4=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x0b49[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x90b4('0x0'));var util=require(_0x90b4('0x1'));var logger=require(_0x90b4('0x2'))(_0x90b4('0x3'));var moment=require('moment');var BPromise=require(_0x90b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90b4('0x5'));var rimraf=require(_0x90b4('0x6'));var config=require('../../config/environment');var attributes=require(_0x90b4('0x7'));module['exports']=function(_0x272086,_0x43436c){return _0x272086[_0x90b4('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x90b4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index ff6275e..0f6b5c0 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 _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 +var _0x146e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','create','body','options','raw','debug','lodash','util','bluebird'];(function(_0x43cd9f,_0x57d758){var _0x5cf244=function(_0xb0bd94){while(--_0xb0bd94){_0x43cd9f['push'](_0x43cd9f['shift']());}};_0x5cf244(++_0x57d758);}(_0x146e,0xdd));var _0xe146=function(_0x4bbabf,_0x3e3454){_0x4bbabf=_0x4bbabf-0x0;var _0x159343=_0x146e[_0x4bbabf];return _0x159343;};'use strict';var _=require(_0xe146('0x0'));var util=require(_0xe146('0x1'));var moment=require('moment');var BPromise=require(_0xe146('0x2'));var rs=require(_0xe146('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe146('0x4'));var logger=require(_0xe146('0x5'))(_0xe146('0x6'));var config=require(_0xe146('0x7'));var jayson=require(_0xe146('0x8'));var client=jayson[_0xe146('0x9')][_0xe146('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad06e,_0x26ce4f,_0x1d932d){return new BPromise(function(_0x444f77,_0x53b822){return client[_0xe146('0xb')](_0x3ad06e,_0x1d932d)[_0xe146('0xc')](function(_0x4ce93a){logger[_0xe146('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x26ce4f,_0xe146('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x26ce4f,_0xe146('0xe'),JSON[_0xe146('0xf')](_0x4ce93a));if(_0x4ce93a['error']){if(_0x4ce93a[_0xe146('0x10')][_0xe146('0x11')]===0x1f4){logger['error'](_0xe146('0x12'),_0x26ce4f,_0x4ce93a[_0xe146('0x10')][_0xe146('0x13')]);return _0x53b822(_0x4ce93a[_0xe146('0x10')][_0xe146('0x13')]);}logger[_0xe146('0x10')](_0xe146('0x12'),_0x26ce4f,_0x4ce93a['error'][_0xe146('0x13')]);return _0x444f77(_0x4ce93a[_0xe146('0x10')]['message']);}else{logger[_0xe146('0xd')](_0xe146('0x12'),_0x26ce4f,_0xe146('0xe'));_0x444f77(_0x4ce93a[_0xe146('0x14')][_0xe146('0x13')]);}})[_0xe146('0x15')](function(_0x51168c){logger[_0xe146('0x10')](_0xe146('0x12'),_0x26ce4f,_0x51168c);_0x53b822(_0x51168c);});});}exports[_0xe146('0x16')]=function(_0x3e2eb8){var _0x4e2fb1=this;return new Promise(function(_0x573580,_0x48ac58){return db['ReportAgentPreview'][_0xe146('0x17')](_0x3e2eb8[_0xe146('0x18')],{'raw':_0x3e2eb8[_0xe146('0x19')]?_0x3e2eb8[_0xe146('0x19')][_0xe146('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4329ca){logger[_0xe146('0xd')](_0xe146('0x16'),_0x3e2eb8);logger[_0xe146('0x1b')](_0xe146('0x16'),_0x3e2eb8,JSON[_0xe146('0xf')](_0x4329ca));_0x573580(_0x4329ca);})['catch'](function(_0x1d3925){logger['error'](_0xe146('0x16'),_0x1d3925[_0xe146('0x13')],_0x3e2eb8);_0x48ac58(_0x4e2fb1['error'](0x1f4,_0x1d3925[_0xe146('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index f7bdaa9..94fae0b 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 _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 +var _0xd131=['get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','/mail/accounts','mailAccounts','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','put','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','post','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','exports','multer','path','express','Router','./rpc.controller'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0xd131,0x95));var _0x1d13=function(_0x366ce9,_0x457a54){_0x366ce9=_0x366ce9-0x0;var _0x56a9a6=_0xd131[_0x366ce9];return _0x56a9a6;};'use strict';var multer=require(_0x1d13('0x0'));var util=require('util');var path=require(_0x1d13('0x1'));var express=require(_0x1d13('0x2'));var router=express[_0x1d13('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x1d13('0x4'));router[_0x1d13('0x5')](_0x1d13('0x6'),auth['isAuthenticated'](),controller[_0x1d13('0x7')]);router[_0x1d13('0x5')](_0x1d13('0x8'),auth[_0x1d13('0x9')](),controller[_0x1d13('0xa')]);router[_0x1d13('0x5')](_0x1d13('0xb'),auth['isAuthenticated'](),controller[_0x1d13('0xc')]);router[_0x1d13('0x5')]('/voice/queues',auth[_0x1d13('0x9')](),controller[_0x1d13('0xd')]);router[_0x1d13('0x5')](_0x1d13('0xe'),auth[_0x1d13('0x9')](),controller['chatQueues']);router['get'](_0x1d13('0xf'),auth[_0x1d13('0x9')](),controller['mailQueues']);router[_0x1d13('0x5')](_0x1d13('0x10'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x11')]);router[_0x1d13('0x5')]('/openchannel/queues',auth[_0x1d13('0x9')](),controller['openchannelQueues']);router[_0x1d13('0x5')](_0x1d13('0x12'),auth['isAuthenticated'](),controller[_0x1d13('0x13')]);router[_0x1d13('0x5')](_0x1d13('0x14'),auth[_0x1d13('0x9')](),controller['whatsappQueues']);router[_0x1d13('0x5')]('/fax/queues',auth[_0x1d13('0x9')](),controller[_0x1d13('0x15')]);router[_0x1d13('0x5')](_0x1d13('0x16'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x17')]);router[_0x1d13('0x5')](_0x1d13('0x18'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x19')]);router[_0x1d13('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x1d13('0x9')](),controller['voiceQueuesChannel']);router[_0x1d13('0x5')](_0x1d13('0x1a'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x1b')]);router[_0x1d13('0x5')](_0x1d13('0x1c'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x1d')]);router[_0x1d13('0x5')]('/voice/queues/:id',auth[_0x1d13('0x9')](),controller[_0x1d13('0x1e')]);router['get'](_0x1d13('0x1f'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x20')]);router['get'](_0x1d13('0x21'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x22')]);router['get']('/agents',auth['isAuthenticated'](),controller['agents']);router[_0x1d13('0x23')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router[_0x1d13('0x5')](_0x1d13('0x24'),auth['isAuthenticated'](),controller[_0x1d13('0x25')]);router['get']('/trunks',auth[_0x1d13('0x9')](),controller[_0x1d13('0x26')]);router[_0x1d13('0x5')](_0x1d13('0x27'),auth['isAuthenticated'](),controller['campaigns']);router[_0x1d13('0x5')](_0x1d13('0x28'),auth['isAuthenticated'](),controller[_0x1d13('0x29')]);router['get'](_0x1d13('0x2a'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x2b')]);router['get']('/mail/queues/waitinginteractions',auth[_0x1d13('0x9')](),controller[_0x1d13('0x2c')]);router[_0x1d13('0x5')](_0x1d13('0x2d'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x2e')]);router[_0x1d13('0x5')](_0x1d13('0x2f'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x30')]);router['get'](_0x1d13('0x31'),auth[_0x1d13('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0x1d13('0x5')](_0x1d13('0x32'),auth['isAuthenticated'](),controller[_0x1d13('0x33')]);router[_0x1d13('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1d13('0x34')]);router['post'](_0x1d13('0x35'),auth[_0x1d13('0x9')](),controller['queueNotify']('mail'));router['get'](_0x1d13('0x36'),auth['isAuthenticated'](),controller[_0x1d13('0x37')]);router['post'](_0x1d13('0x38'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x39')](_0x1d13('0x3a')));router[_0x1d13('0x5')](_0x1d13('0x3b'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x3c')]);router[_0x1d13('0x3d')](_0x1d13('0x3e'),auth['isAuthenticated'](),controller[_0x1d13('0x39')](_0x1d13('0x3f')));router[_0x1d13('0x5')](_0x1d13('0x40'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x1d13('0x41'),auth['isAuthenticated'](),controller['queueNotify'](_0x1d13('0x42')));router[_0x1d13('0x5')]('/openchannel/queues/:id',auth[_0x1d13('0x9')](),controller[_0x1d13('0x43')]);router[_0x1d13('0x3d')](_0x1d13('0x44'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x39')](_0x1d13('0x45')));router[_0x1d13('0x3d')](_0x1d13('0x46'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x39')](_0x1d13('0x47')));router[_0x1d13('0x5')](_0x1d13('0x48'),auth[_0x1d13('0x9')](),controller[_0x1d13('0x49')]);router[_0x1d13('0x5')]('/whatsapp/queues/:id',auth[_0x1d13('0x9')](),controller[_0x1d13('0x4a')]);router[_0x1d13('0x3d')]('/agents/:id/notify',auth[_0x1d13('0x9')](),controller[_0x1d13('0x4b')]);module[_0x1d13('0x4c')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 78ef246..9089f6e 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 _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 +var _0xe18f=['\x20Message\x20not\x20found','queue','InteractionId','QueueId','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','capitalize','User','Agent\x20not\x20found','update','From','TransferReport','create','Start','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','find','rows','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','body','interaction','user','MemberReport','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','capacity','telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','isNil'];(function(_0x558a10,_0x2415ed){var _0x488f72=function(_0x37db1e){while(--_0x37db1e){_0x558a10['push'](_0x558a10['shift']());}};_0x488f72(++_0x2415ed);}(_0xe18f,0x10d));var _0xfe18=function(_0xbda8e2,_0x52b0c9){_0xbda8e2=_0xbda8e2-0x0;var _0x5d1db8=_0xe18f[_0xbda8e2];return _0x5d1db8;};'use strict';var BPromise=require(_0xfe18('0x0'));var moment=require(_0xfe18('0x1'));var _=require('lodash');var util=require(_0xfe18('0x2'));var db=require(_0xfe18('0x3'))['db'];var logger=require(_0xfe18('0x4'))(_0xfe18('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0xfe18('0x6')][_0xfe18('0x7')]({'port':0x232a});var mailClient=jayson[_0xfe18('0x6')][_0xfe18('0x7')]({'port':0x232b});var routingClient=jayson[_0xfe18('0x6')][_0xfe18('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x17d852,_0x577e0f,_0x2a003c){return new BPromise(function(_0x12b488,_0x3b5adf){var _0x3859cc=_0x2a003c?_0x2a003c:amiClient;return _0x3859cc[_0xfe18('0x8')](_0x17d852,_0x577e0f)[_0xfe18('0x9')](function(_0x193609){if(_0x193609[_0xfe18('0xa')]){if(_0x193609[_0xfe18('0xa')][_0xfe18('0xb')]===0x1f4){return _0x3b5adf(_0x193609[_0xfe18('0xa')][_0xfe18('0xc')]);}return _0x12b488(_0x193609['error']['message']);}else{_0x12b488(_0x193609[_0xfe18('0xd')]);}})[_0xfe18('0xe')](function(_0x50c0bb){_0x3b5adf(_0x50c0bb);});});}function respondWithResult(_0x7e2b47,_0x39e6a3){_0x39e6a3=_0x39e6a3||0xc8;return function(_0x28c0c2){if(_0x28c0c2){return _0x7e2b47[_0xfe18('0xf')](_0x39e6a3)[_0xfe18('0x10')](_0x28c0c2);}return _0x7e2b47[_0xfe18('0x11')](0x194);};}function handleError(_0x2798f2,_0x447216){_0x447216=_0x447216||0x1f4;return function(_0x4fd064){logger[_0xfe18('0xa')](_0x4fd064[_0xfe18('0x12')]);if(_0x4fd064[_0xfe18('0x13')]){delete _0x4fd064[_0xfe18('0x13')];}_0x2798f2[_0xfe18('0xf')](_0x447216)[_0xfe18('0x14')](_0x4fd064);};}function findById(_0x8fe90f){return function(_0x18e7bd){if(!_['isNil'](_0x8fe90f)&&!_['isNil'](_0x18e7bd)&&!_['isNil'](_0x18e7bd['rows'])){return _[_0xfe18('0x15')](_0x18e7bd[_0xfe18('0x16')],function(_0xbf29bb){return _0xbf29bb['id']==_0x8fe90f;});}return null;};}exports['voiceChannels']=function(_0x38a3ae,_0xe86d08){return respondWithRpcPromise('VoiceChannels',_0x38a3ae[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0xe86d08,null))['catch'](handleError(_0xe86d08,null));};exports[_0xfe18('0x18')]=function(_0x8735df,_0xcf1ecd){return respondWithRpcPromise(_0xfe18('0x19'),_['merge'](_0x8735df[_0xfe18('0x17')],_0x8735df[_0xfe18('0x1a')]))['then'](respondWithResult(_0xcf1ecd,null))[_0xfe18('0xe')](handleError(_0xcf1ecd,null));};exports['voiceChannelStopMixMonitor']=function(_0x3a8c7b,_0x72c9f8){return respondWithRpcPromise(_0xfe18('0x1b'),_[_0xfe18('0x1c')](_0x3a8c7b['query'],_0x3a8c7b['params']))[_0xfe18('0x9')](respondWithResult(_0x72c9f8,null))[_0xfe18('0xe')](handleError(_0x72c9f8,null));};exports[_0xfe18('0x1d')]=function(_0x64f677,_0x5e559f){return respondWithRpcPromise(_0xfe18('0x1e'),_0x64f677[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0x5e559f,null))[_0xfe18('0xe')](handleError(_0x5e559f,null));};exports[_0xfe18('0x1f')]=function(_0x5db585,_0xb79442){return respondWithRpcPromise(_0xfe18('0x1e'),_0x5db585[_0xfe18('0x17')])['then'](findById(_0x5db585['params']['id']))[_0xfe18('0x9')](respondWithResult(_0xb79442,null))[_0xfe18('0xe')](handleError(_0xb79442,null));};exports['voiceQueuesPreview']=function(_0x4b9361,_0x3f363e){return respondWithRpcPromise(_0xfe18('0x20'),_[_0xfe18('0x1c')](_0x4b9361['query'],_0x4b9361[_0xfe18('0x1a')]))['then'](respondWithResult(_0x3f363e,null))[_0xfe18('0xe')](handleError(_0x3f363e,null));};exports[_0xfe18('0x21')]=function(_0x1e7ce8,_0x3a43e5){return respondWithRpcPromise(_0xfe18('0x22'),_0x1e7ce8[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0x3a43e5,null))[_0xfe18('0xe')](handleError(_0x3a43e5,null));};exports[_0xfe18('0x23')]=function(_0x309b2b,_0x527c5a){return respondWithRpcPromise(_0xfe18('0x24'),_[_0xfe18('0x1c')](_0x309b2b['query'],_0x309b2b['params']))['then'](respondWithResult(_0x527c5a,null))['catch'](handleError(_0x527c5a,null));};exports['voiceQueuesChannelHangup']=function(_0x3ae3f4,_0x31896b){return respondWithRpcPromise(_0xfe18('0x25'),_[_0xfe18('0x1c')](_0x3ae3f4[_0xfe18('0x17')],_0x3ae3f4[_0xfe18('0x1a')]))[_0xfe18('0x9')](respondWithResult(_0x31896b,null))['catch'](handleError(_0x31896b,null));};exports[_0xfe18('0x26')]=function(_0x24c429,_0x11d215){return respondWithRpcPromise(_0xfe18('0x27'),_['merge'](_0x24c429[_0xfe18('0x17')],_0x24c429['params']))[_0xfe18('0x9')](respondWithResult(_0x11d215,null))[_0xfe18('0xe')](handleError(_0x11d215,null));};exports[_0xfe18('0x28')]=function(_0x1648f6,_0x3f5382){return respondWithRpcPromise(_0xfe18('0x29'),_0x1648f6[_0xfe18('0x17')])['then'](respondWithResult(_0x3f5382,null))[_0xfe18('0xe')](handleError(_0x3f5382,null));};exports[_0xfe18('0x2a')]=function(_0x282ded,_0x3ce8d2){return respondWithRpcPromise('OutboundChannels',_0x282ded[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0x3ce8d2,null))[_0xfe18('0xe')](handleError(_0x3ce8d2,null));};exports[_0xfe18('0x2b')]=function(_0x1b7402,_0x110feb){var _0x5a43bf;return respondWithRpcPromise(_0xfe18('0x2c'),_0x1b7402[_0xfe18('0x17')])[_0xfe18('0x9')](function(_0x2d6345){_0x5a43bf=_0x2d6345;return respondWithRpcPromise(_0xfe18('0x2c'),_0x1b7402['query'],routingClient);})['then'](function(_0x1948c0){return _['merge']({},_0x1948c0,_0x5a43bf);})[_0xfe18('0x9')](respondWithResult(_0x110feb,null))[_0xfe18('0xe')](handleError(_0x110feb,null));};exports[_0xfe18('0x2d')]=function(_0x3d7f6e,_0x3be621){if(_0x3d7f6e[_0xfe18('0x2e')]&&_0x3d7f6e[_0xfe18('0x2e')][_0xfe18('0x2f')]&&_0x3d7f6e[_0xfe18('0x30')]&&_0x3d7f6e[_0xfe18('0x30')]['name']){for(var _0x16a9d3 in _0x3d7f6e[_0xfe18('0x2e')][_0xfe18('0x2f')]){if(_0x3d7f6e[_0xfe18('0x2e')][_0xfe18('0x2f')]['hasOwnProperty'](_0x16a9d3)){db[_0xfe18('0x31')][_0xfe18('0x32')]({'where':{'channel':_0x16a9d3,'membername':_0x3d7f6e[_0xfe18('0x30')][_0xfe18('0x13')],'type':_0xfe18('0x33'),'exitAt':null,'uniqueid':_0x3d7f6e[_0xfe18('0x2e')][_0xfe18('0x2f')][_0x16a9d3]&&_0x3d7f6e[_0xfe18('0x2e')]['interaction'][_0x16a9d3]['length']?{'$notIn':_0x3d7f6e[_0xfe18('0x2e')]['interaction'][_0x16a9d3]}:{'$ne':null}}})['then'](function(_0x268c56){var _0x465199=moment()[_0xfe18('0x34')](_0xfe18('0x35'));for(var _0x40c201=0x0,_0x2d6e20=_0x268c56[_0xfe18('0x36')];_0x40c201<_0x2d6e20;_0x40c201+=0x1){_0x268c56[_0x40c201][_0xfe18('0x37')]({'exitAt':_0x465199});}});for(var _0x4f70d6=0x0;_0x4f70d6<_0x3d7f6e[_0xfe18('0x2e')][_0xfe18('0x2f')][_0x16a9d3][_0xfe18('0x36')];_0x4f70d6+=0x1){db[_0xfe18('0x31')][_0xfe18('0x38')]({'where':{'channel':_0x16a9d3,'membername':_0x3d7f6e['user']['name'],'type':_0xfe18('0x33'),'uniqueid':_0x3d7f6e['body'][_0xfe18('0x2f')][_0x16a9d3][_0x4f70d6],'exitAt':null},'defaults':{'channel':_0x16a9d3,'membername':_0x3d7f6e[_0xfe18('0x30')][_0xfe18('0x13')],'interface':_['isNil'](_0x3d7f6e[_0xfe18('0x30')][_0xfe18('0x39')])?util[_0xfe18('0x34')](_0xfe18('0x3a'),_0x3d7f6e[_0xfe18('0x30')][_0xfe18('0x13')]):_0x3d7f6e[_0xfe18('0x30')][_0xfe18('0x39')],'type':_0xfe18('0x33'),'enterAt':moment()[_0xfe18('0x34')](_0xfe18('0x35')),'role':_0xfe18('0x3b'),'internal':_0x3d7f6e[_0xfe18('0x30')][_0xfe18('0x3c')],'uniqueid':_0x3d7f6e[_0xfe18('0x2e')]['interaction'][_0x16a9d3][_0x4f70d6]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3d7f6e[_0xfe18('0x1a')]['id'],'capacity':_0x3d7f6e['body'][_0xfe18('0x3d')]},routingClient)['then'](respondWithResult(_0x3be621,null))[_0xfe18('0xe')](handleError(_0x3be621,null));};exports[_0xfe18('0x3e')]=function(_0x4f5932,_0x3e1c6e){return respondWithRpcPromise('Telephones',_0x4f5932[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0x3e1c6e,null))[_0xfe18('0xe')](handleError(_0x3e1c6e,null));};exports['trunks']=function(_0xd443b7,_0x58f6b3){return respondWithRpcPromise(_0xfe18('0x3f'),_0xd443b7[_0xfe18('0x17')])['then'](respondWithResult(_0x58f6b3,null))[_0xfe18('0xe')](handleError(_0x58f6b3,null));};exports[_0xfe18('0x40')]=function(_0x2e1809,_0x24ed53){return respondWithRpcPromise(_0xfe18('0x41'),_0x2e1809[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0x24ed53,null))[_0xfe18('0xe')](handleError(_0x24ed53,null));};exports[_0xfe18('0x42')]=function(_0x9add26,_0x528157){return respondWithRpcPromise(_0xfe18('0x43'),_0x9add26[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x528157,null))[_0xfe18('0xe')](handleError(_0x528157,null));};exports[_0xfe18('0x44')]=function(_0x4961bf,_0xa2a382){return respondWithRpcPromise(_0xfe18('0x43'),_0x4961bf[_0xfe18('0x17')],routingClient)['then'](findById(_0x4961bf[_0xfe18('0x1a')]['id']))[_0xfe18('0x9')](respondWithResult(_0xa2a382,null))[_0xfe18('0xe')](handleError(_0xa2a382,null));};exports[_0xfe18('0x45')]=function(_0x420d95,_0x5456b5){return respondWithRpcPromise(_0xfe18('0x46'),_0x420d95[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x5456b5,null))[_0xfe18('0xe')](handleError(_0x5456b5,null));};exports[_0xfe18('0x47')]=function(_0x2b198c,_0x4ae56a){return respondWithRpcPromise(_0xfe18('0x46'),_0x2b198c['query'],routingClient)['then'](findById(_0x2b198c['params']['id']))[_0xfe18('0x9')](respondWithResult(_0x4ae56a,null))[_0xfe18('0xe')](handleError(_0x4ae56a,null));};exports[_0xfe18('0x48')]=function(_0x2f0c38,_0x29f83c){return respondWithRpcPromise(_0xfe18('0x49'),_0x2f0c38[_0xfe18('0x17')],mailClient)[_0xfe18('0x9')](respondWithResult(_0x29f83c,null))[_0xfe18('0xe')](handleError(_0x29f83c,null));};exports[_0xfe18('0x4a')]=function(_0x37d487,_0x3afa0e){return respondWithRpcPromise('OpenchannelQueues',_0x37d487[_0xfe18('0x17')],routingClient)['then'](respondWithResult(_0x3afa0e,null))[_0xfe18('0xe')](handleError(_0x3afa0e,null));};exports[_0xfe18('0x4b')]=function(_0x3fdd1e,_0x3d8495){return respondWithRpcPromise(_0xfe18('0x4c'),_0x3fdd1e['query'],routingClient)[_0xfe18('0x9')](findById(_0x3fdd1e[_0xfe18('0x1a')]['id']))[_0xfe18('0x9')](respondWithResult(_0x3d8495,null))['catch'](handleError(_0x3d8495,null));};exports['smsQueues']=function(_0x307591,_0x29a64e){return respondWithRpcPromise(_0xfe18('0x4d'),_0x307591[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x29a64e,null))[_0xfe18('0xe')](handleError(_0x29a64e,null));};exports[_0xfe18('0x4e')]=function(_0x96fe13,_0x3be696){return respondWithRpcPromise('SmsQueues',_0x96fe13[_0xfe18('0x17')],routingClient)['then'](findById(_0x96fe13['params']['id']))[_0xfe18('0x9')](respondWithResult(_0x3be696,null))[_0xfe18('0xe')](handleError(_0x3be696,null));};exports[_0xfe18('0x4f')]=function(_0x2f344e,_0x4d5970){return respondWithRpcPromise(_0xfe18('0x50'),_0x2f344e['query'],routingClient)[_0xfe18('0x9')](respondWithResult(_0x4d5970,null))['catch'](handleError(_0x4d5970,null));};exports['showWhatsappQueues']=function(_0x3ecfb4,_0x229b5d){return respondWithRpcPromise(_0xfe18('0x50'),_0x3ecfb4['query'],routingClient)[_0xfe18('0x9')](findById(_0x3ecfb4[_0xfe18('0x1a')]['id']))[_0xfe18('0x9')](respondWithResult(_0x229b5d,null))[_0xfe18('0xe')](handleError(_0x229b5d,null));};exports[_0xfe18('0x51')]=function(_0x22f958,_0x58f3f9){return respondWithRpcPromise('FaxQueues',_0x22f958[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x58f3f9,null))[_0xfe18('0xe')](handleError(_0x58f3f9,null));};exports['showFaxQueues']=function(_0x2f451d,_0x162fa5){return respondWithRpcPromise(_0xfe18('0x52'),_0x2f451d['query'],routingClient)[_0xfe18('0x9')](findById(_0x2f451d[_0xfe18('0x1a')]['id']))[_0xfe18('0x9')](respondWithResult(_0x162fa5,null))[_0xfe18('0xe')](handleError(_0x162fa5,null));};exports[_0xfe18('0x53')]=function(_0x524db6,_0x4d3665){return respondWithRpcPromise(_0xfe18('0x54'),_0x524db6[_0xfe18('0x17')])[_0xfe18('0x9')](respondWithResult(_0x4d3665,null))['catch'](handleError(_0x4d3665,null));};exports['chatQueuesWaitingInteractions']=function(_0x5d77e0,_0x4ce11a){return respondWithRpcPromise(_0xfe18('0x55'),_0x5d77e0['query'],routingClient)[_0xfe18('0x9')](respondWithResult(_0x4ce11a,null))['catch'](handleError(_0x4ce11a,null));};exports['mailQueuesWaitingInteractions']=function(_0x131db0,_0x348831){return respondWithRpcPromise(_0xfe18('0x56'),_0x131db0[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x348831,null))[_0xfe18('0xe')](handleError(_0x348831,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x1a178f,_0x54b3f6){return respondWithRpcPromise(_0xfe18('0x57'),_0x1a178f[_0xfe18('0x17')],routingClient)['then'](respondWithResult(_0x54b3f6,null))[_0xfe18('0xe')](handleError(_0x54b3f6,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x14c9e6,_0x46a1fa){return respondWithRpcPromise(_0xfe18('0x57'),_0x14c9e6['query'],routingClient)[_0xfe18('0x9')](function(_0x5b8ccf){if(_0x14c9e6[_0xfe18('0x17')][_0xfe18('0x58')]!==undefined){var _0x491576=_(_0x5b8ccf[_0xfe18('0x16')])[_0xfe18('0x59')]([_0x14c9e6['query']['type'],_0x14c9e6[_0xfe18('0x1a')]['id']])['map'](_0xfe18('0x5a'))['uniq']()[_0xfe18('0x5b')]();return _0x5b8ccf[_0xfe18('0x16')]['filter'](function(_0x28ade4){return _0x491576[_0xfe18('0x5c')](_0x28ade4[_0xfe18('0x5a')])>-0x1;});}else{return _0x5b8ccf[_0xfe18('0x16')][_0xfe18('0x59')](function(_0x35ef29){return _0x35ef29[_0xfe18('0x5a')]===parseInt(_0x14c9e6[_0xfe18('0x1a')]['id']);});}})[_0xfe18('0x9')](respondWithResult(_0x46a1fa,null))[_0xfe18('0xe')](handleError(_0x46a1fa,null));};exports['smsQueuesWaitingInteractions']=function(_0x5684ef,_0x213ce8){return respondWithRpcPromise(_0xfe18('0x5d'),_0x5684ef[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x213ce8,null))['catch'](handleError(_0x213ce8,null));};exports[_0xfe18('0x5e')]=function(_0x276192,_0x3ac512){return respondWithRpcPromise(_0xfe18('0x5f'),_0x276192[_0xfe18('0x17')],routingClient)[_0xfe18('0x9')](respondWithResult(_0x3ac512,null))[_0xfe18('0xe')](handleError(_0x3ac512,null));};exports[_0xfe18('0x60')]=function(_0x3e8c1e,_0x26b69c){return respondWithRpcPromise(_0xfe18('0x61'),_0x3e8c1e['query'],routingClient)[_0xfe18('0x9')](respondWithResult(_0x26b69c,null))[_0xfe18('0xe')](handleError(_0x26b69c,null));};exports[_0xfe18('0x62')]=function(_0x377610){return function(_0x5cf5a0,_0xf387a6){var _0x57bf7f,_0x4bb775;var _0x85633f=_['capitalize'](_0x377610);var _0x4f3143=_0x377610===_0xfe18('0x63')?_0xfe18('0x64'):'Account';return db[_0x85633f+_0xfe18('0x65')][_0xfe18('0x66')]({'raw':!![],'where':{'id':_0x5cf5a0[_0xfe18('0x1a')]['id']}})['then'](function(_0x4aaee7){if(_['isNil'](_0x4aaee7)){throw new Error(_0x85633f+_0xfe18('0x67'));}_0x57bf7f=_0x4aaee7;return db[_0x85633f+_0xfe18('0x68')]['findOne']({'where':{'id':_0x5cf5a0[_0xfe18('0x2e')][_0xfe18('0x69')]},'include':[{'model':db[_0x85633f+_0xfe18('0x6a')],'as':_0xfe18('0x6a')},{'model':db[_0x85633f+_0x4f3143],'as':_0xfe18('0x6b')}]});})[_0xfe18('0x9')](function(_0x16f8ae){if(_[_0xfe18('0x6c')](_0x16f8ae)){throw new Error(_0x85633f+_0xfe18('0x6d'));}_0x4bb775=_0x16f8ae;return _0x16f8ae['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x34c64d={'uniqueid':_0x377610+'.'+_0x4bb775['id']+'.'+_0x4bb775[_0xfe18('0x6a')]['id'],'FromUserId':_0x5cf5a0[_0xfe18('0x30')]['id'],'type':_0xfe18('0x6e')};_0x34c64d[_0x85633f+'MessageId']=_0x4bb775['id'];_0x34c64d[_0x85633f+_0xfe18('0x6f')]=_0x4bb775[_0xfe18('0x6a')]['id'];_0x34c64d['From'+_0x85633f+_0x4f3143+'Id']=_0x4bb775['Account']['id'];_0x34c64d['To'+_0x85633f+_0xfe18('0x70')]=_0x57bf7f['id'];return db[_0x85633f+'TransferReport']['create'](_0x34c64d);})[_0xfe18('0x9')](function(){return respondWithRpcPromise('Start',{'channel':_0x377610,'interaction':_0x4bb775['Interaction'],'message':_0x4bb775,'account':_0x4bb775['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xfe18('0x6e'),'appdata':_0x57bf7f[_0xfe18('0x13')]+','+(_0x4bb775[_0xfe18('0x6b')][_0xfe18('0x71')]||0x12c),'interval':_0xfe18('0x72')}]},routingClient);})[_0xfe18('0x9')](respondWithResult(_0xf387a6,null))[_0xfe18('0xe')](handleError(_0xf387a6,null));};};exports['agentNotify']=function(_0x109331,_0x45e31e){var _0xd4747d,_0x3f726d;if(_[_0xfe18('0x6c')](_0x109331[_0xfe18('0x2e')][_0xfe18('0x73')])){throw new Error(_0xfe18('0x74'));}var _0x274a53=_0x109331[_0xfe18('0x2e')][_0xfe18('0x73')];var _0x27b312=_[_0xfe18('0x75')](_0x274a53);var _0x1cb049=_0x274a53===_0xfe18('0x63')?'Website':_0xfe18('0x6b');return db[_0xfe18('0x76')]['findOne']({'raw':!![],'where':{'id':_0x109331['params']['id'],'role':'agent'}})[_0xfe18('0x9')](function(_0xd4348){if(_['isNil'](_0xd4348)){throw new Error(_0xfe18('0x77'));}_0xd4747d=_0xd4348;return db[_0x27b312+_0xfe18('0x68')][_0xfe18('0x66')]({'where':{'id':_0x109331[_0xfe18('0x2e')][_0xfe18('0x69')]},'include':[{'model':db[_0x27b312+_0xfe18('0x6a')],'as':_0xfe18('0x6a')},{'model':db[_0x27b312+_0x1cb049],'as':_0xfe18('0x6b')}]});})[_0xfe18('0x9')](function(_0x2f90de){if(_[_0xfe18('0x6c')](_0x2f90de)){throw new Error(_0x27b312+'\x20Message\x20not\x20found');}_0x3f726d=_0x2f90de;return _0x2f90de[_0xfe18('0x78')]({'read':0x0,'readAt':null,'UserId':null});})[_0xfe18('0x9')](function(){var _0x1dd8dc={'uniqueid':_0x274a53+'.'+_0x3f726d['id']+'.'+_0x3f726d['Interaction']['id'],'FromUserId':_0x109331['user']['id'],'type':_0xfe18('0x6e'),'ToUserId':_0xd4747d['id']};_0x1dd8dc[_0x27b312+'MessageId']=_0x3f726d['id'];_0x1dd8dc[_0x27b312+_0xfe18('0x6f')]=_0x3f726d[_0xfe18('0x6a')]['id'];_0x1dd8dc[_0xfe18('0x79')+_0x27b312+_0x1cb049+'Id']=_0x3f726d[_0xfe18('0x6b')]['id'];return db[_0x27b312+_0xfe18('0x7a')][_0xfe18('0x7b')](_0x1dd8dc);})[_0xfe18('0x9')](function(){return respondWithRpcPromise(_0xfe18('0x7c'),{'channel':_0x274a53,'interaction':_0x3f726d[_0xfe18('0x6a')],'message':_0x3f726d,'account':_0x3f726d[_0xfe18('0x6b')],'applications':[{'id':0x0,'priority':0x1,'app':_0xfe18('0x3b'),'appdata':_0xd4747d[_0xfe18('0x13')]+','+(_0x3f726d[_0xfe18('0x6b')][_0xfe18('0x7d')]||0x12c),'interval':_0xfe18('0x72')}]},routingClient);})['then'](respondWithResult(_0x45e31e,null))[_0xfe18('0xe')](handleError(_0x45e31e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3a54099..0209c23 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 _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 +var _0x1c61=['Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','post','create','put','update','delete','destroy','util','path','connect-timeout','express'];(function(_0xb14b26,_0x38cf9f){var _0xfdb28a=function(_0x380d1c){while(--_0x380d1c){_0xb14b26['push'](_0xb14b26['shift']());}};_0xfdb28a(++_0x38cf9f);}(_0x1c61,0x18b));var _0x11c6=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x1c61[_0x4164f2];return _0x2575c7;};'use strict';var multer=require('multer');var util=require(_0x11c6('0x0'));var path=require(_0x11c6('0x1'));var timeout=require(_0x11c6('0x2'));var express=require(_0x11c6('0x3'));var router=express[_0x11c6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x11c6('0x5'));var config=require(_0x11c6('0x6'));var controller=require(_0x11c6('0x7'));router[_0x11c6('0x8')]('/',auth[_0x11c6('0x9')](),controller[_0x11c6('0xa')]);router['get'](_0x11c6('0xb'),auth[_0x11c6('0x9')](),controller[_0x11c6('0xc')]);router['get'](_0x11c6('0xd'),auth[_0x11c6('0x9')](),controller[_0x11c6('0xe')]);router[_0x11c6('0xf')]('/',auth['isAuthenticated'](),controller[_0x11c6('0x10')]);router[_0x11c6('0x11')]('/:id',auth[_0x11c6('0x9')](),controller[_0x11c6('0x12')]);router[_0x11c6('0x13')](_0x11c6('0xb'),auth[_0x11c6('0x9')](),controller[_0x11c6('0x14')]);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 faf8966..8ff6c8f 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 _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 +var _0x044a=['years','quarters','months','weeks','hours','minutes','days','ENUM','pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER'];(function(_0xa29c5,_0x367adf){var _0x65e746=function(_0x177599){while(--_0x177599){_0xa29c5['push'](_0xa29c5['shift']());}};_0x65e746(++_0x367adf);}(_0x044a,0x173));var _0xa044=function(_0x413f25,_0x5e1d1e){_0x413f25=_0x413f25-0x0;var _0x419406=_0x044a[_0x413f25];return _0x419406;};'use strict';var Sequelize=require(_0xa044('0x0'));module[_0xa044('0x1')]={'name':{'type':Sequelize[_0xa044('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa044('0x2')]},'active':{'type':Sequelize[_0xa044('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa044('0x2')],'allowNull':![],'defaultValue':_0xa044('0x4')},'startAt':{'type':Sequelize[_0xa044('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa044('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa044('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xa044('0x7'),_0xa044('0x8'),_0xa044('0x9'),_0xa044('0xa'),'days',_0xa044('0xb'),_0xa044('0xc')),'allowNull':![],'defaultValue':_0xa044('0xd')},'output':{'type':Sequelize[_0xa044('0xe')]('csv',_0xa044('0xf'),_0xa044('0x10')),'allowNull':![],'defaultValue':_0xa044('0x11')},'type':{'type':Sequelize['ENUM'](_0xa044('0x12'),_0xa044('0x13')),'allowNull':![],'defaultValue':_0xa044('0x12')},'sendMail':{'type':Sequelize[_0xa044('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xa044('0x14')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 269a004..1668e79 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 _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 +var _0x7af3=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','Schedule','includeAll','findAll','rows','catch','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','html-pdf','eml-format','zip-dir','request-promise','moment','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','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','update','then','get','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x16d773,_0x49d88f){var _0x105d96=function(_0x3b7076){while(--_0x3b7076){_0x16d773['push'](_0x16d773['shift']());}};_0x105d96(++_0x49d88f);}(_0x7af3,0x123));var _0x37af=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7af3[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0x37af('0x0'));var emlformat=require(_0x37af('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x37af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x37af('0x3'));var moment=require(_0x37af('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37af('0x5'));var util=require(_0x37af('0x6'));var path=require(_0x37af('0x7'));var sox=require(_0x37af('0x8'));var csv=require(_0x37af('0x9'));var ejs=require(_0x37af('0xa'));var fs=require('fs');var _=require(_0x37af('0xb'));var squel=require('squel');var crypto=require(_0x37af('0xc'));var jsforce=require(_0x37af('0xd'));var deskjs=require(_0x37af('0xe'));var toCsv=require(_0x37af('0x9'));var querystring=require(_0x37af('0xf'));var Papa=require('papaparse');var Redis=require(_0x37af('0x10'));var authService=require(_0x37af('0x11'));var qs=require(_0x37af('0x12'));var as=require(_0x37af('0x13'));var hardwareService=require(_0x37af('0x14'));var logger=require(_0x37af('0x15'))('api');var utils=require(_0x37af('0x16'));var config=require(_0x37af('0x17'));var licenseUtil=require(_0x37af('0x18'));var db=require(_0x37af('0x19'))['db'];function respondWithStatusCode(_0x463a9a,_0x57640e){_0x57640e=_0x57640e||0xcc;return function(_0x49aae6){if(_0x49aae6){return _0x463a9a[_0x37af('0x1a')](_0x57640e);}return _0x463a9a['status'](_0x57640e)[_0x37af('0x1b')]();};}function respondWithResult(_0x5c2ac2,_0x360adb){_0x360adb=_0x360adb||0xc8;return function(_0x58aa52){if(_0x58aa52){return _0x5c2ac2['status'](_0x360adb)[_0x37af('0x1c')](_0x58aa52);}};}function respondWithFilteredResult(_0x13c3d4,_0x3f1e93){return function(_0x22d56f){if(_0x22d56f){var _0x3a2d06=_0x22d56f[_0x37af('0x1d')],_0x1f3fa9=_0x3f1e93[_0x37af('0x1e')],_0x33f0b0=_0x3f1e93[_0x37af('0x1e')]+_0x3f1e93[_0x37af('0x1f')],_0x598b8a;if(_0x33f0b0>=_0x3a2d06){_0x33f0b0=_0x3a2d06;_0x598b8a=0xc8;}else{_0x598b8a=0xce;}_0x13c3d4[_0x37af('0x20')](_0x598b8a);return _0x13c3d4[_0x37af('0x21')]('Content-Range',_0x1f3fa9+'-'+_0x33f0b0+'/'+_0x3a2d06)[_0x37af('0x1c')](_0x22d56f);}return null;};}function patchUpdates(_0x1b1d75){return function(_0x1c919e){try{jsonpatch[_0x37af('0x22')](_0x1c919e,_0x1b1d75,!![]);}catch(_0x25c069){return BPromise[_0x37af('0x23')](_0x25c069);}return _0x1c919e[_0x37af('0x24')]();};}function saveUpdates(_0x2d8577,_0x5cf661){return function(_0x30d36d){if(_0x30d36d){return _0x30d36d[_0x37af('0x25')](_0x2d8577)[_0x37af('0x26')](function(_0x1bf0ac){return _0x1bf0ac;});}return null;};}function removeEntity(_0x3f0d38,_0x55ba36){return function(_0x42c697){if(_0x42c697){return _0x42c697['destroy']()[_0x37af('0x26')](function(){var _0x4770c4=_0x42c697[_0x37af('0x27')]({'plain':!![]});var _0x287a68='Scheduler';return db['UserProfileResource'][_0x37af('0x28')]({'where':{'type':_0x287a68,'resourceId':_0x4770c4['id']}})[_0x37af('0x26')](function(){return _0x42c697;});})[_0x37af('0x26')](function(){_0x3f0d38[_0x37af('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde899b,_0x18f31f){return function(_0x290fe7){if(!_0x290fe7){_0xde899b[_0x37af('0x1a')](0x194);}return _0x290fe7;};}function handleError(_0x5a3e3d,_0x19b710){_0x19b710=_0x19b710||0x1f4;return function(_0x3669a2){logger[_0x37af('0x29')](_0x3669a2[_0x37af('0x2a')]);if(_0x3669a2[_0x37af('0x2b')]){delete _0x3669a2[_0x37af('0x2b')];}_0x5a3e3d['status'](_0x19b710)[_0x37af('0x2c')](_0x3669a2);};}exports[_0x37af('0x2d')]=function(_0x164e89,_0x35bad7){var _0x5bf8c2={},_0x322647={},_0x24ebac={'count':0x0,'rows':[]};var _0x2f6db1=_[_0x37af('0x2e')](db['Schedule'][_0x37af('0x2f')],function(_0x51b5eb){return{'name':_0x51b5eb[_0x37af('0x30')],'type':_0x51b5eb[_0x37af('0x31')][_0x37af('0x32')]};});_0x322647[_0x37af('0x33')]=_[_0x37af('0x2e')](_0x2f6db1,_0x37af('0x2b'));_0x322647[_0x37af('0x34')]=_[_0x37af('0x35')](_0x164e89[_0x37af('0x34')]);_0x322647[_0x37af('0x36')]=_[_0x37af('0x37')](_0x322647[_0x37af('0x33')],_0x322647['query']);_0x5bf8c2[_0x37af('0x38')]=_[_0x37af('0x37')](_0x322647[_0x37af('0x33')],qs[_0x37af('0x39')](_0x164e89[_0x37af('0x34')][_0x37af('0x39')]));_0x5bf8c2['attributes']=_0x5bf8c2[_0x37af('0x38')]['length']?_0x5bf8c2[_0x37af('0x38')]:_0x322647[_0x37af('0x33')];if(!_0x164e89[_0x37af('0x34')][_0x37af('0x3a')](_0x37af('0x3b'))){_0x5bf8c2[_0x37af('0x1f')]=qs[_0x37af('0x1f')](_0x164e89[_0x37af('0x34')][_0x37af('0x1f')]);_0x5bf8c2[_0x37af('0x1e')]=qs[_0x37af('0x1e')](_0x164e89['query'][_0x37af('0x1e')]);}_0x5bf8c2['order']=qs[_0x37af('0x3c')](_0x164e89[_0x37af('0x34')][_0x37af('0x3c')]);_0x5bf8c2[_0x37af('0x3d')]=qs[_0x37af('0x36')](_['pick'](_0x164e89[_0x37af('0x34')],_0x322647[_0x37af('0x36')]),_0x2f6db1);if(_0x164e89[_0x37af('0x34')][_0x37af('0x3e')]){_0x5bf8c2[_0x37af('0x3d')]=_['merge'](_0x5bf8c2[_0x37af('0x3d')],{'$or':_[_0x37af('0x2e')](_0x2f6db1,function(_0x1708bc){if(_0x1708bc[_0x37af('0x31')]!==_0x37af('0x3f')){var _0x24050d={};_0x24050d[_0x1708bc['name']]={'$like':'%'+_0x164e89[_0x37af('0x34')]['filter']+'%'};return _0x24050d;}})});}_0x5bf8c2=_[_0x37af('0x40')]({},_0x5bf8c2,_0x164e89[_0x37af('0x41')]);var _0x5f1528={'where':_0x5bf8c2[_0x37af('0x3d')]};return db[_0x37af('0x42')][_0x37af('0x1d')](_0x5f1528)['then'](function(_0x2c7ad1){_0x24ebac[_0x37af('0x1d')]=_0x2c7ad1;if(_0x164e89[_0x37af('0x34')][_0x37af('0x43')]){_0x5bf8c2['include']=[{'all':!![]}];}return db[_0x37af('0x42')][_0x37af('0x44')](_0x5bf8c2);})['then'](function(_0x901051){_0x24ebac[_0x37af('0x45')]=_0x901051;return _0x24ebac;})[_0x37af('0x26')](respondWithFilteredResult(_0x35bad7,_0x5bf8c2))[_0x37af('0x46')](handleError(_0x35bad7,null));};exports['show']=function(_0x65c912,_0x34455c){var _0x1f28e2={'raw':![],'where':{'id':_0x65c912['params']['id']}},_0x55b3db={};_0x55b3db[_0x37af('0x33')]=_['keys'](db[_0x37af('0x42')][_0x37af('0x2f')]);_0x55b3db['query']=_[_0x37af('0x35')](_0x65c912[_0x37af('0x34')]);_0x55b3db[_0x37af('0x36')]=_[_0x37af('0x37')](_0x55b3db[_0x37af('0x33')],_0x55b3db[_0x37af('0x34')]);_0x1f28e2['attributes']=_[_0x37af('0x37')](_0x55b3db[_0x37af('0x33')],qs[_0x37af('0x39')](_0x65c912[_0x37af('0x34')]['fields']));_0x1f28e2[_0x37af('0x38')]=_0x1f28e2['attributes'][_0x37af('0x47')]?_0x1f28e2[_0x37af('0x38')]:_0x55b3db[_0x37af('0x33')];if(_0x65c912[_0x37af('0x34')][_0x37af('0x43')]){_0x1f28e2[_0x37af('0x48')]=[{'all':!![]}];}_0x1f28e2=_['merge']({},_0x1f28e2,_0x65c912['options']);return db[_0x37af('0x42')][_0x37af('0x49')](_0x1f28e2)[_0x37af('0x26')](handleEntityNotFound(_0x34455c,null))[_0x37af('0x26')](respondWithResult(_0x34455c,null))[_0x37af('0x46')](handleError(_0x34455c,null));};exports['create']=function(_0x35a427,_0xc88fa5){return db['Schedule'][_0x37af('0x4a')](_0x35a427[_0x37af('0x4b')],{})[_0x37af('0x26')](function(_0x4b4622){var _0x17f403=_0x35a427['user']['get']({'plain':!![]});if(!_0x17f403)throw new Error(_0x37af('0x4c'));if(_0x17f403[_0x37af('0x4d')]==='user'){var _0x76bfa2=_0x4b4622[_0x37af('0x27')]({'plain':!![]});var _0x5477ed=_0x37af('0x4e');return db[_0x37af('0x4f')][_0x37af('0x49')]({'where':{'name':_0x5477ed,'userProfileId':_0x17f403[_0x37af('0x50')]},'raw':!![]})[_0x37af('0x26')](function(_0x430251){if(_0x430251&&_0x430251[_0x37af('0x51')]===0x0){return db[_0x37af('0x52')][_0x37af('0x4a')]({'name':_0x76bfa2['name'],'resourceId':_0x76bfa2['id'],'type':_0x430251['name'],'sectionId':_0x430251['id']},{})['then'](function(){return _0x4b4622;});}else{return _0x4b4622;}})['catch'](function(_0x1e67cb){logger[_0x37af('0x29')](_0x37af('0x53'),_0x1e67cb);throw _0x1e67cb;});}return _0x4b4622;})['then'](respondWithResult(_0xc88fa5,0xc9))['catch'](handleError(_0xc88fa5,null));};exports['update']=function(_0x5761e7,_0x35fc51){if(_0x5761e7['body']['id']){delete _0x5761e7[_0x37af('0x4b')]['id'];}return db['Schedule'][_0x37af('0x49')]({'where':{'id':_0x5761e7[_0x37af('0x54')]['id']}})[_0x37af('0x26')](handleEntityNotFound(_0x35fc51,null))[_0x37af('0x26')](saveUpdates(_0x5761e7[_0x37af('0x4b')],null))[_0x37af('0x26')](respondWithResult(_0x35fc51,null))[_0x37af('0x46')](handleError(_0x35fc51,null));};exports[_0x37af('0x28')]=function(_0xdcc840,_0x272d3e){return db[_0x37af('0x42')][_0x37af('0x49')]({'where':{'id':_0xdcc840['params']['id']}})[_0x37af('0x26')](handleEntityNotFound(_0x272d3e,null))[_0x37af('0x26')](removeEntity(_0x272d3e,null))[_0x37af('0x46')](handleError(_0x272d3e,null));};exports[_0x37af('0x55')]=function(_0x16d4a9,_0x1f6894,_0x515398){var _0x196ce5=require('../../config/schedule');return db[_0x37af('0x42')]['find']({'where':{'id':_0x16d4a9[_0x37af('0x54')]['id']},'raw':!![]})[_0x37af('0x26')](handleEntityNotFound(_0x1f6894,null))[_0x37af('0x26')](function(){_0x196ce5['run'](_0x16d4a9['params']['id']);})[_0x37af('0x26')](respondWithStatusCode(_0x1f6894,null))[_0x37af('0x46')](handleError(_0x1f6894,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3357916..5a47d52 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 _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 +var _0x4e20=['define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes'];(function(_0x2160bc,_0x417d34){var _0xb81542=function(_0x19a757){while(--_0x19a757){_0x2160bc['push'](_0x2160bc['shift']());}};_0xb81542(++_0x417d34);}(_0x4e20,0xe3));var _0x04e2=function(_0x200827,_0x4af951){_0x200827=_0x200827-0x0;var _0x120047=_0x4e20[_0x200827];return _0x120047;};'use strict';var _=require(_0x04e2('0x0'));var util=require(_0x04e2('0x1'));var logger=require(_0x04e2('0x2'))(_0x04e2('0x3'));var moment=require(_0x04e2('0x4'));var BPromise=require(_0x04e2('0x5'));var rp=require(_0x04e2('0x6'));var fs=require('fs');var path=require(_0x04e2('0x7'));var rimraf=require(_0x04e2('0x8'));var config=require(_0x04e2('0x9'));var attributes=require(_0x04e2('0xa'));module['exports']=function(_0x4de02d,_0x422ed7){return _0x4de02d[_0x04e2('0xb')](_0x04e2('0xc'),attributes,{'tableName':_0x04e2('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 3d304d0..57fb482 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 _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 +var _0x8a15=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3b3922,_0x24662b){var _0x3bdbcb=function(_0x28a32a){while(--_0x28a32a){_0x3b3922['push'](_0x3b3922['shift']());}};_0x3bdbcb(++_0x24662b);}(_0x8a15,0x1c7));var _0x58a1=function(_0x558dad,_0x1a9b5a){_0x558dad=_0x558dad-0x0;var _0x1921ea=_0x8a15[_0x558dad];return _0x1921ea;};'use strict';var _=require(_0x58a1('0x0'));var util=require(_0x58a1('0x1'));var moment=require(_0x58a1('0x2'));var BPromise=require(_0x58a1('0x3'));var rs=require(_0x58a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x58a1('0x5'));var logger=require(_0x58a1('0x6'))(_0x58a1('0x7'));var config=require(_0x58a1('0x8'));var jayson=require(_0x58a1('0x9'));var client=jayson['client'][_0x58a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x232337,_0x536b55,_0x5ed2cc){return new BPromise(function(_0x4d5aa9,_0xa6a441){return client[_0x58a1('0xb')](_0x232337,_0x5ed2cc)['then'](function(_0x46b566){logger['info'](_0x58a1('0xc'),_0x536b55,_0x58a1('0xd'));logger[_0x58a1('0xe')](_0x58a1('0xf'),_0x536b55,_0x58a1('0xd'),JSON[_0x58a1('0x10')](_0x46b566));if(_0x46b566[_0x58a1('0x11')]){if(_0x46b566['error'][_0x58a1('0x12')]===0x1f4){logger[_0x58a1('0x11')](_0x58a1('0xc'),_0x536b55,_0x46b566[_0x58a1('0x11')][_0x58a1('0x13')]);return _0xa6a441(_0x46b566['error'][_0x58a1('0x13')]);}logger[_0x58a1('0x11')](_0x58a1('0xc'),_0x536b55,_0x46b566[_0x58a1('0x11')]['message']);return _0x4d5aa9(_0x46b566['error'][_0x58a1('0x13')]);}else{logger[_0x58a1('0x14')](_0x58a1('0xc'),_0x536b55,_0x58a1('0xd'));_0x4d5aa9(_0x46b566[_0x58a1('0x15')][_0x58a1('0x13')]);}})[_0x58a1('0x16')](function(_0x3a04dd){logger[_0x58a1('0x11')]('Schedule,\x20%s,\x20%s',_0x536b55,_0x3a04dd);_0xa6a441(_0x3a04dd);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index fdda2e3..accc785 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 _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 +var _0x5c5b=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','index','/describe','/:id','download','post','create','put','delete','destroy','exports','path'];(function(_0x346149,_0x2ce05e){var _0xd64589=function(_0x8c739d){while(--_0x8c739d){_0x346149['push'](_0x346149['shift']());}};_0xd64589(++_0x2ce05e);}(_0x5c5b,0x12f));var _0xb5c5=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0x5c5b[_0x3430aa];return _0x2ac5c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb5c5('0x0'));var timeout=require(_0xb5c5('0x1'));var express=require(_0xb5c5('0x2'));var router=express[_0xb5c5('0x3')]();var auth=require(_0xb5c5('0x4'));var interaction=require(_0xb5c5('0x5'));var config=require('../../config/environment');var controller=require(_0xb5c5('0x6'));router[_0xb5c5('0x7')]('/',auth[_0xb5c5('0x8')](),controller[_0xb5c5('0x9')]);router[_0xb5c5('0x7')](_0xb5c5('0xa'),auth[_0xb5c5('0x8')](),controller['describe']);router['get'](_0xb5c5('0xb'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/download',auth[_0xb5c5('0x8')](),controller[_0xb5c5('0xc')]);router[_0xb5c5('0xd')]('/',auth[_0xb5c5('0x8')](),controller[_0xb5c5('0xe')]);router[_0xb5c5('0xf')]('/:id',auth[_0xb5c5('0x8')](),controller['update']);router[_0xb5c5('0x10')](_0xb5c5('0xb'),auth[_0xb5c5('0x8')](),controller[_0xb5c5('0x11')]);module[_0xb5c5('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index b8280b3..5c59563 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 _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 +var _0x3eea=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','path'];(function(_0x3672ff,_0x458fc3){var _0x4e2aa8=function(_0x5708b3){while(--_0x5708b3){_0x3672ff['push'](_0x3672ff['shift']());}};_0x4e2aa8(++_0x458fc3);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5632c5,_0x567e16){_0x5632c5=_0x5632c5-0x0;var _0xfde203=_0x3eea[_0x5632c5];return _0xfde203;};'use strict';var Sequelize=require(_0xa3ee('0x0'));var moment=require('moment');var path=require(_0xa3ee('0x1'));var config=require(_0xa3ee('0x2'));module[_0xa3ee('0x3')]={'format':{'type':Sequelize[_0xa3ee('0x4')],'get':function(){return this[_0xa3ee('0x5')](_0xa3ee('0x6'))?path[_0xa3ee('0x7')](this[_0xa3ee('0x5')](_0xa3ee('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xa3ee('0x8')]},'channel':{'type':Sequelize[_0xa3ee('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x538bf9){var _0x4183ee=_0x538bf9['replace'](/\\/g,'/');this[_0xa3ee('0x9')]('value',_0x4183ee);}},'rating':{'type':Sequelize[_0xa3ee('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xb1b96d){this['setDataValue'](_0xa3ee('0xb'),moment()[_0xa3ee('0xc')](_0xb1b96d,'ms'));this[_0xa3ee('0x9')]('closedAt',moment());this[_0xa3ee('0x9')](_0xa3ee('0xd'),_0xb1b96d);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa3ee('0xb')))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')]('closedAt'))[_0xa3ee('0xe')](_0xa3ee('0xf'))[_0xa3ee('0x10')]();}},'createdAt':{'type':Sequelize[_0xa3ee('0x11')],'get':function(){return moment(this['getDataValue'](_0xa3ee('0x12')))[_0xa3ee('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xa3ee('0x5')](_0xa3ee('0x13')))[_0xa3ee('0xe')](_0xa3ee('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 36e64d4..4710a1f 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 _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 +var _0x9828=['update','duration','closedAt','describe','download','../../components/encryptor','type','uniqueid','value','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','join','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','root','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','apply','reject','save','then','destroy','stack','name','send','index','ScreenRecording','fieldName','differenceBy','map','format','intersection','model','query','attributes','fields','length','limit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','find','create','body'];(function(_0x3e7b38,_0x31fbd6){var _0x52c258=function(_0x5957c3){while(--_0x5957c3){_0x3e7b38['push'](_0x3e7b38['shift']());}};_0x52c258(++_0x31fbd6);}(_0x9828,0x1a6));var _0x8982=function(_0x4077b2,_0x52377b){_0x4077b2=_0x4077b2-0x0;var _0x433d3c=_0x9828[_0x4077b2];return _0x433d3c;};'use strict';var pdf=require(_0x8982('0x0'));var emlformat=require(_0x8982('0x1'));var rimraf=require(_0x8982('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8982('0x3'));var moment=require(_0x8982('0x4'));var BPromise=require(_0x8982('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8982('0x6'));var sox=require(_0x8982('0x7'));var csv=require(_0x8982('0x8'));var ejs=require(_0x8982('0x9'));var fs=require('fs');var _=require(_0x8982('0xa'));var squel=require(_0x8982('0xb'));var crypto=require('crypto');var jsforce=require(_0x8982('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8982('0xd'));var Redis=require(_0x8982('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8982('0xf'));var as=require(_0x8982('0x10'));var hardwareService=require(_0x8982('0x11'));var logger=require(_0x8982('0x12'))(_0x8982('0x13'));var utils=require(_0x8982('0x14'));var config=require(_0x8982('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8982('0x16'))['db'];function respondWithStatusCode(_0x2c891a,_0xead0bd){_0xead0bd=_0xead0bd||0xcc;return function(_0x86f696){if(_0x86f696){return _0x2c891a['sendStatus'](_0xead0bd);}return _0x2c891a[_0x8982('0x17')](_0xead0bd)[_0x8982('0x18')]();};}function respondWithResult(_0x3ba2d,_0x2334c5){_0x2334c5=_0x2334c5||0xc8;return function(_0x4ea2b1){if(_0x4ea2b1){return _0x3ba2d['status'](_0x2334c5)[_0x8982('0x19')](_0x4ea2b1);}};}function respondWithFilteredResult(_0x5a7573,_0x414725){return function(_0x9573b){if(_0x9573b){var _0x5cccc8=_0x9573b[_0x8982('0x1a')],_0x455be2=_0x414725[_0x8982('0x1b')],_0x485c12=_0x414725[_0x8982('0x1b')]+_0x414725['limit'],_0x18ba4e;if(_0x485c12>=_0x5cccc8){_0x485c12=_0x5cccc8;_0x18ba4e=0xc8;}else{_0x18ba4e=0xce;}_0x5a7573['status'](_0x18ba4e);return _0x5a7573[_0x8982('0x1c')]('Content-Range',_0x455be2+'-'+_0x485c12+'/'+_0x5cccc8)[_0x8982('0x19')](_0x9573b);}return null;};}function patchUpdates(_0x5462c9){return function(_0x4bbd1b){try{jsonpatch[_0x8982('0x1d')](_0x4bbd1b,_0x5462c9,!![]);}catch(_0x3d59e3){return BPromise[_0x8982('0x1e')](_0x3d59e3);}return _0x4bbd1b[_0x8982('0x1f')]();};}function saveUpdates(_0x114b5e,_0x238dbb){return function(_0x4a7380){if(_0x4a7380){return _0x4a7380['update'](_0x114b5e)[_0x8982('0x20')](function(_0x51a46a){return _0x51a46a;});}return null;};}function removeEntity(_0xe8c922,_0x16b737){return function(_0x30db38){if(_0x30db38){return _0x30db38[_0x8982('0x21')]()[_0x8982('0x20')](function(){_0xe8c922[_0x8982('0x17')](0xcc)[_0x8982('0x18')]();});}};}function handleEntityNotFound(_0x48db57,_0x207918){return function(_0x86f790){if(!_0x86f790){_0x48db57['sendStatus'](0x194);}return _0x86f790;};}function handleError(_0x3d204c,_0x1b36b8){_0x1b36b8=_0x1b36b8||0x1f4;return function(_0x1e94c9){logger['error'](_0x1e94c9[_0x8982('0x22')]);if(_0x1e94c9[_0x8982('0x23')]){delete _0x1e94c9['name'];}_0x3d204c[_0x8982('0x17')](_0x1b36b8)[_0x8982('0x24')](_0x1e94c9);};}exports[_0x8982('0x25')]=function(_0x17ebd7,_0x5775e3){var _0x491950={},_0x10a9a9={},_0x3e22f8={'count':0x0,'rows':[]};var _0x27f3d2=_['map'](db[_0x8982('0x26')]['rawAttributes'],function(_0x46effa){return{'name':_0x46effa[_0x8982('0x27')],'type':_0x46effa['type']['key']};});_0x10a9a9['model']=_[_0x8982('0x28')](_[_0x8982('0x29')](_0x27f3d2,_0x8982('0x23')),[_0x8982('0x2a')]);_0x10a9a9['query']=_['keys'](_0x17ebd7['query']);_0x10a9a9['filters']=_[_0x8982('0x2b')](_0x10a9a9[_0x8982('0x2c')],_0x10a9a9[_0x8982('0x2d')]);_0x491950[_0x8982('0x2e')]=_['intersection'](_0x10a9a9[_0x8982('0x2c')],qs[_0x8982('0x2f')](_0x17ebd7[_0x8982('0x2d')][_0x8982('0x2f')]));_0x491950['attributes']=_0x491950[_0x8982('0x2e')][_0x8982('0x30')]?_0x491950[_0x8982('0x2e')]:_0x10a9a9['model'];if(!_0x17ebd7[_0x8982('0x2d')]['hasOwnProperty']('nolimit')){_0x491950[_0x8982('0x31')]=qs[_0x8982('0x31')](_0x17ebd7[_0x8982('0x2d')][_0x8982('0x31')]);_0x491950[_0x8982('0x1b')]=qs[_0x8982('0x1b')](_0x17ebd7['query'][_0x8982('0x1b')]);}_0x491950[_0x8982('0x32')]=qs[_0x8982('0x33')](_0x17ebd7[_0x8982('0x2d')][_0x8982('0x33')]);_0x491950[_0x8982('0x34')]=qs[_0x8982('0x35')](_['pick'](_0x17ebd7[_0x8982('0x2d')],_0x10a9a9[_0x8982('0x35')]),_0x27f3d2);if(_0x17ebd7['query'][_0x8982('0x36')]){_0x491950[_0x8982('0x34')]=_[_0x8982('0x37')](_0x491950[_0x8982('0x34')],{'$or':_['map'](_0x27f3d2,function(_0x1cbd93){if(_0x1cbd93['type']!=='VIRTUAL'){var _0x39ccbd={};_0x39ccbd[_0x1cbd93['name']]={'$like':'%'+_0x17ebd7['query'][_0x8982('0x36')]+'%'};return _0x39ccbd;}})});}_0x491950=_[_0x8982('0x37')]({},_0x491950,_0x17ebd7['options']);var _0x45c441={'where':_0x491950['where']};return db[_0x8982('0x26')]['count'](_0x45c441)[_0x8982('0x20')](function(_0x507517){_0x3e22f8['count']=_0x507517;if(_0x17ebd7['query'][_0x8982('0x38')]){_0x491950[_0x8982('0x39')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8982('0x3a')](_0x491950);})[_0x8982('0x20')](function(_0x31ac71){_0x3e22f8[_0x8982('0x3b')]=_0x31ac71;return _0x3e22f8;})[_0x8982('0x20')](respondWithFilteredResult(_0x5775e3,_0x491950))[_0x8982('0x3c')](handleError(_0x5775e3,null));};exports['show']=function(_0x2967bd,_0x10eb0d){var _0x2a1713={'raw':![],'where':{'id':_0x2967bd[_0x8982('0x3d')]['id']}},_0x10fa05={};_0x10fa05[_0x8982('0x2c')]=_[_0x8982('0x3e')](db[_0x8982('0x26')][_0x8982('0x3f')]);_0x10fa05[_0x8982('0x2d')]=_[_0x8982('0x3e')](_0x2967bd[_0x8982('0x2d')]);_0x10fa05[_0x8982('0x35')]=_[_0x8982('0x2b')](_0x10fa05[_0x8982('0x2c')],_0x10fa05['query']);_0x2a1713[_0x8982('0x2e')]=_['intersection'](_0x10fa05[_0x8982('0x2c')],qs[_0x8982('0x2f')](_0x2967bd[_0x8982('0x2d')][_0x8982('0x2f')]));_0x2a1713[_0x8982('0x2e')]=_0x2a1713['attributes']['length']?_0x2a1713[_0x8982('0x2e')]:_0x10fa05[_0x8982('0x2c')];if(_0x2967bd[_0x8982('0x2d')][_0x8982('0x38')]){_0x2a1713[_0x8982('0x39')]=[{'all':!![]}];}_0x2a1713=_['merge']({},_0x2a1713,_0x2967bd[_0x8982('0x40')]);return db['ScreenRecording'][_0x8982('0x41')](_0x2a1713)[_0x8982('0x20')](handleEntityNotFound(_0x10eb0d,null))[_0x8982('0x20')](respondWithResult(_0x10eb0d,null))['catch'](handleError(_0x10eb0d,null));};exports[_0x8982('0x42')]=function(_0x354085,_0x10fe22){return db[_0x8982('0x26')][_0x8982('0x42')](_0x354085[_0x8982('0x43')],{})[_0x8982('0x20')](respondWithResult(_0x10fe22,0xc9))['catch'](handleError(_0x10fe22,null));};exports[_0x8982('0x44')]=function(_0x1d7384,_0x452b4d){if(_0x1d7384[_0x8982('0x43')]['id']){delete _0x1d7384[_0x8982('0x43')]['id'];}delete _0x1d7384[_0x8982('0x43')][_0x8982('0x45')];delete _0x1d7384[_0x8982('0x43')]['createdAt'];delete _0x1d7384[_0x8982('0x43')][_0x8982('0x46')];delete _0x1d7384[_0x8982('0x43')]['value'];return db['ScreenRecording'][_0x8982('0x41')]({'where':{'id':_0x1d7384[_0x8982('0x3d')]['id']}})[_0x8982('0x20')](handleEntityNotFound(_0x452b4d,null))['then'](saveUpdates(_0x1d7384[_0x8982('0x43')],null))[_0x8982('0x20')](respondWithResult(_0x452b4d,null))[_0x8982('0x3c')](handleError(_0x452b4d,null));};exports[_0x8982('0x47')]=function(_0x76c142,_0x36dc2b){return db['ScreenRecording'][_0x8982('0x47')]()[_0x8982('0x20')](respondWithResult(_0x36dc2b,null))[_0x8982('0x3c')](handleError(_0x36dc2b,null));};exports[_0x8982('0x48')]=function(_0x54b7a1,_0x3e9f77,_0x3bde2e){var _0x57475e=require(_0x8982('0x49'));var _0x3bb0aa=![];var _0x126b13={};if(_0x54b7a1[_0x8982('0x2d')][_0x8982('0x4a')]&&_0x54b7a1['query']['type']===_0x8982('0x4b')){_0x126b13['uniqueid']=_0x54b7a1[_0x8982('0x3d')]['id'];}else{_0x126b13['id']=_0x54b7a1[_0x8982('0x3d')]['id'];}return db[_0x8982('0x26')][_0x8982('0x41')]({'where':_0x126b13,'attributes':['id',_0x8982('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x3e9f77,null))[_0x8982('0x20')](function(_0x4dcbbd){if(_0x4dcbbd){var _0xa76a6f=path['join'](config['root'],_0x8982('0x4d'),_0x4dcbbd[_0x8982('0x4c')]);var _0x46cb25=util['format']('%s.cypher',_0xa76a6f);if(fs[_0x8982('0x4e')](_0x46cb25)){_0x3bb0aa=!![];return _0x57475e[_0x8982('0x4f')](_0x46cb25,_0xa76a6f,config[_0x8982('0x50')][_0x8982('0x51')])[_0x8982('0x20')](function(){return _0x4dcbbd;});}return _0x4dcbbd;}})[_0x8982('0x20')](function(_0xd6bef7){if(_0xd6bef7){var _0x1a6ad4=path[_0x8982('0x52')](config['root'],_0x8982('0x4d'),_0xd6bef7[_0x8982('0x4c')]);if(!fs['existsSync'](_0x1a6ad4)){throw new db[(_0x8982('0x53'))][(_0x8982('0x54'))](_0x8982('0x55'));}if(_0xd6bef7['filename']){return _0x3e9f77[_0x8982('0x48')](_0x1a6ad4,_0xd6bef7[_0x8982('0x56')]+path[_0x8982('0x57')](_0x1a6ad4),function(){if(_0x3bb0aa){fs['unlink'](_0x1a6ad4);}});}else{return _0x3e9f77[_0x8982('0x48')](_0x1a6ad4,function(_0x17dbe0){if(_0x3bb0aa){fs[_0x8982('0x58')](_0x1a6ad4);}});}}})[_0x8982('0x3c')](function(_0x52a03f){if(_0x52a03f[_0x8982('0x59')]===_0x8982('0x55')){_0x3e9f77[_0x8982('0x17')](0x194)['send'](_0x8982('0x5a'));}else{return handleError(_0x3e9f77,null);}});};exports[_0x8982('0x21')]=function(_0x2df60b,_0xcff391){return db[_0x8982('0x26')][_0x8982('0x41')]({'where':{'id':_0x2df60b['params']['id']}})[_0x8982('0x20')](function(_0x7f52b4){if(!_0x7f52b4)throw new ReferenceError('Entity\x20not\x20found');return _0x7f52b4;})[_0x8982('0x20')](function(_0x18b60b){var _0x23d469=path[_0x8982('0x52')](config[_0x8982('0x5b')],'server/files/screen_recordings',_0x18b60b[_0x8982('0x4c')]);logger[_0x8982('0x5c')](_0x8982('0x5d'),_0x23d469);if(!_[_0x8982('0x5e')](_0x18b60b[_0x8982('0x4c')])&&fs[_0x8982('0x4e')](_0x23d469)){logger[_0x8982('0x5c')](_0x8982('0x5f')+_0x23d469+_0x8982('0x60'));fs[_0x8982('0x61')](_0x23d469);}_0x23d469=_0x23d469+'.cypher';if(!_[_0x8982('0x5e')](_0x18b60b[_0x8982('0x4c')])&&fs[_0x8982('0x4e')](_0x23d469)){logger[_0x8982('0x5c')](_0x8982('0x5f')+_0x23d469+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8982('0x61')](_0x23d469);}return _0x18b60b;})[_0x8982('0x20')](function(_0x2c505c){if(!_0x2c505c)throw new InternalError();return _0x2c505c[_0x8982('0x21')]();})['then'](function(){_0xcff391[_0x8982('0x17')](0xcc)[_0x8982('0x18')]();})['catch'](handleError(_0xcff391,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 0819a31..916dae0 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 _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 +var _0x728a=['../../config/logger','api','moment','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','interactionid','util'];(function(_0x5e739f,_0x5f0670){var _0x27cb92=function(_0x353d87){while(--_0x353d87){_0x5e739f['push'](_0x5e739f['shift']());}};_0x27cb92(++_0x5f0670);}(_0x728a,0x18b));var _0xa728=function(_0x3234e9,_0xe8d32b){_0x3234e9=_0x3234e9-0x0;var _0x4e22c5=_0x728a[_0x3234e9];return _0x4e22c5;};'use strict';var _=require('lodash');var util=require(_0xa728('0x0'));var logger=require(_0xa728('0x1'))(_0xa728('0x2'));var moment=require(_0xa728('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa728('0x4'));var rimraf=require('rimraf');var config=require(_0xa728('0x5'));var attributes=require(_0xa728('0x6'));module[_0xa728('0x7')]=function(_0x4996fd,_0x456d15){return _0x4996fd['define'](_0xa728('0x8'),attributes,{'tableName':_0xa728('0x9'),'paranoid':![],'indexes':[{'name':_0xa728('0xa'),'fields':[_0xa728('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 896af62..4fd9d28 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(_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 +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(_0x251a5e,_0xd0224b){var _0x1aaba2=function(_0x1668b6){while(--_0x1668b6){_0x251a5e['push'](_0x251a5e['shift']());}};_0x1aaba2(++_0xd0224b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 ff1ac08..3f0e272 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 _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 +var _0xb52a=['gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','originalname','single','file','addLogo','extname','post','addPreferred','server/files/images/logos/','put','isAuthenticated','update','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','index','getDate','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr'];(function(_0x46288b,_0x5461fb){var _0x350831=function(_0xac7ff9){while(--_0xac7ff9){_0x46288b['push'](_0x46288b['shift']());}};_0x350831(++_0x5461fb);}(_0xb52a,0x187));var _0xab52=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb52a[_0x4a53d];return _0x27410e;};'use strict';var multer=require('multer');var util=require(_0xab52('0x0'));var path=require(_0xab52('0x1'));var timeout=require(_0xab52('0x2'));var express=require('express');var router=express[_0xab52('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xab52('0x4'));var config=require(_0xab52('0x5'));var controller=require(_0xab52('0x6'));router[_0xab52('0x7')]('/',auth['isAuthenticated'](),controller[_0xab52('0x8')]);router[_0xab52('0x7')]('/now',controller[_0xab52('0x9')]);router[_0xab52('0x7')](_0xab52('0xa'),controller['show']);router[_0xab52('0x7')](_0xab52('0xb'),controller[_0xab52('0xc')]);router[_0xab52('0x7')](_0xab52('0xd'),controller[_0xab52('0xe')]);router['get'](_0xab52('0xf'),controller[_0xab52('0x10')]);router[_0xab52('0x7')](_0xab52('0x11'),controller['getPreferred']);router['get'](_0xab52('0x12'),controller[_0xab52('0x13')]);var upload=multer({'storage':multer[_0xab52('0x14')]({'destination':function(_0x443ed8,_0x51e737,_0x3ff884){_0x3ff884(null,path[_0xab52('0x15')](config[_0xab52('0x16')],'server/files/images/logos/'));},'filename':function(_0x3fee76,_0x56c9e1,_0x313947){_0x313947(null,util[_0xab52('0x17')](_0xab52('0x18'),_0xab52('0x19'),path['extname'](_0x56c9e1[_0xab52('0x1a')])));}})});router['post']('/:id/logo',upload[_0xab52('0x1b')](_0xab52('0x1c')),controller[_0xab52('0x1d')]);var upload=multer({'storage':multer[_0xab52('0x14')]({'destination':function(_0x1a4efc,_0x379d0c,_0x22d83e){_0x22d83e(null,path[_0xab52('0x15')](config[_0xab52('0x16')],'server/files/images/logos/'));},'filename':function(_0x28efe1,_0x21c4ce,_0xf3532e){_0xf3532e(null,util['format'](_0xab52('0x18'),'logologin',path['extname'](_0x21c4ce[_0xab52('0x1a')])));}})});router['post'](_0xab52('0xd'),upload['single'](_0xab52('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xab52('0x14')]({'destination':function(_0x4773a6,_0x474b97,_0x4274cf){_0x4274cf(null,path[_0xab52('0x15')](config[_0xab52('0x16')],'server/files/images/logos/'));},'filename':function(_0x182e19,_0x5a09ab,_0x338662){_0x338662(null,util[_0xab52('0x17')]('%s%s','preferred',path[_0xab52('0x1e')](_0x5a09ab['originalname'])));}})});router[_0xab52('0x1f')](_0xab52('0x11'),upload[_0xab52('0x1b')]('file'),controller[_0xab52('0x20')]);var upload=multer({'storage':multer[_0xab52('0x14')]({'destination':function(_0x2437c4,_0x259e1c,_0x57d702){_0x57d702(null,path['join'](config[_0xab52('0x16')],_0xab52('0x21')));},'filename':function(_0x76d071,_0x2839d8,_0x50fb31){_0x50fb31(null,util['format'](_0xab52('0x18'),'favicon',path['extname'](_0x2839d8['originalname'])));}})});router['post'](_0xab52('0x12'),upload[_0xab52('0x1b')](_0xab52('0x1c')),controller['addFavicon']);router[_0xab52('0x22')](_0xab52('0xa'),auth[_0xab52('0x23')](),controller[_0xab52('0x24')]);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 8188b0e..7fade4b 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 _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 +var _0x5489=['INTEGER','min_mailbox','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','sequelize','exports'];(function(_0x39d36f,_0x4298e0){var _0x48d408=function(_0x38f924){while(--_0x38f924){_0x39d36f['push'](_0x39d36f['shift']());}};_0x48d408(++_0x4298e0);}(_0x5489,0xb4));var _0x9548=function(_0x3531cb,_0x25c4ab){_0x3531cb=_0x3531cb-0x0;var _0xa3ba00=_0x5489[_0x3531cb];return _0xa3ba00;};'use strict';var Sequelize=require(_0x9548('0x0'));module[_0x9548('0x1')]={'min_internal':{'type':Sequelize[_0x9548('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x9548('0x2')](0xb),'unique':_0x9548('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x9548('0x4')},'logo':{'type':Sequelize[_0x9548('0x5')]},'defaultLogo':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x9548('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x9548('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x9548('0x5')]},'turnaddr':{'type':Sequelize[_0x9548('0x5')]},'turnusername':{'type':Sequelize[_0x9548('0x5')]},'turnpassword':{'type':Sequelize[_0x9548('0x5')]},'pageTitle':{'type':Sequelize[_0x9548('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x9548('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x9548('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x9548('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x9548('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x9548('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x9548('0x5')]},'defaultPreferred':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x9548('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x9548('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x9548('0x2')]},'transcribeRegion':{'type':Sequelize[_0x9548('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x9548('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x9548('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x9548('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x9548('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x9548('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x9548('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x9548('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 8438b24..9727920 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 _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 +var _0xd317=['intersection','fields','attributes','model','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','count','includeAll','include','findAll','rows','show','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','toLower','root','default_logo.svg','custom','ValidationError','upperFirst','\x20not\x20found','download','getLicense','favicon','defaultFavicon','default_loginLogo.svg','default','getPreferred','default_preferred.png','Sequelize','default_favicon.ico','getDate','utcOffset','format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','save','update','name','send','index','map','Setting','rawAttributes','fieldName','type','key','query','filters'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd317,0x1a2));var _0x7d31=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xd317[_0x255d5b];return _0x3e141a;};'use strict';var pdf=require(_0x7d31('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d31('0x1'));var zipdir=require(_0x7d31('0x2'));var jsonpatch=require(_0x7d31('0x3'));var rp=require(_0x7d31('0x4'));var moment=require(_0x7d31('0x5'));var BPromise=require(_0x7d31('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d31('0x7'));var sox=require('sox');var csv=require(_0x7d31('0x8'));var ejs=require(_0x7d31('0x9'));var fs=require('fs');var _=require(_0x7d31('0xa'));var squel=require(_0x7d31('0xb'));var crypto=require(_0x7d31('0xc'));var jsforce=require(_0x7d31('0xd'));var deskjs=require(_0x7d31('0xe'));var toCsv=require(_0x7d31('0x8'));var querystring=require(_0x7d31('0xf'));var Papa=require(_0x7d31('0x10'));var Redis=require(_0x7d31('0x11'));var authService=require(_0x7d31('0x12'));var qs=require(_0x7d31('0x13'));var as=require(_0x7d31('0x14'));var hardwareService=require(_0x7d31('0x15'));var logger=require(_0x7d31('0x16'))(_0x7d31('0x17'));var utils=require(_0x7d31('0x18'));var config=require(_0x7d31('0x19'));var licenseUtil=require(_0x7d31('0x1a'));var db=require(_0x7d31('0x1b'))['db'];var jayson=require(_0x7d31('0x1c'));var client=jayson[_0x7d31('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55f6c6,_0x2532de,_0x10e3b2,_0x581191){return new BPromise(function(_0x52e685,_0x48f7cb){var _0x464cc2=_0x581191||client;return _0x464cc2['request'](_0x55f6c6,_0x10e3b2)[_0x7d31('0x1e')](function(_0x38f72d){logger[_0x7d31('0x1f')](_0x7d31('0x20'),_0x2532de,_0x7d31('0x21'));logger[_0x7d31('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x2532de,_0x7d31('0x21'),JSON[_0x7d31('0x23')](_0x38f72d));if(_0x38f72d[_0x7d31('0x24')]){if(_0x38f72d[_0x7d31('0x24')][_0x7d31('0x25')]===0x1f4){logger[_0x7d31('0x24')](_0x7d31('0x20'),_0x2532de,_0x38f72d['error'][_0x7d31('0x26')]);return _0x48f7cb(_0x38f72d[_0x7d31('0x24')][_0x7d31('0x26')]);}logger['error'](_0x7d31('0x20'),_0x2532de,_0x38f72d[_0x7d31('0x24')][_0x7d31('0x26')]);return _0x52e685(_0x38f72d[_0x7d31('0x24')]['message']);}else{logger[_0x7d31('0x1f')](_0x7d31('0x20'),_0x2532de,_0x7d31('0x21'));_0x52e685(_0x38f72d[_0x7d31('0x27')][_0x7d31('0x26')]);}})[_0x7d31('0x28')](function(_0x37df1b){logger[_0x7d31('0x24')](_0x7d31('0x20'),_0x2532de,_0x37df1b);_0x48f7cb(_0x37df1b);});});}function respondWithStatusCode(_0x53b53e,_0x593998){_0x593998=_0x593998||0xcc;return function(_0x5002e5){if(_0x5002e5){return _0x53b53e[_0x7d31('0x29')](_0x593998);}return _0x53b53e[_0x7d31('0x2a')](_0x593998)[_0x7d31('0x2b')]();};}function respondWithResult(_0x26b5ed,_0x2ba0bf){_0x2ba0bf=_0x2ba0bf||0xc8;return function(_0x4b8acc){if(_0x4b8acc){return _0x26b5ed['status'](_0x2ba0bf)[_0x7d31('0x2c')](_0x4b8acc);}};}function respondWithFilteredResult(_0x289bfe,_0x1b91bc){return function(_0x2c8794){if(_0x2c8794){var _0x1c91ee=_0x2c8794['count'],_0x4046ae=_0x1b91bc['offset'],_0x43f9ab=_0x1b91bc[_0x7d31('0x2d')]+_0x1b91bc['limit'],_0x51f345;if(_0x43f9ab>=_0x1c91ee){_0x43f9ab=_0x1c91ee;_0x51f345=0xc8;}else{_0x51f345=0xce;}_0x289bfe[_0x7d31('0x2a')](_0x51f345);return _0x289bfe[_0x7d31('0x2e')](_0x7d31('0x2f'),_0x4046ae+'-'+_0x43f9ab+'/'+_0x1c91ee)[_0x7d31('0x2c')](_0x2c8794);}return null;};}function patchUpdates(_0xa0fef1){return function(_0x432605){try{jsonpatch[_0x7d31('0x30')](_0x432605,_0xa0fef1,!![]);}catch(_0xc0370){return BPromise['reject'](_0xc0370);}return _0x432605[_0x7d31('0x31')]();};}function saveUpdates(_0x38c36f,_0x1f8b46){return function(_0x163efa){if(_0x163efa){return _0x163efa[_0x7d31('0x32')](_0x38c36f)[_0x7d31('0x1e')](function(_0x1c08bf){return _0x1c08bf;});}return null;};}function removeEntity(_0xfd23e4,_0x32596a){return function(_0x81df09){if(_0x81df09){return _0x81df09['destroy']()[_0x7d31('0x1e')](function(){_0xfd23e4[_0x7d31('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c1b4,_0x5b809a){return function(_0x16cf18){if(!_0x16cf18){_0x45c1b4[_0x7d31('0x29')](0x194);}return _0x16cf18;};}function handleError(_0x2b1f80,_0x385ce9){_0x385ce9=_0x385ce9||0x1f4;return function(_0x5ebbd3){logger[_0x7d31('0x24')](_0x5ebbd3['stack']);if(_0x5ebbd3[_0x7d31('0x33')]){delete _0x5ebbd3[_0x7d31('0x33')];}_0x2b1f80[_0x7d31('0x2a')](_0x385ce9)[_0x7d31('0x34')](_0x5ebbd3);};}exports[_0x7d31('0x35')]=function(_0x3e8278,_0x234865){var _0x1c1b64={},_0x196659={},_0x2090ac={'count':0x0,'rows':[]};var _0x2a9e99=_[_0x7d31('0x36')](db[_0x7d31('0x37')][_0x7d31('0x38')],function(_0x235d29){return{'name':_0x235d29[_0x7d31('0x39')],'type':_0x235d29[_0x7d31('0x3a')][_0x7d31('0x3b')]};});_0x196659['model']=_[_0x7d31('0x36')](_0x2a9e99,'name');_0x196659[_0x7d31('0x3c')]=_['keys'](_0x3e8278[_0x7d31('0x3c')]);_0x196659[_0x7d31('0x3d')]=_[_0x7d31('0x3e')](_0x196659['model'],_0x196659[_0x7d31('0x3c')]);_0x1c1b64['attributes']=_[_0x7d31('0x3e')](_0x196659['model'],qs[_0x7d31('0x3f')](_0x3e8278['query']['fields']));_0x1c1b64[_0x7d31('0x40')]=_0x1c1b64[_0x7d31('0x40')]['length']?_0x1c1b64[_0x7d31('0x40')]:_0x196659[_0x7d31('0x41')];if(!_0x3e8278[_0x7d31('0x3c')][_0x7d31('0x42')](_0x7d31('0x43'))){_0x1c1b64[_0x7d31('0x44')]=qs[_0x7d31('0x44')](_0x3e8278[_0x7d31('0x3c')][_0x7d31('0x44')]);_0x1c1b64[_0x7d31('0x2d')]=qs[_0x7d31('0x2d')](_0x3e8278[_0x7d31('0x3c')][_0x7d31('0x2d')]);}_0x1c1b64[_0x7d31('0x45')]=qs[_0x7d31('0x46')](_0x3e8278['query'][_0x7d31('0x46')]);_0x1c1b64[_0x7d31('0x47')]=qs[_0x7d31('0x3d')](_[_0x7d31('0x48')](_0x3e8278[_0x7d31('0x3c')],_0x196659[_0x7d31('0x3d')]),_0x2a9e99);if(_0x3e8278['query']['filter']){_0x1c1b64[_0x7d31('0x47')]=_[_0x7d31('0x49')](_0x1c1b64[_0x7d31('0x47')],{'$or':_[_0x7d31('0x36')](_0x2a9e99,function(_0x48ecb5){if(_0x48ecb5['type']!=='VIRTUAL'){var _0x31564c={};_0x31564c[_0x48ecb5[_0x7d31('0x33')]]={'$like':'%'+_0x3e8278[_0x7d31('0x3c')][_0x7d31('0x4a')]+'%'};return _0x31564c;}})});}_0x1c1b64=_['merge']({},_0x1c1b64,_0x3e8278[_0x7d31('0x4b')]);var _0x3943be={'where':_0x1c1b64[_0x7d31('0x47')]};return db[_0x7d31('0x37')][_0x7d31('0x4c')](_0x3943be)[_0x7d31('0x1e')](function(_0x512bc1){_0x2090ac['count']=_0x512bc1;if(_0x3e8278['query'][_0x7d31('0x4d')]){_0x1c1b64[_0x7d31('0x4e')]=[{'all':!![]}];}return db[_0x7d31('0x37')][_0x7d31('0x4f')](_0x1c1b64);})[_0x7d31('0x1e')](function(_0x92ba5a){_0x2090ac[_0x7d31('0x50')]=_0x92ba5a;return _0x2090ac;})[_0x7d31('0x1e')](respondWithFilteredResult(_0x234865,_0x1c1b64))[_0x7d31('0x28')](handleError(_0x234865,null));};exports[_0x7d31('0x51')]=function(_0x5a20c1,_0xef1baa){var _0x581fd5={'raw':![],'where':{'id':_0x5a20c1[_0x7d31('0x52')]['id']}},_0x2e286c={};_0x2e286c[_0x7d31('0x41')]=_[_0x7d31('0x53')](db[_0x7d31('0x37')][_0x7d31('0x38')]);_0x2e286c[_0x7d31('0x3c')]=_['keys'](_0x5a20c1[_0x7d31('0x3c')]);_0x2e286c[_0x7d31('0x3d')]=_[_0x7d31('0x3e')](_0x2e286c['model'],_0x2e286c[_0x7d31('0x3c')]);_0x581fd5[_0x7d31('0x40')]=_[_0x7d31('0x3e')](_0x2e286c[_0x7d31('0x41')],qs[_0x7d31('0x3f')](_0x5a20c1[_0x7d31('0x3c')]['fields']));_0x581fd5[_0x7d31('0x40')]=_0x581fd5['attributes']['length']?_0x581fd5[_0x7d31('0x40')]:_0x2e286c[_0x7d31('0x41')];if(_0x5a20c1[_0x7d31('0x3c')]['includeAll']){_0x581fd5[_0x7d31('0x4e')]=[{'all':!![]}];}_0x581fd5=_[_0x7d31('0x49')]({},_0x581fd5,_0x5a20c1[_0x7d31('0x4b')]);return db[_0x7d31('0x37')][_0x7d31('0x54')](_0x581fd5)[_0x7d31('0x1e')](handleEntityNotFound(_0xef1baa,null))[_0x7d31('0x1e')](respondWithResult(_0xef1baa,null))['catch'](handleError(_0xef1baa,null));};exports['update']=function(_0x50922e,_0x4d3fec){if(_0x50922e['body']['id']){delete _0x50922e[_0x7d31('0x55')]['id'];}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x50922e[_0x7d31('0x52')]['id']}})[_0x7d31('0x1e')](handleEntityNotFound(_0x4d3fec,null))[_0x7d31('0x1e')](saveUpdates(_0x50922e[_0x7d31('0x55')],null))[_0x7d31('0x1e')](respondWithResult(_0x4d3fec,null))['catch'](handleError(_0x4d3fec,null));};exports[_0x7d31('0x56')]=function(_0x59cc56,_0x3b7912,_0x2ce146){if(_0x59cc56['file']&&_0x59cc56[_0x7d31('0x57')][_0x7d31('0x58')]){_0x59cc56[_0x7d31('0x55')][_0x7d31('0x59')]=_0x59cc56[_0x7d31('0x57')][_0x7d31('0x58')];}return db[_0x7d31('0x37')]['find']({'where':{'id':_0x59cc56['params']['id']}})[_0x7d31('0x1e')](handleEntityNotFound(_0x3b7912,null))[_0x7d31('0x1e')](saveUpdates(_0x59cc56[_0x7d31('0x55')],null))[_0x7d31('0x1e')](respondWithResult(_0x3b7912,null))[_0x7d31('0x28')](handleError(_0x3b7912,null));};exports[_0x7d31('0x5a')]=function(_0x20d8c1,_0x2f004b,_0x5e2263){if(_0x20d8c1['file']&&_0x20d8c1[_0x7d31('0x57')][_0x7d31('0x58')]){_0x20d8c1[_0x7d31('0x55')][_0x7d31('0x5b')]=_0x20d8c1[_0x7d31('0x57')]['filename'];}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x20d8c1['params']['id']}})[_0x7d31('0x1e')](handleEntityNotFound(_0x2f004b,null))[_0x7d31('0x1e')](saveUpdates(_0x20d8c1['body'],null))[_0x7d31('0x1e')](respondWithResult(_0x2f004b,null))['catch'](handleError(_0x2f004b,null));};var utilLicense=require(_0x7d31('0x1a'));exports[_0x7d31('0x5c')]=function(_0x4a33eb,_0x11fb3c,_0x4b4770){var _0x2c2a08=_0x7d31('0x5d');var _0x3c0fe3={'custom':![]};return utilLicense['getLicense']()[_0x7d31('0x1e')](function(_0x159749){if(_0x159749){_0x3c0fe3=_0x159749;}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x4a33eb[_0x7d31('0x52')]['id']},'attributes':[_0x7d31('0x59'),_0x7d31('0x5b'),_0x7d31('0x5e'),'favicon',_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),'defaultFavicon'],'raw':!![]});})[_0x7d31('0x1e')](handleEntityNotFound(_0x11fb3c,null))[_0x7d31('0x1e')](function(_0x14c7c0){if(_0x14c7c0){var _0x5b80aa=_0x14c7c0[_0x7d31('0x59')]&&fs[_0x7d31('0x62')](path[_0x7d31('0x63')](config['root'],_0x2c2a08,_[_0x7d31('0x64')](_0x14c7c0[_0x7d31('0x59')])))?path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x2c2a08,_[_0x7d31('0x64')](_0x14c7c0[_0x7d31('0x59')])):path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x2c2a08,_[_0x7d31('0x64')](_0x7d31('0x66')));var _0xe124ff='default'+_['upperFirst']('logo');if(_0x14c7c0[_0xe124ff]||!_0x3c0fe3[_0x7d31('0x67')]){_0x5b80aa=path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x2c2a08,_[_0x7d31('0x64')]('default_logo.svg'));}if(!fs['existsSync'](_0x5b80aa)){throw new db['Sequelize'][(_0x7d31('0x68'))](_[_0x7d31('0x69')](_0x7d31('0x59'))+_0x7d31('0x6a'));}return _0x11fb3c[_0x7d31('0x6b')](_0x5b80aa);}})[_0x7d31('0x28')](handleError(_0x11fb3c,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x16fdda,_0x439dd8,_0x31829d){var _0x390e35=_0x7d31('0x5d');var _0x7b2680={'custom':![]};return utilLicense[_0x7d31('0x6c')]()[_0x7d31('0x1e')](function(_0x235332){if(_0x235332){_0x7b2680=_0x235332;}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x16fdda[_0x7d31('0x52')]['id']},'attributes':['logo',_0x7d31('0x5b'),_0x7d31('0x5e'),_0x7d31('0x6d'),'defaultLogo','defaultLoginLogo',_0x7d31('0x61'),_0x7d31('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x439dd8,null))[_0x7d31('0x1e')](function(_0xb03e7d){if(_0xb03e7d){var _0x5bf3dc=_0xb03e7d[_0x7d31('0x5b')]&&fs[_0x7d31('0x62')](path[_0x7d31('0x63')](config['root'],_0x390e35,_[_0x7d31('0x64')](_0xb03e7d[_0x7d31('0x5b')])))?path[_0x7d31('0x63')](config['root'],_0x390e35,_[_0x7d31('0x64')](_0xb03e7d[_0x7d31('0x5b')])):path[_0x7d31('0x63')](config['root'],_0x390e35,_[_0x7d31('0x64')](_0x7d31('0x6f')));var _0x98d92b=_0x7d31('0x70')+_[_0x7d31('0x69')](_0x7d31('0x5b'));if(_0xb03e7d[_0x98d92b]||!_0x7b2680[_0x7d31('0x67')]){_0x5bf3dc=path[_0x7d31('0x63')](config['root'],_0x390e35,_[_0x7d31('0x64')](_0x7d31('0x6f')));}if(!fs['existsSync'](_0x5bf3dc)){throw new db['Sequelize'][(_0x7d31('0x68'))](_[_0x7d31('0x69')](_0x7d31('0x5b'))+'\x20not\x20found');}return _0x439dd8[_0x7d31('0x6b')](_0x5bf3dc);}})[_0x7d31('0x28')](handleError(_0x439dd8,null));};exports['gdpr']=function(_0x4a227c,_0x3db1d8){return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x4a227c[_0x7d31('0x52')]['id']},'attributes':['securePassword']})[_0x7d31('0x1e')](respondWithResult(_0x3db1d8,null))[_0x7d31('0x28')](handleError(_0x3db1d8,null));};exports['addPreferred']=function(_0x2b2e77,_0x5f1e1a,_0xed1c6f){if(_0x2b2e77['file']&&_0x2b2e77[_0x7d31('0x57')][_0x7d31('0x58')]){_0x2b2e77['body'][_0x7d31('0x5e')]=_0x2b2e77[_0x7d31('0x57')]['filename'];}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x2b2e77['params']['id']}})[_0x7d31('0x1e')](handleEntityNotFound(_0x5f1e1a,null))[_0x7d31('0x1e')](saveUpdates(_0x2b2e77[_0x7d31('0x55')],null))[_0x7d31('0x1e')](respondWithResult(_0x5f1e1a,null))[_0x7d31('0x28')](handleError(_0x5f1e1a,null));};var utilLicense=require('../../config/license/util');exports[_0x7d31('0x71')]=function(_0x370c53,_0x305052,_0x551d30){var _0x595cf9='server/files/images/logos';var _0x14d787={'custom':![]};return utilLicense[_0x7d31('0x6c')]()[_0x7d31('0x1e')](function(_0x35c083){if(_0x35c083){_0x14d787=_0x35c083;}return db['Setting']['find']({'where':{'id':_0x370c53[_0x7d31('0x52')]['id']},'attributes':[_0x7d31('0x59'),_0x7d31('0x5b'),'preferred',_0x7d31('0x6d'),_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),_0x7d31('0x6e')],'raw':!![]});})[_0x7d31('0x1e')](handleEntityNotFound(_0x305052,null))[_0x7d31('0x1e')](function(_0x456532){if(_0x456532){var _0x1c0ba9=_0x456532[_0x7d31('0x5e')]&&fs[_0x7d31('0x62')](path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x595cf9,_['toLower'](_0x456532[_0x7d31('0x5e')])))?path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x595cf9,_[_0x7d31('0x64')](_0x456532[_0x7d31('0x5e')])):path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x595cf9,_[_0x7d31('0x64')]('default_preferred.png'));var _0x2ae361=_0x7d31('0x70')+_[_0x7d31('0x69')]('preferred');if(_0x456532[_0x2ae361]||!_0x14d787['custom']||!_0x14d787[_0x7d31('0x5e')]){_0x1c0ba9=path['join'](config[_0x7d31('0x65')],_0x595cf9,_[_0x7d31('0x64')](_0x7d31('0x72')));}if(!fs[_0x7d31('0x62')](_0x1c0ba9)){throw new db[(_0x7d31('0x73'))][(_0x7d31('0x68'))](_['upperFirst']('preferred')+_0x7d31('0x6a'));}return _0x305052[_0x7d31('0x6b')](_0x1c0ba9);}})[_0x7d31('0x28')](handleError(_0x305052,null));};exports['addFavicon']=function(_0x317e90,_0x41abe2,_0x7b49f1){if(_0x317e90[_0x7d31('0x57')]&&_0x317e90[_0x7d31('0x57')]['filename']){_0x317e90[_0x7d31('0x55')][_0x7d31('0x6d')]=_0x317e90[_0x7d31('0x57')][_0x7d31('0x58')];}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x317e90[_0x7d31('0x52')]['id']}})['then'](handleEntityNotFound(_0x41abe2,null))['then'](saveUpdates(_0x317e90['body'],null))['then'](respondWithResult(_0x41abe2,null))[_0x7d31('0x28')](handleError(_0x41abe2,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x59dc0d,_0x2a4765,_0xcfa6db){var _0x2e957d='server/files/images/logos';var _0xd40249={'custom':![]};return utilLicense[_0x7d31('0x6c')]()['then'](function(_0x233080){if(_0x233080){_0xd40249=_0x233080;}return db[_0x7d31('0x37')][_0x7d31('0x54')]({'where':{'id':_0x59dc0d['params']['id']},'attributes':[_0x7d31('0x59'),'loginLogo',_0x7d31('0x5e'),_0x7d31('0x6d'),_0x7d31('0x5f'),_0x7d31('0x60'),_0x7d31('0x61'),_0x7d31('0x6e')],'raw':!![]});})['then'](handleEntityNotFound(_0x2a4765,null))['then'](function(_0x4d4454){if(_0x4d4454){var _0x582ea7=_0x4d4454[_0x7d31('0x6d')]&&fs['existsSync'](path['join'](config[_0x7d31('0x65')],_0x2e957d,_[_0x7d31('0x64')](_0x4d4454['favicon'])))?path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x2e957d,_['toLower'](_0x4d4454['favicon'])):path[_0x7d31('0x63')](config['root'],_0x2e957d,_[_0x7d31('0x64')]('default_favicon.ico'));var _0x2f4992=_0x7d31('0x70')+_[_0x7d31('0x69')]('favicon');if(_0x4d4454[_0x2f4992]||!_0xd40249[_0x7d31('0x67')]){_0x582ea7=path[_0x7d31('0x63')](config[_0x7d31('0x65')],_0x2e957d,_['toLower'](_0x7d31('0x74')));}if(!fs['existsSync'](_0x582ea7)){throw new db[(_0x7d31('0x73'))]['ValidationError'](_[_0x7d31('0x69')](_0x7d31('0x6d'))+_0x7d31('0x6a'));}return _0x2a4765[_0x7d31('0x6b')](_0x582ea7);}})[_0x7d31('0x28')](handleError(_0x2a4765,null));};exports[_0x7d31('0x75')]=function(_0x492323,_0xa42d3e){var _0x5326e8={'offset':moment()[_0x7d31('0x76')]()};_0x5326e8['now']=moment()[_0x7d31('0x76')](_0x5326e8['offset'])[_0x7d31('0x77')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0xa42d3e[_0x7d31('0x2a')](0xc8)['send'](_0x5326e8);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 8d55d1d..ca8c981 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 _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 +var _0x2812=['moment','bluebird','request-promise','rimraf','../../config/environment','./setting.attributes','exports','define','Setting','settings','util','../../config/logger','api'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x2812,0xda));var _0x2281=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2812[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x2281('0x0'));var logger=require(_0x2281('0x1'))(_0x2281('0x2'));var moment=require(_0x2281('0x3'));var BPromise=require(_0x2281('0x4'));var rp=require(_0x2281('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2281('0x6'));var config=require(_0x2281('0x7'));var attributes=require(_0x2281('0x8'));module[_0x2281('0x9')]=function(_0x4880f5,_0x272853){return _0x4880f5[_0x2281('0xa')](_0x2281('0xb'),attributes,{'tableName':_0x2281('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index e25f707..c1d27f9 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 _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 +var _0x4c04=['client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x4c04,0x120));var _0x44c0=function(_0x2371cd,_0x244140){_0x2371cd=_0x2371cd-0x0;var _0x4f1208=_0x4c04[_0x2371cd];return _0x4f1208;};'use strict';var _=require(_0x44c0('0x0'));var util=require(_0x44c0('0x1'));var moment=require(_0x44c0('0x2'));var BPromise=require(_0x44c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44c0('0x4'));var db=require(_0x44c0('0x5'))['db'];var utils=require(_0x44c0('0x6'));var logger=require(_0x44c0('0x7'))(_0x44c0('0x8'));var config=require(_0x44c0('0x9'));var jayson=require(_0x44c0('0xa'));var client=jayson[_0x44c0('0xb')][_0x44c0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x501516,_0x302d6c,_0x3ac682){return new BPromise(function(_0x3733e3,_0x1149a1){return client['request'](_0x501516,_0x3ac682)[_0x44c0('0xd')](function(_0x372020){logger[_0x44c0('0xe')](_0x44c0('0xf'),_0x302d6c,_0x44c0('0x10'));logger[_0x44c0('0x11')]('Setting,\x20%s,\x20%s,\x20%s',_0x302d6c,_0x44c0('0x10'),JSON[_0x44c0('0x12')](_0x372020));if(_0x372020[_0x44c0('0x13')]){if(_0x372020[_0x44c0('0x13')]['code']===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x302d6c,_0x372020[_0x44c0('0x13')]['message']);return _0x1149a1(_0x372020[_0x44c0('0x13')][_0x44c0('0x14')]);}logger[_0x44c0('0x13')](_0x44c0('0xf'),_0x302d6c,_0x372020['error'][_0x44c0('0x14')]);return _0x3733e3(_0x372020[_0x44c0('0x13')][_0x44c0('0x14')]);}else{logger[_0x44c0('0xe')](_0x44c0('0xf'),_0x302d6c,_0x44c0('0x10'));_0x3733e3(_0x372020[_0x44c0('0x15')][_0x44c0('0x14')]);}})[_0x44c0('0x16')](function(_0x3599fd){logger[_0x44c0('0x13')](_0x44c0('0xf'),_0x302d6c,_0x3599fd);_0x1149a1(_0x3599fd);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index dcb2772..9f62b4b 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 _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 +var _0x1108=['status','addAgents','put','delete','destroy','removeDispositions','removeAnswers','multer','util','path','express','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/send'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x1108,0x179));var _0x8110=function(_0x5b406e,_0xcd06bc){_0x5b406e=_0x5b406e-0x0;var _0xe7d242=_0x1108[_0x5b406e];return _0xe7d242;};'use strict';var multer=require(_0x8110('0x0'));var util=require(_0x8110('0x1'));var path=require(_0x8110('0x2'));var timeout=require('connect-timeout');var express=require(_0x8110('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8110('0x4'));var config=require(_0x8110('0x5'));var controller=require(_0x8110('0x6'));router[_0x8110('0x7')]('/',auth[_0x8110('0x8')](),controller[_0x8110('0x9')]);router[_0x8110('0x7')](_0x8110('0xa'),auth['isAuthenticated'](),controller[_0x8110('0xb')]);router['get'](_0x8110('0xc'),auth[_0x8110('0x8')](),controller['show']);router[_0x8110('0x7')](_0x8110('0xd'),auth[_0x8110('0x8')](),controller['getDispositions']);router['get'](_0x8110('0xe'),auth[_0x8110('0x8')](),controller[_0x8110('0xf')]);router[_0x8110('0x7')](_0x8110('0x10'),auth[_0x8110('0x8')](),controller['getApplications']);router[_0x8110('0x7')](_0x8110('0x11'),auth[_0x8110('0x8')](),controller['getInteractions']);router['get'](_0x8110('0x12'),controller[_0x8110('0x13')]);router[_0x8110('0x7')](_0x8110('0x14'),auth[_0x8110('0x8')](),controller[_0x8110('0x15')]);router[_0x8110('0x16')]('/',auth[_0x8110('0x8')](),controller[_0x8110('0x17')]);router[_0x8110('0x16')](_0x8110('0xd'),auth[_0x8110('0x8')](),controller[_0x8110('0x18')]);router[_0x8110('0x16')]('/:id/canned_answers',auth[_0x8110('0x8')](),controller[_0x8110('0x19')]);router[_0x8110('0x16')](_0x8110('0x1a'),controller[_0x8110('0x1b')]);router[_0x8110('0x16')](_0x8110('0x10'),auth[_0x8110('0x8')](),controller[_0x8110('0x1c')]);router[_0x8110('0x16')](_0x8110('0x1d'),auth[_0x8110('0x8')](),controller['send']);router['post'](_0x8110('0x12'),controller[_0x8110('0x1e')]);router[_0x8110('0x16')](_0x8110('0x14'),auth[_0x8110('0x8')](),controller[_0x8110('0x1f')]);router[_0x8110('0x20')](_0x8110('0xc'),auth[_0x8110('0x8')](),controller['update']);router[_0x8110('0x21')](_0x8110('0xc'),auth[_0x8110('0x8')](),controller[_0x8110('0x22')]);router[_0x8110('0x21')](_0x8110('0xd'),auth[_0x8110('0x8')](),controller[_0x8110('0x23')]);router[_0x8110('0x21')]('/:id/canned_answers',auth[_0x8110('0x8')](),controller[_0x8110('0x24')]);router[_0x8110('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 8714024..b536c03 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 _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 +var _0xb515=['clickatell','bandwidth','csc','infobip','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','generate','twilio','skebby','connectel','clicksend','plivo'];(function(_0x5f1845,_0x4910dc){var _0x5dd4d8=function(_0x304588){while(--_0x304588){_0x5f1845['push'](_0x5f1845['shift']());}};_0x5dd4d8(++_0x4910dc);}(_0xb515,0x1b8));var _0x5b51=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0xb515[_0x22c684];return _0x39fcbb;};'use strict';var Sequelize=require(_0x5b51('0x0'));var rs=require('randomstring');module[_0x5b51('0x1')]={'name':{'type':Sequelize[_0x5b51('0x2')],'unique':_0x5b51('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x5b51('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x5b51('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x5b51('0x2')],'defaultValue':function(){return rs[_0x5b51('0x4')]();}},'phone':{'type':Sequelize[_0x5b51('0x2')]},'type':{'type':Sequelize['ENUM'](_0x5b51('0x5'),_0x5b51('0x6'),_0x5b51('0x7'),_0x5b51('0x8'),_0x5b51('0x9'),_0x5b51('0xa'),_0x5b51('0xb'),_0x5b51('0xc'),_0x5b51('0xd'),_0x5b51('0xe'))},'accountSid':{'type':Sequelize[_0x5b51('0x2')]},'authId':{'type':Sequelize[_0x5b51('0x2')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x5b51('0xf')]('SI','TI','GP')},'username':{'type':Sequelize[_0x5b51('0x2')]},'password':{'type':Sequelize[_0x5b51('0x2')]},'apiKey':{'type':Sequelize[_0x5b51('0x2')]},'applicationId':{'type':Sequelize[_0x5b51('0x2')]},'accountId':{'type':Sequelize[_0x5b51('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x5b51('0x10')],'defaultValue':function(){return _0x5b51('0x11');}},'notificationSound':{'type':Sequelize[_0x5b51('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5b51('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5b51('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5b51('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5b51('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5b51('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x5b51('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5b51('0x13')],'comment':_0x5b51('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x5b51('0x12')],'defaultValue':![],'comment':_0x5b51('0x15'),'set':function(_0x1c69fc){if(!_0x1c69fc)this[_0x5b51('0x16')](_0x5b51('0x17'),null);this['setDataValue'](_0x5b51('0x18'),_0x1c69fc);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c0bb13a..f92cf05 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 _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 +var _0xabb1=['findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','user','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','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','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','end','status','json','count','offset','limit','apply','reject','save','update','destroy','get','SmsAccounts','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','show','find','body','role','UserProfileSection','userProfileId','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','SmsAccountId','Disposition','getDispositions','findOne','pick','removeDispositions','ids','CannedAnswer','hasOwnProperty','removeAnswers','sms','Applications','account','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','mobile','twilio','From','Body','MessageSid','skebby','from','sender','text','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','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','CmList','ListId','Contacts','DESC','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','SmsApplication','bulkCreate'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xabb1,0x1f4));var _0x1abb=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xabb1[_0x4fbfd9];return _0x31dc94;};'use strict';var pdf=require(_0x1abb('0x0'));var emlformat=require(_0x1abb('0x1'));var rimraf=require(_0x1abb('0x2'));var zipdir=require(_0x1abb('0x3'));var jsonpatch=require(_0x1abb('0x4'));var rp=require(_0x1abb('0x5'));var moment=require('moment');var BPromise=require(_0x1abb('0x6'));var Mustache=require('mustache');var util=require(_0x1abb('0x7'));var path=require('path');var sox=require(_0x1abb('0x8'));var csv=require('to-csv');var ejs=require(_0x1abb('0x9'));var fs=require('fs');var _=require(_0x1abb('0xa'));var squel=require(_0x1abb('0xb'));var crypto=require(_0x1abb('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1abb('0xd'));var toCsv=require(_0x1abb('0xe'));var querystring=require('querystring');var Papa=require(_0x1abb('0xf'));var Redis=require(_0x1abb('0x10'));var authService=require(_0x1abb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1abb('0x12'));var hardwareService=require(_0x1abb('0x13'));var logger=require(_0x1abb('0x14'))(_0x1abb('0x15'));var utils=require(_0x1abb('0x16'));var config=require(_0x1abb('0x17'));var licenseUtil=require(_0x1abb('0x18'));var db=require(_0x1abb('0x19'))['db'];config[_0x1abb('0x1a')]=_[_0x1abb('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1abb('0x1c'))(new Redis(config[_0x1abb('0x1a')]));require(_0x1abb('0x1d'))[_0x1abb('0x1e')](socket);var jayson=require(_0x1abb('0x1f'));var client=jayson[_0x1abb('0x20')][_0x1abb('0x21')]({'port':0x232c});function respondWithRpcPromise(_0xd564a5,_0x5a1294,_0x17f93b,_0xd434da){return new BPromise(function(_0x5d6dba,_0x5249c0){var _0x488f46=_0xd434da||client;return _0x488f46[_0x1abb('0x22')](_0xd564a5,_0x17f93b)[_0x1abb('0x23')](function(_0x4f84ea){logger[_0x1abb('0x24')]('SmsAccount,\x20%s,\x20%s',_0x5a1294,_0x1abb('0x25'));logger[_0x1abb('0x26')](_0x1abb('0x27'),_0x5a1294,_0x1abb('0x25'),JSON[_0x1abb('0x28')](_0x4f84ea));if(_0x4f84ea[_0x1abb('0x29')]){if(_0x4f84ea[_0x1abb('0x29')][_0x1abb('0x2a')]===0x1f4){logger[_0x1abb('0x29')](_0x1abb('0x2b'),_0x5a1294,_0x4f84ea['error'][_0x1abb('0x2c')]);return _0x5249c0(_0x4f84ea[_0x1abb('0x29')][_0x1abb('0x2c')]);}logger[_0x1abb('0x29')]('SmsAccount,\x20%s,\x20%s',_0x5a1294,_0x4f84ea[_0x1abb('0x29')][_0x1abb('0x2c')]);return _0x5d6dba(_0x4f84ea[_0x1abb('0x29')]['message']);}else{logger['info'](_0x1abb('0x2b'),_0x5a1294,_0x1abb('0x25'));_0x5d6dba(_0x4f84ea[_0x1abb('0x2d')][_0x1abb('0x2c')]);}})[_0x1abb('0x2e')](function(_0x379622){logger['error'](_0x1abb('0x2b'),_0x5a1294,_0x379622);_0x5249c0(_0x379622);});});}function respondWithStatusCode(_0x5b322e,_0xd70d20){_0xd70d20=_0xd70d20||0xcc;return function(_0x365615){if(_0x365615){return _0x5b322e['sendStatus'](_0xd70d20);}return _0x5b322e['status'](_0xd70d20)[_0x1abb('0x2f')]();};}function respondWithResult(_0x4aa553,_0x1e240a){_0x1e240a=_0x1e240a||0xc8;return function(_0x59429b){if(_0x59429b){return _0x4aa553[_0x1abb('0x30')](_0x1e240a)[_0x1abb('0x31')](_0x59429b);}};}function respondWithFilteredResult(_0x49b552,_0x46d380){return function(_0x5eaf22){if(_0x5eaf22){var _0x3c366b=_0x5eaf22[_0x1abb('0x32')],_0x2fdcf8=_0x46d380[_0x1abb('0x33')],_0x237c12=_0x46d380[_0x1abb('0x33')]+_0x46d380[_0x1abb('0x34')],_0x2903d9;if(_0x237c12>=_0x3c366b){_0x237c12=_0x3c366b;_0x2903d9=0xc8;}else{_0x2903d9=0xce;}_0x49b552[_0x1abb('0x30')](_0x2903d9);return _0x49b552['set']('Content-Range',_0x2fdcf8+'-'+_0x237c12+'/'+_0x3c366b)[_0x1abb('0x31')](_0x5eaf22);}return null;};}function patchUpdates(_0x3cd1e9){return function(_0x572775){try{jsonpatch[_0x1abb('0x35')](_0x572775,_0x3cd1e9,!![]);}catch(_0x50f576){return BPromise[_0x1abb('0x36')](_0x50f576);}return _0x572775[_0x1abb('0x37')]();};}function saveUpdates(_0x49a9b0,_0xe9bd4a){return function(_0x1459f0){if(_0x1459f0){return _0x1459f0[_0x1abb('0x38')](_0x49a9b0)[_0x1abb('0x23')](function(_0x51ebeb){return _0x51ebeb;});}return null;};}function removeEntity(_0x7b2514,_0x14d199){return function(_0x58ee7a){if(_0x58ee7a){return _0x58ee7a[_0x1abb('0x39')]()['then'](function(){var _0x20e914=_0x58ee7a[_0x1abb('0x3a')]({'plain':!![]});var _0x1d2062=_0x1abb('0x3b');return db['UserProfileResource'][_0x1abb('0x39')]({'where':{'type':_0x1d2062,'resourceId':_0x20e914['id']}})[_0x1abb('0x23')](function(){return _0x58ee7a;});})[_0x1abb('0x23')](function(){_0x7b2514[_0x1abb('0x30')](0xcc)[_0x1abb('0x2f')]();});}};}function handleEntityNotFound(_0x4d23ff,_0x474a9c){return function(_0x1a4448){if(!_0x1a4448){_0x4d23ff[_0x1abb('0x3c')](0x194);}return _0x1a4448;};}function handleError(_0x342a15,_0x36460b){_0x36460b=_0x36460b||0x1f4;return function(_0x2796eb){logger[_0x1abb('0x29')](_0x2796eb[_0x1abb('0x3d')]);if(_0x2796eb[_0x1abb('0x3e')]){delete _0x2796eb[_0x1abb('0x3e')];}_0x342a15[_0x1abb('0x30')](_0x36460b)[_0x1abb('0x3f')](_0x2796eb);};}exports[_0x1abb('0x40')]=function(_0x541bdd,_0x5c8cbf){var _0x17869f={'include':[{'model':db[_0x1abb('0x41')],'as':_0x1abb('0x42')}]},_0x1bb025={},_0x42c26a={'count':0x0,'rows':[]};var _0x1f1586=_[_0x1abb('0x43')](db[_0x1abb('0x44')][_0x1abb('0x45')],function(_0x5a45f6){return{'name':_0x5a45f6['fieldName'],'type':_0x5a45f6[_0x1abb('0x46')][_0x1abb('0x47')]};});_0x1bb025[_0x1abb('0x48')]=_['map'](_0x1f1586,_0x1abb('0x3e'));_0x1bb025[_0x1abb('0x49')]=_[_0x1abb('0x4a')](_0x541bdd[_0x1abb('0x49')]);_0x1bb025[_0x1abb('0x4b')]=_[_0x1abb('0x4c')](_0x1bb025['model'],_0x1bb025[_0x1abb('0x49')]);_0x17869f['attributes']=_['intersection'](_0x1bb025[_0x1abb('0x48')],qs[_0x1abb('0x4d')](_0x541bdd['query']['fields']));_0x17869f[_0x1abb('0x4e')]=_0x17869f[_0x1abb('0x4e')][_0x1abb('0x4f')]?_0x17869f[_0x1abb('0x4e')]:_0x1bb025[_0x1abb('0x48')];if(!_0x541bdd['query']['hasOwnProperty'](_0x1abb('0x50'))){_0x17869f[_0x1abb('0x34')]=qs[_0x1abb('0x34')](_0x541bdd[_0x1abb('0x49')][_0x1abb('0x34')]);_0x17869f[_0x1abb('0x33')]=qs['offset'](_0x541bdd[_0x1abb('0x49')][_0x1abb('0x33')]);}_0x17869f[_0x1abb('0x51')]=qs[_0x1abb('0x52')](_0x541bdd[_0x1abb('0x49')][_0x1abb('0x52')]);_0x17869f['where']=qs[_0x1abb('0x4b')](_['pick'](_0x541bdd[_0x1abb('0x49')],_0x1bb025[_0x1abb('0x4b')]),_0x1f1586);if(_0x541bdd[_0x1abb('0x49')][_0x1abb('0x53')]){_0x17869f[_0x1abb('0x54')]=_[_0x1abb('0x55')](_0x17869f[_0x1abb('0x54')],{'$or':_['map'](_0x1f1586,function(_0x457344){if(_0x457344[_0x1abb('0x46')]!=='VIRTUAL'){var _0x127ff8={};_0x127ff8[_0x457344[_0x1abb('0x3e')]]={'$like':'%'+_0x541bdd[_0x1abb('0x49')][_0x1abb('0x53')]+'%'};return _0x127ff8;}})});}_0x17869f=_[_0x1abb('0x55')]({},_0x17869f,_0x541bdd[_0x1abb('0x56')]);var _0x10639d={'where':_0x17869f['where']};return db['SmsAccount'][_0x1abb('0x32')](_0x10639d)[_0x1abb('0x23')](function(_0x13fd01){_0x42c26a['count']=_0x13fd01;if(_0x541bdd[_0x1abb('0x49')][_0x1abb('0x57')]){_0x17869f[_0x1abb('0x58')]=[{'all':!![]}];}return db[_0x1abb('0x44')][_0x1abb('0x59')](_0x17869f);})[_0x1abb('0x23')](function(_0x159001){_0x42c26a[_0x1abb('0x5a')]=_0x159001;return _0x42c26a;})['then'](respondWithFilteredResult(_0x5c8cbf,_0x17869f))[_0x1abb('0x2e')](handleError(_0x5c8cbf,null));};exports[_0x1abb('0x5b')]=function(_0x15cc5b,_0x1bd637){var _0x2da3b5={'raw':![],'where':{'id':_0x15cc5b['params']['id']},'include':[{'model':db['Pause'],'as':_0x1abb('0x42')}]},_0x387822={};_0x387822['model']=_[_0x1abb('0x4a')](db[_0x1abb('0x44')][_0x1abb('0x45')]);_0x387822['query']=_['keys'](_0x15cc5b[_0x1abb('0x49')]);_0x387822[_0x1abb('0x4b')]=_[_0x1abb('0x4c')](_0x387822[_0x1abb('0x48')],_0x387822[_0x1abb('0x49')]);_0x2da3b5[_0x1abb('0x4e')]=_['intersection'](_0x387822['model'],qs[_0x1abb('0x4d')](_0x15cc5b[_0x1abb('0x49')][_0x1abb('0x4d')]));_0x2da3b5[_0x1abb('0x4e')]=_0x2da3b5[_0x1abb('0x4e')][_0x1abb('0x4f')]?_0x2da3b5['attributes']:_0x387822[_0x1abb('0x48')];if(_0x15cc5b['query'][_0x1abb('0x57')]){_0x2da3b5[_0x1abb('0x58')]=[{'all':!![]}];}_0x2da3b5=_['merge']({},_0x2da3b5,_0x15cc5b[_0x1abb('0x56')]);return db[_0x1abb('0x44')][_0x1abb('0x5c')](_0x2da3b5)['then'](handleEntityNotFound(_0x1bd637,null))['then'](respondWithResult(_0x1bd637,null))[_0x1abb('0x2e')](handleError(_0x1bd637,null));};exports['create']=function(_0x1f3a12,_0x269ceb){return db[_0x1abb('0x44')]['create'](_0x1f3a12[_0x1abb('0x5d')],{})['then'](function(_0x51e94b){var _0x2299cc=_0x1f3a12['user']['get']({'plain':!![]});if(!_0x2299cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2299cc[_0x1abb('0x5e')]==='user'){var _0x5a33ba=_0x51e94b[_0x1abb('0x3a')]({'plain':!![]});var _0x31994e='SmsAccounts';return db[_0x1abb('0x5f')][_0x1abb('0x5c')]({'where':{'name':_0x31994e,'userProfileId':_0x2299cc[_0x1abb('0x60')]},'raw':!![]})[_0x1abb('0x23')](function(_0x2bc75f){if(_0x2bc75f&&_0x2bc75f['autoAssociation']===0x0){return db[_0x1abb('0x61')][_0x1abb('0x62')]({'name':_0x5a33ba[_0x1abb('0x3e')],'resourceId':_0x5a33ba['id'],'type':_0x2bc75f['name'],'sectionId':_0x2bc75f['id']},{})['then'](function(){return _0x51e94b;});}else{return _0x51e94b;}})[_0x1abb('0x2e')](function(_0x267126){logger['error'](_0x1abb('0x63'),_0x267126);throw _0x267126;});}return _0x51e94b;})[_0x1abb('0x23')](respondWithResult(_0x269ceb,0xc9))[_0x1abb('0x2e')](handleError(_0x269ceb,null));};exports[_0x1abb('0x38')]=function(_0x17ca4e,_0x155222){if(_0x17ca4e[_0x1abb('0x5d')]['id']){delete _0x17ca4e['body']['id'];}return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x17ca4e[_0x1abb('0x64')]['id']},'include':[{'model':db['Pause'],'as':_0x1abb('0x42')}]})[_0x1abb('0x23')](handleEntityNotFound(_0x155222,null))[_0x1abb('0x23')](saveUpdates(_0x17ca4e['body'],null))[_0x1abb('0x23')](respondWithResult(_0x155222,null))[_0x1abb('0x2e')](handleError(_0x155222,null));};exports[_0x1abb('0x39')]=function(_0x3271c7,_0xef068e){return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x3271c7[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0xef068e,null))[_0x1abb('0x23')](removeEntity(_0xef068e,null))[_0x1abb('0x2e')](handleError(_0xef068e,null));};exports[_0x1abb('0x65')]=function(_0x5d49f6,_0x319241){return db['SmsAccount'][_0x1abb('0x65')]()[_0x1abb('0x23')](respondWithResult(_0x319241,null))[_0x1abb('0x2e')](handleError(_0x319241,null));};exports['addDisposition']=function(_0x26ffc0,_0x38dc25,_0x6b53a3){if(_0x26ffc0['body']['id']){delete _0x26ffc0[_0x1abb('0x5d')]['id'];}return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x26ffc0[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x38dc25,null))['then'](function(_0x408d0f){if(_0x408d0f){_0x26ffc0[_0x1abb('0x5d')][_0x1abb('0x66')]=_0x408d0f['id'];return db[_0x1abb('0x67')][_0x1abb('0x62')](_0x26ffc0['body']);}})['then'](respondWithResult(_0x38dc25,null))['catch'](handleError(_0x38dc25,null));};exports[_0x1abb('0x68')]=function(_0x3707d8,_0x25f942,_0x4a109e){var _0x591b06={'raw':![],'where':{}};var _0x5844e8={};var _0x5e928d={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1abb('0x69')]({'where':{'id':_0x3707d8[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x25f942,null))[_0x1abb('0x23')](function(_0x1ecce3){if(_0x1ecce3){_0x5844e8[_0x1abb('0x48')]=_[_0x1abb('0x4a')](db[_0x1abb('0x67')]['rawAttributes']);_0x5844e8[_0x1abb('0x49')]=_[_0x1abb('0x4a')](_0x3707d8['query']);_0x5844e8[_0x1abb('0x4b')]=_[_0x1abb('0x4c')](_0x5844e8['model'],_0x5844e8[_0x1abb('0x49')]);_0x591b06[_0x1abb('0x4e')]=_['intersection'](_0x5844e8[_0x1abb('0x48')],qs['fields'](_0x3707d8[_0x1abb('0x49')]['fields']));_0x591b06[_0x1abb('0x4e')]=_0x591b06['attributes'][_0x1abb('0x4f')]?_0x591b06[_0x1abb('0x4e')]:_0x5844e8[_0x1abb('0x48')];if(!_0x3707d8[_0x1abb('0x49')]['hasOwnProperty'](_0x1abb('0x50'))){_0x591b06['limit']=qs[_0x1abb('0x34')](_0x3707d8[_0x1abb('0x49')]['limit']);_0x591b06['offset']=qs[_0x1abb('0x33')](_0x3707d8[_0x1abb('0x49')][_0x1abb('0x33')]);}_0x591b06[_0x1abb('0x51')]=qs[_0x1abb('0x52')](_0x3707d8[_0x1abb('0x49')][_0x1abb('0x52')]);_0x591b06[_0x1abb('0x54')]=qs[_0x1abb('0x4b')](_[_0x1abb('0x6a')](_0x3707d8[_0x1abb('0x49')],_0x5844e8[_0x1abb('0x4b')]));_0x591b06[_0x1abb('0x54')][_0x1abb('0x66')]=_0x1ecce3['id'];if(_0x3707d8[_0x1abb('0x49')][_0x1abb('0x53')]){_0x591b06['where']=_['merge'](_0x591b06['where'],{'$or':_['map'](_0x591b06[_0x1abb('0x4e')],function(_0x1691e1){var _0xf73db7={};_0xf73db7[_0x1691e1]={'$like':'%'+_0x3707d8[_0x1abb('0x49')]['filter']+'%'};return _0xf73db7;})});}_0x591b06=_[_0x1abb('0x55')]({},_0x591b06,_0x3707d8[_0x1abb('0x56')]);return db[_0x1abb('0x67')][_0x1abb('0x32')]({'where':_0x591b06[_0x1abb('0x54')]})[_0x1abb('0x23')](function(_0x220609){_0x5e928d[_0x1abb('0x32')]=_0x220609;if(_0x3707d8['query'][_0x1abb('0x57')]){_0x591b06[_0x1abb('0x58')]=[{'all':!![]}];}return db[_0x1abb('0x67')][_0x1abb('0x59')](_0x591b06);})[_0x1abb('0x23')](function(_0x20c712){_0x5e928d[_0x1abb('0x5a')]=_0x20c712;return _0x5e928d;});}})[_0x1abb('0x23')](respondWithFilteredResult(_0x25f942,_0x591b06))[_0x1abb('0x2e')](handleError(_0x25f942,null));};exports[_0x1abb('0x6b')]=function(_0x3b91f7,_0x4141ad,_0xb3b42d){return db[_0x1abb('0x44')]['find']({'where':{'id':_0x3b91f7['params']['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x4141ad,null))[_0x1abb('0x23')](function(_0x3ea2f6){if(_0x3ea2f6){return _0x3ea2f6['removeDispositions'](_0x3b91f7[_0x1abb('0x49')][_0x1abb('0x6c')]);}})[_0x1abb('0x23')](respondWithStatusCode(_0x4141ad,null))[_0x1abb('0x2e')](handleError(_0x4141ad,null));};exports['addAnswer']=function(_0x4d3ce0,_0x57b3ce,_0x464704){if(_0x4d3ce0[_0x1abb('0x5d')]['id']){delete _0x4d3ce0['body']['id'];}return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x4d3ce0[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x57b3ce,null))[_0x1abb('0x23')](function(_0x450ecc){if(_0x450ecc){_0x4d3ce0[_0x1abb('0x5d')][_0x1abb('0x66')]=_0x450ecc['id'];return db[_0x1abb('0x6d')][_0x1abb('0x62')](_0x4d3ce0['body']);}})['then'](respondWithResult(_0x57b3ce,null))[_0x1abb('0x2e')](handleError(_0x57b3ce,null));};exports['getAnswers']=function(_0x476bf5,_0x4660a0,_0x32bfd9){var _0x28ecf3={'raw':![],'where':{}};var _0x1888be={};var _0x57fecd={'count':0x0,'rows':[]};return db[_0x1abb('0x44')][_0x1abb('0x69')]({'where':{'id':_0x476bf5[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x4660a0,null))[_0x1abb('0x23')](function(_0x470e79){if(_0x470e79){_0x1888be[_0x1abb('0x48')]=_[_0x1abb('0x4a')](db[_0x1abb('0x6d')][_0x1abb('0x45')]);_0x1888be['query']=_[_0x1abb('0x4a')](_0x476bf5[_0x1abb('0x49')]);_0x1888be['filters']=_[_0x1abb('0x4c')](_0x1888be[_0x1abb('0x48')],_0x1888be[_0x1abb('0x49')]);_0x28ecf3['attributes']=_[_0x1abb('0x4c')](_0x1888be[_0x1abb('0x48')],qs['fields'](_0x476bf5[_0x1abb('0x49')][_0x1abb('0x4d')]));_0x28ecf3[_0x1abb('0x4e')]=_0x28ecf3[_0x1abb('0x4e')][_0x1abb('0x4f')]?_0x28ecf3[_0x1abb('0x4e')]:_0x1888be['model'];if(!_0x476bf5[_0x1abb('0x49')][_0x1abb('0x6e')](_0x1abb('0x50'))){_0x28ecf3[_0x1abb('0x34')]=qs[_0x1abb('0x34')](_0x476bf5[_0x1abb('0x49')][_0x1abb('0x34')]);_0x28ecf3['offset']=qs[_0x1abb('0x33')](_0x476bf5[_0x1abb('0x49')][_0x1abb('0x33')]);}_0x28ecf3['order']=qs[_0x1abb('0x52')](_0x476bf5[_0x1abb('0x49')][_0x1abb('0x52')]);_0x28ecf3[_0x1abb('0x54')]=qs[_0x1abb('0x4b')](_[_0x1abb('0x6a')](_0x476bf5[_0x1abb('0x49')],_0x1888be[_0x1abb('0x4b')]));_0x28ecf3['where']['SmsAccountId']=_0x470e79['id'];if(_0x476bf5[_0x1abb('0x49')][_0x1abb('0x53')]){_0x28ecf3[_0x1abb('0x54')]=_[_0x1abb('0x55')](_0x28ecf3[_0x1abb('0x54')],{'$or':_['map'](_0x28ecf3[_0x1abb('0x4e')],function(_0x4e8d58){var _0xc19a11={};_0xc19a11[_0x4e8d58]={'$like':'%'+_0x476bf5[_0x1abb('0x49')][_0x1abb('0x53')]+'%'};return _0xc19a11;})});}_0x28ecf3=_[_0x1abb('0x55')]({},_0x28ecf3,_0x476bf5[_0x1abb('0x56')]);return db[_0x1abb('0x6d')]['count']({'where':_0x28ecf3[_0x1abb('0x54')]})[_0x1abb('0x23')](function(_0x11a51b){_0x57fecd['count']=_0x11a51b;if(_0x476bf5['query']['includeAll']){_0x28ecf3[_0x1abb('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1abb('0x59')](_0x28ecf3);})[_0x1abb('0x23')](function(_0x39844b){_0x57fecd[_0x1abb('0x5a')]=_0x39844b;return _0x57fecd;});}})[_0x1abb('0x23')](respondWithFilteredResult(_0x4660a0,_0x28ecf3))[_0x1abb('0x2e')](handleError(_0x4660a0,null));};exports[_0x1abb('0x6f')]=function(_0x3e3524,_0x2fa8ce,_0xc52327){return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x3e3524[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x2fa8ce,null))[_0x1abb('0x23')](function(_0x5fcce7){if(_0x5fcce7){return _0x5fcce7[_0x1abb('0x6f')](_0x3e3524[_0x1abb('0x49')][_0x1abb('0x6c')]);}})['then'](respondWithStatusCode(_0x2fa8ce,null))[_0x1abb('0x2e')](handleError(_0x2fa8ce,null));};exports['notify']=function(_0x5ac2e5,_0x2733eb,_0x1e6b1a){var _0x48cd3c={'channel':_0x1abb('0x70')};var _0x676e91=[];var _0x8636d3=[];var _0x255f56={};return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x5ac2e5[_0x1abb('0x64')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x1abb('0x71')}]})[_0x1abb('0x23')](handleEntityNotFound(_0x2733eb,null))['then'](function(_0x29c6b7){_0x48cd3c[_0x1abb('0x72')]=_0x29c6b7;_0x48cd3c[_0x1abb('0x73')]=_[_0x1abb('0x74')](_0x29c6b7[_0x1abb('0x71')],['priority'],[_0x1abb('0x75')]);if(_0x48cd3c[_0x1abb('0x72')][_0x1abb('0x71')]){delete _0x48cd3c[_0x1abb('0x72')]['Applications'];}return db[_0x1abb('0x76')]['describe']();})[_0x1abb('0x23')](function(_0x28748d){if(!_0x28748d){throw new db[(_0x1abb('0x77'))][(_0x1abb('0x78'))]('no\x20available\x20attributes');}_0x676e91=_[_0x1abb('0x79')](_['keys'](_0x28748d),[_0x1abb('0x7a'),'updatedAt']);_0x8636d3=_[_0x1abb('0x79')](_[_0x1abb('0x4a')](_0x28748d),[_0x1abb('0x7a'),_0x1abb('0x7b'),'CompanyId','ListId']);_0x48cd3c[_0x1abb('0x5d')]={'mapKey':_0x1abb('0x7c')};if(_0x48cd3c[_0x1abb('0x72')][_0x1abb('0x46')]){switch(_0x48cd3c[_0x1abb('0x72')][_0x1abb('0x46')]){case _0x1abb('0x7d'):_0x48cd3c[_0x1abb('0x5d')]['from']=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x7e')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x7f')];_0x48cd3c['body']['messageId']=_0x5ac2e5['body'][_0x1abb('0x80')];break;case _0x1abb('0x81'):_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')]='+'+_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x83')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x84')];break;case'connectel':_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x82')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x2c')];break;case _0x1abb('0x85'):_0x48cd3c['body'][_0x1abb('0x82')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x82')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')]['body'];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x86')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x87')];break;case _0x1abb('0x88'):_0x48cd3c['body'][_0x1abb('0x82')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x7e')];_0x48cd3c['body'][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x89')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x86')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x8a')];break;case _0x1abb('0x8b'):_0x48cd3c[_0x1abb('0x5d')]['from']='+'+_0x5ac2e5[_0x1abb('0x5d')]['results'][0x0][_0x1abb('0x82')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x8c')][0x0][_0x1abb('0x84')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x86')]=_0x5ac2e5['body'][_0x1abb('0x8c')][0x0][_0x1abb('0x86')];break;case _0x1abb('0x8d'):_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')]=_0x5ac2e5['body'][_0x1abb('0x8e')];_0x48cd3c['body'][_0x1abb('0x5d')]=_0x5ac2e5['body']['segmentedMessage'][_0x1abb('0x2c')];break;case _0x1abb('0x8f'):_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x90')];_0x48cd3c[_0x1abb('0x5d')]['body']=_0x5ac2e5[_0x1abb('0x5d')]['text'];_0x48cd3c[_0x1abb('0x5d')]['messageId']=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x91')];break;case _0x1abb('0x92'):_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x86')]=_0x5ac2e5[_0x1abb('0x5d')][0x0][_0x1abb('0x2c')]['id'];_0x48cd3c['body'][_0x1abb('0x82')]=_0x5ac2e5[_0x1abb('0x5d')][0x0][_0x1abb('0x2c')][_0x1abb('0x82')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')]=_0x5ac2e5['body'][0x0][_0x1abb('0x2c')][_0x1abb('0x84')];break;case _0x1abb('0x93'):_0x48cd3c[_0x1abb('0x5d')]['from']=_0x5ac2e5['body']['from'];_0x48cd3c['body'][_0x1abb('0x5d')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x2c')];_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x86')]=_0x5ac2e5[_0x1abb('0x5d')][_0x1abb('0x94')];break;}}if(_0x48cd3c[_0x1abb('0x5d')]['id']){delete _0x48cd3c[_0x1abb('0x5d')]['id'];}if(_[_0x1abb('0x95')](_0x48cd3c['body'][_0x1abb('0x82')])){throw new db[(_0x1abb('0x77'))][(_0x1abb('0x78'))]('from\x20is\x20mandatory');}if(_[_0x1abb('0x95')](_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')])||_0x48cd3c[_0x1abb('0x5d')]['body']===''){throw new db[(_0x1abb('0x77'))][(_0x1abb('0x78'))](_0x1abb('0x96'));}if(_[_0x1abb('0x95')](_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x97')])){throw new db['Sequelize']['ValidationError'](_0x1abb('0x98')+_0x8636d3);}if(!_['includes'](_0x8636d3,_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x97')])){throw new db[(_0x1abb('0x77'))][(_0x1abb('0x78'))](_0x1abb('0x99')+_0x8636d3);}_0x255f56[_0x48cd3c['body'][_0x1abb('0x97')]]=_0x48cd3c[_0x1abb('0x5d')]['from'];return db[_0x1abb('0x9a')]['find']({'where':{'id':_0x48cd3c[_0x1abb('0x72')][_0x1abb('0x9b')]},'include':[{'model':db[_0x1abb('0x76')],'as':_0x1abb('0x9c'),'where':_0x255f56,'limit':0x1,'order':[[_0x1abb('0x7b'),_0x1abb('0x9d')]]}]});})[_0x1abb('0x23')](handleEntityNotFound(_0x2733eb,null))[_0x1abb('0x23')](function(_0x278fdd){if(_0x278fdd){_0x48cd3c['list']=_['omit'](_0x278fdd,[_0x1abb('0x9c')]);if(_0x278fdd[_0x1abb('0x9c')][_0x1abb('0x4f')]){return _0x278fdd[_0x1abb('0x9c')][0x0];}var _0x106d59=_[_0x1abb('0x1b')](_0x48cd3c[_0x1abb('0x5d')],{'firstName':_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')],'ListId':_0x278fdd['id']});_0x106d59[_0x48cd3c['body'][_0x1abb('0x97')]]=_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')];return db[_0x1abb('0x76')][_0x1abb('0x62')](_0x106d59,{'fields':_0x676e91,'raw':!![]});}})[_0x1abb('0x23')](handleEntityNotFound(_0x2733eb,null))['then'](function(_0x4ddad5){if(_0x4ddad5){_0x48cd3c[_0x1abb('0x9e')]=_0x4ddad5;var _0xc6dd2={'ContactId':_0x4ddad5['id'],'phone':_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x82')],'SmsAccountId':_0x5ac2e5[_0x1abb('0x64')]['id']};var _0x5dfd45={'ContactId':_0x4ddad5['id'],'SmsAccountId':_0x5ac2e5[_0x1abb('0x64')]['id'],'closed':![]};return db[_0x1abb('0x9f')]['find']({'where':_0x5dfd45})['then'](function(_0x4b0ff7){if(_0x4b0ff7){return[_0x4b0ff7,![]];}return db[_0x1abb('0x9f')][_0x1abb('0x62')](_0xc6dd2)[_0x1abb('0x23')](function(_0x34f31f){return[_0x34f31f,!![]];});});}})[_0x1abb('0xa0')](function(_0x8124a7,_0x437419){_0x48cd3c[_0x1abb('0xa1')]=_0x8124a7[_0x1abb('0x3a')]({'plain':!![]});_0x48cd3c[_0x1abb('0xa1')][_0x1abb('0xa2')]=![];if(_0x437419){if(_0x48cd3c[_0x1abb('0x72')][_0x1abb('0xa3')]){_0x48cd3c[_0x1abb('0x73')][_0x1abb('0xa4')]({'id':0x0,'priority':_0x48cd3c[_0x1abb('0x73')][_0x1abb('0x4f')]+0x1,'app':_0x1abb('0xa5'),'appdata':'unmanaged','interval':_0x1abb('0xa6')});}_0x48cd3c[_0x1abb('0xa1')][_0x1abb('0xa2')]=!![];}return db[_0x1abb('0xa7')][_0x1abb('0x62')]({'phone':_0x48cd3c[_0x1abb('0x5d')]['from'],'messageId':_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x86')],'body':_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0x5d')],'SmsAccountId':_0x5ac2e5['params']['id'],'SmsInteractionId':_0x8124a7['id'],'direction':'in','ContactId':_0x8124a7[_0x1abb('0xa8')],'AttachmentId':_0x48cd3c[_0x1abb('0x5d')][_0x1abb('0xa9')]});})[_0x1abb('0x23')](function(_0x35043d){_0x48cd3c['message']=_0x35043d;if(_0x48cd3c['interaction'][_0x1abb('0xaa')]){return db[_0x1abb('0xab')]['find']({'attributes':['id',_0x1abb('0x3e')],'where':{'id':_0x48cd3c[_0x1abb('0xa1')][_0x1abb('0xaa')]}})['then'](function(_0x5d0c8a){if(_0x5d0c8a){_0x48cd3c[_0x1abb('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1abb('0xac'),'appdata':_0x5d0c8a[_0x1abb('0x3e')]+','+(_0x48cd3c[_0x1abb('0x72')][_0x1abb('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1abb('0xae'),_0x1abb('0xaf'),_0x48cd3c);});}return respondWithRpcPromise(_0x1abb('0xae'),'startRouting',_0x48cd3c);})[_0x1abb('0x23')](function(_0x567f4d){if(_0x567f4d){var _0x258fda=0xc8;var _0x7d081=_0x1abb('0xb0');logger['info'](_0x1abb('0x27'),_0x7d081,_0x258fda,_0x1abb('0xb1'));logger[_0x1abb('0x26')](_0x1abb('0xb2'),_0x7d081,_0x258fda,'entity\x20found',JSON[_0x1abb('0x28')](_0x567f4d));if(_0x48cd3c[_0x1abb('0x72')][_0x1abb('0x46')]===_0x1abb('0x7d')){return _0x2733eb['status'](_0x258fda)[_0x1abb('0xb3')](_0x1abb('0xb4'),_0x1abb('0xb5'))[_0x1abb('0x3f')](_0x1abb('0xb6'));}else{return _0x2733eb[_0x1abb('0x30')](_0x258fda)[_0x1abb('0x31')](_0x567f4d);}}})[_0x1abb('0x2e')](handleError(_0x2733eb,null));};exports[_0x1abb('0xb7')]=function(_0x31a234,_0x4aa888,_0x1bb911){return db[_0x1abb('0x44')][_0x1abb('0x69')]({'where':{'id':_0x31a234[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x4aa888,null))[_0x1abb('0x23')](function(_0x5ea715){if(_0x5ea715){return db[_0x1abb('0xb8')]['transaction'](function(_0x31a77e){return db[_0x1abb('0xb9')][_0x1abb('0x39')]({'where':{'SmsAccountId':_0x31a234[_0x1abb('0x64')]['id']},'transaction':_0x31a77e})[_0x1abb('0x23')](function(_0x551b82){var _0x3cd756=_[_0x1abb('0x43')](_0x31a234[_0x1abb('0x5d')],function(_0x5835a6){_0x5835a6[_0x1abb('0x66')]=_0x31a234[_0x1abb('0x64')]['id'];return _0x5835a6;});return db[_0x1abb('0xb9')][_0x1abb('0xba')](_0x3cd756,{'transaction':_0x31a77e});});})[_0x1abb('0x23')](function(){return db[_0x1abb('0xb9')][_0x1abb('0xbb')]({'where':{'SmsAccountId':_0x31a234[_0x1abb('0x64')]['id']},'order':_0x1abb('0xbc')});});}})['then'](respondWithResult(_0x4aa888,null))[_0x1abb('0x2e')](handleError(_0x4aa888,null));};exports['getApplications']=function(_0x3ac652,_0x28f37a,_0x260ef){var _0x870119={};var _0x2fc206={};var _0x7a3a0;var _0x487847;return db['SmsAccount']['findOne']({'where':{'id':_0x3ac652[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x28f37a,null))[_0x1abb('0x23')](function(_0x6ffa3e){if(_0x6ffa3e){_0x7a3a0=_0x6ffa3e;_0x2fc206['model']=_['keys'](db[_0x1abb('0xb9')][_0x1abb('0x45')]);_0x2fc206[_0x1abb('0x49')]=_['keys'](_0x3ac652['query']);_0x2fc206[_0x1abb('0x4b')]=_['intersection'](_0x2fc206[_0x1abb('0x48')],_0x2fc206[_0x1abb('0x49')]);_0x870119['attributes']=_[_0x1abb('0x4c')](_0x2fc206['model'],qs[_0x1abb('0x4d')](_0x3ac652['query'][_0x1abb('0x4d')]));_0x870119[_0x1abb('0x4e')]=_0x870119[_0x1abb('0x4e')][_0x1abb('0x4f')]?_0x870119['attributes']:_0x2fc206[_0x1abb('0x48')];_0x870119[_0x1abb('0x51')]=qs['sort'](_0x3ac652[_0x1abb('0x49')]['sort']);_0x870119['where']=qs[_0x1abb('0x4b')](_[_0x1abb('0x6a')](_0x3ac652[_0x1abb('0x49')],_0x2fc206[_0x1abb('0x4b')]));if(_0x3ac652[_0x1abb('0x49')]['filter']){_0x870119[_0x1abb('0x54')]=_['merge'](_0x870119[_0x1abb('0x54')],{'$or':_[_0x1abb('0x43')](_0x870119[_0x1abb('0x4e')],function(_0x4d6200){var _0x5b3b80={};_0x5b3b80[_0x4d6200]={'$like':'%'+_0x3ac652[_0x1abb('0x49')]['filter']+'%'};return _0x5b3b80;})});}_0x870119=_[_0x1abb('0x55')]({},_0x870119,_0x3ac652['options']);return _0x7a3a0['getApplications'](_0x870119);}})[_0x1abb('0x23')](function(_0x1b4100){if(_0x1b4100){_0x487847=_0x1b4100['length'];if(!_0x3ac652[_0x1abb('0x49')]['hasOwnProperty'](_0x1abb('0x50'))){_0x870119[_0x1abb('0x34')]=qs['limit'](_0x3ac652[_0x1abb('0x49')]['limit']);_0x870119[_0x1abb('0x33')]=qs[_0x1abb('0x33')](_0x3ac652['query'][_0x1abb('0x33')]);}return _0x7a3a0[_0x1abb('0xbd')](_0x870119);}})[_0x1abb('0x23')](function(_0x1c1899){if(_0x1c1899){return _0x1c1899?{'count':_0x487847,'rows':_0x1c1899}:null;}})[_0x1abb('0x23')](respondWithResult(_0x28f37a,null))[_0x1abb('0x2e')](handleError(_0x28f37a,null));};exports[_0x1abb('0xbe')]=function(_0x360627,_0x4cf0f2,_0x57bd18){var _0x5beacb={'raw':![],'where':{}};var _0x2dba5d={};var _0x44925b={'count':0x0,'rows':[]};return db[_0x1abb('0x44')][_0x1abb('0x69')]({'where':{'id':_0x360627[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x4cf0f2,null))[_0x1abb('0x23')](function(_0x18480c){if(_0x18480c){_0x2dba5d[_0x1abb('0x48')]=_[_0x1abb('0x4a')](db[_0x1abb('0x9f')][_0x1abb('0x45')]);_0x2dba5d['query']=_[_0x1abb('0x4a')](_0x360627['query']);_0x2dba5d['filters']=_[_0x1abb('0x4c')](_0x2dba5d[_0x1abb('0x48')],_0x2dba5d[_0x1abb('0x49')]);_0x5beacb[_0x1abb('0x4e')]=_[_0x1abb('0x4c')](_0x2dba5d[_0x1abb('0x48')],qs[_0x1abb('0x4d')](_0x360627[_0x1abb('0x49')][_0x1abb('0x4d')]));_0x5beacb['attributes']=_0x5beacb[_0x1abb('0x4e')][_0x1abb('0x4f')]?_0x5beacb[_0x1abb('0x4e')]:_0x2dba5d[_0x1abb('0x48')];if(!_0x360627[_0x1abb('0x49')]['hasOwnProperty']('nolimit')){_0x5beacb[_0x1abb('0x34')]=qs[_0x1abb('0x34')](_0x360627[_0x1abb('0x49')][_0x1abb('0x34')]);_0x5beacb[_0x1abb('0x33')]=qs[_0x1abb('0x33')](_0x360627[_0x1abb('0x49')][_0x1abb('0x33')]);}_0x5beacb[_0x1abb('0x51')]=qs[_0x1abb('0x52')](_0x360627[_0x1abb('0x49')]['sort']);_0x5beacb[_0x1abb('0x54')]=qs[_0x1abb('0x4b')](_[_0x1abb('0x6a')](_0x360627[_0x1abb('0x49')],_0x2dba5d[_0x1abb('0x4b')]));_0x5beacb['where'][_0x1abb('0x66')]=_0x18480c['id'];if(_0x360627[_0x1abb('0x49')][_0x1abb('0x53')]){_0x5beacb[_0x1abb('0x54')]=_['merge'](_0x5beacb[_0x1abb('0x54')],{'$or':_['map'](_0x5beacb[_0x1abb('0x4e')],function(_0x283367){var _0x5ec0e3={};_0x5ec0e3[_0x283367]={'$like':'%'+_0x360627[_0x1abb('0x49')][_0x1abb('0x53')]+'%'};return _0x5ec0e3;})});}_0x5beacb=_['merge']({},_0x5beacb,_0x360627[_0x1abb('0x56')]);return db[_0x1abb('0x9f')][_0x1abb('0x32')]({'where':_0x5beacb[_0x1abb('0x54')]})[_0x1abb('0x23')](function(_0xca949d){_0x44925b['count']=_0xca949d;if(_0x360627[_0x1abb('0x49')]['includeAll']){_0x5beacb[_0x1abb('0x58')]=[{'model':db[_0x1abb('0x76')],'as':_0x1abb('0xbf'),'required':![]},{'model':db[_0x1abb('0xab')],'as':_0x1abb('0xc0'),'attributes':[_0x1abb('0x3e'),_0x1abb('0xc1'),_0x1abb('0xc2')],'required':![]},{'model':db[_0x1abb('0xc3')],'as':_0x1abb('0xc4'),'attributes':['id',_0x1abb('0x3e'),_0x1abb('0xc5')],'where':_0x360627[_0x1abb('0x49')]['tag']?{'id':_0x360627[_0x1abb('0x49')][_0x1abb('0xc6')]}:undefined,'required':_0x360627[_0x1abb('0x49')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x1abb('0x59')](_0x5beacb);})[_0x1abb('0x23')](function(_0x5660ae){_0x44925b['rows']=_0x5660ae;return _0x44925b;});}})[_0x1abb('0x23')](respondWithFilteredResult(_0x4cf0f2,_0x5beacb))[_0x1abb('0x2e')](handleError(_0x4cf0f2,null));};exports[_0x1abb('0x3f')]=function(_0x19a788,_0x3610a1,_0x276326){var _0x2f5e48,_0x2e7892,_0x477d30;if(_[_0x1abb('0x95')](_0x19a788[_0x1abb('0x5d')][_0x1abb('0x5d')])||_0x19a788[_0x1abb('0x5d')][_0x1abb('0x5d')]===''){throw new db[(_0x1abb('0x77'))][(_0x1abb('0x78'))](_0x1abb('0x96'));}if(_['isNil'](_0x19a788[_0x1abb('0x5d')]['to'])){throw new db[(_0x1abb('0x77'))][(_0x1abb('0x78'))](_0x1abb('0xc7'));}_0x2f5e48=_0x19a788['body']['to'];return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x19a788['params']['id']},'include':[{'model':db[_0x1abb('0x9a')],'as':_0x1abb('0xc8'),'include':[{'model':db[_0x1abb('0x76')],'as':_0x1abb('0x9c'),'where':{'mobile':_0x2f5e48},'limit':0x1,'order':[['updatedAt',_0x1abb('0x9d')]]}]}]})[_0x1abb('0x23')](handleEntityNotFound(_0x3610a1,null))[_0x1abb('0x23')](function(_0x4f2312){if(_0x4f2312&&_0x4f2312[_0x1abb('0xc8')]){_0x2e7892=_0x4f2312[_0x1abb('0x3a')]({'plain':!![]});if(_0x2e7892[_0x1abb('0xc8')]&&_0x2e7892[_0x1abb('0xc8')]['Contacts'][_0x1abb('0x4f')]){return _0x2e7892['List'][_0x1abb('0x9c')][0x0];}return db['CmContact'][_0x1abb('0x62')](_[_0x1abb('0x1b')](_0x19a788[_0x1abb('0x5d')],{'firstName':_0x2f5e48,'mobile':_0x2f5e48,'phone':_0x2f5e48,'ListId':_0x2e7892[_0x1abb('0x9b')]}));}})[_0x1abb('0x23')](handleEntityNotFound(_0x3610a1,null))['then'](function(_0x3774cd){if(_0x3774cd){_0x477d30=_0x3774cd;return db[_0x1abb('0x9f')][_0x1abb('0x5c')]({'where':{'ContactId':_0x477d30['id'],'closed':![],'SmsAccountId':_0x2e7892['id']}})[_0x1abb('0x23')](function(_0x3d5e45){if(_0x3d5e45){return[_0x3d5e45,![]];}return db[_0x1abb('0x9f')][_0x1abb('0x62')]({'UserId':_0x19a788[_0x1abb('0xc9')]['id'],'ContactId':_0x477d30['id'],'SmsAccountId':_0x2e7892['id'],'phone':_0x2f5e48,'firstMsgDirection':'out','Messages':[_[_0x1abb('0x55')](_0x19a788['body'],{'read':![],'body':_0x19a788[_0x1abb('0x5d')][_0x1abb('0x5d')],'phone':_0x2f5e48,'SmsAccountId':_0x2e7892['id'],'UserId':_0x19a788[_0x1abb('0xc9')]['id'],'ContactId':_0x477d30['id']})]},{'include':[{'model':db[_0x1abb('0xa7')],'as':_0x1abb('0xca')}]})[_0x1abb('0x23')](function(_0x253225){return[_0x253225,!![]];});});}})[_0x1abb('0xa0')](function(_0x2af004,_0x3cca4b){if(_0x3cca4b){return _0x2af004;}return db[_0x1abb('0xa7')][_0x1abb('0x62')](_[_0x1abb('0x55')](_0x19a788[_0x1abb('0x5d')],{'read':![],'body':_0x19a788[_0x1abb('0x5d')][_0x1abb('0x5d')],'phone':_0x2f5e48,'SmsAccountId':_0x2e7892['id'],'SmsInteractionId':_0x2af004['id'],'UserId':_0x19a788['user']['id'],'ContactId':_0x477d30['id']}))['then'](function(_0x51a9a0){_0x2af004[_0x1abb('0xcb')]['Messages']=[];_0x2af004[_0x1abb('0xcb')][_0x1abb('0xca')][_0x1abb('0xa4')](_0x51a9a0[_0x1abb('0xcb')]);return _0x2af004;});})['then'](respondWithResult(_0x3610a1,null))[_0x1abb('0x2e')](handleError(_0x3610a1,null));};exports['status']=function(_0x2e37c3,_0x3de03a,_0x49f66b){if(_0x2e37c3[_0x1abb('0x5d')]['id']){delete _0x2e37c3[_0x1abb('0x5d')]['id'];}var _0x45e018,_0x5e6c03,_0x4b95a8;return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x2e37c3[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x3de03a,null))[_0x1abb('0x23')](function(_0x1c2881){if(_0x1c2881){_0x4b95a8=_0x1c2881;logger[_0x1abb('0x26')](_0x1abb('0x27'),_0x1abb('0x30'),_0x1abb('0xcc'),_0x1c2881[_0x1abb('0x46')],util[_0x1abb('0xcd')](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));switch(_0x1c2881[_0x1abb('0x46')]){case _0x1abb('0x81'):if(_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0xce')]&&_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x30')]){_0x5e6c03=_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x30')];return db['SmsMessage'][_0x1abb('0x5c')]({'where':{'messageId':_0x2e37c3['body'][_0x1abb('0xce')]}});}break;case _0x1abb('0xcf'):if(_0x2e37c3['body'][_0x1abb('0xd0')]&&_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0xd1')]){_0x5e6c03=_0x2e37c3[_0x1abb('0x5d')]['statusInt'];return db[_0x1abb('0xa7')][_0x1abb('0x5c')]({'where':{'messageId':_0x2e37c3[_0x1abb('0x5d')]['requestid']}});}break;case _0x1abb('0x85'):if(_0x2e37c3['body'][_0x1abb('0x87')]&&_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0xd2')]){_0x5e6c03=_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0xd2')];return db[_0x1abb('0xa7')][_0x1abb('0x5c')]({'where':{'messageId':_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x87')]}});}break;case _0x1abb('0x8b'):var _0x1236a6=_0x2e37c3['body'][_0x1abb('0x8c')][0x0];if(_0x1236a6[_0x1abb('0x86')]&&_0x1236a6[_0x1abb('0x30')][_0x1abb('0xd3')]==='DELIVERED'){_0x5e6c03=_0x1236a6['status'][_0x1abb('0xd3')];return db[_0x1abb('0xa7')]['find']({'where':{'messageId':_0x1236a6['messageId']}});}break;case _0x1abb('0x8f'):if(_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x86')]&&_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x30')]){_0x5e6c03=_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x30')];return db[_0x1abb('0xa7')][_0x1abb('0x5c')]({'where':{'messageId':_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x86')]}});}break;case'bandwidth':if(_0x2e37c3[_0x1abb('0x5d')][0x0]['message']['id']){_0x5e6c03=_0x2e37c3[_0x1abb('0x5d')][0x0]['type'];return db['SmsMessage']['find']({'where':{'messageId':_0x2e37c3[_0x1abb('0x5d')][0x0][_0x1abb('0x2c')]['id']}});}break;case _0x1abb('0x93'):if(_0x2e37c3['body'][_0x1abb('0xd4')]&&_0x2e37c3['body'][_0x1abb('0x30')]){_0x5e6c03=_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x30')];return db['SmsMessage'][_0x1abb('0x5c')]({'where':{'messageId':_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0xd4')]}});}break;}}})[_0x1abb('0x23')](handleEntityNotFound(_0x3de03a,null))[_0x1abb('0x23')](function(_0x54bc90){if(_0x54bc90){_0x45e018=_0x54bc90;switch(_0x4b95a8[_0x1abb('0x46')]){case _0x1abb('0x81'):if(_0x5e6c03===_0x1abb('0xd5')){return _0x45e018[_0x1abb('0x38')]({'read':!![]});}else{logger[_0x1abb('0x29')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1abb('0x30'),'skebby',util[_0x1abb('0xcd')](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1abb('0xcf'):if(_0x5e6c03==='1'){return _0x45e018[_0x1abb('0x38')]({'read':!![]});}else{logger['error'](_0x1abb('0x27'),_0x1abb('0x30'),_0x1abb('0x81'),util['inspect'](_0x2e37c3['body'],{'showHidden':![],'depth':null}));}break;case _0x1abb('0x85'):if(!_0x2e37c3['body']['error_code']&&_0x5e6c03>=0xc8&&_0x5e6c03<=0xce){return _0x45e018['update']({'read':!![]});}else{logger['error'](_0x1abb('0x27'),_0x1abb('0x30'),_0x1abb('0x85'),util[_0x1abb('0xcd')](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1abb('0x8b'):var _0x3c57b7=_0x2e37c3[_0x1abb('0x5d')][_0x1abb('0x8c')][0x0];if(_0x3c57b7[_0x1abb('0x30')][_0x1abb('0xd3')]==='DELIVERED'){return _0x45e018[_0x1abb('0x38')]({'read':!![]});}else{logger[_0x1abb('0x29')](_0x1abb('0x27'),_0x1abb('0x30'),_0x1abb('0x8b'),util['inspect'](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x5e6c03==_0x1abb('0xd6')||_0x5e6c03==_0x1abb('0xd7')){return _0x45e018[_0x1abb('0x38')]({'read':!![]});}else{logger[_0x1abb('0x29')](_0x1abb('0x27'),_0x1abb('0x30'),'clickatell',util['inspect'](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1abb('0x92'):if(_0x5e6c03==_0x1abb('0xd8')){return _0x45e018[_0x1abb('0x38')]({'read':!![]});}else{logger[_0x1abb('0x29')](_0x1abb('0x27'),_0x1abb('0x30'),'bandwidth',util['inspect'](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1abb('0x93'):if(_0x5e6c03===_0x1abb('0xd9')||_0x5e6c03===_0x1abb('0xda')){return _0x45e018[_0x1abb('0x38')]({'read':!![]});}else{logger['error'](_0x1abb('0x27'),_0x1abb('0x30'),'intelepeer',util[_0x1abb('0xcd')](_0x2e37c3[_0x1abb('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x45e018;}})[_0x1abb('0x23')](respondWithResult(_0x3de03a,null))['catch'](handleError(_0x3de03a,null));};exports['statusGet']=function(_0x15eb6a,_0x512e11,_0x1b0ae7){var _0x2b8176,_0x17ed2b,_0x976eda;return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x15eb6a[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x512e11,null))[_0x1abb('0x23')](function(_0x29452a){if(_0x29452a){_0x976eda=_0x29452a;logger[_0x1abb('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1abb('0x30'),_0x1abb('0xcc'),_0x29452a[_0x1abb('0x46')],util['inspect'](_0x15eb6a[_0x1abb('0x49')],{'showHidden':![],'depth':null}));switch(_0x29452a[_0x1abb('0x46')]){case'csc':if(_0x15eb6a[_0x1abb('0x49')][_0x1abb('0xdb')]&&_0x15eb6a[_0x1abb('0x49')]['state']){_0x17ed2b=_0x15eb6a[_0x1abb('0x49')][_0x1abb('0xdc')];return db[_0x1abb('0xa7')][_0x1abb('0x5c')]({'where':{'messageId':_0x15eb6a[_0x1abb('0x49')][_0x1abb('0xdb')]}});}break;}}})[_0x1abb('0x23')](handleEntityNotFound(_0x512e11,null))[_0x1abb('0x23')](function(_0x4e1112){if(_0x4e1112){_0x2b8176=_0x4e1112;switch(_0x976eda[_0x1abb('0x46')]){case'csc':if(_0x17ed2b==='2'||_0x17ed2b==='6'){return _0x2b8176[_0x1abb('0x38')]({'read':!![]});}else{logger[_0x1abb('0x29')](_0x1abb('0x27'),'status','csc',util[_0x1abb('0xcd')](_0x15eb6a[_0x1abb('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x2b8176;}})[_0x1abb('0x23')](respondWithResult(_0x512e11,null))[_0x1abb('0x2e')](handleError(_0x512e11,null));};exports[_0x1abb('0xdd')]=function(_0x5c5fa4,_0x4c4058,_0x5ef012){return db['SmsAccount'][_0x1abb('0x5c')]({'where':{'id':_0x5c5fa4[_0x1abb('0x64')]['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0x4c4058,null))[_0x1abb('0x23')](function(_0x197c29){if(_0x197c29){return _0x197c29['addAgents'](_0x5c5fa4[_0x1abb('0x5d')]['ids'],_[_0x1abb('0xde')](_0x5c5fa4['body'],[_0x1abb('0x6c'),'id'])||{})[_0x1abb('0xa0')](function(_0x25abfa){for(var _0x1092fc=0x0;_0x1092fc<_0x5c5fa4['body'][_0x1abb('0x6c')][_0x1abb('0x4f')];_0x1092fc+=0x1){socket[_0x1abb('0xdf')](_0x1abb('0xe0'),{'UserId':_0x5c5fa4[_0x1abb('0x5d')][_0x1abb('0x6c')][_0x1092fc],'SmsAccountId':_0x5c5fa4[_0x1abb('0x64')]['id']});}return _0x25abfa;});}})[_0x1abb('0x23')](respondWithResult(_0x4c4058,null))['catch'](handleError(_0x4c4058,null));};exports[_0x1abb('0xe1')]=function(_0x2bb3e4,_0xccc122,_0x3ee4ee){return db[_0x1abb('0x44')][_0x1abb('0x5c')]({'where':{'id':_0x2bb3e4[_0x1abb('0x64')]['id']}})['then'](handleEntityNotFound(_0xccc122,null))[_0x1abb('0x23')](function(_0x59656e){if(_0x59656e){return _0x59656e[_0x1abb('0xe1')](_0x2bb3e4[_0x1abb('0x49')][_0x1abb('0x6c')])[_0x1abb('0x23')](function(){if(_[_0x1abb('0xe2')](_0x2bb3e4[_0x1abb('0x49')][_0x1abb('0x6c')])){for(var _0x3c6d1c=0x0;_0x3c6d1c<_0x2bb3e4[_0x1abb('0x49')]['ids'][_0x1abb('0x4f')];_0x3c6d1c+=0x1){socket[_0x1abb('0xdf')]('userSmsAccount:remove',{'UserId':Number(_0x2bb3e4[_0x1abb('0x49')][_0x1abb('0x6c')][_0x3c6d1c]),'SmsAccountId':Number(_0x2bb3e4[_0x1abb('0x64')]['id'])});}}else{socket[_0x1abb('0xdf')](_0x1abb('0xe3'),{'UserId':Number(_0x2bb3e4[_0x1abb('0x49')][_0x1abb('0x6c')]),'SmsAccountId':Number(_0x2bb3e4[_0x1abb('0x64')]['id'])});}});}})[_0x1abb('0x23')](respondWithStatusCode(_0xccc122,null))[_0x1abb('0x2e')](handleError(_0xccc122,null));};exports[_0x1abb('0xe4')]=function(_0xf72761,_0xc371c0,_0x4eeb21){var _0x4ed521={};var _0x382ac4={};var _0x71384c;var _0xacaf15;return db[_0x1abb('0x44')][_0x1abb('0x69')]({'where':{'id':_0xf72761['params']['id']}})[_0x1abb('0x23')](handleEntityNotFound(_0xc371c0,null))['then'](function(_0x445191){if(_0x445191){_0x71384c=_0x445191;_0x382ac4['model']=_[_0x1abb('0x4a')](db[_0x1abb('0xab')]['rawAttributes']);_0x382ac4['query']=_[_0x1abb('0x4a')](_0xf72761[_0x1abb('0x49')]);_0x382ac4['filters']=_['intersection'](_0x382ac4[_0x1abb('0x48')],_0x382ac4['query']);_0x4ed521[_0x1abb('0x4e')]=_['intersection'](_0x382ac4[_0x1abb('0x48')],qs['fields'](_0xf72761['query']['fields']));_0x4ed521[_0x1abb('0x4e')]=_0x4ed521['attributes'][_0x1abb('0x4f')]?_0x4ed521[_0x1abb('0x4e')]:_0x382ac4['model'];_0x4ed521[_0x1abb('0x51')]=qs[_0x1abb('0x52')](_0xf72761[_0x1abb('0x49')][_0x1abb('0x52')]);_0x4ed521[_0x1abb('0x54')]=qs['filters'](_[_0x1abb('0x6a')](_0xf72761['query'],_0x382ac4['filters']));if(_0xf72761['query'][_0x1abb('0x53')]){_0x4ed521[_0x1abb('0x54')]=_[_0x1abb('0x55')](_0x4ed521['where'],{'$or':_[_0x1abb('0x43')](_0x4ed521[_0x1abb('0x4e')],function(_0x47481c){var _0xcea61b={};_0xcea61b[_0x47481c]={'$like':'%'+_0xf72761[_0x1abb('0x49')][_0x1abb('0x53')]+'%'};return _0xcea61b;})});}_0x4ed521=_[_0x1abb('0x55')]({},_0x4ed521,_0xf72761[_0x1abb('0x56')]);return _0x71384c[_0x1abb('0xe4')](_0x4ed521);}})[_0x1abb('0x23')](function(_0x1585f0){if(_0x1585f0){_0xacaf15=_0x1585f0['length'];if(!_0xf72761[_0x1abb('0x49')][_0x1abb('0x6e')](_0x1abb('0x50'))){_0x4ed521[_0x1abb('0x34')]=qs[_0x1abb('0x34')](_0xf72761[_0x1abb('0x49')][_0x1abb('0x34')]);_0x4ed521[_0x1abb('0x33')]=qs[_0x1abb('0x33')](_0xf72761[_0x1abb('0x49')][_0x1abb('0x33')]);}return _0x71384c['getAgents'](_0x4ed521);}})['then'](function(_0x312a8b){if(_0x312a8b){return _0x312a8b?{'count':_0xacaf15,'rows':_0x312a8b}:null;}})[_0x1abb('0x23')](respondWithResult(_0xc371c0,null))[_0x1abb('0x2e')](handleError(_0xc371c0,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 23825ba..8339570 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 _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 +var _0x6ebf=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x6ebf,0x1cf));var _0xf6eb=function(_0x200aa5,_0x197802){_0x200aa5=_0x200aa5-0x0;var _0x458200=_0x6ebf[_0x200aa5];return _0x458200;};'use strict';var EventEmitter=require(_0xf6eb('0x0'));var SmsAccount=require(_0xf6eb('0x1'))['db'][_0xf6eb('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xf6eb('0x3')](0x0);var events={'afterCreate':_0xf6eb('0x4'),'afterUpdate':_0xf6eb('0x5'),'afterDestroy':_0xf6eb('0x6')};function emitEvent(_0x23698f){return function(_0x58068a,_0x48026c,_0x13eb84){SmsAccountEvents[_0xf6eb('0x7')](_0x23698f+':'+_0x58068a['id'],_0x58068a);SmsAccountEvents[_0xf6eb('0x7')](_0x23698f,_0x58068a);_0x13eb84(null);};}for(var e in events){if(events[_0xf6eb('0x8')](e)){var event=events[e];SmsAccount[_0xf6eb('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 4f0d0a8..9602344 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 _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 +var _0xda02=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xda02,0x1bc));var _0x2da0=function(_0x2a6754,_0x277259){_0x2a6754=_0x2a6754-0x0;var _0x17feda=_0xda02[_0x2a6754];return _0x17feda;};'use strict';var _=require(_0x2da0('0x0'));var util=require(_0x2da0('0x1'));var logger=require(_0x2da0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2da0('0x3'));var fs=require('fs');var path=require(_0x2da0('0x4'));var rimraf=require(_0x2da0('0x5'));var config=require(_0x2da0('0x6'));var attributes=require(_0x2da0('0x7'));module[_0x2da0('0x8')]=function(_0x1b6be3,_0x1de896){return _0x1b6be3[_0x2da0('0x9')](_0x2da0('0xa'),attributes,{'tableName':_0x2da0('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 13a000d..3b614ef 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 _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 +var _0x9cef=['request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','catch','SmsAccount','find','raw','options','where','attributes','include','map','model','ShowSmsAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x110b7f,_0x46ee56){var _0xa55646=function(_0x530391){while(--_0x530391){_0x110b7f['push'](_0x110b7f['shift']());}};_0xa55646(++_0x46ee56);}(_0x9cef,0x164));var _0xf9ce=function(_0x40bc32,_0x428c83){_0x40bc32=_0x40bc32-0x0;var _0x2351e3=_0x9cef[_0x40bc32];return _0x2351e3;};'use strict';var _=require(_0xf9ce('0x0'));var util=require('util');var moment=require(_0xf9ce('0x1'));var BPromise=require(_0xf9ce('0x2'));var rs=require(_0xf9ce('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9ce('0x4'))['db'];var utils=require(_0xf9ce('0x5'));var logger=require(_0xf9ce('0x6'))(_0xf9ce('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf9ce('0x8')][_0xf9ce('0x9')]({'port':0x232a});config[_0xf9ce('0xa')]=_[_0xf9ce('0xb')](config[_0xf9ce('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf9ce('0xc'))(new Redis(config[_0xf9ce('0xa')]));require('./smsAccount.socket')[_0xf9ce('0xd')](socket);function respondWithRpcPromise(_0x77eb0d,_0x5c366c,_0xae6a17){return new BPromise(function(_0x5a2d5c,_0x4a77d3){return client[_0xf9ce('0xe')](_0x77eb0d,_0xae6a17)[_0xf9ce('0xf')](function(_0x1a7f15){logger[_0xf9ce('0x10')](_0xf9ce('0x11'),_0x5c366c,_0xf9ce('0x12'));logger[_0xf9ce('0x13')](_0xf9ce('0x14'),_0x5c366c,_0xf9ce('0x12'),JSON['stringify'](_0x1a7f15));if(_0x1a7f15[_0xf9ce('0x15')]){if(_0x1a7f15[_0xf9ce('0x15')]['code']===0x1f4){logger[_0xf9ce('0x15')]('SmsAccount,\x20%s,\x20%s',_0x5c366c,_0x1a7f15[_0xf9ce('0x15')][_0xf9ce('0x16')]);return _0x4a77d3(_0x1a7f15['error'][_0xf9ce('0x16')]);}logger[_0xf9ce('0x15')](_0xf9ce('0x11'),_0x5c366c,_0x1a7f15['error']['message']);return _0x5a2d5c(_0x1a7f15['error'][_0xf9ce('0x16')]);}else{logger[_0xf9ce('0x10')](_0xf9ce('0x11'),_0x5c366c,_0xf9ce('0x12'));_0x5a2d5c(_0x1a7f15['result'][_0xf9ce('0x16')]);}})[_0xf9ce('0x17')](function(_0x2d86ad){logger[_0xf9ce('0x15')](_0xf9ce('0x11'),_0x5c366c,_0x2d86ad);_0x4a77d3(_0x2d86ad);});});}exports['ShowSmsAccount']=function(_0x11d2db){var _0x23a73e=this;return new Promise(function(_0x2f661d,_0x59acfc){return db[_0xf9ce('0x18')][_0xf9ce('0x19')]({'raw':_0x11d2db['options']?_0x11d2db['options'][_0xf9ce('0x1a')]===undefined?!![]:![]:!![],'where':_0x11d2db[_0xf9ce('0x1b')]?_0x11d2db['options'][_0xf9ce('0x1c')]||null:null,'attributes':_0x11d2db[_0xf9ce('0x1b')]?_0x11d2db['options'][_0xf9ce('0x1d')]||null:null,'include':_0x11d2db[_0xf9ce('0x1b')]?_0x11d2db[_0xf9ce('0x1b')][_0xf9ce('0x1e')]?_[_0xf9ce('0x1f')](_0x11d2db[_0xf9ce('0x1b')][_0xf9ce('0x1e')],function(_0xf6062c){return{'model':db[_0xf6062c[_0xf9ce('0x20')]],'as':_0xf6062c['as'],'attributes':_0xf6062c[_0xf9ce('0x1d')],'include':_0xf6062c[_0xf9ce('0x1e')]?_['map'](_0xf6062c['include'],function(_0x39bfa2){return{'model':db[_0x39bfa2[_0xf9ce('0x20')]],'as':_0x39bfa2['as'],'attributes':_0x39bfa2['attributes'],'include':_0x39bfa2[_0xf9ce('0x1e')]?_[_0xf9ce('0x1f')](_0x39bfa2['include'],function(_0x408de0){return{'model':db[_0x408de0[_0xf9ce('0x20')]],'as':_0x408de0['as'],'attributes':_0x408de0['attributes']};}):[]};}):[]};}):[]:[]})[_0xf9ce('0xf')](function(_0x664b0c){logger[_0xf9ce('0x10')](_0xf9ce('0x21'),_0x11d2db);logger['debug'](_0xf9ce('0x21'),_0x11d2db,JSON['stringify'](_0x664b0c));_0x2f661d(_0x664b0c);})['catch'](function(_0x3e998e){logger[_0xf9ce('0x15')](_0xf9ce('0x21'),_0x3e998e['message'],_0x11d2db);_0x59acfc(_0x23a73e[_0xf9ce('0x15')](0x1f4,_0x3e998e[_0xf9ce('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index c65c0bc..a5c8934 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 _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 +var _0xeee9=['register','length','smsAccount:','save','remove','update','emit'];(function(_0x2ce370,_0x491031){var _0x2ff1e9=function(_0x38853d){while(--_0x38853d){_0x2ce370['push'](_0x2ce370['shift']());}};_0x2ff1e9(++_0x491031);}(_0xeee9,0x153));var _0x9eee=function(_0x174342,_0xf5b3d6){_0x174342=_0x174342-0x0;var _0x3073a9=_0xeee9[_0x174342];return _0x3073a9;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x9eee('0x0'),_0x9eee('0x1'),_0x9eee('0x2')];function createListener(_0x947624,_0x3cd318){return function(_0x214abc){_0x3cd318[_0x9eee('0x3')](_0x947624,_0x214abc);};}function removeListener(_0x43a2c7,_0x22aba8){return function(){SmsAccountEvents['removeListener'](_0x43a2c7,_0x22aba8);};}exports[_0x9eee('0x4')]=function(_0x10e278){for(var _0x39e1d5=0x0,_0x37a570=events[_0x9eee('0x5')];_0x39e1d5<_0x37a570;_0x39e1d5++){var _0x5aa5b4=events[_0x39e1d5];var _0x44c3c3=createListener(_0x9eee('0x6')+_0x5aa5b4,_0x10e278);SmsAccountEvents['on'](_0x5aa5b4,_0x44c3c3);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 182f31e..cb85a78 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 _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 +var _0x946a=['isAuthenticated','index','show','post','create','put','delete','/:id','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./smsApplication.controller','get'];(function(_0x437e91,_0x149689){var _0x5d37eb=function(_0x47538c){while(--_0x47538c){_0x437e91['push'](_0x437e91['shift']());}};_0x5d37eb(++_0x149689);}(_0x946a,0xe6));var _0xa946=function(_0x1ce997,_0x4cb43f){_0x1ce997=_0x1ce997-0x0;var _0x510cc4=_0x946a[_0x1ce997];return _0x510cc4;};'use strict';var multer=require('multer');var util=require(_0xa946('0x0'));var path=require(_0xa946('0x1'));var timeout=require(_0xa946('0x2'));var express=require(_0xa946('0x3'));var router=express[_0xa946('0x4')]();var auth=require(_0xa946('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa946('0x6'));router[_0xa946('0x7')]('/',auth[_0xa946('0x8')](),controller[_0xa946('0x9')]);router['get']('/:id',auth[_0xa946('0x8')](),controller[_0xa946('0xa')]);router[_0xa946('0xb')]('/',auth[_0xa946('0x8')](),controller[_0xa946('0xc')]);router[_0xa946('0xd')]('/:id',auth[_0xa946('0x8')](),controller['update']);router[_0xa946('0xe')](_0xa946('0xf'),auth[_0xa946('0x8')](),controller['destroy']);module[_0xa946('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 6af411b..c680b31 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 _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 +var _0x04c4=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x04c4,0xa5));var _0x404c=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x04c4[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x404c('0x0'));module[_0x404c('0x1')]={'priority':{'type':Sequelize[_0x404c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x404c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x404c('0x4')]()},'description':{'type':Sequelize[_0x404c('0x3')]},'interval':{'type':Sequelize[_0x404c('0x3')],'defaultValue':_0x404c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 246600e..c8bb96c 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 _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 +var _0x92f0=['key','model','query','filters','intersection','attributes','nolimit','sort','where','pick','merge','VIRTUAL','options','SmsApplication','includeAll','include','findAll','show','keys','fields','length','find','catch','create','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','stack','name','fieldName','type'];(function(_0x46a671,_0x758e9a){var _0x526d75=function(_0xde3640){while(--_0xde3640){_0x46a671['push'](_0x46a671['shift']());}};_0x526d75(++_0x758e9a);}(_0x92f0,0xa0));var _0x092f=function(_0xdd2348,_0x5d3232){_0xdd2348=_0xdd2348-0x0;var _0x2e0a02=_0x92f0[_0xdd2348];return _0x2e0a02;};'use strict';var pdf=require(_0x092f('0x0'));var emlformat=require(_0x092f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x092f('0x2'));var jsonpatch=require(_0x092f('0x3'));var rp=require(_0x092f('0x4'));var moment=require(_0x092f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x092f('0x6'));var util=require('util');var path=require('path');var sox=require(_0x092f('0x7'));var csv=require(_0x092f('0x8'));var ejs=require(_0x092f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x092f('0xa'));var crypto=require('crypto');var jsforce=require(_0x092f('0xb'));var deskjs=require(_0x092f('0xc'));var toCsv=require(_0x092f('0x8'));var querystring=require(_0x092f('0xd'));var Papa=require(_0x092f('0xe'));var Redis=require(_0x092f('0xf'));var authService=require(_0x092f('0x10'));var qs=require(_0x092f('0x11'));var as=require(_0x092f('0x12'));var hardwareService=require(_0x092f('0x13'));var logger=require(_0x092f('0x14'))(_0x092f('0x15'));var utils=require('../../config/utils');var config=require(_0x092f('0x16'));var licenseUtil=require(_0x092f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15aaa2,_0x1e0709){_0x1e0709=_0x1e0709||0xcc;return function(_0x27e022){if(_0x27e022){return _0x15aaa2[_0x092f('0x18')](_0x1e0709);}return _0x15aaa2[_0x092f('0x19')](_0x1e0709)[_0x092f('0x1a')]();};}function respondWithResult(_0x363eeb,_0x31fd60){_0x31fd60=_0x31fd60||0xc8;return function(_0xda9bfa){if(_0xda9bfa){return _0x363eeb[_0x092f('0x19')](_0x31fd60)[_0x092f('0x1b')](_0xda9bfa);}};}function respondWithFilteredResult(_0x321ed1,_0x29373e){return function(_0x3d3a90){if(_0x3d3a90){var _0xe9ff=_0x3d3a90[_0x092f('0x1c')],_0x56ed58=_0x29373e[_0x092f('0x1d')],_0x47a2ab=_0x29373e[_0x092f('0x1d')]+_0x29373e[_0x092f('0x1e')],_0x4f6ece;if(_0x47a2ab>=_0xe9ff){_0x47a2ab=_0xe9ff;_0x4f6ece=0xc8;}else{_0x4f6ece=0xce;}_0x321ed1['status'](_0x4f6ece);return _0x321ed1[_0x092f('0x1f')]('Content-Range',_0x56ed58+'-'+_0x47a2ab+'/'+_0xe9ff)[_0x092f('0x1b')](_0x3d3a90);}return null;};}function patchUpdates(_0xe2db98){return function(_0x5709a4){try{jsonpatch[_0x092f('0x20')](_0x5709a4,_0xe2db98,!![]);}catch(_0x4aca0d){return BPromise[_0x092f('0x21')](_0x4aca0d);}return _0x5709a4['save']();};}function saveUpdates(_0x3f7ed0,_0x1ce400){return function(_0x2c7532){if(_0x2c7532){return _0x2c7532[_0x092f('0x22')](_0x3f7ed0)[_0x092f('0x23')](function(_0x34a301){return _0x34a301;});}return null;};}function removeEntity(_0x5773b5,_0x51d7c2){return function(_0x440080){if(_0x440080){return _0x440080[_0x092f('0x24')]()[_0x092f('0x23')](function(){_0x5773b5['status'](0xcc)[_0x092f('0x1a')]();});}};}function handleEntityNotFound(_0x20283b,_0x5b3bf7){return function(_0x38d811){if(!_0x38d811){_0x20283b['sendStatus'](0x194);}return _0x38d811;};}function handleError(_0x5a5b6a,_0x169a44){_0x169a44=_0x169a44||0x1f4;return function(_0xded315){logger['error'](_0xded315[_0x092f('0x25')]);if(_0xded315[_0x092f('0x26')]){delete _0xded315['name'];}_0x5a5b6a[_0x092f('0x19')](_0x169a44)['send'](_0xded315);};}exports['index']=function(_0x2cc00c,_0x239da0){var _0x284138={},_0x4a3bc8={},_0x559ceb={'count':0x0,'rows':[]};var _0x5f0be5=_['map'](db['SmsApplication']['rawAttributes'],function(_0x3af6ce){return{'name':_0x3af6ce[_0x092f('0x27')],'type':_0x3af6ce[_0x092f('0x28')][_0x092f('0x29')]};});_0x4a3bc8[_0x092f('0x2a')]=_['map'](_0x5f0be5,_0x092f('0x26'));_0x4a3bc8[_0x092f('0x2b')]=_['keys'](_0x2cc00c[_0x092f('0x2b')]);_0x4a3bc8[_0x092f('0x2c')]=_[_0x092f('0x2d')](_0x4a3bc8['model'],_0x4a3bc8[_0x092f('0x2b')]);_0x284138[_0x092f('0x2e')]=_[_0x092f('0x2d')](_0x4a3bc8['model'],qs['fields'](_0x2cc00c[_0x092f('0x2b')]['fields']));_0x284138['attributes']=_0x284138['attributes']['length']?_0x284138[_0x092f('0x2e')]:_0x4a3bc8['model'];if(!_0x2cc00c[_0x092f('0x2b')]['hasOwnProperty'](_0x092f('0x2f'))){_0x284138['limit']=qs[_0x092f('0x1e')](_0x2cc00c[_0x092f('0x2b')][_0x092f('0x1e')]);_0x284138[_0x092f('0x1d')]=qs['offset'](_0x2cc00c[_0x092f('0x2b')][_0x092f('0x1d')]);}_0x284138['order']=qs[_0x092f('0x30')](_0x2cc00c['query']['sort']);_0x284138[_0x092f('0x31')]=qs['filters'](_[_0x092f('0x32')](_0x2cc00c[_0x092f('0x2b')],_0x4a3bc8[_0x092f('0x2c')]),_0x5f0be5);if(_0x2cc00c[_0x092f('0x2b')]['filter']){_0x284138[_0x092f('0x31')]=_[_0x092f('0x33')](_0x284138[_0x092f('0x31')],{'$or':_['map'](_0x5f0be5,function(_0x430038){if(_0x430038[_0x092f('0x28')]!==_0x092f('0x34')){var _0x26e073={};_0x26e073[_0x430038[_0x092f('0x26')]]={'$like':'%'+_0x2cc00c[_0x092f('0x2b')]['filter']+'%'};return _0x26e073;}})});}_0x284138=_[_0x092f('0x33')]({},_0x284138,_0x2cc00c[_0x092f('0x35')]);var _0x40606e={'where':_0x284138[_0x092f('0x31')]};return db[_0x092f('0x36')][_0x092f('0x1c')](_0x40606e)['then'](function(_0x2b438d){_0x559ceb[_0x092f('0x1c')]=_0x2b438d;if(_0x2cc00c[_0x092f('0x2b')][_0x092f('0x37')]){_0x284138[_0x092f('0x38')]=[{'all':!![]}];}return db[_0x092f('0x36')][_0x092f('0x39')](_0x284138);})[_0x092f('0x23')](function(_0x287a02){_0x559ceb['rows']=_0x287a02;return _0x559ceb;})[_0x092f('0x23')](respondWithFilteredResult(_0x239da0,_0x284138))['catch'](handleError(_0x239da0,null));};exports[_0x092f('0x3a')]=function(_0x421854,_0x5e45cd){var _0x298ec0={'raw':!![],'where':{'id':_0x421854['params']['id']}},_0x42e9e9={};_0x42e9e9[_0x092f('0x2a')]=_[_0x092f('0x3b')](db[_0x092f('0x36')]['rawAttributes']);_0x42e9e9[_0x092f('0x2b')]=_[_0x092f('0x3b')](_0x421854[_0x092f('0x2b')]);_0x42e9e9[_0x092f('0x2c')]=_[_0x092f('0x2d')](_0x42e9e9['model'],_0x42e9e9[_0x092f('0x2b')]);_0x298ec0[_0x092f('0x2e')]=_[_0x092f('0x2d')](_0x42e9e9[_0x092f('0x2a')],qs[_0x092f('0x3c')](_0x421854[_0x092f('0x2b')][_0x092f('0x3c')]));_0x298ec0[_0x092f('0x2e')]=_0x298ec0[_0x092f('0x2e')][_0x092f('0x3d')]?_0x298ec0[_0x092f('0x2e')]:_0x42e9e9[_0x092f('0x2a')];if(_0x421854[_0x092f('0x2b')][_0x092f('0x37')]){_0x298ec0[_0x092f('0x38')]=[{'all':!![]}];}_0x298ec0=_[_0x092f('0x33')]({},_0x298ec0,_0x421854[_0x092f('0x35')]);return db['SmsApplication'][_0x092f('0x3e')](_0x298ec0)[_0x092f('0x23')](handleEntityNotFound(_0x5e45cd,null))[_0x092f('0x23')](respondWithResult(_0x5e45cd,null))[_0x092f('0x3f')](handleError(_0x5e45cd,null));};exports[_0x092f('0x40')]=function(_0x15d675,_0x707421){return db[_0x092f('0x36')][_0x092f('0x40')](_0x15d675[_0x092f('0x41')],{})[_0x092f('0x23')](respondWithResult(_0x707421,0xc9))[_0x092f('0x3f')](handleError(_0x707421,null));};exports[_0x092f('0x22')]=function(_0x10c71d,_0x3995df){if(_0x10c71d['body']['id']){delete _0x10c71d[_0x092f('0x41')]['id'];}return db[_0x092f('0x36')][_0x092f('0x3e')]({'where':{'id':_0x10c71d['params']['id']}})[_0x092f('0x23')](handleEntityNotFound(_0x3995df,null))[_0x092f('0x23')](saveUpdates(_0x10c71d['body'],null))[_0x092f('0x23')](respondWithResult(_0x3995df,null))['catch'](handleError(_0x3995df,null));};exports[_0x092f('0x24')]=function(_0x2ad41c,_0x106789){return db['SmsApplication'][_0x092f('0x3e')]({'where':{'id':_0x2ad41c[_0x092f('0x42')]['id']}})[_0x092f('0x23')](handleEntityNotFound(_0x106789,null))[_0x092f('0x23')](removeEntity(_0x106789,null))[_0x092f('0x3f')](handleError(_0x106789,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 19dba3c..5210728 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 _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 +var _0x5814=['SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./smsApplication.attributes','exports','define'];(function(_0x50c31a,_0x4494a5){var _0xa909ce=function(_0x314fca){while(--_0x314fca){_0x50c31a['push'](_0x50c31a['shift']());}};_0xa909ce(++_0x4494a5);}(_0x5814,0x189));var _0x4581=function(_0x326096,_0x4dc513){_0x326096=_0x326096-0x0;var _0x2dfa21=_0x5814[_0x326096];return _0x2dfa21;};'use strict';var _=require(_0x4581('0x0'));var util=require(_0x4581('0x1'));var logger=require(_0x4581('0x2'))(_0x4581('0x3'));var moment=require(_0x4581('0x4'));var BPromise=require('bluebird');var rp=require(_0x4581('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4581('0x6'));var config=require('../../config/environment');var attributes=require(_0x4581('0x7'));module[_0x4581('0x8')]=function(_0x8e9e7b,_0x470cf4){return _0x8e9e7b[_0x4581('0x9')](_0x4581('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4581('0xb'),'collate':_0x4581('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 25efd9e..073adff 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 _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 +var _0xad78=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x4e4bcf,_0x4a61a7){var _0x2a7593=function(_0x432c73){while(--_0x432c73){_0x4e4bcf['push'](_0x4e4bcf['shift']());}};_0x2a7593(++_0x4a61a7);}(_0xad78,0x149));var _0x8ad7=function(_0x5ae862,_0x10bad4){_0x5ae862=_0x5ae862-0x0;var _0x29849d=_0xad78[_0x5ae862];return _0x29849d;};'use strict';var _=require(_0x8ad7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8ad7('0x1'));var rs=require(_0x8ad7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ad7('0x3'))['db'];var utils=require(_0x8ad7('0x4'));var logger=require(_0x8ad7('0x5'))(_0x8ad7('0x6'));var config=require(_0x8ad7('0x7'));var jayson=require(_0x8ad7('0x8'));var client=jayson[_0x8ad7('0x9')][_0x8ad7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415e9c,_0x3daa2d,_0x49aeb1){return new BPromise(function(_0x4822d3,_0x336b3a){return client[_0x8ad7('0xb')](_0x415e9c,_0x49aeb1)[_0x8ad7('0xc')](function(_0x152b82){logger[_0x8ad7('0xd')](_0x8ad7('0xe'),_0x3daa2d,_0x8ad7('0xf'));logger['debug'](_0x8ad7('0x10'),_0x3daa2d,_0x8ad7('0xf'),JSON[_0x8ad7('0x11')](_0x152b82));if(_0x152b82['error']){if(_0x152b82[_0x8ad7('0x12')][_0x8ad7('0x13')]===0x1f4){logger[_0x8ad7('0x12')](_0x8ad7('0xe'),_0x3daa2d,_0x152b82[_0x8ad7('0x12')][_0x8ad7('0x14')]);return _0x336b3a(_0x152b82[_0x8ad7('0x12')][_0x8ad7('0x14')]);}logger[_0x8ad7('0x12')](_0x8ad7('0xe'),_0x3daa2d,_0x152b82[_0x8ad7('0x12')]['message']);return _0x4822d3(_0x152b82['error'][_0x8ad7('0x14')]);}else{logger['info'](_0x8ad7('0xe'),_0x3daa2d,_0x8ad7('0xf'));_0x4822d3(_0x152b82['result']['message']);}})[_0x8ad7('0x15')](function(_0x1607c9){logger[_0x8ad7('0x12')](_0x8ad7('0xe'),_0x3daa2d,_0x1607c9);_0x336b3a(_0x1607c9);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1c4ecf0..3c1ad67 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 _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 +var _0x4501=['getMessages','/:id/download','download','post','addMessage','sms','smsinteraction:addtags','addTags','put','tracked','update','delete','smsinteraction:destroy','destroy','/:id/tags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0x13e54f,_0x509d15){var _0x2802e3=function(_0x251aca){while(--_0x251aca){_0x13e54f['push'](_0x13e54f['shift']());}};_0x2802e3(++_0x509d15);}(_0x4501,0xe2));var _0x1450=function(_0x2390fa,_0x5768ea){_0x2390fa=_0x2390fa-0x0;var _0x4a0e0b=_0x4501[_0x2390fa];return _0x4a0e0b;};'use strict';var multer=require(_0x1450('0x0'));var util=require('util');var path=require(_0x1450('0x1'));var timeout=require(_0x1450('0x2'));var express=require(_0x1450('0x3'));var router=express[_0x1450('0x4')]();var auth=require(_0x1450('0x5'));var interaction=require(_0x1450('0x6'));var config=require('../../config/environment');var controller=require(_0x1450('0x7'));router[_0x1450('0x8')]('/',auth[_0x1450('0x9')](),controller[_0x1450('0xa')]);router['get']('/describe',auth[_0x1450('0x9')](),controller[_0x1450('0xb')]);router['get'](_0x1450('0xc'),auth[_0x1450('0x9')](),controller[_0x1450('0xd')]);router[_0x1450('0x8')]('/:id/messages',auth[_0x1450('0x9')](),controller[_0x1450('0xe')]);router[_0x1450('0x8')](_0x1450('0xf'),auth[_0x1450('0x9')](),controller[_0x1450('0x10')]);router[_0x1450('0x11')]('/',auth[_0x1450('0x9')](),controller['create']);router[_0x1450('0x11')]('/:id/messages',auth[_0x1450('0x9')](),controller[_0x1450('0x12')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0x1450('0x13'),_0x1450('0x14')),controller[_0x1450('0x15')]);router[_0x1450('0x16')]('/:id',auth[_0x1450('0x9')](),interaction[_0x1450('0x17')](_0x1450('0x13'),'smsinteraction:update'),controller[_0x1450('0x18')]);router[_0x1450('0x19')](_0x1450('0xc'),auth[_0x1450('0x9')](),interaction['tracked'](_0x1450('0x13'),_0x1450('0x1a')),controller[_0x1450('0x1b')]);router['delete'](_0x1450('0x1c'),auth[_0x1450('0x9')](),controller['removeTags']);module[_0x1450('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 6525308..e00b07d 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 _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 +var _0x94b6=['sequelize','moment','exports','BOOLEAN','STRING','DATE','ENUM','out'];(function(_0x14adb3,_0x2f07a7){var _0xdfbdfe=function(_0x3cf088){while(--_0x3cf088){_0x14adb3['push'](_0x14adb3['shift']());}};_0xdfbdfe(++_0x2f07a7);}(_0x94b6,0x120));var _0x694b=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x94b6[_0x5471ec];return _0x121d4c;};'use strict';var Sequelize=require(_0x694b('0x0'));var moment=require(_0x694b('0x1'));module[_0x694b('0x2')]={'closed':{'type':Sequelize[_0x694b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x694b('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x694b('0x4')]},'note':{'type':Sequelize[_0x694b('0x4')]},'phone':{'type':Sequelize[_0x694b('0x4')]},'read1stAt':{'type':Sequelize[_0x694b('0x5')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x694b('0x6')]('in',_0x694b('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 6656753..467c364 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(_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 +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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 7136269..2036218 100644 --- a/server/api/smsInteraction/smsInteraction.events.js +++ b/server/api/smsInteraction/smsInteraction.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb647=['save','update','getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_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 +var _0x7d9f=['emit','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','setDataValue','Users','length'];(function(_0x3c3e74,_0x3a0c56){var _0x3e1321=function(_0x3f36bc){while(--_0x3f36bc){_0x3c3e74['push'](_0x3c3e74['shift']());}};_0x3e1321(++_0x3a0c56);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x54d879,_0x35c691){_0x54d879=_0x54d879-0x0;var _0xf1c912=_0x7d9f[_0x54d879];return _0xf1c912;};'use strict';var EventEmitter=require(_0xf7d9('0x0'));var SmsInteraction=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x2')];var SmsMessage=require(_0xf7d9('0x1'))['db'][_0xf7d9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7d9('0x4'),'afterUpdate':_0xf7d9('0x5'),'afterDestroy':_0xf7d9('0x6')};function emitEvent(_0x159e95){return function(_0x23cb4c,_0x53fdaf,_0x4b50c7){_0x23cb4c[_0xf7d9('0x7')]({'attributes':['id'],'raw':!![]})[_0xf7d9('0x8')](function(_0x5772b4){_0x23cb4c[_0xf7d9('0x9')](_0xf7d9('0xa'),_0x5772b4['map'](function(_0x572d51){return{'id':_0x572d51['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x23cb4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf7d9('0x8')](function(_0x33360a){_0x23cb4c['setDataValue']('unreadMessages',_0x33360a[_0xf7d9('0xb')]);SmsInteractionEvents[_0xf7d9('0xc')](_0x159e95+':'+_0x23cb4c['id'],_0x23cb4c);SmsInteractionEvents[_0xf7d9('0xc')](_0x159e95,_0x23cb4c);_0x4b50c7(null);})['catch'](_0x4b50c7(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xf7d9('0xd')](e,emitEvent(event));}}module[_0xf7d9('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 81da02a..e4e892d 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 _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 +var _0xce56=['rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0xce56,0x135));var _0x6ce5=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xce56[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var util=require(_0x6ce5('0x0'));var logger=require('../../config/logger')(_0x6ce5('0x1'));var moment=require(_0x6ce5('0x2'));var BPromise=require(_0x6ce5('0x3'));var rp=require(_0x6ce5('0x4'));var fs=require('fs');var path=require(_0x6ce5('0x5'));var rimraf=require(_0x6ce5('0x6'));var config=require(_0x6ce5('0x7'));var attributes=require('./smsInteraction.attributes');module[_0x6ce5('0x8')]=function(_0x4210f5,_0x3ee36f){return _0x4210f5[_0x6ce5('0x9')](_0x6ce5('0xa'),attributes,{'tableName':_0x6ce5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1f922a,_0x25faaf,_0x505227){if(_0x1f922a['changed'](_0x6ce5('0xc'))){_0x1f922a['closedAt']=moment()[_0x6ce5('0xd')](_0x6ce5('0xe'));}_0x505227(null,_0x1f922a);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 730da36..76d09bd 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 _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 +var _0xc697=['../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x229bd3,_0x37a6d8){var _0xaac7da=function(_0x5386d4){while(--_0x5386d4){_0x229bd3['push'](_0x229bd3['shift']());}};_0xaac7da(++_0x37a6d8);}(_0xc697,0xd6));var _0x7c69=function(_0x2ce2b3,_0x272f46){_0x2ce2b3=_0x2ce2b3-0x0;var _0x2e9e2d=_0xc697[_0x2ce2b3];return _0x2e9e2d;};'use strict';var _=require('lodash');var util=require(_0x7c69('0x0'));var moment=require(_0x7c69('0x1'));var BPromise=require(_0x7c69('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c69('0x3'))['db'];var utils=require(_0x7c69('0x4'));var logger=require(_0x7c69('0x5'))('rpc');var config=require(_0x7c69('0x6'));var jayson=require(_0x7c69('0x7'));var client=jayson[_0x7c69('0x8')][_0x7c69('0x9')]({'port':0x232a});config['redis']=_[_0x7c69('0xa')](config[_0x7c69('0xb')],{'host':_0x7c69('0xc'),'port':0x18eb});var socket=require(_0x7c69('0xd'))(new Redis(config['redis']));require(_0x7c69('0xe'))[_0x7c69('0xf')](socket);function respondWithRpcPromise(_0x11ccde,_0x2f774a,_0x4cc4e0){return new BPromise(function(_0x1e2961,_0x5e4449){return client[_0x7c69('0x10')](_0x11ccde,_0x4cc4e0)[_0x7c69('0x11')](function(_0xc52585){logger[_0x7c69('0x12')](_0x7c69('0x13'),_0x2f774a,_0x7c69('0x14'));logger[_0x7c69('0x15')](_0x7c69('0x16'),_0x2f774a,_0x7c69('0x14'),JSON[_0x7c69('0x17')](_0xc52585));if(_0xc52585['error']){if(_0xc52585[_0x7c69('0x18')][_0x7c69('0x19')]===0x1f4){logger[_0x7c69('0x18')](_0x7c69('0x13'),_0x2f774a,_0xc52585[_0x7c69('0x18')][_0x7c69('0x1a')]);return _0x5e4449(_0xc52585[_0x7c69('0x18')][_0x7c69('0x1a')]);}logger[_0x7c69('0x18')](_0x7c69('0x13'),_0x2f774a,_0xc52585['error'][_0x7c69('0x1a')]);return _0x1e2961(_0xc52585[_0x7c69('0x18')]['message']);}else{logger[_0x7c69('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x2f774a,_0x7c69('0x14'));_0x1e2961(_0xc52585[_0x7c69('0x1b')][_0x7c69('0x1a')]);}})[_0x7c69('0x1c')](function(_0x12f5cd){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2f774a,_0x12f5cd);_0x5e4449(_0x12f5cd);});});}exports[_0x7c69('0x1d')]=function(_0x2e6bbd){var _0x1c7e3a=this;return new Promise(function(_0x10d6a2,_0x28bac7){return db['SmsInteraction'][_0x7c69('0x1e')](_0x2e6bbd['body'],{'raw':_0x2e6bbd[_0x7c69('0x1f')]?_0x2e6bbd[_0x7c69('0x1f')][_0x7c69('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e6bbd[_0x7c69('0x1f')]?_0x2e6bbd[_0x7c69('0x1f')][_0x7c69('0x21')]||null:null,'attributes':_0x2e6bbd[_0x7c69('0x1f')]?_0x2e6bbd[_0x7c69('0x1f')][_0x7c69('0x22')]||null:null,'limit':_0x2e6bbd[_0x7c69('0x1f')]?_0x2e6bbd['options'][_0x7c69('0x23')]||null:null})[_0x7c69('0x11')](function(_0x393613){logger[_0x7c69('0x12')](_0x7c69('0x1d'),_0x2e6bbd);logger['debug']('UpdateSmsInteraction',_0x2e6bbd,JSON['stringify'](_0x393613));_0x10d6a2(_0x393613);})[_0x7c69('0x1c')](function(_0x1ccf9d){logger[_0x7c69('0x18')](_0x7c69('0x1d'),_0x1ccf9d[_0x7c69('0x1a')],_0x2e6bbd);_0x28bac7(_0x1c7e3a[_0x7c69('0x18')](0x1f4,_0x1ccf9d[_0x7c69('0x1a')]));});});};exports[_0x7c69('0x24')]=function(_0x5be2d0){return new Promise(function(_0x7d6a0e,_0x4d4883){return db[_0x7c69('0x25')][_0x7c69('0x26')]({'where':_0x5be2d0['options']?_0x5be2d0[_0x7c69('0x1f')][_0x7c69('0x21')]||null:null})[_0x7c69('0x11')](function(_0x59873c){if(_0x59873c){return _0x59873c[_0x7c69('0x27')](_0x5be2d0['body'][_0x7c69('0x28')],_[_0x7c69('0x29')](_0x5be2d0['body'],[_0x7c69('0x28'),'id'])||{});}})[_0x7c69('0x2a')](function(_0x8f976f){logger[_0x7c69('0x12')]('AddTags',_0x5be2d0);logger[_0x7c69('0x15')](_0x7c69('0x2b'),_0x5be2d0,JSON[_0x7c69('0x17')](_0x8f976f));_0x7d6a0e(_0x8f976f);})[_0x7c69('0x1c')](function(_0x2d520a){logger[_0x7c69('0x18')](_0x7c69('0x2b'),_0x2d520a['message'],_0x5be2d0);_0x4d4883(_this[_0x7c69('0x18')](0x1f4,_0x2d520a[_0x7c69('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 9b2c95d..bba5cd0 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 _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 +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x8267aa,_0x496ef0){var _0x2a437f=function(_0x447f72){while(--_0x447f72){_0x8267aa['push'](_0x8267aa['shift']());}};_0x2a437f(++_0x496ef0);}(_0xb10b,0x12a));var _0xbb10=function(_0x245d76,_0x1c2c6f){_0x245d76=_0x245d76-0x0;var _0x4516f7=_0xb10b[_0x245d76];return _0x4516f7;};'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 2a6b563..48d9e84 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 _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 +var _0x3a45=['/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','sms','smsmessage:create','create'];(function(_0xb88ae2,_0x3c1f03){var _0x7d273a=function(_0x9e83d2){while(--_0x9e83d2){_0xb88ae2['push'](_0xb88ae2['shift']());}};_0x7d273a(++_0x3c1f03);}(_0x3a45,0x175));var _0x53a4=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x3a45[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x53a4('0x0'));var util=require(_0x53a4('0x1'));var path=require('path');var timeout=require(_0x53a4('0x2'));var express=require(_0x53a4('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x53a4('0x4'));var config=require(_0x53a4('0x5'));var controller=require(_0x53a4('0x6'));router['get']('/',auth[_0x53a4('0x7')](),controller[_0x53a4('0x8')]);router['get'](_0x53a4('0x9'),auth[_0x53a4('0x7')](),controller[_0x53a4('0xa')]);router[_0x53a4('0xb')](_0x53a4('0xc'),auth[_0x53a4('0x7')](),controller[_0x53a4('0xd')]);router[_0x53a4('0xe')]('/',auth[_0x53a4('0x7')](),interaction[_0x53a4('0xf')](_0x53a4('0x10'),_0x53a4('0x11')),controller[_0x53a4('0x12')]);router[_0x53a4('0xe')](_0x53a4('0x13'),controller[_0x53a4('0x14')]);router['put'](_0x53a4('0xc'),auth[_0x53a4('0x7')](),controller[_0x53a4('0x15')]);router[_0x53a4('0x16')](_0x53a4('0x17'),auth[_0x53a4('0x7')](),controller[_0x53a4('0x18')]);router[_0x53a4('0x16')](_0x53a4('0x19'),auth[_0x53a4('0x7')](),controller[_0x53a4('0x1a')]);router['delete'](_0x53a4('0xc'),auth[_0x53a4('0x7')](),controller[_0x53a4('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 35bc9e9..ccd73fe 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 _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 +var _0x2104=['BOOLEAN','ENUM','out','STRING','exports','TEXT'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x2104,0x88));var _0x4210=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x2104[_0x124298];return _0x35ac24;};'use strict';var Sequelize=require('sequelize');module[_0x4210('0x0')]={'body':{'type':Sequelize[_0x4210('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x4210('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4210('0x3')]('in',_0x4210('0x4')),'defaultValue':_0x4210('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4210('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x4210('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4210('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 43785d0..89c1d5b 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 _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 +var _0x3f80=['request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','offset','limit','set','Content-Range','json','reject','save','then','stack','name','index','map','SmsMessage','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','params','rawAttributes','create','body','update','find','describe','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','SmsInteraction','SmsInteractionId','isNil','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','acceptMessage','manual','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','sent','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','info','SmsMessage,\x20%s,\x20%s'];(function(_0x240ed8,_0x5875f0){var _0x6e1098=function(_0x41f31d){while(--_0x41f31d){_0x240ed8['push'](_0x240ed8['shift']());}};_0x6e1098(++_0x5875f0);}(_0x3f80,0x67));var _0x03f8=function(_0x2d626f,_0x4f5915){_0x2d626f=_0x2d626f-0x0;var _0x49ad89=_0x3f80[_0x2d626f];return _0x49ad89;};'use strict';var pdf=require(_0x03f8('0x0'));var emlformat=require(_0x03f8('0x1'));var rimraf=require(_0x03f8('0x2'));var zipdir=require(_0x03f8('0x3'));var jsonpatch=require(_0x03f8('0x4'));var rp=require(_0x03f8('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x03f8('0x6'));var util=require(_0x03f8('0x7'));var path=require(_0x03f8('0x8'));var sox=require('sox');var csv=require(_0x03f8('0x9'));var ejs=require(_0x03f8('0xa'));var fs=require('fs');var _=require(_0x03f8('0xb'));var squel=require(_0x03f8('0xc'));var crypto=require(_0x03f8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x03f8('0x9'));var querystring=require(_0x03f8('0xe'));var Papa=require(_0x03f8('0xf'));var Redis=require('ioredis');var authService=require(_0x03f8('0x10'));var qs=require(_0x03f8('0x11'));var as=require(_0x03f8('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03f8('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x03f8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x03f8('0x15'))['db'];config['redis']=_[_0x03f8('0x16')](config[_0x03f8('0x17')],{'host':_0x03f8('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x03f8('0x17')]));require(_0x03f8('0x19'))[_0x03f8('0x1a')](socket);var jayson=require(_0x03f8('0x1b'));var client=jayson[_0x03f8('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0x03f8('0x1c')][_0x03f8('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1f355e,_0x966d9c,_0x43f44d,_0x2c2bb8){return new BPromise(function(_0x36c87c,_0x383fdc){var _0x1fa855=_0x2c2bb8||client;return _0x1fa855['request'](_0x1f355e,_0x43f44d)['then'](function(_0x2bafb1){logger[_0x03f8('0x1e')](_0x03f8('0x1f'),_0x966d9c,_0x03f8('0x20'));logger[_0x03f8('0x21')](_0x03f8('0x22'),_0x966d9c,_0x03f8('0x20'),JSON['stringify'](_0x2bafb1));if(_0x2bafb1[_0x03f8('0x23')]){if(_0x2bafb1[_0x03f8('0x23')][_0x03f8('0x24')]===0x1f4){logger[_0x03f8('0x23')](_0x03f8('0x1f'),_0x966d9c,_0x2bafb1[_0x03f8('0x23')][_0x03f8('0x25')]);return _0x383fdc(_0x2bafb1[_0x03f8('0x23')][_0x03f8('0x25')]);}logger[_0x03f8('0x23')](_0x03f8('0x1f'),_0x966d9c,_0x2bafb1[_0x03f8('0x23')][_0x03f8('0x25')]);return _0x36c87c(_0x2bafb1[_0x03f8('0x23')]['message']);}else{logger[_0x03f8('0x1e')](_0x03f8('0x1f'),_0x966d9c,_0x03f8('0x20'));_0x36c87c(_0x2bafb1[_0x03f8('0x26')][_0x03f8('0x25')]);}})[_0x03f8('0x27')](function(_0x442a1d){logger[_0x03f8('0x23')](_0x03f8('0x1f'),_0x966d9c,_0x442a1d);_0x383fdc(_0x442a1d);});});}function respondWithStatusCode(_0x29da20,_0x2c0774){_0x2c0774=_0x2c0774||0xcc;return function(_0x44e0f6){if(_0x44e0f6){return _0x29da20[_0x03f8('0x28')](_0x2c0774);}return _0x29da20[_0x03f8('0x29')](_0x2c0774)['end']();};}function respondWithResult(_0x3e48f6,_0x497cee){_0x497cee=_0x497cee||0xc8;return function(_0x32014d){if(_0x32014d){return _0x3e48f6[_0x03f8('0x29')](_0x497cee)['json'](_0x32014d);}};}function respondWithFilteredResult(_0x3f30d3,_0x43a105){return function(_0x4521a6){if(_0x4521a6){var _0x590787=_0x4521a6['count'],_0x42bc58=_0x43a105[_0x03f8('0x2a')],_0x33b09d=_0x43a105[_0x03f8('0x2a')]+_0x43a105[_0x03f8('0x2b')],_0x596403;if(_0x33b09d>=_0x590787){_0x33b09d=_0x590787;_0x596403=0xc8;}else{_0x596403=0xce;}_0x3f30d3['status'](_0x596403);return _0x3f30d3[_0x03f8('0x2c')](_0x03f8('0x2d'),_0x42bc58+'-'+_0x33b09d+'/'+_0x590787)[_0x03f8('0x2e')](_0x4521a6);}return null;};}function patchUpdates(_0x31b986){return function(_0x8d51b7){try{jsonpatch['apply'](_0x8d51b7,_0x31b986,!![]);}catch(_0x261cfa){return BPromise[_0x03f8('0x2f')](_0x261cfa);}return _0x8d51b7[_0x03f8('0x30')]();};}function saveUpdates(_0x5e5d71,_0x27fc74){return function(_0x1d2a6b){if(_0x1d2a6b){return _0x1d2a6b['update'](_0x5e5d71)[_0x03f8('0x31')](function(_0x4eca6f){return _0x4eca6f;});}return null;};}function removeEntity(_0x5ad687,_0x3d1017){return function(_0x2f4258){if(_0x2f4258){return _0x2f4258['destroy']()[_0x03f8('0x31')](function(){_0x5ad687['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11415e,_0x4d2bc5){return function(_0x2b8399){if(!_0x2b8399){_0x11415e['sendStatus'](0x194);}return _0x2b8399;};}function handleError(_0x17b8d9,_0x22883e){_0x22883e=_0x22883e||0x1f4;return function(_0x471db7){logger['error'](_0x471db7[_0x03f8('0x32')]);if(_0x471db7[_0x03f8('0x33')]){delete _0x471db7[_0x03f8('0x33')];}_0x17b8d9[_0x03f8('0x29')](_0x22883e)['send'](_0x471db7);};}exports[_0x03f8('0x34')]=function(_0x627728,_0x57fc04){var _0x4097ab={},_0x4e50bc={},_0x5117fe={'count':0x0,'rows':[]};var _0x2fafa6=_[_0x03f8('0x35')](db[_0x03f8('0x36')]['rawAttributes'],function(_0x5214a4){return{'name':_0x5214a4[_0x03f8('0x37')],'type':_0x5214a4['type'][_0x03f8('0x38')]};});_0x4e50bc[_0x03f8('0x39')]=_[_0x03f8('0x35')](_0x2fafa6,_0x03f8('0x33'));_0x4e50bc['query']=_[_0x03f8('0x3a')](_0x627728['query']);_0x4e50bc[_0x03f8('0x3b')]=_[_0x03f8('0x3c')](_0x4e50bc[_0x03f8('0x39')],_0x4e50bc[_0x03f8('0x3d')]);_0x4097ab[_0x03f8('0x3e')]=_[_0x03f8('0x3c')](_0x4e50bc['model'],qs[_0x03f8('0x3f')](_0x627728[_0x03f8('0x3d')][_0x03f8('0x3f')]));_0x4097ab[_0x03f8('0x3e')]=_0x4097ab['attributes'][_0x03f8('0x40')]?_0x4097ab[_0x03f8('0x3e')]:_0x4e50bc[_0x03f8('0x39')];if(!_0x627728[_0x03f8('0x3d')][_0x03f8('0x41')](_0x03f8('0x42'))){_0x4097ab[_0x03f8('0x2b')]=qs[_0x03f8('0x2b')](_0x627728[_0x03f8('0x3d')]['limit']);_0x4097ab[_0x03f8('0x2a')]=qs[_0x03f8('0x2a')](_0x627728[_0x03f8('0x3d')]['offset']);}_0x4097ab[_0x03f8('0x43')]=qs[_0x03f8('0x44')](_0x627728['query']['sort']);_0x4097ab[_0x03f8('0x45')]=qs['filters'](_[_0x03f8('0x46')](_0x627728[_0x03f8('0x3d')],_0x4e50bc[_0x03f8('0x3b')]),_0x2fafa6);if(_0x627728[_0x03f8('0x3d')][_0x03f8('0x47')]){_0x4097ab[_0x03f8('0x45')]=_[_0x03f8('0x48')](_0x4097ab[_0x03f8('0x45')],{'$or':_[_0x03f8('0x35')](_0x2fafa6,function(_0x20ea06){if(_0x20ea06[_0x03f8('0x49')]!==_0x03f8('0x4a')){var _0xe53cea={};_0xe53cea[_0x20ea06[_0x03f8('0x33')]]={'$like':'%'+_0x627728['query'][_0x03f8('0x47')]+'%'};return _0xe53cea;}})});}_0x4097ab=_[_0x03f8('0x48')]({},_0x4097ab,_0x627728[_0x03f8('0x4b')]);var _0x2dc19f={'where':_0x4097ab[_0x03f8('0x45')]};return db['SmsMessage'][_0x03f8('0x4c')](_0x2dc19f)[_0x03f8('0x31')](function(_0x5335af){_0x5117fe[_0x03f8('0x4c')]=_0x5335af;if(_0x627728[_0x03f8('0x3d')][_0x03f8('0x4d')]){_0x4097ab[_0x03f8('0x4e')]=[{'all':!![]}];}return db[_0x03f8('0x36')][_0x03f8('0x4f')](_0x4097ab);})['then'](function(_0x50bfcf){_0x5117fe[_0x03f8('0x50')]=_0x50bfcf;return _0x5117fe;})[_0x03f8('0x31')](respondWithFilteredResult(_0x57fc04,_0x4097ab))[_0x03f8('0x27')](handleError(_0x57fc04,null));};exports['show']=function(_0x8a4b7f,_0x4728c5){var _0xc3f7fb={'raw':!![],'where':{'id':_0x8a4b7f[_0x03f8('0x51')]['id']}},_0x366313={};_0x366313[_0x03f8('0x39')]=_[_0x03f8('0x3a')](db[_0x03f8('0x36')][_0x03f8('0x52')]);_0x366313[_0x03f8('0x3d')]=_[_0x03f8('0x3a')](_0x8a4b7f['query']);_0x366313[_0x03f8('0x3b')]=_[_0x03f8('0x3c')](_0x366313[_0x03f8('0x39')],_0x366313[_0x03f8('0x3d')]);_0xc3f7fb[_0x03f8('0x3e')]=_[_0x03f8('0x3c')](_0x366313['model'],qs['fields'](_0x8a4b7f[_0x03f8('0x3d')][_0x03f8('0x3f')]));_0xc3f7fb[_0x03f8('0x3e')]=_0xc3f7fb[_0x03f8('0x3e')][_0x03f8('0x40')]?_0xc3f7fb['attributes']:_0x366313[_0x03f8('0x39')];if(_0x8a4b7f[_0x03f8('0x3d')][_0x03f8('0x4d')]){_0xc3f7fb[_0x03f8('0x4e')]=[{'all':!![]}];}_0xc3f7fb=_[_0x03f8('0x48')]({},_0xc3f7fb,_0x8a4b7f[_0x03f8('0x4b')]);return db[_0x03f8('0x36')]['find'](_0xc3f7fb)[_0x03f8('0x31')](handleEntityNotFound(_0x4728c5,null))[_0x03f8('0x31')](respondWithResult(_0x4728c5,null))[_0x03f8('0x27')](handleError(_0x4728c5,null));};exports[_0x03f8('0x53')]=function(_0x50c97d,_0x204772){return db['SmsMessage']['create'](_0x50c97d[_0x03f8('0x54')],{})[_0x03f8('0x31')](respondWithResult(_0x204772,0xc9))[_0x03f8('0x27')](handleError(_0x204772,null));};exports[_0x03f8('0x55')]=function(_0x287c36,_0x517c50){if(_0x287c36[_0x03f8('0x54')]['id']){delete _0x287c36['body']['id'];}return db[_0x03f8('0x36')][_0x03f8('0x56')]({'where':{'id':_0x287c36[_0x03f8('0x51')]['id']}})[_0x03f8('0x31')](handleEntityNotFound(_0x517c50,null))[_0x03f8('0x31')](saveUpdates(_0x287c36[_0x03f8('0x54')],null))['then'](respondWithResult(_0x517c50,null))[_0x03f8('0x27')](handleError(_0x517c50,null));};exports['destroy']=function(_0x3e7134,_0x281945){return db['SmsMessage'][_0x03f8('0x56')]({'where':{'id':_0x3e7134[_0x03f8('0x51')]['id']}})[_0x03f8('0x31')](handleEntityNotFound(_0x281945,null))[_0x03f8('0x31')](removeEntity(_0x281945,null))[_0x03f8('0x27')](handleError(_0x281945,null));};exports[_0x03f8('0x57')]=function(_0x2f9d3a,_0x1dc04d){return db['SmsMessage'][_0x03f8('0x57')]()['then'](respondWithResult(_0x1dc04d,null))[_0x03f8('0x27')](handleError(_0x1dc04d,null));};var interaction_log=require(_0x03f8('0x13'))(_0x03f8('0x58'));exports[_0x03f8('0x59')]=function(_0x556343,_0x5decac,_0x587ed2){var _0x377838={'agent':{},'channel':_0x03f8('0x5a')};if(_0x556343[_0x03f8('0x54')]['id']){delete _0x556343['body']['id'];}_0x556343['body'][_0x03f8('0x5b')]=!![];_0x556343[_0x03f8('0x54')][_0x03f8('0x5c')]=moment()[_0x03f8('0x5d')](_0x03f8('0x5e'));_0x556343[_0x03f8('0x54')][_0x03f8('0x5f')]=_0x556343[_0x03f8('0x54')][_0x03f8('0x5f')]||_0x556343[_0x03f8('0x60')]['id'];_0x377838[_0x03f8('0x61')]['id']=_0x556343[_0x03f8('0x54')][_0x03f8('0x5f')];return db[_0x03f8('0x36')][_0x03f8('0x56')]({'where':{'id':_0x556343[_0x03f8('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x03f8('0x62')}]})['then'](handleEntityNotFound(_0x5decac,null))['then'](saveUpdates(_0x556343[_0x03f8('0x54')],null))[_0x03f8('0x31')](function(_0x12e0c2){if(_0x12e0c2){_0x377838['message']=_0x12e0c2[_0x03f8('0x63')]({'plain':!![]});return db[_0x03f8('0x64')][_0x03f8('0x56')]({'where':{'id':_0x12e0c2[_0x03f8('0x65')]}});}return null;})[_0x03f8('0x31')](handleEntityNotFound(_0x5decac,null))['then'](function(_0x56eb3c){if(_0x56eb3c){return _0x56eb3c[_0x03f8('0x55')]({'UserId':_0x556343['body'][_0x03f8('0x5f')],'read1stAt':_[_0x03f8('0x66')](_0x56eb3c['read1stAt'])?moment()[_0x03f8('0x5d')](_0x03f8('0x5e')):undefined});}return null;})[_0x03f8('0x31')](function(_0x2b78b5){if(_0x2b78b5){_0x377838['interaction']=_0x2b78b5['get']({'plain':!![]});interaction_log[_0x03f8('0x1e')](_0x03f8('0x67'),_0x556343[_0x03f8('0x60')]['id'],_0x556343[_0x03f8('0x60')][_0x03f8('0x33')],_0x556343[_0x03f8('0x60')]['role'],_0x377838[_0x03f8('0x68')]['id'],_0x556343['body']?JSON[_0x03f8('0x69')](_0x556343[_0x03f8('0x54')]):_0x03f8('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x03f8('0x6b'),_0x377838);}return null;})[_0x03f8('0x31')](function(_0x1ba115){if(_0x1ba115){if(_0x556343['body'][_0x03f8('0x6c')]){_0x377838[_0x03f8('0x25')]['interface']=util[_0x03f8('0x5d')]('SIP/%s',_0x556343[_0x03f8('0x60')][_0x03f8('0x33')]);_0x377838[_0x03f8('0x25')][_0x03f8('0x6d')]=_0x377838[_0x03f8('0x6d')];_0x377838[_0x03f8('0x25')][_0x03f8('0x6e')]='accept';return respondWithRpcPromise(_0x03f8('0x6f'),_0x03f8('0x6f'),{'event':_0x03f8('0x70'),'message':_0x377838[_0x03f8('0x25')]},client9002)[_0x03f8('0x31')](function(){return _0x377838;});}return _0x377838;}return null;})[_0x03f8('0x31')](respondWithResult(_0x5decac,null))[_0x03f8('0x27')](handleError(_0x5decac,null));};var interaction_log=require(_0x03f8('0x13'))(_0x03f8('0x58'));exports['reject']=function(_0x324202,_0x2aae21,_0x5bcb69){var _0x5ed9ec={'agent':{},'channel':'sms'};if(_0x324202[_0x03f8('0x54')]['id']){delete _0x324202[_0x03f8('0x54')]['id'];}_0x324202[_0x03f8('0x54')]['UserId']=_0x324202[_0x03f8('0x54')]['UserId']||_0x324202[_0x03f8('0x60')]['id'];_0x5ed9ec[_0x03f8('0x61')]['id']=_0x324202[_0x03f8('0x54')][_0x03f8('0x5f')];return db['SmsMessage']['find']({'where':{'id':_0x324202[_0x03f8('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2aae21,null))[_0x03f8('0x31')](function(_0x297fda){if(_0x297fda){_0x5ed9ec['message']=_0x297fda['get']({'plain':!![]});return db[_0x03f8('0x64')][_0x03f8('0x56')]({'where':{'id':_0x297fda[_0x03f8('0x65')]}});}return null;})[_0x03f8('0x31')](handleEntityNotFound(_0x2aae21,null))['then'](function(_0x4d3106){if(_0x4d3106){_0x5ed9ec[_0x03f8('0x68')]=_0x4d3106[_0x03f8('0x63')]({'plain':!![]});interaction_log[_0x03f8('0x1e')](_0x03f8('0x71'),_0x324202[_0x03f8('0x60')]['id'],_0x324202[_0x03f8('0x60')][_0x03f8('0x33')],_0x324202[_0x03f8('0x60')][_0x03f8('0x72')],_0x5ed9ec['interaction']['id'],_0x324202['body']?JSON[_0x03f8('0x69')](_0x324202['body']):_0x03f8('0x6a'));return respondWithRpcPromise(_0x03f8('0x73'),_0x03f8('0x74'),_0x5ed9ec);}return null;})[_0x03f8('0x31')](function(_0x2668cc){if(_0x2668cc){_0x2668cc[_0x03f8('0x25')][_0x03f8('0x75')]=util[_0x03f8('0x5d')](_0x03f8('0x76'),_0x324202['user'][_0x03f8('0x33')]);_0x2668cc[_0x03f8('0x25')][_0x03f8('0x6d')]=_0x5ed9ec[_0x03f8('0x6d')];_0x2668cc[_0x03f8('0x25')][_0x03f8('0x6e')]=_0x03f8('0x2f');respondWithRpcPromise(_0x03f8('0x6f'),'EventManager',{'event':_0x03f8('0x77'),'message':_0x2668cc[_0x03f8('0x25')]},client9002);return _0x5ed9ec;}return null;})[_0x03f8('0x31')](respondWithResult(_0x2aae21,null))['catch'](handleError(_0x2aae21,null));};exports['status']=function(_0x470c10,_0x2b3b2b,_0x2ef088){if(_0x470c10[_0x03f8('0x54')]['id']){delete _0x470c10[_0x03f8('0x54')]['id'];}var _0x141876;return db[_0x03f8('0x36')][_0x03f8('0x56')]({'where':{'id':_0x470c10[_0x03f8('0x51')]['id']}})['then'](handleEntityNotFound(_0x2b3b2b,null))[_0x03f8('0x31')](function(_0x438ec2){if(_0x438ec2){_0x141876=_0x438ec2;return db[_0x03f8('0x78')]['find']({'where':{'id':_0x438ec2[_0x03f8('0x79')]}});}})['then'](handleEntityNotFound(_0x2b3b2b,null))[_0x03f8('0x31')](function(_0x4dd2ad){if(_0x4dd2ad){logger[_0x03f8('0x21')](_0x03f8('0x22'),_0x03f8('0x29'),_0x03f8('0x7a'),_0x4dd2ad[_0x03f8('0x49')],util['inspect'](_0x470c10['body'],{'showHidden':![],'depth':null}));switch(_0x4dd2ad[_0x03f8('0x49')]){case _0x03f8('0x7b'):if(_0x470c10[_0x03f8('0x54')][_0x03f8('0x7c')]&&_0x470c10[_0x03f8('0x54')][_0x03f8('0x7c')]===_0x141876[_0x03f8('0x7d')]){return _0x141876[_0x03f8('0x55')]({'read':!![]});}else{logger[_0x03f8('0x23')](_0x03f8('0x7e'),_0x03f8('0x29'),_0x03f8('0x7b'),util[_0x03f8('0x7f')](_0x470c10[_0x03f8('0x54')],{'showHidden':![],'depth':null}));}break;case _0x03f8('0x80'):if(_0x470c10['body'][_0x03f8('0x81')]&&_0x470c10[_0x03f8('0x54')][_0x03f8('0x81')]===_0x141876[_0x03f8('0x7d')]&&_['indexOf']([_0x03f8('0x82'),'delivered'],_0x470c10[_0x03f8('0x54')]['Status'])>=0x0){return _0x141876[_0x03f8('0x55')]({'read':!![]});}else{logger[_0x03f8('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x03f8('0x83'),util['inspect'](_0x470c10['body'],{'showHidden':![],'depth':null}));}break;case _0x03f8('0x84'):var _0x16c635=_0x470c10[_0x03f8('0x54')]['results'][0x0];if(_0x16c635[_0x03f8('0x29')][_0x03f8('0x85')]===_0x03f8('0x86')){return _0x141876[_0x03f8('0x55')]({'read':!![]});}else{logger['error'](_0x03f8('0x7e'),_0x03f8('0x29'),_0x03f8('0x84'),util['inspect'](_0x470c10[_0x03f8('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x141876;}})['then'](respondWithResult(_0x2b3b2b,null))[_0x03f8('0x27')](handleError(_0x2b3b2b,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index c49e2aa..fc92b98 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 _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 +var _0x781c=['SmsMessage','setMaxListeners','save','update','remove','hook','exports','events','../../mysqldb'];(function(_0x55f5a2,_0x210428){var _0x1363a0=function(_0x51298b){while(--_0x51298b){_0x55f5a2['push'](_0x55f5a2['shift']());}};_0x1363a0(++_0x210428);}(_0x781c,0x16f));var _0xc781=function(_0x3e0668,_0x5e86b4){_0x3e0668=_0x3e0668-0x0;var _0x415954=_0x781c[_0x3e0668];return _0x415954;};'use strict';var EventEmitter=require(_0xc781('0x0'));var SmsMessage=require(_0xc781('0x1'))['db'][_0xc781('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xc781('0x3')](0x0);var events={'afterCreate':_0xc781('0x4'),'afterUpdate':_0xc781('0x5'),'afterDestroy':_0xc781('0x6')};function emitEvent(_0xc06a20){return function(_0x18f519,_0x5b7c3e,_0x1c1efc){SmsMessageEvents['emit'](_0xc06a20+':'+_0x18f519['id'],_0x18f519);SmsMessageEvents['emit'](_0xc06a20,_0x18f519);_0x1c1efc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xc781('0x7')](e,emitEvent(event));}}module[_0xc781('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2c18e38..bd9e9e9 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 _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 +var _0xd130=['SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','toLowerCase','out','secret','isNil','findOne','createdAt','direction','catch','error','SmsAccount','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','/api/sms/messages/','/status?token=','token','then','sid','update','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','GET','split','sms','user_key','session_key','total_sent','deliveryReport','read','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','inspect','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','http_code','data','queued_count','head','message_id','clickSend','plivo','remote','authId','toString','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','Missing\x20parameters:\x20username,\x20password','csc','crypto','apiKey','login','timestamp','keys','createHash','digest','hex','signature=','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','Missing\x20parameters:\x20apiKey','accountId','/messages','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define'];(function(_0x489394,_0x8eaa3a){var _0x409b16=function(_0x150cbf){while(--_0x150cbf){_0x489394['push'](_0x489394['shift']());}};_0x409b16(++_0x8eaa3a);}(_0xd130,0xe6));var _0x0d13=function(_0x31dee9,_0x27c1be){_0x31dee9=_0x31dee9-0x0;var _0x5b9829=_0xd130[_0x31dee9];return _0x5b9829;};'use strict';var _=require(_0x0d13('0x0'));var util=require(_0x0d13('0x1'));var logger=require(_0x0d13('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0d13('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d13('0x4'));var rimraf=require(_0x0d13('0x5'));var config=require(_0x0d13('0x6'));var attributes=require(_0x0d13('0x7'));module[_0x0d13('0x8')]=function(_0x18cb88,_0x17d59c){return _0x18cb88[_0x0d13('0x9')](_0x0d13('0xa'),attributes,{'tableName':_0x0d13('0xb'),'paranoid':![],'indexes':[{'name':_0x0d13('0xc'),'fields':[_0x0d13('0xc')]},{'name':_0x0d13('0xd'),'fields':[_0x0d13('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x24da55,_0x314f08,_0x4a4e2d){var _0x277719=_0x18cb88['models'];var _0x574c35=_0x24da55[_0x0d13('0xf')]({'plain':!![]});if(_0x574c35['direction'][_0x0d13('0x10')]()==='in'||_0x574c35['direction']['toLowerCase']()===_0x0d13('0x11')&&!_0x574c35[_0x0d13('0x12')]&&!_[_0x0d13('0x13')](_0x574c35['UserId'])){_0x277719['SmsInteraction'][_0x0d13('0x14')]({'where':{'id':_0x574c35['SmsInteractionId']}})['then'](function(_0xfd5bb7){if(_0xfd5bb7){_0xfd5bb7['update']({'lastMsgAt':_0x574c35[_0x0d13('0x15')],'lastMsgDirection':_0x574c35[_0x0d13('0x16')]['toLowerCase']()});}})[_0x0d13('0x17')](function(_0xbf4c3c){console[_0x0d13('0x18')](_0xbf4c3c);});}if(_0x574c35[_0x0d13('0x16')]===_0x0d13('0x11')&&!_0x574c35[_0x0d13('0x12')]){var _0x2a461e;_0x277719[_0x0d13('0x19')]['find']({'where':{'id':_0x574c35[_0x0d13('0x1a')]},'raw':!![]})['then'](function(_0x574abc){_0x2a461e=_0x574abc;if(_0x2a461e&&_0x2a461e['type']){switch(_0x2a461e[_0x0d13('0x1b')]){case _0x0d13('0x1c'):var _0x1b21f7=require('twilio');if(_0x2a461e['accountSid']&&_0x2a461e[_0x0d13('0x1d')]&&_0x2a461e[_0x0d13('0x1e')]){var _0x59934d=new _0x1b21f7(_0x2a461e[_0x0d13('0x1f')],_0x2a461e[_0x0d13('0x1d')]);_0x59934d[_0x0d13('0x20')]['create']({'body':_0x574c35[_0x0d13('0xe')],'to':_0x574c35['phone'],'from':_0x2a461e['phone'],'statusCallback':_0x2a461e['remote']+_0x0d13('0x21')+_0x574c35['id']+_0x0d13('0x22')+_0x2a461e[_0x0d13('0x23')]})[_0x0d13('0x24')](function(_0x25a60e){if(_0x25a60e[_0x0d13('0x25')]){return _0x24da55[_0x0d13('0x26')]({'messageId':_0x25a60e['sid']});}})[_0x0d13('0x17')](function(_0x5f0a56){logger[_0x0d13('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),_0x0d13('0x1c'),util['inspect'](_0x5f0a56,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x1c'),_0x0d13('0x29'));}break;case _0x0d13('0x2a'):var _0x2151f4=_0x0d13('0x2b');if(_0x2a461e[_0x0d13('0x2c')]&&_0x2a461e['password']){var _0x4df728={'recipient':[_0x574c35[_0x0d13('0x1e')]],'message':_0x574c35[_0x0d13('0xe')],'message_type':_0x2a461e[_0x0d13('0x2d')]};if(_0x2a461e[_0x0d13('0x2d')]&&_0x2a461e[_0x0d13('0x2d')]!=='SI'){_0x4df728[_0x0d13('0x2e')]=_0x2a461e[_0x0d13('0x1e')];}var _0x57a895={'url':_0x2151f4+'login?username='+_0x2a461e[_0x0d13('0x2c')]+_0x0d13('0x2f')+_0x2a461e[_0x0d13('0x30')],'method':_0x0d13('0x31')};rp(_0x57a895)['then'](function(_0x4a6334){var _0x70a490=_0x4a6334[_0x0d13('0x32')](';');var _0x519a63={'user_key':_0x70a490[0x0],'session_key':_0x70a490[0x1]};_0x57a895={'url':_0x2151f4+_0x0d13('0x33'),'method':'POST','headers':{'user_key':_0x519a63[_0x0d13('0x34')],'Session_key':_0x519a63[_0x0d13('0x35')]},'json':!![],'body':_0x4df728};return rp(_0x57a895);})['then'](function(_0x1b1a3c){if(_0x1b1a3c[_0x0d13('0x36')]>=0x1){var _0x5de1ff={'messageId':_0x1b1a3c['internal_order_id']};if(_0x2a461e[_0x0d13('0x2d')]!=='GP'||!_0x2a461e[_0x0d13('0x37')]){_0x5de1ff[_0x0d13('0x38')]=!![];}return _0x24da55['update'](_0x5de1ff);}else{return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x2a'),util['inspect'](_0x1b1a3c,{'showHidden':![],'depth':null}));}})[_0x0d13('0x17')](function(_0x531b22){return logger[_0x0d13('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),_0x0d13('0x2a'),util['inspect'](_0x531b22,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),_0x0d13('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0d13('0x39'):if(_0x2a461e['authToken']){var _0xfbc049={'recipient':_0x574c35[_0x0d13('0x1e')],'message':_0x574c35[_0x0d13('0xe')],'sender':_0x2a461e[_0x0d13('0x3a')]||_0x2a461e['phone'],'authorization':_0x2a461e['authToken']};var _0x314f08={'method':_0x0d13('0x3b'),'uri':_0x0d13('0x3c'),'body':_0xfbc049,'json':!![]};rp(_0x314f08)[_0x0d13('0x24')](function(_0x11f50f){var _0x44219d={'messageId':_0x11f50f[_0x0d13('0x3d')]};if(!_0x2a461e['deliveryReport']){_0x44219d[_0x0d13('0x38')]=!![];}return _0x24da55[_0x0d13('0x26')](_0x44219d);})[_0x0d13('0x17')](function(_0x4b3140){logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x39'),util[_0x0d13('0x3e')](_0x4b3140,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x39'),_0x0d13('0x3f'));}break;case _0x0d13('0x40'):if(_0x2a461e[_0x0d13('0x2c')]&&_0x2a461e[_0x0d13('0x30')]){var _0xfbc049={'messages':[{'source':'xCALLY\x20Motion','to':_0x574c35[_0x0d13('0x1e')],'body':_0x574c35[_0x0d13('0xe')],'from':_0x2a461e[_0x0d13('0x3a')]||_0x2a461e[_0x0d13('0x1e')]}]};var _0x17e3e1=util[_0x0d13('0x41')](_0x0d13('0x42'),_0x2a461e[_0x0d13('0x2c')],_0x2a461e['password']);var _0x314f08={'method':_0x0d13('0x3b'),'uri':_0x0d13('0x43'),'body':_0xfbc049,'headers':{'Authorization':util[_0x0d13('0x41')](_0x0d13('0x44'),new Buffer(_0x17e3e1)['toString']('base64'))},'json':!![]};rp(_0x314f08)[_0x0d13('0x24')](function(_0x30b076){if(_0x30b076['http_code']>=0xc8&&_0x30b076[_0x0d13('0x45')]<=0xce){if(_0x30b076[_0x0d13('0x46')]&&_0x30b076[_0x0d13('0x46')][_0x0d13('0x47')]>0x0){var _0x120bfa=_[_0x0d13('0x48')](_0x30b076[_0x0d13('0x46')][_0x0d13('0x20')]);var _0x2c105e={'messageId':_0x120bfa[_0x0d13('0x49')]};if(!_0x2a461e['deliveryReport']){_0x2c105e[_0x0d13('0x38')]=!![];}return _0x24da55[_0x0d13('0x26')](_0x2c105e);}else{logger[_0x0d13('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),'clickSend',util[_0x0d13('0x3e')](_0x30b076,{'showHidden':![],'depth':null}));}}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x4a'),util[_0x0d13('0x3e')](_0x30b076,{'showHidden':![],'depth':null}));}})[_0x0d13('0x17')](function(_0x33760a){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),'clickSend',util[_0x0d13('0x3e')](_0x33760a,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x0d13('0x4b'):if(_0x2a461e['authId']&&_0x2a461e[_0x0d13('0x1d')]){var _0xfbc049={'dst':_0x574c35[_0x0d13('0x1e')],'text':_0x574c35[_0x0d13('0xe')],'src':_0x2a461e[_0x0d13('0x3a')]||_0x2a461e[_0x0d13('0x1e')],'url':_0x2a461e[_0x0d13('0x4c')]+'/api/sms/messages/'+_0x574c35['id']+_0x0d13('0x22')+_0x2a461e[_0x0d13('0x23')]};var _0x17e3e1=util['format'](_0x0d13('0x42'),_0x2a461e[_0x0d13('0x4d')],_0x2a461e[_0x0d13('0x1d')]);var _0x314f08={'method':'POST','uri':util[_0x0d13('0x41')]('https://api.plivo.com/v1/Account/%s/Message/',_0x2a461e[_0x0d13('0x4d')]),'body':_0xfbc049,'headers':{'Authorization':util[_0x0d13('0x41')](_0x0d13('0x44'),new Buffer(_0x17e3e1)[_0x0d13('0x4e')](_0x0d13('0x4f')))},'json':!![]};rp(_0x314f08)['then'](function(_0x29da7b){var _0x1a4e64={'messageId':_0x29da7b[_0x0d13('0x50')][0x0]};return _0x24da55[_0x0d13('0x26')](_0x1a4e64);})[_0x0d13('0x17')](function(_0x222adf){logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),'plivo',util['inspect'](_0x222adf,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x4b'),_0x0d13('0x51'));}break;case _0x0d13('0x52'):if(_0x2a461e['username']&&_0x2a461e[_0x0d13('0x30')]){if(_0x2a461e['baseUrl']){var _0x4a32d9={'method':_0x0d13('0x3b'),'uri':_0x2a461e[_0x0d13('0x53')]+_0x0d13('0x54'),'body':{'username':_0x2a461e[_0x0d13('0x2c')],'password':_0x2a461e[_0x0d13('0x30')]},'json':!![]};return rp(_0x4a32d9)['then'](function(_0x12b1fc){var _0x10a7fc={'method':'POST','uri':_0x2a461e['baseUrl']+_0x0d13('0x55'),'body':{'messages':[{'from':_0x2a461e[_0x0d13('0x1e')],'destinations':[{'to':_0x574c35['phone']}],'text':_0x574c35['body'],'notifyUrl':_0x2a461e[_0x0d13('0x4c')]+_0x0d13('0x21')+_0x574c35['id']+_0x0d13('0x22')+_0x2a461e['token'],'notifyContentType':'application/json','callbackData':_0x2a461e[_0x0d13('0x1e')]+';'+_0x574c35[_0x0d13('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x12b1fc[_0x0d13('0x23')]},'json':!![]};return rp(_0x10a7fc)[_0x0d13('0x24')](function(_0x1fa875){if(_0x1fa875[_0x0d13('0x20')]){var _0x5fe332={'messageId':_0x1fa875['messages'][0x0][_0x0d13('0xc')]};if(!_0x2a461e[_0x0d13('0x37')]){_0x5fe332[_0x0d13('0x38')]=!![];}return _0x24da55['update'](_0x5fe332);}else{return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x52'),util[_0x0d13('0x3e')](_0x1fa875,{'showHidden':![],'depth':null}));}});})['catch'](function(_0xd42ac7){return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x52'),util[_0x0d13('0x3e')](_0xd42ac7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0d13('0x28'),'afterCreate',_0x0d13('0x52'),_0x0d13('0x56'));}}else{logger[_0x0d13('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),_0x0d13('0x52'),_0x0d13('0x57'));}break;case _0x0d13('0x58'):var _0x4b7dda=require(_0x0d13('0x59'));if(_0x2a461e[_0x0d13('0x5a')]){var _0x3d4127={};_0x3d4127[_0x0d13('0x5b')]=_0x2a461e[_0x0d13('0x2c')];_0x3d4127['phone']=_0x574c35['phone'];_0x3d4127['sender']=_0x2a461e[_0x0d13('0x1e')];_0x3d4127['text']=_0x574c35[_0x0d13('0xe')];_0x3d4127[_0x0d13('0x5c')]=+new Date();var _0x38474f='';var _0x501997='';var _0x9321fa=Object[_0x0d13('0x5d')](_0x3d4127);_0x9321fa['sort']();for(var _0x1e4517=0x0;_0x1e4517<_0x9321fa['length'];_0x1e4517++){if(_0x38474f!=''){_0x38474f+='&';}_0x38474f+=_0x9321fa[_0x1e4517]+'='+encodeURIComponent(_0x3d4127[_0x9321fa[_0x1e4517]]);_0x501997+=_0x3d4127[_0x9321fa[_0x1e4517]];}_0x501997+=_0x2a461e['apiKey'];_0x501997=_0x4b7dda[_0x0d13('0x5e')]('md5')['update'](_0x501997)[_0x0d13('0x5f')](_0x0d13('0x60'));if(_0x38474f!==''){_0x38474f+='&';}_0x38474f+=_0x0d13('0x61')+_0x501997;var _0x57a895={'method':'GET','uri':_0x2a461e[_0x0d13('0x53')]+_0x0d13('0x62')+_0x38474f,'json':!![]};return rp(_0x57a895)[_0x0d13('0x24')](function(_0x2659a0){var _0x32b629=Object[_0x0d13('0x5d')](_0x2659a0);if(_0x2659a0[_0x32b629[0x0]][_0x0d13('0x18')]&&parseInt(_0x2659a0[_0x32b629[0x0]][_0x0d13('0x18')])===0x0){var _0xa5bc1e={'messageId':_0x2659a0[_0x32b629[0x0]][_0x0d13('0x63')]};if(!_0x2a461e[_0x0d13('0x37')]){_0xa5bc1e['read']=!![];}return _0x24da55[_0x0d13('0x26')](_0xa5bc1e);}else{return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x58'),util[_0x0d13('0x3e')](_0x2659a0['error'],{'showHidden':![],'depth':null}));}})[_0x0d13('0x17')](function(_0x5cef74){return logger[_0x0d13('0x18')](_0x0d13('0x28'),'afterCreate',_0x0d13('0x58'),util[_0x0d13('0x3e')](_0x5cef74,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x58'),'Missing\x20parameters:\x20apiKey');}break;case _0x0d13('0x64'):if(_0x2a461e[_0x0d13('0x5a')]){var _0x322a1f={'method':_0x0d13('0x3b'),'uri':_0x0d13('0x65'),'headers':{'Authorization':_0x2a461e[_0x0d13('0x5a')]},'body':{'content':_0x574c35[_0x0d13('0xe')],'to':[_0x574c35[_0x0d13('0x1e')]],'from':_0x2a461e[_0x0d13('0x1e')],'binary':![],'clientMessageId':_0x0d13('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x322a1f)['then'](function(_0x391d8b){if(!_0x391d8b[_0x0d13('0x18')]){var _0x8d12ec={'messageId':_0x391d8b[_0x0d13('0x20')][0x0][_0x0d13('0x67')]};if(!_0x2a461e['deliveryReport']){_0x8d12ec[_0x0d13('0x38')]=!![];}return _0x24da55[_0x0d13('0x26')](_0x8d12ec);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0d13('0x27'),'clickatell',util[_0x0d13('0x3e')](_0x391d8b[_0x0d13('0x18')],{'showHidden':![],'depth':null}));}})[_0x0d13('0x17')](function(_0x32b47c){return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x64'),util[_0x0d13('0x3e')](_0x32b47c,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),'afterCreate',_0x0d13('0x64'),_0x0d13('0x68'));}break;case'bandwidth':if(_0x2a461e['username']&&_0x2a461e[_0x0d13('0x30')]){var _0x17e3e1=util[_0x0d13('0x41')](_0x0d13('0x42'),_0x2a461e['username'],_0x2a461e[_0x0d13('0x30')]);var _0x314f08={'method':_0x0d13('0x3b'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x2a461e[_0x0d13('0x69')]+_0x0d13('0x6a'),'body':{'to':[_0x574c35[_0x0d13('0x1e')]],'text':_0x574c35['body'],'from':_0x2a461e[_0x0d13('0x1e')],'applicationId':_0x2a461e['applicationId']},'headers':{'Authorization':util['format'](_0x0d13('0x44'),new Buffer(_0x17e3e1)['toString'](_0x0d13('0x4f')))},'json':!![]};rp(_0x314f08)[_0x0d13('0x24')](function(_0x12495c){if(_0x12495c['id']){var _0x35cfae={'messageId':_0x12495c['id']};return _0x24da55['update'](_0x35cfae);}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x6b'),util[_0x0d13('0x3e')](_0x12495c,{'showHidden':![],'depth':null}));}})[_0x0d13('0x17')](function(_0x3750f8){logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),'bandwidth',util[_0x0d13('0x3e')](_0x3750f8,{'showHidden':![],'depth':null}));});}else{logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),'bandwidth',_0x0d13('0x57'));}break;case _0x0d13('0x6c'):if(_0x2a461e['apiKey']){var _0xe5f2e0={};var _0x57a895={'method':_0x0d13('0x3b'),'uri':_0x0d13('0x6d'),'headers':{'Authorization':_0x0d13('0x6e')+_0x2a461e[_0x0d13('0x5a')],'Content-Type':_0x0d13('0x6f')},'body':{'from':_0x2a461e['phone'],'to':_0x574c35['phone'],'text':_0x574c35[_0x0d13('0xe')]},'json':!![]};return rp(_0x57a895)[_0x0d13('0x24')](function(_0x3ad467){if(_0x3ad467[_0x0d13('0x70')]==0xca){_0xe5f2e0[_0x0d13('0x71')]=_0x3ad467;var _0x5c5f43={'method':_0x0d13('0x3b'),'uri':_0x0d13('0x72'),'headers':{'Authorization':_0x0d13('0x6e')+_0x2a461e['apiKey'],'Content-Type':_0x0d13('0x6f')},'body':{'refid':_0xe5f2e0[_0x0d13('0x71')][_0x0d13('0x73')]},'json':!![]};return rp(_0x5c5f43)[_0x0d13('0x24')](function(_0x1cef38){_0xe5f2e0['status']=_0x1cef38;var _0x181bd8={'messageId':_0xe5f2e0[_0x0d13('0x71')][_0x0d13('0x73')],'read':!![]};return _0x24da55[_0x0d13('0x26')](_0x181bd8);});}else{return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x6c'),util[_0x0d13('0x3e')](_0x3ad467,{'showHidden':![],'depth':null}));}})[_0x0d13('0x17')](function(_0x423883){return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x6c'),util['inspect'](_0x423883,{'showHidden':![],'depth':null}));});}else{return logger[_0x0d13('0x18')](_0x0d13('0x28'),_0x0d13('0x27'),_0x0d13('0x6c'),_0x0d13('0x74'));}break;}}})[_0x0d13('0x75')](function(){_0x4a4e2d();});}else{_0x4a4e2d();}}},'charset':_0x0d13('0x76'),'collate':_0x0d13('0x77')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 0307e25..cc6262d 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 _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 +var _0xc48c=['code','message','result','catch','CreateSmsMessage','body','options','raw','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2bc112,_0x1cbe58){var _0x57bd63=function(_0x21ad4d){while(--_0x21ad4d){_0x2bc112['push'](_0x2bc112['shift']());}};_0x57bd63(++_0x1cbe58);}(_0xc48c,0x1d9));var _0xcc48=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc48c[_0x56482c];return _0x5aae7a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc48('0x0'));var BPromise=require(_0xcc48('0x1'));var rs=require(_0xcc48('0x2'));var fs=require('fs');var Redis=require(_0xcc48('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcc48('0x4'))(_0xcc48('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc48('0x6'));var client=jayson[_0xcc48('0x7')][_0xcc48('0x8')]({'port':0x232a});config[_0xcc48('0x9')]=_[_0xcc48('0xa')](config[_0xcc48('0x9')],{'host':_0xcc48('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc48('0x9')]));require(_0xcc48('0xc'))[_0xcc48('0xd')](socket);function respondWithRpcPromise(_0x4950df,_0x596f72,_0xa249db){return new BPromise(function(_0xa076eb,_0x12788f){return client[_0xcc48('0xe')](_0x4950df,_0xa249db)[_0xcc48('0xf')](function(_0x4bc7cf){logger[_0xcc48('0x10')](_0xcc48('0x11'),_0x596f72,_0xcc48('0x12'));logger[_0xcc48('0x13')](_0xcc48('0x14'),_0x596f72,_0xcc48('0x12'),JSON[_0xcc48('0x15')](_0x4bc7cf));if(_0x4bc7cf['error']){if(_0x4bc7cf[_0xcc48('0x16')][_0xcc48('0x17')]===0x1f4){logger[_0xcc48('0x16')](_0xcc48('0x11'),_0x596f72,_0x4bc7cf['error'][_0xcc48('0x18')]);return _0x12788f(_0x4bc7cf[_0xcc48('0x16')][_0xcc48('0x18')]);}logger[_0xcc48('0x16')](_0xcc48('0x11'),_0x596f72,_0x4bc7cf[_0xcc48('0x16')]['message']);return _0xa076eb(_0x4bc7cf[_0xcc48('0x16')][_0xcc48('0x18')]);}else{logger[_0xcc48('0x10')](_0xcc48('0x11'),_0x596f72,_0xcc48('0x12'));_0xa076eb(_0x4bc7cf[_0xcc48('0x19')][_0xcc48('0x18')]);}})[_0xcc48('0x1a')](function(_0x4f2832){logger[_0xcc48('0x16')](_0xcc48('0x11'),_0x596f72,_0x4f2832);_0x12788f(_0x4f2832);});});}exports[_0xcc48('0x1b')]=function(_0xcb71a9){var _0x349188=this;return new Promise(function(_0x1f28d6,_0x2ad1db){return db['SmsMessage']['create'](_0xcb71a9[_0xcc48('0x1c')],{'raw':_0xcb71a9[_0xcc48('0x1d')]?_0xcb71a9['options'][_0xcc48('0x1e')]===undefined?!![]:![]:!![]})[_0xcc48('0xf')](function(_0x3cc0f4){logger[_0xcc48('0x10')]('CreateSmsMessage',_0xcb71a9);logger['debug'](_0xcc48('0x1b'),_0xcb71a9,JSON[_0xcc48('0x15')](_0x3cc0f4));_0x1f28d6(_0x3cc0f4);})[_0xcc48('0x1a')](function(_0x6a4a69){logger[_0xcc48('0x16')]('CreateSmsMessage',_0x6a4a69[_0xcc48('0x18')],_0xcb71a9);_0x2ad1db(_0x349188['error'](0x1f4,_0x6a4a69[_0xcc48('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8067448..2035f90 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 _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 +var _0xc57b=['save','remove','update','length','smsMessage:','./smsMessage.events'];(function(_0x958fff,_0x426211){var _0x52f712=function(_0x2537e4){while(--_0x2537e4){_0x958fff['push'](_0x958fff['shift']());}};_0x52f712(++_0x426211);}(_0xc57b,0xcb));var _0xbc57=function(_0x58dc4c,_0x3af7ae){_0x58dc4c=_0x58dc4c-0x0;var _0x17da9e=_0xc57b[_0x58dc4c];return _0x17da9e;};'use strict';var SmsMessageEvents=require(_0xbc57('0x0'));var events=[_0xbc57('0x1'),_0xbc57('0x2'),_0xbc57('0x3')];function createListener(_0x731924,_0xe853ea){return function(_0x319a6e){_0xe853ea['emit'](_0x731924,_0x319a6e);};}function removeListener(_0x2ea8d8,_0x29509a){return function(){SmsMessageEvents['removeListener'](_0x2ea8d8,_0x29509a);};}exports['register']=function(_0x1f4bd5){for(var _0x2c9eb5=0x0,_0xffbdc2=events[_0xbc57('0x4')];_0x2c9eb5<_0xffbdc2;_0x2c9eb5++){var _0x40e4f9=events[_0x2c9eb5];var _0x453763=createListener(_0xbc57('0x5')+_0x40e4f9,_0x1f4bd5);SmsMessageEvents['on'](_0x40e4f9,_0x453763);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index ab88e6d..ba3ada7 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 _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 +var _0xc1dc=['removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','put','update','delete','destroy'];(function(_0x53e95b,_0x2b8b07){var _0x47a3a1=function(_0x3dfc2c){while(--_0x3dfc2c){_0x53e95b['push'](_0x53e95b['shift']());}};_0x47a3a1(++_0x2b8b07);}(_0xc1dc,0x84));var _0xcc1d=function(_0x1ff2aa,_0x380447){_0x1ff2aa=_0x1ff2aa-0x0;var _0x2d158c=_0xc1dc[_0x1ff2aa];return _0x2d158c;};'use strict';var multer=require(_0xcc1d('0x0'));var util=require(_0xcc1d('0x1'));var path=require(_0xcc1d('0x2'));var timeout=require('connect-timeout');var express=require(_0xcc1d('0x3'));var router=express['Router']();var auth=require(_0xcc1d('0x4'));var interaction=require(_0xcc1d('0x5'));var config=require('../../config/environment');var controller=require(_0xcc1d('0x6'));router[_0xcc1d('0x7')]('/',auth[_0xcc1d('0x8')](),controller[_0xcc1d('0x9')]);router[_0xcc1d('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xcc1d('0xa')]);router[_0xcc1d('0x7')](_0xcc1d('0xb'),auth[_0xcc1d('0x8')](),controller[_0xcc1d('0xc')]);router[_0xcc1d('0x7')]('/:id/members',auth[_0xcc1d('0x8')](),controller[_0xcc1d('0xd')]);router[_0xcc1d('0x7')](_0xcc1d('0xe'),auth[_0xcc1d('0x8')](),controller[_0xcc1d('0xf')]);router['get'](_0xcc1d('0x10'),auth[_0xcc1d('0x8')](),controller['getAgents']);router[_0xcc1d('0x11')]('/',auth[_0xcc1d('0x8')](),controller[_0xcc1d('0x12')]);router[_0xcc1d('0x11')](_0xcc1d('0xe'),auth[_0xcc1d('0x8')](),controller[_0xcc1d('0x13')]);router['post']('/:id/users',auth[_0xcc1d('0x8')](),controller['addAgents']);router[_0xcc1d('0x14')](_0xcc1d('0xb'),auth[_0xcc1d('0x8')](),controller[_0xcc1d('0x15')]);router[_0xcc1d('0x16')](_0xcc1d('0xb'),auth[_0xcc1d('0x8')](),controller[_0xcc1d('0x17')]);router[_0xcc1d('0x16')](_0xcc1d('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xcc1d('0x16')]('/:id/users',auth[_0xcc1d('0x8')](),controller[_0xcc1d('0x18')]);module[_0xcc1d('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 8feeae8..0b4a84b 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 _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 +var _0xde65=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde65,0x98));var _0x5de6=function(_0x9b8d91,_0xd8a5a0){_0x9b8d91=_0x9b8d91-0x0;var _0x5db140=_0xde65[_0x9b8d91];return _0x5db140;};'use strict';var Sequelize=require('sequelize');module[_0x5de6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5de6('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5de6('0x2')]},'timeout':{'type':Sequelize[_0x5de6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5de6('0x4')](_0x5de6('0x5'),_0x5de6('0x6'),_0x5de6('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index aef9c01..e39aeab 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 _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 +var _0xabce=['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','socket.io-emitter','./smsQueue.socket','sendStatus','end','status','count','offset','set','json','apply','save','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','filter','merge','where','findAll','show','includeAll','options','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserSmsQueue','sort','pick','User','UserId','smsPause','updatedAt','createdAt','rows','format','SIP','getTeams','Team','ids','online','interface','flatMap','Agents','sequelize','transaction','addTeams','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','union','value','isEmpty','removeAgents','forEach','addAgents','spread','isArray','userSmsQueue:remove','getAgents','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x47f916,_0x11dfda){var _0x2a1bfb=function(_0x1c58bd){while(--_0x1c58bd){_0x47f916['push'](_0x47f916['shift']());}};_0x2a1bfb(++_0x11dfda);}(_0xabce,0x103));var _0xeabc=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xabce[_0x3ce3c];return _0x55a2c9;};'use strict';var pdf=require(_0xeabc('0x0'));var emlformat=require(_0xeabc('0x1'));var rimraf=require(_0xeabc('0x2'));var zipdir=require(_0xeabc('0x3'));var jsonpatch=require(_0xeabc('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeabc('0x5'));var Mustache=require(_0xeabc('0x6'));var util=require(_0xeabc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xeabc('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];config[_0xeabc('0x1a')]=_[_0xeabc('0x1b')](config[_0xeabc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x1c'))(new Redis(config[_0xeabc('0x1a')]));require(_0xeabc('0x1d'))['register'](socket);function respondWithStatusCode(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xcc;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1e')](_0x3170ea);}return _0x5f4ee8['status'](_0x3170ea)[_0xeabc('0x1f')]();};}function respondWithResult(_0x638976,_0x49f2d8){_0x49f2d8=_0x49f2d8||0xc8;return function(_0x53fe28){if(_0x53fe28){return _0x638976[_0xeabc('0x20')](_0x49f2d8)['json'](_0x53fe28);}};}function respondWithFilteredResult(_0x3d0e21,_0x1b64b9){return function(_0x58a3c0){if(_0x58a3c0){var _0x16f08b=_0x58a3c0[_0xeabc('0x21')],_0x31dd53=_0x1b64b9['offset'],_0x31f52a=_0x1b64b9[_0xeabc('0x22')]+_0x1b64b9['limit'],_0x384be5;if(_0x31f52a>=_0x16f08b){_0x31f52a=_0x16f08b;_0x384be5=0xc8;}else{_0x384be5=0xce;}_0x3d0e21[_0xeabc('0x20')](_0x384be5);return _0x3d0e21[_0xeabc('0x23')]('Content-Range',_0x31dd53+'-'+_0x31f52a+'/'+_0x16f08b)[_0xeabc('0x24')](_0x58a3c0);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x25')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x26')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x27')](_0x10c675)[_0xeabc('0x28')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x28')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x29')]({'plain':!![]});var _0x12acbd=_0xeabc('0x2a');return db[_0xeabc('0x2b')][_0xeabc('0x2c')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x28')](function(){return _0x109e1d;});})[_0xeabc('0x28')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1e')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2d')](_0x38572d[_0xeabc('0x2e')]);if(_0x38572d[_0xeabc('0x2f')]){delete _0x38572d[_0xeabc('0x2f')];}_0x48fb52[_0xeabc('0x20')](_0x2163e6)[_0xeabc('0x30')](_0x38572d);};}exports[_0xeabc('0x31')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x32')](db[_0xeabc('0x33')][_0xeabc('0x34')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x35')][_0xeabc('0x36')]};});_0x2f03e8[_0xeabc('0x37')]=_['map'](_0x98b445,_0xeabc('0x2f'));_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x2f03e8[_0xeabc('0x37')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3c')]=_[_0xeabc('0x3b')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x38')][_0xeabc('0x3d')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3c')][_0xeabc('0x3e')]?_0x5bb1f1[_0xeabc('0x3c')]:_0x2f03e8[_0xeabc('0x37')];if(!_0x5ebb86[_0xeabc('0x38')]['hasOwnProperty'](_0xeabc('0x3f'))){_0x5bb1f1['limit']=qs[_0xeabc('0x40')](_0x5ebb86[_0xeabc('0x38')][_0xeabc('0x40')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x38')]['offset']);}_0x5bb1f1[_0xeabc('0x41')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x3a')](_['pick'](_0x5ebb86[_0xeabc('0x38')],_0x2f03e8[_0xeabc('0x3a')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x42')]){_0x5bb1f1['where']=_[_0xeabc('0x43')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x32')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x35')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x38')][_0xeabc('0x42')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x43')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x44')]};return db[_0xeabc('0x33')]['count'](_0x4f1897)[_0xeabc('0x28')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x21')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x33')][_0xeabc('0x45')](_0x5bb1f1);})[_0xeabc('0x28')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x28')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x46')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x39')](db['SmsQueue'][_0xeabc('0x34')]);_0xc849c9[_0xeabc('0x38')]=_['keys'](_0x1a4bbe[_0xeabc('0x38')]);_0xc849c9[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0xc849c9[_0xeabc('0x37')],_0xc849c9[_0xeabc('0x38')]);_0x17a0df[_0xeabc('0x3c')]=_[_0xeabc('0x3b')](_0xc849c9['model'],qs[_0xeabc('0x3d')](_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x3d')]));_0x17a0df[_0xeabc('0x3c')]=_0x17a0df[_0xeabc('0x3c')][_0xeabc('0x3e')]?_0x17a0df[_0xeabc('0x3c')]:_0xc849c9[_0xeabc('0x37')];if(_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x47')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x43')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x48')]);return db[_0xeabc('0x33')][_0xeabc('0x49')](_0x17a0df)[_0xeabc('0x28')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x28')](respondWithResult(_0x3a7807,null))[_0xeabc('0x4a')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x33')][_0xeabc('0x4b')](_0x766743[_0xeabc('0x4c')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4d')][_0xeabc('0x29')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4e')]===_0xeabc('0x4d')){var _0x568847=_0x305946[_0xeabc('0x29')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x2a');return db['UserProfileSection'][_0xeabc('0x49')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4f')]},'raw':!![]})[_0xeabc('0x28')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x50')]===0x0){return db[_0xeabc('0x2b')][_0xeabc('0x4b')]({'name':_0x568847[_0xeabc('0x2f')],'resourceId':_0x568847['id'],'type':_0x1524c3[_0xeabc('0x2f')],'sectionId':_0x1524c3['id']},{})[_0xeabc('0x28')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2d')](_0xeabc('0x51'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x28')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x27')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x4c')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x33')][_0xeabc('0x49')]({'where':{'id':_0x392913[_0xeabc('0x52')]['id']}})[_0xeabc('0x28')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x28')](saveUpdates(_0x392913[_0xeabc('0x4c')],null))[_0xeabc('0x28')](respondWithResult(_0x10d56f,null))[_0xeabc('0x4a')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2c')]=function(_0x58ab08,_0x4546c4){return db['SmsQueue']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x28')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x28')](removeEntity(_0x4546c4,null))[_0xeabc('0x4a')](handleError(_0x4546c4,null));};exports[_0xeabc('0x53')]=function(_0xe89728,_0x2f78f3){return db['SmsQueue'][_0xeabc('0x53')]()[_0xeabc('0x28')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x4a')](handleError(_0x2f78f3,null));};exports[_0xeabc('0x54')]=function(_0x2ddc53,_0x2c7b4e,_0x1750e9){var _0x25c728={'raw':!![],'where':{}},_0x5820ca={},_0x5b8370;return db[_0xeabc('0x33')][_0xeabc('0x55')]({'where':{'id':_0x2ddc53[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c7b4e,null))[_0xeabc('0x28')](function(_0x536f42){if(_0x536f42){_0x5b8370=_0x536f42['get']({'plain':!![]});_0x5820ca[_0xeabc('0x37')]=_[_0xeabc('0x39')](db[_0xeabc('0x56')][_0xeabc('0x34')]);_0x5820ca[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2ddc53['query']);_0x5820ca[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x5820ca[_0xeabc('0x37')],_0x5820ca[_0xeabc('0x38')]);_0x25c728[_0xeabc('0x3c')]=_[_0xeabc('0x3b')](_0x5820ca['model'],qs[_0xeabc('0x3d')](_0x2ddc53[_0xeabc('0x38')][_0xeabc('0x3d')]));_0x25c728[_0xeabc('0x3c')]=_0x25c728[_0xeabc('0x3c')][_0xeabc('0x3e')]?_0x25c728[_0xeabc('0x3c')]:_0x5820ca[_0xeabc('0x37')];if(!_0x2ddc53[_0xeabc('0x38')]['hasOwnProperty'](_0xeabc('0x3f'))){_0x25c728['limit']=qs[_0xeabc('0x40')](_0x2ddc53[_0xeabc('0x38')][_0xeabc('0x40')]);_0x25c728[_0xeabc('0x22')]=qs[_0xeabc('0x22')](_0x2ddc53[_0xeabc('0x38')][_0xeabc('0x22')]);}_0x25c728[_0xeabc('0x41')]=qs[_0xeabc('0x57')](_0x2ddc53[_0xeabc('0x38')]['sort']);_0x25c728[_0xeabc('0x44')]=qs[_0xeabc('0x3a')](_[_0xeabc('0x58')](_0x2ddc53[_0xeabc('0x38')],_0x5820ca['filters']));_0x25c728[_0xeabc('0x44')]['SmsQueueId']=_0x536f42['id'];if(_0x2ddc53['query'][_0xeabc('0x42')]){_0x25c728[_0xeabc('0x44')]=_[_0xeabc('0x43')](_0x25c728[_0xeabc('0x44')],{'$or':_['map'](_0x25c728['attributes'],function(_0x2e712e){var _0x4ce3f4={};_0x4ce3f4[_0x2e712e]={'$like':'%'+_0x2ddc53['query'][_0xeabc('0x42')]+'%'};return _0x4ce3f4;})});}_0x25c728=_['merge']({},_0x25c728,_0x2ddc53['options']);return db[_0xeabc('0x56')][_0xeabc('0x45')](_0x25c728);}})['then'](function(_0x48cccc){if(_0x48cccc){return db[_0xeabc('0x59')]['findAndCountAll']({'where':{'id':_[_0xeabc('0x32')](_0x48cccc,_0xeabc('0x5a')),'role':'agent'},'attributes':['id','name',_0xeabc('0x5b'),_0xeabc('0x5c'),_0xeabc('0x5d')]});}})[_0xeabc('0x28')](function(_0x1debaa){if(_0x1debaa){return{'count':_0x1debaa['count'],'rows':_['map'](_0x1debaa[_0xeabc('0x5e')],function(_0x5c760d){return{'membername':_0x5c760d[_0xeabc('0x2f')],'UserId':_0x5c760d['id'],'queue_name':_0x5b8370['name'],'SmsQueueId':_0x5b8370['id'],'interface':util[_0xeabc('0x5f')]('%s/%s',_0xeabc('0x60'),_0x5c760d['name']),'penalty':0x0,'paused':_0x5c760d[_0xeabc('0x5b')],'createdAt':_0x5c760d[_0xeabc('0x5d')],'updatedAt':_0x5c760d[_0xeabc('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xeabc('0x28')](respondWithFilteredResult(_0x2c7b4e,_0x25c728))['catch'](handleError(_0x2c7b4e,null));};exports[_0xeabc('0x61')]=function(_0x4fa682,_0x26ff38,_0x3e87c3){var _0x26d024={};var _0x433dd3={};var _0x399d2e;var _0x5c1ab2;return db[_0xeabc('0x33')][_0xeabc('0x55')]({'where':{'id':_0x4fa682[_0xeabc('0x52')]['id']}})[_0xeabc('0x28')](handleEntityNotFound(_0x26ff38,null))['then'](function(_0x1559dc){if(_0x1559dc){_0x399d2e=_0x1559dc;_0x433dd3[_0xeabc('0x37')]=_[_0xeabc('0x39')](db[_0xeabc('0x62')]['rawAttributes']);_0x433dd3[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x4fa682[_0xeabc('0x38')]);_0x433dd3[_0xeabc('0x3a')]=_['intersection'](_0x433dd3['model'],_0x433dd3[_0xeabc('0x38')]);_0x26d024['attributes']=_['intersection'](_0x433dd3[_0xeabc('0x37')],qs[_0xeabc('0x3d')](_0x4fa682[_0xeabc('0x38')]['fields']));_0x26d024[_0xeabc('0x3c')]=_0x26d024[_0xeabc('0x3c')]['length']?_0x26d024[_0xeabc('0x3c')]:_0x433dd3[_0xeabc('0x37')];_0x26d024[_0xeabc('0x41')]=qs[_0xeabc('0x57')](_0x4fa682[_0xeabc('0x38')]['sort']);_0x26d024[_0xeabc('0x44')]=qs['filters'](_['pick'](_0x4fa682['query'],_0x433dd3[_0xeabc('0x3a')]));if(_0x4fa682[_0xeabc('0x38')][_0xeabc('0x42')]){_0x26d024[_0xeabc('0x44')]=_[_0xeabc('0x43')](_0x26d024['where'],{'$or':_[_0xeabc('0x32')](_0x26d024['attributes'],function(_0x1795fe){var _0x2f95c7={};_0x2f95c7[_0x1795fe]={'$like':'%'+_0x4fa682['query'][_0xeabc('0x42')]+'%'};return _0x2f95c7;})});}_0x26d024=_['merge']({},_0x26d024,_0x4fa682['options']);return _0x399d2e[_0xeabc('0x61')](_0x26d024);}})[_0xeabc('0x28')](function(_0x439a48){if(_0x439a48){_0x5c1ab2=_0x439a48[_0xeabc('0x3e')];if(!_0x4fa682[_0xeabc('0x38')]['hasOwnProperty'](_0xeabc('0x3f'))){_0x26d024[_0xeabc('0x40')]=qs[_0xeabc('0x40')](_0x4fa682[_0xeabc('0x38')][_0xeabc('0x40')]);_0x26d024[_0xeabc('0x22')]=qs[_0xeabc('0x22')](_0x4fa682[_0xeabc('0x38')][_0xeabc('0x22')]);}return _0x399d2e[_0xeabc('0x61')](_0x26d024);}})['then'](function(_0x436f8e){if(_0x436f8e){return _0x436f8e?{'count':_0x5c1ab2,'rows':_0x436f8e}:null;}})[_0xeabc('0x28')](respondWithResult(_0x26ff38,null))[_0xeabc('0x4a')](handleError(_0x26ff38,null));};exports['addTeams']=function(_0x4bccf7,_0x1506bd,_0x273ca5){var _0xe90200=_0x4bccf7[_0xeabc('0x4c')][_0xeabc('0x63')];return db['Team'][_0xeabc('0x45')]({'where':{'id':_0xe90200},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xeabc('0x2f'),_0xeabc('0x64'),'voicePause',_0xeabc('0x65')],'raw':!![]}]})[_0xeabc('0x28')](function(_0x49a70a){if(_0x49a70a){var _0x5963f7=_[_0xeabc('0x66')](_0x49a70a,function(_0xb04677){var _0x135a79=_0xb04677[_0xeabc('0x29')]({'plain':!![]});return _0x135a79[_0xeabc('0x67')];});return db[_0xeabc('0x33')][_0xeabc('0x49')]({'where':{'id':_0x4bccf7['params']['id']}})[_0xeabc('0x28')](function(_0x5c9d6f){return db[_0xeabc('0x68')][_0xeabc('0x69')](function(_0x204e39){return _0x5c9d6f[_0xeabc('0x6a')](_0xe90200,{'transaction':_0x204e39})[_0xeabc('0x28')](function(){return BPromise[_0xeabc('0x6b')](_0x5963f7,function(_0x40f51e){return db[_0xeabc('0x56')][_0xeabc('0x6c')]({'where':{'UserId':_0x40f51e['id'],'SmsQueueId':_0x4bccf7[_0xeabc('0x52')]['id']},'transaction':_0x204e39});});})[_0xeabc('0x28')](function(){_0x5963f7['forEach'](function(_0x10bcef){socket[_0xeabc('0x6d')](_0xeabc('0x6e'),{'UserId':_0x10bcef['id'],'SmsQueueId':_0x5c9d6f['id']});});});});});}})[_0xeabc('0x28')](respondWithStatusCode(_0x1506bd,null))['catch'](handleError(_0x1506bd,null));};exports[_0xeabc('0x6f')]=function(_0x180f99,_0x580661,_0x3de927){return db[_0xeabc('0x62')]['findAll']({'where':{'id':_0x180f99['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeabc('0x67'),'attributes':['id'],'raw':!![]}]})[_0xeabc('0x28')](handleEntityNotFound(_0x580661,null))[_0xeabc('0x28')](function(_0xe18bf1){var _0x1d8dca=_[_0xeabc('0x32')](_0xe18bf1,'id');var _0x3abe69=[];var _0x385ecf=[];var _0x18c27f=squel[_0xeabc('0x70')]();_0x18c27f['field'](_0xeabc('0x71'))[_0xeabc('0x72')]('team_has_sms_queues','tq')[_0xeabc('0x73')](_0xeabc('0x74'),'ut',_0xeabc('0x75'))['where'](_0xeabc('0x76'),_0x180f99['params']['id']);for(var _0x425e5c=0x0;_0x425e5c<_0xe18bf1[_0xeabc('0x3e')];_0x425e5c+=0x1){let _0x1841f0=_0xe18bf1[_0x425e5c];for(var _0xd9a156=0x0;_0xd9a156<_0x1841f0[_0xeabc('0x67')]['length'];_0xd9a156+=0x1){let _0x53a5bc=_0x1841f0['Agents'][_0xd9a156];var _0x4ab2f5=_0x18c27f[_0xeabc('0x77')]();_0x4ab2f5[_0xeabc('0x44')](_0xeabc('0x78'),_0x53a5bc['id']);_0x385ecf['push'](db[_0xeabc('0x68')][_0xeabc('0x38')](_0x4ab2f5[_0xeabc('0x79')](),{'type':db[_0xeabc('0x68')][_0xeabc('0x7a')][_0xeabc('0x7b')]})[_0xeabc('0x28')](function(_0x468030){if(_0x468030[_0xeabc('0x3e')]===0x1){return _0x53a5bc['id'];}else{var _0x391e67=_[_0xeabc('0x7c')](_[_0xeabc('0x32')](_0x468030,'TeamId'),function(_0x5f5a98){return _[_0xeabc('0x7d')](_0x1d8dca,_0x5f5a98);});if(_0x391e67){return _0x53a5bc['id'];}}}));}}return BPromise['all'](_0x385ecf)[_0xeabc('0x28')](function(_0x18ee16){_0x3abe69=_(_0x3abe69)[_0xeabc('0x7e')](_0x18ee16)['compact']()[_0xeabc('0x7f')]();return db[_0xeabc('0x33')][_0xeabc('0x49')]({'where':{'id':_0x180f99['params']['id']}})['then'](function(_0x3557f2){return db[_0xeabc('0x68')][_0xeabc('0x69')](function(_0xb2bdc4){return _0x3557f2[_0xeabc('0x6f')](_0x180f99[_0xeabc('0x38')]['ids'],{'transaction':_0xb2bdc4})['then'](function(){if(!_[_0xeabc('0x80')](_0x3abe69)){return _0x3557f2[_0xeabc('0x81')](_0x3abe69,{'transaction':_0xb2bdc4});}})[_0xeabc('0x28')](function(){_0x3abe69[_0xeabc('0x82')](function(_0x5f054d){socket['emit']('userSmsQueue:remove',{'UserId':_0x5f054d,'SmsQueueId':_0x3557f2['id']});});});});});});})[_0xeabc('0x28')](respondWithStatusCode(_0x580661,null))['catch'](handleError(_0x580661,null));};exports[_0xeabc('0x83')]=function(_0x5016e2,_0xd43a95,_0x50007b){return db[_0xeabc('0x33')][_0xeabc('0x49')]({'where':{'id':_0x5016e2[_0xeabc('0x52')]['id']}})[_0xeabc('0x28')](handleEntityNotFound(_0xd43a95,null))[_0xeabc('0x28')](function(_0x52183d){if(_0x52183d){return _0x52183d[_0xeabc('0x83')](_0x5016e2[_0xeabc('0x4c')][_0xeabc('0x63')],_['omit'](_0x5016e2[_0xeabc('0x4c')],[_0xeabc('0x63'),'id'])||{})[_0xeabc('0x84')](function(_0x395acf){for(var _0x1aab38=0x0;_0x1aab38<_0x5016e2['body'][_0xeabc('0x63')][_0xeabc('0x3e')];_0x1aab38+=0x1){socket['emit'](_0xeabc('0x6e'),{'UserId':_0x5016e2[_0xeabc('0x4c')]['ids'][_0x1aab38],'SmsQueueId':_0x5016e2[_0xeabc('0x52')]['id']});}return _0x395acf;});}})[_0xeabc('0x28')](respondWithResult(_0xd43a95,null))[_0xeabc('0x4a')](handleError(_0xd43a95,null));};exports[_0xeabc('0x81')]=function(_0xfcc0,_0xe102c,_0x2db532){return db[_0xeabc('0x33')][_0xeabc('0x49')]({'where':{'id':_0xfcc0[_0xeabc('0x52')]['id']}})[_0xeabc('0x28')](handleEntityNotFound(_0xe102c,null))[_0xeabc('0x28')](function(_0x474c8c){if(_0x474c8c){return _0x474c8c['removeAgents'](_0xfcc0['query'][_0xeabc('0x63')])[_0xeabc('0x28')](function(){if(_[_0xeabc('0x85')](_0xfcc0[_0xeabc('0x38')]['ids'])){for(var _0x1cc278=0x0;_0x1cc278<_0xfcc0['query']['ids']['length'];_0x1cc278+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0xfcc0['query'][_0xeabc('0x63')][_0x1cc278]),'SmsQueueId':Number(_0xfcc0[_0xeabc('0x52')]['id'])});}}else{socket[_0xeabc('0x6d')](_0xeabc('0x86'),{'UserId':Number(_0xfcc0[_0xeabc('0x38')][_0xeabc('0x63')]),'SmsQueueId':Number(_0xfcc0[_0xeabc('0x52')]['id'])});}});}})[_0xeabc('0x28')](respondWithStatusCode(_0xe102c,null))[_0xeabc('0x4a')](handleError(_0xe102c,null));};exports['getAgents']=function(_0x3b1f77,_0x10b35b,_0x233412){var _0x3e639b={};var _0x22c141={};var _0x43ef5d;var _0x2a29d7;return db['SmsQueue'][_0xeabc('0x55')]({'where':{'id':_0x3b1f77['params']['id']}})[_0xeabc('0x28')](handleEntityNotFound(_0x10b35b,null))[_0xeabc('0x28')](function(_0x5f3e0a){if(_0x5f3e0a){_0x43ef5d=_0x5f3e0a;_0x22c141[_0xeabc('0x37')]=_['keys'](db[_0xeabc('0x59')][_0xeabc('0x34')]);_0x22c141[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x3b1f77[_0xeabc('0x38')]);_0x22c141[_0xeabc('0x3a')]=_[_0xeabc('0x3b')](_0x22c141[_0xeabc('0x37')],_0x22c141[_0xeabc('0x38')]);_0x3e639b['attributes']=_['intersection'](_0x22c141[_0xeabc('0x37')],qs[_0xeabc('0x3d')](_0x3b1f77['query'][_0xeabc('0x3d')]));_0x3e639b['attributes']=_0x3e639b[_0xeabc('0x3c')][_0xeabc('0x3e')]?_0x3e639b[_0xeabc('0x3c')]:_0x22c141[_0xeabc('0x37')];_0x3e639b[_0xeabc('0x41')]=qs[_0xeabc('0x57')](_0x3b1f77['query'][_0xeabc('0x57')]);_0x3e639b['where']=qs[_0xeabc('0x3a')](_[_0xeabc('0x58')](_0x3b1f77[_0xeabc('0x38')],_0x22c141[_0xeabc('0x3a')]));if(_0x3b1f77['query'][_0xeabc('0x42')]){_0x3e639b[_0xeabc('0x44')]=_[_0xeabc('0x43')](_0x3e639b['where'],{'$or':_[_0xeabc('0x32')](_0x3e639b[_0xeabc('0x3c')],function(_0xf4ebc4){var _0x53dd5c={};_0x53dd5c[_0xf4ebc4]={'$like':'%'+_0x3b1f77['query']['filter']+'%'};return _0x53dd5c;})});}_0x3e639b=_['merge']({},_0x3e639b,_0x3b1f77[_0xeabc('0x48')]);return _0x43ef5d[_0xeabc('0x87')](_0x3e639b);}})['then'](function(_0x12f024){if(_0x12f024){_0x2a29d7=_0x12f024[_0xeabc('0x3e')];if(!_0x3b1f77[_0xeabc('0x38')][_0xeabc('0x88')](_0xeabc('0x3f'))){_0x3e639b[_0xeabc('0x40')]=qs[_0xeabc('0x40')](_0x3b1f77[_0xeabc('0x38')][_0xeabc('0x40')]);_0x3e639b['offset']=qs[_0xeabc('0x22')](_0x3b1f77['query'][_0xeabc('0x22')]);}return _0x43ef5d[_0xeabc('0x87')](_0x3e639b);}})[_0xeabc('0x28')](function(_0xa797a0){if(_0xa797a0){return _0xa797a0?{'count':_0x2a29d7,'rows':_0xa797a0}:null;}})[_0xeabc('0x28')](respondWithResult(_0x10b35b,null))[_0xeabc('0x4a')](handleError(_0x10b35b,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 9ac0b9e..29c162b 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 _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 +var _0x8fa5=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x596f6e,_0x3f8857){var _0x1e0803=function(_0x31f91f){while(--_0x31f91f){_0x596f6e['push'](_0x596f6e['shift']());}};_0x1e0803(++_0x3f8857);}(_0x8fa5,0xb0));var _0x58fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fa5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x58fa('0x0'));var SmsQueue=require(_0x58fa('0x1'))['db'][_0x58fa('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x58fa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x58fa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4ce971){return function(_0x205dec,_0x57c08c,_0x1df75d){SmsQueueEvents['emit'](_0x4ce971+':'+_0x205dec['id'],_0x205dec);SmsQueueEvents[_0x58fa('0x5')](_0x4ce971,_0x205dec);_0x1df75d(null);};}for(var e in events){if(events[_0x58fa('0x6')](e)){var event=events[e];SmsQueue[_0x58fa('0x7')](e,emitEvent(event));}}module[_0x58fa('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 283dab6..e501456 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 _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 +var _0xcada=['sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x3b8cf6,_0x564301){var _0x5bcd64=function(_0x1b81de){while(--_0x1b81de){_0x3b8cf6['push'](_0x3b8cf6['shift']());}};_0x5bcd64(++_0x564301);}(_0xcada,0x139));var _0xacad=function(_0x5728ba,_0x19a31e){_0x5728ba=_0x5728ba-0x0;var _0x2a1831=_0xcada[_0x5728ba];return _0x2a1831;};'use strict';var _=require(_0xacad('0x0'));var util=require('util');var logger=require(_0xacad('0x1'))(_0xacad('0x2'));var moment=require(_0xacad('0x3'));var BPromise=require(_0xacad('0x4'));var rp=require(_0xacad('0x5'));var fs=require('fs');var path=require(_0xacad('0x6'));var rimraf=require(_0xacad('0x7'));var config=require(_0xacad('0x8'));var attributes=require(_0xacad('0x9'));module[_0xacad('0xa')]=function(_0x14b96c,_0x28759d){return _0x14b96c['define']('SmsQueue',attributes,{'tableName':_0xacad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 5eb36ad..5407a2d 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 _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 +var _0x0fa8=['request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SmsQueue','options','raw','attributes','limit','include','map','model','GetSmsQueue','ShowSmsQueue','find','where','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register'];(function(_0x1454e8,_0x1c2159){var _0x4d9869=function(_0x16026b){while(--_0x16026b){_0x1454e8['push'](_0x1454e8['shift']());}};_0x4d9869(++_0x1c2159);}(_0x0fa8,0x1a8));var _0x80fa=function(_0x4c5708,_0x34b1f9){_0x4c5708=_0x4c5708-0x0;var _0x37fa9b=_0x0fa8[_0x4c5708];return _0x37fa9b;};'use strict';var _=require(_0x80fa('0x0'));var util=require(_0x80fa('0x1'));var moment=require(_0x80fa('0x2'));var BPromise=require(_0x80fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x80fa('0x4'));var logger=require(_0x80fa('0x5'))(_0x80fa('0x6'));var config=require(_0x80fa('0x7'));var jayson=require(_0x80fa('0x8'));var client=jayson[_0x80fa('0x9')][_0x80fa('0xa')]({'port':0x232a});config[_0x80fa('0xb')]=_[_0x80fa('0xc')](config[_0x80fa('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x80fa('0xd'))(new Redis(config[_0x80fa('0xb')]));require(_0x80fa('0xe'))[_0x80fa('0xf')](socket);function respondWithRpcPromise(_0x170c50,_0x36875c,_0x29d547){return new BPromise(function(_0x354095,_0x281099){return client[_0x80fa('0x10')](_0x170c50,_0x29d547)[_0x80fa('0x11')](function(_0x5ac320){logger[_0x80fa('0x12')](_0x80fa('0x13'),_0x36875c,'request\x20sent');logger[_0x80fa('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x36875c,_0x80fa('0x15'),JSON[_0x80fa('0x16')](_0x5ac320));if(_0x5ac320['error']){if(_0x5ac320[_0x80fa('0x17')][_0x80fa('0x18')]===0x1f4){logger[_0x80fa('0x17')](_0x80fa('0x13'),_0x36875c,_0x5ac320['error'][_0x80fa('0x19')]);return _0x281099(_0x5ac320[_0x80fa('0x17')][_0x80fa('0x19')]);}logger[_0x80fa('0x17')](_0x80fa('0x13'),_0x36875c,_0x5ac320['error'][_0x80fa('0x19')]);return _0x354095(_0x5ac320[_0x80fa('0x17')][_0x80fa('0x19')]);}else{logger[_0x80fa('0x12')](_0x80fa('0x13'),_0x36875c,_0x80fa('0x15'));_0x354095(_0x5ac320[_0x80fa('0x1a')]['message']);}})[_0x80fa('0x1b')](function(_0x58b659){logger[_0x80fa('0x17')]('SmsQueue,\x20%s,\x20%s',_0x36875c,_0x58b659);_0x281099(_0x58b659);});});}exports['GetSmsQueue']=function(_0x96794f){var _0x454f54=this;return new Promise(function(_0x1842fc,_0x284f6c){return db[_0x80fa('0x1c')]['findAll']({'raw':_0x96794f[_0x80fa('0x1d')]?_0x96794f[_0x80fa('0x1d')][_0x80fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x96794f[_0x80fa('0x1d')]?_0x96794f[_0x80fa('0x1d')]['where']||null:null,'attributes':_0x96794f[_0x80fa('0x1d')]?_0x96794f[_0x80fa('0x1d')][_0x80fa('0x1f')]||null:null,'limit':_0x96794f[_0x80fa('0x1d')]?_0x96794f['options'][_0x80fa('0x20')]||null:null,'include':_0x96794f[_0x80fa('0x1d')]?_0x96794f[_0x80fa('0x1d')][_0x80fa('0x21')]?_[_0x80fa('0x22')](_0x96794f[_0x80fa('0x1d')][_0x80fa('0x21')],function(_0x1bedf4){return{'model':db[_0x1bedf4['model']],'as':_0x1bedf4['as'],'attributes':_0x1bedf4['attributes'],'include':_0x1bedf4[_0x80fa('0x21')]?_['map'](_0x1bedf4['include'],function(_0x504d15){return{'model':db[_0x504d15[_0x80fa('0x23')]],'as':_0x504d15['as'],'attributes':_0x504d15[_0x80fa('0x1f')],'include':_0x504d15[_0x80fa('0x21')]?_[_0x80fa('0x22')](_0x504d15[_0x80fa('0x21')],function(_0x310deb){return{'model':db[_0x310deb[_0x80fa('0x23')]],'as':_0x310deb['as'],'attributes':_0x310deb[_0x80fa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2afae0){logger[_0x80fa('0x12')]('GetSmsQueue',_0x96794f);logger[_0x80fa('0x14')](_0x80fa('0x24'),_0x96794f,JSON['stringify'](_0x2afae0));_0x1842fc(_0x2afae0);})['catch'](function(_0x342b90){logger[_0x80fa('0x17')](_0x80fa('0x24'),_0x342b90[_0x80fa('0x19')],_0x96794f);_0x284f6c(_0x454f54[_0x80fa('0x17')](0x1f4,_0x342b90[_0x80fa('0x19')]));});});};exports[_0x80fa('0x25')]=function(_0x5d5393){var _0x2e9257=this;return new Promise(function(_0x49e4df,_0x5d181c){return db[_0x80fa('0x1c')][_0x80fa('0x26')]({'raw':_0x5d5393['options']?_0x5d5393[_0x80fa('0x1d')][_0x80fa('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d5393[_0x80fa('0x1d')]?_0x5d5393[_0x80fa('0x1d')][_0x80fa('0x27')]||null:null,'attributes':_0x5d5393[_0x80fa('0x1d')]?_0x5d5393[_0x80fa('0x1d')][_0x80fa('0x1f')]||null:null,'include':_0x5d5393[_0x80fa('0x1d')]?_0x5d5393['options']['include']?_[_0x80fa('0x22')](_0x5d5393[_0x80fa('0x1d')][_0x80fa('0x21')],function(_0x488728){return{'model':db[_0x488728[_0x80fa('0x23')]],'as':_0x488728['as'],'attributes':_0x488728['attributes'],'include':_0x488728[_0x80fa('0x21')]?_[_0x80fa('0x22')](_0x488728['include'],function(_0x55a798){return{'model':db[_0x55a798[_0x80fa('0x23')]],'as':_0x55a798['as'],'attributes':_0x55a798[_0x80fa('0x1f')],'include':_0x55a798[_0x80fa('0x21')]?_[_0x80fa('0x22')](_0x55a798[_0x80fa('0x21')],function(_0x153a95){return{'model':db[_0x153a95[_0x80fa('0x23')]],'as':_0x153a95['as'],'attributes':_0x153a95[_0x80fa('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fc426){logger['info'](_0x80fa('0x25'),_0x5d5393);logger[_0x80fa('0x14')]('ShowSmsQueue',_0x5d5393,JSON[_0x80fa('0x16')](_0x1fc426));_0x49e4df(_0x1fc426);})['catch'](function(_0x36b3d0){logger[_0x80fa('0x17')](_0x80fa('0x25'),_0x36b3d0[_0x80fa('0x19')],_0x5d5393);_0x5d181c(_0x2e9257['error'](0x1f4,_0x36b3d0[_0x80fa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 569cc92..731cc02 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 _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 +var _0x2f2a=['./smsQueue.events','save','update','emit','removeListener','register','smsQueue:'];(function(_0x50af86,_0x5ee8ff){var _0x244730=function(_0x5db633){while(--_0x5db633){_0x50af86['push'](_0x50af86['shift']());}};_0x244730(++_0x5ee8ff);}(_0x2f2a,0xee));var _0xa2f2=function(_0x548627,_0x4ec392){_0x548627=_0x548627-0x0;var _0x844a84=_0x2f2a[_0x548627];return _0x844a84;};'use strict';var SmsQueueEvents=require(_0xa2f2('0x0'));var events=[_0xa2f2('0x1'),'remove',_0xa2f2('0x2')];function createListener(_0x495ccf,_0x5ee498){return function(_0x18f259){_0x5ee498[_0xa2f2('0x3')](_0x495ccf,_0x18f259);};}function removeListener(_0x5a7304,_0x11d3a9){return function(){SmsQueueEvents[_0xa2f2('0x4')](_0x5a7304,_0x11d3a9);};}exports[_0xa2f2('0x5')]=function(_0x5513d0){for(var _0x5bb613=0x0,_0x37da5d=events['length'];_0x5bb613<_0x37da5d;_0x5bb613++){var _0x359e95=events[_0x5bb613];var _0x255fbb=createListener(_0xa2f2('0x6')+_0x359e95,_0x5513d0);SmsQueueEvents['on'](_0x359e95,_0x255fbb);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index e0fcc70..b17f083 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 _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 +var _0xd984=['index','describe','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x34dc6e,_0x59f00d){var _0x54fa98=function(_0x573a45){while(--_0x573a45){_0x34dc6e['push'](_0x34dc6e['shift']());}};_0x54fa98(++_0x59f00d);}(_0xd984,0x10e));var _0x4d98=function(_0x46c59b,_0x5635dd){_0x46c59b=_0x46c59b-0x0;var _0x16dd2d=_0xd984[_0x46c59b];return _0x16dd2d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d98('0x0'));var timeout=require(_0x4d98('0x1'));var express=require(_0x4d98('0x2'));var router=express[_0x4d98('0x3')]();var auth=require(_0x4d98('0x4'));var interaction=require(_0x4d98('0x5'));var config=require(_0x4d98('0x6'));var controller=require(_0x4d98('0x7'));router[_0x4d98('0x8')]('/',auth[_0x4d98('0x9')](),controller[_0x4d98('0xa')]);router[_0x4d98('0x8')]('/describe',auth[_0x4d98('0x9')](),controller[_0x4d98('0xb')]);router['get'](_0x4d98('0xc'),auth[_0x4d98('0x9')](),controller[_0x4d98('0xd')]);router[_0x4d98('0xe')]('/',auth[_0x4d98('0x9')](),controller[_0x4d98('0xf')]);router[_0x4d98('0x10')](_0x4d98('0xc'),auth[_0x4d98('0x9')](),controller[_0x4d98('0x11')]);router[_0x4d98('0x12')](_0x4d98('0xc'),auth[_0x4d98('0x9')](),controller['destroy']);module[_0x4d98('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 8c438cc..91db9be 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 _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 +var _0x5e38=['sequelize','DATE'];(function(_0x5a9993,_0x9b6bcf){var _0x3ac610=function(_0xa1885c){while(--_0xa1885c){_0x5a9993['push'](_0x5a9993['shift']());}};_0x3ac610(++_0x9b6bcf);}(_0x5e38,0x138));var _0x85e3=function(_0x1323c8,_0x480c01){_0x1323c8=_0x1323c8-0x0;var _0x4e3add=_0x5e38[_0x1323c8];return _0x4e3add;};'use strict';var moment=require('moment');var Sequelize=require(_0x85e3('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x85e3('0x1')]},'leaveAt':{'type':Sequelize[_0x85e3('0x1')]},'acceptAt':{'type':Sequelize[_0x85e3('0x1')]},'exitAt':{'type':Sequelize[_0x85e3('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 79121c2..f7d0e19 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 _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 +var _0x65da=['moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','SmsQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','show','params','fields','length','includeAll','find','catch','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65da,0xdf));var _0xa65d=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x65da[_0x2d2c16];return _0x53f2fb;};'use strict';var pdf=require(_0xa65d('0x0'));var emlformat=require(_0xa65d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa65d('0x2'));var jsonpatch=require(_0xa65d('0x3'));var rp=require(_0xa65d('0x4'));var moment=require(_0xa65d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa65d('0x6'));var util=require(_0xa65d('0x7'));var path=require(_0xa65d('0x8'));var sox=require(_0xa65d('0x9'));var csv=require(_0xa65d('0xa'));var ejs=require(_0xa65d('0xb'));var fs=require('fs');var _=require(_0xa65d('0xc'));var squel=require(_0xa65d('0xd'));var crypto=require(_0xa65d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa65d('0xa'));var querystring=require('querystring');var Papa=require(_0xa65d('0xf'));var Redis=require('ioredis');var authService=require(_0xa65d('0x10'));var qs=require(_0xa65d('0x11'));var as=require(_0xa65d('0x12'));var hardwareService=require(_0xa65d('0x13'));var logger=require(_0xa65d('0x14'))(_0xa65d('0x15'));var utils=require('../../config/utils');var config=require(_0xa65d('0x16'));var licenseUtil=require(_0xa65d('0x17'));var db=require(_0xa65d('0x18'))['db'];function respondWithStatusCode(_0x48ab0d,_0x5964d0){_0x5964d0=_0x5964d0||0xcc;return function(_0x2066e2){if(_0x2066e2){return _0x48ab0d[_0xa65d('0x19')](_0x5964d0);}return _0x48ab0d[_0xa65d('0x1a')](_0x5964d0)[_0xa65d('0x1b')]();};}function respondWithResult(_0x316287,_0xeec923){_0xeec923=_0xeec923||0xc8;return function(_0x11114e){if(_0x11114e){return _0x316287[_0xa65d('0x1a')](_0xeec923)[_0xa65d('0x1c')](_0x11114e);}};}function respondWithFilteredResult(_0xbbdff5,_0x301189){return function(_0x1a37f5){if(_0x1a37f5){var _0x3db318=_0x1a37f5[_0xa65d('0x1d')],_0x5a17c0=_0x301189[_0xa65d('0x1e')],_0xdb3682=_0x301189[_0xa65d('0x1e')]+_0x301189['limit'],_0x5e0f21;if(_0xdb3682>=_0x3db318){_0xdb3682=_0x3db318;_0x5e0f21=0xc8;}else{_0x5e0f21=0xce;}_0xbbdff5['status'](_0x5e0f21);return _0xbbdff5[_0xa65d('0x1f')](_0xa65d('0x20'),_0x5a17c0+'-'+_0xdb3682+'/'+_0x3db318)['json'](_0x1a37f5);}return null;};}function patchUpdates(_0x3175e2){return function(_0x1030a9){try{jsonpatch[_0xa65d('0x21')](_0x1030a9,_0x3175e2,!![]);}catch(_0x359cb8){return BPromise[_0xa65d('0x22')](_0x359cb8);}return _0x1030a9[_0xa65d('0x23')]();};}function saveUpdates(_0x47a54b,_0x8c4f6b){return function(_0x61d704){if(_0x61d704){return _0x61d704[_0xa65d('0x24')](_0x47a54b)[_0xa65d('0x25')](function(_0x389a0b){return _0x389a0b;});}return null;};}function removeEntity(_0x5e1161,_0x3fdb47){return function(_0x4653b2){if(_0x4653b2){return _0x4653b2[_0xa65d('0x26')]()[_0xa65d('0x25')](function(){_0x5e1161[_0xa65d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bce67,_0x49a1cb){return function(_0x7ae5f3){if(!_0x7ae5f3){_0x2bce67[_0xa65d('0x19')](0x194);}return _0x7ae5f3;};}function handleError(_0x2ddfdf,_0x2d5627){_0x2d5627=_0x2d5627||0x1f4;return function(_0x1dbbe5){logger['error'](_0x1dbbe5[_0xa65d('0x27')]);if(_0x1dbbe5[_0xa65d('0x28')]){delete _0x1dbbe5['name'];}_0x2ddfdf[_0xa65d('0x1a')](_0x2d5627)[_0xa65d('0x29')](_0x1dbbe5);};}exports['index']=function(_0x2f1e5a,_0x49c281){var _0x3254d1={},_0x2a978e={},_0x5121c4={'count':0x0,'rows':[]};var _0x43c43a=_[_0xa65d('0x2a')](db[_0xa65d('0x2b')][_0xa65d('0x2c')],function(_0x5654b4){return{'name':_0x5654b4[_0xa65d('0x2d')],'type':_0x5654b4[_0xa65d('0x2e')][_0xa65d('0x2f')]};});_0x2a978e[_0xa65d('0x30')]=_[_0xa65d('0x2a')](_0x43c43a,_0xa65d('0x28'));_0x2a978e[_0xa65d('0x31')]=_[_0xa65d('0x32')](_0x2f1e5a['query']);_0x2a978e[_0xa65d('0x33')]=_[_0xa65d('0x34')](_0x2a978e[_0xa65d('0x30')],_0x2a978e[_0xa65d('0x31')]);_0x3254d1['attributes']=_[_0xa65d('0x34')](_0x2a978e[_0xa65d('0x30')],qs['fields'](_0x2f1e5a[_0xa65d('0x31')]['fields']));_0x3254d1[_0xa65d('0x35')]=_0x3254d1[_0xa65d('0x35')]['length']?_0x3254d1[_0xa65d('0x35')]:_0x2a978e['model'];if(!_0x2f1e5a['query'][_0xa65d('0x36')](_0xa65d('0x37'))){_0x3254d1[_0xa65d('0x38')]=qs[_0xa65d('0x38')](_0x2f1e5a[_0xa65d('0x31')]['limit']);_0x3254d1[_0xa65d('0x1e')]=qs[_0xa65d('0x1e')](_0x2f1e5a['query'][_0xa65d('0x1e')]);}_0x3254d1[_0xa65d('0x39')]=qs[_0xa65d('0x3a')](_0x2f1e5a[_0xa65d('0x31')][_0xa65d('0x3a')]);_0x3254d1[_0xa65d('0x3b')]=qs[_0xa65d('0x33')](_[_0xa65d('0x3c')](_0x2f1e5a[_0xa65d('0x31')],_0x2a978e['filters']),_0x43c43a);if(_0x2f1e5a[_0xa65d('0x31')][_0xa65d('0x3d')]){_0x3254d1[_0xa65d('0x3b')]=_['merge'](_0x3254d1['where'],{'$or':_[_0xa65d('0x2a')](_0x43c43a,function(_0x1d48f3){if(_0x1d48f3[_0xa65d('0x2e')]!==_0xa65d('0x3e')){var _0x17eb6b={};_0x17eb6b[_0x1d48f3[_0xa65d('0x28')]]={'$like':'%'+_0x2f1e5a[_0xa65d('0x31')][_0xa65d('0x3d')]+'%'};return _0x17eb6b;}})});}_0x3254d1=_[_0xa65d('0x3f')]({},_0x3254d1,_0x2f1e5a[_0xa65d('0x40')]);var _0x486405={'where':_0x3254d1[_0xa65d('0x3b')]};return db[_0xa65d('0x2b')][_0xa65d('0x1d')](_0x486405)[_0xa65d('0x25')](function(_0xb8df79){_0x5121c4[_0xa65d('0x1d')]=_0xb8df79;if(_0x2f1e5a[_0xa65d('0x31')]['includeAll']){_0x3254d1[_0xa65d('0x41')]=[{'all':!![]}];}return db[_0xa65d('0x2b')]['findAll'](_0x3254d1);})[_0xa65d('0x25')](function(_0x3c146f){_0x5121c4['rows']=_0x3c146f;return _0x5121c4;})['then'](respondWithFilteredResult(_0x49c281,_0x3254d1))['catch'](handleError(_0x49c281,null));};exports[_0xa65d('0x42')]=function(_0x102adf,_0x19966b){var _0x5db86a={'raw':!![],'where':{'id':_0x102adf[_0xa65d('0x43')]['id']}},_0x1c4fe5={};_0x1c4fe5[_0xa65d('0x30')]=_['keys'](db[_0xa65d('0x2b')][_0xa65d('0x2c')]);_0x1c4fe5[_0xa65d('0x31')]=_['keys'](_0x102adf[_0xa65d('0x31')]);_0x1c4fe5[_0xa65d('0x33')]=_['intersection'](_0x1c4fe5['model'],_0x1c4fe5[_0xa65d('0x31')]);_0x5db86a[_0xa65d('0x35')]=_[_0xa65d('0x34')](_0x1c4fe5[_0xa65d('0x30')],qs[_0xa65d('0x44')](_0x102adf[_0xa65d('0x31')][_0xa65d('0x44')]));_0x5db86a[_0xa65d('0x35')]=_0x5db86a['attributes'][_0xa65d('0x45')]?_0x5db86a[_0xa65d('0x35')]:_0x1c4fe5['model'];if(_0x102adf[_0xa65d('0x31')][_0xa65d('0x46')]){_0x5db86a[_0xa65d('0x41')]=[{'all':!![]}];}_0x5db86a=_[_0xa65d('0x3f')]({},_0x5db86a,_0x102adf[_0xa65d('0x40')]);return db[_0xa65d('0x2b')][_0xa65d('0x47')](_0x5db86a)['then'](handleEntityNotFound(_0x19966b,null))[_0xa65d('0x25')](respondWithResult(_0x19966b,null))[_0xa65d('0x48')](handleError(_0x19966b,null));};exports[_0xa65d('0x49')]=function(_0x55d405,_0x4198d3){return db[_0xa65d('0x2b')][_0xa65d('0x49')](_0x55d405['body'],{})['then'](respondWithResult(_0x4198d3,0xc9))['catch'](handleError(_0x4198d3,null));};exports[_0xa65d('0x24')]=function(_0xcd2375,_0x2f4986){if(_0xcd2375[_0xa65d('0x4a')]['id']){delete _0xcd2375[_0xa65d('0x4a')]['id'];}return db[_0xa65d('0x2b')][_0xa65d('0x47')]({'where':{'id':_0xcd2375[_0xa65d('0x43')]['id']}})[_0xa65d('0x25')](handleEntityNotFound(_0x2f4986,null))[_0xa65d('0x25')](saveUpdates(_0xcd2375[_0xa65d('0x4a')],null))[_0xa65d('0x25')](respondWithResult(_0x2f4986,null))[_0xa65d('0x48')](handleError(_0x2f4986,null));};exports[_0xa65d('0x26')]=function(_0x5b3a51,_0x38f2ad){return db[_0xa65d('0x2b')][_0xa65d('0x47')]({'where':{'id':_0x5b3a51['params']['id']}})[_0xa65d('0x25')](handleEntityNotFound(_0x38f2ad,null))['then'](removeEntity(_0x38f2ad,null))[_0xa65d('0x48')](handleError(_0x38f2ad,null));};exports[_0xa65d('0x4b')]=function(_0x40c0f0,_0x258976){return db[_0xa65d('0x2b')][_0xa65d('0x4b')]()['then'](respondWithResult(_0x258976,null))[_0xa65d('0x48')](handleError(_0x258976,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index d914eb0..f7ca89a 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 _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 +var _0x2391=['define','SmsQueueReport','uniqueid','../../config/logger','api','moment','request-promise','path','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x144dc3,_0x3f399f){var _0xad1dcd=function(_0x528ce8){while(--_0x528ce8){_0x144dc3['push'](_0x144dc3['shift']());}};_0xad1dcd(++_0x3f399f);}(_0x2391,0xc9));var _0x1239=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2391[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1239('0x0'))(_0x1239('0x1'));var moment=require(_0x1239('0x2'));var BPromise=require('bluebird');var rp=require(_0x1239('0x3'));var fs=require('fs');var path=require(_0x1239('0x4'));var rimraf=require('rimraf');var config=require(_0x1239('0x5'));var attributes=require(_0x1239('0x6'));module[_0x1239('0x7')]=function(_0x4c05e2,_0x9d510d){return _0x4c05e2[_0x1239('0x8')](_0x1239('0x9'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x1239('0xa'),'fields':[_0x1239('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c978885..9f21f2d 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 _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 +var _0xe465=['request','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','update','attributes','limit','UpdateSmsQueueReport','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x542d4f,_0x278cb4){var _0x135f28=function(_0x17ffbb){while(--_0x17ffbb){_0x542d4f['push'](_0x542d4f['shift']());}};_0x135f28(++_0x278cb4);}(_0xe465,0x117));var _0x5e46=function(_0x246f55,_0xc9af01){_0x246f55=_0x246f55-0x0;var _0xf54324=_0xe465[_0x246f55];return _0xf54324;};'use strict';var _=require('lodash');var util=require(_0x5e46('0x0'));var moment=require(_0x5e46('0x1'));var BPromise=require('bluebird');var rs=require(_0x5e46('0x2'));var fs=require('fs');var Redis=require(_0x5e46('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e46('0x4'));var logger=require(_0x5e46('0x5'))('rpc');var config=require(_0x5e46('0x6'));var jayson=require(_0x5e46('0x7'));var client=jayson[_0x5e46('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x504e75,_0x441607,_0x3fd18e){return new BPromise(function(_0x397dea,_0xd1727c){return client[_0x5e46('0x9')](_0x504e75,_0x3fd18e)[_0x5e46('0xa')](function(_0x25d5d1){logger[_0x5e46('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x441607,_0x5e46('0xc'));logger[_0x5e46('0xd')](_0x5e46('0xe'),_0x441607,_0x5e46('0xc'),JSON[_0x5e46('0xf')](_0x25d5d1));if(_0x25d5d1['error']){if(_0x25d5d1[_0x5e46('0x10')][_0x5e46('0x11')]===0x1f4){logger[_0x5e46('0x10')](_0x5e46('0x12'),_0x441607,_0x25d5d1[_0x5e46('0x10')][_0x5e46('0x13')]);return _0xd1727c(_0x25d5d1[_0x5e46('0x10')][_0x5e46('0x13')]);}logger['error'](_0x5e46('0x12'),_0x441607,_0x25d5d1[_0x5e46('0x10')][_0x5e46('0x13')]);return _0x397dea(_0x25d5d1[_0x5e46('0x10')]['message']);}else{logger[_0x5e46('0xb')](_0x5e46('0x12'),_0x441607,_0x5e46('0xc'));_0x397dea(_0x25d5d1[_0x5e46('0x14')][_0x5e46('0x13')]);}})[_0x5e46('0x15')](function(_0x46a1af){logger[_0x5e46('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x441607,_0x46a1af);_0xd1727c(_0x46a1af);});});}exports[_0x5e46('0x16')]=function(_0x1f6ff2){var _0x5f01a0=this;return new Promise(function(_0x1b62c9,_0x1f1efd){return db[_0x5e46('0x17')][_0x5e46('0x18')](_0x1f6ff2[_0x5e46('0x19')],{'raw':_0x1f6ff2[_0x5e46('0x1a')]?_0x1f6ff2[_0x5e46('0x1a')][_0x5e46('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x36de86){logger[_0x5e46('0xb')]('CreateSmsQueueReport',_0x1f6ff2);logger['debug'](_0x5e46('0x16'),_0x1f6ff2,JSON[_0x5e46('0xf')](_0x36de86));_0x1b62c9(_0x36de86);})['catch'](function(_0xbcdcfb){logger[_0x5e46('0x10')]('CreateSmsQueueReport',_0xbcdcfb[_0x5e46('0x13')],_0x1f6ff2);_0x1f1efd(_0x5f01a0[_0x5e46('0x10')](0x1f4,_0xbcdcfb[_0x5e46('0x13')]));});});};exports['UpdateSmsQueueReport']=function(_0x2afa39){var _0x206c81=this;return new Promise(function(_0x51f5c7,_0x4d3583){return db[_0x5e46('0x17')][_0x5e46('0x1c')](_0x2afa39[_0x5e46('0x19')],{'raw':_0x2afa39[_0x5e46('0x1a')]?_0x2afa39[_0x5e46('0x1a')][_0x5e46('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2afa39[_0x5e46('0x1a')]?_0x2afa39[_0x5e46('0x1a')]['where']||null:null,'attributes':_0x2afa39[_0x5e46('0x1a')]?_0x2afa39[_0x5e46('0x1a')][_0x5e46('0x1d')]||null:null,'limit':_0x2afa39['options']?_0x2afa39[_0x5e46('0x1a')][_0x5e46('0x1e')]||null:null})[_0x5e46('0xa')](function(_0x3e44c0){logger['info'](_0x5e46('0x1f'),_0x2afa39);logger[_0x5e46('0xd')](_0x5e46('0x1f'),_0x2afa39,JSON[_0x5e46('0xf')](_0x3e44c0));_0x51f5c7(_0x3e44c0);})[_0x5e46('0x15')](function(_0x51c325){logger[_0x5e46('0x10')]('UpdateSmsQueueReport',_0x51c325[_0x5e46('0x13')],_0x2afa39);_0x4d3583(_0x206c81[_0x5e46('0x10')](0x1f4,_0x51c325[_0x5e46('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index a93815a..995c4f4 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 _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 +var _0xf4f4=['Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x109ba4,_0x5d9f){var _0x2b9a70=function(_0x22cadd){while(--_0x22cadd){_0x109ba4['push'](_0x109ba4['shift']());}};_0x2b9a70(++_0x5d9f);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x39ec3b,_0x5bf9a8){_0x39ec3b=_0x39ec3b-0x0;var _0x3287b4=_0xf4f4[_0x39ec3b];return _0x3287b4;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')]('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x12')]);router['delete']('/:id',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);module[_0x4f4f('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index c589365..9a3d7ed 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 _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 +var _0x8a5c=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x8a5c,0x1e4));var _0xc8a5=function(_0x150b48,_0x5b0cb2){_0x150b48=_0x150b48-0x0;var _0x8de468=_0x8a5c[_0x150b48];return _0x8de468;};'use strict';var moment=require(_0xc8a5('0x0'));var Sequelize=require(_0xc8a5('0x1'));module[_0xc8a5('0x2')]={'uniqueid':{'type':Sequelize[_0xc8a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc8a5('0x4')](_0xc8a5('0x5'),_0xc8a5('0x6'),_0xc8a5('0x7')),'allowNull':![],'defaultValue':_0xc8a5('0x7')},'transferredAt':{'type':Sequelize[_0xc8a5('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xc8a5('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b81f8cb..224b405 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 _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 +var _0x2bbb=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','SmsTransferReport','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','options','includeAll','findAll','rawAttributes','include','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x358f34,_0x36c28c){var _0x215806=function(_0xad9ca6){while(--_0xad9ca6){_0x358f34['push'](_0x358f34['shift']());}};_0x215806(++_0x36c28c);}(_0x2bbb,0x85));var _0xb2bb=function(_0x3a3019,_0x318c3e){_0x3a3019=_0x3a3019-0x0;var _0x57f721=_0x2bbb[_0x3a3019];return _0x57f721;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb2bb('0x0'));var rimraf=require(_0xb2bb('0x1'));var zipdir=require(_0xb2bb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb2bb('0x3'));var moment=require(_0xb2bb('0x4'));var BPromise=require(_0xb2bb('0x5'));var Mustache=require(_0xb2bb('0x6'));var util=require(_0xb2bb('0x7'));var path=require(_0xb2bb('0x8'));var sox=require('sox');var csv=require(_0xb2bb('0x9'));var ejs=require(_0xb2bb('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb2bb('0xb'));var crypto=require(_0xb2bb('0xc'));var jsforce=require(_0xb2bb('0xd'));var deskjs=require(_0xb2bb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb2bb('0xf'));var Papa=require('papaparse');var Redis=require(_0xb2bb('0x10'));var authService=require(_0xb2bb('0x11'));var qs=require(_0xb2bb('0x12'));var as=require(_0xb2bb('0x13'));var hardwareService=require(_0xb2bb('0x14'));var logger=require('../../config/logger')(_0xb2bb('0x15'));var utils=require('../../config/utils');var config=require(_0xb2bb('0x16'));var licenseUtil=require(_0xb2bb('0x17'));var db=require(_0xb2bb('0x18'))['db'];function respondWithStatusCode(_0x43950f,_0x38ea15){_0x38ea15=_0x38ea15||0xcc;return function(_0x14c05e){if(_0x14c05e){return _0x43950f['sendStatus'](_0x38ea15);}return _0x43950f[_0xb2bb('0x19')](_0x38ea15)[_0xb2bb('0x1a')]();};}function respondWithResult(_0x332903,_0x2905e2){_0x2905e2=_0x2905e2||0xc8;return function(_0x50a32e){if(_0x50a32e){return _0x332903[_0xb2bb('0x19')](_0x2905e2)[_0xb2bb('0x1b')](_0x50a32e);}};}function respondWithFilteredResult(_0x3bb017,_0x28b73c){return function(_0x367c6f){if(_0x367c6f){var _0x48d630=_0x367c6f[_0xb2bb('0x1c')],_0x1a46eb=_0x28b73c[_0xb2bb('0x1d')],_0x306a87=_0x28b73c[_0xb2bb('0x1d')]+_0x28b73c[_0xb2bb('0x1e')],_0xa9bbcd;if(_0x306a87>=_0x48d630){_0x306a87=_0x48d630;_0xa9bbcd=0xc8;}else{_0xa9bbcd=0xce;}_0x3bb017[_0xb2bb('0x19')](_0xa9bbcd);return _0x3bb017[_0xb2bb('0x1f')](_0xb2bb('0x20'),_0x1a46eb+'-'+_0x306a87+'/'+_0x48d630)[_0xb2bb('0x1b')](_0x367c6f);}return null;};}function patchUpdates(_0xd60546){return function(_0x5e8d6a){try{jsonpatch[_0xb2bb('0x21')](_0x5e8d6a,_0xd60546,!![]);}catch(_0x5eaa96){return BPromise[_0xb2bb('0x22')](_0x5eaa96);}return _0x5e8d6a['save']();};}function saveUpdates(_0x3e7028,_0x8f37d9){return function(_0x4a8df1){if(_0x4a8df1){return _0x4a8df1[_0xb2bb('0x23')](_0x3e7028)[_0xb2bb('0x24')](function(_0x4877d5){return _0x4877d5;});}return null;};}function removeEntity(_0x5ab483,_0x4a428f){return function(_0x2f1e0f){if(_0x2f1e0f){return _0x2f1e0f[_0xb2bb('0x25')]()[_0xb2bb('0x24')](function(){_0x5ab483['status'](0xcc)[_0xb2bb('0x1a')]();});}};}function handleEntityNotFound(_0x2b1f94,_0x250c3f){return function(_0x52c3c7){if(!_0x52c3c7){_0x2b1f94[_0xb2bb('0x26')](0x194);}return _0x52c3c7;};}function handleError(_0x962b0a,_0x32a336){_0x32a336=_0x32a336||0x1f4;return function(_0x14aba5){logger['error'](_0x14aba5[_0xb2bb('0x27')]);if(_0x14aba5[_0xb2bb('0x28')]){delete _0x14aba5[_0xb2bb('0x28')];}_0x962b0a['status'](_0x32a336)[_0xb2bb('0x29')](_0x14aba5);};}exports[_0xb2bb('0x2a')]=function(_0x400fff,_0x35949b){var _0x149ab2={},_0x2da423={},_0x4a1b3d={'count':0x0,'rows':[]};var _0x279baa=_['map'](db[_0xb2bb('0x2b')]['rawAttributes'],function(_0x3d82c8){return{'name':_0x3d82c8[_0xb2bb('0x2c')],'type':_0x3d82c8['type'][_0xb2bb('0x2d')]};});_0x2da423['model']=_[_0xb2bb('0x2e')](_0x279baa,_0xb2bb('0x28'));_0x2da423['query']=_[_0xb2bb('0x2f')](_0x400fff[_0xb2bb('0x30')]);_0x2da423[_0xb2bb('0x31')]=_[_0xb2bb('0x32')](_0x2da423[_0xb2bb('0x33')],_0x2da423[_0xb2bb('0x30')]);_0x149ab2[_0xb2bb('0x34')]=_[_0xb2bb('0x32')](_0x2da423[_0xb2bb('0x33')],qs[_0xb2bb('0x35')](_0x400fff[_0xb2bb('0x30')]['fields']));_0x149ab2[_0xb2bb('0x34')]=_0x149ab2[_0xb2bb('0x34')][_0xb2bb('0x36')]?_0x149ab2[_0xb2bb('0x34')]:_0x2da423[_0xb2bb('0x33')];if(!_0x400fff['query'][_0xb2bb('0x37')](_0xb2bb('0x38'))){_0x149ab2[_0xb2bb('0x1e')]=qs[_0xb2bb('0x1e')](_0x400fff[_0xb2bb('0x30')]['limit']);_0x149ab2['offset']=qs[_0xb2bb('0x1d')](_0x400fff[_0xb2bb('0x30')]['offset']);}_0x149ab2[_0xb2bb('0x39')]=qs[_0xb2bb('0x3a')](_0x400fff['query'][_0xb2bb('0x3a')]);_0x149ab2['where']=qs[_0xb2bb('0x31')](_[_0xb2bb('0x3b')](_0x400fff['query'],_0x2da423[_0xb2bb('0x31')]),_0x279baa);if(_0x400fff[_0xb2bb('0x30')][_0xb2bb('0x3c')]){_0x149ab2[_0xb2bb('0x3d')]=_['merge'](_0x149ab2[_0xb2bb('0x3d')],{'$or':_[_0xb2bb('0x2e')](_0x279baa,function(_0x6d068b){if(_0x6d068b[_0xb2bb('0x3e')]!==_0xb2bb('0x3f')){var _0x2fca9d={};_0x2fca9d[_0x6d068b[_0xb2bb('0x28')]]={'$like':'%'+_0x400fff[_0xb2bb('0x30')][_0xb2bb('0x3c')]+'%'};return _0x2fca9d;}})});}_0x149ab2=_['merge']({},_0x149ab2,_0x400fff[_0xb2bb('0x40')]);var _0x3e1ab8={'where':_0x149ab2[_0xb2bb('0x3d')]};return db[_0xb2bb('0x2b')][_0xb2bb('0x1c')](_0x3e1ab8)[_0xb2bb('0x24')](function(_0x397589){_0x4a1b3d[_0xb2bb('0x1c')]=_0x397589;if(_0x400fff['query'][_0xb2bb('0x41')]){_0x149ab2['include']=[{'all':!![]}];}return db[_0xb2bb('0x2b')][_0xb2bb('0x42')](_0x149ab2);})[_0xb2bb('0x24')](function(_0x32096c){_0x4a1b3d['rows']=_0x32096c;return _0x4a1b3d;})[_0xb2bb('0x24')](respondWithFilteredResult(_0x35949b,_0x149ab2))['catch'](handleError(_0x35949b,null));};exports['show']=function(_0x1352ee,_0x51c19b){var _0x17db4f={'raw':!![],'where':{'id':_0x1352ee['params']['id']}},_0x5ed58c={};_0x5ed58c['model']=_[_0xb2bb('0x2f')](db[_0xb2bb('0x2b')][_0xb2bb('0x43')]);_0x5ed58c['query']=_['keys'](_0x1352ee[_0xb2bb('0x30')]);_0x5ed58c[_0xb2bb('0x31')]=_['intersection'](_0x5ed58c[_0xb2bb('0x33')],_0x5ed58c[_0xb2bb('0x30')]);_0x17db4f['attributes']=_[_0xb2bb('0x32')](_0x5ed58c[_0xb2bb('0x33')],qs['fields'](_0x1352ee['query'][_0xb2bb('0x35')]));_0x17db4f[_0xb2bb('0x34')]=_0x17db4f[_0xb2bb('0x34')][_0xb2bb('0x36')]?_0x17db4f['attributes']:_0x5ed58c[_0xb2bb('0x33')];if(_0x1352ee[_0xb2bb('0x30')][_0xb2bb('0x41')]){_0x17db4f[_0xb2bb('0x44')]=[{'all':!![]}];}_0x17db4f=_[_0xb2bb('0x45')]({},_0x17db4f,_0x1352ee[_0xb2bb('0x40')]);return db['SmsTransferReport'][_0xb2bb('0x46')](_0x17db4f)['then'](handleEntityNotFound(_0x51c19b,null))[_0xb2bb('0x24')](respondWithResult(_0x51c19b,null))[_0xb2bb('0x47')](handleError(_0x51c19b,null));};exports[_0xb2bb('0x48')]=function(_0x1cadb5,_0x9fb0fb){return db[_0xb2bb('0x2b')][_0xb2bb('0x48')](_0x1cadb5[_0xb2bb('0x49')],{})['then'](respondWithResult(_0x9fb0fb,0xc9))[_0xb2bb('0x47')](handleError(_0x9fb0fb,null));};exports['update']=function(_0x1d873c,_0x42f202){if(_0x1d873c[_0xb2bb('0x49')]['id']){delete _0x1d873c['body']['id'];}return db[_0xb2bb('0x2b')][_0xb2bb('0x46')]({'where':{'id':_0x1d873c['params']['id']}})['then'](handleEntityNotFound(_0x42f202,null))['then'](saveUpdates(_0x1d873c[_0xb2bb('0x49')],null))['then'](respondWithResult(_0x42f202,null))[_0xb2bb('0x47')](handleError(_0x42f202,null));};exports[_0xb2bb('0x25')]=function(_0x5f351e,_0x141b0b){return db[_0xb2bb('0x2b')][_0xb2bb('0x46')]({'where':{'id':_0x5f351e[_0xb2bb('0x4a')]['id']}})[_0xb2bb('0x24')](handleEntityNotFound(_0x141b0b,null))[_0xb2bb('0x24')](removeEntity(_0x141b0b,null))[_0xb2bb('0x47')](handleError(_0x141b0b,null));};exports['describe']=function(_0x2d498c,_0x105359){return db[_0xb2bb('0x2b')][_0xb2bb('0x4b')]()['then'](respondWithResult(_0x105359,null))[_0xb2bb('0x47')](handleError(_0x105359,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 6114274..a6c95ca 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 _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 +var _0x7278=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x232cf2,_0x4ffb79){var _0x463cec=function(_0x581b60){while(--_0x581b60){_0x232cf2['push'](_0x232cf2['shift']());}};_0x463cec(++_0x4ffb79);}(_0x7278,0x161));var _0x8727=function(_0x4b099d,_0x2dc977){_0x4b099d=_0x4b099d-0x0;var _0x24fdf6=_0x7278[_0x4b099d];return _0x24fdf6;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[{'name':_0x8727('0xe'),'fields':[_0x8727('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 244cd8d..31cc3c7 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 _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 +var _0xcfb7=['http','then','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x301eae,_0x346b6a){var _0xaa9f98=function(_0x574ece){while(--_0x574ece){_0x301eae['push'](_0x301eae['shift']());}};_0xaa9f98(++_0x346b6a);}(_0xcfb7,0x19c));var _0x7cfb=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xcfb7[_0x432682];return _0x463d05;};'use strict';var _=require(_0x7cfb('0x0'));var util=require(_0x7cfb('0x1'));var moment=require(_0x7cfb('0x2'));var BPromise=require(_0x7cfb('0x3'));var rs=require(_0x7cfb('0x4'));var fs=require('fs');var Redis=require(_0x7cfb('0x5'));var db=require(_0x7cfb('0x6'))['db'];var utils=require(_0x7cfb('0x7'));var logger=require(_0x7cfb('0x8'))(_0x7cfb('0x9'));var config=require(_0x7cfb('0xa'));var jayson=require(_0x7cfb('0xb'));var client=jayson[_0x7cfb('0xc')][_0x7cfb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x35551a,_0x3d49c2,_0x2dc68c){return new BPromise(function(_0x1055c5,_0x9d57b6){return client['request'](_0x35551a,_0x2dc68c)[_0x7cfb('0xe')](function(_0x5b23c9){logger[_0x7cfb('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x3d49c2,_0x7cfb('0x10'));logger[_0x7cfb('0x11')](_0x7cfb('0x12'),_0x3d49c2,_0x7cfb('0x10'),JSON[_0x7cfb('0x13')](_0x5b23c9));if(_0x5b23c9['error']){if(_0x5b23c9[_0x7cfb('0x14')][_0x7cfb('0x15')]===0x1f4){logger[_0x7cfb('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x3d49c2,_0x5b23c9[_0x7cfb('0x14')]['message']);return _0x9d57b6(_0x5b23c9[_0x7cfb('0x14')]['message']);}logger[_0x7cfb('0x14')](_0x7cfb('0x16'),_0x3d49c2,_0x5b23c9['error'][_0x7cfb('0x17')]);return _0x1055c5(_0x5b23c9['error'][_0x7cfb('0x17')]);}else{logger['info'](_0x7cfb('0x16'),_0x3d49c2,_0x7cfb('0x10'));_0x1055c5(_0x5b23c9['result'][_0x7cfb('0x17')]);}})[_0x7cfb('0x18')](function(_0x58b462){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x3d49c2,_0x58b462);_0x9d57b6(_0x58b462);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ca9899c..b3ba4b0 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 _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 +var _0x9a30=['../../components/auth/service','../../config/environment','./sound.controller','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','multer','util','path','express'];(function(_0x3a6855,_0x218967){var _0x5505fc=function(_0x1035c4){while(--_0x1035c4){_0x3a6855['push'](_0x3a6855['shift']());}};_0x5505fc(++_0x218967);}(_0x9a30,0x170));var _0x09a3=function(_0x29b46e,_0x1c9b92){_0x29b46e=_0x29b46e-0x0;var _0x477532=_0x9a30[_0x29b46e];return _0x477532;};'use strict';var multer=require(_0x09a3('0x0'));var util=require(_0x09a3('0x1'));var path=require(_0x09a3('0x2'));var timeout=require('connect-timeout');var express=require(_0x09a3('0x3'));var router=express['Router']();var auth=require(_0x09a3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x09a3('0x5'));var controller=require(_0x09a3('0x6'));router['get']('/',auth[_0x09a3('0x7')](),controller[_0x09a3('0x8')]);router['get'](_0x09a3('0x9'),auth['isAuthenticated'](),controller[_0x09a3('0xa')]);router['get'](_0x09a3('0xb'),auth[_0x09a3('0x7')](),controller[_0x09a3('0xc')]);var upload=multer({'storage':multer[_0x09a3('0xd')]({'destination':function(_0x50fd9d,_0x45c222,_0x12ca2f){_0x12ca2f(null,path[_0x09a3('0xe')](config['root'],_0x09a3('0xf')));},'filename':function(_0x42c627,_0x4a1a9c,_0x23dc8d){_0x4a1a9c[_0x09a3('0x10')]=_0x4a1a9c['originalname'][_0x09a3('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23dc8d(null,util[_0x09a3('0x12')](_0x09a3('0x13'),path[_0x09a3('0x14')](_0x4a1a9c['originalname'],path[_0x09a3('0x15')](_0x4a1a9c[_0x09a3('0x10')])),Date[_0x09a3('0x16')](),path[_0x09a3('0x15')](_0x4a1a9c['originalname'])));}})});router[_0x09a3('0x17')]('/',upload[_0x09a3('0x18')](_0x09a3('0x19')),controller[_0x09a3('0x1a')]);router[_0x09a3('0x1b')](_0x09a3('0x9'),auth['isAuthenticated'](),controller[_0x09a3('0x1c')]);router['delete'](_0x09a3('0x9'),auth[_0x09a3('0x7')](),controller[_0x09a3('0x1d')]);module[_0x09a3('0x1e')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index fe176d7..72a37f0 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 _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 +var _0x7847=['BIGINT','INTEGER','FLOAT','exports','STRING'];(function(_0x31b103,_0x2ecb91){var _0x5812e0=function(_0x58f936){while(--_0x58f936){_0x31b103['push'](_0x31b103['shift']());}};_0x5812e0(++_0x2ecb91);}(_0x7847,0x116));var _0x7784=function(_0x20ceec,_0x5d61e6){_0x20ceec=_0x20ceec-0x0;var _0x567ceb=_0x7847[_0x20ceec];return _0x567ceb;};'use strict';var Sequelize=require('sequelize');module[_0x7784('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x7784('0x1')]},'display_name':{'type':Sequelize[_0x7784('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7784('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x7784('0x2')]},'original_channelCount':{'type':Sequelize[_0x7784('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7784('0x1')]},'converted_duration':{'type':Sequelize[_0x7784('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7784('0x2')]},'converted_channelCount':{'type':Sequelize[_0x7784('0x3')]},'converted_bitRate':{'type':Sequelize[_0x7784('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x7784('0x3')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 5d4123b..ead0601 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 _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 +var _0x8017=['params','length','find','catch','download','save_name','existsSync','join','root','converted_format','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','0777','transcode','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','chmodSync','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Sounds','autoAssociation','delete','original_format','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','end','error','send','index','map','rawAttributes','fieldName','type','name','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','show'];(function(_0x2118ad,_0xe8e3fd){var _0x4b5715=function(_0x399f72){while(--_0x399f72){_0x2118ad['push'](_0x2118ad['shift']());}};_0x4b5715(++_0xe8e3fd);}(_0x8017,0xae));var _0x7801=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0x8017[_0x4afac5];return _0x2404b3;};'use strict';var pdf=require(_0x7801('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7801('0x1'));var zipdir=require(_0x7801('0x2'));var jsonpatch=require(_0x7801('0x3'));var rp=require(_0x7801('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7801('0x5'));var util=require(_0x7801('0x6'));var path=require(_0x7801('0x7'));var sox=require(_0x7801('0x8'));var csv=require(_0x7801('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7801('0xa'));var squel=require(_0x7801('0xb'));var crypto=require(_0x7801('0xc'));var jsforce=require(_0x7801('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7801('0x9'));var querystring=require(_0x7801('0xe'));var Papa=require(_0x7801('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7801('0x10'));var hardwareService=require(_0x7801('0x11'));var logger=require(_0x7801('0x12'))(_0x7801('0x13'));var utils=require(_0x7801('0x14'));var config=require(_0x7801('0x15'));var licenseUtil=require(_0x7801('0x16'));var db=require(_0x7801('0x17'))['db'];function respondWithStatusCode(_0x509709,_0x36d6be){_0x36d6be=_0x36d6be||0xcc;return function(_0x18cca4){if(_0x18cca4){return _0x509709[_0x7801('0x18')](_0x36d6be);}return _0x509709[_0x7801('0x19')](_0x36d6be)['end']();};}function respondWithResult(_0x43455e,_0x5c06ed){_0x5c06ed=_0x5c06ed||0xc8;return function(_0x3f87d9){if(_0x3f87d9){return _0x43455e['status'](_0x5c06ed)[_0x7801('0x1a')](_0x3f87d9);}};}function respondWithFilteredResult(_0x16747f,_0x4f0d72){return function(_0x4a0e6c){if(_0x4a0e6c){var _0x12e43c=_0x4a0e6c[_0x7801('0x1b')],_0x22a60d=_0x4f0d72[_0x7801('0x1c')],_0x7d2d0c=_0x4f0d72[_0x7801('0x1c')]+_0x4f0d72[_0x7801('0x1d')],_0x4757c6;if(_0x7d2d0c>=_0x12e43c){_0x7d2d0c=_0x12e43c;_0x4757c6=0xc8;}else{_0x4757c6=0xce;}_0x16747f['status'](_0x4757c6);return _0x16747f[_0x7801('0x1e')](_0x7801('0x1f'),_0x22a60d+'-'+_0x7d2d0c+'/'+_0x12e43c)[_0x7801('0x1a')](_0x4a0e6c);}return null;};}function patchUpdates(_0x40f2cb){return function(_0x5efd04){try{jsonpatch[_0x7801('0x20')](_0x5efd04,_0x40f2cb,!![]);}catch(_0x5afa3d){return BPromise['reject'](_0x5afa3d);}return _0x5efd04[_0x7801('0x21')]();};}function saveUpdates(_0x16d308,_0x1e1c10){return function(_0x52b5d3){if(_0x52b5d3){return _0x52b5d3[_0x7801('0x22')](_0x16d308)[_0x7801('0x23')](function(_0xb00a9b){return _0xb00a9b;});}return null;};}function removeEntity(_0x4ceb93,_0x3a7682){return function(_0x595080){if(_0x595080){return _0x595080[_0x7801('0x24')]()[_0x7801('0x23')](function(){var _0x57a7c3=_0x595080[_0x7801('0x25')]({'plain':!![]});var _0x5ddd34='Sounds';return db[_0x7801('0x26')]['destroy']({'where':{'type':_0x5ddd34,'resourceId':_0x57a7c3['id']}})[_0x7801('0x23')](function(){return _0x595080;});})[_0x7801('0x23')](function(){_0x4ceb93['status'](0xcc)[_0x7801('0x27')]();});}};}function handleEntityNotFound(_0x134adc,_0x43c445){return function(_0x1eb0f7){if(!_0x1eb0f7){_0x134adc['sendStatus'](0x194);}return _0x1eb0f7;};}function handleError(_0x34a93a,_0x5a5c68){_0x5a5c68=_0x5a5c68||0x1f4;return function(_0x5005f1){logger[_0x7801('0x28')](_0x5005f1['stack']);if(_0x5005f1['name']){delete _0x5005f1['name'];}_0x34a93a[_0x7801('0x19')](_0x5a5c68)[_0x7801('0x29')](_0x5005f1);};}exports[_0x7801('0x2a')]=function(_0x1dd73c,_0x31ab72){var _0x246b44={},_0x45be76={},_0x1f1cb1={'count':0x0,'rows':[]};var _0xc6a69b=_[_0x7801('0x2b')](db['Sound'][_0x7801('0x2c')],function(_0x50aa34){return{'name':_0x50aa34[_0x7801('0x2d')],'type':_0x50aa34[_0x7801('0x2e')]['key']};});_0x45be76['model']=_[_0x7801('0x2b')](_0xc6a69b,_0x7801('0x2f'));_0x45be76['query']=_[_0x7801('0x30')](_0x1dd73c[_0x7801('0x31')]);_0x45be76[_0x7801('0x32')]=_[_0x7801('0x33')](_0x45be76[_0x7801('0x34')],_0x45be76['query']);_0x246b44[_0x7801('0x35')]=_['intersection'](_0x45be76[_0x7801('0x34')],qs[_0x7801('0x36')](_0x1dd73c[_0x7801('0x31')]['fields']));_0x246b44[_0x7801('0x35')]=_0x246b44['attributes']['length']?_0x246b44['attributes']:_0x45be76[_0x7801('0x34')];if(!_0x1dd73c[_0x7801('0x31')][_0x7801('0x37')](_0x7801('0x38'))){_0x246b44[_0x7801('0x1d')]=qs[_0x7801('0x1d')](_0x1dd73c[_0x7801('0x31')][_0x7801('0x1d')]);_0x246b44[_0x7801('0x1c')]=qs[_0x7801('0x1c')](_0x1dd73c['query'][_0x7801('0x1c')]);}_0x246b44[_0x7801('0x39')]=qs[_0x7801('0x3a')](_0x1dd73c['query'][_0x7801('0x3a')]);_0x246b44[_0x7801('0x3b')]=qs['filters'](_[_0x7801('0x3c')](_0x1dd73c['query'],_0x45be76[_0x7801('0x32')]),_0xc6a69b);if(_0x1dd73c['query'][_0x7801('0x3d')]){_0x246b44[_0x7801('0x3b')]=_[_0x7801('0x3e')](_0x246b44['where'],{'$or':_[_0x7801('0x2b')](_0xc6a69b,function(_0x477867){if(_0x477867['type']!==_0x7801('0x3f')){var _0x288bd7={};_0x288bd7[_0x477867[_0x7801('0x2f')]]={'$like':'%'+_0x1dd73c['query'][_0x7801('0x3d')]+'%'};return _0x288bd7;}})});}_0x246b44=_[_0x7801('0x3e')]({},_0x246b44,_0x1dd73c[_0x7801('0x40')]);var _0x187e45={'where':_0x246b44[_0x7801('0x3b')]};return db[_0x7801('0x41')][_0x7801('0x1b')](_0x187e45)['then'](function(_0x554fdd){_0x1f1cb1[_0x7801('0x1b')]=_0x554fdd;if(_0x1dd73c[_0x7801('0x31')][_0x7801('0x42')]){_0x246b44[_0x7801('0x43')]=[{'all':!![]}];}return db[_0x7801('0x41')][_0x7801('0x44')](_0x246b44);})[_0x7801('0x23')](function(_0x4a8393){_0x1f1cb1['rows']=_0x4a8393;return _0x1f1cb1;})[_0x7801('0x23')](respondWithFilteredResult(_0x31ab72,_0x246b44))['catch'](handleError(_0x31ab72,null));};exports[_0x7801('0x45')]=function(_0x28cfde,_0x220042){var _0x3b7912={'raw':!![],'where':{'id':_0x28cfde[_0x7801('0x46')]['id']}},_0x2b32eb={};_0x2b32eb['model']=_[_0x7801('0x30')](db['Sound'][_0x7801('0x2c')]);_0x2b32eb[_0x7801('0x31')]=_['keys'](_0x28cfde[_0x7801('0x31')]);_0x2b32eb[_0x7801('0x32')]=_[_0x7801('0x33')](_0x2b32eb[_0x7801('0x34')],_0x2b32eb[_0x7801('0x31')]);_0x3b7912[_0x7801('0x35')]=_[_0x7801('0x33')](_0x2b32eb['model'],qs[_0x7801('0x36')](_0x28cfde['query'][_0x7801('0x36')]));_0x3b7912[_0x7801('0x35')]=_0x3b7912[_0x7801('0x35')][_0x7801('0x47')]?_0x3b7912[_0x7801('0x35')]:_0x2b32eb['model'];if(_0x28cfde['query'][_0x7801('0x42')]){_0x3b7912[_0x7801('0x43')]=[{'all':!![]}];}_0x3b7912=_['merge']({},_0x3b7912,_0x28cfde[_0x7801('0x40')]);return db[_0x7801('0x41')][_0x7801('0x48')](_0x3b7912)[_0x7801('0x23')](handleEntityNotFound(_0x220042,null))[_0x7801('0x23')](respondWithResult(_0x220042,null))[_0x7801('0x49')](handleError(_0x220042,null));};exports[_0x7801('0x4a')]=function(_0x64687e,_0x2da780,_0x3596e0){return db[_0x7801('0x41')][_0x7801('0x48')]({'where':{'id':_0x64687e[_0x7801('0x46')]['id']},'attributes':['name',_0x7801('0x4b'),'converted_format'],'raw':!![]})[_0x7801('0x23')](handleEntityNotFound(_0x2da780,null))[_0x7801('0x23')](function(_0x1481f6){if(_0x1481f6){if(!fs[_0x7801('0x4c')](path[_0x7801('0x4d')](config[_0x7801('0x4e')],'server/files/sounds/converted',_0x1481f6[_0x7801('0x4b')]+'.'+_0x1481f6[_0x7801('0x4f')]))){throw new db[(_0x7801('0x50'))][(_0x7801('0x51'))]('Sound\x20not\x20found');}return _0x2da780[_0x7801('0x4a')](path[_0x7801('0x4d')](config['root'],_0x7801('0x52'),util[_0x7801('0x53')](_0x7801('0x54'),_0x1481f6['save_name'],_0x1481f6[_0x7801('0x4f')])),util[_0x7801('0x53')](_0x7801('0x54'),_0x1481f6['name'],_0x1481f6[_0x7801('0x4f')]));}return null;})[_0x7801('0x49')](handleError(_0x2da780,null));};exports['create']=function(_0x1c3ccc,_0x122845,_0x1d9af5){var _0x237bfe={'name':path[_0x7801('0x55')](_0x1c3ccc[_0x7801('0x56')][_0x7801('0x57')],path[_0x7801('0x58')](_0x1c3ccc[_0x7801('0x56')][_0x7801('0x57')])),'save_name':path['basename'](_0x1c3ccc[_0x7801('0x56')]['filename'],path[_0x7801('0x58')](_0x1c3ccc['file'][_0x7801('0x59')])),'original_format':path[_0x7801('0x58')](_0x1c3ccc[_0x7801('0x56')]['originalname'])[_0x7801('0x5a')](0x1),'converted_format':_0x7801('0x5b')};var _0x5c6f1e=path['join'](config[_0x7801('0x4e')],_0x7801('0x5c'),_0x1c3ccc[_0x7801('0x56')]['filename']);var _0x576a62=path[_0x7801('0x4d')](config[_0x7801('0x4e')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x7801('0x55')](_0x1c3ccc[_0x7801('0x56')][_0x7801('0x59')],path[_0x7801('0x58')](_0x1c3ccc[_0x7801('0x56')][_0x7801('0x59')])),_0x237bfe['converted_format']));logger[_0x7801('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x5c6f1e);logger[_0x7801('0x5d')]('Sound\x20upload\x20destination:\x20%s',_0x576a62);try{fs['chmodSync'](_0x5c6f1e,parseInt(_0x7801('0x5e'),0x8));var _0x550c62=sox[_0x7801('0x5f')](_0x5c6f1e,_0x576a62,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x550c62['on'](_0x7801('0x28'),function(_0x132d46){fs['unlinkSync'](_0x5c6f1e);_0x122845[_0x7801('0x19')](0x1f4)[_0x7801('0x29')](_0x132d46);});_0x550c62['on']('src',function(_0x4477c9){_0x237bfe[_0x7801('0x60')]=isNaN(_0x4477c9[_0x7801('0x61')])?null:_0x4477c9[_0x7801('0x61')]*0x3e8;_0x237bfe[_0x7801('0x62')]=isNaN(_0x4477c9[_0x7801('0x63')])?null:_0x4477c9[_0x7801('0x63')];_0x237bfe['original_channelCount']=isNaN(_0x4477c9[_0x7801('0x64')])?null:_0x4477c9[_0x7801('0x64')];_0x237bfe[_0x7801('0x65')]=isNaN(_0x4477c9[_0x7801('0x66')])?null:_0x4477c9[_0x7801('0x66')];_0x237bfe[_0x7801('0x67')]=isNaN(_0x4477c9['sampleRate'])?null:_0x4477c9[_0x7801('0x68')];});_0x550c62['on']('dest',function(_0x1f929a){_0x237bfe[_0x7801('0x69')]=isNaN(_0x1f929a[_0x7801('0x61')])?null:_0x1f929a[_0x7801('0x61')]*0x3e8;_0x237bfe[_0x7801('0x6a')]=isNaN(_0x1f929a['sampleCount'])?null:_0x1f929a['sampleCount'];_0x237bfe[_0x7801('0x6b')]=isNaN(_0x1f929a[_0x7801('0x64')])?null:_0x1f929a['channelCount'];_0x237bfe[_0x7801('0x6c')]=isNaN(_0x1f929a['bitRate'])?null:_0x1f929a[_0x7801('0x66')];_0x237bfe['converted_sampleRate']=isNaN(_0x1f929a[_0x7801('0x68')])?null:_0x1f929a[_0x7801('0x68')];});_0x550c62['on'](_0x7801('0x27'),function(){fs[_0x7801('0x6d')](_0x576a62,parseInt('0777',0x8));return db[_0x7801('0x41')][_0x7801('0x6e')](_0x237bfe)[_0x7801('0x23')](function(_0x638d93){var _0x22d5fb={'role':_0x1c3ccc[_0x7801('0x6f')]['role'],'userProfileId':_0x1c3ccc['body'][_0x7801('0x70')]};if(!_0x22d5fb)throw new Error(_0x7801('0x71'));if(_0x22d5fb[_0x7801('0x72')]===_0x7801('0x73')){var _0x535738=_0x638d93[_0x7801('0x25')]({'plain':!![]});return db[_0x7801('0x74')]['find']({'where':{'name':_0x7801('0x75'),'userProfileId':_0x22d5fb[_0x7801('0x70')]},'raw':!![]})[_0x7801('0x23')](function(_0x5e9f41){if(_0x5e9f41&&_0x5e9f41[_0x7801('0x76')]===0x0){return db['UserProfileResource'][_0x7801('0x6e')]({'name':_0x535738[_0x7801('0x2f')],'resourceId':_0x535738['id'],'type':_0x5e9f41[_0x7801('0x2f')],'sectionId':_0x5e9f41['id']},{})['then'](function(){return _0x638d93;});}else{return _0x638d93;}})[_0x7801('0x49')](function(_0x14f578){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14f578);throw _0x14f578;});}return _0x638d93;})[_0x7801('0x23')](respondWithResult(_0x122845,null))[_0x7801('0x49')](handleError(_0x122845,null));});_0x550c62['start']();}catch(_0x4d6cb7){_0x122845[_0x7801('0x19')](0x1f4)[_0x7801('0x29')](_0x4d6cb7);}};exports[_0x7801('0x22')]=function(_0x4ab613,_0x418f9c,_0x10f45d){return db[_0x7801('0x41')][_0x7801('0x48')]({'where':{'id':_0x4ab613['params']['id']}})['then'](handleEntityNotFound(_0x418f9c,null))[_0x7801('0x23')](saveUpdates(_['pick'](_0x4ab613['body'],[_0x7801('0x2f'),'description']),null))['then'](respondWithResult(_0x418f9c,null))[_0x7801('0x49')](handleError(_0x418f9c,null));};exports[_0x7801('0x77')]=function(_0x41beb6,_0x51c5b7,_0x1e2f40){return db[_0x7801('0x41')][_0x7801('0x48')]({'where':{'id':_0x41beb6[_0x7801('0x46')]['id']}})['then'](function(_0x2a259e){if(_0x2a259e){return _0x2a259e[_0x7801('0x24')]();}})[_0x7801('0x23')](function(_0x2dec57){var _0x329058=path[_0x7801('0x4d')](config[_0x7801('0x4e')],_0x7801('0x5c'),util[_0x7801('0x53')]('%s.%s',_0x2dec57[_0x7801('0x4b')],_0x2dec57[_0x7801('0x78')]));var _0x1092ac=path[_0x7801('0x4d')](config[_0x7801('0x4e')],'server/files/sounds/converted',util['format'](_0x7801('0x54'),_0x2dec57[_0x7801('0x4b')],_0x2dec57[_0x7801('0x4f')]));fs[_0x7801('0x79')](_0x329058);fs[_0x7801('0x79')](_0x1092ac);return _0x2dec57;})[_0x7801('0x23')](function(_0x2255cc){if(_0x2255cc){return _0x51c5b7[_0x7801('0x19')](0xcc)['end']();}})[_0x7801('0x23')](handleEntityNotFound(_0x51c5b7,null))[_0x7801('0x49')](handleError(_0x51c5b7,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index caa40e3..e158396 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 _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 +var _0x8868=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x8868,0x16c));var _0x8886=function(_0x38bf6f,_0x102074){_0x38bf6f=_0x38bf6f-0x0;var _0x3140a4=_0x8868[_0x38bf6f];return _0x3140a4;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var logger=require('../../config/logger')(_0x8886('0x2'));var moment=require(_0x8886('0x3'));var BPromise=require(_0x8886('0x4'));var rp=require(_0x8886('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8886('0x6'));var config=require(_0x8886('0x7'));var attributes=require(_0x8886('0x8'));module[_0x8886('0x9')]=function(_0x59277f,_0x5ca882){return _0x59277f[_0x8886('0xa')](_0x8886('0xb'),attributes,{'tableName':_0x8886('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 c99df0b..ef1c23f 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 _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 +var _0xcf9d=['model','map','include','ShowSound','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','find','options','where','attributes'];(function(_0x3af0d8,_0x331a6c){var _0x36261c=function(_0x105478){while(--_0x105478){_0x3af0d8['push'](_0x3af0d8['shift']());}};_0x36261c(++_0x331a6c);}(_0xcf9d,0x154));var _0xdcf9=function(_0x537648,_0x474dd6){_0x537648=_0x537648-0x0;var _0x4b57ca=_0xcf9d[_0x537648];return _0x4b57ca;};'use strict';var _=require(_0xdcf9('0x0'));var util=require(_0xdcf9('0x1'));var moment=require(_0xdcf9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdcf9('0x3'));var db=require(_0xdcf9('0x4'))['db'];var utils=require(_0xdcf9('0x5'));var logger=require('../../config/logger')(_0xdcf9('0x6'));var config=require('../../config/environment');var jayson=require(_0xdcf9('0x7'));var client=jayson[_0xdcf9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31b4ea,_0x297c27,_0x1e39f2){return new BPromise(function(_0x3df6ca,_0x14def5){return client[_0xdcf9('0x9')](_0x31b4ea,_0x1e39f2)['then'](function(_0x9538a4){logger[_0xdcf9('0xa')]('Sound,\x20%s,\x20%s',_0x297c27,'request\x20sent');logger[_0xdcf9('0xb')](_0xdcf9('0xc'),_0x297c27,_0xdcf9('0xd'),JSON[_0xdcf9('0xe')](_0x9538a4));if(_0x9538a4[_0xdcf9('0xf')]){if(_0x9538a4[_0xdcf9('0xf')][_0xdcf9('0x10')]===0x1f4){logger[_0xdcf9('0xf')](_0xdcf9('0x11'),_0x297c27,_0x9538a4[_0xdcf9('0xf')][_0xdcf9('0x12')]);return _0x14def5(_0x9538a4[_0xdcf9('0xf')][_0xdcf9('0x12')]);}logger[_0xdcf9('0xf')](_0xdcf9('0x11'),_0x297c27,_0x9538a4[_0xdcf9('0xf')][_0xdcf9('0x12')]);return _0x3df6ca(_0x9538a4[_0xdcf9('0xf')]['message']);}else{logger[_0xdcf9('0xa')](_0xdcf9('0x11'),_0x297c27,_0xdcf9('0xd'));_0x3df6ca(_0x9538a4['result'][_0xdcf9('0x12')]);}})[_0xdcf9('0x13')](function(_0x53755a){logger[_0xdcf9('0xf')](_0xdcf9('0x11'),_0x297c27,_0x53755a);_0x14def5(_0x53755a);});});}exports['ShowSound']=function(_0x1ce483){var _0x514418=this;return new Promise(function(_0x427b78,_0x3b6c14){return db['Sound'][_0xdcf9('0x14')]({'raw':_0x1ce483[_0xdcf9('0x15')]?_0x1ce483['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ce483['options']?_0x1ce483[_0xdcf9('0x15')][_0xdcf9('0x16')]||null:null,'attributes':_0x1ce483[_0xdcf9('0x15')]?_0x1ce483[_0xdcf9('0x15')][_0xdcf9('0x17')]||null:null,'include':_0x1ce483[_0xdcf9('0x15')]?_0x1ce483['options']['include']?_['map'](_0x1ce483[_0xdcf9('0x15')]['include'],function(_0x4d3be3){return{'model':db[_0x4d3be3[_0xdcf9('0x18')]],'as':_0x4d3be3['as'],'attributes':_0x4d3be3[_0xdcf9('0x17')],'include':_0x4d3be3['include']?_[_0xdcf9('0x19')](_0x4d3be3[_0xdcf9('0x1a')],function(_0x5d19d5){return{'model':db[_0x5d19d5[_0xdcf9('0x18')]],'as':_0x5d19d5['as'],'attributes':_0x5d19d5[_0xdcf9('0x17')],'include':_0x5d19d5[_0xdcf9('0x1a')]?_['map'](_0x5d19d5[_0xdcf9('0x1a')],function(_0x3bd5d1){return{'model':db[_0x3bd5d1[_0xdcf9('0x18')]],'as':_0x3bd5d1['as'],'attributes':_0x3bd5d1[_0xdcf9('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x489159){logger[_0xdcf9('0xa')]('ShowSound',_0x1ce483);logger[_0xdcf9('0xb')](_0xdcf9('0x1b'),_0x1ce483,JSON[_0xdcf9('0xe')](_0x489159));_0x427b78(_0x489159);})[_0xdcf9('0x13')](function(_0xad1808){logger[_0xdcf9('0xf')]('ShowSound',_0xad1808[_0xdcf9('0x12')],_0x1ce483);_0x3b6c14(_0x514418[_0xdcf9('0xf')](0x1f4,_0xad1808[_0xdcf9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 7a5f728..a486770 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 _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 +var _0x1e34=['./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','express','../../config/environment'];(function(_0x4f6259,_0x35094b){var _0x35f1bb=function(_0x2ecb4e){while(--_0x2ecb4e){_0x4f6259['push'](_0x4f6259['shift']());}};_0x35f1bb(++_0x35094b);}(_0x1e34,0x182));var _0x41e3=function(_0x32a338,_0x380c51){_0x32a338=_0x32a338-0x0;var _0x360c0b=_0x1e34[_0x32a338];return _0x360c0b;};'use strict';var multer=require(_0x41e3('0x0'));var util=require(_0x41e3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x41e3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x41e3('0x3'));var controller=require(_0x41e3('0x4'));router[_0x41e3('0x5')]('/',auth[_0x41e3('0x6')](),controller[_0x41e3('0x7')]);router[_0x41e3('0x5')](_0x41e3('0x8'),auth['isAuthenticated'](),controller[_0x41e3('0x9')]);router[_0x41e3('0xa')]('/',auth[_0x41e3('0x6')](),controller[_0x41e3('0xb')]);router[_0x41e3('0xc')]('/:id',auth[_0x41e3('0x6')](),controller['update']);router[_0x41e3('0xd')](_0x41e3('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x41e3('0xe')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 50d7fe9..f167a7d 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 _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 +var _0x3937=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0x3937,0xbf));var _0x7393=function(_0x1f1d87,_0x49451d){_0x1f1d87=_0x1f1d87-0x0;var _0x343a6c=_0x3937[_0x1f1d87];return _0x343a6c;};'use strict';var Sequelize=require(_0x7393('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7393('0x1')]},'body':{'type':Sequelize[_0x7393('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x7393('0x3')]('in','out'),'defaultValue':_0x7393('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7393('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2908c57..213cab0 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 _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 +var _0xe787=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','filters','intersection','fields','attributes','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','update','body','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3fb84f,_0x526d87){var _0x48975c=function(_0x21bcfa){while(--_0x21bcfa){_0x3fb84f['push'](_0x3fb84f['shift']());}};_0x48975c(++_0x526d87);}(_0xe787,0x11d));var _0x7e78=function(_0x2f3ecd,_0x57976b){_0x2f3ecd=_0x2f3ecd-0x0;var _0xffdc44=_0xe787[_0x2f3ecd];return _0xffdc44;};'use strict';var pdf=require(_0x7e78('0x0'));var emlformat=require(_0x7e78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7e78('0x2'));var jsonpatch=require(_0x7e78('0x3'));var rp=require(_0x7e78('0x4'));var moment=require(_0x7e78('0x5'));var BPromise=require(_0x7e78('0x6'));var Mustache=require('mustache');var util=require(_0x7e78('0x7'));var path=require(_0x7e78('0x8'));var sox=require('sox');var csv=require(_0x7e78('0x9'));var ejs=require(_0x7e78('0xa'));var fs=require('fs');var _=require(_0x7e78('0xb'));var squel=require(_0x7e78('0xc'));var crypto=require(_0x7e78('0xd'));var jsforce=require(_0x7e78('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7e78('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7e78('0xf'));var authService=require(_0x7e78('0x10'));var qs=require(_0x7e78('0x11'));var as=require(_0x7e78('0x12'));var hardwareService=require(_0x7e78('0x13'));var logger=require(_0x7e78('0x14'))(_0x7e78('0x15'));var utils=require(_0x7e78('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7e78('0x17'))['db'];function respondWithStatusCode(_0xe43ac0,_0x554d39){_0x554d39=_0x554d39||0xcc;return function(_0x45716d){if(_0x45716d){return _0xe43ac0[_0x7e78('0x18')](_0x554d39);}return _0xe43ac0[_0x7e78('0x19')](_0x554d39)[_0x7e78('0x1a')]();};}function respondWithResult(_0x3fd742,_0x67406a){_0x67406a=_0x67406a||0xc8;return function(_0x20617d){if(_0x20617d){return _0x3fd742[_0x7e78('0x19')](_0x67406a)[_0x7e78('0x1b')](_0x20617d);}};}function respondWithFilteredResult(_0x59cf1c,_0x3b9f3e){return function(_0x561d0d){if(_0x561d0d){var _0x4ca2ff=_0x561d0d['count'],_0x4da64e=_0x3b9f3e[_0x7e78('0x1c')],_0xe8b1b2=_0x3b9f3e['offset']+_0x3b9f3e[_0x7e78('0x1d')],_0x368d60;if(_0xe8b1b2>=_0x4ca2ff){_0xe8b1b2=_0x4ca2ff;_0x368d60=0xc8;}else{_0x368d60=0xce;}_0x59cf1c[_0x7e78('0x19')](_0x368d60);return _0x59cf1c[_0x7e78('0x1e')](_0x7e78('0x1f'),_0x4da64e+'-'+_0xe8b1b2+'/'+_0x4ca2ff)[_0x7e78('0x1b')](_0x561d0d);}return null;};}function patchUpdates(_0x7c22a6){return function(_0x319ecf){try{jsonpatch[_0x7e78('0x20')](_0x319ecf,_0x7c22a6,!![]);}catch(_0x3521f4){return BPromise[_0x7e78('0x21')](_0x3521f4);}return _0x319ecf[_0x7e78('0x22')]();};}function saveUpdates(_0x3cf099,_0x5b5dc2){return function(_0x31d7bf){if(_0x31d7bf){return _0x31d7bf['update'](_0x3cf099)[_0x7e78('0x23')](function(_0x41f072){return _0x41f072;});}return null;};}function removeEntity(_0x49fa6e,_0x4532a0){return function(_0xa307cd){if(_0xa307cd){return _0xa307cd[_0x7e78('0x24')]()[_0x7e78('0x23')](function(){_0x49fa6e[_0x7e78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dcc36,_0x55458c){return function(_0x4bb857){if(!_0x4bb857){_0x2dcc36[_0x7e78('0x18')](0x194);}return _0x4bb857;};}function handleError(_0x7c73c3,_0x341f47){_0x341f47=_0x341f47||0x1f4;return function(_0x8b4cfc){logger[_0x7e78('0x25')](_0x8b4cfc['stack']);if(_0x8b4cfc['name']){delete _0x8b4cfc[_0x7e78('0x26')];}_0x7c73c3[_0x7e78('0x19')](_0x341f47)[_0x7e78('0x27')](_0x8b4cfc);};}exports[_0x7e78('0x28')]=function(_0x1646c9,_0x41dceb){var _0x6e0095={},_0x2e4b8e={},_0x10a891={'count':0x0,'rows':[]};var _0x42a4e0=_[_0x7e78('0x29')](db[_0x7e78('0x2a')][_0x7e78('0x2b')],function(_0x3aa2fa){return{'name':_0x3aa2fa[_0x7e78('0x2c')],'type':_0x3aa2fa[_0x7e78('0x2d')][_0x7e78('0x2e')]};});_0x2e4b8e[_0x7e78('0x2f')]=_[_0x7e78('0x29')](_0x42a4e0,_0x7e78('0x26'));_0x2e4b8e['query']=_[_0x7e78('0x30')](_0x1646c9['query']);_0x2e4b8e[_0x7e78('0x31')]=_[_0x7e78('0x32')](_0x2e4b8e[_0x7e78('0x2f')],_0x2e4b8e['query']);_0x6e0095['attributes']=_[_0x7e78('0x32')](_0x2e4b8e[_0x7e78('0x2f')],qs[_0x7e78('0x33')](_0x1646c9['query']['fields']));_0x6e0095['attributes']=_0x6e0095[_0x7e78('0x34')]['length']?_0x6e0095[_0x7e78('0x34')]:_0x2e4b8e[_0x7e78('0x2f')];if(!_0x1646c9[_0x7e78('0x35')][_0x7e78('0x36')](_0x7e78('0x37'))){_0x6e0095['limit']=qs[_0x7e78('0x1d')](_0x1646c9[_0x7e78('0x35')][_0x7e78('0x1d')]);_0x6e0095[_0x7e78('0x1c')]=qs[_0x7e78('0x1c')](_0x1646c9[_0x7e78('0x35')][_0x7e78('0x1c')]);}_0x6e0095[_0x7e78('0x38')]=qs[_0x7e78('0x39')](_0x1646c9[_0x7e78('0x35')][_0x7e78('0x39')]);_0x6e0095[_0x7e78('0x3a')]=qs[_0x7e78('0x31')](_[_0x7e78('0x3b')](_0x1646c9[_0x7e78('0x35')],_0x2e4b8e[_0x7e78('0x31')]),_0x42a4e0);if(_0x1646c9[_0x7e78('0x35')][_0x7e78('0x3c')]){_0x6e0095[_0x7e78('0x3a')]=_[_0x7e78('0x3d')](_0x6e0095['where'],{'$or':_[_0x7e78('0x29')](_0x42a4e0,function(_0x15125e){if(_0x15125e[_0x7e78('0x2d')]!==_0x7e78('0x3e')){var _0xcfc303={};_0xcfc303[_0x15125e[_0x7e78('0x26')]]={'$like':'%'+_0x1646c9[_0x7e78('0x35')][_0x7e78('0x3c')]+'%'};return _0xcfc303;}})});}_0x6e0095=_[_0x7e78('0x3d')]({},_0x6e0095,_0x1646c9[_0x7e78('0x3f')]);var _0x231336={'where':_0x6e0095[_0x7e78('0x3a')]};return db[_0x7e78('0x2a')][_0x7e78('0x40')](_0x231336)['then'](function(_0x3cdda0){_0x10a891[_0x7e78('0x40')]=_0x3cdda0;if(_0x1646c9['query'][_0x7e78('0x41')]){_0x6e0095[_0x7e78('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x7e78('0x43')](_0x6e0095);})[_0x7e78('0x23')](function(_0x568ab9){_0x10a891[_0x7e78('0x44')]=_0x568ab9;return _0x10a891;})[_0x7e78('0x23')](respondWithFilteredResult(_0x41dceb,_0x6e0095))[_0x7e78('0x45')](handleError(_0x41dceb,null));};exports[_0x7e78('0x46')]=function(_0x8292ae,_0x3ff260){var _0x2dbdb6={'raw':!![],'where':{'id':_0x8292ae['params']['id']}},_0x3fd5e8={};_0x3fd5e8[_0x7e78('0x2f')]=_[_0x7e78('0x30')](db[_0x7e78('0x2a')]['rawAttributes']);_0x3fd5e8[_0x7e78('0x35')]=_[_0x7e78('0x30')](_0x8292ae[_0x7e78('0x35')]);_0x3fd5e8['filters']=_[_0x7e78('0x32')](_0x3fd5e8[_0x7e78('0x2f')],_0x3fd5e8[_0x7e78('0x35')]);_0x2dbdb6[_0x7e78('0x34')]=_[_0x7e78('0x32')](_0x3fd5e8['model'],qs[_0x7e78('0x33')](_0x8292ae[_0x7e78('0x35')]['fields']));_0x2dbdb6[_0x7e78('0x34')]=_0x2dbdb6[_0x7e78('0x34')]['length']?_0x2dbdb6[_0x7e78('0x34')]:_0x3fd5e8[_0x7e78('0x2f')];if(_0x8292ae[_0x7e78('0x35')]['includeAll']){_0x2dbdb6['include']=[{'all':!![]}];}_0x2dbdb6=_['merge']({},_0x2dbdb6,_0x8292ae[_0x7e78('0x3f')]);return db[_0x7e78('0x2a')][_0x7e78('0x47')](_0x2dbdb6)[_0x7e78('0x23')](handleEntityNotFound(_0x3ff260,null))[_0x7e78('0x23')](respondWithResult(_0x3ff260,null))[_0x7e78('0x45')](handleError(_0x3ff260,null));};exports['create']=function(_0x566265,_0x165354){return db[_0x7e78('0x2a')][_0x7e78('0x48')](_0x566265['body'],{})[_0x7e78('0x23')](respondWithResult(_0x165354,0xc9))[_0x7e78('0x45')](handleError(_0x165354,null));};exports[_0x7e78('0x49')]=function(_0x5ff5fe,_0x5cd9a8){if(_0x5ff5fe[_0x7e78('0x4a')]['id']){delete _0x5ff5fe[_0x7e78('0x4a')]['id'];}return db['SquareMessage'][_0x7e78('0x47')]({'where':{'id':_0x5ff5fe[_0x7e78('0x4b')]['id']}})[_0x7e78('0x23')](handleEntityNotFound(_0x5cd9a8,null))[_0x7e78('0x23')](saveUpdates(_0x5ff5fe[_0x7e78('0x4a')],null))['then'](respondWithResult(_0x5cd9a8,null))[_0x7e78('0x45')](handleError(_0x5cd9a8,null));};exports[_0x7e78('0x24')]=function(_0x2823b2,_0x343106){return db[_0x7e78('0x2a')][_0x7e78('0x47')]({'where':{'id':_0x2823b2[_0x7e78('0x4b')]['id']}})['then'](handleEntityNotFound(_0x343106,null))[_0x7e78('0x23')](removeEntity(_0x343106,null))[_0x7e78('0x45')](handleError(_0x343106,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1e814d2..13d3f1d 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 _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 +var _0x3442=['api','moment','bluebird','request-promise','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','util','../../config/logger'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x3442,0x195));var _0x2344=function(_0x44353c,_0x363887){_0x44353c=_0x44353c-0x0;var _0x3a0279=_0x3442[_0x44353c];return _0x3a0279;};'use strict';var _=require('lodash');var util=require(_0x2344('0x0'));var logger=require(_0x2344('0x1'))(_0x2344('0x2'));var moment=require(_0x2344('0x3'));var BPromise=require(_0x2344('0x4'));var rp=require(_0x2344('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2344('0x6'));var attributes=require(_0x2344('0x7'));module['exports']=function(_0x12c1f2,_0x34ed3b){return _0x12c1f2[_0x2344('0x8')](_0x2344('0x9'),attributes,{'tableName':_0x2344('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 16d3aa0..0c69281 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(_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 +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(_0x5e3c34,_0x5c971d){var _0x47c2c4=function(_0x176151){while(--_0x176151){_0x5e3c34['push'](_0x5e3c34['shift']());}};_0x47c2c4(++_0x5c971d);}(_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);});});}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 f72566a..4f6c7be 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 _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 +var _0xed2a=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','show','/:id/test','test','create','update'];(function(_0x459858,_0x5cdb29){var _0x47503a=function(_0x4c4227){while(--_0x4c4227){_0x459858['push'](_0x459858['shift']());}};_0x47503a(++_0x5cdb29);}(_0xed2a,0x1e8));var _0xaed2=function(_0xa2fb15,_0x34d2be){_0xa2fb15=_0xa2fb15-0x0;var _0x39e002=_0xed2a[_0xa2fb15];return _0x39e002;};'use strict';var multer=require(_0xaed2('0x0'));var util=require(_0xaed2('0x1'));var path=require(_0xaed2('0x2'));var timeout=require(_0xaed2('0x3'));var express=require(_0xaed2('0x4'));var router=express[_0xaed2('0x5')]();var auth=require(_0xaed2('0x6'));var interaction=require(_0xaed2('0x7'));var config=require(_0xaed2('0x8'));var controller=require(_0xaed2('0x9'));router[_0xaed2('0xa')]('/',auth[_0xaed2('0xb')](),controller[_0xaed2('0xc')]);router[_0xaed2('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xaed2('0xd')]);router[_0xaed2('0xa')](_0xaed2('0xe'),auth[_0xaed2('0xb')](),timeout('15s'),controller[_0xaed2('0xf')]);router['post']('/',auth[_0xaed2('0xb')](),controller[_0xaed2('0x10')]);router['put']('/:id',auth[_0xaed2('0xb')](),controller[_0xaed2('0x11')]);router[_0xaed2('0x12')](_0xaed2('0x13'),auth['isAuthenticated'](),controller[_0xaed2('0x14')]);module[_0xaed2('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index cccf18c..d523bbe 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 _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 +var _0x4323=['STRING','name','sequelize'];(function(_0x12cbd8,_0x8ef0ce){var _0x2fb1ab=function(_0x57242c){while(--_0x57242c){_0x12cbd8['push'](_0x12cbd8['shift']());}};_0x2fb1ab(++_0x8ef0ce);}(_0x4323,0x10a));var _0x3432=function(_0x26f00b,_0x12dda3){_0x26f00b=_0x26f00b-0x0;var _0x72284=_0x4323[_0x26f00b];return _0x72284;};'use strict';var Sequelize=require(_0x3432('0x0'));module['exports']={'name':{'type':Sequelize[_0x3432('0x1')],'unique':_0x3432('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3432('0x1')]},'description':{'type':Sequelize[_0x3432('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 71c213e..b46f265 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 _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 +var _0x03f0=['merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','ODBC','UserProfileSection','autoAssociation','error','params','test','odbc','dsn','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','save','update','destroy','then','get','UserProfileResource','stack','name','index','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter'];(function(_0x3ec2ba,_0x1f28e5){var _0x237b01=function(_0x2bd7c8){while(--_0x2bd7c8){_0x3ec2ba['push'](_0x3ec2ba['shift']());}};_0x237b01(++_0x1f28e5);}(_0x03f0,0xfe));var _0x003f=function(_0x2e973e,_0x3db52f){_0x2e973e=_0x2e973e-0x0;var _0xa7db0d=_0x03f0[_0x2e973e];return _0xa7db0d;};'use strict';var pdf=require(_0x003f('0x0'));var emlformat=require(_0x003f('0x1'));var rimraf=require(_0x003f('0x2'));var zipdir=require(_0x003f('0x3'));var jsonpatch=require(_0x003f('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x003f('0x5'));var Mustache=require(_0x003f('0x6'));var util=require('util');var path=require(_0x003f('0x7'));var sox=require(_0x003f('0x8'));var csv=require(_0x003f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x003f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x003f('0xb'));var deskjs=require(_0x003f('0xc'));var toCsv=require(_0x003f('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x003f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x003f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x003f('0xf'))(_0x003f('0x10'));var utils=require(_0x003f('0x11'));var config=require(_0x003f('0x12'));var licenseUtil=require(_0x003f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f5444,_0x8deb7){_0x8deb7=_0x8deb7||0xcc;return function(_0x4c664a){if(_0x4c664a){return _0x4f5444[_0x003f('0x14')](_0x8deb7);}return _0x4f5444[_0x003f('0x15')](_0x8deb7)[_0x003f('0x16')]();};}function respondWithResult(_0x170546,_0x49c5f9){_0x49c5f9=_0x49c5f9||0xc8;return function(_0x2cf477){if(_0x2cf477){return _0x170546[_0x003f('0x15')](_0x49c5f9)[_0x003f('0x17')](_0x2cf477);}};}function respondWithFilteredResult(_0x20f323,_0x178ae5){return function(_0x64858f){if(_0x64858f){var _0x4abc92=_0x64858f['count'],_0x3270ef=_0x178ae5[_0x003f('0x18')],_0x2eaa2c=_0x178ae5['offset']+_0x178ae5[_0x003f('0x19')],_0x46b18e;if(_0x2eaa2c>=_0x4abc92){_0x2eaa2c=_0x4abc92;_0x46b18e=0xc8;}else{_0x46b18e=0xce;}_0x20f323['status'](_0x46b18e);return _0x20f323[_0x003f('0x1a')]('Content-Range',_0x3270ef+'-'+_0x2eaa2c+'/'+_0x4abc92)[_0x003f('0x17')](_0x64858f);}return null;};}function patchUpdates(_0x2e0fd1){return function(_0x23df66){try{jsonpatch['apply'](_0x23df66,_0x2e0fd1,!![]);}catch(_0x384e1f){return BPromise['reject'](_0x384e1f);}return _0x23df66[_0x003f('0x1b')]();};}function saveUpdates(_0x1e2ce5,_0x16e5de){return function(_0x480147){if(_0x480147){return _0x480147[_0x003f('0x1c')](_0x1e2ce5)['then'](function(_0x4502a0){return _0x4502a0;});}return null;};}function removeEntity(_0x22eb45,_0x18582a){return function(_0x5c83d6){if(_0x5c83d6){return _0x5c83d6[_0x003f('0x1d')]()[_0x003f('0x1e')](function(){var _0x190b0e=_0x5c83d6[_0x003f('0x1f')]({'plain':!![]});var _0x5bcf86='ODBC';return db[_0x003f('0x20')]['destroy']({'where':{'type':_0x5bcf86,'resourceId':_0x190b0e['id']}})[_0x003f('0x1e')](function(){return _0x5c83d6;});})[_0x003f('0x1e')](function(){_0x22eb45[_0x003f('0x15')](0xcc)[_0x003f('0x16')]();});}};}function handleEntityNotFound(_0x33b277,_0x349d39){return function(_0x1dbe54){if(!_0x1dbe54){_0x33b277[_0x003f('0x14')](0x194);}return _0x1dbe54;};}function handleError(_0x2d5247,_0x3c201c){_0x3c201c=_0x3c201c||0x1f4;return function(_0x75762c){logger['error'](_0x75762c[_0x003f('0x21')]);if(_0x75762c['name']){delete _0x75762c[_0x003f('0x22')];}_0x2d5247[_0x003f('0x15')](_0x3c201c)['send'](_0x75762c);};}exports[_0x003f('0x23')]=function(_0x3c87a4,_0x1d7bca){var _0x5dec19={},_0xc9a112={},_0x2c7651={'count':0x0,'rows':[]};var _0x4f9df3=_['map'](db[_0x003f('0x24')][_0x003f('0x25')],function(_0x321758){return{'name':_0x321758[_0x003f('0x26')],'type':_0x321758[_0x003f('0x27')][_0x003f('0x28')]};});_0xc9a112['model']=_['map'](_0x4f9df3,_0x003f('0x22'));_0xc9a112[_0x003f('0x29')]=_[_0x003f('0x2a')](_0x3c87a4['query']);_0xc9a112['filters']=_[_0x003f('0x2b')](_0xc9a112[_0x003f('0x2c')],_0xc9a112[_0x003f('0x29')]);_0x5dec19[_0x003f('0x2d')]=_['intersection'](_0xc9a112[_0x003f('0x2c')],qs[_0x003f('0x2e')](_0x3c87a4[_0x003f('0x29')][_0x003f('0x2e')]));_0x5dec19[_0x003f('0x2d')]=_0x5dec19[_0x003f('0x2d')][_0x003f('0x2f')]?_0x5dec19['attributes']:_0xc9a112[_0x003f('0x2c')];if(!_0x3c87a4['query'][_0x003f('0x30')](_0x003f('0x31'))){_0x5dec19['limit']=qs['limit'](_0x3c87a4[_0x003f('0x29')][_0x003f('0x19')]);_0x5dec19[_0x003f('0x18')]=qs[_0x003f('0x18')](_0x3c87a4[_0x003f('0x29')][_0x003f('0x18')]);}_0x5dec19['order']=qs['sort'](_0x3c87a4[_0x003f('0x29')][_0x003f('0x32')]);_0x5dec19[_0x003f('0x33')]=qs[_0x003f('0x34')](_['pick'](_0x3c87a4[_0x003f('0x29')],_0xc9a112[_0x003f('0x34')]),_0x4f9df3);if(_0x3c87a4[_0x003f('0x29')][_0x003f('0x35')]){_0x5dec19[_0x003f('0x33')]=_[_0x003f('0x36')](_0x5dec19[_0x003f('0x33')],{'$or':_[_0x003f('0x37')](_0x4f9df3,function(_0x2b71f4){if(_0x2b71f4[_0x003f('0x27')]!==_0x003f('0x38')){var _0x55c72b={};_0x55c72b[_0x2b71f4[_0x003f('0x22')]]={'$like':'%'+_0x3c87a4[_0x003f('0x29')]['filter']+'%'};return _0x55c72b;}})});}_0x5dec19=_[_0x003f('0x36')]({},_0x5dec19,_0x3c87a4[_0x003f('0x39')]);var _0x5c359e={'where':_0x5dec19['where']};return db['SquareOdbc'][_0x003f('0x3a')](_0x5c359e)[_0x003f('0x1e')](function(_0x49a869){_0x2c7651[_0x003f('0x3a')]=_0x49a869;if(_0x3c87a4['query'][_0x003f('0x3b')]){_0x5dec19[_0x003f('0x3c')]=[{'all':!![]}];}return db[_0x003f('0x24')][_0x003f('0x3d')](_0x5dec19);})[_0x003f('0x1e')](function(_0x5d0774){_0x2c7651[_0x003f('0x3e')]=_0x5d0774;return _0x2c7651;})['then'](respondWithFilteredResult(_0x1d7bca,_0x5dec19))[_0x003f('0x3f')](handleError(_0x1d7bca,null));};exports[_0x003f('0x40')]=function(_0x3a3e8e,_0x3304e9){var _0x2b6264={'raw':!![],'where':{'id':_0x3a3e8e['params']['id']}},_0x253fe1={};_0x253fe1[_0x003f('0x2c')]=_[_0x003f('0x2a')](db['SquareOdbc']['rawAttributes']);_0x253fe1['query']=_[_0x003f('0x2a')](_0x3a3e8e[_0x003f('0x29')]);_0x253fe1[_0x003f('0x34')]=_[_0x003f('0x2b')](_0x253fe1['model'],_0x253fe1['query']);_0x2b6264[_0x003f('0x2d')]=_[_0x003f('0x2b')](_0x253fe1[_0x003f('0x2c')],qs[_0x003f('0x2e')](_0x3a3e8e['query'][_0x003f('0x2e')]));_0x2b6264[_0x003f('0x2d')]=_0x2b6264[_0x003f('0x2d')][_0x003f('0x2f')]?_0x2b6264[_0x003f('0x2d')]:_0x253fe1['model'];if(_0x3a3e8e[_0x003f('0x29')]['includeAll']){_0x2b6264[_0x003f('0x3c')]=[{'all':!![]}];}_0x2b6264=_['merge']({},_0x2b6264,_0x3a3e8e['options']);return db[_0x003f('0x24')][_0x003f('0x41')](_0x2b6264)[_0x003f('0x1e')](handleEntityNotFound(_0x3304e9,null))[_0x003f('0x1e')](respondWithResult(_0x3304e9,null))[_0x003f('0x3f')](handleError(_0x3304e9,null));};exports['create']=function(_0x194493,_0x2c2038){return db[_0x003f('0x24')][_0x003f('0x42')](_0x194493[_0x003f('0x43')],{})[_0x003f('0x1e')](function(_0x3db662){var _0x5a9741=_0x194493[_0x003f('0x44')][_0x003f('0x1f')]({'plain':!![]});if(!_0x5a9741)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a9741['role']===_0x003f('0x44')){var _0x450d08=_0x3db662[_0x003f('0x1f')]({'plain':!![]});var _0x42002c=_0x003f('0x45');return db[_0x003f('0x46')][_0x003f('0x41')]({'where':{'name':_0x42002c,'userProfileId':_0x5a9741['userProfileId']},'raw':!![]})[_0x003f('0x1e')](function(_0x33e4bb){if(_0x33e4bb&&_0x33e4bb[_0x003f('0x47')]===0x0){return db[_0x003f('0x20')][_0x003f('0x42')]({'name':_0x450d08[_0x003f('0x22')],'resourceId':_0x450d08['id'],'type':_0x33e4bb[_0x003f('0x22')],'sectionId':_0x33e4bb['id']},{})[_0x003f('0x1e')](function(){return _0x3db662;});}else{return _0x3db662;}})['catch'](function(_0x363227){logger[_0x003f('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x363227);throw _0x363227;});}return _0x3db662;})[_0x003f('0x1e')](respondWithResult(_0x2c2038,0xc9))[_0x003f('0x3f')](handleError(_0x2c2038,null));};exports[_0x003f('0x1c')]=function(_0xb6dc67,_0x569f9c){if(_0xb6dc67['body']['id']){delete _0xb6dc67['body']['id'];}return db[_0x003f('0x24')][_0x003f('0x41')]({'where':{'id':_0xb6dc67[_0x003f('0x49')]['id']}})[_0x003f('0x1e')](handleEntityNotFound(_0x569f9c,null))['then'](saveUpdates(_0xb6dc67[_0x003f('0x43')],null))[_0x003f('0x1e')](respondWithResult(_0x569f9c,null))['catch'](handleError(_0x569f9c,null));};exports[_0x003f('0x1d')]=function(_0x275cbf,_0x20d443){return db[_0x003f('0x24')]['find']({'where':{'id':_0x275cbf[_0x003f('0x49')]['id']}})[_0x003f('0x1e')](handleEntityNotFound(_0x20d443,null))[_0x003f('0x1e')](removeEntity(_0x20d443,null))['catch'](handleError(_0x20d443,null));};exports[_0x003f('0x4a')]=function(_0x21793a,_0x1cebba,_0x62f63c){var _0x5149f6;return db['SquareOdbc'][_0x003f('0x41')]({'where':{'id':_0x21793a['params']['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x1cebba,null))[_0x003f('0x1e')](function(_0x405488){if(_0x405488){var _0x4484bf=require(_0x003f('0x4b'))();_0x4484bf['openSync'](_0x405488[_0x003f('0x4c')]);_0x4484bf['closeSync']();return _0x405488;}})[_0x003f('0x1e')](respondWithResult(_0x1cebba,null))[_0x003f('0x3f')](handleError(_0x1cebba,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 25ab4bd..773a9b0 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 _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 +var _0x6739=['SquareOdbc','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./squareOdbc.attributes','define'];(function(_0xb284b,_0x366e35){var _0x2118cf=function(_0x468ea5){while(--_0x468ea5){_0xb284b['push'](_0xb284b['shift']());}};_0x2118cf(++_0x366e35);}(_0x6739,0xd3));var _0x9673=function(_0x177dda,_0x27b6fc){_0x177dda=_0x177dda-0x0;var _0x47c325=_0x6739[_0x177dda];return _0x47c325;};'use strict';var _=require(_0x9673('0x0'));var util=require(_0x9673('0x1'));var logger=require(_0x9673('0x2'))(_0x9673('0x3'));var moment=require(_0x9673('0x4'));var BPromise=require(_0x9673('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9673('0x6'));var config=require('../../config/environment');var attributes=require(_0x9673('0x7'));module['exports']=function(_0x57a9d5,_0x27f94b){return _0x57a9d5[_0x9673('0x8')](_0x9673('0x9'),attributes,{'tableName':'square_odbc','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 c6897d2..0bed8ce 100644 --- a/server/api/squareOdbc/squareOdbc.rpc.js +++ b/server/api/squareOdbc/squareOdbc.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_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 +var _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x2a38e8,_0x5c457e){var _0x33d01b=function(_0x46b93d){while(--_0x46b93d){_0x2a38e8['push'](_0x2a38e8['shift']());}};_0x33d01b(++_0x5c457e);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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']('SquareOdbc,\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['SquareOdbc'][_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,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e48a189..2ad87a2 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 _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 +var _0xbe2e=['../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','getUsers','post','/:id/users','addUsers','put','update','destroy','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x30bfd1,_0x486594){var _0x5bea96=function(_0x33df02){while(--_0x33df02){_0x30bfd1['push'](_0x30bfd1['shift']());}};_0x5bea96(++_0x486594);}(_0xbe2e,0x7e));var _0xebe2=function(_0x7eb9ad,_0x50bb18){_0x7eb9ad=_0x7eb9ad-0x0;var _0x16b24c=_0xbe2e[_0x7eb9ad];return _0x16b24c;};'use strict';var multer=require(_0xebe2('0x0'));var util=require('util');var path=require(_0xebe2('0x1'));var timeout=require('connect-timeout');var express=require(_0xebe2('0x2'));var router=express[_0xebe2('0x3')]();var auth=require(_0xebe2('0x4'));var interaction=require(_0xebe2('0x5'));var config=require(_0xebe2('0x6'));var controller=require(_0xebe2('0x7'));router[_0xebe2('0x8')]('/',auth['isAuthenticated'](),controller[_0xebe2('0x9')]);router['get'](_0xebe2('0xa'),auth[_0xebe2('0xb')](),controller[_0xebe2('0xc')]);router[_0xebe2('0x8')]('/:id/users',auth[_0xebe2('0xb')](),controller[_0xebe2('0xd')]);router['post']('/',auth[_0xebe2('0xb')](),controller['create']);router[_0xebe2('0xe')](_0xebe2('0xf'),auth[_0xebe2('0xb')](),controller[_0xebe2('0x10')]);router[_0xebe2('0x11')](_0xebe2('0xa'),auth[_0xebe2('0xb')](),controller[_0xebe2('0x12')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xebe2('0x13')]);router[_0xebe2('0x14')](_0xebe2('0xf'),auth[_0xebe2('0xb')](),controller['removeUsers']);module[_0xebe2('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3a15d1e..5401b80 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 _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 +var _0x3a89=['sequelize','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x1780f8,_0x11ba93){var _0x33a410=function(_0x2a015f){while(--_0x2a015f){_0x1780f8['push'](_0x1780f8['shift']());}};_0x33a410(++_0x11ba93);}(_0x3a89,0x114));var _0x93a8=function(_0x1264ca,_0x8b9735){_0x1264ca=_0x1264ca-0x0;var _0x343a2c=_0x3a89[_0x1264ca];return _0x343a2c;};'use strict';var Sequelize=require(_0x93a8('0x0'));module[_0x93a8('0x1')]={'name':{'type':Sequelize[_0x93a8('0x2')],'unique':_0x93a8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x93a8('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x93a8('0x4')](_0x93a8('0x5')),'get':function(){if(this[_0x93a8('0x6')]('preproduction')){return this[_0x93a8('0x6')](_0x93a8('0x7'))[_0x93a8('0x8')](_0x93a8('0x9'));}}},'production':{'type':Sequelize[_0x93a8('0x4')](_0x93a8('0x5')),'get':function(){if(this['getDataValue']('production')){return this[_0x93a8('0x6')](_0x93a8('0xa'))[_0x93a8('0x8')](_0x93a8('0x9'));}}},'savedAt':{'type':Sequelize[_0x93a8('0xb')]},'publishedAt':{'type':Sequelize[_0x93a8('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 8f44e34..cb28c60 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 _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 +var _0x2b79=['index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','SquareProject','rows','catch','show','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','get','SquareProjects','destroy','error','stack','name'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x2b79,0xf5));var _0x92b7=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0x2b79[_0x52598d];return _0x170309;};'use strict';var pdf=require(_0x92b7('0x0'));var emlformat=require(_0x92b7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x92b7('0x2'));var jsonpatch=require(_0x92b7('0x3'));var rp=require(_0x92b7('0x4'));var moment=require(_0x92b7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x92b7('0x6'));var util=require(_0x92b7('0x7'));var path=require(_0x92b7('0x8'));var sox=require(_0x92b7('0x9'));var csv=require(_0x92b7('0xa'));var ejs=require(_0x92b7('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x92b7('0xc'));var crypto=require(_0x92b7('0xd'));var jsforce=require(_0x92b7('0xe'));var deskjs=require(_0x92b7('0xf'));var toCsv=require(_0x92b7('0xa'));var querystring=require(_0x92b7('0x10'));var Papa=require(_0x92b7('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x92b7('0x12'));var as=require(_0x92b7('0x13'));var hardwareService=require(_0x92b7('0x14'));var logger=require(_0x92b7('0x15'))(_0x92b7('0x16'));var utils=require(_0x92b7('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x92b7('0x18'));var db=require(_0x92b7('0x19'))['db'];config[_0x92b7('0x1a')]=_[_0x92b7('0x1b')](config[_0x92b7('0x1a')],{'host':_0x92b7('0x1c'),'port':0x18eb});var socket=require(_0x92b7('0x1d'))(new Redis(config['redis']));require(_0x92b7('0x1e'))[_0x92b7('0x1f')](socket);function respondWithStatusCode(_0x52b35e,_0x42bde6){_0x42bde6=_0x42bde6||0xcc;return function(_0x10b9c0){if(_0x10b9c0){return _0x52b35e[_0x92b7('0x20')](_0x42bde6);}return _0x52b35e[_0x92b7('0x21')](_0x42bde6)['end']();};}function respondWithResult(_0x529ce0,_0x228c61){_0x228c61=_0x228c61||0xc8;return function(_0x55b681){if(_0x55b681){return _0x529ce0[_0x92b7('0x21')](_0x228c61)[_0x92b7('0x22')](_0x55b681);}};}function respondWithFilteredResult(_0x4ecd8c,_0x3bf23f){return function(_0x4baf55){if(_0x4baf55){var _0x44c8ac=_0x4baf55[_0x92b7('0x23')],_0x499ddf=_0x3bf23f['offset'],_0x4430f9=_0x3bf23f[_0x92b7('0x24')]+_0x3bf23f['limit'],_0x2adcb5;if(_0x4430f9>=_0x44c8ac){_0x4430f9=_0x44c8ac;_0x2adcb5=0xc8;}else{_0x2adcb5=0xce;}_0x4ecd8c[_0x92b7('0x21')](_0x2adcb5);return _0x4ecd8c['set'](_0x92b7('0x25'),_0x499ddf+'-'+_0x4430f9+'/'+_0x44c8ac)[_0x92b7('0x22')](_0x4baf55);}return null;};}function patchUpdates(_0x10735c){return function(_0x485973){try{jsonpatch[_0x92b7('0x26')](_0x485973,_0x10735c,!![]);}catch(_0x2dfd3c){return BPromise[_0x92b7('0x27')](_0x2dfd3c);}return _0x485973[_0x92b7('0x28')]();};}function saveUpdates(_0x5e43fb,_0x178f89){return function(_0xe07392){if(_0xe07392){return _0xe07392[_0x92b7('0x29')](_0x5e43fb)[_0x92b7('0x2a')](function(_0x1ab2ec){return _0x1ab2ec;});}return null;};}function removeEntity(_0x2933c1,_0x80b186){return function(_0x512d91){if(_0x512d91){return _0x512d91['destroy']()[_0x92b7('0x2a')](function(){var _0x12046f=_0x512d91[_0x92b7('0x2b')]({'plain':!![]});var _0x261f72=_0x92b7('0x2c');return db['UserProfileResource'][_0x92b7('0x2d')]({'where':{'type':_0x261f72,'resourceId':_0x12046f['id']}})[_0x92b7('0x2a')](function(){return _0x512d91;});})[_0x92b7('0x2a')](function(){_0x2933c1[_0x92b7('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e5977,_0x37e31d){return function(_0x1b06b5){if(!_0x1b06b5){_0x2e5977[_0x92b7('0x20')](0x194);}return _0x1b06b5;};}function handleError(_0x3469e5,_0x35bd85){_0x35bd85=_0x35bd85||0x1f4;return function(_0x371072){logger[_0x92b7('0x2e')](_0x371072[_0x92b7('0x2f')]);if(_0x371072[_0x92b7('0x30')]){delete _0x371072[_0x92b7('0x30')];}_0x3469e5[_0x92b7('0x21')](_0x35bd85)['send'](_0x371072);};}exports[_0x92b7('0x31')]=function(_0x51f7f4,_0x239225){var _0x2aa325={},_0x277ffe={},_0x93ae45={'count':0x0,'rows':[]};var _0x32bd93=_[_0x92b7('0x32')](db['SquareProject'][_0x92b7('0x33')],function(_0x4a7ab6){return{'name':_0x4a7ab6[_0x92b7('0x34')],'type':_0x4a7ab6[_0x92b7('0x35')][_0x92b7('0x36')]};});_0x277ffe[_0x92b7('0x37')]=_[_0x92b7('0x32')](_0x32bd93,_0x92b7('0x30'));_0x277ffe[_0x92b7('0x38')]=_[_0x92b7('0x39')](_0x51f7f4[_0x92b7('0x38')]);_0x277ffe[_0x92b7('0x3a')]=_[_0x92b7('0x3b')](_0x277ffe['model'],_0x277ffe[_0x92b7('0x38')]);_0x2aa325[_0x92b7('0x3c')]=_[_0x92b7('0x3b')](_0x277ffe['model'],qs[_0x92b7('0x3d')](_0x51f7f4[_0x92b7('0x38')][_0x92b7('0x3d')]));_0x2aa325['attributes']=_0x2aa325['attributes']['length']?_0x2aa325[_0x92b7('0x3c')]:_0x277ffe[_0x92b7('0x37')];if(!_0x51f7f4[_0x92b7('0x38')][_0x92b7('0x3e')](_0x92b7('0x3f'))){_0x2aa325['limit']=qs[_0x92b7('0x40')](_0x51f7f4[_0x92b7('0x38')]['limit']);_0x2aa325[_0x92b7('0x24')]=qs[_0x92b7('0x24')](_0x51f7f4[_0x92b7('0x38')][_0x92b7('0x24')]);}_0x2aa325[_0x92b7('0x41')]=qs[_0x92b7('0x42')](_0x51f7f4['query'][_0x92b7('0x42')]);_0x2aa325[_0x92b7('0x43')]=qs[_0x92b7('0x3a')](_[_0x92b7('0x44')](_0x51f7f4[_0x92b7('0x38')],_0x277ffe[_0x92b7('0x3a')]),_0x32bd93);if(_0x51f7f4['query'][_0x92b7('0x45')]){_0x2aa325['where']=_[_0x92b7('0x46')](_0x2aa325[_0x92b7('0x43')],{'$or':_[_0x92b7('0x32')](_0x32bd93,function(_0x4bda4a){if(_0x4bda4a[_0x92b7('0x35')]!=='VIRTUAL'){var _0x2bbd26={};_0x2bbd26[_0x4bda4a[_0x92b7('0x30')]]={'$like':'%'+_0x51f7f4[_0x92b7('0x38')][_0x92b7('0x45')]+'%'};return _0x2bbd26;}})});}_0x2aa325=_[_0x92b7('0x46')]({},_0x2aa325,_0x51f7f4[_0x92b7('0x47')]);var _0x1c2121={'where':_0x2aa325[_0x92b7('0x43')]};return db['SquareProject'][_0x92b7('0x23')](_0x1c2121)[_0x92b7('0x2a')](function(_0x2779c7){_0x93ae45[_0x92b7('0x23')]=_0x2779c7;if(_0x51f7f4[_0x92b7('0x38')][_0x92b7('0x48')]){_0x2aa325[_0x92b7('0x49')]=[{'all':!![]}];}return db[_0x92b7('0x4a')]['findAll'](_0x2aa325);})['then'](function(_0x5c4efe){_0x93ae45[_0x92b7('0x4b')]=_0x5c4efe;return _0x93ae45;})['then'](respondWithFilteredResult(_0x239225,_0x2aa325))[_0x92b7('0x4c')](handleError(_0x239225,null));};exports[_0x92b7('0x4d')]=function(_0x44b19f,_0x26a64c){var _0x3e0c3a={'raw':![],'where':{'id':_0x44b19f['params']['id']}},_0xa47ef8={};_0xa47ef8[_0x92b7('0x37')]=_['keys'](db[_0x92b7('0x4a')][_0x92b7('0x33')]);_0xa47ef8[_0x92b7('0x38')]=_[_0x92b7('0x39')](_0x44b19f['query']);_0xa47ef8[_0x92b7('0x3a')]=_[_0x92b7('0x3b')](_0xa47ef8[_0x92b7('0x37')],_0xa47ef8['query']);_0x3e0c3a[_0x92b7('0x3c')]=_[_0x92b7('0x3b')](_0xa47ef8[_0x92b7('0x37')],qs[_0x92b7('0x3d')](_0x44b19f[_0x92b7('0x38')][_0x92b7('0x3d')]));_0x3e0c3a[_0x92b7('0x3c')]=_0x3e0c3a[_0x92b7('0x3c')][_0x92b7('0x4e')]?_0x3e0c3a[_0x92b7('0x3c')]:_0xa47ef8[_0x92b7('0x37')];if(_0x44b19f[_0x92b7('0x38')][_0x92b7('0x48')]){_0x3e0c3a['include']=[{'all':!![]}];}_0x3e0c3a=_[_0x92b7('0x46')]({},_0x3e0c3a,_0x44b19f[_0x92b7('0x47')]);return db['SquareProject'][_0x92b7('0x4f')](_0x3e0c3a)[_0x92b7('0x2a')](handleEntityNotFound(_0x26a64c,null))[_0x92b7('0x2a')](respondWithResult(_0x26a64c,null))[_0x92b7('0x4c')](handleError(_0x26a64c,null));};exports['create']=function(_0x5358d1,_0x2858ab){return db['SquareProject'][_0x92b7('0x50')](_0x5358d1[_0x92b7('0x51')],{})[_0x92b7('0x2a')](function(_0x2f8c7f){var _0x46a0c8=_0x5358d1[_0x92b7('0x52')]['get']({'plain':!![]});if(!_0x46a0c8)throw new Error(_0x92b7('0x53'));if(_0x46a0c8['role']===_0x92b7('0x52')){var _0x2ddf63=_0x2f8c7f[_0x92b7('0x2b')]({'plain':!![]});var _0x348a06=_0x92b7('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x348a06,'userProfileId':_0x46a0c8[_0x92b7('0x54')]},'raw':!![]})[_0x92b7('0x2a')](function(_0x4b99b6){if(_0x4b99b6&&_0x4b99b6[_0x92b7('0x55')]===0x0){return db[_0x92b7('0x56')]['create']({'name':_0x2ddf63['name'],'resourceId':_0x2ddf63['id'],'type':_0x4b99b6[_0x92b7('0x30')],'sectionId':_0x4b99b6['id']},{})[_0x92b7('0x2a')](function(){return _0x2f8c7f;});}else{return _0x2f8c7f;}})[_0x92b7('0x4c')](function(_0x113208){logger['error'](_0x92b7('0x57'),_0x113208);throw _0x113208;});}return _0x2f8c7f;})[_0x92b7('0x2a')](respondWithResult(_0x2858ab,0xc9))[_0x92b7('0x4c')](handleError(_0x2858ab,null));};exports['update']=function(_0x590db7,_0x42e245){if(_0x590db7['body']['id']){delete _0x590db7['body']['id'];}return db[_0x92b7('0x4a')][_0x92b7('0x4f')]({'where':{'id':_0x590db7['params']['id']}})[_0x92b7('0x2a')](handleEntityNotFound(_0x42e245,null))[_0x92b7('0x2a')](saveUpdates(_0x590db7[_0x92b7('0x51')],null))[_0x92b7('0x2a')](respondWithResult(_0x42e245,null))['catch'](handleError(_0x42e245,null));};exports[_0x92b7('0x2d')]=function(_0xff8100,_0x438ffe){return db[_0x92b7('0x4a')][_0x92b7('0x4f')]({'where':{'id':_0xff8100[_0x92b7('0x58')]['id']}})[_0x92b7('0x2a')](handleEntityNotFound(_0x438ffe,null))['then'](removeEntity(_0x438ffe,null))[_0x92b7('0x4c')](handleError(_0x438ffe,null));};exports[_0x92b7('0x59')]=function(_0x48bd04,_0x75fb6,_0x4b37f9){return db[_0x92b7('0x4a')][_0x92b7('0x4f')]({'where':{'id':_0x48bd04[_0x92b7('0x58')]['id']}})[_0x92b7('0x2a')](handleEntityNotFound(_0x75fb6,null))[_0x92b7('0x2a')](function(_0x24dfb2){if(_0x24dfb2){return _0x24dfb2['addUsers'](_0x48bd04[_0x92b7('0x51')]['ids'],_['omit'](_0x48bd04['body'],[_0x92b7('0x5a'),'id'])||{});}})[_0x92b7('0x2a')](respondWithResult(_0x75fb6,null))[_0x92b7('0x4c')](handleError(_0x75fb6,null));};exports[_0x92b7('0x5b')]=function(_0x249811,_0x1e9ad1,_0x2982c3){return db[_0x92b7('0x4a')][_0x92b7('0x4f')]({'where':{'id':_0x249811[_0x92b7('0x58')]['id']}})[_0x92b7('0x2a')](handleEntityNotFound(_0x1e9ad1,null))[_0x92b7('0x2a')](function(_0x16e290){if(_0x16e290){return _0x16e290[_0x92b7('0x5b')](_0x249811[_0x92b7('0x38')][_0x92b7('0x5a')])[_0x92b7('0x2a')](function(){if(_[_0x92b7('0x5c')](_0x249811[_0x92b7('0x38')][_0x92b7('0x5a')])){for(var _0xc66d34=0x0;_0xc66d34<_0x249811[_0x92b7('0x38')][_0x92b7('0x5a')][_0x92b7('0x4e')];_0xc66d34+=0x1){socket[_0x92b7('0x5d')](_0x92b7('0x5e'),{'UserId':Number(_0x249811[_0x92b7('0x38')]['ids'][_0xc66d34]),'SquareProjectId':Number(_0x249811[_0x92b7('0x58')]['id'])});}}else{socket[_0x92b7('0x5d')](_0x92b7('0x5e'),{'UserId':Number(_0x249811[_0x92b7('0x38')]['ids']),'SquareProjectId':Number(_0x249811[_0x92b7('0x58')]['id'])});}});}})[_0x92b7('0x2a')](respondWithStatusCode(_0x1e9ad1,null))[_0x92b7('0x4c')](handleError(_0x1e9ad1,null));};exports[_0x92b7('0x5f')]=function(_0x1bc6fb,_0x3b4d01,_0x1f36a2){var _0x4f61c9={};var _0x469cf6={};var _0x42b014;var _0x405269;return db[_0x92b7('0x4a')][_0x92b7('0x60')]({'where':{'id':_0x1bc6fb[_0x92b7('0x58')]['id']}})['then'](handleEntityNotFound(_0x3b4d01,null))['then'](function(_0x5757d0){if(_0x5757d0){_0x42b014=_0x5757d0;_0x469cf6[_0x92b7('0x37')]=_[_0x92b7('0x39')](db[_0x92b7('0x61')]['rawAttributes']);_0x469cf6[_0x92b7('0x38')]=_['keys'](_0x1bc6fb[_0x92b7('0x38')]);_0x469cf6['filters']=_[_0x92b7('0x3b')](_0x469cf6[_0x92b7('0x37')],_0x469cf6[_0x92b7('0x38')]);_0x4f61c9[_0x92b7('0x3c')]=_['intersection'](_0x469cf6[_0x92b7('0x37')],qs[_0x92b7('0x3d')](_0x1bc6fb[_0x92b7('0x38')]['fields']));_0x4f61c9[_0x92b7('0x3c')]=_0x4f61c9[_0x92b7('0x3c')][_0x92b7('0x4e')]?_0x4f61c9['attributes']:_0x469cf6[_0x92b7('0x37')];_0x4f61c9[_0x92b7('0x41')]=qs[_0x92b7('0x42')](_0x1bc6fb[_0x92b7('0x38')][_0x92b7('0x42')]);_0x4f61c9['where']=qs[_0x92b7('0x3a')](_[_0x92b7('0x44')](_0x1bc6fb['query'],_0x469cf6['filters']));if(_0x1bc6fb[_0x92b7('0x38')]['filter']){_0x4f61c9[_0x92b7('0x43')]=_[_0x92b7('0x46')](_0x4f61c9['where'],{'$or':_['map'](_0x4f61c9[_0x92b7('0x3c')],function(_0x3be41b){var _0x331cfd={};_0x331cfd[_0x3be41b]={'$like':'%'+_0x1bc6fb[_0x92b7('0x38')][_0x92b7('0x45')]+'%'};return _0x331cfd;})});}_0x4f61c9=_[_0x92b7('0x46')]({},_0x4f61c9,_0x1bc6fb[_0x92b7('0x47')]);return _0x42b014['getUsers'](_0x4f61c9);}})['then'](function(_0x49bb57){if(_0x49bb57){_0x405269=_0x49bb57[_0x92b7('0x4e')];if(!_0x1bc6fb['query'][_0x92b7('0x3e')](_0x92b7('0x3f'))){_0x4f61c9[_0x92b7('0x40')]=qs['limit'](_0x1bc6fb['query']['limit']);_0x4f61c9[_0x92b7('0x24')]=qs[_0x92b7('0x24')](_0x1bc6fb['query'][_0x92b7('0x24')]);}return _0x42b014[_0x92b7('0x5f')](_0x4f61c9);}})[_0x92b7('0x2a')](function(_0x280de6){if(_0x280de6){return _0x280de6?{'count':_0x405269,'rows':_0x280de6}:null;}})[_0x92b7('0x2a')](respondWithResult(_0x3b4d01,null))[_0x92b7('0x4c')](handleError(_0x3b4d01,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 25260c6..86ec8e4 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 _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 +var _0xfc0b=['exports','../../mysqldb','SquareProject','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x139154,_0x1548cf){var _0x5c2447=function(_0x81588a){while(--_0x81588a){_0x139154['push'](_0x139154['shift']());}};_0x5c2447(++_0x1548cf);}(_0xfc0b,0x189));var _0xbfc0=function(_0x3d9778,_0x4c909a){_0x3d9778=_0x3d9778-0x0;var _0x14e368=_0xfc0b[_0x3d9778];return _0x14e368;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xbfc0('0x0'))['db'][_0xbfc0('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbfc0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xbfc0('0x3')};function emitEvent(_0x8b934e){return function(_0x57075f,_0x374c32,_0x2199c9){SquareProjectEvents[_0xbfc0('0x4')](_0x8b934e+':'+_0x57075f['id'],_0x57075f);SquareProjectEvents[_0xbfc0('0x4')](_0x8b934e,_0x57075f);_0x2199c9(null);};}for(var e in events){if(events[_0xbfc0('0x5')](e)){var event=events[e];SquareProject[_0xbfc0('0x6')](e,emitEvent(event));}}module[_0xbfc0('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index b019fee..4bec94f 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 _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 +var _0x9cff=['SquareProject','square_projects','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','define'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x9cff,0x1b0));var _0xf9cf=function(_0x17abcf,_0xdd5674){_0x17abcf=_0x17abcf-0x0;var _0x547fab=_0x9cff[_0x17abcf];return _0x547fab;};'use strict';var _=require('lodash');var util=require(_0xf9cf('0x0'));var logger=require(_0xf9cf('0x1'))(_0xf9cf('0x2'));var moment=require('moment');var BPromise=require(_0xf9cf('0x3'));var rp=require(_0xf9cf('0x4'));var fs=require('fs');var path=require(_0xf9cf('0x5'));var rimraf=require('rimraf');var config=require(_0xf9cf('0x6'));var attributes=require(_0xf9cf('0x7'));module[_0xf9cf('0x8')]=function(_0x183113,_0xcacbdc){return _0x183113[_0xf9cf('0x9')](_0xf9cf('0xa'),attributes,{'tableName':_0xf9cf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1c29f6,_0x2f726d,_0x285982){if(_0x1c29f6['changed'](_0xf9cf('0xc'))){_0x1c29f6[_0xf9cf('0xd')]=moment()['format'](_0xf9cf('0xe'));}if(_0x1c29f6['changed']('production')){_0x1c29f6[_0xf9cf('0xf')]=moment()[_0xf9cf('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x285982(null,_0x1c29f6);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 3c1b163..f0f2811 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 _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 +var _0x38b5=['SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowSquareProject','SquareProject','find','options','raw','where','include','map','model','attributes','then','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17db61,_0x364236){var _0x7ac96b=function(_0x329bf4){while(--_0x329bf4){_0x17db61['push'](_0x17db61['shift']());}};_0x7ac96b(++_0x364236);}(_0x38b5,0x11b));var _0x538b=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x38b5[_0x4c3ffe];return _0x28d3eb;};'use strict';var _=require(_0x538b('0x0'));var util=require(_0x538b('0x1'));var moment=require(_0x538b('0x2'));var BPromise=require('bluebird');var rs=require(_0x538b('0x3'));var fs=require('fs');var Redis=require(_0x538b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x538b('0x5'));var logger=require(_0x538b('0x6'))(_0x538b('0x7'));var config=require(_0x538b('0x8'));var jayson=require(_0x538b('0x9'));var client=jayson[_0x538b('0xa')][_0x538b('0xb')]({'port':0x232a});config[_0x538b('0xc')]=_[_0x538b('0xd')](config[_0x538b('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x538b('0xe'))(new Redis(config[_0x538b('0xc')]));require(_0x538b('0xf'))['register'](socket);function respondWithRpcPromise(_0x576097,_0x3a2f7a,_0x100029){return new BPromise(function(_0x44017a,_0xaea1f6){return client[_0x538b('0x10')](_0x576097,_0x100029)['then'](function(_0x206ce1){logger[_0x538b('0x11')](_0x538b('0x12'),_0x3a2f7a,_0x538b('0x13'));logger[_0x538b('0x14')](_0x538b('0x15'),_0x3a2f7a,_0x538b('0x13'),JSON[_0x538b('0x16')](_0x206ce1));if(_0x206ce1[_0x538b('0x17')]){if(_0x206ce1[_0x538b('0x17')]['code']===0x1f4){logger[_0x538b('0x17')]('SquareProject,\x20%s,\x20%s',_0x3a2f7a,_0x206ce1['error'][_0x538b('0x18')]);return _0xaea1f6(_0x206ce1[_0x538b('0x17')]['message']);}logger[_0x538b('0x17')](_0x538b('0x12'),_0x3a2f7a,_0x206ce1[_0x538b('0x17')]['message']);return _0x44017a(_0x206ce1['error'][_0x538b('0x18')]);}else{logger['info']('SquareProject,\x20%s,\x20%s',_0x3a2f7a,_0x538b('0x13'));_0x44017a(_0x206ce1[_0x538b('0x19')][_0x538b('0x18')]);}})['catch'](function(_0x1eb61c){logger[_0x538b('0x17')](_0x538b('0x12'),_0x3a2f7a,_0x1eb61c);_0xaea1f6(_0x1eb61c);});});}exports[_0x538b('0x1a')]=function(_0x1d764d){var _0x20970a=this;return new Promise(function(_0x3f46fd,_0x155ff1){return db[_0x538b('0x1b')][_0x538b('0x1c')]({'raw':_0x1d764d[_0x538b('0x1d')]?_0x1d764d[_0x538b('0x1d')][_0x538b('0x1e')]===undefined?!![]:![]:!![],'where':_0x1d764d['options']?_0x1d764d[_0x538b('0x1d')][_0x538b('0x1f')]||null:null,'attributes':_0x1d764d[_0x538b('0x1d')]?_0x1d764d[_0x538b('0x1d')]['attributes']||null:null,'include':_0x1d764d[_0x538b('0x1d')]?_0x1d764d[_0x538b('0x1d')][_0x538b('0x20')]?_[_0x538b('0x21')](_0x1d764d[_0x538b('0x1d')]['include'],function(_0x4905f2){return{'model':db[_0x4905f2['model']],'as':_0x4905f2['as'],'attributes':_0x4905f2['attributes'],'include':_0x4905f2[_0x538b('0x20')]?_['map'](_0x4905f2[_0x538b('0x20')],function(_0x1796e2){return{'model':db[_0x1796e2[_0x538b('0x22')]],'as':_0x1796e2['as'],'attributes':_0x1796e2[_0x538b('0x23')],'include':_0x1796e2[_0x538b('0x20')]?_[_0x538b('0x21')](_0x1796e2[_0x538b('0x20')],function(_0x40417d){return{'model':db[_0x40417d[_0x538b('0x22')]],'as':_0x40417d['as'],'attributes':_0x40417d[_0x538b('0x23')]};}):[]};}):[]};}):[]:[]})[_0x538b('0x24')](function(_0x8c1d7e){logger[_0x538b('0x11')](_0x538b('0x1a'),_0x1d764d);logger['debug'](_0x538b('0x1a'),_0x1d764d,JSON[_0x538b('0x16')](_0x8c1d7e));_0x3f46fd(_0x8c1d7e);})[_0x538b('0x25')](function(_0x4fd2d0){logger[_0x538b('0x17')]('ShowSquareProject',_0x4fd2d0[_0x538b('0x18')],_0x1d764d);_0x155ff1(_0x20970a[_0x538b('0x17')](0x1f4,_0x4fd2d0[_0x538b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 044b670..3743073 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 _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 +var _0x2a07=['save','remove','update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x4ae5be,_0x354bd2){var _0x4c15ec=function(_0x5a9b38){while(--_0x5a9b38){_0x4ae5be['push'](_0x4ae5be['shift']());}};_0x4c15ec(++_0x354bd2);}(_0x2a07,0x74));var _0x72a0=function(_0x3797d9,_0x1ce1c7){_0x3797d9=_0x3797d9-0x0;var _0x2d1c0d=_0x2a07[_0x3797d9];return _0x2d1c0d;};'use strict';var SquareProjectEvents=require(_0x72a0('0x0'));var events=[_0x72a0('0x1'),_0x72a0('0x2'),_0x72a0('0x3')];function createListener(_0x1cad29,_0x548164){return function(_0x335b7c){_0x548164[_0x72a0('0x4')](_0x1cad29,_0x335b7c);};}function removeListener(_0x135982,_0x45b155){return function(){SquareProjectEvents[_0x72a0('0x5')](_0x135982,_0x45b155);};}exports[_0x72a0('0x6')]=function(_0x3ccf6d){for(var _0x20dab9=0x0,_0x193e3b=events[_0x72a0('0x7')];_0x20dab9<_0x193e3b;_0x20dab9++){var _0x21c819=events[_0x20dab9];var _0x2c04eb=createListener(_0x72a0('0x8')+_0x21c819,_0x3ccf6d);SquareProjectEvents['on'](_0x21c819,_0x2c04eb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 6379705..15c179a 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 _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 +var _0x0b88=['get','isAuthenticated','index','show','/:id/download','post','create','put','/:id','update','delete','/:id/delete','destroy','exports','multer','util','path','express','./squareRecording.controller'];(function(_0x4f2198,_0x30bd28){var _0x161533=function(_0x25fcaa){while(--_0x25fcaa){_0x4f2198['push'](_0x4f2198['shift']());}};_0x161533(++_0x30bd28);}(_0x0b88,0x1e9));var _0x80b8=function(_0x2e186d,_0xe7f51){_0x2e186d=_0x2e186d-0x0;var _0x1ea410=_0x0b88[_0x2e186d];return _0x1ea410;};'use strict';var multer=require(_0x80b8('0x0'));var util=require(_0x80b8('0x1'));var path=require(_0x80b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x80b8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x80b8('0x4'));router[_0x80b8('0x5')]('/',auth[_0x80b8('0x6')](),controller[_0x80b8('0x7')]);router[_0x80b8('0x5')]('/:id',auth[_0x80b8('0x6')](),controller[_0x80b8('0x8')]);router[_0x80b8('0x5')](_0x80b8('0x9'),auth[_0x80b8('0x6')](),controller['download']);router[_0x80b8('0xa')]('/',auth[_0x80b8('0x6')](),controller[_0x80b8('0xb')]);router[_0x80b8('0xc')](_0x80b8('0xd'),auth[_0x80b8('0x6')](),controller[_0x80b8('0xe')]);router[_0x80b8('0xf')](_0x80b8('0x10'),auth[_0x80b8('0x6')](),controller[_0x80b8('0x11')]);module[_0x80b8('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index f5204ad..b22c7dd 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 _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 +var _0x7785=['substring','lastIndexOf','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x46bab9,_0x496d7a){var _0x91286=function(_0x2b83b6){while(--_0x2b83b6){_0x46bab9['push'](_0x46bab9['shift']());}};_0x91286(++_0x496d7a);}(_0x7785,0x104));var _0x5778=function(_0x5e5edd,_0x41ced4){_0x5e5edd=_0x5e5edd-0x0;var _0x59727f=_0x7785[_0x5e5edd];return _0x59727f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x5778('0x0')]},'callerid':{'type':Sequelize[_0x5778('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x5778('0x0')]},'extension':{'type':Sequelize[_0x5778('0x0')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5778('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x5778('0x0')]},'savePath':{'type':Sequelize[_0x5778('0x0')]},'format':{'type':Sequelize[_0x5778('0x1')],'get':function(){var _0x7c613a='';var _0x2d09bb=this[_0x5778('0x2')](_0x5778('0x3'));if(_0x2d09bb){_0x7c613a=_0x2d09bb[_0x5778('0x4')](_0x2d09bb[_0x5778('0x5')]('.'));}return _0x7c613a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 1d6e021..4520417 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 _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 +var _0x7db8=['message','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','apply','destroy','then','end','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','format','existsSync','decryptFile','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7db8,0x174));var _0x87db=function(_0xa6c9f6,_0x3461f1){_0xa6c9f6=_0xa6c9f6-0x0;var _0x6f2638=_0x7db8[_0xa6c9f6];return _0x6f2638;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x87db('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x87db('0x1'));var moment=require(_0x87db('0x2'));var BPromise=require(_0x87db('0x3'));var Mustache=require(_0x87db('0x4'));var util=require(_0x87db('0x5'));var path=require('path');var sox=require(_0x87db('0x6'));var csv=require(_0x87db('0x7'));var ejs=require(_0x87db('0x8'));var fs=require('fs');var _=require(_0x87db('0x9'));var squel=require('squel');var crypto=require(_0x87db('0xa'));var jsforce=require(_0x87db('0xb'));var deskjs=require(_0x87db('0xc'));var toCsv=require(_0x87db('0x7'));var querystring=require(_0x87db('0xd'));var Papa=require(_0x87db('0xe'));var Redis=require(_0x87db('0xf'));var authService=require(_0x87db('0x10'));var qs=require(_0x87db('0x11'));var as=require(_0x87db('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87db('0x13'))(_0x87db('0x14'));var utils=require(_0x87db('0x15'));var config=require(_0x87db('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x87db('0x17'))['db'];function respondWithStatusCode(_0x4cb7c7,_0x18da16){_0x18da16=_0x18da16||0xcc;return function(_0x53adee){if(_0x53adee){return _0x4cb7c7['sendStatus'](_0x18da16);}return _0x4cb7c7[_0x87db('0x18')](_0x18da16)['end']();};}function respondWithResult(_0x5b4c70,_0x1099dd){_0x1099dd=_0x1099dd||0xc8;return function(_0x3a8738){if(_0x3a8738){return _0x5b4c70[_0x87db('0x18')](_0x1099dd)['json'](_0x3a8738);}};}function respondWithFilteredResult(_0x4e965d,_0x53056f){return function(_0x2d5d89){if(_0x2d5d89){var _0xed97f8=_0x2d5d89[_0x87db('0x19')],_0x45a1f6=_0x53056f[_0x87db('0x1a')],_0x239c55=_0x53056f[_0x87db('0x1a')]+_0x53056f[_0x87db('0x1b')],_0x4f9bc6;if(_0x239c55>=_0xed97f8){_0x239c55=_0xed97f8;_0x4f9bc6=0xc8;}else{_0x4f9bc6=0xce;}_0x4e965d[_0x87db('0x18')](_0x4f9bc6);return _0x4e965d[_0x87db('0x1c')](_0x87db('0x1d'),_0x45a1f6+'-'+_0x239c55+'/'+_0xed97f8)['json'](_0x2d5d89);}return null;};}function patchUpdates(_0x54d6c2){return function(_0x5815e7){try{jsonpatch[_0x87db('0x1e')](_0x5815e7,_0x54d6c2,!![]);}catch(_0x27c02a){return BPromise['reject'](_0x27c02a);}return _0x5815e7['save']();};}function saveUpdates(_0x594ca4,_0x38636f){return function(_0x2d3d5c){if(_0x2d3d5c){return _0x2d3d5c['update'](_0x594ca4)['then'](function(_0xb29abe){return _0xb29abe;});}return null;};}function removeEntity(_0x2c97d6,_0x584149){return function(_0x227ad4){if(_0x227ad4){return _0x227ad4[_0x87db('0x1f')]()[_0x87db('0x20')](function(){_0x2c97d6[_0x87db('0x18')](0xcc)[_0x87db('0x21')]();});}};}function handleEntityNotFound(_0x14b8e5,_0xe36622){return function(_0x2f76dc){if(!_0x2f76dc){_0x14b8e5['sendStatus'](0x194);}return _0x2f76dc;};}function handleError(_0x397124,_0xc7432){_0xc7432=_0xc7432||0x1f4;return function(_0x5eade2){logger[_0x87db('0x22')](_0x5eade2[_0x87db('0x23')]);if(_0x5eade2[_0x87db('0x24')]){delete _0x5eade2[_0x87db('0x24')];}_0x397124[_0x87db('0x18')](_0xc7432)[_0x87db('0x25')](_0x5eade2);};}exports['index']=function(_0x637cf3,_0x493a6){var _0x2ae2ef={},_0x36c620={},_0x304e19={'count':0x0,'rows':[]};var _0x4dd48e=_[_0x87db('0x26')](db[_0x87db('0x27')][_0x87db('0x28')],function(_0x23b799){return{'name':_0x23b799[_0x87db('0x29')],'type':_0x23b799['type']['key']};});_0x36c620[_0x87db('0x2a')]=_[_0x87db('0x26')](_0x4dd48e,_0x87db('0x24'));_0x36c620[_0x87db('0x2b')]=_[_0x87db('0x2c')](_0x637cf3[_0x87db('0x2b')]);_0x36c620[_0x87db('0x2d')]=_['intersection'](_0x36c620[_0x87db('0x2a')],_0x36c620[_0x87db('0x2b')]);_0x2ae2ef[_0x87db('0x2e')]=_[_0x87db('0x2f')](_0x36c620[_0x87db('0x2a')],qs[_0x87db('0x30')](_0x637cf3['query'][_0x87db('0x30')]));_0x2ae2ef['attributes']=_0x2ae2ef[_0x87db('0x2e')][_0x87db('0x31')]?_0x2ae2ef[_0x87db('0x2e')]:_0x36c620[_0x87db('0x2a')];if(!_0x637cf3[_0x87db('0x2b')][_0x87db('0x32')](_0x87db('0x33'))){_0x2ae2ef[_0x87db('0x1b')]=qs[_0x87db('0x1b')](_0x637cf3['query']['limit']);_0x2ae2ef['offset']=qs[_0x87db('0x1a')](_0x637cf3[_0x87db('0x2b')][_0x87db('0x1a')]);}_0x2ae2ef[_0x87db('0x34')]=qs[_0x87db('0x35')](_0x637cf3[_0x87db('0x2b')][_0x87db('0x35')]);_0x2ae2ef['where']=qs['filters'](_['pick'](_0x637cf3[_0x87db('0x2b')],_0x36c620[_0x87db('0x2d')]),_0x4dd48e);if(_0x637cf3['query']['filter']){_0x2ae2ef[_0x87db('0x36')]=_[_0x87db('0x37')](_0x2ae2ef[_0x87db('0x36')],{'$or':_['map'](_0x4dd48e,function(_0x5032e1){if(_0x5032e1['type']!==_0x87db('0x38')){var _0x18233e={};_0x18233e[_0x5032e1[_0x87db('0x24')]]={'$like':'%'+_0x637cf3[_0x87db('0x2b')][_0x87db('0x39')]+'%'};return _0x18233e;}})});}_0x2ae2ef=_[_0x87db('0x37')]({},_0x2ae2ef,_0x637cf3[_0x87db('0x3a')]);var _0x12447f={'where':_0x2ae2ef[_0x87db('0x36')]};return db[_0x87db('0x27')]['count'](_0x12447f)[_0x87db('0x20')](function(_0x422499){_0x304e19[_0x87db('0x19')]=_0x422499;if(_0x637cf3['query']['includeAll']){_0x2ae2ef['include']=[{'all':!![]}];}return db['SquareRecording'][_0x87db('0x3b')](_0x2ae2ef);})[_0x87db('0x20')](function(_0xfca650){_0x304e19[_0x87db('0x3c')]=_0xfca650;return _0x304e19;})[_0x87db('0x20')](respondWithFilteredResult(_0x493a6,_0x2ae2ef))[_0x87db('0x3d')](handleError(_0x493a6,null));};exports[_0x87db('0x3e')]=function(_0x3622f2,_0x46996d){var _0x3a4809={'raw':!![],'where':{'id':_0x3622f2[_0x87db('0x3f')]['id']}},_0x5afda6={};_0x5afda6['model']=_[_0x87db('0x2c')](db[_0x87db('0x27')]['rawAttributes']);_0x5afda6[_0x87db('0x2b')]=_['keys'](_0x3622f2[_0x87db('0x2b')]);_0x5afda6[_0x87db('0x2d')]=_['intersection'](_0x5afda6[_0x87db('0x2a')],_0x5afda6['query']);_0x3a4809[_0x87db('0x2e')]=_[_0x87db('0x2f')](_0x5afda6[_0x87db('0x2a')],qs[_0x87db('0x30')](_0x3622f2[_0x87db('0x2b')][_0x87db('0x30')]));_0x3a4809[_0x87db('0x2e')]=_0x3a4809[_0x87db('0x2e')][_0x87db('0x31')]?_0x3a4809[_0x87db('0x2e')]:_0x5afda6[_0x87db('0x2a')];if(_0x3622f2[_0x87db('0x2b')][_0x87db('0x40')]){_0x3a4809[_0x87db('0x41')]=[{'all':!![]}];}_0x3a4809=_[_0x87db('0x37')]({},_0x3a4809,_0x3622f2[_0x87db('0x3a')]);return db[_0x87db('0x27')][_0x87db('0x42')](_0x3a4809)[_0x87db('0x20')](handleEntityNotFound(_0x46996d,null))[_0x87db('0x20')](respondWithResult(_0x46996d,null))[_0x87db('0x3d')](handleError(_0x46996d,null));};exports[_0x87db('0x43')]=function(_0x48bc32,_0x33b61a){return db[_0x87db('0x27')][_0x87db('0x43')](_0x48bc32['body'],{})['then'](respondWithResult(_0x33b61a,0xc9))[_0x87db('0x3d')](handleError(_0x33b61a,null));};exports['update']=function(_0x2e9a25,_0x5b43be){if(_0x2e9a25[_0x87db('0x44')]['id']){delete _0x2e9a25[_0x87db('0x44')]['id'];}return db[_0x87db('0x27')][_0x87db('0x42')]({'where':{'id':_0x2e9a25[_0x87db('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5b43be,null))[_0x87db('0x20')](saveUpdates(_0x2e9a25[_0x87db('0x44')],null))[_0x87db('0x20')](respondWithResult(_0x5b43be,null))['catch'](handleError(_0x5b43be,null));};exports[_0x87db('0x45')]=function(_0x5c6cda,_0x279c89,_0x4ea574){var _0x57724b=require(_0x87db('0x46'));var _0x525628=![];var _0x2e4409={};if(_0x5c6cda[_0x87db('0x2b')][_0x87db('0x47')]&&_0x5c6cda['query'][_0x87db('0x47')]===_0x87db('0x48')){_0x2e4409[_0x87db('0x48')]=_0x5c6cda[_0x87db('0x3f')]['id'];}else{_0x2e4409['id']=_0x5c6cda[_0x87db('0x3f')]['id'];}return db[_0x87db('0x27')][_0x87db('0x42')]({'where':_0x2e4409,'attributes':['id',_0x87db('0x49'),_0x87db('0x4a')],'raw':!![]})[_0x87db('0x20')](handleEntityNotFound(_0x279c89,null))[_0x87db('0x20')](function(_0xb03865){if(_0xb03865){var _0x567e91=_0xb03865[_0x87db('0x49')];var _0x47727b=util[_0x87db('0x4b')]('%s.cypher',_0x567e91);if(fs[_0x87db('0x4c')](_0x47727b)){_0x525628=!![];return _0x57724b[_0x87db('0x4d')](_0x47727b,_0x567e91,config['secrets']['recording'])[_0x87db('0x20')](function(){return _0xb03865;});}return _0xb03865;}})[_0x87db('0x20')](function(_0x2ba09f){if(_0x2ba09f){var _0x290358=_0x2ba09f['savePath'];if(!fs[_0x87db('0x4c')](_0x290358)){throw new db[(_0x87db('0x4e'))][(_0x87db('0x4f'))](_0x87db('0x50'));}if(_0x2ba09f[_0x87db('0x4a')]){return _0x279c89[_0x87db('0x45')](_0x290358,_0x2ba09f['filename']+path[_0x87db('0x51')](_0x290358),function(){if(_0x525628){fs[_0x87db('0x52')](_0x290358);}});}else{return _0x279c89[_0x87db('0x45')](_0x290358,function(_0x32e58a){if(_0x525628){fs['unlink'](_0x290358);}});}}})[_0x87db('0x3d')](function(_0x2b45b8){if(_0x2b45b8[_0x87db('0x53')]===_0x87db('0x50')){_0x279c89[_0x87db('0x18')](0x194)[_0x87db('0x25')]('Not\x20found');}else{return handleError(_0x279c89,null);}});};exports[_0x87db('0x1f')]=function(_0xb53b15,_0x2a3763){return db[_0x87db('0x27')][_0x87db('0x42')]({'where':{'id':_0xb53b15[_0x87db('0x3f')]['id']}})['then'](function(_0x32ac11){if(!_0x32ac11)throw new ReferenceError(_0x87db('0x54'));return _0x32ac11;})[_0x87db('0x20')](function(_0x2376f4){var _0x575cbf=_0x2376f4[_0x87db('0x49')];logger[_0x87db('0x55')](_0x87db('0x56'),_0x575cbf);if(!_[_0x87db('0x57')](_0x2376f4[_0x87db('0x49')])&&fs['existsSync'](_0x575cbf)){logger[_0x87db('0x55')]('File:\x20\x22'+_0x575cbf+_0x87db('0x58'));fs[_0x87db('0x59')](_0x575cbf);}_0x575cbf=_0x575cbf+_0x87db('0x5a');if(!_['isNil'](_0x2376f4[_0x87db('0x49')])&&fs['existsSync'](_0x575cbf)){logger[_0x87db('0x55')]('File:\x20\x22'+_0x575cbf+_0x87db('0x58'));fs['unlinkSync'](_0x575cbf);}return _0x2376f4;})[_0x87db('0x20')](function(_0x368953){if(!_0x368953)throw new InternalError();return _0x368953[_0x87db('0x1f')]();})[_0x87db('0x20')](function(){_0x2a3763[_0x87db('0x18')](0xcc)[_0x87db('0x21')]();})[_0x87db('0x3d')](handleError(_0x2a3763,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 75a36e4..3fba11f 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 _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 +var _0xf963=['../../config/environment','./squareRecording.attributes','define','SquareRecording','square_recordings','lodash','api','moment','path','rimraf'];(function(_0x3fbca8,_0x2e2902){var _0x47e565=function(_0x2f0673){while(--_0x2f0673){_0x3fbca8['push'](_0x3fbca8['shift']());}};_0x47e565(++_0x2e2902);}(_0xf963,0x11d));var _0x3f96=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf963[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3f96('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3f96('0x1'));var moment=require(_0x3f96('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3f96('0x3'));var rimraf=require(_0x3f96('0x4'));var config=require(_0x3f96('0x5'));var attributes=require(_0x3f96('0x6'));module['exports']=function(_0x2ecae8,_0x56c663){return _0x2ecae8[_0x3f96('0x7')](_0x3f96('0x8'),attributes,{'tableName':_0x3f96('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 0a7a686..b3e2e2a 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 _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 +var _0x5163=['options','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5163,0x1de));var _0x3516=function(_0x5cf2a6,_0x5569a1){_0x5cf2a6=_0x5cf2a6-0x0;var _0x39d9ae=_0x5163[_0x5cf2a6];return _0x39d9ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3516('0x0'));var BPromise=require(_0x3516('0x1'));var rs=require(_0x3516('0x2'));var fs=require('fs');var Redis=require(_0x3516('0x3'));var db=require(_0x3516('0x4'))['db'];var utils=require(_0x3516('0x5'));var logger=require('../../config/logger')(_0x3516('0x6'));var config=require(_0x3516('0x7'));var jayson=require(_0x3516('0x8'));var client=jayson['client'][_0x3516('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546863,_0x131e1e,_0x13421f){return new BPromise(function(_0x4b83d1,_0x4caf80){return client[_0x3516('0xa')](_0x546863,_0x13421f)[_0x3516('0xb')](function(_0x4a6c91){logger[_0x3516('0xc')](_0x3516('0xd'),_0x131e1e,_0x3516('0xe'));logger[_0x3516('0xf')](_0x3516('0x10'),_0x131e1e,_0x3516('0xe'),JSON[_0x3516('0x11')](_0x4a6c91));if(_0x4a6c91['error']){if(_0x4a6c91[_0x3516('0x12')][_0x3516('0x13')]===0x1f4){logger[_0x3516('0x12')](_0x3516('0xd'),_0x131e1e,_0x4a6c91['error'][_0x3516('0x14')]);return _0x4caf80(_0x4a6c91[_0x3516('0x12')]['message']);}logger[_0x3516('0x12')](_0x3516('0xd'),_0x131e1e,_0x4a6c91['error'][_0x3516('0x14')]);return _0x4b83d1(_0x4a6c91[_0x3516('0x12')][_0x3516('0x14')]);}else{logger[_0x3516('0xc')](_0x3516('0xd'),_0x131e1e,_0x3516('0xe'));_0x4b83d1(_0x4a6c91[_0x3516('0x15')][_0x3516('0x14')]);}})['catch'](function(_0x3d5271){logger[_0x3516('0x12')](_0x3516('0xd'),_0x131e1e,_0x3d5271);_0x4caf80(_0x3d5271);});});}exports[_0x3516('0x16')]=function(_0x4cb5e2){var _0x1d7460=this;return new Promise(function(_0x4a0649,_0x8ca881){return db[_0x3516('0x17')][_0x3516('0x18')](_0x4cb5e2[_0x3516('0x19')],{'raw':_0x4cb5e2[_0x3516('0x1a')]?_0x4cb5e2['options']['raw']===undefined?!![]:![]:!![]})[_0x3516('0xb')](function(_0x307c1d){logger[_0x3516('0xc')](_0x3516('0x16'),_0x4cb5e2);logger['debug']('CreateSquareRecording',_0x4cb5e2,JSON['stringify'](_0x307c1d));_0x4a0649(_0x307c1d);})[_0x3516('0x1b')](function(_0x4696f7){logger[_0x3516('0x12')](_0x3516('0x16'),_0x4696f7[_0x3516('0x14')],_0x4cb5e2);_0x8ca881(_0x1d7460[_0x3516('0x12')](0x1f4,_0x4696f7[_0x3516('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 9f8b6e1..d446a1f 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 _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 +var _0xc66d=['show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0xc66d,0xe1));var _0xdc66=function(_0x26f935,_0x17b8c3){_0x26f935=_0x26f935-0x0;var _0x3b9713=_0xc66d[_0x26f935];return _0x3b9713;};'use strict';var multer=require(_0xdc66('0x0'));var util=require(_0xdc66('0x1'));var path=require(_0xdc66('0x2'));var timeout=require(_0xdc66('0x3'));var express=require(_0xdc66('0x4'));var router=express[_0xdc66('0x5')]();var auth=require(_0xdc66('0x6'));var interaction=require(_0xdc66('0x7'));var config=require(_0xdc66('0x8'));var controller=require(_0xdc66('0x9'));router[_0xdc66('0xa')]('/',auth[_0xdc66('0xb')](),controller['index']);router[_0xdc66('0xa')](_0xdc66('0xc'),auth['isAuthenticated'](),controller[_0xdc66('0xd')]);router[_0xdc66('0xa')](_0xdc66('0xe'),auth['isAuthenticated'](),controller[_0xdc66('0xf')]);router['post']('/',auth[_0xdc66('0xb')](),controller['create']);router[_0xdc66('0x10')](_0xdc66('0xe'),auth[_0xdc66('0xb')](),controller[_0xdc66('0x11')]);router[_0xdc66('0x12')](_0xdc66('0xe'),auth[_0xdc66('0xb')](),controller['destroy']);module[_0xdc66('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 2afb434..6da4e04 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 _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 +var _0x1a1f=['sequelize','exports','STRING','DATE'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1a1f,0xec));var _0xf1a1=function(_0x141592,_0x2636dd){_0x141592=_0x141592-0x0;var _0xa30aa1=_0x1a1f[_0x141592];return _0xa30aa1;};'use strict';var Sequelize=require(_0xf1a1('0x0'));module[_0xf1a1('0x1')]={'network':{'type':Sequelize[_0xf1a1('0x2')]},'network_script':{'type':Sequelize[_0xf1a1('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf1a1('0x2')]},'type':{'type':Sequelize[_0xf1a1('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0xf1a1('0x2')]},'callerid':{'type':Sequelize[_0xf1a1('0x2')]},'calleridname':{'type':Sequelize[_0xf1a1('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xf1a1('0x2')]},'callington':{'type':Sequelize[_0xf1a1('0x2')]},'callingtns':{'type':Sequelize[_0xf1a1('0x2')]},'dnid':{'type':Sequelize[_0xf1a1('0x2')]},'rdnis':{'type':Sequelize[_0xf1a1('0x2')]},'context':{'type':Sequelize[_0xf1a1('0x2')]},'extension':{'type':Sequelize[_0xf1a1('0x2')]},'priority':{'type':Sequelize[_0xf1a1('0x2')]},'enhanced':{'type':Sequelize[_0xf1a1('0x2')]},'accountcode':{'type':Sequelize[_0xf1a1('0x2')]},'threadid':{'type':Sequelize[_0xf1a1('0x2')]},'project_name':{'type':Sequelize[_0xf1a1('0x2')]},'joinAt':{'type':Sequelize[_0xf1a1('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a2370fa..db97eb6 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 _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 +var _0x341c=['json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x9cc4f6,_0x1e8920){var _0x7d9d8=function(_0xe6d0ed){while(--_0xe6d0ed){_0x9cc4f6['push'](_0x9cc4f6['shift']());}};_0x7d9d8(++_0x1e8920);}(_0x341c,0xcc));var _0xc341=function(_0x5eb442,_0xe2ae2e){_0x5eb442=_0x5eb442-0x0;var _0x53aad0=_0x341c[_0x5eb442];return _0x53aad0;};'use strict';var pdf=require(_0xc341('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc341('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc341('0x2'));var rp=require(_0xc341('0x3'));var moment=require(_0xc341('0x4'));var BPromise=require(_0xc341('0x5'));var Mustache=require(_0xc341('0x6'));var util=require(_0xc341('0x7'));var path=require(_0xc341('0x8'));var sox=require(_0xc341('0x9'));var csv=require('to-csv');var ejs=require(_0xc341('0xa'));var fs=require('fs');var _=require(_0xc341('0xb'));var squel=require(_0xc341('0xc'));var crypto=require(_0xc341('0xd'));var jsforce=require(_0xc341('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc341('0xf'));var querystring=require(_0xc341('0x10'));var Papa=require(_0xc341('0x11'));var Redis=require(_0xc341('0x12'));var authService=require(_0xc341('0x13'));var qs=require(_0xc341('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc341('0x15'));var logger=require(_0xc341('0x16'))(_0xc341('0x17'));var utils=require(_0xc341('0x18'));var config=require(_0xc341('0x19'));var licenseUtil=require(_0xc341('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551f9d,_0x15c85c){_0x15c85c=_0x15c85c||0xcc;return function(_0x19a093){if(_0x19a093){return _0x551f9d[_0xc341('0x1b')](_0x15c85c);}return _0x551f9d[_0xc341('0x1c')](_0x15c85c)[_0xc341('0x1d')]();};}function respondWithResult(_0x483e30,_0x22fdc3){_0x22fdc3=_0x22fdc3||0xc8;return function(_0x12a4eb){if(_0x12a4eb){return _0x483e30[_0xc341('0x1c')](_0x22fdc3)[_0xc341('0x1e')](_0x12a4eb);}};}function respondWithFilteredResult(_0x989024,_0x2bd235){return function(_0x203a06){if(_0x203a06){var _0x26bbce=_0x203a06['count'],_0x33da6b=_0x2bd235['offset'],_0xdbf615=_0x2bd235[_0xc341('0x1f')]+_0x2bd235[_0xc341('0x20')],_0x1d499c;if(_0xdbf615>=_0x26bbce){_0xdbf615=_0x26bbce;_0x1d499c=0xc8;}else{_0x1d499c=0xce;}_0x989024[_0xc341('0x1c')](_0x1d499c);return _0x989024[_0xc341('0x21')](_0xc341('0x22'),_0x33da6b+'-'+_0xdbf615+'/'+_0x26bbce)[_0xc341('0x1e')](_0x203a06);}return null;};}function patchUpdates(_0x40242a){return function(_0x41a020){try{jsonpatch[_0xc341('0x23')](_0x41a020,_0x40242a,!![]);}catch(_0x2c3384){return BPromise[_0xc341('0x24')](_0x2c3384);}return _0x41a020[_0xc341('0x25')]();};}function saveUpdates(_0x55a3c3,_0x556281){return function(_0x13ae28){if(_0x13ae28){return _0x13ae28[_0xc341('0x26')](_0x55a3c3)[_0xc341('0x27')](function(_0x247774){return _0x247774;});}return null;};}function removeEntity(_0x330cb2,_0x230754){return function(_0x488d43){if(_0x488d43){return _0x488d43[_0xc341('0x28')]()[_0xc341('0x27')](function(){_0x330cb2[_0xc341('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c749b,_0x440a4d){return function(_0x5477e9){if(!_0x5477e9){_0x5c749b[_0xc341('0x1b')](0x194);}return _0x5477e9;};}function handleError(_0x466e0f,_0x2fc83e){_0x2fc83e=_0x2fc83e||0x1f4;return function(_0x36b60e){logger[_0xc341('0x29')](_0x36b60e['stack']);if(_0x36b60e[_0xc341('0x2a')]){delete _0x36b60e[_0xc341('0x2a')];}_0x466e0f[_0xc341('0x1c')](_0x2fc83e)[_0xc341('0x2b')](_0x36b60e);};}exports[_0xc341('0x2c')]=function(_0x3b6cd2,_0x7c443f){var _0x51af9d={},_0x44eec7={},_0x421213={'count':0x0,'rows':[]};var _0x5e69b9=_[_0xc341('0x2d')](db[_0xc341('0x2e')][_0xc341('0x2f')],function(_0x192611){return{'name':_0x192611[_0xc341('0x30')],'type':_0x192611[_0xc341('0x31')]['key']};});_0x44eec7[_0xc341('0x32')]=_[_0xc341('0x2d')](_0x5e69b9,_0xc341('0x2a'));_0x44eec7[_0xc341('0x33')]=_[_0xc341('0x34')](_0x3b6cd2[_0xc341('0x33')]);_0x44eec7[_0xc341('0x35')]=_[_0xc341('0x36')](_0x44eec7[_0xc341('0x32')],_0x44eec7[_0xc341('0x33')]);_0x51af9d[_0xc341('0x37')]=_['intersection'](_0x44eec7['model'],qs[_0xc341('0x38')](_0x3b6cd2['query'][_0xc341('0x38')]));_0x51af9d[_0xc341('0x37')]=_0x51af9d[_0xc341('0x37')][_0xc341('0x39')]?_0x51af9d[_0xc341('0x37')]:_0x44eec7[_0xc341('0x32')];if(!_0x3b6cd2[_0xc341('0x33')][_0xc341('0x3a')](_0xc341('0x3b'))){_0x51af9d['limit']=qs[_0xc341('0x20')](_0x3b6cd2[_0xc341('0x33')][_0xc341('0x20')]);_0x51af9d[_0xc341('0x1f')]=qs[_0xc341('0x1f')](_0x3b6cd2['query']['offset']);}_0x51af9d['order']=qs[_0xc341('0x3c')](_0x3b6cd2[_0xc341('0x33')][_0xc341('0x3c')]);_0x51af9d[_0xc341('0x3d')]=qs['filters'](_['pick'](_0x3b6cd2[_0xc341('0x33')],_0x44eec7[_0xc341('0x35')]),_0x5e69b9);if(_0x3b6cd2[_0xc341('0x33')][_0xc341('0x3e')]){_0x51af9d['where']=_[_0xc341('0x3f')](_0x51af9d[_0xc341('0x3d')],{'$or':_['map'](_0x5e69b9,function(_0x882e09){if(_0x882e09['type']!==_0xc341('0x40')){var _0x2a0cbd={};_0x2a0cbd[_0x882e09[_0xc341('0x2a')]]={'$like':'%'+_0x3b6cd2[_0xc341('0x33')][_0xc341('0x3e')]+'%'};return _0x2a0cbd;}})});}_0x51af9d=_[_0xc341('0x3f')]({},_0x51af9d,_0x3b6cd2[_0xc341('0x41')]);var _0x28a962={'where':_0x51af9d[_0xc341('0x3d')]};return db[_0xc341('0x2e')][_0xc341('0x42')](_0x28a962)[_0xc341('0x27')](function(_0x495a84){_0x421213[_0xc341('0x42')]=_0x495a84;if(_0x3b6cd2[_0xc341('0x33')][_0xc341('0x43')]){_0x51af9d[_0xc341('0x44')]=[{'all':!![]}];}return db[_0xc341('0x2e')][_0xc341('0x45')](_0x51af9d);})[_0xc341('0x27')](function(_0x31bd9e){_0x421213[_0xc341('0x46')]=_0x31bd9e;return _0x421213;})[_0xc341('0x27')](respondWithFilteredResult(_0x7c443f,_0x51af9d))[_0xc341('0x47')](handleError(_0x7c443f,null));};exports[_0xc341('0x48')]=function(_0x19f77,_0x5edcd2){var _0x4ccfb9={'raw':!![],'where':{'id':_0x19f77[_0xc341('0x49')]['id']}},_0x223e24={};_0x223e24['model']=_[_0xc341('0x34')](db[_0xc341('0x2e')][_0xc341('0x2f')]);_0x223e24['query']=_[_0xc341('0x34')](_0x19f77['query']);_0x223e24[_0xc341('0x35')]=_[_0xc341('0x36')](_0x223e24[_0xc341('0x32')],_0x223e24[_0xc341('0x33')]);_0x4ccfb9[_0xc341('0x37')]=_[_0xc341('0x36')](_0x223e24['model'],qs[_0xc341('0x38')](_0x19f77[_0xc341('0x33')][_0xc341('0x38')]));_0x4ccfb9['attributes']=_0x4ccfb9[_0xc341('0x37')]['length']?_0x4ccfb9[_0xc341('0x37')]:_0x223e24[_0xc341('0x32')];if(_0x19f77[_0xc341('0x33')][_0xc341('0x43')]){_0x4ccfb9[_0xc341('0x44')]=[{'all':!![]}];}_0x4ccfb9=_['merge']({},_0x4ccfb9,_0x19f77[_0xc341('0x41')]);return db['SquareReport']['find'](_0x4ccfb9)[_0xc341('0x27')](handleEntityNotFound(_0x5edcd2,null))[_0xc341('0x27')](respondWithResult(_0x5edcd2,null))['catch'](handleError(_0x5edcd2,null));};exports['create']=function(_0x550bcd,_0x4828f1){return db[_0xc341('0x2e')][_0xc341('0x4a')](_0x550bcd['body'],{})['then'](respondWithResult(_0x4828f1,0xc9))[_0xc341('0x47')](handleError(_0x4828f1,null));};exports['update']=function(_0x37e484,_0x281669){if(_0x37e484[_0xc341('0x4b')]['id']){delete _0x37e484[_0xc341('0x4b')]['id'];}return db[_0xc341('0x2e')][_0xc341('0x4c')]({'where':{'id':_0x37e484[_0xc341('0x49')]['id']}})[_0xc341('0x27')](handleEntityNotFound(_0x281669,null))[_0xc341('0x27')](saveUpdates(_0x37e484[_0xc341('0x4b')],null))[_0xc341('0x27')](respondWithResult(_0x281669,null))[_0xc341('0x47')](handleError(_0x281669,null));};exports[_0xc341('0x28')]=function(_0x2126a7,_0x244da7){return db[_0xc341('0x2e')][_0xc341('0x4c')]({'where':{'id':_0x2126a7[_0xc341('0x49')]['id']}})[_0xc341('0x27')](handleEntityNotFound(_0x244da7,null))[_0xc341('0x27')](removeEntity(_0x244da7,null))[_0xc341('0x47')](handleError(_0x244da7,null));};exports['describe']=function(_0x475a9c,_0x2bd737){return db[_0xc341('0x2e')][_0xc341('0x4d')]()[_0xc341('0x27')](respondWithResult(_0x2bd737,null))[_0xc341('0x47')](handleError(_0x2bd737,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 130799b..fd93d2a 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 _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 +var _0x5c53=['bluebird','path','rimraf','../../config/environment','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x1062e3,_0x49349e){var _0x92e616=function(_0x1ca4fe){while(--_0x1ca4fe){_0x1062e3['push'](_0x1062e3['shift']());}};_0x92e616(++_0x49349e);}(_0x5c53,0x83));var _0x35c5=function(_0x45af5c,_0x15ffae){_0x45af5c=_0x45af5c-0x0;var _0x20634a=_0x5c53[_0x45af5c];return _0x20634a;};'use strict';var _=require(_0x35c5('0x0'));var util=require(_0x35c5('0x1'));var logger=require(_0x35c5('0x2'))(_0x35c5('0x3'));var moment=require(_0x35c5('0x4'));var BPromise=require(_0x35c5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x35c5('0x6'));var rimraf=require(_0x35c5('0x7'));var config=require(_0x35c5('0x8'));var attributes=require('./squareReport.attributes');module[_0x35c5('0x9')]=function(_0x4bb864,_0x56e87c){return _0x4bb864[_0x35c5('0xa')](_0x35c5('0xb'),attributes,{'tableName':_0x35c5('0xc'),'paranoid':![],'indexes':[{'name':_0x35c5('0xd'),'fields':[_0x35c5('0xe'),_0x35c5('0xf')]},{'name':_0x35c5('0x10'),'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 f475352..6b46989 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 _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 +var _0x7217=['debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareReport','create','body','options','raw','CreateSquareReport','UpdateSquareReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s'];(function(_0x3ec9fd,_0x550c10){var _0x575641=function(_0x5326db){while(--_0x5326db){_0x3ec9fd['push'](_0x3ec9fd['shift']());}};_0x575641(++_0x550c10);}(_0x7217,0x19e));var _0x7721=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x7217[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('SquareReport,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['CreateSquareReport']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')](_0x3fc09e[_0x7721('0x1a')],{'raw':_0x3fc09e[_0x7721('0x1b')]?_0x3fc09e[_0x7721('0x1b')][_0x7721('0x1c')]===undefined?!![]:![]:!![]})[_0x7721('0xc')](function(_0xaeccc4){logger['info'](_0x7721('0x1d'),_0x3fc09e);logger[_0x7721('0xf')](_0x7721('0x1d'),_0x3fc09e,JSON[_0x7721('0x12')](_0xaeccc4));_0xfec626(_0xaeccc4);})['catch'](function(_0x28f5a6){logger['error'](_0x7721('0x1d'),_0x28f5a6[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x28f5a6[_0x7721('0x15')]));});});};exports[_0x7721('0x1e')]=function(_0x395b15){var _0x2c6b7b=this;return new Promise(function(_0x5b4d74,_0x216f20){return db[_0x7721('0x18')][_0x7721('0x1f')](_0x395b15[_0x7721('0x1a')],{'raw':_0x395b15[_0x7721('0x1b')]?_0x395b15[_0x7721('0x1b')][_0x7721('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x395b15[_0x7721('0x1b')]?_0x395b15[_0x7721('0x1b')]['where']||null:null,'attributes':_0x395b15[_0x7721('0x1b')]?_0x395b15['options']['attributes']||null:null,'limit':_0x395b15[_0x7721('0x1b')]?_0x395b15[_0x7721('0x1b')][_0x7721('0x20')]||null:null})[_0x7721('0xc')](function(_0x1ea4d){logger[_0x7721('0xd')](_0x7721('0x1e'),_0x395b15);logger[_0x7721('0xf')]('UpdateSquareReport',_0x395b15,JSON[_0x7721('0x12')](_0x1ea4d));_0x5b4d74(_0x1ea4d);})[_0x7721('0x17')](function(_0x497f9f){logger['error'](_0x7721('0x1e'),_0x497f9f[_0x7721('0x15')],_0x395b15);_0x216f20(_0x2c6b7b['error'](0x1f4,_0x497f9f[_0x7721('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ee84641..d9b3334 100644 --- a/server/api/squareReportDetail/index.js +++ b/server/api/squareReportDetail/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_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 +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(_0x41f4b7,_0x4c867d){var _0xe93221=function(_0x359cb5){while(--_0x359cb5){_0x41f4b7['push'](_0x41f4b7['shift']());}};_0xe93221(++_0x4c867d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1a6a88,_0x5682fb){_0x1a6a88=_0x1a6a88-0x0;var _0x22f4b0=_0x5f2f[_0x1a6a88];return _0x22f4b0;};'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 f40cdbb..6d6e930 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 _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 +var _0x9a1e=['STRING','sequelize'];(function(_0x355538,_0x4caa28){var _0x2a89be=function(_0x50092c){while(--_0x50092c){_0x355538['push'](_0x355538['shift']());}};_0x2a89be(++_0x4caa28);}(_0x9a1e,0x15b));var _0xe9a1=function(_0x21509f,_0x377307){_0x21509f=_0x21509f-0x0;var _0x49e2cb=_0x9a1e[_0x21509f];return _0x49e2cb;};'use strict';var Sequelize=require(_0xe9a1('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9a1('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0xe9a1('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe9a1('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index cd40d3e..ac7e1e6 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 _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 +var _0x0852=['catch','show','params','create','body','find','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','then','destroy','end','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x5caabb,_0x2b0cc1){var _0x2929d8=function(_0x389698){while(--_0x389698){_0x5caabb['push'](_0x5caabb['shift']());}};_0x2929d8(++_0x2b0cc1);}(_0x0852,0xe5));var _0x2085=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0852[_0x27af45];return _0x18df21;};'use strict';var pdf=require(_0x2085('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2085('0x1'));var zipdir=require(_0x2085('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2085('0x3'));var moment=require(_0x2085('0x4'));var BPromise=require(_0x2085('0x5'));var Mustache=require(_0x2085('0x6'));var util=require(_0x2085('0x7'));var path=require('path');var sox=require(_0x2085('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2085('0x9'));var squel=require(_0x2085('0xa'));var crypto=require('crypto');var jsforce=require(_0x2085('0xb'));var deskjs=require(_0x2085('0xc'));var toCsv=require(_0x2085('0xd'));var querystring=require(_0x2085('0xe'));var Papa=require(_0x2085('0xf'));var Redis=require(_0x2085('0x10'));var authService=require(_0x2085('0x11'));var qs=require(_0x2085('0x12'));var as=require(_0x2085('0x13'));var hardwareService=require(_0x2085('0x14'));var logger=require(_0x2085('0x15'))(_0x2085('0x16'));var utils=require('../../config/utils');var config=require(_0x2085('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2085('0x18'))['db'];function respondWithStatusCode(_0x3d33f5,_0x1908a1){_0x1908a1=_0x1908a1||0xcc;return function(_0x193a5d){if(_0x193a5d){return _0x3d33f5[_0x2085('0x19')](_0x1908a1);}return _0x3d33f5[_0x2085('0x1a')](_0x1908a1)['end']();};}function respondWithResult(_0x5b8617,_0x1b9540){_0x1b9540=_0x1b9540||0xc8;return function(_0x2b533a){if(_0x2b533a){return _0x5b8617['status'](_0x1b9540)[_0x2085('0x1b')](_0x2b533a);}};}function respondWithFilteredResult(_0x3c056b,_0x50ac29){return function(_0x165dda){if(_0x165dda){var _0x15b770=_0x165dda[_0x2085('0x1c')],_0x2432ad=_0x50ac29['offset'],_0x5338c7=_0x50ac29[_0x2085('0x1d')]+_0x50ac29['limit'],_0x581e3e;if(_0x5338c7>=_0x15b770){_0x5338c7=_0x15b770;_0x581e3e=0xc8;}else{_0x581e3e=0xce;}_0x3c056b[_0x2085('0x1a')](_0x581e3e);return _0x3c056b[_0x2085('0x1e')](_0x2085('0x1f'),_0x2432ad+'-'+_0x5338c7+'/'+_0x15b770)[_0x2085('0x1b')](_0x165dda);}return null;};}function patchUpdates(_0x28c68b){return function(_0x159522){try{jsonpatch[_0x2085('0x20')](_0x159522,_0x28c68b,!![]);}catch(_0x4d2481){return BPromise['reject'](_0x4d2481);}return _0x159522[_0x2085('0x21')]();};}function saveUpdates(_0x5aa7d0,_0x5e5ce5){return function(_0x44fc5f){if(_0x44fc5f){return _0x44fc5f['update'](_0x5aa7d0)[_0x2085('0x22')](function(_0x4e76e5){return _0x4e76e5;});}return null;};}function removeEntity(_0x54ca8b,_0x38cac9){return function(_0x533b24){if(_0x533b24){return _0x533b24[_0x2085('0x23')]()[_0x2085('0x22')](function(){_0x54ca8b[_0x2085('0x1a')](0xcc)[_0x2085('0x24')]();});}};}function handleEntityNotFound(_0xab9cd6,_0x11fb07){return function(_0x40afb5){if(!_0x40afb5){_0xab9cd6['sendStatus'](0x194);}return _0x40afb5;};}function handleError(_0x4343ee,_0x681756){_0x681756=_0x681756||0x1f4;return function(_0x12e6c7){logger['error'](_0x12e6c7['stack']);if(_0x12e6c7[_0x2085('0x25')]){delete _0x12e6c7[_0x2085('0x25')];}_0x4343ee[_0x2085('0x1a')](_0x681756)[_0x2085('0x26')](_0x12e6c7);};}exports[_0x2085('0x27')]=function(_0x4c524c,_0x49d961){var _0x26cea8={},_0x582516={},_0x241abd={'count':0x0,'rows':[]};var _0x5dab1=_[_0x2085('0x28')](db[_0x2085('0x29')][_0x2085('0x2a')],function(_0x53e121){return{'name':_0x53e121[_0x2085('0x2b')],'type':_0x53e121[_0x2085('0x2c')][_0x2085('0x2d')]};});_0x582516['model']=_[_0x2085('0x28')](_0x5dab1,_0x2085('0x25'));_0x582516[_0x2085('0x2e')]=_[_0x2085('0x2f')](_0x4c524c[_0x2085('0x2e')]);_0x582516[_0x2085('0x30')]=_[_0x2085('0x31')](_0x582516[_0x2085('0x32')],_0x582516[_0x2085('0x2e')]);_0x26cea8[_0x2085('0x33')]=_[_0x2085('0x31')](_0x582516[_0x2085('0x32')],qs[_0x2085('0x34')](_0x4c524c[_0x2085('0x2e')][_0x2085('0x34')]));_0x26cea8[_0x2085('0x33')]=_0x26cea8[_0x2085('0x33')][_0x2085('0x35')]?_0x26cea8['attributes']:_0x582516[_0x2085('0x32')];if(!_0x4c524c['query'][_0x2085('0x36')]('nolimit')){_0x26cea8[_0x2085('0x37')]=qs[_0x2085('0x37')](_0x4c524c[_0x2085('0x2e')][_0x2085('0x37')]);_0x26cea8['offset']=qs[_0x2085('0x1d')](_0x4c524c[_0x2085('0x2e')][_0x2085('0x1d')]);}_0x26cea8['order']=qs[_0x2085('0x38')](_0x4c524c[_0x2085('0x2e')]['sort']);_0x26cea8[_0x2085('0x39')]=qs[_0x2085('0x30')](_[_0x2085('0x3a')](_0x4c524c[_0x2085('0x2e')],_0x582516[_0x2085('0x30')]),_0x5dab1);if(_0x4c524c[_0x2085('0x2e')][_0x2085('0x3b')]){_0x26cea8[_0x2085('0x39')]=_[_0x2085('0x3c')](_0x26cea8[_0x2085('0x39')],{'$or':_['map'](_0x5dab1,function(_0x45cdf9){if(_0x45cdf9['type']!==_0x2085('0x3d')){var _0x31d2f7={};_0x31d2f7[_0x45cdf9[_0x2085('0x25')]]={'$like':'%'+_0x4c524c[_0x2085('0x2e')][_0x2085('0x3b')]+'%'};return _0x31d2f7;}})});}_0x26cea8=_[_0x2085('0x3c')]({},_0x26cea8,_0x4c524c[_0x2085('0x3e')]);var _0x2665ef={'where':_0x26cea8[_0x2085('0x39')]};return db[_0x2085('0x29')][_0x2085('0x1c')](_0x2665ef)[_0x2085('0x22')](function(_0x22357d){_0x241abd[_0x2085('0x1c')]=_0x22357d;if(_0x4c524c[_0x2085('0x2e')][_0x2085('0x3f')]){_0x26cea8[_0x2085('0x40')]=[{'all':!![]}];}return db[_0x2085('0x29')][_0x2085('0x41')](_0x26cea8);})['then'](function(_0x1dfac6){_0x241abd[_0x2085('0x42')]=_0x1dfac6;return _0x241abd;})[_0x2085('0x22')](respondWithFilteredResult(_0x49d961,_0x26cea8))[_0x2085('0x43')](handleError(_0x49d961,null));};exports[_0x2085('0x44')]=function(_0x25ca03,_0x412d74){var _0x8279ae={'raw':!![],'where':{'id':_0x25ca03[_0x2085('0x45')]['id']}},_0x417457={};_0x417457['model']=_[_0x2085('0x2f')](db[_0x2085('0x29')][_0x2085('0x2a')]);_0x417457['query']=_[_0x2085('0x2f')](_0x25ca03[_0x2085('0x2e')]);_0x417457['filters']=_[_0x2085('0x31')](_0x417457[_0x2085('0x32')],_0x417457[_0x2085('0x2e')]);_0x8279ae[_0x2085('0x33')]=_[_0x2085('0x31')](_0x417457[_0x2085('0x32')],qs['fields'](_0x25ca03[_0x2085('0x2e')][_0x2085('0x34')]));_0x8279ae[_0x2085('0x33')]=_0x8279ae[_0x2085('0x33')][_0x2085('0x35')]?_0x8279ae[_0x2085('0x33')]:_0x417457['model'];if(_0x25ca03[_0x2085('0x2e')][_0x2085('0x3f')]){_0x8279ae[_0x2085('0x40')]=[{'all':!![]}];}_0x8279ae=_[_0x2085('0x3c')]({},_0x8279ae,_0x25ca03[_0x2085('0x3e')]);return db[_0x2085('0x29')]['find'](_0x8279ae)[_0x2085('0x22')](handleEntityNotFound(_0x412d74,null))['then'](respondWithResult(_0x412d74,null))['catch'](handleError(_0x412d74,null));};exports[_0x2085('0x46')]=function(_0x1824ad,_0x2ea86b){return db[_0x2085('0x29')][_0x2085('0x46')](_0x1824ad[_0x2085('0x47')],{})[_0x2085('0x22')](respondWithResult(_0x2ea86b,0xc9))['catch'](handleError(_0x2ea86b,null));};exports['update']=function(_0x352fc8,_0x4765ba){if(_0x352fc8[_0x2085('0x47')]['id']){delete _0x352fc8[_0x2085('0x47')]['id'];}return db[_0x2085('0x29')][_0x2085('0x48')]({'where':{'id':_0x352fc8[_0x2085('0x45')]['id']}})[_0x2085('0x22')](handleEntityNotFound(_0x4765ba,null))['then'](saveUpdates(_0x352fc8['body'],null))[_0x2085('0x22')](respondWithResult(_0x4765ba,null))[_0x2085('0x43')](handleError(_0x4765ba,null));};exports['destroy']=function(_0x3fde25,_0x3a2daa){return db[_0x2085('0x29')][_0x2085('0x48')]({'where':{'id':_0x3fde25[_0x2085('0x45')]['id']}})[_0x2085('0x22')](handleEntityNotFound(_0x3a2daa,null))[_0x2085('0x22')](removeEntity(_0x3a2daa,null))[_0x2085('0x43')](handleError(_0x3a2daa,null));};exports[_0x2085('0x49')]=function(_0x2b3992,_0x3a21f0){return db['SquareDetailsReport'][_0x2085('0x49')]()[_0x2085('0x22')](respondWithResult(_0x3a21f0,null))[_0x2085('0x43')](handleError(_0x3a21f0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 81b120e..6e256cd 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 _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 +var _0xabdd=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details'];(function(_0x239af1,_0x597d34){var _0x5d3222=function(_0x16565d){while(--_0x16565d){_0x239af1['push'](_0x239af1['shift']());}};_0x5d3222(++_0x597d34);}(_0xabdd,0x82));var _0xdabd=function(_0x4bba15,_0x386e5f){_0x4bba15=_0x4bba15-0x0;var _0xd9b12c=_0xabdd[_0x4bba15];return _0xd9b12c;};'use strict';var _=require(_0xdabd('0x0'));var util=require(_0xdabd('0x1'));var logger=require(_0xdabd('0x2'))(_0xdabd('0x3'));var moment=require('moment');var BPromise=require(_0xdabd('0x4'));var rp=require(_0xdabd('0x5'));var fs=require('fs');var path=require(_0xdabd('0x6'));var rimraf=require('rimraf');var config=require(_0xdabd('0x7'));var attributes=require(_0xdabd('0x8'));module[_0xdabd('0x9')]=function(_0x175415,_0x96a737){return _0x175415[_0xdabd('0xa')](_0xdabd('0xb'),attributes,{'tableName':_0xdabd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index f3d1c36..0614157 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 _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 +var _0x6a39=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options'];(function(_0x3f70b2,_0x573060){var _0x5a10fb=function(_0x11ec79){while(--_0x11ec79){_0x3f70b2['push'](_0x3f70b2['shift']());}};_0x5a10fb(++_0x573060);}(_0x6a39,0x104));var _0x96a3=function(_0x22bae4,_0x22474b){_0x22bae4=_0x22bae4-0x0;var _0x2047b6=_0x6a39[_0x22bae4];return _0x2047b6;};'use strict';var _=require('lodash');var util=require(_0x96a3('0x0'));var moment=require(_0x96a3('0x1'));var BPromise=require('bluebird');var rs=require(_0x96a3('0x2'));var fs=require('fs');var Redis=require(_0x96a3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x96a3('0x4'))(_0x96a3('0x5'));var config=require(_0x96a3('0x6'));var jayson=require(_0x96a3('0x7'));var client=jayson[_0x96a3('0x8')][_0x96a3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30b544,_0x1a398d,_0x443448){return new BPromise(function(_0xd94029,_0x3d38d5){return client['request'](_0x30b544,_0x443448)[_0x96a3('0xa')](function(_0x1b6ead){logger[_0x96a3('0xb')](_0x96a3('0xc'),_0x1a398d,_0x96a3('0xd'));logger[_0x96a3('0xe')](_0x96a3('0xf'),_0x1a398d,_0x96a3('0xd'),JSON[_0x96a3('0x10')](_0x1b6ead));if(_0x1b6ead[_0x96a3('0x11')]){if(_0x1b6ead[_0x96a3('0x11')][_0x96a3('0x12')]===0x1f4){logger[_0x96a3('0x11')](_0x96a3('0xc'),_0x1a398d,_0x1b6ead[_0x96a3('0x11')]['message']);return _0x3d38d5(_0x1b6ead[_0x96a3('0x11')]['message']);}logger[_0x96a3('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1a398d,_0x1b6ead['error'][_0x96a3('0x13')]);return _0xd94029(_0x1b6ead[_0x96a3('0x11')][_0x96a3('0x13')]);}else{logger[_0x96a3('0xb')](_0x96a3('0xc'),_0x1a398d,_0x96a3('0xd'));_0xd94029(_0x1b6ead['result'][_0x96a3('0x13')]);}})[_0x96a3('0x14')](function(_0x830e96){logger[_0x96a3('0x11')](_0x96a3('0xc'),_0x1a398d,_0x830e96);_0x3d38d5(_0x830e96);});});}exports[_0x96a3('0x15')]=function(_0x268bbf){var _0x5160af=this;return new Promise(function(_0x12c62f,_0x29c236){return db[_0x96a3('0x16')][_0x96a3('0x17')](_0x268bbf[_0x96a3('0x18')],{'raw':_0x268bbf[_0x96a3('0x19')]?_0x268bbf[_0x96a3('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x96a3('0xa')](function(_0x3f915a){logger[_0x96a3('0xb')]('CreateSquareDetailsReport',_0x268bbf);logger['debug'](_0x96a3('0x15'),_0x268bbf,JSON[_0x96a3('0x10')](_0x3f915a));_0x12c62f(_0x3f915a);})[_0x96a3('0x14')](function(_0x1ed43a){logger['error'](_0x96a3('0x15'),_0x1ed43a[_0x96a3('0x13')],_0x268bbf);_0x29c236(_0x5160af['error'](0x1f4,_0x1ed43a[_0x96a3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 3c1e69f..7d1e795 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 _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 +var _0x2125=['Router','../../components/auth/service','./system.controller','isAuthenticated','index','get','killProcess'];(function(_0x389aac,_0xa31159){var _0x3f29f2=function(_0x4f8487){while(--_0x4f8487){_0x389aac['push'](_0x389aac['shift']());}};_0x3f29f2(++_0xa31159);}(_0x2125,0x15e));var _0x5212=function(_0xaa2232,_0x479655){_0xaa2232=_0xaa2232-0x0;var _0x156aa0=_0x2125[_0xaa2232];return _0x156aa0;};'use strict';var express=require('express');var router=express[_0x5212('0x0')]();var auth=require(_0x5212('0x1'));var controller=require(_0x5212('0x2'));router['get']('/',auth[_0x5212('0x3')](),controller[_0x5212('0x4')]);router[_0x5212('0x5')]('/process/:pid/kill',auth[_0x5212('0x3')](),controller[_0x5212('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index bcfe303..834052f 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 _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 +var _0xf7a1=['getAllData','then','status','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x596099,_0x4da4a9){var _0x24b9ef=function(_0x5cff0d){while(--_0x5cff0d){_0x596099['push'](_0x596099['shift']());}};_0x24b9ef(++_0x4da4a9);}(_0xf7a1,0xef));var _0x1f7a=function(_0x12699c,_0xf9dd49){_0x12699c=_0x12699c-0x0;var _0x54360e=_0xf7a1[_0x12699c];return _0x54360e;};'use strict';var info=require(_0x1f7a('0x0'));var exec=require(_0x1f7a('0x1'))[_0x1f7a('0x2')];var logger=require(_0x1f7a('0x3'))(_0x1f7a('0x4'));var util=require(_0x1f7a('0x5'));var BPromise=require(_0x1f7a('0x6'));var _=require(_0x1f7a('0x7'));function handleError(_0x415a8b,_0x5db476,_0x56c12f){_0x5db476=_0x5db476||0x1f4;return function(_0x9b9a77){logger['error'](_0x1f7a('0x8'),_0x56c12f,_0x5db476,util[_0x1f7a('0x9')](_0x9b9a77,{'showHidden':![],'depth':null}));delete _0x9b9a77[_0x1f7a('0xa')];_0x415a8b['status'](_0x5db476)['send'](_0x9b9a77);};}exports['index']=function(_0x5a02e9,_0x3338fc){return info[_0x1f7a('0xb')]()[_0x1f7a('0xc')](function(_0x262fea){return _0x3338fc[_0x1f7a('0xd')](0xc8)['json'](_0x262fea);})['catch'](function(_0x30edbf){return _0x3338fc[_0x1f7a('0xd')](0x1f4)['json'](_0x30edbf);});};exports[_0x1f7a('0xe')]=function(_0x2db7b6,_0x1674b5){var _0x2799f4=[_0x1f7a('0xf')];return new BPromise(function(_0x484484,_0x42bc1c){return exec(util['format'](_0x1f7a('0x10'),_0x2db7b6[_0x1f7a('0x11')][_0x1f7a('0x12')]),function(_0x45b447,_0x11a0d8,_0x26bbfa){if(_0x45b447){return _0x42bc1c(_0x45b447);}return _0x484484(_0x11a0d8);});})[_0x1f7a('0xc')](function(_0x2ab9fe){var _0x48203c=![];var _0x2a8935=_0x2ab9fe[_0x1f7a('0x13')](/\n/);for(var _0x684a0d=0x0,_0xf79e2e=_0x2799f4[_0x1f7a('0x14')];_0x684a0d<_0xf79e2e,_0x48203c===![];_0x684a0d+=0x1){if(_0x2ab9fe['indexOf'](_0x2799f4[_0x684a0d])>=0x0){_0x48203c=!![];}}if(!_0x48203c){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x2db7b6['params'][_0x1f7a('0x12')]));}process[_0x1f7a('0x15')](_0x2db7b6['params'][_0x1f7a('0x12')],_0x1f7a('0x16'));return _0x1674b5['status'](0xc8)['json']({'message':util['format'](_0x1f7a('0x17'),_0x2db7b6['params'][_0x1f7a('0x12')])});})[_0x1f7a('0x18')](handleError(_0x1674b5,null,_0x1f7a('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 57519ab..2d64571 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 _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 +var _0xda55=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x370732,_0x304cac){var _0x3226d8=function(_0xafef58){while(--_0xafef58){_0x370732['push'](_0x370732['shift']());}};_0x3226d8(++_0x304cac);}(_0xda55,0x6d));var _0x5da5=function(_0x418432,_0x537680){_0x418432=_0x418432-0x0;var _0x3023a9=_0xda55[_0x418432];return _0x3023a9;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var auth=require(_0x5da5('0x4'));var interaction=require(_0x5da5('0x5'));var config=require(_0x5da5('0x6'));var controller=require('./tag.controller');router[_0x5da5('0x7')]('/',auth['isAuthenticated'](),controller[_0x5da5('0x8')]);router['get'](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0xb')]);router[_0x5da5('0xc')]('/',auth[_0x5da5('0xa')](),controller[_0x5da5('0xd')]);router[_0x5da5('0xe')](_0x5da5('0x9'),auth['isAuthenticated'](),controller[_0x5da5('0xf')]);router[_0x5da5('0x10')](_0x5da5('0x9'),auth[_0x5da5('0xa')](),controller[_0x5da5('0x11')]);module[_0x5da5('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 2a78306..a79ab70 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 _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 +var _0xda3f=['exports','STRING'];(function(_0x43a9d3,_0x5d5a27){var _0x5cfcd6=function(_0x561a56){while(--_0x561a56){_0x43a9d3['push'](_0x43a9d3['shift']());}};_0x5cfcd6(++_0x5d5a27);}(_0xda3f,0xec));var _0xfda3=function(_0x5ca6ef,_0x1ba5c9){_0x5ca6ef=_0x5ca6ef-0x0;var _0x30a259=_0xda3f[_0x5ca6ef];return _0x30a259;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'name':{'type':Sequelize[_0xfda3('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index e020fb5..a15a286 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 _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 +var _0xa8c6=['length','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','end','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','keys'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa8c6,0x10f));var _0x6a8c=function(_0xf1f2e0,_0x37c415){_0xf1f2e0=_0xf1f2e0-0x0;var _0x991373=_0xa8c6[_0xf1f2e0];return _0x991373;};'use strict';var pdf=require(_0x6a8c('0x0'));var emlformat=require(_0x6a8c('0x1'));var rimraf=require(_0x6a8c('0x2'));var zipdir=require(_0x6a8c('0x3'));var jsonpatch=require(_0x6a8c('0x4'));var rp=require(_0x6a8c('0x5'));var moment=require(_0x6a8c('0x6'));var BPromise=require(_0x6a8c('0x7'));var Mustache=require(_0x6a8c('0x8'));var util=require(_0x6a8c('0x9'));var path=require(_0x6a8c('0xa'));var sox=require(_0x6a8c('0xb'));var csv=require(_0x6a8c('0xc'));var ejs=require(_0x6a8c('0xd'));var fs=require('fs');var _=require(_0x6a8c('0xe'));var squel=require(_0x6a8c('0xf'));var crypto=require(_0x6a8c('0x10'));var jsforce=require(_0x6a8c('0x11'));var deskjs=require(_0x6a8c('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6a8c('0x13'));var Papa=require(_0x6a8c('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6a8c('0x15'));var hardwareService=require(_0x6a8c('0x16'));var logger=require(_0x6a8c('0x17'))(_0x6a8c('0x18'));var utils=require(_0x6a8c('0x19'));var config=require(_0x6a8c('0x1a'));var licenseUtil=require(_0x6a8c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x507465,_0x4294dc){_0x4294dc=_0x4294dc||0xcc;return function(_0x49be17){if(_0x49be17){return _0x507465[_0x6a8c('0x1c')](_0x4294dc);}return _0x507465['status'](_0x4294dc)['end']();};}function respondWithResult(_0x3746c4,_0x468e01){_0x468e01=_0x468e01||0xc8;return function(_0x3c37e9){if(_0x3c37e9){return _0x3746c4[_0x6a8c('0x1d')](_0x468e01)[_0x6a8c('0x1e')](_0x3c37e9);}};}function respondWithFilteredResult(_0x3804ed,_0x411df6){return function(_0x30cc78){if(_0x30cc78){var _0x3efa3b=_0x30cc78[_0x6a8c('0x1f')],_0x5e693b=_0x411df6[_0x6a8c('0x20')],_0x265188=_0x411df6[_0x6a8c('0x20')]+_0x411df6[_0x6a8c('0x21')],_0xf18fa8;if(_0x265188>=_0x3efa3b){_0x265188=_0x3efa3b;_0xf18fa8=0xc8;}else{_0xf18fa8=0xce;}_0x3804ed['status'](_0xf18fa8);return _0x3804ed[_0x6a8c('0x22')]('Content-Range',_0x5e693b+'-'+_0x265188+'/'+_0x3efa3b)[_0x6a8c('0x1e')](_0x30cc78);}return null;};}function patchUpdates(_0x303781){return function(_0xf04363){try{jsonpatch[_0x6a8c('0x23')](_0xf04363,_0x303781,!![]);}catch(_0x495db4){return BPromise[_0x6a8c('0x24')](_0x495db4);}return _0xf04363[_0x6a8c('0x25')]();};}function saveUpdates(_0x2f828d,_0x22cc45){return function(_0x3ad9cb){if(_0x3ad9cb){return _0x3ad9cb[_0x6a8c('0x26')](_0x2f828d)[_0x6a8c('0x27')](function(_0x3d9b79){return _0x3d9b79;});}return null;};}function removeEntity(_0x141489,_0x2a9200){return function(_0x478364){if(_0x478364){return _0x478364[_0x6a8c('0x28')]()[_0x6a8c('0x27')](function(){var _0x2c3aba=_0x478364[_0x6a8c('0x29')]({'plain':!![]});var _0x378d3c=_0x6a8c('0x2a');return db[_0x6a8c('0x2b')][_0x6a8c('0x28')]({'where':{'type':_0x378d3c,'resourceId':_0x2c3aba['id']}})['then'](function(){return _0x478364;});})[_0x6a8c('0x27')](function(){_0x141489[_0x6a8c('0x1d')](0xcc)[_0x6a8c('0x2c')]();});}};}function handleEntityNotFound(_0x53bdea,_0x59eaa2){return function(_0xd09e86){if(!_0xd09e86){_0x53bdea[_0x6a8c('0x1c')](0x194);}return _0xd09e86;};}function handleError(_0x211478,_0x2e6f15){_0x2e6f15=_0x2e6f15||0x1f4;return function(_0x241238){logger[_0x6a8c('0x2d')](_0x241238[_0x6a8c('0x2e')]);if(_0x241238[_0x6a8c('0x2f')]){delete _0x241238[_0x6a8c('0x2f')];}_0x211478[_0x6a8c('0x1d')](_0x2e6f15)[_0x6a8c('0x30')](_0x241238);};}exports[_0x6a8c('0x31')]=function(_0x32463e,_0x49dda8){var _0x1a352e={},_0x53d4c2={},_0x53cfb5={'count':0x0,'rows':[]};var _0x69637e=_['map'](db[_0x6a8c('0x32')][_0x6a8c('0x33')],function(_0x58d8b9){return{'name':_0x58d8b9[_0x6a8c('0x34')],'type':_0x58d8b9[_0x6a8c('0x35')][_0x6a8c('0x36')]};});_0x53d4c2['model']=_[_0x6a8c('0x37')](_0x69637e,_0x6a8c('0x2f'));_0x53d4c2[_0x6a8c('0x38')]=_['keys'](_0x32463e[_0x6a8c('0x38')]);_0x53d4c2[_0x6a8c('0x39')]=_[_0x6a8c('0x3a')](_0x53d4c2[_0x6a8c('0x3b')],_0x53d4c2['query']);_0x1a352e[_0x6a8c('0x3c')]=_[_0x6a8c('0x3a')](_0x53d4c2[_0x6a8c('0x3b')],qs[_0x6a8c('0x3d')](_0x32463e['query'][_0x6a8c('0x3d')]));_0x1a352e['attributes']=_0x1a352e[_0x6a8c('0x3c')]['length']?_0x1a352e[_0x6a8c('0x3c')]:_0x53d4c2[_0x6a8c('0x3b')];if(!_0x32463e['query'][_0x6a8c('0x3e')]('nolimit')){_0x1a352e[_0x6a8c('0x21')]=qs[_0x6a8c('0x21')](_0x32463e[_0x6a8c('0x38')]['limit']);_0x1a352e['offset']=qs[_0x6a8c('0x20')](_0x32463e[_0x6a8c('0x38')][_0x6a8c('0x20')]);}_0x1a352e[_0x6a8c('0x3f')]=qs[_0x6a8c('0x40')](_0x32463e[_0x6a8c('0x38')][_0x6a8c('0x40')]);_0x1a352e[_0x6a8c('0x41')]=qs['filters'](_[_0x6a8c('0x42')](_0x32463e[_0x6a8c('0x38')],_0x53d4c2[_0x6a8c('0x39')]),_0x69637e);if(_0x32463e[_0x6a8c('0x38')][_0x6a8c('0x43')]){_0x1a352e['where']=_[_0x6a8c('0x44')](_0x1a352e[_0x6a8c('0x41')],{'$or':_[_0x6a8c('0x37')](_0x69637e,function(_0x98969b){if(_0x98969b[_0x6a8c('0x35')]!=='VIRTUAL'){var _0x25363a={};_0x25363a[_0x98969b['name']]={'$like':'%'+_0x32463e['query'][_0x6a8c('0x43')]+'%'};return _0x25363a;}})});}_0x1a352e=_[_0x6a8c('0x44')]({},_0x1a352e,_0x32463e[_0x6a8c('0x45')]);var _0x268f28={'where':_0x1a352e[_0x6a8c('0x41')]};return db[_0x6a8c('0x32')][_0x6a8c('0x1f')](_0x268f28)[_0x6a8c('0x27')](function(_0x5085fb){_0x53cfb5[_0x6a8c('0x1f')]=_0x5085fb;if(_0x32463e[_0x6a8c('0x38')]['includeAll']){_0x1a352e[_0x6a8c('0x46')]=[{'all':!![]}];}return db[_0x6a8c('0x32')][_0x6a8c('0x47')](_0x1a352e);})[_0x6a8c('0x27')](function(_0x22fb87){_0x53cfb5[_0x6a8c('0x48')]=_0x22fb87;return _0x53cfb5;})[_0x6a8c('0x27')](respondWithFilteredResult(_0x49dda8,_0x1a352e))[_0x6a8c('0x49')](handleError(_0x49dda8,null));};exports[_0x6a8c('0x4a')]=function(_0x1813a4,_0x4f1d1c){var _0x8ff7ef={'raw':!![],'where':{'id':_0x1813a4[_0x6a8c('0x4b')]['id']}},_0x2916be={};_0x2916be[_0x6a8c('0x3b')]=_['keys'](db[_0x6a8c('0x32')][_0x6a8c('0x33')]);_0x2916be['query']=_[_0x6a8c('0x4c')](_0x1813a4[_0x6a8c('0x38')]);_0x2916be[_0x6a8c('0x39')]=_[_0x6a8c('0x3a')](_0x2916be[_0x6a8c('0x3b')],_0x2916be[_0x6a8c('0x38')]);_0x8ff7ef[_0x6a8c('0x3c')]=_['intersection'](_0x2916be[_0x6a8c('0x3b')],qs[_0x6a8c('0x3d')](_0x1813a4[_0x6a8c('0x38')][_0x6a8c('0x3d')]));_0x8ff7ef[_0x6a8c('0x3c')]=_0x8ff7ef[_0x6a8c('0x3c')][_0x6a8c('0x4d')]?_0x8ff7ef['attributes']:_0x2916be[_0x6a8c('0x3b')];if(_0x1813a4['query'][_0x6a8c('0x4e')]){_0x8ff7ef[_0x6a8c('0x46')]=[{'all':!![]}];}_0x8ff7ef=_['merge']({},_0x8ff7ef,_0x1813a4['options']);return db['Tag']['find'](_0x8ff7ef)[_0x6a8c('0x27')](handleEntityNotFound(_0x4f1d1c,null))[_0x6a8c('0x27')](respondWithResult(_0x4f1d1c,null))[_0x6a8c('0x49')](handleError(_0x4f1d1c,null));};exports[_0x6a8c('0x4f')]=function(_0x5b552a,_0x34c76a){return db['Tag']['create'](_0x5b552a[_0x6a8c('0x50')],{})[_0x6a8c('0x27')](function(_0x6911d6){var _0x432813=_0x5b552a[_0x6a8c('0x51')]['get']({'plain':!![]});if(!_0x432813)throw new Error(_0x6a8c('0x52'));if(_0x432813[_0x6a8c('0x53')]===_0x6a8c('0x51')){var _0x58fcf6=_0x6911d6['get']({'plain':!![]});var _0x25a2ad=_0x6a8c('0x2a');return db[_0x6a8c('0x54')][_0x6a8c('0x55')]({'where':{'name':_0x25a2ad,'userProfileId':_0x432813[_0x6a8c('0x56')]},'raw':!![]})['then'](function(_0x335cbf){if(_0x335cbf&&_0x335cbf['autoAssociation']===0x0){return db[_0x6a8c('0x2b')][_0x6a8c('0x4f')]({'name':_0x58fcf6[_0x6a8c('0x2f')],'resourceId':_0x58fcf6['id'],'type':_0x335cbf[_0x6a8c('0x2f')],'sectionId':_0x335cbf['id']},{})[_0x6a8c('0x27')](function(){return _0x6911d6;});}else{return _0x6911d6;}})[_0x6a8c('0x49')](function(_0x5e2154){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e2154);throw _0x5e2154;});}return _0x6911d6;})[_0x6a8c('0x27')](respondWithResult(_0x34c76a,0xc9))[_0x6a8c('0x49')](handleError(_0x34c76a,null));};exports['update']=function(_0x14fc42,_0x2d5285){if(_0x14fc42[_0x6a8c('0x50')]['id']){delete _0x14fc42['body']['id'];}return db[_0x6a8c('0x32')]['find']({'where':{'id':_0x14fc42[_0x6a8c('0x4b')]['id']}})[_0x6a8c('0x27')](handleEntityNotFound(_0x2d5285,null))[_0x6a8c('0x27')](saveUpdates(_0x14fc42[_0x6a8c('0x50')],null))[_0x6a8c('0x27')](respondWithResult(_0x2d5285,null))[_0x6a8c('0x49')](handleError(_0x2d5285,null));};exports[_0x6a8c('0x28')]=function(_0x474bee,_0x2ff89a){return db[_0x6a8c('0x32')][_0x6a8c('0x55')]({'where':{'id':_0x474bee[_0x6a8c('0x4b')]['id']}})[_0x6a8c('0x27')](handleEntityNotFound(_0x2ff89a,null))[_0x6a8c('0x27')](removeEntity(_0x2ff89a,null))['catch'](handleError(_0x2ff89a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 1ae9306..f244bad 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 _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 +var _0xf6f7=['rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x87dfe2,_0x47e279){var _0x23a2b4=function(_0xa7de48){while(--_0xa7de48){_0x87dfe2['push'](_0x87dfe2['shift']());}};_0x23a2b4(++_0x47e279);}(_0xf6f7,0xae));var _0x7f6f=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xf6f7[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x7f6f('0x0'));var util=require(_0x7f6f('0x1'));var logger=require(_0x7f6f('0x2'))(_0x7f6f('0x3'));var moment=require(_0x7f6f('0x4'));var BPromise=require(_0x7f6f('0x5'));var rp=require(_0x7f6f('0x6'));var fs=require('fs');var path=require(_0x7f6f('0x7'));var rimraf=require(_0x7f6f('0x8'));var config=require('../../config/environment');var attributes=require(_0x7f6f('0x9'));module[_0x7f6f('0xa')]=function(_0x1e50de,_0x3a7843){return _0x1e50de[_0x7f6f('0xb')]('Tag',attributes,{'tableName':_0x7f6f('0xc'),'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 2e0bafa..cd7e602 100644 --- a/server/api/tag/tag.rpc.js +++ b/server/api/tag/tag.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_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 +var _0x41bb=['Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x5fbf08,_0x47c38){var _0x5d7df8=function(_0x3e7d74){while(--_0x3e7d74){_0x5fbf08['push'](_0x5fbf08['shift']());}};_0x5d7df8(++_0x47c38);}(_0x41bb,0xc5));var _0xb41b=function(_0x12d3ed,_0x4e391d){_0x12d3ed=_0x12d3ed-0x0;var _0x190946=_0x41bb[_0x12d3ed];return _0x190946;};'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')]('Tag,\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);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 47d5721..ee4982e 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 _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 +var _0x0f02=['connect-timeout','express','get','isAuthenticated','/:id','/:id/queues','/:id/users','post','create','addAgents','put','update','delete','destroy','removeQueues','removeAgents','multer','path'];(function(_0x109356,_0x555a9e){var _0x111a29=function(_0x36669a){while(--_0x36669a){_0x109356['push'](_0x109356['shift']());}};_0x111a29(++_0x555a9e);}(_0x0f02,0x19c));var _0x20f0=function(_0x458a74,_0x51cba3){_0x458a74=_0x458a74-0x0;var _0x29e0ad=_0x0f02[_0x458a74];return _0x29e0ad;};'use strict';var multer=require(_0x20f0('0x0'));var util=require('util');var path=require(_0x20f0('0x1'));var timeout=require(_0x20f0('0x2'));var express=require(_0x20f0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./team.controller');router[_0x20f0('0x4')]('/',auth[_0x20f0('0x5')](),controller['index']);router['get'](_0x20f0('0x6'),auth[_0x20f0('0x5')](),controller['show']);router[_0x20f0('0x4')](_0x20f0('0x7'),auth['isAuthenticated'](),controller['getQueues']);router[_0x20f0('0x4')](_0x20f0('0x8'),auth[_0x20f0('0x5')](),controller['getAgents']);router[_0x20f0('0x9')]('/',auth['isAuthenticated'](),controller[_0x20f0('0xa')]);router[_0x20f0('0x9')]('/:id/queues',auth[_0x20f0('0x5')](),controller['addQueues']);router[_0x20f0('0x9')](_0x20f0('0x8'),auth[_0x20f0('0x5')](),controller[_0x20f0('0xb')]);router[_0x20f0('0xc')](_0x20f0('0x6'),auth[_0x20f0('0x5')](),controller[_0x20f0('0xd')]);router[_0x20f0('0xe')]('/:id',auth[_0x20f0('0x5')](),controller[_0x20f0('0xf')]);router[_0x20f0('0xe')](_0x20f0('0x7'),auth[_0x20f0('0x5')](),controller[_0x20f0('0x10')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x20f0('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index a07228d..74e0f6a 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 _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 +var _0xff0d=['exports','STRING'];(function(_0x5ab39b,_0x346b1b){var _0x3150e2=function(_0x5d17f7){while(--_0x5d17f7){_0x5ab39b['push'](_0x5ab39b['shift']());}};_0x3150e2(++_0x346b1b);}(_0xff0d,0x130));var _0xdff0=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0xff0d[_0x2a67fe];return _0x57e726;};'use strict';var Sequelize=require('sequelize');module[_0xdff0('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xdff0('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a462ff7..1cf96a0 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 _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 +var _0x2106=['../../config/license/util','redis','socket.io-emitter','./team.socket','register','sendStatus','json','limit','status','set','Content-Range','reject','save','update','then','destroy','get','Teams','UserProfileResource','end','error','stack','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','offset','sort','where','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','pick','Queues','findOne','Sequelize','add','ids','removeQueues','remove','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','each','addAgents','User','online','voicePause','interface','upsert','format','omit','spread','emit','userTeam:save','removeAgents','voice','chat','sms','fax','openchannel','whatsapp','UserVoiceQueueRt','isArray','userTeam:remove','getAgents','filter','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x2106,0x183));var _0x6210=function(_0x169b8c,_0x63308a){_0x169b8c=_0x169b8c-0x0;var _0x1ab09a=_0x2106[_0x169b8c];return _0x1ab09a;};'use strict';var pdf=require(_0x6210('0x0'));var emlformat=require(_0x6210('0x1'));var rimraf=require(_0x6210('0x2'));var zipdir=require(_0x6210('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6210('0x4'));var moment=require(_0x6210('0x5'));var BPromise=require(_0x6210('0x6'));var Mustache=require(_0x6210('0x7'));var util=require(_0x6210('0x8'));var path=require(_0x6210('0x9'));var sox=require('sox');var csv=require(_0x6210('0xa'));var ejs=require(_0x6210('0xb'));var fs=require('fs');var _=require(_0x6210('0xc'));var squel=require(_0x6210('0xd'));var crypto=require(_0x6210('0xe'));var jsforce=require(_0x6210('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6210('0x10'));var Papa=require(_0x6210('0x11'));var Redis=require(_0x6210('0x12'));var authService=require(_0x6210('0x13'));var qs=require(_0x6210('0x14'));var as=require(_0x6210('0x15'));var hardwareService=require(_0x6210('0x16'));var logger=require(_0x6210('0x17'))(_0x6210('0x18'));var utils=require(_0x6210('0x19'));var config=require(_0x6210('0x1a'));var licenseUtil=require(_0x6210('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x6210('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x6210('0x1d'))(new Redis(config[_0x6210('0x1c')]));require(_0x6210('0x1e'))[_0x6210('0x1f')](socket);function respondWithStatusCode(_0x186edf,_0x4d1ea0){_0x4d1ea0=_0x4d1ea0||0xcc;return function(_0x58b5c5){if(_0x58b5c5){return _0x186edf[_0x6210('0x20')](_0x4d1ea0);}return _0x186edf['status'](_0x4d1ea0)['end']();};}function respondWithResult(_0x3aaaed,_0x58c2ac){_0x58c2ac=_0x58c2ac||0xc8;return function(_0x525535){if(_0x525535){return _0x3aaaed['status'](_0x58c2ac)[_0x6210('0x21')](_0x525535);}};}function respondWithFilteredResult(_0x28a44c,_0x500bc1){return function(_0x18316d){if(_0x18316d){var _0x451b3e=_0x18316d['count'],_0x1ef5cd=_0x500bc1['offset'],_0x5ec731=_0x500bc1['offset']+_0x500bc1[_0x6210('0x22')],_0x4edd46;if(_0x5ec731>=_0x451b3e){_0x5ec731=_0x451b3e;_0x4edd46=0xc8;}else{_0x4edd46=0xce;}_0x28a44c[_0x6210('0x23')](_0x4edd46);return _0x28a44c[_0x6210('0x24')](_0x6210('0x25'),_0x1ef5cd+'-'+_0x5ec731+'/'+_0x451b3e)[_0x6210('0x21')](_0x18316d);}return null;};}function patchUpdates(_0x3a7b77){return function(_0x4852f9){try{jsonpatch['apply'](_0x4852f9,_0x3a7b77,!![]);}catch(_0x4e2588){return BPromise[_0x6210('0x26')](_0x4e2588);}return _0x4852f9[_0x6210('0x27')]();};}function saveUpdates(_0x4ed080,_0x12306b){return function(_0x1698c8){if(_0x1698c8){return _0x1698c8[_0x6210('0x28')](_0x4ed080)[_0x6210('0x29')](function(_0x352d05){return _0x352d05;});}return null;};}function removeEntity(_0x189e64,_0x5af447){return function(_0xb54e8a){if(_0xb54e8a){return _0xb54e8a[_0x6210('0x2a')]()['then'](function(){var _0x55b784=_0xb54e8a[_0x6210('0x2b')]({'plain':!![]});var _0x3cad05=_0x6210('0x2c');return db[_0x6210('0x2d')][_0x6210('0x2a')]({'where':{'type':_0x3cad05,'resourceId':_0x55b784['id']}})[_0x6210('0x29')](function(){return _0xb54e8a;});})[_0x6210('0x29')](function(){_0x189e64[_0x6210('0x23')](0xcc)[_0x6210('0x2e')]();});}};}function handleEntityNotFound(_0x4a34ed,_0x41ee65){return function(_0x3c6cfd){if(!_0x3c6cfd){_0x4a34ed[_0x6210('0x20')](0x194);}return _0x3c6cfd;};}function handleError(_0x7a5e45,_0x2e1572){_0x2e1572=_0x2e1572||0x1f4;return function(_0x21c7bf){logger[_0x6210('0x2f')](_0x21c7bf[_0x6210('0x30')]);if(_0x21c7bf['name']){delete _0x21c7bf[_0x6210('0x31')];}_0x7a5e45[_0x6210('0x23')](_0x2e1572)[_0x6210('0x32')](_0x21c7bf);};}exports[_0x6210('0x33')]=function(_0x59e4bc,_0x3dc82c){var _0xd136d0={},_0x2cd7a6={},_0x19af1d={'count':0x0,'rows':[]};var _0x3a2c80=_[_0x6210('0x34')](db[_0x6210('0x35')][_0x6210('0x36')],function(_0x1401f2){return{'name':_0x1401f2[_0x6210('0x37')],'type':_0x1401f2['type'][_0x6210('0x38')]};});_0x2cd7a6[_0x6210('0x39')]=_[_0x6210('0x34')](_0x3a2c80,_0x6210('0x31'));_0x2cd7a6[_0x6210('0x3a')]=_[_0x6210('0x3b')](_0x59e4bc[_0x6210('0x3a')]);_0x2cd7a6[_0x6210('0x3c')]=_['intersection'](_0x2cd7a6[_0x6210('0x39')],_0x2cd7a6[_0x6210('0x3a')]);_0xd136d0['attributes']=_['intersection'](_0x2cd7a6[_0x6210('0x39')],qs[_0x6210('0x3d')](_0x59e4bc['query'][_0x6210('0x3d')]));_0xd136d0[_0x6210('0x3e')]=_0xd136d0[_0x6210('0x3e')][_0x6210('0x3f')]?_0xd136d0[_0x6210('0x3e')]:_0x2cd7a6[_0x6210('0x39')];if(!_0x59e4bc[_0x6210('0x3a')][_0x6210('0x40')](_0x6210('0x41'))){_0xd136d0[_0x6210('0x22')]=qs[_0x6210('0x22')](_0x59e4bc[_0x6210('0x3a')][_0x6210('0x22')]);_0xd136d0[_0x6210('0x42')]=qs[_0x6210('0x42')](_0x59e4bc[_0x6210('0x3a')][_0x6210('0x42')]);}_0xd136d0['order']=qs['sort'](_0x59e4bc[_0x6210('0x3a')][_0x6210('0x43')]);_0xd136d0[_0x6210('0x44')]=qs['filters'](_['pick'](_0x59e4bc[_0x6210('0x3a')],_0x2cd7a6['filters']),_0x3a2c80);if(_0x59e4bc[_0x6210('0x3a')]['filter']){_0xd136d0[_0x6210('0x44')]=_[_0x6210('0x45')](_0xd136d0[_0x6210('0x44')],{'$or':_['map'](_0x3a2c80,function(_0x199edc){if(_0x199edc[_0x6210('0x46')]!=='VIRTUAL'){var _0x33f483={};_0x33f483[_0x199edc[_0x6210('0x31')]]={'$like':'%'+_0x59e4bc[_0x6210('0x3a')]['filter']+'%'};return _0x33f483;}})});}_0xd136d0=_[_0x6210('0x45')]({},_0xd136d0,_0x59e4bc[_0x6210('0x47')]);var _0x303fbe={'where':_0xd136d0[_0x6210('0x44')]};return db[_0x6210('0x35')][_0x6210('0x48')](_0x303fbe)['then'](function(_0x346759){_0x19af1d[_0x6210('0x48')]=_0x346759;if(_0x59e4bc[_0x6210('0x3a')][_0x6210('0x49')]){_0xd136d0[_0x6210('0x4a')]=[{'all':!![]}];}return db[_0x6210('0x35')][_0x6210('0x4b')](_0xd136d0);})[_0x6210('0x29')](function(_0xb48dbc){_0x19af1d[_0x6210('0x4c')]=_0xb48dbc;return _0x19af1d;})[_0x6210('0x29')](respondWithFilteredResult(_0x3dc82c,_0xd136d0))[_0x6210('0x4d')](handleError(_0x3dc82c,null));};exports[_0x6210('0x4e')]=function(_0x254112,_0x384a2c){var _0x5f21b4={'raw':![],'where':{'id':_0x254112[_0x6210('0x4f')]['id']}},_0x3044d1={};_0x3044d1[_0x6210('0x39')]=_[_0x6210('0x3b')](db[_0x6210('0x35')][_0x6210('0x36')]);_0x3044d1['query']=_[_0x6210('0x3b')](_0x254112[_0x6210('0x3a')]);_0x3044d1[_0x6210('0x3c')]=_[_0x6210('0x50')](_0x3044d1[_0x6210('0x39')],_0x3044d1[_0x6210('0x3a')]);_0x5f21b4[_0x6210('0x3e')]=_['intersection'](_0x3044d1[_0x6210('0x39')],qs['fields'](_0x254112[_0x6210('0x3a')][_0x6210('0x3d')]));_0x5f21b4[_0x6210('0x3e')]=_0x5f21b4[_0x6210('0x3e')][_0x6210('0x3f')]?_0x5f21b4['attributes']:_0x3044d1[_0x6210('0x39')];if(_0x254112[_0x6210('0x3a')][_0x6210('0x49')]){_0x5f21b4['include']=[{'all':!![]}];}_0x5f21b4=_[_0x6210('0x45')]({},_0x5f21b4,_0x254112['options']);return db[_0x6210('0x35')][_0x6210('0x51')](_0x5f21b4)[_0x6210('0x29')](handleEntityNotFound(_0x384a2c,null))[_0x6210('0x29')](respondWithResult(_0x384a2c,null))[_0x6210('0x4d')](handleError(_0x384a2c,null));};exports[_0x6210('0x52')]=function(_0x51979e,_0x2bc8ca){return db[_0x6210('0x35')][_0x6210('0x52')](_0x51979e[_0x6210('0x53')],{})[_0x6210('0x29')](function(_0x2d20f3){var _0x2a7e3f=_0x51979e['user'][_0x6210('0x2b')]({'plain':!![]});if(!_0x2a7e3f)throw new Error(_0x6210('0x54'));if(_0x2a7e3f['role']===_0x6210('0x55')){var _0x1defb5=_0x2d20f3[_0x6210('0x2b')]({'plain':!![]});var _0x458ed8=_0x6210('0x2c');return db[_0x6210('0x56')][_0x6210('0x51')]({'where':{'name':_0x458ed8,'userProfileId':_0x2a7e3f[_0x6210('0x57')]},'raw':!![]})['then'](function(_0x219c1f){if(_0x219c1f&&_0x219c1f[_0x6210('0x58')]===0x0){return db[_0x6210('0x2d')][_0x6210('0x52')]({'name':_0x1defb5[_0x6210('0x31')],'resourceId':_0x1defb5['id'],'type':_0x219c1f['name'],'sectionId':_0x219c1f['id']},{})[_0x6210('0x29')](function(){return _0x2d20f3;});}else{return _0x2d20f3;}})[_0x6210('0x4d')](function(_0x19a6dd){logger['error'](_0x6210('0x59'),_0x19a6dd);throw _0x19a6dd;});}return _0x2d20f3;})[_0x6210('0x29')](respondWithResult(_0x2bc8ca,0xc9))['catch'](handleError(_0x2bc8ca,null));};exports[_0x6210('0x28')]=function(_0x2321ff,_0xf3caff){if(_0x2321ff[_0x6210('0x53')]['id']){delete _0x2321ff['body']['id'];}return db[_0x6210('0x35')]['find']({'where':{'id':_0x2321ff['params']['id']}})[_0x6210('0x29')](handleEntityNotFound(_0xf3caff,null))[_0x6210('0x29')](saveUpdates(_0x2321ff['body'],null))[_0x6210('0x29')](respondWithResult(_0xf3caff,null))['catch'](handleError(_0xf3caff,null));};exports[_0x6210('0x2a')]=function(_0x101ce8,_0x93a3a7){return db[_0x6210('0x35')][_0x6210('0x51')]({'where':{'id':_0x101ce8[_0x6210('0x4f')]['id']}})[_0x6210('0x29')](handleEntityNotFound(_0x93a3a7,null))[_0x6210('0x29')](removeEntity(_0x93a3a7,null))[_0x6210('0x4d')](handleError(_0x93a3a7,null));};exports[_0x6210('0x5a')]=function(_0x3d094d,_0xf2b9d2,_0x1964c0){return db[_0x6210('0x35')]['findOne']({'where':{'id':_0x3d094d[_0x6210('0x4f')]['id']}})[_0x6210('0x29')](handleEntityNotFound(_0xf2b9d2,null))[_0x6210('0x29')](function(_0x485c62){if(!_0x3d094d['query'][_0x6210('0x5b')]||!utils[_0x6210('0x5c')](_0x3d094d[_0x6210('0x3a')][_0x6210('0x5b')])){throw new db['Sequelize'][(_0x6210('0x5d'))](_0x6210('0x5e'));}var _0x5df14e={};var _0x1d5f91={};_0x1d5f91[_0x6210('0x39')]=_['keys'](db[_[_0x6210('0x5f')](_0x3d094d['query'][_0x6210('0x5b')][_0x6210('0x60')]())+_0x6210('0x61')][_0x6210('0x36')]);_0x1d5f91[_0x6210('0x3a')]=_[_0x6210('0x3b')](_0x3d094d[_0x6210('0x3a')]);_0x1d5f91[_0x6210('0x3c')]=_[_0x6210('0x50')](_0x1d5f91[_0x6210('0x39')],_0x1d5f91[_0x6210('0x3a')]);_0x5df14e['attributes']=_['intersection'](_0x1d5f91[_0x6210('0x39')],qs[_0x6210('0x3d')](_0x3d094d[_0x6210('0x3a')]['fields']));_0x5df14e[_0x6210('0x3e')]=_0x5df14e[_0x6210('0x3e')][_0x6210('0x3f')]?_0x5df14e[_0x6210('0x3e')]:_0x1d5f91[_0x6210('0x39')];_0x5df14e[_0x6210('0x22')]=qs[_0x6210('0x22')](_0x3d094d[_0x6210('0x3a')][_0x6210('0x22')]);_0x5df14e['offset']=qs['offset'](_0x3d094d['query']['offset']);_0x5df14e[_0x6210('0x62')]=qs['sort'](_0x3d094d[_0x6210('0x3a')][_0x6210('0x43')]);_0x5df14e[_0x6210('0x44')]=qs[_0x6210('0x3c')](_[_0x6210('0x63')](_0x3d094d[_0x6210('0x3a')],_0x1d5f91[_0x6210('0x3c')]));_0x5df14e=_[_0x6210('0x45')]({},_0x5df14e,_0x3d094d[_0x6210('0x47')]);return _0x485c62['get'+_[_0x6210('0x5f')](_0x3d094d['query'][_0x6210('0x5b')][_0x6210('0x60')]())+_0x6210('0x64')](_0x5df14e);})[_0x6210('0x29')](respondWithResult(_0xf2b9d2,null))[_0x6210('0x4d')](handleError(_0xf2b9d2,null));};exports['addQueues']=function(_0x352d37,_0x82fc7e,_0x753cc4){return db['Team'][_0x6210('0x65')]({'where':{'id':_0x352d37['params']['id']}})[_0x6210('0x29')](function(_0x2344ac){if(_0x2344ac){if(!_0x352d37[_0x6210('0x53')][_0x6210('0x5b')]||!utils[_0x6210('0x5c')](_0x352d37[_0x6210('0x53')][_0x6210('0x5b')])){throw new db[(_0x6210('0x66'))][(_0x6210('0x5d'))]('Unknown\x20channel');}return _0x2344ac[_0x6210('0x67')+_[_0x6210('0x5f')](_0x352d37[_0x6210('0x53')][_0x6210('0x5b')][_0x6210('0x60')]())+'Queues'](_0x352d37[_0x6210('0x53')][_0x6210('0x68')]);}return null;})[_0x6210('0x29')](handleEntityNotFound(_0x82fc7e,null))[_0x6210('0x29')](respondWithStatusCode(_0x82fc7e,null))[_0x6210('0x4d')](handleError(_0x82fc7e,null));};exports[_0x6210('0x69')]=function(_0x49791c,_0x4337e0,_0x596ded){return db[_0x6210('0x35')]['findOne']({'where':{'id':_0x49791c[_0x6210('0x4f')]['id']}})['then'](function(_0x3307b6){if(_0x3307b6){if(!_0x49791c[_0x6210('0x3a')][_0x6210('0x5b')]||!utils[_0x6210('0x5c')](_0x49791c['query'][_0x6210('0x5b')])){throw new db['Sequelize']['ValidationError'](_0x6210('0x5e'));}return _0x3307b6[_0x6210('0x6a')+_[_0x6210('0x5f')](_0x49791c[_0x6210('0x3a')][_0x6210('0x5b')][_0x6210('0x60')]())+'Queues'](_0x49791c[_0x6210('0x3a')][_0x6210('0x68')]);}return null;})[_0x6210('0x29')](handleEntityNotFound(_0x4337e0,null))[_0x6210('0x29')](respondWithStatusCode(_0x4337e0,null))[_0x6210('0x4d')](handleError(_0x4337e0,null));};exports['addAgents']=function(_0x22014a,_0x1df036,_0x39eccc){return db['Team'][_0x6210('0x51')]({'where':{'id':_0x22014a['params']['id']}})[_0x6210('0x29')](handleEntityNotFound(_0x1df036,null))[_0x6210('0x29')](function(_0x53b411){if(_0x53b411){var _0x27e87d=[_0x6210('0x6b'),_0x6210('0x6c'),_0x6210('0x6d'),_0x6210('0x6e'),_0x6210('0x6f'),_0x6210('0x70'),_0x6210('0x71')];return BPromise['each'](_0x27e87d,function(_0x3b02b2){return _0x53b411[_0x6210('0x2b')+_0x3b02b2+_0x6210('0x64')]({'attributes':['id','name']})[_0x6210('0x29')](function(_0x5753fb){return BPromise[_0x6210('0x72')](_0x5753fb,function(_0x238ab1){return _0x238ab1[_0x6210('0x73')](_0x22014a[_0x6210('0x53')][_0x6210('0x68')])[_0x6210('0x29')](function(){if(_0x3b02b2===_0x6210('0x6b')){return db[_0x6210('0x74')]['findAll']({'where':{'id':_0x22014a['body'][_0x6210('0x68')]},'attributes':['id','name',_0x6210('0x75'),_0x6210('0x76'),_0x6210('0x77')],'raw':!![]})[_0x6210('0x29')](function(_0x1cf0df){return BPromise[_0x6210('0x72')](_['filter'](_0x1cf0df,{'online':0x1}),function(_0x4ca922){return db['UserVoiceQueueRt'][_0x6210('0x78')]({'membername':_0x4ca922[_0x6210('0x31')],'UserId':_0x4ca922['id'],'queue_name':_0x238ab1['name'],'VoiceQueueId':_0x238ab1['id'],'interface':_['isNil'](_0x4ca922[_0x6210('0x77')])?util[_0x6210('0x79')]('SIP/%s',_0x4ca922[_0x6210('0x31')]):_0x4ca922[_0x6210('0x77')],'paused':_0x4ca922[_0x6210('0x76')]||![],'penalty':0x0});});});}});});})[_0x6210('0x29')](function(){return _0x53b411;});})[_0x6210('0x29')](function(){return _0x53b411;});}})[_0x6210('0x29')](function(_0x3b774c){if(_0x3b774c){return _0x3b774c[_0x6210('0x73')](_0x22014a['body'][_0x6210('0x68')],_[_0x6210('0x7a')](_0x22014a[_0x6210('0x53')],[_0x6210('0x68'),'id'])||{})[_0x6210('0x7b')](function(_0x198949){for(var _0xff6d2f=0x0;_0xff6d2f<_0x22014a[_0x6210('0x53')]['ids'][_0x6210('0x3f')];_0xff6d2f+=0x1){socket[_0x6210('0x7c')](_0x6210('0x7d'),{'UserId':_0x22014a[_0x6210('0x53')][_0x6210('0x68')][_0xff6d2f],'TeamId':_0x22014a['params']['id']});}return _0x198949;});}})['then'](respondWithResult(_0x1df036,null))['catch'](handleError(_0x1df036,null));};exports[_0x6210('0x7e')]=function(_0x2f5859,_0x3d953f,_0x56380e){return db[_0x6210('0x35')][_0x6210('0x51')]({'where':{'id':_0x2f5859['params']['id']}})[_0x6210('0x29')](handleEntityNotFound(_0x3d953f,null))[_0x6210('0x29')](function(_0x1f4840){if(_0x1f4840){return BPromise['each']([_0x6210('0x7f'),_0x6210('0x80'),'mail',_0x6210('0x81'),_0x6210('0x82'),_0x6210('0x83'),_0x6210('0x84')],function(_0x29c08b){return _0x1f4840[_0x6210('0x2b')+_[_0x6210('0x5f')](_0x29c08b)+_0x6210('0x64')]({'attributes':['id','name']})[_0x6210('0x29')](function(_0x22390d){return BPromise[_0x6210('0x72')](_0x22390d,function(_0x162c69){return _0x162c69['removeAgents'](_0x2f5859[_0x6210('0x3a')][_0x6210('0x68')])[_0x6210('0x29')](function(){if(_0x29c08b===_0x6210('0x7f')){return db[_0x6210('0x85')]['destroy']({'where':{'VoiceQueueId':_0x162c69['id'],'UserId':_0x2f5859[_0x6210('0x3a')][_0x6210('0x68')]}});}});});})[_0x6210('0x29')](function(){return _0x1f4840;});})['then'](function(){return _0x1f4840;});}})[_0x6210('0x29')](function(_0xb89d78){if(_0xb89d78){return _0xb89d78[_0x6210('0x7e')](_0x2f5859['query'][_0x6210('0x68')])['then'](function(){if(_[_0x6210('0x86')](_0x2f5859[_0x6210('0x3a')][_0x6210('0x68')])){for(var _0x2bc0f7=0x0;_0x2bc0f7<_0x2f5859[_0x6210('0x3a')]['ids'][_0x6210('0x3f')];_0x2bc0f7+=0x1){socket[_0x6210('0x7c')](_0x6210('0x87'),{'UserId':Number(_0x2f5859[_0x6210('0x3a')][_0x6210('0x68')][_0x2bc0f7]),'TeamId':Number(_0x2f5859[_0x6210('0x4f')]['id'])});}}else{socket['emit'](_0x6210('0x87'),{'UserId':Number(_0x2f5859[_0x6210('0x3a')][_0x6210('0x68')]),'TeamId':Number(_0x2f5859[_0x6210('0x4f')]['id'])});}});}})[_0x6210('0x29')](respondWithStatusCode(_0x3d953f,null))[_0x6210('0x4d')](handleError(_0x3d953f,null));};exports[_0x6210('0x88')]=function(_0x2489e0,_0x5aa239,_0x81e3fd){var _0x3a15c3={};var _0x50efba={};var _0x134856;var _0x178f9f;return db[_0x6210('0x35')][_0x6210('0x65')]({'where':{'id':_0x2489e0[_0x6210('0x4f')]['id']}})[_0x6210('0x29')](handleEntityNotFound(_0x5aa239,null))[_0x6210('0x29')](function(_0x22ead9){if(_0x22ead9){_0x134856=_0x22ead9;_0x50efba[_0x6210('0x39')]=_[_0x6210('0x3b')](db[_0x6210('0x74')][_0x6210('0x36')]);_0x50efba[_0x6210('0x3a')]=_[_0x6210('0x3b')](_0x2489e0[_0x6210('0x3a')]);_0x50efba['filters']=_[_0x6210('0x50')](_0x50efba[_0x6210('0x39')],_0x50efba[_0x6210('0x3a')]);_0x3a15c3[_0x6210('0x3e')]=_[_0x6210('0x50')](_0x50efba['model'],qs[_0x6210('0x3d')](_0x2489e0[_0x6210('0x3a')]['fields']));_0x3a15c3[_0x6210('0x3e')]=_0x3a15c3['attributes'][_0x6210('0x3f')]?_0x3a15c3[_0x6210('0x3e')]:_0x50efba[_0x6210('0x39')];_0x3a15c3[_0x6210('0x62')]=qs[_0x6210('0x43')](_0x2489e0[_0x6210('0x3a')][_0x6210('0x43')]);_0x3a15c3[_0x6210('0x44')]=qs[_0x6210('0x3c')](_[_0x6210('0x63')](_0x2489e0['query'],_0x50efba[_0x6210('0x3c')]));if(_0x2489e0['query'][_0x6210('0x89')]){_0x3a15c3[_0x6210('0x44')]=_[_0x6210('0x45')](_0x3a15c3[_0x6210('0x44')],{'$or':_[_0x6210('0x34')](_0x3a15c3[_0x6210('0x3e')],function(_0x2891d5){var _0x204e90={};_0x204e90[_0x2891d5]={'$like':'%'+_0x2489e0[_0x6210('0x3a')][_0x6210('0x89')]+'%'};return _0x204e90;})});}_0x3a15c3=_[_0x6210('0x45')]({},_0x3a15c3,_0x2489e0[_0x6210('0x47')]);return _0x134856[_0x6210('0x88')](_0x3a15c3);}})[_0x6210('0x29')](function(_0x53abc5){if(_0x53abc5){_0x178f9f=_0x53abc5['length'];if(!_0x2489e0['query'][_0x6210('0x40')](_0x6210('0x41'))){_0x3a15c3['limit']=qs[_0x6210('0x22')](_0x2489e0[_0x6210('0x3a')]['limit']);_0x3a15c3[_0x6210('0x42')]=qs[_0x6210('0x42')](_0x2489e0[_0x6210('0x3a')][_0x6210('0x42')]);}return _0x134856[_0x6210('0x88')](_0x3a15c3);}})[_0x6210('0x29')](function(_0x55aa0d){if(_0x55aa0d){return _0x55aa0d?{'count':_0x178f9f,'rows':_0x55aa0d}:null;}})[_0x6210('0x29')](respondWithResult(_0x5aa239,null))[_0x6210('0x4d')](handleError(_0x5aa239,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b3d70bd..45578be 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 _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 +var _0x0176=['emit','hasOwnProperty','exports','events','../../mysqldb','save'];(function(_0x4496a5,_0x24675a){var _0x338d97=function(_0x520fab){while(--_0x520fab){_0x4496a5['push'](_0x4496a5['shift']());}};_0x338d97(++_0x24675a);}(_0x0176,0x1ad));var _0x6017=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0176[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x6017('0x0'));var Team=require(_0x6017('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6017('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5c0a1b){return function(_0x14bcb0,_0x1d501c,_0x59f639){TeamEvents[_0x6017('0x3')](_0x5c0a1b+':'+_0x14bcb0['id'],_0x14bcb0);TeamEvents['emit'](_0x5c0a1b,_0x14bcb0);_0x59f639(null);};}for(var e in events){if(events[_0x6017('0x4')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x6017('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 544a32b..1d55426 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 _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 +var _0x1bd1=['./team.attributes','exports','define','Team','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3e28e3,_0x14215f){var _0xe648ea=function(_0x1010d9){while(--_0x1010d9){_0x3e28e3['push'](_0x3e28e3['shift']());}};_0xe648ea(++_0x14215f);}(_0x1bd1,0x164));var _0x11bd=function(_0x278c9f,_0x588286){_0x278c9f=_0x278c9f-0x0;var _0x3e796d=_0x1bd1[_0x278c9f];return _0x3e796d;};'use strict';var _=require('lodash');var util=require(_0x11bd('0x0'));var logger=require(_0x11bd('0x1'))('api');var moment=require(_0x11bd('0x2'));var BPromise=require(_0x11bd('0x3'));var rp=require(_0x11bd('0x4'));var fs=require('fs');var path=require(_0x11bd('0x5'));var rimraf=require(_0x11bd('0x6'));var config=require('../../config/environment');var attributes=require(_0x11bd('0x7'));module[_0x11bd('0x8')]=function(_0x5cc75,_0x2375fb){return _0x5cc75[_0x11bd('0x9')](_0x11bd('0xa'),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 34363a7..94f0573 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 _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 +var _0x4945=['Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','then','info'];(function(_0x3684f4,_0x213bcb){var _0x12b17c=function(_0x2c1b3e){while(--_0x2c1b3e){_0x3684f4['push'](_0x3684f4['shift']());}};_0x12b17c(++_0x213bcb);}(_0x4945,0x127));var _0x5494=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x4945[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x5494('0x0'));var util=require(_0x5494('0x1'));var moment=require('moment');var BPromise=require(_0x5494('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5494('0x3'));var db=require(_0x5494('0x4'))['db'];var utils=require(_0x5494('0x5'));var logger=require('../../config/logger')(_0x5494('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5494('0x7')][_0x5494('0x8')]({'port':0x232a});config[_0x5494('0x9')]=_[_0x5494('0xa')](config[_0x5494('0x9')],{'host':_0x5494('0xb'),'port':0x18eb});var socket=require(_0x5494('0xc'))(new Redis(config[_0x5494('0x9')]));require(_0x5494('0xd'))[_0x5494('0xe')](socket);function respondWithRpcPromise(_0x595d0d,_0x2835d1,_0x571ce0){return new BPromise(function(_0x125cc6,_0x1c1b8a){return client['request'](_0x595d0d,_0x571ce0)[_0x5494('0xf')](function(_0xb2b20e){logger[_0x5494('0x10')](_0x5494('0x11'),_0x2835d1,_0x5494('0x12'));logger['debug'](_0x5494('0x13'),_0x2835d1,_0x5494('0x12'),JSON[_0x5494('0x14')](_0xb2b20e));if(_0xb2b20e[_0x5494('0x15')]){if(_0xb2b20e[_0x5494('0x15')][_0x5494('0x16')]===0x1f4){logger[_0x5494('0x15')](_0x5494('0x11'),_0x2835d1,_0xb2b20e[_0x5494('0x15')][_0x5494('0x17')]);return _0x1c1b8a(_0xb2b20e[_0x5494('0x15')][_0x5494('0x17')]);}logger['error'](_0x5494('0x11'),_0x2835d1,_0xb2b20e['error'][_0x5494('0x17')]);return _0x125cc6(_0xb2b20e[_0x5494('0x15')][_0x5494('0x17')]);}else{logger['info'](_0x5494('0x11'),_0x2835d1,_0x5494('0x12'));_0x125cc6(_0xb2b20e[_0x5494('0x18')]['message']);}})[_0x5494('0x19')](function(_0x2bf49e){logger[_0x5494('0x15')](_0x5494('0x11'),_0x2835d1,_0x2bf49e);_0x1c1b8a(_0x2bf49e);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a3cb4bc..45c483a 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 _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 +var _0x1893=['remove','update','emit','removeListener','register','length'];(function(_0x4fc154,_0x174d09){var _0x2bb6fe=function(_0x7fbdf6){while(--_0x7fbdf6){_0x4fc154['push'](_0x4fc154['shift']());}};_0x2bb6fe(++_0x174d09);}(_0x1893,0xa2));var _0x3189=function(_0x1d4663,_0x17cb51){_0x1d4663=_0x1d4663-0x0;var _0x581eb5=_0x1893[_0x1d4663];return _0x581eb5;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3189('0x0'),_0x3189('0x1')];function createListener(_0x1b12ad,_0x106df4){return function(_0x10c189){_0x106df4[_0x3189('0x2')](_0x1b12ad,_0x10c189);};}function removeListener(_0x3953a2,_0x5371db){return function(){TeamEvents[_0x3189('0x3')](_0x3953a2,_0x5371db);};}exports[_0x3189('0x4')]=function(_0x2333e6){for(var _0x4080a9=0x0,_0x77c566=events[_0x3189('0x5')];_0x4080a9<_0x77c566;_0x4080a9++){var _0x14d84b=events[_0x4080a9];var _0x1f6764=createListener('team:'+_0x14d84b,_0x2333e6);TeamEvents['on'](_0x14d84b,_0x1f6764);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 83c6166..8124b43 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 _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 +var _0xbd9b=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x50f7fb,_0x2b81db){var _0x566c10=function(_0x59abee){while(--_0x59abee){_0x50f7fb['push'](_0x50f7fb['shift']());}};_0x566c10(++_0x2b81db);}(_0xbd9b,0x67));var _0xbbd9=function(_0x526f85,_0x479e53){_0x526f85=_0x526f85-0x0;var _0x9d5ae5=_0xbd9b[_0x526f85];return _0x9d5ae5;};'use strict';var multer=require(_0xbbd9('0x0'));var util=require(_0xbbd9('0x1'));var path=require('path');var timeout=require(_0xbbd9('0x2'));var express=require(_0xbbd9('0x3'));var router=express[_0xbbd9('0x4')]();var auth=require(_0xbbd9('0x5'));var interaction=require(_0xbbd9('0x6'));var config=require(_0xbbd9('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index a25e6af..4df5fa8 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 _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 +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x621959,_0x141e2c){var _0x3b7956=function(_0x8ab6dc){while(--_0x8ab6dc){_0x621959['push'](_0x621959['shift']());}};_0x3b7956(++_0x141e2c);}(_0xe706,0xa3));var _0x6e70=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0xe706[_0x282916];return _0x317b39;};'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/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 6e2d2e3..2a0f2d8 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 _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 +var _0xf630=['../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x184c3c,_0x51c8a7){var _0x32deda=function(_0x7b0da7){while(--_0x7b0da7){_0x184c3c['push'](_0x184c3c['shift']());}};_0x32deda(++_0x51c8a7);}(_0xf630,0x117));var _0x0f63=function(_0x3e36d5,_0x3c0359){_0x3e36d5=_0x3e36d5-0x0;var _0x3ebbff=_0xf630[_0x3e36d5];return _0x3ebbff;};'use strict';var _=require(_0x0f63('0x0'));var util=require('util');var logger=require(_0x0f63('0x1'))(_0x0f63('0x2'));var moment=require(_0x0f63('0x3'));var BPromise=require(_0x0f63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f63('0x5'));var rimraf=require(_0x0f63('0x6'));var config=require(_0x0f63('0x7'));var attributes=require(_0x0f63('0x8'));module['exports']=function(_0x35a967,_0x40571f){return _0x35a967[_0x0f63('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0x0f63('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 0d18d91..f9d641b 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 _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 +var _0xbacc=['debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x284240,_0x555b56){var _0x390667=function(_0x409454){while(--_0x409454){_0x284240['push'](_0x284240['shift']());}};_0x390667(++_0x555b56);}(_0xbacc,0x17b));var _0xcbac=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xbacc[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0xcbac('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcbac('0x1'));var rs=require(_0xcbac('0x2'));var fs=require('fs');var Redis=require(_0xcbac('0x3'));var db=require(_0xcbac('0x4'))['db'];var utils=require(_0xcbac('0x5'));var logger=require(_0xcbac('0x6'))(_0xcbac('0x7'));var config=require(_0xcbac('0x8'));var jayson=require(_0xcbac('0x9'));var client=jayson[_0xcbac('0xa')][_0xcbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12509b,_0x36fdb1,_0x498969){return new BPromise(function(_0x5bf713,_0x305edd){return client[_0xcbac('0xc')](_0x12509b,_0x498969)[_0xcbac('0xd')](function(_0x369838){logger[_0xcbac('0xe')](_0xcbac('0xf'),_0x36fdb1,_0xcbac('0x10'));logger[_0xcbac('0x11')](_0xcbac('0x12'),_0x36fdb1,'request\x20sent',JSON[_0xcbac('0x13')](_0x369838));if(_0x369838[_0xcbac('0x14')]){if(_0x369838['error']['code']===0x1f4){logger[_0xcbac('0x14')](_0xcbac('0xf'),_0x36fdb1,_0x369838[_0xcbac('0x14')][_0xcbac('0x15')]);return _0x305edd(_0x369838[_0xcbac('0x14')][_0xcbac('0x15')]);}logger['error'](_0xcbac('0xf'),_0x36fdb1,_0x369838[_0xcbac('0x14')][_0xcbac('0x15')]);return _0x5bf713(_0x369838[_0xcbac('0x14')][_0xcbac('0x15')]);}else{logger[_0xcbac('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x36fdb1,_0xcbac('0x10'));_0x5bf713(_0x369838['result'][_0xcbac('0x15')]);}})['catch'](function(_0x2ac4af){logger[_0xcbac('0x14')](_0xcbac('0xf'),_0x36fdb1,_0x2ac4af);_0x305edd(_0x2ac4af);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 35cfd7a..6455fa5 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 _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 +var _0xd8b4=['Router','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express'];(function(_0x3cca8c,_0x2d5c25){var _0x33d916=function(_0x24766b){while(--_0x24766b){_0x3cca8c['push'](_0x3cca8c['shift']());}};_0x33d916(++_0x2d5c25);}(_0xd8b4,0xb0));var _0x4d8b=function(_0x5b3902,_0x19c705){_0x5b3902=_0x5b3902-0x0;var _0x27d4cb=_0xd8b4[_0x5b3902];return _0x27d4cb;};'use strict';var multer=require(_0x4d8b('0x0'));var util=require(_0x4d8b('0x1'));var path=require('path');var timeout=require(_0x4d8b('0x2'));var express=require(_0x4d8b('0x3'));var router=express[_0x4d8b('0x4')]();var auth=require(_0x4d8b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d8b('0x6'));var controller=require(_0x4d8b('0x7'));router['get']('/',auth[_0x4d8b('0x8')](),controller['index']);router[_0x4d8b('0x9')](_0x4d8b('0xa'),auth['isAuthenticated'](),controller[_0x4d8b('0xb')]);router[_0x4d8b('0xc')]('/',auth[_0x4d8b('0x8')](),controller[_0x4d8b('0xd')]);router[_0x4d8b('0xe')](_0x4d8b('0xa'),auth['isAuthenticated'](),controller[_0x4d8b('0xf')]);router[_0x4d8b('0x10')](_0x4d8b('0xa'),auth['isAuthenticated'](),controller[_0x4d8b('0x11')]);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 1f0ae7d..f889a4e 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 _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 +var _0x0730=['TEXT','sequelize','exports','STRING'];(function(_0x220ae8,_0x25fb2a){var _0x536160=function(_0xae12d5){while(--_0xae12d5){_0x220ae8['push'](_0x220ae8['shift']());}};_0x536160(++_0x25fb2a);}(_0x0730,0x191));var _0x0073=function(_0x79b1a9,_0x376bc1){_0x79b1a9=_0x79b1a9-0x0;var _0x22411d=_0x0730[_0x79b1a9];return _0x22411d;};'use strict';var Sequelize=require(_0x0073('0x0'));module[_0x0073('0x1')]={'name':{'type':Sequelize[_0x0073('0x2')]},'description':{'type':Sequelize[_0x0073('0x2')]},'html':{'type':Sequelize[_0x0073('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 84f81fb..915395e 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(_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 +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(_0x2d2ae2,_0x4024f3){var _0x145d00=function(_0x2b263d){while(--_0x2b263d){_0x2d2ae2['push'](_0x2d2ae2['shift']());}};_0x145d00(++_0x4024f3);}(_0xe14b,0x93));var _0xbe14=function(_0x52b03e,_0x23ffc5){_0x52b03e=_0x52b03e-0x0;var _0x4a7084=_0xe14b[_0x52b03e];return _0x4a7084;};'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 b544423..fa7ac32 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 _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 +var _0x4e4c=['../../config/logger','api','moment','bluebird','path','../../config/environment','./template.attributes','exports','define','Template','util'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x4e4c,0x78));var _0xc4e4=function(_0x46b75d,_0x1cffcc){_0x46b75d=_0x46b75d-0x0;var _0x1e17b8=_0x4e4c[_0x46b75d];return _0x1e17b8;};'use strict';var _=require('lodash');var util=require(_0xc4e4('0x0'));var logger=require(_0xc4e4('0x1'))(_0xc4e4('0x2'));var moment=require(_0xc4e4('0x3'));var BPromise=require(_0xc4e4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4e4('0x5'));var rimraf=require('rimraf');var config=require(_0xc4e4('0x6'));var attributes=require(_0xc4e4('0x7'));module[_0xc4e4('0x8')]=function(_0x17307f,_0xe365da){return _0x17307f[_0xc4e4('0x9')](_0xc4e4('0xa'),attributes,{'tableName':'tools_templates','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 efd57c8..fb3fa50 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 _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 +var _0x5ad7=['attributes','limit','include','map','model','catch','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTemplate','Template','options','raw'];(function(_0x3167b1,_0x5ad266){var _0x362152=function(_0xc49d4a){while(--_0xc49d4a){_0x3167b1['push'](_0x3167b1['shift']());}};_0x362152(++_0x5ad266);}(_0x5ad7,0x18c));var _0x75ad=function(_0x3657ba,_0x32f055){_0x3657ba=_0x3657ba-0x0;var _0x4146e8=_0x5ad7[_0x3657ba];return _0x4146e8;};'use strict';var _=require('lodash');var util=require(_0x75ad('0x0'));var moment=require(_0x75ad('0x1'));var BPromise=require('bluebird');var rs=require(_0x75ad('0x2'));var fs=require('fs');var Redis=require(_0x75ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x75ad('0x4'));var config=require(_0x75ad('0x5'));var jayson=require(_0x75ad('0x6'));var client=jayson[_0x75ad('0x7')][_0x75ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33032e,_0x1a8c50,_0x361b85){return new BPromise(function(_0x31ef40,_0x23fa87){return client[_0x75ad('0x9')](_0x33032e,_0x361b85)[_0x75ad('0xa')](function(_0x148313){logger[_0x75ad('0xb')](_0x75ad('0xc'),_0x1a8c50,'request\x20sent');logger[_0x75ad('0xd')](_0x75ad('0xe'),_0x1a8c50,_0x75ad('0xf'),JSON[_0x75ad('0x10')](_0x148313));if(_0x148313['error']){if(_0x148313[_0x75ad('0x11')]['code']===0x1f4){logger[_0x75ad('0x11')](_0x75ad('0xc'),_0x1a8c50,_0x148313[_0x75ad('0x11')][_0x75ad('0x12')]);return _0x23fa87(_0x148313[_0x75ad('0x11')][_0x75ad('0x12')]);}logger['error'](_0x75ad('0xc'),_0x1a8c50,_0x148313[_0x75ad('0x11')][_0x75ad('0x12')]);return _0x31ef40(_0x148313[_0x75ad('0x11')][_0x75ad('0x12')]);}else{logger[_0x75ad('0xb')](_0x75ad('0xc'),_0x1a8c50,_0x75ad('0xf'));_0x31ef40(_0x148313[_0x75ad('0x13')][_0x75ad('0x12')]);}})['catch'](function(_0x52798c){logger[_0x75ad('0x11')](_0x75ad('0xc'),_0x1a8c50,_0x52798c);_0x23fa87(_0x52798c);});});}exports[_0x75ad('0x14')]=function(_0x3a61fe){var _0x59087e=this;return new Promise(function(_0x3c7dca,_0x36608b){return db[_0x75ad('0x15')]['findAll']({'raw':_0x3a61fe[_0x75ad('0x16')]?_0x3a61fe[_0x75ad('0x16')][_0x75ad('0x17')]===undefined?!![]:![]:!![],'where':_0x3a61fe[_0x75ad('0x16')]?_0x3a61fe[_0x75ad('0x16')]['where']||null:null,'attributes':_0x3a61fe[_0x75ad('0x16')]?_0x3a61fe[_0x75ad('0x16')][_0x75ad('0x18')]||null:null,'limit':_0x3a61fe[_0x75ad('0x16')]?_0x3a61fe[_0x75ad('0x16')][_0x75ad('0x19')]||null:null,'include':_0x3a61fe[_0x75ad('0x16')]?_0x3a61fe[_0x75ad('0x16')][_0x75ad('0x1a')]?_[_0x75ad('0x1b')](_0x3a61fe[_0x75ad('0x16')][_0x75ad('0x1a')],function(_0x4dbf09){return{'model':db[_0x4dbf09['model']],'as':_0x4dbf09['as'],'attributes':_0x4dbf09['attributes'],'include':_0x4dbf09[_0x75ad('0x1a')]?_[_0x75ad('0x1b')](_0x4dbf09['include'],function(_0x25511c){return{'model':db[_0x25511c[_0x75ad('0x1c')]],'as':_0x25511c['as'],'attributes':_0x25511c[_0x75ad('0x18')],'include':_0x25511c['include']?_[_0x75ad('0x1b')](_0x25511c[_0x75ad('0x1a')],function(_0x5bf8aa){return{'model':db[_0x5bf8aa[_0x75ad('0x1c')]],'as':_0x5bf8aa['as'],'attributes':_0x5bf8aa[_0x75ad('0x18')]};}):[]};}):[]};}):[]:[]})[_0x75ad('0xa')](function(_0x22e448){logger[_0x75ad('0xb')](_0x75ad('0x14'),_0x3a61fe);logger['debug']('GetTemplate',_0x3a61fe,JSON[_0x75ad('0x10')](_0x22e448));_0x3c7dca(_0x22e448);})[_0x75ad('0x1d')](function(_0x4d708b){logger[_0x75ad('0x11')](_0x75ad('0x14'),_0x4d708b[_0x75ad('0x12')],_0x3a61fe);_0x36608b(_0x59087e[_0x75ad('0x11')](0x1f4,_0x4d708b['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 15ca0c0..83eebe6 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 _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 +var _0x4568=['/:id','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','put','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4568,0x121));var _0x8456=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x4568[_0x3b0731];return _0x4204d7;};'use strict';var multer=require(_0x8456('0x0'));var util=require('util');var path=require(_0x8456('0x1'));var timeout=require(_0x8456('0x2'));var express=require(_0x8456('0x3'));var router=express[_0x8456('0x4')]();var auth=require(_0x8456('0x5'));var interaction=require(_0x8456('0x6'));var config=require(_0x8456('0x7'));var controller=require(_0x8456('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8456('0x9')]('/:id',auth[_0x8456('0xa')](),controller[_0x8456('0xb')]);router[_0x8456('0x9')](_0x8456('0xc'),auth[_0x8456('0xa')](),controller[_0x8456('0xd')]);router[_0x8456('0x9')](_0x8456('0xe'),auth['isAuthenticated'](),controller['getAnyConditions']);router['get'](_0x8456('0xf'),auth['isAuthenticated'](),controller[_0x8456('0x10')]);router[_0x8456('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8456('0x11')](_0x8456('0xc'),auth[_0x8456('0xa')](),controller[_0x8456('0x12')]);router[_0x8456('0x11')](_0x8456('0xe'),auth[_0x8456('0xa')](),controller[_0x8456('0x13')]);router[_0x8456('0x11')](_0x8456('0xf'),auth['isAuthenticated'](),controller[_0x8456('0x14')]);router[_0x8456('0x15')]('/:id',auth[_0x8456('0xa')](),controller[_0x8456('0x16')]);router['delete'](_0x8456('0x17'),auth[_0x8456('0xa')](),controller[_0x8456('0x18')]);module[_0x8456('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 0db234a..197f6a3 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 _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 +var _0xcc9c=['sequelize','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcc9c,0xed));var _0xccc9=function(_0x628b1c,_0x2177c9){_0x628b1c=_0x628b1c-0x0;var _0x4d7f67=_0xcc9c[_0x628b1c];return _0x4d7f67;};'use strict';var Sequelize=require(_0xccc9('0x0'));module[_0xccc9('0x1')]={'name':{'type':Sequelize[_0xccc9('0x2')]},'channel':{'type':Sequelize[_0xccc9('0x2')]},'description':{'type':Sequelize[_0xccc9('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 4eae08b..3357706 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 _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 +var _0x8917=['path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','Trigger','include','catch','create','body','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','findOne','order','pick','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x54db05,_0x4de7fb){var _0x1cdca0=function(_0x280db3){while(--_0x280db3){_0x54db05['push'](_0x54db05['shift']());}};_0x1cdca0(++_0x4de7fb);}(_0x8917,0x1d7));var _0x7891=function(_0x467793,_0x2a09ca){_0x467793=_0x467793-0x0;var _0x1d7cf5=_0x8917[_0x467793];return _0x1d7cf5;};'use strict';var pdf=require(_0x7891('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7891('0x1'));var zipdir=require(_0x7891('0x2'));var jsonpatch=require(_0x7891('0x3'));var rp=require(_0x7891('0x4'));var moment=require(_0x7891('0x5'));var BPromise=require(_0x7891('0x6'));var Mustache=require(_0x7891('0x7'));var util=require(_0x7891('0x8'));var path=require(_0x7891('0x9'));var sox=require('sox');var csv=require(_0x7891('0xa'));var ejs=require(_0x7891('0xb'));var fs=require('fs');var _=require(_0x7891('0xc'));var squel=require(_0x7891('0xd'));var crypto=require(_0x7891('0xe'));var jsforce=require(_0x7891('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7891('0xa'));var querystring=require('querystring');var Papa=require(_0x7891('0x10'));var Redis=require(_0x7891('0x11'));var authService=require(_0x7891('0x12'));var qs=require(_0x7891('0x13'));var as=require(_0x7891('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7891('0x15'))(_0x7891('0x16'));var utils=require(_0x7891('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7891('0x18'));var db=require(_0x7891('0x19'))['db'];function respondWithStatusCode(_0x1a1dbc,_0x31692f){_0x31692f=_0x31692f||0xcc;return function(_0x1b481e){if(_0x1b481e){return _0x1a1dbc['sendStatus'](_0x31692f);}return _0x1a1dbc[_0x7891('0x1a')](_0x31692f)[_0x7891('0x1b')]();};}function respondWithResult(_0x2517f1,_0xc56bc0){_0xc56bc0=_0xc56bc0||0xc8;return function(_0x71e75c){if(_0x71e75c){return _0x2517f1[_0x7891('0x1a')](_0xc56bc0)['json'](_0x71e75c);}};}function respondWithFilteredResult(_0x1fa45b,_0x21a74f){return function(_0x5bfe12){if(_0x5bfe12){var _0x23286b=_0x5bfe12[_0x7891('0x1c')],_0x19731c=_0x21a74f[_0x7891('0x1d')],_0x5b4b88=_0x21a74f[_0x7891('0x1d')]+_0x21a74f[_0x7891('0x1e')],_0x44e17b;if(_0x5b4b88>=_0x23286b){_0x5b4b88=_0x23286b;_0x44e17b=0xc8;}else{_0x44e17b=0xce;}_0x1fa45b[_0x7891('0x1a')](_0x44e17b);return _0x1fa45b[_0x7891('0x1f')](_0x7891('0x20'),_0x19731c+'-'+_0x5b4b88+'/'+_0x23286b)[_0x7891('0x21')](_0x5bfe12);}return null;};}function patchUpdates(_0x164155){return function(_0x20da1e){try{jsonpatch['apply'](_0x20da1e,_0x164155,!![]);}catch(_0x4f4cf4){return BPromise[_0x7891('0x22')](_0x4f4cf4);}return _0x20da1e[_0x7891('0x23')]();};}function saveUpdates(_0x30b2ae,_0x4c76fe){return function(_0x5bcb34){if(_0x5bcb34){return _0x5bcb34[_0x7891('0x24')](_0x30b2ae)[_0x7891('0x25')](function(_0x1dba83){return _0x1dba83;});}return null;};}function removeEntity(_0x36f66a,_0x155a97){return function(_0xf09f20){if(_0xf09f20){return _0xf09f20[_0x7891('0x26')]()['then'](function(){var _0x28a917=_0xf09f20[_0x7891('0x27')]({'plain':!![]});var _0x27f2e0=_0x7891('0x28');return db[_0x7891('0x29')][_0x7891('0x26')]({'where':{'type':_0x27f2e0,'resourceId':_0x28a917['id']}})[_0x7891('0x25')](function(){return _0xf09f20;});})[_0x7891('0x25')](function(){_0x36f66a[_0x7891('0x1a')](0xcc)[_0x7891('0x1b')]();});}};}function handleEntityNotFound(_0x55108b,_0x1631fc){return function(_0x369740){if(!_0x369740){_0x55108b[_0x7891('0x2a')](0x194);}return _0x369740;};}function handleError(_0x12ed70,_0x5afd05){_0x5afd05=_0x5afd05||0x1f4;return function(_0xa1fa44){logger['error'](_0xa1fa44[_0x7891('0x2b')]);if(_0xa1fa44[_0x7891('0x2c')]){delete _0xa1fa44[_0x7891('0x2c')];}_0x12ed70['status'](_0x5afd05)[_0x7891('0x2d')](_0xa1fa44);};}exports[_0x7891('0x2e')]=function(_0x44442f,_0x263f13){var _0x27be75={},_0x2a72d2={},_0x4af630={'count':0x0,'rows':[]};var _0x5ddee8=_[_0x7891('0x2f')](db['Trigger'][_0x7891('0x30')],function(_0x3b0a40){return{'name':_0x3b0a40[_0x7891('0x31')],'type':_0x3b0a40[_0x7891('0x32')][_0x7891('0x33')]};});_0x2a72d2[_0x7891('0x34')]=_[_0x7891('0x2f')](_0x5ddee8,'name');_0x2a72d2[_0x7891('0x35')]=_[_0x7891('0x36')](_0x44442f[_0x7891('0x35')]);_0x2a72d2[_0x7891('0x37')]=_[_0x7891('0x38')](_0x2a72d2[_0x7891('0x34')],_0x2a72d2[_0x7891('0x35')]);_0x27be75['attributes']=_['intersection'](_0x2a72d2['model'],qs['fields'](_0x44442f[_0x7891('0x35')][_0x7891('0x39')]));_0x27be75[_0x7891('0x3a')]=_0x27be75[_0x7891('0x3a')][_0x7891('0x3b')]?_0x27be75[_0x7891('0x3a')]:_0x2a72d2['model'];if(!_0x44442f[_0x7891('0x35')][_0x7891('0x3c')](_0x7891('0x3d'))){_0x27be75[_0x7891('0x1e')]=qs[_0x7891('0x1e')](_0x44442f[_0x7891('0x35')][_0x7891('0x1e')]);_0x27be75['offset']=qs[_0x7891('0x1d')](_0x44442f['query'][_0x7891('0x1d')]);}_0x27be75['order']=qs[_0x7891('0x3e')](_0x44442f[_0x7891('0x35')][_0x7891('0x3e')]);_0x27be75[_0x7891('0x3f')]=qs[_0x7891('0x37')](_['pick'](_0x44442f[_0x7891('0x35')],_0x2a72d2[_0x7891('0x37')]),_0x5ddee8);if(_0x44442f[_0x7891('0x35')][_0x7891('0x40')]){_0x27be75[_0x7891('0x3f')]=_['merge'](_0x27be75['where'],{'$or':_['map'](_0x5ddee8,function(_0x2c7127){if(_0x2c7127[_0x7891('0x32')]!==_0x7891('0x41')){var _0x3b1e23={};_0x3b1e23[_0x2c7127[_0x7891('0x2c')]]={'$like':'%'+_0x44442f['query']['filter']+'%'};return _0x3b1e23;}})});}_0x27be75=_[_0x7891('0x42')]({},_0x27be75,_0x44442f[_0x7891('0x43')]);var _0xd11f5f={'where':_0x27be75[_0x7891('0x3f')]};return db['Trigger'][_0x7891('0x1c')](_0xd11f5f)[_0x7891('0x25')](function(_0x18da2f){_0x4af630[_0x7891('0x1c')]=_0x18da2f;if(_0x44442f[_0x7891('0x35')][_0x7891('0x44')]){_0x27be75['include']=[{'all':!![]}];}return db['Trigger'][_0x7891('0x45')](_0x27be75);})['then'](function(_0x1fef94){_0x4af630[_0x7891('0x46')]=_0x1fef94;return _0x4af630;})[_0x7891('0x25')](respondWithFilteredResult(_0x263f13,_0x27be75))['catch'](handleError(_0x263f13,null));};exports['show']=function(_0x29a55b,_0xe65246){var _0x1861c6={'raw':![],'where':{'id':_0x29a55b[_0x7891('0x47')]['id']}},_0x131f26={};_0x131f26['model']=_['keys'](db[_0x7891('0x48')]['rawAttributes']);_0x131f26[_0x7891('0x35')]=_['keys'](_0x29a55b[_0x7891('0x35')]);_0x131f26[_0x7891('0x37')]=_[_0x7891('0x38')](_0x131f26['model'],_0x131f26[_0x7891('0x35')]);_0x1861c6[_0x7891('0x3a')]=_[_0x7891('0x38')](_0x131f26[_0x7891('0x34')],qs['fields'](_0x29a55b[_0x7891('0x35')][_0x7891('0x39')]));_0x1861c6['attributes']=_0x1861c6['attributes'][_0x7891('0x3b')]?_0x1861c6['attributes']:_0x131f26[_0x7891('0x34')];if(_0x29a55b[_0x7891('0x35')][_0x7891('0x44')]){_0x1861c6[_0x7891('0x49')]=[{'all':!![]}];}_0x1861c6=_['merge']({},_0x1861c6,_0x29a55b[_0x7891('0x43')]);return db['Trigger']['find'](_0x1861c6)['then'](handleEntityNotFound(_0xe65246,null))[_0x7891('0x25')](respondWithResult(_0xe65246,null))[_0x7891('0x4a')](handleError(_0xe65246,null));};exports[_0x7891('0x4b')]=function(_0x4086bb,_0x501910){return db[_0x7891('0x48')][_0x7891('0x4b')](_0x4086bb[_0x7891('0x4c')],{})[_0x7891('0x25')](function(_0xa637bc){var _0x551aa9=_0x4086bb['user'][_0x7891('0x27')]({'plain':!![]});if(!_0x551aa9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x551aa9[_0x7891('0x4d')]==='user'){var _0x1056d8=_0xa637bc[_0x7891('0x27')]({'plain':!![]});var _0x46a0a1=_0x7891('0x28');return db[_0x7891('0x4e')][_0x7891('0x4f')]({'where':{'name':_0x46a0a1,'userProfileId':_0x551aa9[_0x7891('0x50')]},'raw':!![]})[_0x7891('0x25')](function(_0x13aaa1){if(_0x13aaa1&&_0x13aaa1[_0x7891('0x51')]===0x0){return db[_0x7891('0x29')][_0x7891('0x4b')]({'name':_0x1056d8[_0x7891('0x2c')],'resourceId':_0x1056d8['id'],'type':_0x13aaa1[_0x7891('0x2c')],'sectionId':_0x13aaa1['id']},{})[_0x7891('0x25')](function(){return _0xa637bc;});}else{return _0xa637bc;}})[_0x7891('0x4a')](function(_0x51a6fc){logger[_0x7891('0x52')](_0x7891('0x53'),_0x51a6fc);throw _0x51a6fc;});}return _0xa637bc;})[_0x7891('0x25')](respondWithResult(_0x501910,0xc9))[_0x7891('0x4a')](handleError(_0x501910,null));};exports[_0x7891('0x24')]=function(_0x20c74a,_0x1fa0bc){if(_0x20c74a['body']['id']){delete _0x20c74a['body']['id'];}return db[_0x7891('0x48')]['find']({'where':{'id':_0x20c74a['params']['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x1fa0bc,null))['then'](saveUpdates(_0x20c74a['body'],null))[_0x7891('0x25')](respondWithResult(_0x1fa0bc,null))['catch'](handleError(_0x1fa0bc,null));};exports[_0x7891('0x26')]=function(_0x27c664,_0x4624b8){return db['Trigger']['find']({'where':{'id':_0x27c664[_0x7891('0x47')]['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x4624b8,null))[_0x7891('0x25')](removeEntity(_0x4624b8,null))[_0x7891('0x4a')](handleError(_0x4624b8,null));};exports[_0x7891('0x54')]=function(_0x504124,_0x443000,_0x15f316){if(_0x504124['body']['id']){delete _0x504124[_0x7891('0x4c')]['id'];}return db[_0x7891('0x48')][_0x7891('0x4f')]({'where':{'id':_0x504124[_0x7891('0x47')]['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x443000,null))[_0x7891('0x25')](function(_0xb60097){if(_0xb60097){_0x504124['body'][_0x7891('0x55')]=_0xb60097['id'];return db[_0x7891('0x56')][_0x7891('0x4b')](_0x504124['body']);}})['then'](respondWithResult(_0x443000,null))[_0x7891('0x4a')](handleError(_0x443000,null));};exports['addAnyCondition']=function(_0x5e5caa,_0x3be636,_0x13aad7){if(_0x5e5caa[_0x7891('0x4c')]['id']){delete _0x5e5caa[_0x7891('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x5e5caa[_0x7891('0x47')]['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x3be636,null))[_0x7891('0x25')](function(_0x2dda91){if(_0x2dda91){_0x5e5caa[_0x7891('0x4c')]['TriggerAnyId']=_0x2dda91['id'];return db[_0x7891('0x56')][_0x7891('0x4b')](_0x5e5caa[_0x7891('0x4c')]);}})['then'](respondWithResult(_0x3be636,null))[_0x7891('0x4a')](handleError(_0x3be636,null));};exports['getAllConditions']=function(_0xe3114b,_0x2a4d91,_0x31c264){var _0x2b1ac0={};var _0x398fef={};var _0x17182d;var _0x380aa1;return db[_0x7891('0x48')][_0x7891('0x57')]({'where':{'id':_0xe3114b[_0x7891('0x47')]['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x2a4d91,null))[_0x7891('0x25')](function(_0x31ec94){if(_0x31ec94){_0x17182d=_0x31ec94;_0x398fef['model']=_[_0x7891('0x36')](db[_0x7891('0x56')][_0x7891('0x30')]);_0x398fef[_0x7891('0x35')]=_[_0x7891('0x36')](_0xe3114b[_0x7891('0x35')]);_0x398fef[_0x7891('0x37')]=_[_0x7891('0x38')](_0x398fef[_0x7891('0x34')],_0x398fef[_0x7891('0x35')]);_0x2b1ac0[_0x7891('0x3a')]=_['intersection'](_0x398fef[_0x7891('0x34')],qs['fields'](_0xe3114b[_0x7891('0x35')][_0x7891('0x39')]));_0x2b1ac0['attributes']=_0x2b1ac0['attributes'][_0x7891('0x3b')]?_0x2b1ac0['attributes']:_0x398fef[_0x7891('0x34')];_0x2b1ac0[_0x7891('0x58')]=qs[_0x7891('0x3e')](_0xe3114b[_0x7891('0x35')][_0x7891('0x3e')]);_0x2b1ac0['where']=qs['filters'](_[_0x7891('0x59')](_0xe3114b[_0x7891('0x35')],_0x398fef['filters']));if(_0xe3114b[_0x7891('0x35')][_0x7891('0x40')]){_0x2b1ac0[_0x7891('0x3f')]=_['merge'](_0x2b1ac0[_0x7891('0x3f')],{'$or':_['map'](_0x2b1ac0['attributes'],function(_0x2ce7c5){var _0x14464e={};_0x14464e[_0x2ce7c5]={'$like':'%'+_0xe3114b[_0x7891('0x35')][_0x7891('0x40')]+'%'};return _0x14464e;})});}_0x2b1ac0=_[_0x7891('0x42')]({},_0x2b1ac0,_0xe3114b[_0x7891('0x43')]);return _0x17182d[_0x7891('0x5a')](_0x2b1ac0);}})[_0x7891('0x25')](function(_0x3c12eb){if(_0x3c12eb){_0x380aa1=_0x3c12eb[_0x7891('0x3b')];if(!_0xe3114b[_0x7891('0x35')][_0x7891('0x3c')](_0x7891('0x3d'))){_0x2b1ac0[_0x7891('0x1e')]=qs['limit'](_0xe3114b['query'][_0x7891('0x1e')]);_0x2b1ac0[_0x7891('0x1d')]=qs['offset'](_0xe3114b[_0x7891('0x35')][_0x7891('0x1d')]);}return _0x17182d[_0x7891('0x5a')](_0x2b1ac0);}})[_0x7891('0x25')](function(_0x1616b6){if(_0x1616b6){return _0x1616b6?{'count':_0x380aa1,'rows':_0x1616b6}:null;}})[_0x7891('0x25')](respondWithResult(_0x2a4d91,null))[_0x7891('0x4a')](handleError(_0x2a4d91,null));};exports['getAnyConditions']=function(_0x317579,_0x425366,_0x230db0){var _0xc50f6f={};var _0x1c9663={};var _0x41f4b9;var _0x1b8da9;return db[_0x7891('0x48')][_0x7891('0x57')]({'where':{'id':_0x317579[_0x7891('0x47')]['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x425366,null))['then'](function(_0x199321){if(_0x199321){_0x41f4b9=_0x199321;_0x1c9663[_0x7891('0x34')]=_[_0x7891('0x36')](db[_0x7891('0x56')]['rawAttributes']);_0x1c9663[_0x7891('0x35')]=_[_0x7891('0x36')](_0x317579['query']);_0x1c9663[_0x7891('0x37')]=_[_0x7891('0x38')](_0x1c9663['model'],_0x1c9663[_0x7891('0x35')]);_0xc50f6f[_0x7891('0x3a')]=_['intersection'](_0x1c9663[_0x7891('0x34')],qs['fields'](_0x317579[_0x7891('0x35')][_0x7891('0x39')]));_0xc50f6f['attributes']=_0xc50f6f[_0x7891('0x3a')][_0x7891('0x3b')]?_0xc50f6f[_0x7891('0x3a')]:_0x1c9663[_0x7891('0x34')];_0xc50f6f['order']=qs['sort'](_0x317579[_0x7891('0x35')]['sort']);_0xc50f6f[_0x7891('0x3f')]=qs['filters'](_[_0x7891('0x59')](_0x317579[_0x7891('0x35')],_0x1c9663[_0x7891('0x37')]));if(_0x317579[_0x7891('0x35')][_0x7891('0x40')]){_0xc50f6f[_0x7891('0x3f')]=_['merge'](_0xc50f6f['where'],{'$or':_['map'](_0xc50f6f[_0x7891('0x3a')],function(_0x141a3d){var _0x4ff5c7={};_0x4ff5c7[_0x141a3d]={'$like':'%'+_0x317579[_0x7891('0x35')][_0x7891('0x40')]+'%'};return _0x4ff5c7;})});}_0xc50f6f=_['merge']({},_0xc50f6f,_0x317579[_0x7891('0x43')]);return _0x41f4b9[_0x7891('0x5b')](_0xc50f6f);}})[_0x7891('0x25')](function(_0x2a26ac){if(_0x2a26ac){_0x1b8da9=_0x2a26ac[_0x7891('0x3b')];if(!_0x317579[_0x7891('0x35')]['hasOwnProperty'](_0x7891('0x3d'))){_0xc50f6f[_0x7891('0x1e')]=qs[_0x7891('0x1e')](_0x317579[_0x7891('0x35')][_0x7891('0x1e')]);_0xc50f6f['offset']=qs[_0x7891('0x1d')](_0x317579[_0x7891('0x35')][_0x7891('0x1d')]);}return _0x41f4b9[_0x7891('0x5b')](_0xc50f6f);}})[_0x7891('0x25')](function(_0x982ba8){if(_0x982ba8){return _0x982ba8?{'count':_0x1b8da9,'rows':_0x982ba8}:null;}})['then'](respondWithResult(_0x425366,null))[_0x7891('0x4a')](handleError(_0x425366,null));};exports[_0x7891('0x5c')]=function(_0x20b4c2,_0x27df1b,_0x46d42d){if(_0x20b4c2['body']['id']){delete _0x20b4c2['body']['id'];}return db[_0x7891('0x48')]['find']({'where':{'id':_0x20b4c2[_0x7891('0x47')]['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x27df1b,null))[_0x7891('0x25')](function(_0x13b0e0){if(_0x13b0e0){_0x20b4c2[_0x7891('0x4c')][_0x7891('0x5d')]=_0x13b0e0['id'];return db[_0x7891('0x5e')]['create'](_0x20b4c2[_0x7891('0x4c')]);}})[_0x7891('0x25')](respondWithResult(_0x27df1b,null))[_0x7891('0x4a')](handleError(_0x27df1b,null));};exports[_0x7891('0x5f')]=function(_0x3ffc36,_0x11b689,_0xbd2e53){var _0x1e9e61={};var _0x4d64de={};var _0x150d57;var _0x1f029;return db[_0x7891('0x48')][_0x7891('0x57')]({'where':{'id':_0x3ffc36['params']['id']}})[_0x7891('0x25')](handleEntityNotFound(_0x11b689,null))[_0x7891('0x25')](function(_0x2e53a0){if(_0x2e53a0){_0x150d57=_0x2e53a0;_0x4d64de['model']=_[_0x7891('0x36')](db['Action'][_0x7891('0x30')]);_0x4d64de[_0x7891('0x35')]=_[_0x7891('0x36')](_0x3ffc36[_0x7891('0x35')]);_0x4d64de[_0x7891('0x37')]=_[_0x7891('0x38')](_0x4d64de[_0x7891('0x34')],_0x4d64de[_0x7891('0x35')]);_0x1e9e61[_0x7891('0x3a')]=_[_0x7891('0x38')](_0x4d64de[_0x7891('0x34')],qs[_0x7891('0x39')](_0x3ffc36[_0x7891('0x35')][_0x7891('0x39')]));_0x1e9e61[_0x7891('0x3a')]=_0x1e9e61[_0x7891('0x3a')][_0x7891('0x3b')]?_0x1e9e61[_0x7891('0x3a')]:_0x4d64de[_0x7891('0x34')];_0x1e9e61[_0x7891('0x58')]=qs[_0x7891('0x3e')](_0x3ffc36[_0x7891('0x35')]['sort']);_0x1e9e61[_0x7891('0x3f')]=qs['filters'](_[_0x7891('0x59')](_0x3ffc36[_0x7891('0x35')],_0x4d64de[_0x7891('0x37')]));if(_0x3ffc36[_0x7891('0x35')][_0x7891('0x40')]){_0x1e9e61[_0x7891('0x3f')]=_[_0x7891('0x42')](_0x1e9e61[_0x7891('0x3f')],{'$or':_[_0x7891('0x2f')](_0x1e9e61['attributes'],function(_0x3a0d2a){var _0x32417e={};_0x32417e[_0x3a0d2a]={'$like':'%'+_0x3ffc36[_0x7891('0x35')][_0x7891('0x40')]+'%'};return _0x32417e;})});}_0x1e9e61=_[_0x7891('0x42')]({},_0x1e9e61,_0x3ffc36[_0x7891('0x43')]);return _0x150d57[_0x7891('0x5f')](_0x1e9e61);}})['then'](function(_0x4587a8){if(_0x4587a8){_0x1f029=_0x4587a8[_0x7891('0x3b')];if(!_0x3ffc36[_0x7891('0x35')][_0x7891('0x3c')](_0x7891('0x3d'))){_0x1e9e61[_0x7891('0x1e')]=qs[_0x7891('0x1e')](_0x3ffc36[_0x7891('0x35')][_0x7891('0x1e')]);_0x1e9e61[_0x7891('0x1d')]=qs[_0x7891('0x1d')](_0x3ffc36[_0x7891('0x35')][_0x7891('0x1d')]);}return _0x150d57['getActions'](_0x1e9e61);}})[_0x7891('0x25')](function(_0x31517a){if(_0x31517a){return _0x31517a?{'count':_0x1f029,'rows':_0x31517a}:null;}})[_0x7891('0x25')](respondWithResult(_0x11b689,null))[_0x7891('0x4a')](handleError(_0x11b689,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index cf02ad7..c80c93d 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 _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 +var _0x42a6=['../../config/environment','Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0x42a6,0xb7));var _0x642a=function(_0x5f3562,_0x212f41){_0x5f3562=_0x5f3562-0x0;var _0x1b39b4=_0x42a6[_0x5f3562];return _0x1b39b4;};'use strict';var _=require(_0x642a('0x0'));var util=require('util');var logger=require(_0x642a('0x1'))(_0x642a('0x2'));var moment=require(_0x642a('0x3'));var BPromise=require(_0x642a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x642a('0x5'));var rimraf=require('rimraf');var config=require(_0x642a('0x6'));var attributes=require('./trigger.attributes');module['exports']=function(_0x1f9c42,_0x5ee395){return _0x1f9c42['define'](_0x642a('0x7'),attributes,{'tableName':_0x642a('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 b624292..c94e6cb 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 _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 +var _0x1339=['stringify','error','code','message','result','catch','Trigger','findAll','options','attributes','map','include','model','GetTrigger','debug','raw','ShowTrigger','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0xb52a30,_0x9b4336){var _0x160875=function(_0xd23d7a){while(--_0xd23d7a){_0xb52a30['push'](_0xb52a30['shift']());}};_0x160875(++_0x9b4336);}(_0x1339,0x1ed));var _0x9133=function(_0x368480,_0x416007){_0x368480=_0x368480-0x0;var _0x1afdcb=_0x1339[_0x368480];return _0x1afdcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('Trigger,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}exports['GetTrigger']=function(_0x1f3484){var _0x573998=this;return new Promise(function(_0x3c48ef,_0x5d4a77){return db[_0x9133('0x17')][_0x9133('0x18')]({'raw':_0x1f3484['options']?_0x1f3484[_0x9133('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options']['where']||null:null,'attributes':_0x1f3484[_0x9133('0x19')]?_0x1f3484['options'][_0x9133('0x1a')]||null:null,'limit':_0x1f3484['options']?_0x1f3484['options']['limit']||null:null,'include':_0x1f3484[_0x9133('0x19')]?_0x1f3484[_0x9133('0x19')]['include']?_[_0x9133('0x1b')](_0x1f3484[_0x9133('0x19')][_0x9133('0x1c')],function(_0x26190c){return{'model':db[_0x26190c['model']],'as':_0x26190c['as'],'attributes':_0x26190c[_0x9133('0x1a')],'include':_0x26190c['include']?_[_0x9133('0x1b')](_0x26190c[_0x9133('0x1c')],function(_0x3f278d){return{'model':db[_0x3f278d[_0x9133('0x1d')]],'as':_0x3f278d['as'],'attributes':_0x3f278d[_0x9133('0x1a')],'include':_0x3f278d[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x3f278d[_0x9133('0x1c')],function(_0x1b6b3e){return{'model':db[_0x1b6b3e[_0x9133('0x1d')]],'as':_0x1b6b3e['as'],'attributes':_0x1b6b3e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x477bf1){logger[_0x9133('0xd')](_0x9133('0x1e'),_0x1f3484);logger[_0x9133('0x1f')]('GetTrigger',_0x1f3484,JSON['stringify'](_0x477bf1));_0x3c48ef(_0x477bf1);})[_0x9133('0x16')](function(_0x45966d){logger[_0x9133('0x12')](_0x9133('0x1e'),_0x45966d[_0x9133('0x14')],_0x1f3484);_0x5d4a77(_0x573998[_0x9133('0x12')](0x1f4,_0x45966d['message']));});});};exports['ShowTrigger']=function(_0x5a27c1){var _0x1ad222=this;return new Promise(function(_0x4a4a8e,_0x43b5f3){return db[_0x9133('0x17')]['find']({'raw':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1['options'][_0x9133('0x20')]===undefined?!![]:![]:!![],'where':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')]['where']||null:null,'attributes':_0x5a27c1[_0x9133('0x19')]?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1a')]||null:null,'include':_0x5a27c1['options']?_0x5a27c1[_0x9133('0x19')][_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x5a27c1['options'][_0x9133('0x1c')],function(_0x20da68){return{'model':db[_0x20da68[_0x9133('0x1d')]],'as':_0x20da68['as'],'attributes':_0x20da68[_0x9133('0x1a')],'include':_0x20da68['include']?_[_0x9133('0x1b')](_0x20da68[_0x9133('0x1c')],function(_0x56719e){return{'model':db[_0x56719e[_0x9133('0x1d')]],'as':_0x56719e['as'],'attributes':_0x56719e[_0x9133('0x1a')],'include':_0x56719e[_0x9133('0x1c')]?_[_0x9133('0x1b')](_0x56719e[_0x9133('0x1c')],function(_0x2db377){return{'model':db[_0x2db377[_0x9133('0x1d')]],'as':_0x2db377['as'],'attributes':_0x2db377[_0x9133('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9133('0xc')](function(_0x335217){logger[_0x9133('0xd')]('ShowTrigger',_0x5a27c1);logger[_0x9133('0x1f')](_0x9133('0x21'),_0x5a27c1,JSON['stringify'](_0x335217));_0x4a4a8e(_0x335217);})[_0x9133('0x16')](function(_0x3a2d1f){logger[_0x9133('0x12')](_0x9133('0x21'),_0x3a2d1f[_0x9133('0x14')],_0x5a27c1);_0x43b5f3(_0x1ad222[_0x9133('0x12')](0x1f4,_0x3a2d1f['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 52912d3..b1d59aa 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 _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 +var _0xbd50=['show','clone','post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x22d72b,_0x112e6d){var _0x35f65f=function(_0x23d67f){while(--_0x23d67f){_0x22d72b['push'](_0x22d72b['shift']());}};_0x35f65f(++_0x112e6d);}(_0xbd50,0x196));var _0x0bd5=function(_0x36b2c5,_0x5eaf9a){_0x36b2c5=_0x36b2c5-0x0;var _0x919462=_0xbd50[_0x36b2c5];return _0x919462;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['post']('/:id/clone',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bd5('0xf')]);router[_0x0bd5('0x10')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['delete'](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1f1f425..3b852b0 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 _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 +var _0x3bd1=['\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER'];(function(_0x42aba3,_0x4ef48f){var _0x33b03c=function(_0x424739){while(--_0x424739){_0x42aba3['push'](_0x42aba3['shift']());}};_0x33b03c(++_0x4ef48f);}(_0x3bd1,0xab));var _0x13bd=function(_0x27a4b2,_0x231b8d){_0x27a4b2=_0x27a4b2-0x0;var _0x189df2=_0x3bd1[_0x27a4b2];return _0x189df2;};'use strict';var Sequelize=require('sequelize');module[_0x13bd('0x0')]={'name':{'type':Sequelize[_0x13bd('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x3'),_0x13bd('0x4'),_0x13bd('0x5')),'allowNull':![],'defaultValue':_0x13bd('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x13bd('0x6')},'callingpres':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x7'),'ALLOWED_PASSED_SCREEN',_0x13bd('0x8'),_0x13bd('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0x13bd('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0x13bd('0x1')]},'permit':{'type':Sequelize[_0x13bd('0x1')]},'secret':{'type':Sequelize[_0x13bd('0x1')]},'md5secret':{'type':Sequelize[_0x13bd('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x13bd('0x1')],'defaultValue':_0x13bd('0xb'),'set':function(_0x50c39d){this['setDataValue'](_0x13bd('0xc'),_0x50c39d?_0x50c39d[_0x13bd('0xd')](','):null);},'get':function(){return this[_0x13bd('0xe')]('transport')?this[_0x13bd('0xe')](_0x13bd('0xc'))[_0x13bd('0xf')](','):null;},'comment':_0x13bd('0x10')},'dtmfmode':{'type':Sequelize[_0x13bd('0x2')]('rfc2833',_0x13bd('0x11'),_0x13bd('0x12'),'inband',_0x13bd('0x13')),'defaultValue':_0x13bd('0x14')},'directmedia':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no',_0x13bd('0x16'),_0x13bd('0x17'),_0x13bd('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x13bd('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x13bd('0x1')],'defaultValue':_0x13bd('0x19'),'set':function(_0x805ef7){this['setDataValue']('nat',_0x805ef7?_0x805ef7['join'](','):null);},'get':function(){return this['getDataValue'](_0x13bd('0x1a'))?this[_0x13bd('0xe')](_0x13bd('0x1a'))['split'](','):null;},'comment':_0x13bd('0x1b')},'callgroup':{'type':Sequelize[_0x13bd('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x13bd('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x13bd('0x1')]},'language':{'type':Sequelize[_0x13bd('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x13bd('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x13bd('0x1')],'defaultValue':_0x13bd('0x1c')},'allow':{'type':Sequelize[_0x13bd('0x1')],'allowNull':![],'defaultValue':_0x13bd('0x1d'),'set':function(_0x41a9f9){this[_0x13bd('0x1e')](_0x13bd('0x1f'),_0x41a9f9?_0x41a9f9[_0x13bd('0xd')](';'):_0x13bd('0x1d'));},'get':function(){return this[_0x13bd('0xe')](_0x13bd('0x1f'))?this[_0x13bd('0xe')](_0x13bd('0x1f'))['split'](';'):null;},'comment':_0x13bd('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0x13bd('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x13bd('0x21'),'set':function(_0xc3e788){this['setDataValue'](_0x13bd('0x22'),_0xc3e788?_0xc3e788[_0x13bd('0xd')](','):null);},'get':function(){return this[_0x13bd('0xe')](_0x13bd('0x22'))?this[_0x13bd('0xe')](_0x13bd('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x13bd('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no',_0x13bd('0x23'))},'promiscredir':{'type':Sequelize[_0x13bd('0x2')]('yes','no')},'useclientcode':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'accountcode':{'type':Sequelize[_0x13bd('0x24')](0xb)},'setvar':{'type':Sequelize[_0x13bd('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x13bd('0x25')},'amaflags':{'type':Sequelize[_0x13bd('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x13bd('0x15'),'no'),'defaultValue':_0x13bd('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x13bd('0x1')]},'template':{'type':Sequelize[_0x13bd('0x1')]},'videosupport':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no',_0x13bd('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x13bd('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'mailbox':{'type':Sequelize[_0x13bd('0x1')]},'session_timers':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x27'),_0x13bd('0x28'),'originate')},'session_expires':{'type':Sequelize[_0x13bd('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x13bd('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x29'),_0x13bd('0x2a')),'defaultValue':_0x13bd('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0x13bd('0x1')]},'regexten':{'type':Sequelize[_0x13bd('0x1')]},'fromdomain':{'type':Sequelize[_0x13bd('0x1')]},'fromuser':{'type':Sequelize[_0x13bd('0x1')]},'port':{'type':Sequelize[_0x13bd('0x24')](0x5)},'qualify':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x13bd('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x13bd('0x1')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x13bd('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x13bd('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no',_0x13bd('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x13bd('0x1')]},'callbackextension':{'type':Sequelize[_0x13bd('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x13bd('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x13bd('0x1')]},'contactacl':{'type':Sequelize[_0x13bd('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x13bd('0x1')]},'maxforwards':{'type':Sequelize[_0x13bd('0x24')](0xb)},'encryption':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'force_avp':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'icesupport':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x13bd('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no',_0x13bd('0x2c'),_0x13bd('0x2d'))},'dtlsrekey':{'type':Sequelize[_0x13bd('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x13bd('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x13bd('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x13bd('0x1')]},'dtlscapath':{'type':Sequelize[_0x13bd('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x13bd('0x2e'),_0x13bd('0x2f'),_0x13bd('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x13bd('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x13bd('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x13bd('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x13bd('0x2')](_0x13bd('0x15'),'no')},'subscribemwi':{'type':Sequelize['ENUM']('yes','no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x13bd('0x1')]},'mohsuggest':{'type':Sequelize[_0x13bd('0x1')]},'parkinglot':{'type':Sequelize[_0x13bd('0x1')]},'description':{'type':Sequelize[_0x13bd('0x1')]},'host':{'type':Sequelize[_0x13bd('0x1')],'defaultValue':_0x13bd('0x31')},'canreinvite':{'type':Sequelize[_0x13bd('0x2')]('yes','no',_0x13bd('0x16'),_0x13bd('0x17'),_0x13bd('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x13bd('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x13bd('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x13bd('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 9dfb0be..e179ab7 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 _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 +var _0x03e8=['lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','client','http','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','json','count','offset','set','apply','reject','save','update','then','get','Trunks','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Trunk','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','clone','omit','createdAt','body','updatedAt','create','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','utf8','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','writeFileSync','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','server/files/templates/trunk.ejs','/etc/asterisk/sip_xcally_registers.conf','html-pdf','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0x03e8,0xd0));var _0x803e=function(_0x19a4c4,_0x343453){_0x19a4c4=_0x19a4c4-0x0;var _0x1966f7=_0x03e8[_0x19a4c4];return _0x1966f7;};'use strict';var pdf=require(_0x803e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x803e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x803e('0x2'));var rp=require(_0x803e('0x3'));var moment=require(_0x803e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x803e('0x5'));var util=require(_0x803e('0x6'));var path=require('path');var sox=require(_0x803e('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x803e('0x8'));var squel=require('squel');var crypto=require(_0x803e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x803e('0xa'));var toCsv=require(_0x803e('0xb'));var querystring=require(_0x803e('0xc'));var Papa=require(_0x803e('0xd'));var Redis=require(_0x803e('0xe'));var authService=require(_0x803e('0xf'));var qs=require(_0x803e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x803e('0x11'));var logger=require(_0x803e('0x12'))(_0x803e('0x13'));var utils=require('../../config/utils');var config=require(_0x803e('0x14'));var licenseUtil=require(_0x803e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x803e('0x16')][_0x803e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x2c9586,_0xc3ae75,_0x280da5,_0x1ec47f){return new BPromise(function(_0x1ed717,_0xe4e4b4){var _0x5702e2=_0x1ec47f||client;return _0x5702e2['request'](_0x2c9586,_0x280da5)['then'](function(_0x4d8603){logger['info'](_0x803e('0x18'),_0xc3ae75,_0x803e('0x19'));logger['debug'](_0x803e('0x1a'),_0xc3ae75,_0x803e('0x19'),JSON[_0x803e('0x1b')](_0x4d8603));if(_0x4d8603[_0x803e('0x1c')]){if(_0x4d8603['error'][_0x803e('0x1d')]===0x1f4){logger[_0x803e('0x1c')](_0x803e('0x18'),_0xc3ae75,_0x4d8603[_0x803e('0x1c')][_0x803e('0x1e')]);return _0xe4e4b4(_0x4d8603[_0x803e('0x1c')][_0x803e('0x1e')]);}logger['error'](_0x803e('0x18'),_0xc3ae75,_0x4d8603[_0x803e('0x1c')][_0x803e('0x1e')]);return _0x1ed717(_0x4d8603[_0x803e('0x1c')][_0x803e('0x1e')]);}else{logger[_0x803e('0x1f')](_0x803e('0x18'),_0xc3ae75,_0x803e('0x19'));_0x1ed717(_0x4d8603[_0x803e('0x20')][_0x803e('0x1e')]);}})['catch'](function(_0xee7483){logger['error'](_0x803e('0x18'),_0xc3ae75,_0xee7483);_0xe4e4b4(_0xee7483);});});}function respondWithStatusCode(_0x3c0fb2,_0x3dc108){_0x3dc108=_0x3dc108||0xcc;return function(_0x28d4ad){if(_0x28d4ad){return _0x3c0fb2['sendStatus'](_0x3dc108);}return _0x3c0fb2[_0x803e('0x21')](_0x3dc108)[_0x803e('0x22')]();};}function respondWithResult(_0x2c1dc5,_0x3eda35){_0x3eda35=_0x3eda35||0xc8;return function(_0x490af3){if(_0x490af3){return _0x2c1dc5['status'](_0x3eda35)[_0x803e('0x23')](_0x490af3);}};}function respondWithFilteredResult(_0x282960,_0x3c5c22){return function(_0x3c7e30){if(_0x3c7e30){var _0x206f41=_0x3c7e30[_0x803e('0x24')],_0x4445cc=_0x3c5c22[_0x803e('0x25')],_0x321d17=_0x3c5c22[_0x803e('0x25')]+_0x3c5c22['limit'],_0x1f424d;if(_0x321d17>=_0x206f41){_0x321d17=_0x206f41;_0x1f424d=0xc8;}else{_0x1f424d=0xce;}_0x282960[_0x803e('0x21')](_0x1f424d);return _0x282960[_0x803e('0x26')]('Content-Range',_0x4445cc+'-'+_0x321d17+'/'+_0x206f41)[_0x803e('0x23')](_0x3c7e30);}return null;};}function patchUpdates(_0xf1f1f0){return function(_0x48fdf2){try{jsonpatch[_0x803e('0x27')](_0x48fdf2,_0xf1f1f0,!![]);}catch(_0x74c7c){return BPromise[_0x803e('0x28')](_0x74c7c);}return _0x48fdf2[_0x803e('0x29')]();};}function saveUpdates(_0x43b143,_0x33ffe5){return function(_0x3402f0){if(_0x3402f0){return _0x3402f0[_0x803e('0x2a')](_0x43b143)[_0x803e('0x2b')](function(_0x3a54fe){return _0x3a54fe;});}return null;};}function removeEntity(_0x2e1bff,_0x1140cc){return function(_0x9196cf){if(_0x9196cf){return _0x9196cf['destroy']()[_0x803e('0x2b')](function(){var _0x43c7c2=_0x9196cf[_0x803e('0x2c')]({'plain':!![]});var _0x25a20b=_0x803e('0x2d');return db[_0x803e('0x2e')][_0x803e('0x2f')]({'where':{'type':_0x25a20b,'resourceId':_0x43c7c2['id']}})[_0x803e('0x2b')](function(){return _0x9196cf;});})['then'](function(){_0x2e1bff['status'](0xcc)[_0x803e('0x22')]();});}};}function handleEntityNotFound(_0x3f85df,_0x4b93fe){return function(_0x3fe0c6){if(!_0x3fe0c6){_0x3f85df[_0x803e('0x30')](0x194);}return _0x3fe0c6;};}function handleError(_0xfba75e,_0x5450dd){_0x5450dd=_0x5450dd||0x1f4;return function(_0x1a5875){logger[_0x803e('0x1c')](_0x1a5875[_0x803e('0x31')]);if(_0x1a5875[_0x803e('0x32')]){delete _0x1a5875[_0x803e('0x32')];}_0xfba75e['status'](_0x5450dd)[_0x803e('0x33')](_0x1a5875);};}exports[_0x803e('0x34')]=function(_0x5353a8,_0x16343a){var _0x4e1764={},_0x54f6c2={},_0x1ad5bf={'count':0x0,'rows':[]};var _0x4e44d5=_[_0x803e('0x35')](db[_0x803e('0x36')][_0x803e('0x37')],function(_0x57ac15){return{'name':_0x57ac15['fieldName'],'type':_0x57ac15[_0x803e('0x38')][_0x803e('0x39')]};});_0x54f6c2[_0x803e('0x3a')]=_[_0x803e('0x35')](_0x4e44d5,'name');_0x54f6c2[_0x803e('0x3b')]=_[_0x803e('0x3c')](_0x5353a8[_0x803e('0x3b')]);_0x54f6c2['filters']=_[_0x803e('0x3d')](_0x54f6c2[_0x803e('0x3a')],_0x54f6c2[_0x803e('0x3b')]);_0x4e1764[_0x803e('0x3e')]=_[_0x803e('0x3d')](_0x54f6c2[_0x803e('0x3a')],qs[_0x803e('0x3f')](_0x5353a8[_0x803e('0x3b')]['fields']));_0x4e1764['attributes']=_0x4e1764['attributes'][_0x803e('0x40')]?_0x4e1764[_0x803e('0x3e')]:_0x54f6c2[_0x803e('0x3a')];if(!_0x5353a8[_0x803e('0x3b')][_0x803e('0x41')](_0x803e('0x42'))){_0x4e1764[_0x803e('0x43')]=qs[_0x803e('0x43')](_0x5353a8[_0x803e('0x3b')]['limit']);_0x4e1764[_0x803e('0x25')]=qs[_0x803e('0x25')](_0x5353a8['query'][_0x803e('0x25')]);}_0x4e1764['order']=qs['sort'](_0x5353a8[_0x803e('0x3b')][_0x803e('0x44')]);_0x4e1764['where']=qs[_0x803e('0x45')](_[_0x803e('0x46')](_0x5353a8[_0x803e('0x3b')],_0x54f6c2['filters']),_0x4e44d5);if(_0x5353a8[_0x803e('0x3b')][_0x803e('0x47')]){_0x4e1764[_0x803e('0x48')]=_[_0x803e('0x49')](_0x4e1764['where'],{'$or':_['map'](_0x4e44d5,function(_0x1b8565){if(_0x1b8565[_0x803e('0x38')]!==_0x803e('0x4a')){var _0x40e393={};_0x40e393[_0x1b8565[_0x803e('0x32')]]={'$like':'%'+_0x5353a8[_0x803e('0x3b')][_0x803e('0x47')]+'%'};return _0x40e393;}})});}_0x4e1764=_[_0x803e('0x49')]({},_0x4e1764,_0x5353a8['options']);var _0x2f2dec={'where':_0x4e1764[_0x803e('0x48')]};return db[_0x803e('0x36')][_0x803e('0x24')](_0x2f2dec)['then'](function(_0x510f02){_0x1ad5bf[_0x803e('0x24')]=_0x510f02;if(_0x5353a8[_0x803e('0x3b')][_0x803e('0x4b')]){_0x4e1764['include']=[{'all':!![]}];}return db['Trunk'][_0x803e('0x4c')](_0x4e1764);})[_0x803e('0x2b')](function(_0x47f3de){_0x1ad5bf[_0x803e('0x4d')]=_0x47f3de;return _0x1ad5bf;})['then'](respondWithFilteredResult(_0x16343a,_0x4e1764))['catch'](handleError(_0x16343a,null));};exports[_0x803e('0x4e')]=function(_0x40b78d,_0x53ee5f){var _0x3c9988={'raw':![],'where':{'id':_0x40b78d[_0x803e('0x4f')]['id']}},_0x5ef49e={};_0x5ef49e['model']=_[_0x803e('0x3c')](db[_0x803e('0x36')]['rawAttributes']);_0x5ef49e[_0x803e('0x3b')]=_[_0x803e('0x3c')](_0x40b78d[_0x803e('0x3b')]);_0x5ef49e['filters']=_[_0x803e('0x3d')](_0x5ef49e[_0x803e('0x3a')],_0x5ef49e[_0x803e('0x3b')]);_0x3c9988['attributes']=_[_0x803e('0x3d')](_0x5ef49e[_0x803e('0x3a')],qs[_0x803e('0x3f')](_0x40b78d[_0x803e('0x3b')][_0x803e('0x3f')]));_0x3c9988['attributes']=_0x3c9988[_0x803e('0x3e')][_0x803e('0x40')]?_0x3c9988[_0x803e('0x3e')]:_0x5ef49e[_0x803e('0x3a')];if(_0x40b78d[_0x803e('0x3b')][_0x803e('0x4b')]){_0x3c9988[_0x803e('0x50')]=[{'all':!![]}];}_0x3c9988=_[_0x803e('0x49')]({},_0x3c9988,_0x40b78d[_0x803e('0x51')]);return db[_0x803e('0x36')][_0x803e('0x52')](_0x3c9988)[_0x803e('0x2b')](handleEntityNotFound(_0x53ee5f,null))['then'](respondWithResult(_0x53ee5f,null))[_0x803e('0x53')](handleError(_0x53ee5f,null));};exports[_0x803e('0x54')]=function(_0x4e2e2b,_0x47910d){var _0x300fde={'where':{'id':_0x4e2e2b[_0x803e('0x4f')]['id']}},_0x582a40={};_0x582a40[_0x803e('0x3a')]=_[_0x803e('0x3c')](db[_0x803e('0x36')]['rawAttributes']);_0x300fde['attributes']=_[_0x803e('0x3d')](_0x582a40[_0x803e('0x3a')],qs[_0x803e('0x3f')](_0x4e2e2b[_0x803e('0x3b')][_0x803e('0x3f')]));_0x300fde[_0x803e('0x3e')]=_0x300fde['attributes']['length']?_0x300fde[_0x803e('0x3e')]:_0x582a40['model'];if(_0x4e2e2b[_0x803e('0x3b')][_0x803e('0x4b')]){_0x300fde['include']=[{'all':!![]}];}_0x300fde=_[_0x803e('0x49')]({},_0x300fde,_0x4e2e2b[_0x803e('0x51')]);return db['Trunk']['find'](_0x300fde)[_0x803e('0x2b')](handleEntityNotFound(_0x47910d,null))[_0x803e('0x2b')](function(_0x275720){if(_0x275720){var _0x4714ce=_0x275720[_0x803e('0x2c')]({'plain':!![]});_0x4714ce=qs[_0x803e('0x55')](_0x4714ce,['id',_0x803e('0x56'),'updatedAt']);_0x4e2e2b[_0x803e('0x57')]=_[_0x803e('0x55')](_0x4e2e2b['body'],['id',_0x803e('0x56'),_0x803e('0x58')]);return db[_0x803e('0x36')][_0x803e('0x59')](_[_0x803e('0x49')](_0x4714ce,_0x4e2e2b[_0x803e('0x57')]),{'include':_0x4e2e2b[_0x803e('0x3b')][_0x803e('0x4b')]?[{'all':!![]}]:undefined})[_0x803e('0x2b')](function(_0x2950d0){var _0x46b566=_0x4e2e2b[_0x803e('0x5a')][_0x803e('0x2c')]({'plain':!![]});if(!_0x46b566)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x46b566['role']===_0x803e('0x5a')){var _0x332053=_0x2950d0[_0x803e('0x2c')]({'plain':!![]});var _0x31452e=_0x803e('0x2d');return db['UserProfileSection'][_0x803e('0x52')]({'where':{'name':_0x31452e,'userProfileId':_0x46b566['userProfileId']},'raw':!![]})[_0x803e('0x2b')](function(_0x536ffc){if(_0x536ffc&&_0x536ffc[_0x803e('0x5b')]===0x0){return db[_0x803e('0x2e')][_0x803e('0x59')]({'name':_0x332053['name'],'resourceId':_0x332053['id'],'type':_0x536ffc['name'],'sectionId':_0x536ffc['id']},{})[_0x803e('0x2b')](function(){return _0x2950d0;});}else{return _0x2950d0;}})['catch'](function(_0x4e8934){logger[_0x803e('0x1c')](_0x803e('0x5c'),_0x4e8934);throw _0x4e8934;});}return _0x2950d0;});}})[_0x803e('0x2b')](respondWithResult(_0x47910d,0xc9))[_0x803e('0x53')](handleError(_0x47910d,null));};exports[_0x803e('0x59')]=function(_0x2ddfd3,_0x4b7c07,_0x1dfc6c){var _0x3c2fe1;return db[_0x803e('0x36')][_0x803e('0x59')](_0x2ddfd3[_0x803e('0x57')],{'raw':!![]})[_0x803e('0x2b')](function(_0x48749e){_0x3c2fe1=_0x48749e;return db['Trunk']['findAll']({'raw':!![]});})[_0x803e('0x2b')](function(_0x24129e){var _0x3c8f15=fs[_0x803e('0x5d')](path[_0x803e('0x5e')](config['root'],'server/files/templates/trunk.ejs'),_0x803e('0x5f'));var _0x381e35=fs[_0x803e('0x5d')](path['join'](config['root'],_0x803e('0x60')),_0x803e('0x5f'));var _0x9a7aa9=ejs[_0x803e('0x61')](_0x3c8f15,{'trunks':_0x24129e||[]});fs['writeFileSync'](_0x803e('0x62'),_0x9a7aa9);if(_0x3c2fe1['registry']){var _0x111b8f=ejs[_0x803e('0x61')](_0x381e35,{'trunks':_0x24129e||[]});fs[_0x803e('0x63')]('/etc/asterisk/sip_xcally_registers.conf',_0x111b8f);}})[_0x803e('0x2b')](function(){return respondWithRpcPromise(_0x803e('0x64'),_0x803e('0x59'),{'module':_0x803e('0x65')});})[_0x803e('0x2b')](function(){var _0x409015=_0x2ddfd3['user'][_0x803e('0x2c')]({'plain':!![]});if(!_0x409015)throw new Error(_0x803e('0x66'));if(_0x409015[_0x803e('0x67')]==='user'){var _0x1fa102=_0x3c2fe1['get']({'plain':!![]});return db[_0x803e('0x68')][_0x803e('0x52')]({'where':{'name':_0x803e('0x2d'),'userProfileId':_0x409015[_0x803e('0x69')]},'raw':!![]})[_0x803e('0x2b')](function(_0x1e2d40){if(_0x1e2d40&&_0x1e2d40[_0x803e('0x5b')]===0x0){return db[_0x803e('0x2e')][_0x803e('0x59')]({'name':_0x1fa102[_0x803e('0x32')],'resourceId':_0x1fa102['id'],'type':_0x1e2d40[_0x803e('0x32')],'sectionId':_0x1e2d40['id']},{})[_0x803e('0x2b')](function(){return _0x3c2fe1;});}else{return _0x3c2fe1;}})['catch'](function(_0x710eb0){logger[_0x803e('0x1c')](_0x803e('0x5c'),_0x710eb0);throw _0x710eb0;});}return _0x3c2fe1;})[_0x803e('0x2b')](respondWithResult(_0x4b7c07,0xc9))[_0x803e('0x53')](handleError(_0x4b7c07,null));};exports['update']=function(_0x29820a,_0xaff7da,_0x36bb9e){var _0x451f73;return db[_0x803e('0x36')][_0x803e('0x52')]({'where':{'id':_0x29820a[_0x803e('0x4f')]['id']}})[_0x803e('0x2b')](handleEntityNotFound(_0xaff7da,null))[_0x803e('0x2b')](saveUpdates(_0x29820a[_0x803e('0x57')],null))['then'](function(_0x409552){if(_0x409552){_0x451f73=_0x409552;return db[_0x803e('0x36')][_0x803e('0x4c')]({'raw':!![]});}})[_0x803e('0x2b')](function(_0x3c289d){if(_0x3c289d){var _0x219c60=fs[_0x803e('0x5d')](path[_0x803e('0x5e')](config['root'],_0x803e('0x6a')),_0x803e('0x5f'));var _0x587cfb=fs[_0x803e('0x5d')](path['join'](config['root'],_0x803e('0x60')),_0x803e('0x5f'));var _0x5bda7e=ejs[_0x803e('0x61')](_0x219c60,{'trunks':_0x3c289d||[]});fs[_0x803e('0x63')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5bda7e);var _0x205f48=ejs[_0x803e('0x61')](_0x587cfb,{'trunks':_0x3c289d||[]});fs['writeFileSync'](_0x803e('0x6b'),_0x205f48);return respondWithRpcPromise('Reload',_0x803e('0x2a'),{'module':_0x803e('0x65')});}return null;})[_0x803e('0x2b')](function(_0x306068){if(_0x306068){return _0x451f73;}})[_0x803e('0x2b')](respondWithResult(_0xaff7da,null))[_0x803e('0x53')](handleError(_0xaff7da,null));};exports['destroy']=function(_0x39823a,_0x34337d,_0x1c0379){var _0x486fe2;return db['Trunk'][_0x803e('0x52')]({'where':{'id':_0x39823a[_0x803e('0x4f')]['id']}})[_0x803e('0x2b')](handleEntityNotFound(_0x34337d,null))[_0x803e('0x2b')](removeEntity(_0x34337d,null))[_0x803e('0x2b')](function(){return db[_0x803e('0x36')]['findAll']({'raw':!![]});})[_0x803e('0x2b')](function(_0x288594){var _0x11c7bd=fs[_0x803e('0x5d')](path['join'](config['root'],'server/files/templates/trunk.ejs'),_0x803e('0x5f'));var _0x4484ab=fs[_0x803e('0x5d')](path[_0x803e('0x5e')](config['root'],'server/files/templates/registry.ejs'),_0x803e('0x5f'));var _0x1e25bd=ejs[_0x803e('0x61')](_0x11c7bd,{'trunks':_0x288594});var _0xbf4d24=ejs[_0x803e('0x61')](_0x4484ab,{'trunks':_0x288594});fs['writeFileSync'](_0x803e('0x62'),_0x1e25bd);fs[_0x803e('0x63')](_0x803e('0x6b'),_0xbf4d24);return respondWithRpcPromise(_0x803e('0x64'),_0x803e('0x2f'),{'module':'chan_sip.so'});})['catch'](handleError(_0x34337d,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 5148ce3..0e046b2 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 _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 +var _0x4aa0=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Trunk','tools_trunks','util','../../config/logger'];(function(_0x429e48,_0x17964a){var _0x832e99=function(_0x420ff8){while(--_0x420ff8){_0x429e48['push'](_0x429e48['shift']());}};_0x832e99(++_0x17964a);}(_0x4aa0,0x111));var _0x04aa=function(_0x12388a,_0x2ba752){_0x12388a=_0x12388a-0x0;var _0x301deb=_0x4aa0[_0x12388a];return _0x301deb;};'use strict';var _=require('lodash');var util=require(_0x04aa('0x0'));var logger=require(_0x04aa('0x1'))(_0x04aa('0x2'));var moment=require('moment');var BPromise=require(_0x04aa('0x3'));var rp=require(_0x04aa('0x4'));var fs=require('fs');var path=require(_0x04aa('0x5'));var rimraf=require(_0x04aa('0x6'));var config=require(_0x04aa('0x7'));var attributes=require('./trunk.attributes');module[_0x04aa('0x8')]=function(_0x101f60,_0x4828ba){return _0x101f60['define'](_0x04aa('0x9'),attributes,{'tableName':_0x04aa('0xa'),'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 eaa61f0..8150dba 100644 --- a/server/api/trunk/trunk.rpc.js +++ b/server/api/trunk/trunk.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['stringify','error','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','ShowTrunk','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s'];(function(_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 +var _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f4977,_0x33a846){_0x2f4977=_0x2f4977-0x0;var _0x5dbcda=_0x5f2f[_0x2f4977];return _0x5dbcda;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0f80018..417873b 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 _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 +var _0x613f=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','whoami','show','/:id/avatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/sms_accounts','addSmsAccounts','/:id/chat_websites','addWhatsappAccounts','createApiKey','put','update','changePassword','removeQueues','delete','removeTeams','/:id','destroy','removeMailInteractions','/:id/sms_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports'];(function(_0x20c76d,_0x35ee5d){var _0x3dc7c3=function(_0x47ccc3){while(--_0x47ccc3){_0x20c76d['push'](_0x20c76d['shift']());}};_0x3dc7c3(++_0x35ee5d);}(_0x613f,0xdc));var _0xf613=function(_0x38e499,_0x1591a3){_0x38e499=_0x38e499-0x0;var _0x4ec936=_0x613f[_0x38e499];return _0x4ec936;};'use strict';var multer=require(_0xf613('0x0'));var util=require(_0xf613('0x1'));var path=require(_0xf613('0x2'));var timeout=require('connect-timeout');var express=require(_0xf613('0x3'));var router=express[_0xf613('0x4')]();var auth=require(_0xf613('0x5'));var interaction=require(_0xf613('0x6'));var config=require(_0xf613('0x7'));var controller=require(_0xf613('0x8'));router[_0xf613('0x9')]('/',auth[_0xf613('0xa')](),controller[_0xf613('0xb')]);router[_0xf613('0x9')]('/describe',auth[_0xf613('0xa')](),controller[_0xf613('0xc')]);router[_0xf613('0x9')]('/whoami',auth[_0xf613('0xa')](),controller[_0xf613('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf613('0xe')]);router[_0xf613('0x9')](_0xf613('0xf'),controller['getAvatar']);router['get'](_0xf613('0x10'),auth[_0xf613('0xa')](),controller['getContacts']);router['get'](_0xf613('0x11'),auth[_0xf613('0xa')](),controller[_0xf613('0x12')]);router['get']('/:id/queues_rt',auth[_0xf613('0xa')](),controller[_0xf613('0x13')]);router[_0xf613('0x9')](_0xf613('0x14'),auth[_0xf613('0xa')](),controller[_0xf613('0x15')]);router[_0xf613('0x9')]('/:id/recordings',auth[_0xf613('0xa')](),controller[_0xf613('0x16')]);router[_0xf613('0x9')](_0xf613('0x17'),auth['isAuthenticated'](),controller['getScreenRecordings']);router['get'](_0xf613('0x18'),auth[_0xf613('0xa')](),controller[_0xf613('0x19')]);router[_0xf613('0x9')](_0xf613('0x1a'),auth['isAuthenticated'](),controller[_0xf613('0x1b')]);router[_0xf613('0x9')](_0xf613('0x1c'),auth[_0xf613('0xa')](),controller[_0xf613('0x1d')]);router[_0xf613('0x9')]('/:id/sms/interactions',auth[_0xf613('0xa')](),controller[_0xf613('0x1e')]);router[_0xf613('0x9')](_0xf613('0x1f'),auth[_0xf613('0xa')](),controller[_0xf613('0x20')]);router[_0xf613('0x9')]('/:id/whatsapp/interactions',auth[_0xf613('0xa')](),controller['getWhatsappInteractions']);router[_0xf613('0x9')](_0xf613('0x21'),auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/lists',auth[_0xf613('0xa')](),controller[_0xf613('0x22')]);router['get']('/:id/agents',auth[_0xf613('0xa')](),controller[_0xf613('0x23')]);router[_0xf613('0x9')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0xf613('0x24')]);router[_0xf613('0x9')](_0xf613('0x25'),auth[_0xf613('0xa')](),controller['getFaxAccounts']);router[_0xf613('0x9')](_0xf613('0x26'),auth[_0xf613('0xa')](),controller[_0xf613('0x27')]);router[_0xf613('0x9')](_0xf613('0x28'),auth[_0xf613('0xa')](),controller[_0xf613('0x29')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xf613('0x2a')]);router[_0xf613('0x9')]('/:id/chat_websites',auth[_0xf613('0xa')](),controller['getChatWebsites']);router[_0xf613('0x9')](_0xf613('0x2b'),auth[_0xf613('0xa')](),controller['getWhatsappAccounts']);router[_0xf613('0x9')](_0xf613('0x2c'),auth['isAuthenticated'](),controller[_0xf613('0x2d')]);router[_0xf613('0x9')](_0xf613('0x2e'),auth[_0xf613('0xa')](),controller[_0xf613('0x2f')]);router[_0xf613('0x9')](_0xf613('0x30'),auth[_0xf613('0xa')](),controller[_0xf613('0x31')]);router[_0xf613('0x32')](_0xf613('0x10'),auth[_0xf613('0xa')](),controller[_0xf613('0x33')]);router[_0xf613('0x32')]('/',auth[_0xf613('0xa')](),controller[_0xf613('0x34')]);router[_0xf613('0x32')](_0xf613('0x35'),auth[_0xf613('0xa')](),controller['bulkCreate']);router['post'](_0xf613('0x11'),auth[_0xf613('0xa')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4c6344,_0x56b44d,_0x5cd477){_0x5cd477(null,path[_0xf613('0x36')](config[_0xf613('0x37')],_0xf613('0x38')));},'filename':function(_0x385a34,_0x53c13a,_0x157d42){_0x157d42(null,util[_0xf613('0x39')](_0xf613('0x3a'),Date[_0xf613('0x3b')](),_0x53c13a[_0xf613('0x3c')]));}})});router[_0xf613('0x32')](_0xf613('0xf'),upload['single'](_0xf613('0x3d')),controller[_0xf613('0x3e')]);router[_0xf613('0x32')](_0xf613('0x3f'),auth['isAuthenticated'](),controller[_0xf613('0x40')]);router[_0xf613('0x32')](_0xf613('0x41'),auth['isAuthenticated'](),controller[_0xf613('0x42')]);router[_0xf613('0x32')](_0xf613('0x43'),auth[_0xf613('0xa')](),controller[_0xf613('0x44')]);router['post'](_0xf613('0x45'),auth[_0xf613('0xa')](),controller[_0xf613('0x46')]);router[_0xf613('0x32')](_0xf613('0x21'),auth[_0xf613('0xa')](),controller[_0xf613('0x47')]);router['post'](_0xf613('0x48'),auth[_0xf613('0xa')](),controller[_0xf613('0x49')]);router[_0xf613('0x32')](_0xf613('0x4a'),auth[_0xf613('0xa')](),controller[_0xf613('0x4b')]);router[_0xf613('0x32')](_0xf613('0x4c'),auth[_0xf613('0xa')](),controller[_0xf613('0x4d')]);router[_0xf613('0x32')]('/:id/sms_interactions',auth[_0xf613('0xa')](),controller[_0xf613('0x4e')]);router[_0xf613('0x32')](_0xf613('0x4f'),auth['isAuthenticated'](),controller[_0xf613('0x50')]);router[_0xf613('0x32')](_0xf613('0x51'),auth['isAuthenticated'](),controller[_0xf613('0x52')]);router['post'](_0xf613('0x25'),auth[_0xf613('0xa')](),controller['addFaxAccounts']);router[_0xf613('0x32')](_0xf613('0x26'),auth[_0xf613('0xa')](),controller[_0xf613('0x53')]);router[_0xf613('0x32')](_0xf613('0x28'),auth[_0xf613('0xa')](),controller['addOpenchannelAccounts']);router[_0xf613('0x32')](_0xf613('0x54'),auth[_0xf613('0xa')](),controller[_0xf613('0x55')]);router['post'](_0xf613('0x56'),auth[_0xf613('0xa')](),controller['addChatWebsites']);router[_0xf613('0x32')](_0xf613('0x2b'),auth[_0xf613('0xa')](),controller[_0xf613('0x57')]);router[_0xf613('0x32')](_0xf613('0x2c'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xf613('0x32')](_0xf613('0x30'),auth['isAuthenticated'](),controller[_0xf613('0x58')]);router[_0xf613('0x59')]('/:id',auth[_0xf613('0xa')](),controller[_0xf613('0x5a')]);router[_0xf613('0x59')]('/:id/password',auth[_0xf613('0xa')](),controller[_0xf613('0x5b')]);router['delete'](_0xf613('0x11'),auth[_0xf613('0xa')](),controller[_0xf613('0x5c')]);router[_0xf613('0x5d')](_0xf613('0x21'),auth[_0xf613('0xa')](),controller[_0xf613('0x5e')]);router[_0xf613('0x5d')](_0xf613('0x5f'),auth[_0xf613('0xa')](),controller[_0xf613('0x60')]);router[_0xf613('0x5d')](_0xf613('0x48'),auth['isAuthenticated'](),controller['removeChatInteractions']);router[_0xf613('0x5d')](_0xf613('0x4a'),auth[_0xf613('0xa')](),controller[_0xf613('0x61')]);router[_0xf613('0x5d')](_0xf613('0x4c'),auth['isAuthenticated'](),controller['removeFaxInteractions']);router[_0xf613('0x5d')](_0xf613('0x62'),auth[_0xf613('0xa')](),controller[_0xf613('0x63')]);router['delete'](_0xf613('0x4f'),auth[_0xf613('0xa')](),controller[_0xf613('0x64')]);router[_0xf613('0x5d')](_0xf613('0x51'),auth['isAuthenticated'](),controller[_0xf613('0x65')]);router[_0xf613('0x5d')]('/:id/fax_accounts',auth[_0xf613('0xa')](),controller[_0xf613('0x66')]);router[_0xf613('0x5d')]('/:id/mail_accounts',auth[_0xf613('0xa')](),controller[_0xf613('0x67')]);router['delete']('/:id/openchannel_accounts',auth[_0xf613('0xa')](),controller[_0xf613('0x68')]);router[_0xf613('0x5d')]('/:id/sms_accounts',auth[_0xf613('0xa')](),controller[_0xf613('0x69')]);router[_0xf613('0x5d')]('/:id/chat_websites',auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0xf613('0x5d')]('/:id/whatsapp_accounts',auth[_0xf613('0xa')](),controller[_0xf613('0x6a')]);router[_0xf613('0x5d')](_0xf613('0x2c'),auth[_0xf613('0xa')](),controller[_0xf613('0x6b')]);router['delete'](_0xf613('0x30'),auth[_0xf613('0xa')](),controller[_0xf613('0x6c')]);module[_0xf613('0x6d')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index fe4ee03..a174081 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 _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 +var _0x42a6=['getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','originate','uac','uas','fingerprint','active','passive','actpass','update,nonat','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','util','lodash','exports','STRING','name','The\x20name\x20of\x20the\x20user','setDataValue','callerid','format','\x22%s\x22\x20<%s>'];(function(_0x31e6c3,_0x321c08){var _0xa6eb9f=function(_0x23d8c6){while(--_0x23d8c6){_0x31e6c3['push'](_0x31e6c3['shift']());}};_0xa6eb9f(++_0x321c08);}(_0x42a6,0x149));var _0x642a=function(_0x26b9cb,_0x12bc4c){_0x26b9cb=_0x26b9cb-0x0;var _0x3f44e6=_0x42a6[_0x26b9cb];return _0x3f44e6;};'use strict';var Sequelize=require(_0x642a('0x0'));var moment=require('moment');var util=require(_0x642a('0x1'));var _=require(_0x642a('0x2'));module[_0x642a('0x3')]={'name':{'type':Sequelize[_0x642a('0x4')],'allowNull':![],'unique':_0x642a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x192970){this['setDataValue']('name',_0x192970);this['setDataValue']('defaultuser',_0x192970);},'comment':_0x642a('0x6')},'fullname':{'type':Sequelize[_0x642a('0x4')],'allowNull':![],'set':function(_0x5774fd){this['setDataValue']('fullname',_0x5774fd);this[_0x642a('0x7')](_0x642a('0x8'),util[_0x642a('0x9')](_0x642a('0xa'),_0x5774fd,this[_0x642a('0xb')](_0x642a('0xc'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x642a('0xd'),'validate':{'isEmail':!![]},'set':function(_0xb3f73d){if(_0xb3f73d){this['setDataValue'](_0x642a('0xd'),_0xb3f73d[_0x642a('0xe')]());}}},'role':{'type':Sequelize[_0x642a('0xf')]('admin',_0x642a('0x10'),_0x642a('0x11'),_0x642a('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x642a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x642a('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x642a('0xc'),'set':function(_0x5b4ef2){this[_0x642a('0x7')](_0x642a('0xc'),_0x5b4ef2);this['setDataValue'](_0x642a('0x13'),_0x5b4ef2);this[_0x642a('0x7')](_0x642a('0x8'),util[_0x642a('0x9')](_0x642a('0xa'),this[_0x642a('0xb')](_0x642a('0x14')),_0x5b4ef2));}},'salt':{'type':Sequelize[_0x642a('0x4')]},'phone':{'type':Sequelize[_0x642a('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x642a('0x4')]},'zipcode':{'type':Sequelize[_0x642a('0x4')]},'userpic':{'type':Sequelize[_0x642a('0x4')]},'city':{'type':Sequelize[_0x642a('0x4')]},'country':{'type':Sequelize[_0x642a('0x4')]},'online':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x642a('0x16')]},'voicePause':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x642a('0x4')],'defaultValue':_0x642a('0x17')},'lastPauseAt':{'type':Sequelize[_0x642a('0x16')]},'chatCapacity':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x642a('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x642a('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x642a('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0x642a('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x19'),'user',_0x642a('0x1a')),'allowNull':!![],'defaultValue':_0x642a('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x1b'),'ALLOWED_PASSED_SCREEN',_0x642a('0x1c'),'ALLOWED',_0x642a('0x1d'),'PROHIB_PASSED_SCREEN',_0x642a('0x1e'),_0x642a('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x14e79e){this[_0x642a('0x7')](_0x642a('0x20'),_0x14e79e?_0x14e79e[_0x642a('0x21')](','):null);},'get':function(){return this['getDataValue'](_0x642a('0x20'))?this['getDataValue'](_0x642a('0x20'))[_0x642a('0x22')](','):null;},'comment':_0x642a('0x23')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x642a('0x24'),_0x642a('0x25'),_0x642a('0x26'),_0x642a('0x27')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no',_0x642a('0x29'),'update',_0x642a('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x642a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![],'defaultValue':_0x642a('0x2b'),'set':function(_0x19d6f2){this['setDataValue'](_0x642a('0x2c'),_0x19d6f2?_0x19d6f2['join'](','):null);},'get':function(){return this[_0x642a('0xb')](_0x642a('0x2c'))?this[_0x642a('0xb')](_0x642a('0x2c'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x642a('0x4')]},'namedcallgroup':{'type':Sequelize[_0x642a('0x4')]},'pickupgroup':{'type':Sequelize[_0x642a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0x642a('0x4')]},'language':{'type':Sequelize[_0x642a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x642a('0x4')]},'disallow':{'type':Sequelize[_0x642a('0x4')],'allowNull':![],'defaultValue':_0x642a('0x2d')},'allow':{'type':Sequelize[_0x642a('0x4')],'allowNull':![],'defaultValue':_0x642a('0x2e'),'set':function(_0x31a398){this[_0x642a('0x7')](_0x642a('0x2f'),_0x31a398?_0x31a398[_0x642a('0x21')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x642a('0xb')]('allow')?this[_0x642a('0xb')](_0x642a('0x2f'))[_0x642a('0x22')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x642a('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![],'set':function(_0x29acb7){this[_0x642a('0x7')](_0x642a('0x30'),_0x29acb7?_0x29acb7[_0x642a('0x21')](','):null);},'get':function(){return this[_0x642a('0xb')](_0x642a('0x30'))?this['getDataValue'](_0x642a('0x30'))[_0x642a('0x22')](','):null;},'comment':_0x642a('0x31')},'trustrpid':{'type':Sequelize['ENUM'](_0x642a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x642a('0xf')]('yes','no',_0x642a('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x642a('0xf')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x642a('0x28')},'busylevel':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x642a('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no',_0x642a('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x642a('0x34'),'refuse',_0x642a('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x36'),_0x642a('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![],'defaultValue':_0x642a('0x28')},'keepalive':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x642a('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x642a('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no',_0x642a('0x38'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x642a('0x39'),_0x642a('0x3a'),_0x642a('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x642a('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x642a('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x642a('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x642a('0x28'),'no',_0x642a('0x29'),'update',_0x642a('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x642a('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0x642a('0x16')]},'passwordResetAt':{'type':Sequelize[_0x642a('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x642a('0x4')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x2b224d){this['setDataValue']('showWebBar',_0x2b224d);var _0x1e2610=this[_0x642a('0x3d')]({'plain':!![]});switch(_0x2b224d){case 0x0:case 0x1:var _0x59edc3=_0x1e2610[_0x642a('0x20')]?_[_0x642a('0x3e')](_0x1e2610[_0x642a('0x20')])?_0x1e2610[_0x642a('0x20')][_0x642a('0x21')]():_0x1e2610[_0x642a('0x20')]:_0x642a('0x3f');if(_0x59edc3===_0x642a('0x40')){_0x59edc3=_0x642a('0x3f');}this[_0x642a('0x7')](_0x642a('0x20'),_0x59edc3);this[_0x642a('0x7')](_0x642a('0x41'),'no');this[_0x642a('0x7')](_0x642a('0x42'),null);this[_0x642a('0x7')](_0x642a('0x43'),null);this['setDataValue'](_0x642a('0x44'),null);this[_0x642a('0x7')](_0x642a('0x45'),null);this[_0x642a('0x7')](_0x642a('0x46'),null);this[_0x642a('0x7')](_0x642a('0x47'),null);this[_0x642a('0x7')](_0x642a('0x48'),null);this[_0x642a('0x7')](_0x642a('0x49'),null);this[_0x642a('0x7')]('rtcp_mux','no');break;case 0x2:this[_0x642a('0x7')](_0x642a('0x20'),_0x642a('0x40'));this['setDataValue'](_0x642a('0x41'),_0x642a('0x28'));this[_0x642a('0x7')](_0x642a('0x42'),_0x642a('0x28'));this[_0x642a('0x7')]('force_avp',_0x642a('0x28'));this[_0x642a('0x7')]('icesupport',_0x642a('0x28'));this['setDataValue'](_0x642a('0x45'),_0x642a('0x28'));this['setDataValue']('dtlsverify','no');this[_0x642a('0x7')](_0x642a('0x47'),_0x642a('0x3b'));this[_0x642a('0x7')](_0x642a('0x48'),_0x1e2610[_0x642a('0x48')]||_0x642a('0x4a'));this[_0x642a('0x7')](_0x642a('0x49'),_0x1e2610[_0x642a('0x49')]||'/etc/pki/tls/private/motion.key');this[_0x642a('0x7')]('rtcp_mux','yes');break;default:}}},'permissions':{'type':Sequelize[_0x642a('0x4b')],'set':function(_0x2e2ce1){this[_0x642a('0x7')](_0x642a('0x4c'),_0x2e2ce1?_0x2e2ce1[_0x642a('0x21')](','):[]);},'get':function(){return this[_0x642a('0xb')]('permissions')?_[_0x642a('0x4d')](this[_0x642a('0xb')]('permissions')[_0x642a('0x22')](','),function(_0x11cdf5){return parseInt(_0x11cdf5,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x642a('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x642a('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x642a('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x642a('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x642a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x642a('0xf')](_0x642a('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x642a('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x642a('0x4e')],'get':function(){return this[_0x642a('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x642a('0xb')](_0x642a('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x642a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x642a('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1ca4c9){if(typeof _0x1ca4c9===_0x642a('0x50')){var _0x5ad37e=_0x1ca4c9==='1'?!![]:_0x1ca4c9==='0'?![]:_0x1ca4c9===_0x642a('0x51')?!![]:_0x1ca4c9===_0x642a('0x52')?![]:![];this[_0x642a('0x7')]('screenrecording',_0x5ad37e);}else{this[_0x642a('0x7')](_0x642a('0x53'),_0x1ca4c9);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x10dd8c){this[_0x642a('0x7')]('blocked',_0x10dd8c);if(_0x10dd8c===!![]){this[_0x642a('0x7')](_0x642a('0x54'),moment());this[_0x642a('0x7')]('loginAttempts',0x0);}else{this[_0x642a('0x7')](_0x642a('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x642a('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x642a('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x642a('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x642a('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 52102db..5e5e828 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 _0xab81=['Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','enforcePasswordHistory','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','emit','voice','VoiceQueue','get','format','UserVoiceQueueRt','upsert','removeQueues','channel','remove','Queue:remove','destroy','addAvatar','userpic','file','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getContacts','order','hasOwnProperty','CmList','List','Tag','Tags','color','tag','Queue','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','isMiddleware','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','chat','fax','sms','Pause','getTeams','addTeams','Team','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','Openchannel','flatten','addAgent','getDataValue','Queue:save','removeTeams','transaction','removeAgent','getLists','getAgents','send','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','spread','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','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','SquareProject','getSquareProjects','addSquareProjects','removeSquareProjects','CmHopper','$and','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','firstName','lastName','CmContact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','API\x20key\x20not\x20available','whoami','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','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','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','User,\x20%s,\x20%s','message','result','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','then','admin','Users','user','agent','Telephones','telephone','filter','ignore','map','value','role','find','name','UserProfileResource','stack','index','User','rawAttributes','fieldName','type','key','password','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','includeAll','include','findAll','rows','catch','show','params','differenceBy','salt','options','update','body','describe','addContacts','omit','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','min_internal','SELECT','from','isNil','mailbox','VoiceMail','email','permissions','101','103','113','110','104','105','106','107','108','109','100','111','114','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','create','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','push','all','each','compact','includes','changePassword','oldPassword','newPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xab81,0xde));var _0x1ab8=function(_0x13624e,_0x22d684){_0x13624e=_0x13624e-0x0;var _0x2b9562=_0xab81[_0x13624e];return _0x2b9562;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1ab8('0x0'));var rimraf=require(_0x1ab8('0x1'));var zipdir=require(_0x1ab8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ab8('0x3'));var moment=require('moment');var BPromise=require(_0x1ab8('0x4'));var Mustache=require(_0x1ab8('0x5'));var util=require(_0x1ab8('0x6'));var path=require(_0x1ab8('0x7'));var sox=require(_0x1ab8('0x8'));var csv=require('to-csv');var ejs=require(_0x1ab8('0x9'));var fs=require('fs');var _=require(_0x1ab8('0xa'));var squel=require('squel');var crypto=require(_0x1ab8('0xb'));var jsforce=require(_0x1ab8('0xc'));var deskjs=require(_0x1ab8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1ab8('0xe'));var Redis=require(_0x1ab8('0xf'));var authService=require(_0x1ab8('0x10'));var qs=require(_0x1ab8('0x11'));var as=require(_0x1ab8('0x12'));var hardwareService=require(_0x1ab8('0x13'));var logger=require(_0x1ab8('0x14'))(_0x1ab8('0x15'));var utils=require(_0x1ab8('0x16'));var config=require(_0x1ab8('0x17'));var licenseUtil=require(_0x1ab8('0x18'));var db=require(_0x1ab8('0x19'))['db'];config[_0x1ab8('0x1a')]=_[_0x1ab8('0x1b')](config[_0x1ab8('0x1a')],{'host':_0x1ab8('0x1c'),'port':0x18eb});var socket=require(_0x1ab8('0x1d'))(new Redis(config[_0x1ab8('0x1a')]));require(_0x1ab8('0x1e'))[_0x1ab8('0x1f')](socket);var jayson=require(_0x1ab8('0x20'));var client=jayson[_0x1ab8('0x21')][_0x1ab8('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x47d455,_0x57b486,_0x426a25,_0x32f8a4){return new BPromise(function(_0x2b0369,_0x338b1a){var _0x5f25d3=_0x32f8a4||client;return _0x5f25d3[_0x1ab8('0x23')](_0x47d455,_0x426a25)['then'](function(_0x29c0c9){logger[_0x1ab8('0x24')]('User,\x20%s,\x20%s',_0x57b486,_0x1ab8('0x25'));logger[_0x1ab8('0x26')](_0x1ab8('0x27'),_0x57b486,_0x1ab8('0x25'),JSON[_0x1ab8('0x28')](_0x29c0c9));if(_0x29c0c9[_0x1ab8('0x29')]){if(_0x29c0c9['error'][_0x1ab8('0x2a')]===0x1f4){logger[_0x1ab8('0x29')](_0x1ab8('0x2b'),_0x57b486,_0x29c0c9['error']['message']);return _0x338b1a(_0x29c0c9[_0x1ab8('0x29')][_0x1ab8('0x2c')]);}logger['error']('User,\x20%s,\x20%s',_0x57b486,_0x29c0c9[_0x1ab8('0x29')][_0x1ab8('0x2c')]);return _0x2b0369(_0x29c0c9['error'][_0x1ab8('0x2c')]);}else{logger[_0x1ab8('0x24')]('User,\x20%s,\x20%s',_0x57b486,_0x1ab8('0x25'));_0x2b0369(_0x29c0c9[_0x1ab8('0x2d')][_0x1ab8('0x2c')]);}})['catch'](function(_0xdf3b5e){logger[_0x1ab8('0x29')]('User,\x20%s,\x20%s',_0x57b486,_0xdf3b5e);_0x338b1a(_0xdf3b5e);});});}function respondWithStatusCode(_0x5de2a4,_0x385277){_0x385277=_0x385277||0xcc;return function(_0x36fecc){if(_0x36fecc){return _0x5de2a4[_0x1ab8('0x2e')](_0x385277);}return _0x5de2a4['status'](_0x385277)['end']();};}function respondWithResult(_0x2b5aaa,_0x526d2e){_0x526d2e=_0x526d2e||0xc8;return function(_0x9a4e9e){if(_0x9a4e9e){return _0x2b5aaa[_0x1ab8('0x2f')](_0x526d2e)[_0x1ab8('0x30')](_0x9a4e9e);}};}function respondWithFilteredResult(_0x2d327d,_0x4af94c){return function(_0x394719){if(_0x394719){var _0x1ec179=_0x394719[_0x1ab8('0x31')],_0x225357=_0x4af94c[_0x1ab8('0x32')],_0x1a9e74=_0x4af94c[_0x1ab8('0x32')]+_0x4af94c[_0x1ab8('0x33')],_0x18b3a7;if(_0x1a9e74>=_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')]=_0x2e45fa){_0x90096f=_0x2e45fa;_0x83e71e=0xc8;}else{_0x83e71e=0xce;}_0x319f41[_0x1b41('0x26')](_0x83e71e);return _0x319f41[_0x1b41('0x2a')]('Content-Range',_0x5db154+'-'+_0x90096f+'/'+_0x2e45fa)[_0x1b41('0x27')](_0x2f8643);}return null;};}function patchUpdates(_0x5ba3ab){return function(_0x4fcfd8){try{jsonpatch[_0x1b41('0x2b')](_0x4fcfd8,_0x5ba3ab,!![]);}catch(_0x1ea40f){return BPromise['reject'](_0x1ea40f);}return _0x4fcfd8[_0x1b41('0x2c')]();};}function saveUpdates(_0x17491d,_0x1d9753){return function(_0x582c76){if(_0x582c76){return _0x582c76[_0x1b41('0x2d')](_0x17491d)[_0x1b41('0x1d')](function(_0x7748cf){return _0x7748cf;});}return null;};}function removeEntity(_0x3f7140,_0x4f1b62){return function(_0x59d1f6){if(_0x59d1f6){return _0x59d1f6['destroy']()[_0x1b41('0x1d')](function(){var _0x20309f=_0x59d1f6[_0x1b41('0x2e')]({'plain':!![]});if(_0x20309f['role']==='admin')return;var _0x1d3361=[{'name':_0x1b41('0x2f'),'value':_0x1b41('0x30'),'ignore':!![]},{'name':_0x1b41('0x31'),'value':_0x1b41('0x32'),'ignore':![]},{'name':_0x1b41('0x33'),'value':_0x1b41('0x34'),'ignore':![]}];var _0x1c2322=_(_0x1d3361)[_0x1b41('0x35')](_0x1b41('0x36'))['map'](_0x1b41('0x37'))[_0x1b41('0x37')]();if(_[_0x1b41('0x38')](_0x1c2322,_0x20309f[_0x1b41('0x39')])){return;}var _0x551a1a=_[_0x1b41('0x3a')](_0x1d3361,[_0x1b41('0x37'),_0x20309f[_0x1b41('0x39')]])[_0x1b41('0x3b')];return db[_0x1b41('0x3c')][_0x1b41('0x3d')]({'where':{'type':_0x551a1a,'resourceId':_0x20309f['id']}})['then'](function(){return _0x59d1f6;});})[_0x1b41('0x1d')](function(){_0x3f7140[_0x1b41('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x521c1f,_0x56c716){return function(_0x1e548b){if(!_0x1e548b){_0x521c1f[_0x1b41('0x25')](0x194);}return _0x1e548b;};}function handleError(_0x28614e,_0x9e6758){_0x9e6758=_0x9e6758||0x1f4;return function(_0x3646ac){logger[_0x1b41('0x21')](_0x3646ac[_0x1b41('0x3e')]);if(_0x3646ac[_0x1b41('0x3b')]){delete _0x3646ac[_0x1b41('0x3b')];}_0x28614e[_0x1b41('0x26')](_0x9e6758)[_0x1b41('0x3f')](_0x3646ac);};}exports[_0x1b41('0x40')]=function(_0x40b7bf,_0x1ed0a1){var _0x446c5e={},_0x39291c={},_0x1c7034={'count':0x0,'rows':[]};var _0x4ba21b=_[_0x1b41('0x41')](db[_0x1b41('0x42')][_0x1b41('0x43')],function(_0xe45784){return{'name':_0xe45784[_0x1b41('0x44')],'type':_0xe45784[_0x1b41('0x45')][_0x1b41('0x46')]};});_0x39291c[_0x1b41('0x47')]=_[_0x1b41('0x48')](_[_0x1b41('0x41')](_0x4ba21b,_0x1b41('0x3b')),['password',_0x1b41('0x49')]);_0x39291c[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x40b7bf[_0x1b41('0x4a')]);_0x39291c[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x39291c[_0x1b41('0x47')],_0x39291c[_0x1b41('0x4a')]);_0x446c5e[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x39291c[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x40b7bf[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x446c5e[_0x1b41('0x4e')]=_0x446c5e[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x446c5e[_0x1b41('0x4e')]:_0x39291c['model'];if(!_0x40b7bf[_0x1b41('0x4a')][_0x1b41('0x51')](_0x1b41('0x52'))){_0x446c5e[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x40b7bf[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x446c5e[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x40b7bf[_0x1b41('0x4a')][_0x1b41('0x28')]);}_0x446c5e[_0x1b41('0x53')]=qs['sort'](_0x40b7bf[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x446c5e[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x40b7bf[_0x1b41('0x4a')],_0x39291c[_0x1b41('0x4c')]),_0x4ba21b);if(_0x40b7bf['query']['filter']){_0x446c5e[_0x1b41('0x55')]=_['merge'](_0x446c5e[_0x1b41('0x55')],{'$or':_['map'](_0x4ba21b,function(_0x5df081){if(_0x5df081[_0x1b41('0x45')]!=='VIRTUAL'){return db[_0x1b41('0x57')]['where'](db['sequelize']['fn'](_0x1b41('0x58'),db[_0x1b41('0x57')][_0x1b41('0x59')](_0x5df081[_0x1b41('0x3b')])),{'$like':db[_0x1b41('0x57')]['fn'](_0x1b41('0x58'),'%'+_0x40b7bf[_0x1b41('0x4a')]['filter']+'%')});}})});}_0x446c5e=_['merge']({},_0x446c5e,_0x40b7bf[_0x1b41('0x5a')]);var _0x28ef2c={'where':_0x446c5e['where']};return db[_0x1b41('0x42')]['count'](_0x28ef2c)[_0x1b41('0x1d')](function(_0x311c37){_0x1c7034[_0x1b41('0x5b')]=_0x311c37;if(_0x40b7bf[_0x1b41('0x4a')][_0x1b41('0x5c')]){_0x446c5e[_0x1b41('0x5d')]=[{'all':!![]}];}return db[_0x1b41('0x42')][_0x1b41('0x5e')](_0x446c5e);})[_0x1b41('0x1d')](function(_0x34fdbb){_0x1c7034['rows']=_0x34fdbb;return _0x1c7034;})[_0x1b41('0x1d')](respondWithFilteredResult(_0x1ed0a1,_0x446c5e))[_0x1b41('0x5f')](handleError(_0x1ed0a1,null));};exports[_0x1b41('0x60')]=function(_0x5526ec,_0x59c1cf){var _0x43aaf6={'raw':![],'where':{'id':_0x5526ec['params']['id']}},_0x5c50d0={};_0x5c50d0[_0x1b41('0x47')]=_['differenceBy'](_['keys'](db[_0x1b41('0x42')]['rawAttributes']),['password','salt']);_0x5c50d0[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x5526ec['query']);_0x5c50d0[_0x1b41('0x4c')]=_['intersection'](_0x5c50d0['model'],_0x5c50d0[_0x1b41('0x4a')]);_0x43aaf6[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x5c50d0[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x5526ec['query'][_0x1b41('0x4f')]));_0x43aaf6['attributes']=_0x43aaf6[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x43aaf6[_0x1b41('0x4e')]:_0x5c50d0[_0x1b41('0x47')];if(_0x5526ec['query'][_0x1b41('0x5c')]){_0x43aaf6['include']=[{'all':!![]}];}_0x43aaf6=_['merge']({},_0x43aaf6,_0x5526ec[_0x1b41('0x5a')]);return db[_0x1b41('0x42')][_0x1b41('0x3a')](_0x43aaf6)[_0x1b41('0x1d')](handleEntityNotFound(_0x59c1cf,null))[_0x1b41('0x1d')](respondWithResult(_0x59c1cf,null))[_0x1b41('0x5f')](handleError(_0x59c1cf,null));};exports[_0x1b41('0x2d')]=function(_0x1d3738,_0xf5ebf){if(_0x1d3738['body']['id']){delete _0x1d3738['body']['id'];}delete _0x1d3738[_0x1b41('0x61')][_0x1b41('0x39')];return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0x1d3738[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0xf5ebf,null))[_0x1b41('0x1d')](saveUpdates(_0x1d3738[_0x1b41('0x61')],null))[_0x1b41('0x1d')](respondWithResult(_0xf5ebf,null))['catch'](handleError(_0xf5ebf,null));};exports[_0x1b41('0x63')]=function(_0x38ba7b,_0x312f0c){return db[_0x1b41('0x42')][_0x1b41('0x63')]()[_0x1b41('0x1d')](respondWithResult(_0x312f0c,null))[_0x1b41('0x5f')](handleError(_0x312f0c,null));};exports[_0x1b41('0x64')]=function(_0x5c8460,_0x5c545e,_0x441d44){return db['User']['find']({'where':{'id':_0x5c8460['params']['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x5c545e,null))[_0x1b41('0x1d')](function(_0x238f00){if(_0x238f00){return _0x238f00[_0x1b41('0x64')](_0x5c8460['body'][_0x1b41('0x65')],_[_0x1b41('0x66')](_0x5c8460[_0x1b41('0x61')],[_0x1b41('0x65'),'id'])||{});}})[_0x1b41('0x1d')](respondWithResult(_0x5c545e,null))[_0x1b41('0x5f')](handleError(_0x5c545e,null));};function validateUser(_0x48ce49){return new BPromise(function(_0x2c0464,_0x3e241d){if(_0x48ce49[_0x1b41('0x67')])return _0x2c0464(_0x48ce49);return db['Setting'][_0x1b41('0x68')](0x1)[_0x1b41('0x1d')](function(_0x3247e5){if(_0x3247e5[_0x1b41('0x69')])authService[_0x1b41('0x6a')](_0x48ce49[_0x1b41('0x6b')]);db[_0x1b41('0x42')][_0x1b41('0x6c')](_0x1b41('0x67'))[_0x1b41('0x1d')](function(_0x3bdec1){if(_[_0x1b41('0x6d')](_0x3bdec1)){_0x48ce49[_0x1b41('0x67')]=_0x3247e5[_0x1b41('0x6e')]||0x1;return;}if(_[_0x1b41('0x6d')](_0x3247e5['min_internal'])||_0x3247e5['min_internal']===_0x3bdec1){_0x48ce49[_0x1b41('0x67')]=_0x3bdec1+0x1;return;}if(_0x3247e5[_0x1b41('0x6e')]>_0x3bdec1){_0x48ce49[_0x1b41('0x67')]=_0x3247e5['min_internal'];return;}return db['sequelize'][_0x1b41('0x4a')](_0x1b41('0x6f'),{'type':db[_0x1b41('0x57')][_0x1b41('0x70')][_0x1b41('0x71')]})[_0x1b41('0x1d')](function(_0x20f9dc){if(_0x20f9dc&&_0x20f9dc[_0x1b41('0x50')]){for(var _0x1aea26=0x0,_0x3bdaa7=_0x20f9dc[_0x1b41('0x50')];_0x1aea26<_0x3bdaa7&&_[_0x1b41('0x6d')](_0x48ce49[_0x1b41('0x67')]);_0x1aea26++){if(_0x3247e5[_0x1b41('0x6e')]<=_0x20f9dc[_0x1aea26][_0x1b41('0x72')]){_0x48ce49[_0x1b41('0x67')]=_0x20f9dc[_0x1aea26]['from'];}else if(_0x3247e5[_0x1b41('0x6e')]>_0x20f9dc[_0x1aea26][_0x1b41('0x72')]&&_0x3247e5[_0x1b41('0x6e')]<=_0x20f9dc[_0x1aea26]['to']){_0x48ce49[_0x1b41('0x67')]=_0x3247e5[_0x1b41('0x6e')];}}}if(_[_0x1b41('0x6d')](_0x48ce49[_0x1b41('0x67')])){_0x48ce49[_0x1b41('0x67')]=_0x3bdec1+0x1;}return _0x2c0464(_0x48ce49);});});})[_0x1b41('0x5f')](function(_0x8e49ce){_0x3e241d(_0x8e49ce);});});}function updateUser(_0x96f28f){return new BPromise(function(_0x348b1a,_0x381aab){try{if(_0x96f28f[_0x1b41('0x73')]){_0x96f28f[_0x1b41('0x74')]=_0x96f28f[_0x1b41('0x67')];_0x96f28f['VoiceMail']={'mailbox':_0x96f28f[_0x1b41('0x67')],'password':_0x96f28f[_0x1b41('0x6b')],'fullname':_0x96f28f[_0x1b41('0x75')],'email':_0x96f28f[_0x1b41('0x76')]};}if(_0x96f28f[_0x1b41('0x39')]===_0x1b41('0x32')){if(!_0x96f28f['permissions'])_0x96f28f['permissions']=[_0x1b41('0x77'),_0x1b41('0x78'),_0x1b41('0x79'),_0x1b41('0x7a'),_0x1b41('0x7b'),'104',_0x1b41('0x7c'),_0x1b41('0x7d'),_0x1b41('0x7e'),_0x1b41('0x7f'),'109',_0x1b41('0x80'),_0x1b41('0x81'),'114'];}_0x348b1a(_0x96f28f);}catch(_0x38b830){_0x381aab(_0x38b830);}});}exports[_0x1b41('0x82')]=function(_0xc80a04,_0x58cfa9){if(_0xc80a04['user'][_0x1b41('0x39')]==='agent')throw new Error('Unauthorized');if(_0xc80a04['body']['role']===_0x1b41('0x30')&&_0xc80a04[_0x1b41('0x30')]['role']!==_0x1b41('0x83')){throw new Error(_0x1b41('0x84'));}if(_0xc80a04[_0x1b41('0x61')]['role']===_0x1b41('0x83')&&_0xc80a04[_0x1b41('0x30')][_0x1b41('0x39')]!==_0x1b41('0x83')){throw new Error(_0x1b41('0x85'));}return licenseUtil['checkUserLimits']([_0xc80a04[_0x1b41('0x61')]])[_0x1b41('0x1d')](function(){return validateUser(_0xc80a04[_0x1b41('0x61')]);})[_0x1b41('0x1d')](function(_0x1fe780){return updateUser(_0x1fe780)[_0x1b41('0x1d')](function(_0x456ae6){if(_0x456ae6[_0x1b41('0x39')]===_0x1b41('0x83')){_0x456ae6[_0x1b41('0x86')]=_0xc80a04[_0x1b41('0x30')]['settingsEnabled'];delete _0x456ae6[_0x1b41('0x87')];}return _0x456ae6;});})[_0x1b41('0x1d')](function(_0x5d17e7){return db[_0x1b41('0x42')][_0x1b41('0x82')](_0x5d17e7,{'include':[{'model':db[_0x1b41('0x88')],'as':_0x1b41('0x88')}]});})['then'](function(_0x599412){if(_0xc80a04['body'][_0x1b41('0x39')]===_0x1b41('0x30'))return _0x599412;if(_0xc80a04[_0x1b41('0x30')][_0x1b41('0x39')]!==_0x1b41('0x30'))return _0x599412;return db[_0x1b41('0x89')][_0x1b41('0x3a')]({'where':{'name':_0x599412[_0x1b41('0x39')]===_0x1b41('0x32')?_0x1b41('0x31'):_0x1b41('0x33'),'userProfileId':_0xc80a04[_0x1b41('0x30')][_0x1b41('0x87')]},'raw':!![]})[_0x1b41('0x1d')](function(_0xb14199){if(!_0xb14199||_0xb14199[_0x1b41('0x8a')]!=0x0)return _0x599412;return db[_0x1b41('0x3c')]['create']({'name':_0x599412['name'],'resourceId':_0x599412['id'],'type':_0xb14199[_0x1b41('0x3b')],'sectionId':_0xb14199['id']},{})[_0x1b41('0x1d')](function(){return _0x599412;});})[_0x1b41('0x5f')](function(_0x4890ee){logger[_0x1b41('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4890ee);throw _0x4890ee;});})[_0x1b41('0x1d')](respondWithResult(_0x58cfa9,0xc9))[_0x1b41('0x5f')](handleError(_0x58cfa9,null));};exports[_0x1b41('0x8b')]=function(_0x49c1c9,_0x3acc7a){var _0x535f79=_0x49c1c9[_0x1b41('0x61')];var _0x55d5ec=[];if(_0x49c1c9[_0x1b41('0x30')][_0x1b41('0x39')]===_0x1b41('0x32'))throw new Error(_0x1b41('0x8c'));if(_['some'](_0x535f79,[_0x1b41('0x39'),_0x1b41('0x30')])&&_0x49c1c9[_0x1b41('0x30')][_0x1b41('0x39')]!==_0x1b41('0x83')){throw new Error(_0x1b41('0x84'));}if(_[_0x1b41('0x8d')](_0x535f79,[_0x1b41('0x39'),'admin'])&&_0x49c1c9[_0x1b41('0x30')][_0x1b41('0x39')]!==_0x1b41('0x83')){throw new Error(_0x1b41('0x8e'));}return licenseUtil[_0x1b41('0x8f')](_0x535f79)['then'](function(){return validateUser(_0x535f79[0x0]);})[_0x1b41('0x1d')](function(){for(var _0x19232d=0x1;_0x19232d<_0x535f79[_0x1b41('0x50')];_0x19232d++){var _0x8f7618=_0x535f79[_0x19232d-0x1][_0x1b41('0x67')];if(!_0x535f79[_0x19232d][_0x1b41('0x67')])_0x535f79[_0x19232d][_0x1b41('0x67')]=_0x8f7618+0x1;_0x55d5ec[_0x1b41('0x90')](validateUser(_0x535f79[_0x19232d]));}return BPromise['all'](_0x55d5ec);})[_0x1b41('0x1d')](function(){_0x55d5ec=[];for(var _0x1b52bc=0x0;_0x1b52bc<_0x535f79[_0x1b41('0x50')];_0x1b52bc++){_0x55d5ec[_0x1b41('0x90')](updateUser(_0x535f79[_0x1b52bc]));}return BPromise[_0x1b41('0x91')](_0x55d5ec);})['then'](function(){return BPromise[_0x1b41('0x92')](_0x535f79,function(_0x5fcf35){return db[_0x1b41('0x42')]['create'](_0x5fcf35,{'include':[{'model':db[_0x1b41('0x88')],'as':'VoiceMail'}]})[_0x1b41('0x1d')](function(_0x317f48){_0x5fcf35['id']=_0x317f48['id'];return _0x5fcf35;});});})[_0x1b41('0x1d')](function(_0x5a402f){if(_0x49c1c9[_0x1b41('0x61')][_0x1b41('0x39')]===_0x1b41('0x30'))return _0x5a402f;if(_0x49c1c9[_0x1b41('0x30')][_0x1b41('0x39')]!==_0x1b41('0x30'))return _0x5a402f;var _0x5e1183=_[_0x1b41('0x8d')](_0x5a402f,function(_0xeae957){return _0xeae957[_0x1b41('0x39')]===_0x1b41('0x32')||_0xeae957[_0x1b41('0x39')]===_0x1b41('0x34');});if(!_0x5e1183)return _0x5a402f;return db[_0x1b41('0x89')][_0x1b41('0x5e')]({'where':{'name':{'$or':[_0x1b41('0x31'),_0x1b41('0x33')]},'userProfileId':_0x49c1c9[_0x1b41('0x30')][_0x1b41('0x87')]},'raw':!![]})[_0x1b41('0x1d')](function(_0x29b5d3){if(_['isEmpty'](_0x29b5d3)||!_['some'](_0x29b5d3,[_0x1b41('0x8a'),0x0]))return _0x5a402f;_0x55d5ec=[];var _0x3a4046=_(_0x29b5d3)[_0x1b41('0x41')](function(_0x20ae7e){if(_0x20ae7e[_0x1b41('0x8a')]===0x1)return;return _0x20ae7e[_0x1b41('0x3b')]===_0x1b41('0x31')?_0x1b41('0x32'):'telephone';})['compact']()[_0x1b41('0x37')]();for(var _0x358f1b=0x0;_0x358f1b<_0x5a402f[_0x1b41('0x50')];_0x358f1b++){if(!_['includes'](_0x3a4046,_0x5a402f[_0x358f1b][_0x1b41('0x39')]))return;var _0x3cdf34=_0x5a402f[_0x358f1b][_0x1b41('0x39')]===_0x1b41('0x32')?_0x1b41('0x31'):_0x1b41('0x33');_0x55d5ec[_0x1b41('0x90')](db[_0x1b41('0x3c')][_0x1b41('0x82')]({'name':_0x5a402f[_0x358f1b][_0x1b41('0x3b')],'resourceId':_0x5a402f[_0x358f1b]['id'],'type':_0x3cdf34,'sectionId':_[_0x1b41('0x3a')](_0x29b5d3,[_0x1b41('0x3b'),_0x3cdf34])['id']},{}));}return BPromise[_0x1b41('0x91')](_0x55d5ec);})[_0x1b41('0x1d')](respondWithResult(_0x3acc7a,0xc9))['catch'](handleError(_0x3acc7a,null));});};exports['changePassword']=function(_0x1cc900,_0x23af5d,_0x16f682){if(_0x1cc900[_0x1b41('0x61')]['id']){delete _0x1cc900[_0x1b41('0x61')]['id'];}return db[_0x1b41('0x42')]['find']({'where':{'id':_0x1cc900[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](function(_0x26a1ba){if(!_0x26a1ba)return null;if(_0x26a1ba['id']===_0x1cc900['user']['id']){if(!_0x1cc900['body']['oldPassword']||!_0x1cc900[_0x1b41('0x61')][_0x1b41('0x93')]){throw new db[(_0x1b41('0x94'))]['ValidationError'](_0x1b41('0x95'));}if(!_0x26a1ba[_0x1b41('0x96')](_0x1cc900[_0x1b41('0x61')]['oldPassword'])){throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0x98'));}if(_0x1cc900[_0x1b41('0x61')][_0x1b41('0x99')]===_0x1cc900[_0x1b41('0x61')][_0x1b41('0x93')]){throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0x9a'));}}else if(_0x1cc900[_0x1b41('0x30')][_0x1b41('0x39')]===_0x1b41('0x83')){if(!_0x1cc900['body'][_0x1b41('0x93')]){throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0x9b'));}}else if(_0x1cc900[_0x1b41('0x30')][_0x1b41('0x39')]===_0x1b41('0x30')){if(!_0x1cc900[_0x1b41('0x61')][_0x1b41('0x93')]){throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0x9b'));}if(_0x26a1ba[_0x1b41('0x39')]!==_0x1b41('0x32')){throw new db['Sequelize']['ValidationError'](_0x1b41('0x8c'));}}else{throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0x8c'));}return _0x26a1ba;})['then'](handleEntityNotFound(_0x23af5d,null))[_0x1b41('0x1d')](function(_0x1c48ee){return db[_0x1b41('0x9c')][_0x1b41('0x9d')]({'attributes':['id',_0x1b41('0x69'),_0x1b41('0x9e'),_0x1b41('0x9f')]})[_0x1b41('0x1d')](function(_0x4c7e68){if(_0x4c7e68[_0x1b41('0x69')])authService[_0x1b41('0x6a')](_0x1cc900[_0x1b41('0x61')][_0x1b41('0x93')]);if(!_0x4c7e68[_0x1b41('0x9e')]||!_0x1c48ee[_0x1b41('0xa0')])return _0x1c48ee;authService[_0x1b41('0xa1')](_0x1cc900['body'][_0x1b41('0x93')],_0x1c48ee[_0x1b41('0xa0')],_0x4c7e68[_0x1b41('0x9f')]);return _0x1c48ee;})[_0x1b41('0x1d')](saveUpdates({'password':_0x1cc900[_0x1b41('0x61')][_0x1b41('0x93')],'passwordResetAt':_0x1cc900[_0x1b41('0x30')]['id']==_0x1cc900[_0x1b41('0x62')]['id']?moment():null,'previousPasswords':authService[_0x1b41('0xa2')](_0x1cc900['body'][_0x1b41('0x93')],_0x1c48ee[_0x1b41('0xa0')])},null));})[_0x1b41('0x1d')](respondWithResult(_0x23af5d,null))[_0x1b41('0x5f')](handleError(_0x23af5d,null));};exports[_0x1b41('0xa3')]=function(_0x56bfaa,_0x33a50d,_0x2c4a0f){var _0x3a0aa4=_0x56bfaa[_0x1b41('0x61')][_0x1b41('0xa4')];return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0x56bfaa[_0x1b41('0x62')]['id']},'attributes':['id',_0x1b41('0x3b'),_0x1b41('0x39'),_0x1b41('0xa5'),'loginInPause',_0x1b41('0xa6'),_0x1b41('0xa7')]})[_0x1b41('0x1d')](handleEntityNotFound(_0x33a50d,null))[_0x1b41('0x1d')](function(_0x3983f4){if(_0x3983f4){if(!utils[_0x1b41('0xa8')](_0x3a0aa4)){throw new db[(_0x1b41('0x94'))]['ValidationError'](_0x1b41('0xa9'));}return _0x3983f4['add'+_[_0x1b41('0xaa')](_0x3a0aa4[_0x1b41('0xab')]())+_0x1b41('0xac')](_0x56bfaa[_0x1b41('0x61')][_0x1b41('0x65')],{'penalty':_0x56bfaa[_0x1b41('0x61')][_0x1b41('0xad')]||0x0})[_0x1b41('0xae')](function(_0x3bbf45){for(var _0x3bc9ab=0x0;_0x3bc9ab<_0x56bfaa[_0x1b41('0x61')][_0x1b41('0x65')][_0x1b41('0x50')];_0x3bc9ab+=0x1){var _0xea32b6={'UserId':_0x56bfaa[_0x1b41('0x62')]['id']};_0xea32b6[_[_0x1b41('0xaa')](_0x3a0aa4['toLowerCase']())+_0x1b41('0xaf')]=_0x56bfaa['body'][_0x1b41('0x65')][_0x3bc9ab];socket[_0x1b41('0xb0')](_0x1b41('0x30')+_['capitalize'](_0x3a0aa4[_0x1b41('0xab')]())+'Queue:save',_0xea32b6);}return _0x3bbf45;})[_0x1b41('0x1d')](function(){if(_0x3a0aa4==='voice'){return db['VoiceQueue'][_0x1b41('0x5e')]({'where':{'id':_0x56bfaa[_0x1b41('0x61')][_0x1b41('0x65')]||[]},'raw':!![],'attributes':['id',_0x1b41('0x3b')]});}})['then'](function(_0x450076){var _0x2a4398=_0x3983f4[_0x1b41('0x2e')]({'plain':!![]});var _0x24272b=[];if(_0x3a0aa4===_0x1b41('0xb1')&&_0x2a4398[_0x1b41('0x39')]===_0x1b41('0x32')&&_0x2a4398[_0x1b41('0xa5')]){for(var _0x4f6cfd=0x0;_0x4f6cfd<_0x450076[_0x1b41('0x50')];_0x4f6cfd+=0x1){_0x24272b[_0x1b41('0x90')]({'membername':_0x2a4398[_0x1b41('0x3b')],'UserId':_0x2a4398['id'],'queue_name':_0x450076[_0x4f6cfd][_0x1b41('0x3b')],'VoiceQueueId':_0x450076[_0x4f6cfd]['id'],'interface':_[_0x1b41('0x6d')](_0x2a4398['interface'])?util[_0x1b41('0xb2')](_0x1b41('0xb3'),_0x2a4398[_0x1b41('0x3b')]):_0x2a4398[_0x1b41('0xa7')],'paused':_0x2a4398[_0x1b41('0xa6')]||![],'penalty':_0x56bfaa[_0x1b41('0x61')][_0x1b41('0xad')]||0x0});}return BPromise[_0x1b41('0x92')](_0x24272b,function(_0x4db3bd){return db[_0x1b41('0xb4')][_0x1b41('0xb5')](_0x4db3bd);});}return _0x3983f4;});}})[_0x1b41('0x1d')](respondWithStatusCode(_0x33a50d,null))[_0x1b41('0x5f')](handleError(_0x33a50d,null));};exports['removeQueues']=function(_0x516eed,_0x3e2931,_0x47f553){var _0x32a841;return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0x516eed['params']['id']},'attributes':['id',_0x1b41('0x3b'),_0x1b41('0x39')]})[_0x1b41('0x1d')](handleEntityNotFound(_0x3e2931,null))[_0x1b41('0x1d')](function(_0x451830){if(_0x451830){_0x32a841=_0x451830;if(!_0x516eed[_0x1b41('0x4a')][_0x1b41('0xa4')]||!utils[_0x1b41('0xa8')](_0x516eed[_0x1b41('0x4a')][_0x1b41('0xa4')])){throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0xa9'));}return _0x451830[_0x1b41('0xb6')+_[_0x1b41('0xaa')](_0x516eed[_0x1b41('0x4a')]['channel'][_0x1b41('0xab')]())+'Queues'](_0x516eed[_0x1b41('0x4a')][_0x1b41('0x65')]);}})['then'](function(_0x1824e5){for(var _0x4f7e0b=0x0;_0x4f7e0b<_0x516eed[_0x1b41('0x4a')]['ids'][_0x1b41('0x50')];_0x4f7e0b+=0x1){var _0x2089ac={'UserId':_0x516eed[_0x1b41('0x62')]['id']};_0x2089ac[_[_0x1b41('0xaa')](_0x516eed[_0x1b41('0x4a')]['channel'][_0x1b41('0xab')]())+_0x1b41('0xaf')]=_0x516eed[_0x1b41('0x4a')][_0x1b41('0x65')][_0x4f7e0b];socket[_0x1b41('0xb0')](_0x1b41('0x30')+_[_0x1b41('0xaa')](_0x516eed[_0x1b41('0x4a')][_0x1b41('0xa4')][_0x1b41('0xab')]())+_0x1b41('0xb7'),_0x2089ac);}return _0x1824e5;})[_0x1b41('0x1d')](function(){if(_0x516eed[_0x1b41('0x4a')][_0x1b41('0xa4')]===_0x1b41('0xb1')){return db[_0x1b41('0xb4')][_0x1b41('0x3d')]({'where':{'UserId':_0x516eed[_0x1b41('0x62')]['id'],'VoiceQueueId':_0x516eed[_0x1b41('0x4a')][_0x1b41('0x65')]},'individualHooks':!![]})[_0x1b41('0x1d')](function(){return _0x32a841;});}return _0x32a841;})[_0x1b41('0x1d')](respondWithStatusCode(_0x3e2931,null))[_0x1b41('0x5f')](handleError(_0x3e2931,null));};exports[_0x1b41('0xb8')]=function(_0x1cefaf,_0x411885,_0x5db2e1){_0x1cefaf[_0x1b41('0x61')]['userpic']=_0x1cefaf['file'][_0x1b41('0xb9')];return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0x1cefaf['params']['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x411885,null))['then'](saveUpdates(_0x1cefaf[_0x1b41('0x61')],null))[_0x1b41('0x1d')](respondWithResult(_0x411885,null))[_0x1b41('0x5f')](handleError(_0x411885,null));};exports[_0x1b41('0xba')]=function(_0x1488fd,_0x41ee2a,_0x3550b7){var _0x164a84=path['join'](config['root'],_0x1b41('0xbb'));return db['User'][_0x1b41('0x3a')]({'where':{'id':_0x1488fd[_0x1b41('0x62')]['id']},'attributes':['id',_0x1b41('0xbc')],'raw':!![]})[_0x1b41('0x1d')](handleEntityNotFound(_0x41ee2a,null))[_0x1b41('0x1d')](function(_0x29e160){if(_0x29e160){if(_['isNil'](_0x29e160[_0x1b41('0xbc')])){return _0x41ee2a['download'](_0x164a84);}else{if(!fs[_0x1b41('0xbd')](path[_0x1b41('0xbe')](config[_0x1b41('0xbf')],_0x1b41('0xc0'),_0x29e160[_0x1b41('0xbc')]))){return _0x41ee2a[_0x1b41('0xc1')](_0x164a84);}return _0x41ee2a[_0x1b41('0xc1')](path[_0x1b41('0xbe')](config[_0x1b41('0xbf')],_0x1b41('0xc0'),_0x29e160['userpic']));}}})[_0x1b41('0x5f')](handleError(_0x41ee2a,null));};exports[_0x1b41('0xc2')]=function(_0x42f735,_0x3f6a9d,_0x420af2){var _0x1d8280={};var _0x1e23d4={};var _0x1e7e49;var _0x28c062;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x42f735[_0x1b41('0x62')]['id']}})['then'](handleEntityNotFound(_0x3f6a9d,null))['then'](function(_0x388767){if(_0x388767){_0x1e7e49=_0x388767;_0x1e23d4['model']=_['keys'](db['CmContact'][_0x1b41('0x43')]);_0x1e23d4['query']=_['keys'](_0x42f735[_0x1b41('0x4a')]);_0x1e23d4[_0x1b41('0x4c')]=_['intersection'](_0x1e23d4[_0x1b41('0x47')],_0x1e23d4[_0x1b41('0x4a')]);_0x1d8280[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x1e23d4['model'],qs[_0x1b41('0x4f')](_0x42f735['query']['fields']));_0x1d8280[_0x1b41('0x4e')]=_0x1d8280['attributes'][_0x1b41('0x50')]?_0x1d8280['attributes']:_0x1e23d4[_0x1b41('0x47')];_0x1d8280[_0x1b41('0x53')]=qs[_0x1b41('0x54')](_0x42f735['query'][_0x1b41('0x54')]);_0x1d8280['where']=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x42f735[_0x1b41('0x4a')],_0x1e23d4[_0x1b41('0x4c')]));if(_0x42f735[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x1d8280[_0x1b41('0x55')]=_['merge'](_0x1d8280[_0x1b41('0x55')],{'$or':_['map'](_0x1d8280[_0x1b41('0x4e')],function(_0x25ad65){var _0x5b2972={};_0x5b2972[_0x25ad65]={'$like':'%'+_0x42f735['query'][_0x1b41('0x35')]+'%'};return _0x5b2972;})});}_0x1d8280=_[_0x1b41('0xc3')]({},_0x1d8280,_0x42f735[_0x1b41('0x5a')]);return _0x1e7e49[_0x1b41('0xc2')](_0x1d8280);}})[_0x1b41('0x1d')](function(_0x25aa05){if(_0x25aa05){_0x28c062=_0x25aa05[_0x1b41('0x50')];if(_0x42f735[_0x1b41('0x4a')][_0x1b41('0x51')]('includeAll')){_0x1d8280[_0x1b41('0x5d')]=[{'model':db[_0x1b41('0xc4')],'as':_0x1b41('0xc5'),'required':![]},{'model':db[_0x1b41('0xc6')],'as':_0x1b41('0xc7'),'attributes':['id',_0x1b41('0x3b'),_0x1b41('0xc8')],'where':_0x42f735[_0x1b41('0x4a')][_0x1b41('0xc9')]?{'id':_0x42f735[_0x1b41('0x4a')][_0x1b41('0xc9')]}:undefined,'required':_0x42f735[_0x1b41('0x4a')]['tag']?!![]:![]}];}if(!_0x42f735[_0x1b41('0x4a')][_0x1b41('0x51')](_0x1b41('0x52'))){_0x1d8280['limit']=qs[_0x1b41('0x29')](_0x42f735[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x1d8280[_0x1b41('0x28')]=qs['offset'](_0x42f735['query']['offset']);}return _0x1e7e49[_0x1b41('0xc2')](_0x1d8280);}})[_0x1b41('0x1d')](function(_0x8b915f){if(_0x8b915f){return _0x8b915f?{'count':_0x28c062,'rows':_0x8b915f}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x3f6a9d,null))[_0x1b41('0x5f')](handleError(_0x3f6a9d,null));};exports[_0x1b41('0xca')]=function(_0x3ca956,_0x59e4bd,_0xe4120){var _0x3f4cf9;var _0x35cf9f;var _0x4637d5={};var _0x54ff96;return db[_0x1b41('0x42')]['findOne']({'where':{'id':_0x3ca956[_0x1b41('0x62')]['id']},'attributes':['id',_0x1b41('0x3b'),_0x1b41('0x39')]})[_0x1b41('0x1d')](handleEntityNotFound(_0x59e4bd,null))[_0x1b41('0x1d')](function(_0x9f13d8){if(!utils[_0x1b41('0xa8')](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0xa4')])){throw new db[(_0x1b41('0x94'))]['ValidationError'](_0x1b41('0xa9'));}_0x3f4cf9=_0x9f13d8;var _0x1ecca4={};_0x1ecca4[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db[_['capitalize'](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0xa4')])+_0x1b41('0xcb')][_0x1b41('0x43')]);_0x1ecca4[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x3ca956[_0x1b41('0x4a')]);_0x1ecca4[_0x1b41('0x4c')]=_['intersection'](_0x1ecca4[_0x1b41('0x47')],_0x1ecca4[_0x1b41('0x4a')]);_0x4637d5['attributes']=_[_0x1b41('0x4d')](_0x1ecca4[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x3ca956[_0x1b41('0x4a')]['fields']));_0x4637d5['attributes']=_0x4637d5['attributes']['length']?_0x4637d5['attributes']:_0x1ecca4[_0x1b41('0x47')];_0x4637d5['order']=qs['sort'](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x4637d5[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x3ca956['query'],_0x1ecca4[_0x1b41('0x4c')]));if(_0x3ca956[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x4637d5[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x4637d5[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x4637d5[_0x1b41('0x4e')],function(_0x417d4c){var _0x35b336={};_0x35b336[_0x417d4c]={'$like':'%'+_0x3ca956[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x35b336;})});}_0x4637d5=_[_0x1b41('0xc3')]({},_0x4637d5,_0x3ca956[_0x1b41('0x5a')]);switch(_0x3f4cf9['role']){case _0x1b41('0x83'):return db[_[_0x1b41('0xaa')](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0xa4')])+_0x1b41('0xcb')][_0x1b41('0x5e')](_0x4637d5);case'user':case _0x1b41('0x32'):return _0x3f4cf9['get'+_[_0x1b41('0xaa')](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0xa4')])+'Queues'](_0x4637d5);default:throw new db[(_0x1b41('0x94'))]['ValidationError'](_0x1b41('0xcc'));}})[_0x1b41('0x1d')](function(_0x59b6c0){_0x54ff96=_0x59b6c0[_0x1b41('0x50')];if(!_0x3ca956['query'][_0x1b41('0x51')](_0x1b41('0x52'))){_0x4637d5[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x3ca956['query'][_0x1b41('0x29')]);_0x4637d5[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0x28')]);}switch(_0x3f4cf9[_0x1b41('0x39')]){case _0x1b41('0x83'):return db[_[_0x1b41('0xaa')](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0xa4')])+_0x1b41('0xcb')][_0x1b41('0x5e')](_0x4637d5);case _0x1b41('0x30'):case'agent':return _0x3f4cf9['get'+_[_0x1b41('0xaa')](_0x3ca956[_0x1b41('0x4a')][_0x1b41('0xa4')])+_0x1b41('0xac')](_0x4637d5);}})[_0x1b41('0x1d')](function(_0x15ab82){return{'count':_0x54ff96,'rows':_0x15ab82};})['then'](respondWithResult(_0x59e4bd,null))[_0x1b41('0x5f')](handleError(_0x59e4bd,null));};exports['getVoiceQueuesRt']=function(_0x4f1c33,_0x4f9f0c,_0x13dffd){var _0xbfbb39={};var _0x50366d={};var _0x2d85b8;var _0xabd811;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x4f1c33[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x4f9f0c,null))[_0x1b41('0x1d')](function(_0x2e01d6){if(_0x2e01d6){_0x2d85b8=_0x2e01d6;_0x50366d[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db[_0x1b41('0xb4')][_0x1b41('0x43')]);_0x50366d[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x4f1c33[_0x1b41('0x4a')]);_0x50366d[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x50366d[_0x1b41('0x47')],_0x50366d[_0x1b41('0x4a')]);_0xbfbb39[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x50366d[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x4f1c33['query'][_0x1b41('0x4f')]));_0xbfbb39['attributes']=_0xbfbb39[_0x1b41('0x4e')][_0x1b41('0x50')]?_0xbfbb39[_0x1b41('0x4e')]:_0x50366d['model'];_0xbfbb39['order']=qs[_0x1b41('0x54')](_0x4f1c33[_0x1b41('0x4a')][_0x1b41('0x54')]);_0xbfbb39['where']=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x4f1c33['query'],_0x50366d[_0x1b41('0x4c')]));if(_0x4f1c33[_0x1b41('0x4a')]['filter']){_0xbfbb39[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0xbfbb39['where'],{'$or':_['map'](_0xbfbb39[_0x1b41('0x4e')],function(_0xfcb314){var _0x2093d2={};_0x2093d2[_0xfcb314]={'$like':'%'+_0x4f1c33['query'][_0x1b41('0x35')]+'%'};return _0x2093d2;})});}_0xbfbb39=_['merge']({},_0xbfbb39,_0x4f1c33['options']);return _0x2d85b8[_0x1b41('0xcd')](_0xbfbb39);}})[_0x1b41('0x1d')](function(_0x45216b){if(_0x45216b){_0xabd811=_0x45216b[_0x1b41('0x50')];if(!_0x4f1c33[_0x1b41('0x4a')][_0x1b41('0x51')](_0x1b41('0x52'))){_0xbfbb39[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x4f1c33['query'][_0x1b41('0x29')]);_0xbfbb39[_0x1b41('0x28')]=qs['offset'](_0x4f1c33[_0x1b41('0x4a')][_0x1b41('0x28')]);}return _0x2d85b8[_0x1b41('0xcd')](_0xbfbb39);}})['then'](function(_0x12c35f){if(_0x12c35f){return _0x12c35f?{'count':_0xabd811,'rows':_0x12c35f}:null;}})['then'](respondWithResult(_0x4f9f0c,null))[_0x1b41('0x5f')](handleError(_0x4f9f0c,null));};exports[_0x1b41('0xce')]=function(_0x268bc1,_0x51b1b1,_0x11eb04){var _0x29bf61={};var _0x5c920c={};var _0x4df5cb;var _0x505572;return db['User']['findOne']({'where':{'id':_0x268bc1[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x51b1b1,null))[_0x1b41('0x1d')](function(_0x4f7424){if(_0x4f7424){_0x4df5cb=_0x4f7424;_0x5c920c['model']=_[_0x1b41('0x4b')](db[_0x1b41('0xcf')][_0x1b41('0x43')]);_0x5c920c[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x268bc1[_0x1b41('0x4a')]);_0x5c920c[_0x1b41('0x4c')]=_['intersection'](_0x5c920c[_0x1b41('0x47')],_0x5c920c[_0x1b41('0x4a')]);_0x29bf61[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x5c920c['model'],qs[_0x1b41('0x4f')](_0x268bc1[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x29bf61[_0x1b41('0x4e')]=_0x29bf61[_0x1b41('0x4e')]['length']?_0x29bf61[_0x1b41('0x4e')]:_0x5c920c['model'];_0x29bf61[_0x1b41('0x53')]=qs['sort'](_0x268bc1[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x29bf61[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_['pick'](_0x268bc1['query'],_0x5c920c[_0x1b41('0x4c')]));if(_0x268bc1['query']['filter']){_0x29bf61[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x29bf61[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x29bf61['attributes'],function(_0x1912b5){var _0x17de35={};_0x17de35[_0x1912b5]={'$like':'%'+_0x268bc1[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x17de35;})});}_0x29bf61=_[_0x1b41('0xc3')]({},_0x29bf61,_0x268bc1[_0x1b41('0x5a')]);return _0x4df5cb[_0x1b41('0xce')](_0x29bf61);}})[_0x1b41('0x1d')](function(_0x4ac6b5){if(_0x4ac6b5){_0x505572=_0x4ac6b5[_0x1b41('0x50')];if(!_0x268bc1[_0x1b41('0x4a')][_0x1b41('0x51')]('nolimit')){_0x29bf61[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x268bc1[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x29bf61[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x268bc1['query'][_0x1b41('0x28')]);}return _0x4df5cb[_0x1b41('0xce')](_0x29bf61);}})['then'](function(_0x37f409){if(_0x37f409){return _0x37f409?{'count':_0x505572,'rows':_0x37f409}:null;}})['then'](respondWithResult(_0x51b1b1,null))[_0x1b41('0x5f')](handleError(_0x51b1b1,null));};exports[_0x1b41('0xd0')]=function(_0x2364c0,_0x17e5e7,_0x1c9a05){var _0x24b9c1={'raw':!![],'where':{}};var _0x58ad3e={};var _0x412071={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x2364c0['params']['id']}})['then'](handleEntityNotFound(_0x17e5e7,null))['then'](function(_0x331984){if(_0x331984){_0x58ad3e[_0x1b41('0x47')]=_['keys'](db['VoiceRecording'][_0x1b41('0x43')]);_0x58ad3e[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x2364c0['query']);_0x58ad3e[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x58ad3e[_0x1b41('0x47')],_0x58ad3e[_0x1b41('0x4a')]);_0x24b9c1['attributes']=_[_0x1b41('0x4d')](_0x58ad3e[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x2364c0[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x24b9c1[_0x1b41('0x4e')]=_0x24b9c1[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x24b9c1[_0x1b41('0x4e')]:_0x58ad3e[_0x1b41('0x47')];if(!_0x2364c0[_0x1b41('0x4a')][_0x1b41('0x51')](_0x1b41('0x52'))){_0x24b9c1[_0x1b41('0x29')]=qs['limit'](_0x2364c0[_0x1b41('0x4a')]['limit']);_0x24b9c1[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x2364c0[_0x1b41('0x4a')][_0x1b41('0x28')]);}_0x24b9c1['order']=qs['sort'](_0x2364c0[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x24b9c1['where']=qs[_0x1b41('0x4c')](_['pick'](_0x2364c0[_0x1b41('0x4a')],_0x58ad3e[_0x1b41('0x4c')]));_0x24b9c1[_0x1b41('0x55')][_0x1b41('0xd1')]=_0x331984['id'];if(_0x2364c0[_0x1b41('0x4a')]['filter']){_0x24b9c1[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x24b9c1[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x24b9c1[_0x1b41('0x4e')],function(_0x4740ab){var _0x27148c={};_0x27148c[_0x4740ab]={'$like':'%'+_0x2364c0[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x27148c;})});}_0x24b9c1=_[_0x1b41('0xc3')]({},_0x24b9c1,_0x2364c0[_0x1b41('0x5a')]);return db[_0x1b41('0xd2')][_0x1b41('0x5b')]({'where':_0x24b9c1['where']})[_0x1b41('0x1d')](function(_0x23c9d6){_0x412071[_0x1b41('0x5b')]=_0x23c9d6;if(_0x2364c0['query'][_0x1b41('0x5c')]){_0x24b9c1[_0x1b41('0x5d')]=[{'all':!![]}];}return db[_0x1b41('0xd2')][_0x1b41('0x5e')](_0x24b9c1);})[_0x1b41('0x1d')](function(_0x1ac7cc){_0x412071['rows']=_0x1ac7cc;return _0x412071;});}})[_0x1b41('0x1d')](respondWithFilteredResult(_0x17e5e7,_0x24b9c1))['catch'](handleError(_0x17e5e7,null));};exports[_0x1b41('0xd3')]=function(_0x3056b5,_0x4b0a7f,_0x9fcf8){var _0x585cd9={'raw':!![],'where':{}};var _0x32f00a={};var _0x4575dd={'count':0x0,'rows':[]};return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x3056b5[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x4b0a7f,null))['then'](function(_0x34004d){if(_0x34004d){_0x32f00a['model']=_[_0x1b41('0x4b')](db[_0x1b41('0xd4')][_0x1b41('0x43')]);_0x32f00a[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x3056b5['query']);_0x32f00a['filters']=_[_0x1b41('0x4d')](_0x32f00a[_0x1b41('0x47')],_0x32f00a['query']);_0x585cd9[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x32f00a['model'],qs[_0x1b41('0x4f')](_0x3056b5[_0x1b41('0x4a')]['fields']));_0x585cd9[_0x1b41('0x4e')]=_0x585cd9[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x585cd9[_0x1b41('0x4e')]:_0x32f00a['model'];if(!_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x51')](_0x1b41('0x52'))){_0x585cd9[_0x1b41('0x29')]=qs['limit'](_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x585cd9[_0x1b41('0x28')]=qs['offset'](_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x28')]);}_0x585cd9['order']=qs[_0x1b41('0x54')](_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x585cd9[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x3056b5[_0x1b41('0x4a')],_0x32f00a[_0x1b41('0x4c')]));_0x585cd9[_0x1b41('0x55')]['UserId']=_0x34004d['id'];if(_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x585cd9[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x585cd9['where'],{'$or':_[_0x1b41('0x41')](_0x585cd9[_0x1b41('0x4e')],function(_0x4624bd){var _0x32eab8={};_0x32eab8[_0x4624bd]={'$like':'%'+_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x32eab8;})});}_0x585cd9=_['merge']({},_0x585cd9,_0x3056b5[_0x1b41('0x5a')]);return db[_0x1b41('0xd4')][_0x1b41('0x5b')]({'where':_0x585cd9[_0x1b41('0x55')]})[_0x1b41('0x1d')](function(_0x1bdfe3){_0x4575dd[_0x1b41('0x5b')]=_0x1bdfe3;if(_0x3056b5[_0x1b41('0x4a')][_0x1b41('0x5c')]){_0x585cd9[_0x1b41('0x5d')]=[{'all':!![]}];}return db[_0x1b41('0xd4')][_0x1b41('0x5e')](_0x585cd9);})['then'](function(_0x5dade8){_0x4575dd[_0x1b41('0xd5')]=_0x5dade8;return _0x4575dd;});}})[_0x1b41('0x1d')](respondWithFilteredResult(_0x4b0a7f,_0x585cd9))[_0x1b41('0x5f')](handleError(_0x4b0a7f,null));};exports[_0x1b41('0xd6')]=function(_0x4421b9,_0x137747,_0x12176a){var _0x51b769={};var _0x4fc359={};var _0x2a2f07;var _0x53d8ba;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x4421b9[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x137747,null))[_0x1b41('0x1d')](function(_0x55aad0){if(_0x55aad0){_0x2a2f07=_0x55aad0;_0x4fc359[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db[_0x1b41('0xd7')][_0x1b41('0x43')]);_0x4fc359[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x4421b9[_0x1b41('0x4a')]);_0x4fc359[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x4fc359[_0x1b41('0x47')],_0x4fc359[_0x1b41('0x4a')]);_0x51b769[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x4fc359[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x4421b9[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x51b769['attributes']=_0x51b769[_0x1b41('0x4e')]['length']?_0x51b769[_0x1b41('0x4e')]:_0x4fc359[_0x1b41('0x47')];_0x51b769[_0x1b41('0x53')]=qs[_0x1b41('0x54')](_0x4421b9[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x51b769[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x4421b9[_0x1b41('0x4a')],_0x4fc359[_0x1b41('0x4c')]));if(_0x4421b9[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x51b769['where']=_[_0x1b41('0xc3')](_0x51b769['where'],{'$or':_[_0x1b41('0x41')](_0x51b769[_0x1b41('0x4e')],function(_0x55f7df){var _0x4ae0e0={};_0x4ae0e0[_0x55f7df]={'$like':'%'+_0x4421b9[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x4ae0e0;})});}_0x51b769=_[_0x1b41('0xc3')]({},_0x51b769,_0x4421b9[_0x1b41('0x5a')]);return _0x2a2f07[_0x1b41('0xd6')](_0x51b769);}})[_0x1b41('0x1d')](function(_0x528ff4){if(_0x528ff4){_0x53d8ba=_0x528ff4[_0x1b41('0x50')];if(!_0x4421b9['query'][_0x1b41('0x51')](_0x1b41('0x52'))){_0x51b769[_0x1b41('0x29')]=qs['limit'](_0x4421b9[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x51b769[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x4421b9[_0x1b41('0x4a')][_0x1b41('0x28')]);}return _0x2a2f07[_0x1b41('0xd6')](_0x51b769);}})[_0x1b41('0x1d')](function(_0x5d523e){if(_0x5d523e){return _0x5d523e?{'count':_0x53d8ba,'rows':_0x5d523e}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x137747,null))[_0x1b41('0x5f')](handleError(_0x137747,null));};exports[_0x1b41('0xd8')]=function(_0x462211,_0x4f5c6d,_0x4bcee7){var _0x5ddb0c={};var _0x34b4aa={};var _0xae794b;var _0x1ffdfd;return db['User'][_0x1b41('0x9d')]({'where':{'id':_0x462211[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x4f5c6d,null))[_0x1b41('0x1d')](function(_0x46b79d){if(_0x46b79d){_0xae794b=_0x46b79d;_0x34b4aa[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db[_0x1b41('0xd9')][_0x1b41('0x43')]);_0x34b4aa[_0x1b41('0x4a')]=_['keys'](_0x462211[_0x1b41('0x4a')]);_0x34b4aa[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x34b4aa[_0x1b41('0x47')],_0x34b4aa[_0x1b41('0x4a')]);_0x5ddb0c[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x34b4aa[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x462211[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x5ddb0c[_0x1b41('0x4e')]=_0x5ddb0c[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x5ddb0c[_0x1b41('0x4e')]:_0x34b4aa[_0x1b41('0x47')];_0x5ddb0c[_0x1b41('0x53')]=qs['sort'](_0x462211['query'][_0x1b41('0x54')]);_0x5ddb0c['where']=qs['filters'](_[_0x1b41('0x56')](_0x462211['query'],_0x34b4aa['filters']));if(_0x462211[_0x1b41('0x4a')]['filter']){_0x5ddb0c[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x5ddb0c[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x5ddb0c[_0x1b41('0x4e')],function(_0x3f3c87){var _0x535870={};_0x535870[_0x3f3c87]={'$like':'%'+_0x462211[_0x1b41('0x4a')]['filter']+'%'};return _0x535870;})});}_0x5ddb0c=_['merge']({},_0x5ddb0c,_0x462211[_0x1b41('0x5a')]);return _0xae794b['getOpenchannelInteractions'](_0x5ddb0c);}})[_0x1b41('0x1d')](function(_0x35be03){if(_0x35be03){_0x1ffdfd=_0x35be03[_0x1b41('0x50')];if(!_0x462211['query'][_0x1b41('0x51')](_0x1b41('0x52'))){_0x5ddb0c[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x462211[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x5ddb0c[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x462211[_0x1b41('0x4a')][_0x1b41('0x28')]);}return _0xae794b['getOpenchannelInteractions'](_0x5ddb0c);}})['then'](function(_0x53bdce){if(_0x53bdce){return _0x53bdce?{'count':_0x1ffdfd,'rows':_0x53bdce}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x4f5c6d,null))[_0x1b41('0x5f')](handleError(_0x4f5c6d,null));};exports[_0x1b41('0xda')]=function(_0x43eb97,_0x3b5027,_0x28305d){var _0x5b98b8={'raw':!![],'where':{}};var _0x5e81a2={};var _0x4a6a51={'count':0x0,'rows':[]};return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x43eb97['params']['id']}})['then'](handleEntityNotFound(_0x3b5027,null))['then'](function(_0x2864e9){if(_0x2864e9){_0x5e81a2['model']=_[_0x1b41('0x4b')](db[_0x1b41('0xdb')][_0x1b41('0x43')]);_0x5e81a2[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x43eb97['query']);_0x5e81a2[_0x1b41('0x4c')]=_['intersection'](_0x5e81a2[_0x1b41('0x47')],_0x5e81a2[_0x1b41('0x4a')]);_0x5b98b8[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x5e81a2[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x43eb97['query'][_0x1b41('0x4f')]));_0x5b98b8['attributes']=_0x5b98b8['attributes']['length']?_0x5b98b8[_0x1b41('0x4e')]:_0x5e81a2[_0x1b41('0x47')];if(!_0x43eb97[_0x1b41('0x4a')]['hasOwnProperty']('nolimit')){_0x5b98b8[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x43eb97['query'][_0x1b41('0x29')]);_0x5b98b8[_0x1b41('0x28')]=qs['offset'](_0x43eb97[_0x1b41('0x4a')][_0x1b41('0x28')]);}_0x5b98b8[_0x1b41('0x53')]=qs[_0x1b41('0x54')](_0x43eb97[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x5b98b8[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x43eb97['query'],_0x5e81a2[_0x1b41('0x4c')]));_0x5b98b8[_0x1b41('0x55')][_0x1b41('0xd1')]=_0x2864e9['id'];if(_0x43eb97[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x5b98b8[_0x1b41('0x55')]=_['merge'](_0x5b98b8[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x5b98b8[_0x1b41('0x4e')],function(_0x3035ef){var _0x1cb910={};_0x1cb910[_0x3035ef]={'$like':'%'+_0x43eb97[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x1cb910;})});}_0x5b98b8=_[_0x1b41('0xc3')]({},_0x5b98b8,_0x43eb97[_0x1b41('0x5a')]);return db['MailInteraction']['count']({'where':_0x5b98b8[_0x1b41('0x55')]})[_0x1b41('0x1d')](function(_0x273148){_0x4a6a51[_0x1b41('0x5b')]=_0x273148;if(_0x43eb97[_0x1b41('0x4a')][_0x1b41('0x5c')]){_0x5b98b8[_0x1b41('0x5d')]=[{'all':!![]}];}return db[_0x1b41('0xdb')][_0x1b41('0x5e')](_0x5b98b8);})[_0x1b41('0x1d')](function(_0x57c2fe){_0x4a6a51[_0x1b41('0xd5')]=_0x57c2fe;return _0x4a6a51;});}})[_0x1b41('0x1d')](respondWithFilteredResult(_0x3b5027,_0x5b98b8))[_0x1b41('0x5f')](handleError(_0x3b5027,null));};exports['getSmsInteractions']=function(_0x1d0612,_0x1d9688,_0x20e8be){var _0x3c9485={};var _0x3ec17e={};var _0x4494b2;var _0x41f97e;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x1d0612['params']['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x1d9688,null))[_0x1b41('0x1d')](function(_0x229d84){if(_0x229d84){_0x4494b2=_0x229d84;_0x3ec17e[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db['SmsInteraction']['rawAttributes']);_0x3ec17e[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x1d0612['query']);_0x3ec17e[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x3ec17e['model'],_0x3ec17e['query']);_0x3c9485[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x3ec17e['model'],qs[_0x1b41('0x4f')](_0x1d0612[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x3c9485[_0x1b41('0x4e')]=_0x3c9485[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x3c9485[_0x1b41('0x4e')]:_0x3ec17e[_0x1b41('0x47')];_0x3c9485['order']=qs['sort'](_0x1d0612['query']['sort']);_0x3c9485[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x1d0612[_0x1b41('0x4a')],_0x3ec17e['filters']));if(_0x1d0612[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x3c9485['where']=_['merge'](_0x3c9485[_0x1b41('0x55')],{'$or':_['map'](_0x3c9485[_0x1b41('0x4e')],function(_0x2ef6b7){var _0x3ee5a1={};_0x3ee5a1[_0x2ef6b7]={'$like':'%'+_0x1d0612[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x3ee5a1;})});}_0x3c9485=_['merge']({},_0x3c9485,_0x1d0612[_0x1b41('0x5a')]);return _0x4494b2[_0x1b41('0xdc')](_0x3c9485);}})['then'](function(_0x28cc4b){if(_0x28cc4b){_0x41f97e=_0x28cc4b['length'];if(!_0x1d0612['query'][_0x1b41('0x51')](_0x1b41('0x52'))){_0x3c9485[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x1d0612[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x3c9485[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x1d0612[_0x1b41('0x4a')]['offset']);}return _0x4494b2['getSmsInteractions'](_0x3c9485);}})['then'](function(_0x3e8ec8){if(_0x3e8ec8){return _0x3e8ec8?{'count':_0x41f97e,'rows':_0x3e8ec8}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x1d9688,null))['catch'](handleError(_0x1d9688,null));};exports[_0x1b41('0xdd')]=function(_0x3fc104,_0x521f0b,_0x5e620c){var _0x30b679={};var _0x10d578={};var _0x4d5b53;var _0x1e9b8b;return db[_0x1b41('0x42')]['findOne']({'where':{'id':_0x3fc104[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x521f0b,null))[_0x1b41('0x1d')](function(_0x55a6fa){if(_0x55a6fa){_0x4d5b53=_0x55a6fa;_0x10d578[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db[_0x1b41('0xde')][_0x1b41('0x43')]);_0x10d578[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x3fc104[_0x1b41('0x4a')]);_0x10d578[_0x1b41('0x4c')]=_['intersection'](_0x10d578['model'],_0x10d578[_0x1b41('0x4a')]);_0x30b679['attributes']=_['intersection'](_0x10d578[_0x1b41('0x47')],qs['fields'](_0x3fc104['query']['fields']));_0x30b679[_0x1b41('0x4e')]=_0x30b679[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x30b679['attributes']:_0x10d578[_0x1b41('0x47')];_0x30b679[_0x1b41('0x53')]=qs[_0x1b41('0x54')](_0x3fc104[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x30b679[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_['pick'](_0x3fc104[_0x1b41('0x4a')],_0x10d578[_0x1b41('0x4c')]));if(_0x3fc104['query']['filter']){_0x30b679[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x30b679[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x30b679[_0x1b41('0x4e')],function(_0x2b964f){var _0x1b2fa4={};_0x1b2fa4[_0x2b964f]={'$like':'%'+_0x3fc104[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x1b2fa4;})});}_0x30b679=_[_0x1b41('0xc3')]({},_0x30b679,_0x3fc104[_0x1b41('0x5a')]);return _0x4d5b53['getFaxInteractions'](_0x30b679);}})[_0x1b41('0x1d')](function(_0x3a1dea){if(_0x3a1dea){_0x1e9b8b=_0x3a1dea[_0x1b41('0x50')];if(!_0x3fc104[_0x1b41('0x4a')][_0x1b41('0x51')](_0x1b41('0x52'))){_0x30b679[_0x1b41('0x29')]=qs['limit'](_0x3fc104[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x30b679[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x3fc104[_0x1b41('0x4a')][_0x1b41('0x28')]);}return _0x4d5b53[_0x1b41('0xdd')](_0x30b679);}})[_0x1b41('0x1d')](function(_0xdc9c27){if(_0xdc9c27){return _0xdc9c27?{'count':_0x1e9b8b,'rows':_0xdc9c27}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x521f0b,null))[_0x1b41('0x5f')](handleError(_0x521f0b,null));};exports['getWhatsappInteractions']=function(_0x3dd0d3,_0xe49c64,_0x579227){var _0x5f0d67={};var _0x2dc938={};var _0x3ba5ef;var _0x827244;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x3dd0d3[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0xe49c64,null))[_0x1b41('0x1d')](function(_0x13d2c7){if(_0x13d2c7){_0x3ba5ef=_0x13d2c7;_0x2dc938['model']=_[_0x1b41('0x4b')](db[_0x1b41('0xdf')][_0x1b41('0x43')]);_0x2dc938[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x3dd0d3['query']);_0x2dc938[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x2dc938['model'],_0x2dc938[_0x1b41('0x4a')]);_0x5f0d67[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x2dc938[_0x1b41('0x47')],qs[_0x1b41('0x4f')](_0x3dd0d3[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0x5f0d67[_0x1b41('0x4e')]=_0x5f0d67[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x5f0d67['attributes']:_0x2dc938[_0x1b41('0x47')];_0x5f0d67['order']=qs[_0x1b41('0x54')](_0x3dd0d3[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x5f0d67[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x3dd0d3['query'],_0x2dc938[_0x1b41('0x4c')]));if(_0x3dd0d3['query'][_0x1b41('0x35')]){_0x5f0d67[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0x5f0d67[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x5f0d67[_0x1b41('0x4e')],function(_0x49fb85){var _0x2581f5={};_0x2581f5[_0x49fb85]={'$like':'%'+_0x3dd0d3['query']['filter']+'%'};return _0x2581f5;})});}_0x5f0d67=_[_0x1b41('0xc3')]({},_0x5f0d67,_0x3dd0d3[_0x1b41('0x5a')]);return _0x3ba5ef[_0x1b41('0xe0')](_0x5f0d67);}})[_0x1b41('0x1d')](function(_0x3ebfe5){if(_0x3ebfe5){_0x827244=_0x3ebfe5[_0x1b41('0x50')];if(!_0x3dd0d3['query'][_0x1b41('0x51')](_0x1b41('0x52'))){_0x5f0d67[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x3dd0d3[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x5f0d67[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x3dd0d3[_0x1b41('0x4a')]['offset']);}return _0x3ba5ef['getWhatsappInteractions'](_0x5f0d67);}})[_0x1b41('0x1d')](function(_0x32a422){if(_0x32a422){return _0x32a422?{'count':_0x827244,'rows':_0x32a422}:null;}})['then'](respondWithResult(_0xe49c64,null))['catch'](handleError(_0xe49c64,null));};exports[_0x1b41('0xe1')]=function(_0x1f693f,_0x1e8fd3,_0x3cc137){var _0x242541;var _0x1183a7;var _0x2ec85b;var _0xf991fc=!_[_0x1b41('0x6d')](_0x1f693f[_0x1b41('0x62')]['id'])?_0x1f693f[_0x1b41('0x62')]['id']:!_[_0x1b41('0x6d')](_0x1f693f[_0x1b41('0x30')]['id'])?_0x1f693f['user']['id']:null;return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0xf991fc,'role':{'$or':[_0x1b41('0x83'),'user',_0x1b41('0x32')]}},'attributes':['id','name',_0x1b41('0xe2'),_0x1b41('0xe3'),_0x1b41('0x39'),'internal',_0x1b41('0xe4')]})[_0x1b41('0x1d')](function(_0x5e2c34){if(_0x5e2c34){if(_0x5e2c34[_0x1b41('0x39')]===_0x1b41('0x32')){_0x242541=_0x5e2c34;if(_0x1f693f[_0x1b41('0x61')][_0x1b41('0xa7')]){_0x2ec85b=util[_0x1b41('0xb2')]('LOCAL/%s@from-sip/n',_0x242541[_0x1f693f[_0x1b41('0x61')]['interface']]);}else if(_0x1f693f[_0x1b41('0x61')][_0x1b41('0xe5')]){_0x2ec85b=util[_0x1b41('0xb2')](_0x1b41('0xb3'),_0x1f693f[_0x1b41('0x61')][_0x1b41('0xe5')]);}else{_0x2ec85b=util[_0x1b41('0xb2')]('SIP/%s',_0x242541[_0x1b41('0x3b')]);}socket['to'](util[_0x1b41('0xb2')](_0x1b41('0xe6'),_0x242541[_0x1b41('0x3b')]))[_0x1b41('0xb0')](_0x1b41('0xe7'),{'ip':_0x1f693f['headers'][_0x1b41('0xe8')]||_0x1f693f['connection']['remoteAddress']||_0x1f693f['socket']['remoteAddress']||_0x1f693f['connection'][_0x1b41('0xe9')][_0x1b41('0xea')]});return db[_0x1b41('0xb4')][_0x1b41('0x3d')]({'where':{'membername':_0x242541[_0x1b41('0x3b')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x1b41('0x97'))](_0x1b41('0xeb'));}})[_0x1b41('0x1d')](function(){if(_0x242541){return _0x242541[_0x1b41('0xec')]({'raw':!![]});}})[_0x1b41('0x1d')](function(_0x1b479d){if(_0x242541){var _0x3f423c=[];if(_0x1b479d){_0x1183a7=_0x1b479d;if(_0x1183a7[_0x1b41('0x50')]){for(var _0x4786ff=0x0;_0x4786ff<_0x1183a7[_0x1b41('0x50')];_0x4786ff++){_0x3f423c[_0x1b41('0x90')]({'membername':_0x242541[_0x1b41('0x3b')],'UserId':_0x242541['id'],'queue_name':_0x1183a7[_0x4786ff][_0x1b41('0x3b')],'VoiceQueueId':_0x1183a7[_0x4786ff]['id'],'interface':_0x2ec85b,'paused':_0x242541[_0x1b41('0xe4')]||![],'penalty':_0x1183a7[_0x4786ff][_0x1b41('0xed')]||0x0});}return BPromise[_0x1b41('0x92')](_0x3f423c,function(_0x3c08d8){return db[_0x1b41('0xb4')][_0x1b41('0xb5')](_0x3c08d8);});}}}})['then'](function(){if(_0x242541){return db[_0x1b41('0xee')][_0x1b41('0x5e')]({'where':{'membername':_0x242541[_0x1b41('0x3b')],'exitAt':null}});}})[_0x1b41('0x1d')](function(_0x2c3c75){if(_0x242541){var _0x288dda=[];_0x2c3c75[_0x1b41('0xef')](function(_0x2f73d4){_0x288dda[_0x1b41('0x90')](_0x2f73d4[_0x1b41('0x2d')]({'exitAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0'))}));});return BPromise[_0x1b41('0x91')](_0x288dda);}})[_0x1b41('0x1d')](function(){if(_0x242541){var _0x5a613=[];var _0x28ae9b=[];var _0x12d168=utils[_0x1b41('0xf1')]();var _0x431b62={'membername':_0x242541[_0x1b41('0x3b')],'interface':_0x2ec85b,'enterAt':moment()['format'](_0x1b41('0xf0')),'role':_0x242541[_0x1b41('0x39')],'internal':_0x242541[_0x1b41('0x67')]};_0x12d168[_0x1b41('0xef')](function(_0x1edcb6){_0x5a613[_0x1b41('0x90')](_[_0x1b41('0xc3')]({'channel':_0x1edcb6,'type':_0x1b41('0xf2'),'data1':_0x1f693f[_0x1b41('0x61')]['device'],'data2':_0x2ec85b},_0x431b62));if(_0x242541['loginInPause']){_0x28ae9b[_0x1b41('0x90')](_[_0x1b41('0xc3')]({'channel':_0x1edcb6,'type':'PAUSE','data1':_0x1b41('0xf3')},_0x431b62));}});return db[_0x1b41('0xee')][_0x1b41('0x8b')](_0x5a613[_0x1b41('0xf4')](_0x28ae9b),{'individualHooks':!![]});}})[_0x1b41('0x1d')](function(){if(_0x242541){return _0x242541[_0x1b41('0x2d')]({'online':!![],'lastLoginAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0')),'voicePause':_0x242541[_0x1b41('0xe4')]||![],'mailPause':_0x242541[_0x1b41('0xe4')]||![],'chatPause':_0x242541['loginInPause']||![],'faxPause':_0x242541[_0x1b41('0xe4')]||![],'smsPause':_0x242541[_0x1b41('0xe4')]||![],'openchannelPause':_0x242541[_0x1b41('0xe4')]||![],'whatsappPause':_0x242541[_0x1b41('0xe4')]||![],'pauseType':_0x242541[_0x1b41('0xe4')]?'LOGININPAUSE':null,'interface':_0x2ec85b,'lastPauseAt':moment()[_0x1b41('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x1b41('0x1d')](function(_0x585e00){if(_0x1f693f[_0x1b41('0xf5')]){return _0x3cc137();}else{return BPromise['resolve'](_0x585e00)['then'](respondWithResult(_0x1e8fd3,null));}})[_0x1b41('0x5f')](handleError(_0x1e8fd3,null));};exports[_0x1b41('0xf6')]=function(_0xdc5e26,_0x204c22,_0x5216c7){var _0x474dad;return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0xdc5e26[_0x1b41('0x62')]['id'],'role':_0x1b41('0x32')},'attributes':['id',_0x1b41('0x3b'),_0x1b41('0x39')]})[_0x1b41('0x1d')](handleEntityNotFound(_0x204c22,null))['then'](function(_0x5ef6fd){if(_0x5ef6fd){_0x474dad=_0x5ef6fd;return db[_0x1b41('0xb4')]['destroy']({'where':{'membername':_0x474dad[_0x1b41('0x3b')]},'individualHooks':!![]});}})['then'](function(){return db[_0x1b41('0xee')][_0x1b41('0x5e')]({'where':{'membername':_0x474dad[_0x1b41('0x3b')],'exitAt':null}});})[_0x1b41('0x1d')](function(_0x347b40){var _0x33b9af=[];_0x347b40[_0x1b41('0xef')](function(_0x8779ad){_0x33b9af[_0x1b41('0x90')](_0x8779ad[_0x1b41('0x2d')]({'exitAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0'))}));});return BPromise[_0x1b41('0x91')](_0x33b9af);})[_0x1b41('0x1d')](function(){return _0x474dad[_0x1b41('0x2d')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x204c22,null))[_0x1b41('0x5f')](handleError(_0x204c22,null));};exports[_0x1b41('0xf7')]=function(_0x4a74ef,_0x59216c,_0x3af51a){var _0x48e1de;return db['UserVoiceQueueRt'][_0x1b41('0x2d')]({'paused':0x1},{'where':{'UserId':_0x4a74ef['params']['id']},'individualHooks':!![]})[_0x1b41('0x1d')](function(){return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0x4a74ef[_0x1b41('0x62')]['id'],'role':_0x1b41('0x32')},'attributes':['id',_0x1b41('0x3b'),_0x1b41('0x39'),_0x1b41('0x67'),_0x1b41('0xa7')]});})['then'](handleEntityNotFound(_0x59216c,null))[_0x1b41('0x1d')](function(_0x46c1e3){if(_0x46c1e3){_0x48e1de=_0x46c1e3;return respondWithRpcPromise('QueuePause',_0x1b41('0xf7'),{'id':_0x48e1de['id'],'name':_0x48e1de[_0x1b41('0x3b')],'pause':!![]});}})[_0x1b41('0x1d')](function(){if(_0x48e1de){return db[_0x1b41('0xee')]['findAll']({'where':{'membername':_0x48e1de['name'],'type':_0x1b41('0xf8'),'exitAt':null}});}})[_0x1b41('0x1d')](function(_0x242394){if(_0x242394['length']){var _0x1dcab2=moment()[_0x1b41('0xb2')](_0x1b41('0xf0'));for(var _0xcb678c=0x0,_0x293f16=_0x242394['length'];_0xcb678c<_0x293f16;_0xcb678c++){_0x242394[_0xcb678c]['updateAttributes']({'exitAt':_0x1dcab2});}}})[_0x1b41('0x1d')](function(){var _0x295ffa=[];var _0x5047ff=utils[_0x1b41('0xf1')]();_0x5047ff[_0x1b41('0xef')](function(_0x3dd55b){_0x295ffa[_0x1b41('0x90')]({'channel':_0x3dd55b,'membername':_0x48e1de[_0x1b41('0x3b')],'interface':_[_0x1b41('0x6d')](_0x48e1de[_0x1b41('0xa7')])?util['format'](_0x1b41('0xb3'),_0x48e1de[_0x1b41('0x3b')]):_0x48e1de[_0x1b41('0xa7')],'type':_0x1b41('0xf8'),'enterAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0')),'data1':_0x4a74ef[_0x1b41('0x61')][_0x1b41('0x45')]||'DEFAULT\x20PAUSE','role':_0x48e1de[_0x1b41('0x39')],'internal':_0x48e1de[_0x1b41('0x67')]});});return db[_0x1b41('0xee')][_0x1b41('0x8b')](_0x295ffa,{'individualHooks':!![]});})['then'](function(){return _0x48e1de[_0x1b41('0x2d')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4a74ef[_0x1b41('0x61')][_0x1b41('0x45')]||_0x1b41('0xf9'),'lastPauseAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0'))});})[_0x1b41('0x1d')](respondWithResult(_0x59216c,null))[_0x1b41('0x5f')](handleError(_0x59216c,null));};exports[_0x1b41('0xfa')]=function(_0x4276b0,_0x4ce029,_0x49ebec){var _0x1ff153;return db['User'][_0x1b41('0x3a')]({'where':{'id':_0x4276b0['params']['id']},'attributes':['id',_0x1b41('0x3b'),'role',_0x1b41('0xa6'),_0x1b41('0xfb'),'chatPause',_0x1b41('0xfc'),_0x1b41('0xfd'),'smsPause',_0x1b41('0xfe'),_0x1b41('0xff'),_0x1b41('0x100')]})[_0x1b41('0x1d')](handleEntityNotFound(_0x4ce029,null))[_0x1b41('0x1d')](function(_0x121d10){if(_0x121d10){_0x1ff153=_0x121d10;if(_0x4276b0[_0x1b41('0x61')][_0x1b41('0xa4')]&&!utils[_0x1b41('0xa8')](_0x4276b0[_0x1b41('0x61')][_0x1b41('0xa4')])){throw new db[(_0x1b41('0x94'))][(_0x1b41('0x97'))](_0x1b41('0xa9'));}switch(_0x4276b0[_0x1b41('0x61')][_0x1b41('0xa4')]){case _0x1b41('0xb1'):return respondWithRpcPromise(_0x1b41('0x101'),_0x1b41('0xfa'),{'id':_0x1ff153['id'],'name':_0x1ff153[_0x1b41('0x3b')],'pause':![]})[_0x1b41('0x1d')](function(){return db[_0x1b41('0xb4')][_0x1b41('0x2d')]({'paused':0x0},{'where':{'UserId':_0x1ff153['id']},'individualHooks':!![]});})[_0x1b41('0x1d')](function(){return db[_0x1b41('0xee')][_0x1b41('0x3a')]({'where':{'channel':_0x4276b0[_0x1b41('0x61')]['channel'],'membername':_0x1ff153[_0x1b41('0x3b')],'type':_0x1b41('0xf8'),'exitAt':null}});})['then'](function(_0x5a11c6){if(_0x5a11c6){return _0x5a11c6[_0x1b41('0x2d')]({'exitAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0')),'data2':_0x1b41('0x102')},{'individualHooks':!![]});}return null;})[_0x1b41('0x1d')](function(){return _0x1ff153[_0x1b41('0x2d')]({'voicePause':![]});});case _0x1b41('0x103'):case _0x1b41('0x104'):case _0x1b41('0x105'):case _0x1b41('0x106'):case _0x1b41('0x107'):case _0x1b41('0x108'):return db['MemberReport']['find']({'where':{'channel':_0x4276b0[_0x1b41('0x61')][_0x1b41('0xa4')],'membername':_0x1ff153[_0x1b41('0x3b')],'type':_0x1b41('0xf8'),'exitAt':null}})[_0x1b41('0x1d')](function(_0x396c26){if(_0x396c26){return _0x396c26[_0x1b41('0x2d')]({'exitAt':moment()[_0x1b41('0xb2')](_0x1b41('0xf0')),'data2':_0x1b41('0x102')},{'individualHooks':!![]});}return null;})[_0x1b41('0x1d')](function(){var _0x5c0979={};_[_0x1b41('0x2a')](_0x5c0979,util[_0x1b41('0xb2')]('%s%s',_0x4276b0[_0x1b41('0x61')]['channel'],_0x1b41('0x109')),![]);return _0x1ff153[_0x1b41('0x2d')](_0x5c0979);});default:return respondWithRpcPromise(_0x1b41('0x101'),'unpause',{'id':_0x1ff153['id'],'name':_0x1ff153[_0x1b41('0x3b')],'pause':![]})[_0x1b41('0x1d')](function(){return db[_0x1b41('0xb4')][_0x1b41('0x2d')]({'paused':0x0},{'where':{'UserId':_0x1ff153['id']}});})[_0x1b41('0x1d')](function(){return db[_0x1b41('0xee')][_0x1b41('0x5e')]({'where':{'membername':_0x1ff153[_0x1b41('0x3b')],'type':'PAUSE','exitAt':null}});})[_0x1b41('0x1d')](function(_0x2d55a5){var _0x366987=[];_0x2d55a5['forEach'](function(_0x40b111){_0x366987['push'](_0x40b111[_0x1b41('0x2d')]({'exitAt':moment()[_0x1b41('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x1b41('0x102')}));});return BPromise[_0x1b41('0x91')](_0x366987);})[_0x1b41('0x1d')](function(){return _0x1ff153['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x1b41('0x1d')](respondWithResult(_0x4ce029,null))['catch'](handleError(_0x4ce029,null));};exports['getTeams']=function(_0x5be630,_0x44e887,_0x2419ee){var _0x128427={};var _0x439977={};var _0x139693;var _0x4c073d;return db['User'][_0x1b41('0x9d')]({'where':{'id':_0x5be630[_0x1b41('0x62')]['id']}})['then'](handleEntityNotFound(_0x44e887,null))[_0x1b41('0x1d')](function(_0x51f232){if(_0x51f232){_0x139693=_0x51f232;_0x439977['model']=_['keys'](db[_0x1b41('0x10a')][_0x1b41('0x43')]);_0x439977[_0x1b41('0x4a')]=_['keys'](_0x5be630[_0x1b41('0x4a')]);_0x439977['filters']=_['intersection'](_0x439977[_0x1b41('0x47')],_0x439977[_0x1b41('0x4a')]);_0x128427[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x439977[_0x1b41('0x47')],qs['fields'](_0x5be630[_0x1b41('0x4a')]['fields']));_0x128427[_0x1b41('0x4e')]=_0x128427[_0x1b41('0x4e')][_0x1b41('0x50')]?_0x128427[_0x1b41('0x4e')]:_0x439977[_0x1b41('0x47')];_0x128427['order']=qs[_0x1b41('0x54')](_0x5be630[_0x1b41('0x4a')][_0x1b41('0x54')]);_0x128427[_0x1b41('0x55')]=qs['filters'](_[_0x1b41('0x56')](_0x5be630['query'],_0x439977[_0x1b41('0x4c')]));if(_0x5be630[_0x1b41('0x4a')][_0x1b41('0x35')]){_0x128427['where']=_[_0x1b41('0xc3')](_0x128427[_0x1b41('0x55')],{'$or':_[_0x1b41('0x41')](_0x128427[_0x1b41('0x4e')],function(_0x43584c){var _0x496164={};_0x496164[_0x43584c]={'$like':'%'+_0x5be630[_0x1b41('0x4a')][_0x1b41('0x35')]+'%'};return _0x496164;})});}_0x128427=_[_0x1b41('0xc3')]({},_0x128427,_0x5be630['options']);return _0x139693[_0x1b41('0x10b')](_0x128427);}})[_0x1b41('0x1d')](function(_0x590393){if(_0x590393){_0x4c073d=_0x590393[_0x1b41('0x50')];if(!_0x5be630['query'][_0x1b41('0x51')](_0x1b41('0x52'))){_0x128427[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x5be630[_0x1b41('0x4a')][_0x1b41('0x29')]);_0x128427[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x5be630[_0x1b41('0x4a')][_0x1b41('0x28')]);}return _0x139693['getTeams'](_0x128427);}})[_0x1b41('0x1d')](function(_0x5d9fbf){if(_0x5d9fbf){return _0x5d9fbf?{'count':_0x4c073d,'rows':_0x5d9fbf}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x44e887,null))['catch'](handleError(_0x44e887,null));};exports[_0x1b41('0x10c')]=function(_0x5e4c83,_0x5143e4){return db[_0x1b41('0x42')][_0x1b41('0x3a')]({'where':{'id':_0x5e4c83[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x5143e4,null))['then'](function(_0x43c550){if(_0x43c550){var _0x5b46ac=_0x43c550['get']({'plain':!![]});return _0x43c550[_0x1b41('0x10c')](_0x5e4c83[_0x1b41('0x61')][_0x1b41('0x65')],_['omit'](_0x5e4c83[_0x1b41('0x61')],['ids','id'])||{})[_0x1b41('0x1d')](function(){for(var _0x309fe7=0x0;_0x309fe7<_0x5e4c83['body'][_0x1b41('0x65')][_0x1b41('0x50')];_0x309fe7++){var _0x38ea7f=[];db[_0x1b41('0x10a')][_0x1b41('0x9d')]({'where':{'id':_0x5e4c83['body'][_0x1b41('0x65')][_0x309fe7]}})[_0x1b41('0x1d')](function(_0x5c2214){_0x38ea7f['push'](_0x5c2214['getVoiceQueues']()[_0x1b41('0x1d')](function(_0x443d4e){for(var _0xb641f1=0x0;_0xb641f1<_0x443d4e['length'];_0xb641f1++){_0x443d4e[_0xb641f1][_0x1b41('0x10d')](_0x1b41('0xa4'),_0x1b41('0x10e'));}return _0x443d4e;}));_0x38ea7f[_0x1b41('0x90')](_0x5c2214[_0x1b41('0x10f')]()['then'](function(_0x2e8289){for(var _0x4442ac=0x0;_0x4442ac<_0x2e8289['length'];_0x4442ac++){_0x2e8289[_0x4442ac][_0x1b41('0x10d')](_0x1b41('0xa4'),'Chat');}return _0x2e8289;}));_0x38ea7f['push'](_0x5c2214['getMailQueues']()[_0x1b41('0x1d')](function(_0x5cc3d0){for(var _0xa6457=0x0;_0xa6457<_0x5cc3d0[_0x1b41('0x50')];_0xa6457++){_0x5cc3d0[_0xa6457][_0x1b41('0x10d')]('channel',_0x1b41('0x110'));}return _0x5cc3d0;}));_0x38ea7f['push'](_0x5c2214[_0x1b41('0x111')]()[_0x1b41('0x1d')](function(_0x384aa3){for(var _0x232dd0=0x0;_0x232dd0<_0x384aa3[_0x1b41('0x50')];_0x232dd0++){_0x384aa3[_0x232dd0][_0x1b41('0x10d')]('channel',_0x1b41('0x112'));}return _0x384aa3;}));_0x38ea7f[_0x1b41('0x90')](_0x5c2214[_0x1b41('0x113')]()[_0x1b41('0x1d')](function(_0x4d5b95){for(var _0x111b5f=0x0;_0x111b5f<_0x4d5b95[_0x1b41('0x50')];_0x111b5f++){_0x4d5b95[_0x111b5f][_0x1b41('0x10d')]('channel','Whatsapp');}return _0x4d5b95;}));_0x38ea7f[_0x1b41('0x90')](_0x5c2214[_0x1b41('0x114')]()['then'](function(_0x53ecba){for(var _0x4446fe=0x0;_0x4446fe<_0x53ecba['length'];_0x4446fe++){_0x53ecba[_0x4446fe]['setDataValue'](_0x1b41('0xa4'),_0x1b41('0x115'));}return _0x53ecba;}));_0x38ea7f[_0x1b41('0x90')](_0x5c2214[_0x1b41('0x116')]()[_0x1b41('0x1d')](function(_0x255dbe){for(var _0x1a5592=0x0;_0x1a5592<_0x255dbe[_0x1b41('0x50')];_0x1a5592++){_0x255dbe[_0x1a5592][_0x1b41('0x10d')]('channel',_0x1b41('0x117'));}return _0x255dbe;}));return BPromise[_0x1b41('0x91')](_0x38ea7f);})['then'](function(_0x29dd20){var _0x1ec37f=_[_0x1b41('0x118')](_0x29dd20);_0x38ea7f=[];return db[_0x1b41('0x57')]['transaction'](function(_0x28bd77){for(var _0x4badf2=0x0;_0x4badf2<_0x1ec37f[_0x1b41('0x50')];_0x4badf2++){_0x38ea7f[_0x1b41('0x90')](_0x1ec37f[_0x4badf2]['addAgent'](_0x5b46ac['id']),{'transaction':_0x28bd77});}return BPromise['all'](_0x38ea7f)[_0x1b41('0x1d')](function(){if(_0x5b46ac[_0x1b41('0xa5')]){return BPromise[_0x1b41('0x92')](_[_0x1b41('0x35')](_0x1ec37f,function(_0x2100eb){return _0x2100eb['getDataValue'](_0x1b41('0xa4'))===_0x1b41('0x10e');}),function(_0x4a9cd6){return db['UserVoiceQueueRt'][_0x1b41('0xb5')]({'membername':_0x5b46ac['name'],'UserId':_0x5b46ac['id'],'queue_name':_0x4a9cd6[_0x1b41('0x3b')],'VoiceQueueId':_0x4a9cd6['id'],'interface':_[_0x1b41('0x6d')](_0x5b46ac[_0x1b41('0xa7')])?util[_0x1b41('0xb2')]('SIP/%s',_0x5b46ac[_0x1b41('0x3b')]):_0x5b46ac[_0x1b41('0xa7')],'paused':_0x5b46ac[_0x1b41('0xa6')]||![],'penalty':_0x5b46ac['penalty']},{'transaction':_0x28bd77});});}else{return;}})[_0x1b41('0x1d')](function(){for(var _0x58a739=0x0;_0x58a739<_0x1ec37f[_0x1b41('0x50')];_0x58a739++){var _0x406e64=_0x1ec37f[_0x58a739]['getDataValue'](_0x1b41('0xa4'));var _0x296f5a=_0x406e64+_0x1b41('0xaf');socket['emit'](_0x1b41('0x30')+_0x406e64+_0x1b41('0x119'),{'UserId':_0x5b46ac['id'],['queueField']:_0x1ec37f[_0x58a739]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x5143e4,null))[_0x1b41('0x5f')](handleError(_0x5143e4,null));};exports[_0x1b41('0x11a')]=function(_0xfc179,_0x3c6179){return db['User'][_0x1b41('0x9d')]({'where':{'id':_0xfc179[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x3c6179,null))['then'](function(_0x181d7c){if(_0x181d7c){var _0x291cd6=_0x181d7c[_0x1b41('0x2e')]({'plain':!![]});var _0x471933=_0xfc179[_0x1b41('0x4a')]['ids'];return _0x181d7c['removeTeams'](_0x471933)[_0x1b41('0x1d')](function(){for(var _0x283318=0x0;_0x283318<_0x471933[_0x1b41('0x50')];_0x283318++){var _0x37e584=[];db[_0x1b41('0x10a')][_0x1b41('0x9d')]({'where':{'id':_0x471933[_0x283318]}})[_0x1b41('0x1d')](function(_0x20df73){_0x37e584[_0x1b41('0x90')](_0x20df73[_0x1b41('0xec')]()['then'](function(_0x26bf7c){for(var _0x494e0f=0x0;_0x494e0f<_0x26bf7c[_0x1b41('0x50')];_0x494e0f++){_0x26bf7c[_0x494e0f][_0x1b41('0x10d')](_0x1b41('0xa4'),'Voice');}return _0x26bf7c;}));_0x37e584[_0x1b41('0x90')](_0x20df73[_0x1b41('0x10f')]()[_0x1b41('0x1d')](function(_0x1cc3e8){for(var _0x3db092=0x0;_0x3db092<_0x1cc3e8[_0x1b41('0x50')];_0x3db092++){_0x1cc3e8[_0x3db092][_0x1b41('0x10d')]('channel',_0x1b41('0x11b'));}return _0x1cc3e8;}));_0x37e584[_0x1b41('0x90')](_0x20df73[_0x1b41('0x11c')]()[_0x1b41('0x1d')](function(_0x1d9c0a){for(var _0x286664=0x0;_0x286664<_0x1d9c0a['length'];_0x286664++){_0x1d9c0a[_0x286664][_0x1b41('0x10d')]('channel',_0x1b41('0x110'));}return _0x1d9c0a;}));_0x37e584[_0x1b41('0x90')](_0x20df73['getSmsQueues']()[_0x1b41('0x1d')](function(_0x49cf8a){for(var _0x471e80=0x0;_0x471e80<_0x49cf8a['length'];_0x471e80++){_0x49cf8a[_0x471e80][_0x1b41('0x10d')](_0x1b41('0xa4'),_0x1b41('0x112'));}return _0x49cf8a;}));_0x37e584[_0x1b41('0x90')](_0x20df73[_0x1b41('0x113')]()['then'](function(_0x2f3782){for(var _0xad5664=0x0;_0xad5664<_0x2f3782['length'];_0xad5664++){_0x2f3782[_0xad5664]['setDataValue']('channel',_0x1b41('0x11d'));}return _0x2f3782;}));_0x37e584[_0x1b41('0x90')](_0x20df73['getFaxQueues']()[_0x1b41('0x1d')](function(_0x217b41){for(var _0x13b9bd=0x0;_0x13b9bd<_0x217b41[_0x1b41('0x50')];_0x13b9bd++){_0x217b41[_0x13b9bd]['setDataValue'](_0x1b41('0xa4'),_0x1b41('0x115'));}return _0x217b41;}));_0x37e584[_0x1b41('0x90')](_0x20df73[_0x1b41('0x116')]()[_0x1b41('0x1d')](function(_0xc47927){for(var _0x198d55=0x0;_0x198d55<_0xc47927['length'];_0x198d55++){_0xc47927[_0x198d55][_0x1b41('0x10d')](_0x1b41('0xa4'),_0x1b41('0x117'));}return _0xc47927;}));return BPromise['all'](_0x37e584);})[_0x1b41('0x1d')](function(_0x361ac5){var _0x2fd67f=_['flatten'](_0x361ac5);_0x37e584=[];return db['sequelize'][_0x1b41('0x11e')](function(_0x1e742d){for(var _0x133640=0x0;_0x133640<_0x2fd67f[_0x1b41('0x50')];_0x133640++){_0x37e584[_0x1b41('0x90')](_0x2fd67f[_0x133640][_0x1b41('0x11f')](_0x291cd6['id']),{'transaction':_0x1e742d});}return BPromise['all'](_0x37e584)['then'](function(){if(_0x291cd6[_0x1b41('0xa5')]){return BPromise['each'](_[_0x1b41('0x35')](_0x2fd67f,function(_0x325c1f){return _0x325c1f['getDataValue'](_0x1b41('0xa4'))===_0x1b41('0x10e');}),function(_0x5d0679){return db[_0x1b41('0xb4')][_0x1b41('0x3d')]({'where':{'VoiceQueueId':_0x5d0679['id'],'UserId':_0x291cd6['id']},'transaction':_0x1e742d});});}else{return;}})[_0x1b41('0x1d')](function(){for(var _0x34f704=0x0;_0x34f704<_0x2fd67f['length'];_0x34f704++){var _0x3a814a=_0x2fd67f[_0x34f704][_0x1b41('0x120')](_0x1b41('0xa4'));var _0x5724e0=_0x3a814a+_0x1b41('0xaf');socket[_0x1b41('0xb0')](_0x1b41('0x30')+_0x3a814a+_0x1b41('0xb7'),{'UserId':_0x291cd6['id'],['queueField']:_0x2fd67f[_0x34f704]['id']});}});});});}});}})[_0x1b41('0x1d')](respondWithStatusCode(_0x3c6179,null))[_0x1b41('0x5f')](handleError(_0x3c6179,null));};exports[_0x1b41('0x121')]=function(_0x2af25f,_0x55d82d,_0x53ecf8){var _0xfe4181={};var _0x3069da={};var _0x2b2915;var _0x2f837c;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x2af25f[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x55d82d,null))[_0x1b41('0x1d')](function(_0x19d5aa){if(_0x19d5aa){_0x2b2915=_0x19d5aa;_0x3069da['model']=_[_0x1b41('0x4b')](db[_0x1b41('0xc4')][_0x1b41('0x43')]);_0x3069da[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x2af25f['query']);_0x3069da[_0x1b41('0x4c')]=_['intersection'](_0x3069da[_0x1b41('0x47')],_0x3069da['query']);_0xfe4181[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x3069da['model'],qs[_0x1b41('0x4f')](_0x2af25f['query']['fields']));_0xfe4181[_0x1b41('0x4e')]=_0xfe4181[_0x1b41('0x4e')][_0x1b41('0x50')]?_0xfe4181[_0x1b41('0x4e')]:_0x3069da[_0x1b41('0x47')];_0xfe4181[_0x1b41('0x53')]=qs[_0x1b41('0x54')](_0x2af25f['query']['sort']);_0xfe4181[_0x1b41('0x55')]=qs['filters'](_[_0x1b41('0x56')](_0x2af25f[_0x1b41('0x4a')],_0x3069da[_0x1b41('0x4c')]));if(_0x2af25f[_0x1b41('0x4a')][_0x1b41('0x35')]){_0xfe4181[_0x1b41('0x55')]=_['merge'](_0xfe4181[_0x1b41('0x55')],{'$or':_['map'](_0xfe4181['attributes'],function(_0x172f1d){var _0x56b459={};_0x56b459[_0x172f1d]={'$like':'%'+_0x2af25f[_0x1b41('0x4a')]['filter']+'%'};return _0x56b459;})});}_0xfe4181=_['merge']({},_0xfe4181,_0x2af25f['options']);return _0x2b2915[_0x1b41('0x121')](_0xfe4181);}})[_0x1b41('0x1d')](function(_0x374ba6){if(_0x374ba6){_0x2f837c=_0x374ba6[_0x1b41('0x50')];if(!_0x2af25f[_0x1b41('0x4a')]['hasOwnProperty'](_0x1b41('0x52'))){_0xfe4181[_0x1b41('0x29')]=qs[_0x1b41('0x29')](_0x2af25f[_0x1b41('0x4a')][_0x1b41('0x29')]);_0xfe4181[_0x1b41('0x28')]=qs[_0x1b41('0x28')](_0x2af25f['query'][_0x1b41('0x28')]);}return _0x2b2915['getLists'](_0xfe4181);}})[_0x1b41('0x1d')](function(_0xe3cfc2){if(_0xe3cfc2){return _0xe3cfc2?{'count':_0x2f837c,'rows':_0xe3cfc2}:null;}})[_0x1b41('0x1d')](respondWithResult(_0x55d82d,null))[_0x1b41('0x5f')](handleError(_0x55d82d,null));};exports[_0x1b41('0x122')]=function(_0x3f569e,_0x415f1f,_0x1d30a6){var _0xc087d={};var _0x28e998={};var _0x6fc730;var _0x5c1254;return db[_0x1b41('0x42')][_0x1b41('0x9d')]({'where':{'id':_0x3f569e[_0x1b41('0x62')]['id']}})[_0x1b41('0x1d')](handleEntityNotFound(_0x415f1f,null))[_0x1b41('0x1d')](function(_0x503675){if(_0x503675){_0x6fc730=_0x503675;_0x28e998[_0x1b41('0x47')]=_[_0x1b41('0x4b')](db['User'][_0x1b41('0x43')]);_0x28e998[_0x1b41('0x4a')]=_[_0x1b41('0x4b')](_0x3f569e['query']);_0x28e998[_0x1b41('0x4c')]=_[_0x1b41('0x4d')](_0x28e998[_0x1b41('0x47')],_0x28e998[_0x1b41('0x4a')]);_0xc087d[_0x1b41('0x4e')]=_[_0x1b41('0x4d')](_0x28e998['model'],qs[_0x1b41('0x4f')](_0x3f569e[_0x1b41('0x4a')][_0x1b41('0x4f')]));_0xc087d['attributes']=_0xc087d[_0x1b41('0x4e')][_0x1b41('0x50')]?_0xc087d[_0x1b41('0x4e')]:_0x28e998[_0x1b41('0x47')];_0xc087d[_0x1b41('0x53')]=qs[_0x1b41('0x54')](_0x3f569e[_0x1b41('0x4a')][_0x1b41('0x54')]);_0xc087d[_0x1b41('0x55')]=qs[_0x1b41('0x4c')](_[_0x1b41('0x56')](_0x3f569e['query'],_0x28e998['filters']));if(_0x3f569e[_0x1b41('0x4a')][_0x1b41('0x35')]){_0xc087d[_0x1b41('0x55')]=_[_0x1b41('0xc3')](_0xc087d['where'],{'$or':_[_0x1b41('0x41')](_0xc087d[_0x1b41('0x4e')],function(_0x5980d0){var _0x593916={};_0x593916[_0x5980d0]={'$like':'%'+_0x3f569e['query']['filter']+'%'};return _0x593916;})});}_0xc087d[_0x1b41('0x47')]=db[_0x1b41('0x42')];_0xc087d['as']=_0x1b41('0x31');_0xc087d=_['merge']({},_0xc087d,_0x3f569e[_0x1b41('0x5a')]);return _0x6fc730[_0x1b41('0xec')]({'include':[_0xc087d]});}})[_0x1b41('0x1d')](function(_0xa4c737){if(_0xa4c737){var _0x546b3f={},_0x8cf1dd=[],_0x3dd95c=0x0;for(var _0x418219=0x0;_0x418219<_0xa4c737[_0x1b41('0x50')];_0x418219+=0x1){for(var _0x420421=0x0,_0x21bc9a;_0x420421<_0xa4c737[_0x418219][_0x1b41('0x31')][_0x1b41('0x50')];_0x420421+=0x1){_0x21bc9a=_0xa4c737[_0x418219][_0x1b41('0x31')][_0x420421][_0x1b41('0x2e')]({'plain':!![]});_0x546b3f[_0x21bc9a['id']]=_0x21bc9a;}}_0x546b3f=_[_0x1b41('0x123')](_0x546b3f);for(var _0x578ead=qs[_0x1b41('0x28')](_0x3f569e[_0x1b41('0x4a')][_0x1b41('0x28')]);_0x578ead<_0x546b3f[_0x1b41('0x50')]&&_0x8cf1dd[_0x1b41('0x50')]=_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 +var _0x2ca5=['socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowUser','find','PauseUser','UserVoiceQueueRt','update','name','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','SIP/%s','DEFAULT\x20PAUSE','role','internal','uniqueid','MemberReport','bulkCreate','body','type','UnpauseUser','channel','isValidChannel','Unknown\x20channel','voice','system','mail','sms','openchannel','whatsapp','set','%s%s','LogoutUser','findOne','destroy','phone','loginInPause','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','all','LOGIN','callysquare','merge','LOGININPAUSE','concat','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','redis','localhost'];(function(_0x252172,_0x542252){var _0x335529=function(_0x32d831){while(--_0x32d831){_0x252172['push'](_0x252172['shift']());}};_0x335529(++_0x542252);}(_0x2ca5,0x108));var _0x52ca=function(_0x59f0ff,_0x2b9d67){_0x59f0ff=_0x59f0ff-0x0;var _0x28e782=_0x2ca5[_0x59f0ff];return _0x28e782;};'use strict';var _=require('lodash');var util=require(_0x52ca('0x0'));var moment=require(_0x52ca('0x1'));var BPromise=require(_0x52ca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52ca('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x52ca('0x4'))(_0x52ca('0x5'));var config=require(_0x52ca('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x52ca('0x7')]=_['defaults'](config['redis'],{'host':_0x52ca('0x8'),'port':0x18eb});var socket=require(_0x52ca('0x9'))(new Redis(config[_0x52ca('0x7')]));require(_0x52ca('0xa'))[_0x52ca('0xb')](socket);function respondWithRpcPromise(_0x1d4453,_0x20a129,_0x4b1709){return new BPromise(function(_0x431308,_0x11fedc){return client[_0x52ca('0xc')](_0x1d4453,_0x4b1709)[_0x52ca('0xd')](function(_0x2d0e25){logger[_0x52ca('0xe')](_0x52ca('0xf'),_0x20a129,_0x52ca('0x10'));logger['debug'](_0x52ca('0x11'),_0x20a129,_0x52ca('0x10'),JSON[_0x52ca('0x12')](_0x2d0e25));if(_0x2d0e25[_0x52ca('0x13')]){if(_0x2d0e25[_0x52ca('0x13')][_0x52ca('0x14')]===0x1f4){logger[_0x52ca('0x13')](_0x52ca('0xf'),_0x20a129,_0x2d0e25[_0x52ca('0x13')]['message']);return _0x11fedc(_0x2d0e25['error'][_0x52ca('0x15')]);}logger[_0x52ca('0x13')](_0x52ca('0xf'),_0x20a129,_0x2d0e25[_0x52ca('0x13')][_0x52ca('0x15')]);return _0x431308(_0x2d0e25[_0x52ca('0x13')][_0x52ca('0x15')]);}else{logger[_0x52ca('0xe')](_0x52ca('0xf'),_0x20a129,_0x52ca('0x10'));_0x431308(_0x2d0e25[_0x52ca('0x16')]['message']);}})[_0x52ca('0x17')](function(_0x334994){logger[_0x52ca('0x13')](_0x52ca('0xf'),_0x20a129,_0x334994);_0x11fedc(_0x334994);});});}exports[_0x52ca('0x18')]=function(_0x338fef){var _0x2901cf=this;return new Promise(function(_0x3a19a9,_0x41f4f3){return db[_0x52ca('0x19')][_0x52ca('0x1a')]({'raw':_0x338fef['options']?_0x338fef[_0x52ca('0x1b')][_0x52ca('0x1c')]===undefined?!![]:![]:!![],'where':_0x338fef[_0x52ca('0x1b')]?_0x338fef[_0x52ca('0x1b')][_0x52ca('0x1d')]||null:null,'attributes':_0x338fef[_0x52ca('0x1b')]?_0x338fef[_0x52ca('0x1b')]['attributes']||null:null,'limit':_0x338fef[_0x52ca('0x1b')]?_0x338fef[_0x52ca('0x1b')][_0x52ca('0x1e')]||null:null,'include':_0x338fef[_0x52ca('0x1b')]?_0x338fef[_0x52ca('0x1b')][_0x52ca('0x1f')]?_[_0x52ca('0x20')](_0x338fef[_0x52ca('0x1b')]['include'],function(_0x4f9ed4){return{'model':db[_0x4f9ed4[_0x52ca('0x21')]],'as':_0x4f9ed4['as'],'attributes':_0x4f9ed4['attributes'],'include':_0x4f9ed4[_0x52ca('0x1f')]?_[_0x52ca('0x20')](_0x4f9ed4['include'],function(_0x15649c){return{'model':db[_0x15649c[_0x52ca('0x21')]],'as':_0x15649c['as'],'attributes':_0x15649c[_0x52ca('0x22')],'include':_0x15649c[_0x52ca('0x1f')]?_['map'](_0x15649c[_0x52ca('0x1f')],function(_0x3133c3){return{'model':db[_0x3133c3['model']],'as':_0x3133c3['as'],'attributes':_0x3133c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x52ca('0xd')](function(_0x55f177){logger[_0x52ca('0xe')](_0x52ca('0x18'),_0x338fef);logger[_0x52ca('0x23')](_0x52ca('0x18'),_0x338fef,JSON[_0x52ca('0x12')](_0x55f177));_0x3a19a9(_0x55f177);})[_0x52ca('0x17')](function(_0x2727ae){logger[_0x52ca('0x13')](_0x52ca('0x18'),_0x2727ae['message'],_0x338fef);_0x41f4f3(_0x2901cf[_0x52ca('0x13')](0x1f4,_0x2727ae[_0x52ca('0x15')]));});});};exports[_0x52ca('0x24')]=function(_0x14e830){var _0x547006=this;return new Promise(function(_0x411270,_0x28bc41){return db[_0x52ca('0x19')][_0x52ca('0x25')]({'raw':_0x14e830[_0x52ca('0x1b')]?_0x14e830['options'][_0x52ca('0x1c')]===undefined?!![]:![]:!![],'where':_0x14e830[_0x52ca('0x1b')]?_0x14e830[_0x52ca('0x1b')][_0x52ca('0x1d')]||null:null,'attributes':_0x14e830[_0x52ca('0x1b')]?_0x14e830['options'][_0x52ca('0x22')]||null:null,'include':_0x14e830[_0x52ca('0x1b')]?_0x14e830[_0x52ca('0x1b')][_0x52ca('0x1f')]?_[_0x52ca('0x20')](_0x14e830[_0x52ca('0x1b')][_0x52ca('0x1f')],function(_0x5b0a12){return{'model':db[_0x5b0a12[_0x52ca('0x21')]],'as':_0x5b0a12['as'],'attributes':_0x5b0a12['attributes'],'include':_0x5b0a12[_0x52ca('0x1f')]?_[_0x52ca('0x20')](_0x5b0a12[_0x52ca('0x1f')],function(_0x4431df){return{'model':db[_0x4431df[_0x52ca('0x21')]],'as':_0x4431df['as'],'attributes':_0x4431df['attributes'],'include':_0x4431df[_0x52ca('0x1f')]?_[_0x52ca('0x20')](_0x4431df[_0x52ca('0x1f')],function(_0x4bb897){return{'model':db[_0x4bb897[_0x52ca('0x21')]],'as':_0x4bb897['as'],'attributes':_0x4bb897[_0x52ca('0x22')]};}):[]};}):[]};}):[]:[]})[_0x52ca('0xd')](function(_0x113b40){logger[_0x52ca('0xe')](_0x52ca('0x24'),_0x14e830);logger['debug'](_0x52ca('0x24'),_0x14e830,JSON[_0x52ca('0x12')](_0x113b40));_0x411270(_0x113b40);})['catch'](function(_0x3cb82c){logger[_0x52ca('0x13')](_0x52ca('0x24'),_0x3cb82c[_0x52ca('0x15')],_0x14e830);_0x28bc41(_0x547006[_0x52ca('0x13')](0x1f4,_0x3cb82c[_0x52ca('0x15')]));});});};exports[_0x52ca('0x26')]=function(_0x2dc7a3){var _0xea976c=this;return new Promise(function(_0x4e5ed3,_0x24f1c){var _0x5b8819;return db[_0x52ca('0x19')][_0x52ca('0x25')]({'where':_0x2dc7a3[_0x52ca('0x1b')][_0x52ca('0x1d')]||{},'attributes':['id','name','role','internal','interface']})[_0x52ca('0xd')](function(_0x3b6954){if(_0x3b6954){_0x5b8819=_0x3b6954;return db[_0x52ca('0x27')][_0x52ca('0x28')]({'paused':0x1},{'where':{'UserId':_0x5b8819['id']},'individualHooks':!![]});}})['then'](function(){if(_0x5b8819){return db['MemberReport'][_0x52ca('0x1a')]({'where':{'membername':_0x5b8819[_0x52ca('0x29')],'type':_0x52ca('0x2a'),'exitAt':null}});}})[_0x52ca('0xd')](function(_0x8aab4d){if(_0x5b8819){if(_0x8aab4d&&_0x8aab4d[_0x52ca('0x2b')]){var _0xcddb83=moment()[_0x52ca('0x2c')](_0x52ca('0x2d'));for(var _0x378ca3=0x0,_0x44fde9=_0x8aab4d['length'];_0x378ca3<_0x44fde9;_0x378ca3++){_0x8aab4d[_0x378ca3][_0x52ca('0x2e')]({'exitAt':_0xcddb83});}}}})['then'](function(){if(_0x5b8819){var _0x55e160=[];var _0x2722ee=utils[_0x52ca('0x2f')]();_0x2722ee[_0x52ca('0x30')](function(_0x591432){_0x55e160[_0x52ca('0x31')]({'channel':_0x591432,'membername':_0x5b8819[_0x52ca('0x29')],'interface':_[_0x52ca('0x32')](_0x5b8819[_0x52ca('0x33')])?util['format'](_0x52ca('0x34'),_0x5b8819[_0x52ca('0x29')]):_0x5b8819['interface'],'type':_0x52ca('0x2a'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x2dc7a3['body']['type']||_0x52ca('0x35'),'role':_0x5b8819[_0x52ca('0x36')],'internal':_0x5b8819[_0x52ca('0x37')],'uniqueid':_0x2dc7a3['body'][_0x52ca('0x38')]||null});});return db[_0x52ca('0x39')][_0x52ca('0x3a')](_0x55e160,{'individualHooks':!![]});}})[_0x52ca('0xd')](function(){if(_0x5b8819){return _0x5b8819[_0x52ca('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x2dc7a3[_0x52ca('0x3b')][_0x52ca('0x3c')]||_0x52ca('0x35'),'lastPauseAt':moment()[_0x52ca('0x2c')](_0x52ca('0x2d'))});}})[_0x52ca('0xd')](function(_0x4cf6b1){_0x4e5ed3(_0x4cf6b1);})[_0x52ca('0x17')](function(_0x30e765){_0x24f1c(_0xea976c[_0x52ca('0x13')](0x1f4,_0x30e765[_0x52ca('0x15')]));});});};exports[_0x52ca('0x3d')]=function(_0x383bef){var _0x3a5191=this;return new Promise(function(_0x1241f0,_0x531ab0){var _0x51b959;return db['User']['findOne']({'where':_0x383bef['options'][_0x52ca('0x1d')]||{},'attributes':['id',_0x52ca('0x29')]})[_0x52ca('0xd')](function(_0x1db1d8){if(_0x1db1d8){_0x51b959=_0x1db1d8;if(_0x383bef['body'][_0x52ca('0x3e')]&&!utils[_0x52ca('0x3f')](_0x383bef[_0x52ca('0x3b')]['channel'])){throw new Error(_0x52ca('0x40'));}switch(_0x383bef['body'][_0x52ca('0x3e')]){case _0x52ca('0x41'):return db[_0x52ca('0x27')][_0x52ca('0x28')]({'paused':0x0},{'where':{'UserId':_0x51b959['id']}})['then'](function(){return db['MemberReport'][_0x52ca('0x25')]({'where':{'channel':_0x383bef[_0x52ca('0x3b')][_0x52ca('0x3e')],'membername':_0x51b959[_0x52ca('0x29')],'type':_0x52ca('0x2a'),'exitAt':null}});})['then'](function(_0x2b4058){if(_0x2b4058){return _0x2b4058[_0x52ca('0x28')]({'exitAt':moment()[_0x52ca('0x2c')](_0x52ca('0x2d')),'data2':_0x52ca('0x42')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x51b959['update']({'voicePause':![]});});case _0x52ca('0x43'):case'chat':case'fax':case _0x52ca('0x44'):case _0x52ca('0x45'):case _0x52ca('0x46'):return db[_0x52ca('0x39')][_0x52ca('0x25')]({'where':{'channel':_0x383bef[_0x52ca('0x3b')][_0x52ca('0x3e')],'membername':_0x51b959[_0x52ca('0x29')],'type':_0x52ca('0x2a'),'exitAt':null}})[_0x52ca('0xd')](function(_0x51330a){return _0x51330a[_0x52ca('0x28')]({'exitAt':moment()[_0x52ca('0x2c')](_0x52ca('0x2d')),'data2':_0x52ca('0x42')},{'individualHooks':!![]});})[_0x52ca('0xd')](function(){var _0x1f4167={};_[_0x52ca('0x47')](_0x1f4167,util[_0x52ca('0x2c')](_0x52ca('0x48'),_0x383bef[_0x52ca('0x3b')]['channel'],'Pause'),![]);return _0x51b959[_0x52ca('0x28')](_0x1f4167);});default:return db[_0x52ca('0x27')][_0x52ca('0x28')]({'paused':0x0},{'where':{'UserId':_0x51b959['id']}})[_0x52ca('0xd')](function(){return db[_0x52ca('0x39')]['findAll']({'where':{'membername':_0x51b959[_0x52ca('0x29')],'type':_0x52ca('0x2a'),'exitAt':null}});})['then'](function(_0x5067b9){var _0x4ed6b5=[];_0x5067b9[_0x52ca('0x30')](function(_0x463f96){_0x4ed6b5[_0x52ca('0x31')](_0x463f96[_0x52ca('0x28')]({'exitAt':moment()[_0x52ca('0x2c')](_0x52ca('0x2d')),'data2':_0x52ca('0x42')}));});return BPromise['all'](_0x4ed6b5);})[_0x52ca('0xd')](function(){return _0x51b959[_0x52ca('0x28')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x52ca('0xd')](function(_0x361582){_0x1241f0(_0x361582);})[_0x52ca('0x17')](function(_0xf44946){_0x531ab0(_0x3a5191[_0x52ca('0x13')](0x1f4,_0xf44946['message']));});});};exports[_0x52ca('0x49')]=function(_0x3db43f){var _0x355a23=this;return new Promise(function(_0x172dd3,_0xe83173){var _0xefe6c9;return db[_0x52ca('0x19')][_0x52ca('0x4a')]({'where':_0x3db43f[_0x52ca('0x1b')]['where']||{},'attributes':['id',_0x52ca('0x29')]})['then'](function(_0x4599b9){if(_0x4599b9){_0xefe6c9=_0x4599b9;return db[_0x52ca('0x27')][_0x52ca('0x4b')]({'where':{'membername':_0xefe6c9[_0x52ca('0x29')]},'individualHooks':!![]});}})[_0x52ca('0xd')](function(){if(_0xefe6c9){return db[_0x52ca('0x39')][_0x52ca('0x1a')]({'where':{'membername':_0xefe6c9[_0x52ca('0x29')],'exitAt':null}});}})[_0x52ca('0xd')](function(_0xef1f58){if(_0xefe6c9){if(_0xef1f58&&_0xef1f58['length']){var _0x157701=[];_0xef1f58['forEach'](function(_0x3cf8e9){_0x157701[_0x52ca('0x31')](_0x3cf8e9[_0x52ca('0x28')]({'exitAt':moment()[_0x52ca('0x2c')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x157701);}}})[_0x52ca('0xd')](function(){if(_0xefe6c9){return _0xefe6c9['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x52ca('0xd')](function(_0xf8ef27){_0x172dd3(_0xf8ef27);})[_0x52ca('0x17')](function(_0x3fd8f9){_0xe83173(_0x355a23[_0x52ca('0x13')](0x1f4,_0x3fd8f9[_0x52ca('0x15')]));});});};exports['LoginUser']=function(_0x5b4a94){var _0x36c7ce=this;return new Promise(function(_0x2681b0,_0x5fa81c){var _0x207f87;var _0x13ac6a;var _0x9b0080;var _0x37a903;return db[_0x52ca('0x19')][_0x52ca('0x4a')]({'where':_0x5b4a94[_0x52ca('0x1b')]['where']||{},'attributes':['id',_0x52ca('0x29'),_0x52ca('0x36'),'mobile',_0x52ca('0x4c'),'internal',_0x52ca('0x4d'),'interface']})[_0x52ca('0xd')](function(_0x46d3bc){if(_0x46d3bc){_0x207f87=_0x46d3bc;_0x37a903=_0x5b4a94[_0x52ca('0x3b')][_0x52ca('0x33')]?_0x5b4a94[_0x52ca('0x3b')][_0x52ca('0x33')]:util[_0x52ca('0x2c')](_0x52ca('0x34'),_0x207f87['name']);return db[_0x52ca('0x19')][_0x52ca('0x4e')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x207f87['id']}}});}})['then'](function(_0x49b59a){if(_0x49b59a){_0x9b0080=_0x49b59a;return require('../../config/license/util')[_0x52ca('0x4f')]();}})['then'](function(_0x1abd64){if(_0x1abd64&&_0x1abd64[_0x52ca('0x50')]&&_0x9b0080>=_0x1abd64['agents']){throw new Error(_0x52ca('0x51'));}})['then'](function(){if(_0x207f87){return db[_0x52ca('0x27')][_0x52ca('0x4b')]({'where':{'membername':_0x207f87[_0x52ca('0x29')]},'individualHooks':!![]});}})[_0x52ca('0xd')](function(){if(_0x207f87){return _0x207f87[_0x52ca('0x52')]({'raw':!![]});}})[_0x52ca('0xd')](function(_0x580c07){if(_0x207f87){if(_0x580c07){var _0xf67f42=[];_0x13ac6a=_0x580c07;if(_0x13ac6a[_0x52ca('0x2b')]){for(var _0x3e530a=0x0;_0x3e530a<_0x13ac6a[_0x52ca('0x2b')];_0x3e530a++){_0xf67f42[_0x52ca('0x31')](db[_0x52ca('0x27')][_0x52ca('0x53')]({'membername':_0x207f87['name'],'UserId':_0x207f87['id'],'queue_name':_0x13ac6a[_0x3e530a][_0x52ca('0x29')],'VoiceQueueId':_0x13ac6a[_0x3e530a]['id'],'interface':_0x37a903,'paused':_0x207f87[_0x52ca('0x4d')]||![],'penalty':_0x13ac6a[_0x3e530a][_0x52ca('0x54')]||0x0}));}return BPromise[_0x52ca('0x55')](_0xf67f42);}}}})[_0x52ca('0xd')](function(){if(_0x207f87){return db[_0x52ca('0x39')]['findAll']({'where':{'membername':_0x207f87[_0x52ca('0x29')],'exitAt':null}});}})['then'](function(_0x59b88f){if(_0x207f87){if(_0x59b88f&&_0x59b88f['length']){var _0x4b712c=[];_0x59b88f[_0x52ca('0x30')](function(_0x21ef9b){_0x4b712c[_0x52ca('0x31')](_0x21ef9b['update']({'exitAt':moment()['format'](_0x52ca('0x2d'))}));});return BPromise[_0x52ca('0x55')](_0x4b712c);}}})[_0x52ca('0xd')](function(_0x41741b){if(_0x207f87){var _0x41f15a=[];var _0x2ba157=[];var _0x58e1af=utils[_0x52ca('0x2f')]();var _0x5994a6={'membername':_0x207f87[_0x52ca('0x29')],'interface':_0x37a903,'enterAt':moment()[_0x52ca('0x2c')](_0x52ca('0x2d')),'role':_0x207f87[_0x52ca('0x36')],'internal':_0x207f87[_0x52ca('0x37')]};_0x58e1af['forEach'](function(_0x131cb4){_0x41f15a[_0x52ca('0x31')](_['merge']({'channel':_0x131cb4,'type':_0x52ca('0x56'),'data1':_0x52ca('0x57'),'data2':_0x37a903},_0x5994a6));if(_0x207f87[_0x52ca('0x4d')]){_0x2ba157[_0x52ca('0x31')](_[_0x52ca('0x58')]({'channel':_0x131cb4,'type':_0x52ca('0x2a'),'data1':_0x52ca('0x59')},_0x5994a6));}});return db[_0x52ca('0x39')]['bulkCreate'](_0x41f15a[_0x52ca('0x5a')](_0x2ba157),{'individualHooks':!![]});}})[_0x52ca('0xd')](function(){if(_0x207f87){return _0x207f87['update']({'online':!![],'lastLoginAt':moment()['format'](_0x52ca('0x2d')),'voicePause':_0x207f87['loginInPause']||![],'mailPause':_0x207f87[_0x52ca('0x4d')]||![],'chatPause':_0x207f87['loginInPause']||![],'faxPause':_0x207f87[_0x52ca('0x4d')]||![],'smsPause':_0x207f87[_0x52ca('0x4d')]||![],'openchannelPause':_0x207f87[_0x52ca('0x4d')]||![],'pauseType':_0x207f87[_0x52ca('0x4d')]?_0x52ca('0x59'):null,'lastPauseAt':moment()['format'](_0x52ca('0x2d')),'interface':_0x37a903});}})[_0x52ca('0xd')](function(_0x28ea50){_0x2681b0(_0x28ea50);})[_0x52ca('0x17')](function(_0x3b9dee){_0x5fa81c(_0x36c7ce[_0x52ca('0x13')](0x1f4,_0x3b9dee[_0x52ca('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1cb2afc..76e8ca7 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 _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 +var _0x68a8=['update','emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x31ce05,_0x1f3d4e){var _0xa0a5bb=function(_0x1a2ffc){while(--_0x1a2ffc){_0x31ce05['push'](_0x31ce05['shift']());}};_0xa0a5bb(++_0x1f3d4e);}(_0x68a8,0x1d1));var _0x868a=function(_0x53f401,_0x5c699d){_0x53f401=_0x53f401-0x0;var _0x2ee3e9=_0x68a8[_0x53f401];return _0x2ee3e9;};'use strict';var UserEvents=require(_0x868a('0x0'));var events=[_0x868a('0x1'),_0x868a('0x2'),_0x868a('0x3')];function createListener(_0x35cfe9,_0x9d64c8){return function(_0x2d3e2f){_0x9d64c8[_0x868a('0x4')](_0x35cfe9,_0x2d3e2f);};}function removeListener(_0x19f2ee,_0x27f412){return function(){UserEvents[_0x868a('0x5')](_0x19f2ee,_0x27f412);};}exports[_0x868a('0x6')]=function(_0x2ce10f){for(var _0x1611b2=0x0,_0x29b687=events[_0x868a('0x7')];_0x1611b2<_0x29b687;_0x1611b2++){var _0x16b795=events[_0x1611b2];var _0x17c272=createListener(_0x868a('0x8')+_0x16b795,_0x2ce10f);UserEvents['on'](_0x16b795,_0x17c272);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index f74a034..1beda40 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 _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 +var _0xb40b=['util','path','express','../../config/environment','multer'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb40b,0x126));var _0xbb40=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb40b[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require(_0xbb40('0x0'));var util=require(_0xbb40('0x1'));var path=require(_0xbb40('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb40('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbb40('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 68cd01a..289ebb8 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_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 +var _0xb10b=['sequelize','INTEGER'];(function(_0x15874c,_0xfccc8c){var _0x2c7ad0=function(_0x5dab1b){while(--_0x5dab1b){_0x15874c['push'](_0x15874c['shift']());}};_0x2c7ad0(++_0xfccc8c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c6c7c,_0x569b3e){_0x3c6c7c=_0x3c6c7c-0x0;var _0x56c812=_0xb10b[_0x3c6c7c];return _0x56c812;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index addc447..df85b6f 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 _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 +var _0x09d5=['path','rimraf','../../config/environment','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x438bba,_0x4ea9e2){var _0x473b0f=function(_0x50c4ef){while(--_0x50c4ef){_0x438bba['push'](_0x438bba['shift']());}};_0x473b0f(++_0x4ea9e2);}(_0x09d5,0x192));var _0x509d=function(_0x2bb296,_0x4d768c){_0x2bb296=_0x2bb296-0x0;var _0x5a6ec5=_0x09d5[_0x2bb296];return _0x5a6ec5;};'use strict';var _=require(_0x509d('0x0'));var util=require(_0x509d('0x1'));var logger=require(_0x509d('0x2'))(_0x509d('0x3'));var moment=require('moment');var BPromise=require(_0x509d('0x4'));var rp=require(_0x509d('0x5'));var fs=require('fs');var path=require(_0x509d('0x6'));var rimraf=require(_0x509d('0x7'));var config=require(_0x509d('0x8'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x29e770,_0x7cf247){return _0x29e770[_0x509d('0x9')](_0x509d('0xa'),attributes,{'tableName':_0x509d('0xb'),'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 f4570f9..46f98a6 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 _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 +var _0x6f7a=['../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','../../config/utils'];(function(_0x54f23e,_0x34ffb9){var _0x297a11=function(_0x4660d5){while(--_0x4660d5){_0x54f23e['push'](_0x54f23e['shift']());}};_0x297a11(++_0x34ffb9);}(_0x6f7a,0x150));var _0xa6f7=function(_0x360530,_0xbfb24d){_0x360530=_0x360530-0x0;var _0x5ad076=_0x6f7a[_0x360530];return _0x5ad076;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require('moment');var BPromise=require(_0xa6f7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa6f7('0x3'));var logger=require(_0xa6f7('0x4'))('rpc');var config=require(_0xa6f7('0x5'));var jayson=require(_0xa6f7('0x6'));var client=jayson['client'][_0xa6f7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x538622,_0x172109,_0x604294){return new BPromise(function(_0x152a90,_0x184a4a){return client[_0xa6f7('0x8')](_0x538622,_0x604294)[_0xa6f7('0x9')](function(_0x3ac95a){logger[_0xa6f7('0xa')]('UserChatQueue,\x20%s,\x20%s',_0x172109,_0xa6f7('0xb'));logger['debug'](_0xa6f7('0xc'),_0x172109,_0xa6f7('0xb'),JSON[_0xa6f7('0xd')](_0x3ac95a));if(_0x3ac95a[_0xa6f7('0xe')]){if(_0x3ac95a[_0xa6f7('0xe')][_0xa6f7('0xf')]===0x1f4){logger[_0xa6f7('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x172109,_0x3ac95a[_0xa6f7('0xe')][_0xa6f7('0x10')]);return _0x184a4a(_0x3ac95a[_0xa6f7('0xe')][_0xa6f7('0x10')]);}logger['error'](_0xa6f7('0x11'),_0x172109,_0x3ac95a[_0xa6f7('0xe')][_0xa6f7('0x10')]);return _0x152a90(_0x3ac95a['error']['message']);}else{logger[_0xa6f7('0xa')](_0xa6f7('0x11'),_0x172109,_0xa6f7('0xb'));_0x152a90(_0x3ac95a[_0xa6f7('0x12')]['message']);}})[_0xa6f7('0x13')](function(_0x40e2da){logger[_0xa6f7('0xe')](_0xa6f7('0x11'),_0x172109,_0x40e2da);_0x184a4a(_0x40e2da);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 16409e1..e80db75 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 _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 +var _0x90ff=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x90ff,0x111));var _0xf90f=function(_0x5c9484,_0x5d8cee){_0x5c9484=_0x5c9484-0x0;var _0x158c60=_0x90ff[_0x5c9484];return _0x158c60;};'use strict';var multer=require(_0xf90f('0x0'));var util=require(_0xf90f('0x1'));var path=require(_0xf90f('0x2'));var timeout=require(_0xf90f('0x3'));var express=require(_0xf90f('0x4'));var router=express[_0xf90f('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf90f('0x6'));var config=require(_0xf90f('0x7'));module[_0xf90f('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 59139b3..66fa566 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 _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 +var _0x4fc2=['sequelize','exports','INTEGER'];(function(_0x3e92a8,_0x23985c){var _0x2117b1=function(_0x58450c){while(--_0x58450c){_0x3e92a8['push'](_0x3e92a8['shift']());}};_0x2117b1(++_0x23985c);}(_0x4fc2,0x111));var _0x24fc=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0x4fc2[_0x52e68e];return _0x3211a4;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'penalty':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x24fc('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 00b07a7..9ff0f62 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 _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 +var _0xbeb5=['UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','./userFaxQueue.attributes','exports','define'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xbeb5,0x14c));var _0x5beb=function(_0x22fcf6,_0xd6b9d3){_0x22fcf6=_0x22fcf6-0x0;var _0x220903=_0xbeb5[_0x22fcf6];return _0x220903;};'use strict';var _=require('lodash');var util=require(_0x5beb('0x0'));var logger=require(_0x5beb('0x1'))(_0x5beb('0x2'));var moment=require(_0x5beb('0x3'));var BPromise=require(_0x5beb('0x4'));var rp=require(_0x5beb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5beb('0x6'));module[_0x5beb('0x7')]=function(_0xc7dc60,_0x4ec2a8){return _0xc7dc60[_0x5beb('0x8')](_0x5beb('0x9'),attributes,{'tableName':_0x5beb('0xa'),'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 8019dee..56235a0 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 _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 +var _0x1a0a=['info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x74c964,_0x247ba4){var _0x54bba9=function(_0x51576d){while(--_0x51576d){_0x74c964['push'](_0x74c964['shift']());}};_0x54bba9(++_0x247ba4);}(_0x1a0a,0x196));var _0xa1a0=function(_0xafb8e6,_0x4b3a6b){_0xafb8e6=_0xafb8e6-0x0;var _0x36eec3=_0x1a0a[_0xafb8e6];return _0x36eec3;};'use strict';var _=require(_0xa1a0('0x0'));var util=require('util');var moment=require(_0xa1a0('0x1'));var BPromise=require(_0xa1a0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1a0('0x3'));var db=require(_0xa1a0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1a0('0x5'))(_0xa1a0('0x6'));var config=require(_0xa1a0('0x7'));var jayson=require(_0xa1a0('0x8'));var client=jayson[_0xa1a0('0x9')][_0xa1a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c143d,_0x88a1c9,_0x5f83c4){return new BPromise(function(_0x25e581,_0x1cb54f){return client['request'](_0x1c143d,_0x5f83c4)[_0xa1a0('0xb')](function(_0x4b78d9){logger[_0xa1a0('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x88a1c9,_0xa1a0('0xd'));logger[_0xa1a0('0xe')](_0xa1a0('0xf'),_0x88a1c9,_0xa1a0('0xd'),JSON[_0xa1a0('0x10')](_0x4b78d9));if(_0x4b78d9[_0xa1a0('0x11')]){if(_0x4b78d9[_0xa1a0('0x11')]['code']===0x1f4){logger[_0xa1a0('0x11')](_0xa1a0('0x12'),_0x88a1c9,_0x4b78d9[_0xa1a0('0x11')][_0xa1a0('0x13')]);return _0x1cb54f(_0x4b78d9['error'][_0xa1a0('0x13')]);}logger[_0xa1a0('0x11')](_0xa1a0('0x12'),_0x88a1c9,_0x4b78d9[_0xa1a0('0x11')][_0xa1a0('0x13')]);return _0x25e581(_0x4b78d9['error'][_0xa1a0('0x13')]);}else{logger['info'](_0xa1a0('0x12'),_0x88a1c9,'request\x20sent');_0x25e581(_0x4b78d9[_0xa1a0('0x14')][_0xa1a0('0x13')]);}})[_0xa1a0('0x15')](function(_0x5c86b4){logger[_0xa1a0('0x11')](_0xa1a0('0x12'),_0x88a1c9,_0x5c86b4);_0x1cb54f(_0x5c86b4);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index d4e755e..80a8910 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 _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 +var _0x9373=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x3e1208,_0x25563a){var _0x315897=function(_0x58152d){while(--_0x58152d){_0x3e1208['push'](_0x3e1208['shift']());}};_0x315897(++_0x25563a);}(_0x9373,0x1a7));var _0x3937=function(_0x2180f5,_0x38f251){_0x2180f5=_0x2180f5-0x0;var _0x3b65ff=_0x9373[_0x2180f5];return _0x3b65ff;};'use strict';var multer=require(_0x3937('0x0'));var util=require(_0x3937('0x1'));var path=require(_0x3937('0x2'));var timeout=require(_0x3937('0x3'));var express=require(_0x3937('0x4'));var router=express[_0x3937('0x5')]();var auth=require(_0x3937('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3937('0x7'));module[_0x3937('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 859f575..5dd6299 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_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 +var _0xbaf0=['exports','INTEGER'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaf0[_0x5b644e];return _0x49c6bf;};'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/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 66468fa..ca8f3f7 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 _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 +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x279c03,_0x686956){var _0x5c9e1f=function(_0x4a4172){while(--_0x4a4172){_0x279c03['push'](_0x279c03['shift']());}};_0x5c9e1f(++_0x686956);}(_0xb7e7,0x121));var _0x7b7e=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xb7e7[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index e4e4c2d..3efe76e 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 _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 +var _0xf722=['jayson/promise','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3589b2,_0x268b7f){var _0x403c53=function(_0x5b6f8b){while(--_0x5b6f8b){_0x3589b2['push'](_0x3589b2['shift']());}};_0x403c53(++_0x268b7f);}(_0xf722,0x18f));var _0x2f72=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf722[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x2f72('0x0'));var util=require(_0x2f72('0x1'));var moment=require(_0x2f72('0x2'));var BPromise=require(_0x2f72('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f72('0x4'));var db=require(_0x2f72('0x5'))['db'];var utils=require(_0x2f72('0x6'));var logger=require(_0x2f72('0x7'))('rpc');var config=require(_0x2f72('0x8'));var jayson=require(_0x2f72('0x9'));var client=jayson[_0x2f72('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d4cf4,_0x30acb2,_0x3cb15e){return new BPromise(function(_0x1f3afb,_0x3adb7e){return client[_0x2f72('0xb')](_0x4d4cf4,_0x3cb15e)[_0x2f72('0xc')](function(_0x72b96f){logger[_0x2f72('0xd')](_0x2f72('0xe'),_0x30acb2,_0x2f72('0xf'));logger[_0x2f72('0x10')](_0x2f72('0x11'),_0x30acb2,_0x2f72('0xf'),JSON[_0x2f72('0x12')](_0x72b96f));if(_0x72b96f['error']){if(_0x72b96f[_0x2f72('0x13')][_0x2f72('0x14')]===0x1f4){logger[_0x2f72('0x13')](_0x2f72('0xe'),_0x30acb2,_0x72b96f[_0x2f72('0x13')][_0x2f72('0x15')]);return _0x3adb7e(_0x72b96f[_0x2f72('0x13')]['message']);}logger['error'](_0x2f72('0xe'),_0x30acb2,_0x72b96f[_0x2f72('0x13')]['message']);return _0x1f3afb(_0x72b96f[_0x2f72('0x13')][_0x2f72('0x15')]);}else{logger[_0x2f72('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x30acb2,_0x2f72('0xf'));_0x1f3afb(_0x72b96f[_0x2f72('0x16')][_0x2f72('0x15')]);}})[_0x2f72('0x17')](function(_0x2efdd9){logger[_0x2f72('0x13')](_0x2f72('0xe'),_0x30acb2,_0x2efdd9);_0x3adb7e(_0x2efdd9);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 49cf536..ccd2910 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 _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 +var _0xd824=['isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post'];(function(_0xc10eab,_0x140077){var _0x535ee4=function(_0x2868bd){while(--_0x2868bd){_0xc10eab['push'](_0xc10eab['shift']());}};_0x535ee4(++_0x140077);}(_0xd824,0x106));var _0x4d82=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd824[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var path=require(_0x4d82('0x2'));var timeout=require(_0x4d82('0x3'));var express=require(_0x4d82('0x4'));var router=express[_0x4d82('0x5')]();var auth=require(_0x4d82('0x6'));var interaction=require(_0x4d82('0x7'));var config=require(_0x4d82('0x8'));var controller=require(_0x4d82('0x9'));router[_0x4d82('0xa')]('/',auth[_0x4d82('0xb')](),controller['sendUserNotification']);module[_0x4d82('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 6a762ba..2b3924f 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 _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 +var _0x1d48=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x1ef5bb,_0x1f6f91){var _0x1083eb=function(_0x3c8975){while(--_0x3c8975){_0x1ef5bb['push'](_0x1ef5bb['shift']());}};_0x1083eb(++_0x1f6f91);}(_0x1d48,0x83));var _0x81d4=function(_0x105611,_0x41a10f){_0x105611=_0x105611-0x0;var _0x1c5859=_0x1d48[_0x105611];return _0x1c5859;};'use strict';var Sequelize=require(_0x81d4('0x0'));module[_0x81d4('0x1')]={'body':{'type':Sequelize[_0x81d4('0x2')]},'senderName':{'type':Sequelize[_0x81d4('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x81d4('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 2085f42..4471601 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 _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 +var _0x3edd=['hasOwnProperty','TemplateId','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','text','Template','findOne','render','html','catch','startCase','union','ids','queue','replace','Queue','push','all','flatten','map','html-pdf','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','limit','set','Content-Range','reject','update','destroy','then','error','stack','name','send','body'];(function(_0x4e817f,_0x416b38){var _0x31634d=function(_0x16594b){while(--_0x16594b){_0x4e817f['push'](_0x4e817f['shift']());}};_0x31634d(++_0x416b38);}(_0x3edd,0x15b));var _0xd3ed=function(_0x3c5a47,_0x541bf3){_0x3c5a47=_0x3c5a47-0x0;var _0x35390a=_0x3edd[_0x3c5a47];return _0x35390a;};'use strict';var pdf=require(_0xd3ed('0x0'));var emlformat=require(_0xd3ed('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd3ed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd3ed('0x3'));var BPromise=require(_0xd3ed('0x4'));var Mustache=require('mustache');var util=require(_0xd3ed('0x5'));var path=require(_0xd3ed('0x6'));var sox=require(_0xd3ed('0x7'));var csv=require(_0xd3ed('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3ed('0x9'));var squel=require(_0xd3ed('0xa'));var crypto=require(_0xd3ed('0xb'));var jsforce=require(_0xd3ed('0xc'));var deskjs=require(_0xd3ed('0xd'));var toCsv=require(_0xd3ed('0x8'));var querystring=require(_0xd3ed('0xe'));var Papa=require(_0xd3ed('0xf'));var Redis=require(_0xd3ed('0x10'));var authService=require(_0xd3ed('0x11'));var qs=require(_0xd3ed('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3ed('0x13'));var logger=require('../../config/logger')(_0xd3ed('0x14'));var utils=require(_0xd3ed('0x15'));var config=require(_0xd3ed('0x16'));var licenseUtil=require(_0xd3ed('0x17'));var db=require('../../mysqldb')['db'];config[_0xd3ed('0x18')]=_[_0xd3ed('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd3ed('0x1a'))(new Redis(config[_0xd3ed('0x18')]));require(_0xd3ed('0x1b'))[_0xd3ed('0x1c')](socket);function respondWithStatusCode(_0x5cb4ce,_0x2a1314){_0x2a1314=_0x2a1314||0xcc;return function(_0x167478){if(_0x167478){return _0x5cb4ce[_0xd3ed('0x1d')](_0x2a1314);}return _0x5cb4ce[_0xd3ed('0x1e')](_0x2a1314)[_0xd3ed('0x1f')]();};}function respondWithResult(_0x5324d7,_0x2bd270){_0x2bd270=_0x2bd270||0xc8;return function(_0x38f4d7){if(_0x38f4d7){return _0x5324d7[_0xd3ed('0x1e')](_0x2bd270)['json'](_0x38f4d7);}};}function respondWithFilteredResult(_0x3ecc09,_0x6c006a){return function(_0x53c10a){if(_0x53c10a){var _0x5de4e2=_0x53c10a['count'],_0x463534=_0x6c006a[_0xd3ed('0x20')],_0x5b31a6=_0x6c006a[_0xd3ed('0x20')]+_0x6c006a[_0xd3ed('0x21')],_0x1bf746;if(_0x5b31a6>=_0x5de4e2){_0x5b31a6=_0x5de4e2;_0x1bf746=0xc8;}else{_0x1bf746=0xce;}_0x3ecc09[_0xd3ed('0x1e')](_0x1bf746);return _0x3ecc09[_0xd3ed('0x22')](_0xd3ed('0x23'),_0x463534+'-'+_0x5b31a6+'/'+_0x5de4e2)['json'](_0x53c10a);}return null;};}function patchUpdates(_0x6b1407){return function(_0x2390a0){try{jsonpatch['apply'](_0x2390a0,_0x6b1407,!![]);}catch(_0x46ee15){return BPromise[_0xd3ed('0x24')](_0x46ee15);}return _0x2390a0['save']();};}function saveUpdates(_0x27763f,_0x5699aa){return function(_0x6e9642){if(_0x6e9642){return _0x6e9642[_0xd3ed('0x25')](_0x27763f)['then'](function(_0x5a2af9){return _0x5a2af9;});}return null;};}function removeEntity(_0x4ba24c,_0x39f65c){return function(_0x49c93d){if(_0x49c93d){return _0x49c93d[_0xd3ed('0x26')]()[_0xd3ed('0x27')](function(){_0x4ba24c[_0xd3ed('0x1e')](0xcc)[_0xd3ed('0x1f')]();});}};}function handleEntityNotFound(_0xc30ad0,_0x2c94ec){return function(_0x209047){if(!_0x209047){_0xc30ad0[_0xd3ed('0x1d')](0x194);}return _0x209047;};}function handleError(_0x340cc9,_0x165c6b){_0x165c6b=_0x165c6b||0x1f4;return function(_0x581187){logger[_0xd3ed('0x28')](_0x581187[_0xd3ed('0x29')]);if(_0x581187[_0xd3ed('0x2a')]){delete _0x581187[_0xd3ed('0x2a')];}_0x340cc9[_0xd3ed('0x1e')](_0x165c6b)[_0xd3ed('0x2b')](_0x581187);};}exports['sendUserNotification']=function(_0x3d527c,_0xe66b34,_0x4901e6){if(!_0x3d527c['body']['hasOwnProperty']('text')&&!_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x2d')](_0xd3ed('0x2e'))){throw new db['Sequelize']['ValidationError'](_0xd3ed('0x2f'));}else{if(_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x2d')](_0xd3ed('0x2e'))&&!_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x2d')](_0xd3ed('0x30'))){throw new db[(_0xd3ed('0x31'))][(_0xd3ed('0x32'))](_0xd3ed('0x33'));}if(!_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x2d')](_0xd3ed('0x34'))){throw new db[(_0xd3ed('0x31'))][(_0xd3ed('0x32'))](_0xd3ed('0x35'));}else{try{var _0x155bf1=JSON[_0xd3ed('0x36')](_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x34')]);}catch(_0x1d7b51){logger['error'](_0x1d7b51);throw new db[(_0xd3ed('0x31'))][(_0xd3ed('0x32'))](_0xd3ed('0x37'));}var _0x3706fd=[_0xd3ed('0x38'),'faxqueue',_0xd3ed('0x39'),_0xd3ed('0x3a'),_0xd3ed('0x3b'),_0xd3ed('0x3c'),_0xd3ed('0x3d'),_0xd3ed('0x3e'),_0xd3ed('0x3f')];if(_['some'](_0x155bf1,function(_0x3b1f23){return!_[_0xd3ed('0x40')](_0x3706fd,_0x3b1f23[_0xd3ed('0x41')][_0xd3ed('0x42')]());})){throw new db['Sequelize'][(_0xd3ed('0x32'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2e2bcf={};_0x2e2bcf[_0xd3ed('0x43')]=_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x2d')](_0xd3ed('0x43'))?_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x43')]:_0x3d527c['user']['fullname'];_0x2e2bcf[_0xd3ed('0x44')]=_[_0xd3ed('0x45')](_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x44')])?null:_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x44')];_0x2e2bcf[_0xd3ed('0x46')]=_0x3d527c[_0xd3ed('0x2c')][_0xd3ed('0x46')]||![];_0x2e2bcf[_0xd3ed('0x47')]=_0x3d527c[_0xd3ed('0x3f')]['id'];return getContent(_0x3d527c[_0xd3ed('0x2c')])[_0xd3ed('0x27')](function(_0x15f40a){_0x2e2bcf[_0xd3ed('0x2c')]=_0x15f40a;return getRecipients(_0x155bf1);})[_0xd3ed('0x27')](function(_0x1f40cd){_0x2e2bcf[_0xd3ed('0x48')]=_[_0xd3ed('0x49')](_0x1f40cd)[_0xd3ed('0x4a')](',');return db[_0xd3ed('0x4b')]['transaction'](function(_0x55fef7){return db[_0xd3ed('0x4c')][_0xd3ed('0x4d')](_0x2e2bcf,{'raw':!![],'transaction':_0x55fef7})['then'](function(_0x3f62dd){var _0x4aad41={'sender':_0x2e2bcf['senderName'],'description':_0x2e2bcf[_0xd3ed('0x44')],'content':_0x2e2bcf[_0xd3ed('0x2c')],'beep':_0x2e2bcf[_0xd3ed('0x46')]};_0x1f40cd[_0xd3ed('0x4e')](function(_0xb0ba5c){_0x4aad41[_0xd3ed('0x4f')]=_0xb0ba5c;socket[_0xd3ed('0x50')](_0xd3ed('0x51'),_0x4aad41);});return _0x3f62dd;});});})['then'](respondWithResult(_0xe66b34,0xc9))['catch'](handleError(_0xe66b34,null));};function getContent(_0x455e36){return new BPromise(function(_0x1cdbf3,_0x1641c5){if(_0x455e36[_0xd3ed('0x52')]){_0x1cdbf3(_0x455e36[_0xd3ed('0x52')]);return;}return db[_0xd3ed('0x53')][_0xd3ed('0x54')]({'attributes':['html'],'where':{'id':_0x455e36[_0xd3ed('0x2e')]},'raw':!![]})[_0xd3ed('0x27')](function(_0x5e0222){if(!_0x5e0222)throw new db['Sequelize'][(_0xd3ed('0x32'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x3c01f6=Mustache[_0xd3ed('0x55')](_0x5e0222[_0xd3ed('0x56')],_0x455e36[_0xd3ed('0x30')]);_0x1cdbf3(_0x3c01f6);})[_0xd3ed('0x57')](function(_0x2fbd56){_0x1641c5(_0x2fbd56);});});}function getRecipients(_0xb06be0){return new BPromise(function(_0x2b7408,_0x9b8ade){var _0x14de80=[];var _0xb6edaa=[];_0xb06be0['forEach'](function(_0x195053){var _0x18b2c6=_[_0xd3ed('0x58')](_0x195053['model'][_0xd3ed('0x42')]());if(_0x18b2c6==='User'){_0x14de80=_[_0xd3ed('0x59')](_0x14de80,_0x195053[_0xd3ed('0x5a')]);}else{if(_[_0xd3ed('0x40')](_0x18b2c6,_0xd3ed('0x5b')))_0x18b2c6=_0x18b2c6[_0xd3ed('0x5c')](_0xd3ed('0x5b'),_0xd3ed('0x5d'));_0x195053[_0xd3ed('0x5a')][_0xd3ed('0x4e')](function(_0x34c4c9){_0xb6edaa[_0xd3ed('0x5e')](getAgents(_0x18b2c6,_0x34c4c9));});}});return BPromise[_0xd3ed('0x5f')](_0xb6edaa)['then'](function(_0xd942e7){_0x14de80=_[_0xd3ed('0x59')](_0x14de80,_[_0xd3ed('0x60')](_0xd942e7));_0x2b7408(_0x14de80);})[_0xd3ed('0x57')](function(_0x4d1751){_0x9b8ade(_0x4d1751);});});}function getAgents(_0xc6e0ad,_0x1dc171){return new BPromise(function(_0x2d7d22,_0x4511b6){return db[_0xc6e0ad]['findOne']({'where':{'id':_0x1dc171}})[_0xd3ed('0x27')](function(_0x1ceaa1){return _0x1ceaa1['getAgents']({'attributes':['id'],'raw':!![]})[_0xd3ed('0x27')](function(_0x3cfff5){var _0x546368=_[_0xd3ed('0x61')](_0x3cfff5,'id');_0x2d7d22(_0x546368);});})['catch'](function(_0x54eb49){_0x4511b6(_0x54eb49);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f539076..842cdc5 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 _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 +var _0x81bd=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0x196821,_0x18f79a){var _0x19b1a6=function(_0xef8848){while(--_0xef8848){_0x196821['push'](_0x196821['shift']());}};_0x19b1a6(++_0x18f79a);}(_0x81bd,0x7c));var _0xd81b=function(_0x547bb6,_0x2d6f27){_0x547bb6=_0x547bb6-0x0;var _0x1a9154=_0x81bd[_0x547bb6];return _0x1a9154;};'use strict';var EventEmitter=require(_0xd81b('0x0'));var UserNotification=require(_0xd81b('0x1'))['db'][_0xd81b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xd81b('0x3')](0x0);var events={'afterCreate':_0xd81b('0x4'),'afterUpdate':_0xd81b('0x5'),'afterDestroy':_0xd81b('0x6')};function emitEvent(_0x54e096){return function(_0x16e8de,_0x2c3d9e,_0x1b6cfe){UserNotificationEvents['emit'](_0x54e096+':'+_0x16e8de['id'],_0x16e8de);UserNotificationEvents[_0xd81b('0x7')](_0x54e096,_0x16e8de);_0x1b6cfe(null);};}for(var e in events){if(events[_0xd81b('0x8')](e)){var event=events[e];UserNotification[_0xd81b('0x9')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7e3786a..549be36 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 _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 +var _0xceb0=['UserNotification','userNotifications','utf8mb4_unicode_ci','moment','request-promise','path','rimraf','exports'];(function(_0x131701,_0x2dc505){var _0x2698d4=function(_0x411131){while(--_0x411131){_0x131701['push'](_0x131701['shift']());}};_0x2698d4(++_0x2dc505);}(_0xceb0,0x173));var _0x0ceb=function(_0x3b10ac,_0x4e875f){_0x3b10ac=_0x3b10ac-0x0;var _0x4d402e=_0xceb0[_0x3b10ac];return _0x4d402e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0ceb('0x0'));var BPromise=require('bluebird');var rp=require(_0x0ceb('0x1'));var fs=require('fs');var path=require(_0x0ceb('0x2'));var rimraf=require(_0x0ceb('0x3'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module[_0x0ceb('0x4')]=function(_0x218237,_0x3f650d){return _0x218237['define'](_0x0ceb('0x5'),attributes,{'tableName':_0x0ceb('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0ceb('0x7')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index d7f2061..cae2df9 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 _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 +var _0x515a=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x515a,0xfb));var _0xa515=function(_0x96319,_0x45ecdc){_0x96319=_0x96319-0x0;var _0x562b2c=_0x515a[_0x96319];return _0x562b2c;};'use strict';var _=require(_0xa515('0x0'));var util=require(_0xa515('0x1'));var moment=require(_0xa515('0x2'));var BPromise=require('bluebird');var rs=require(_0xa515('0x3'));var fs=require('fs');var Redis=require(_0xa515('0x4'));var db=require(_0xa515('0x5'))['db'];var utils=require(_0xa515('0x6'));var logger=require(_0xa515('0x7'))(_0xa515('0x8'));var config=require(_0xa515('0x9'));var jayson=require(_0xa515('0xa'));var client=jayson[_0xa515('0xb')][_0xa515('0xc')]({'port':0x232a});config['redis']=_[_0xa515('0xd')](config[_0xa515('0xe')],{'host':_0xa515('0xf'),'port':0x18eb});var socket=require(_0xa515('0x10'))(new Redis(config[_0xa515('0xe')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x398b47,_0x2ad460,_0x45c13b){return new BPromise(function(_0x32c8ae,_0x289a64){return client[_0xa515('0x11')](_0x398b47,_0x45c13b)[_0xa515('0x12')](function(_0x1e8757){logger[_0xa515('0x13')](_0xa515('0x14'),_0x2ad460,_0xa515('0x15'));logger[_0xa515('0x16')](_0xa515('0x17'),_0x2ad460,_0xa515('0x15'),JSON['stringify'](_0x1e8757));if(_0x1e8757['error']){if(_0x1e8757[_0xa515('0x18')][_0xa515('0x19')]===0x1f4){logger['error'](_0xa515('0x14'),_0x2ad460,_0x1e8757['error'][_0xa515('0x1a')]);return _0x289a64(_0x1e8757[_0xa515('0x18')][_0xa515('0x1a')]);}logger[_0xa515('0x18')](_0xa515('0x14'),_0x2ad460,_0x1e8757['error'][_0xa515('0x1a')]);return _0x32c8ae(_0x1e8757[_0xa515('0x18')]['message']);}else{logger[_0xa515('0x13')]('UserNotification,\x20%s,\x20%s',_0x2ad460,_0xa515('0x15'));_0x32c8ae(_0x1e8757['result'][_0xa515('0x1a')]);}})[_0xa515('0x1b')](function(_0x3dd3c8){logger[_0xa515('0x18')]('UserNotification,\x20%s,\x20%s',_0x2ad460,_0x3dd3c8);_0x289a64(_0x3dd3c8);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 55c6110..9e9fa53 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 _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 +var _0xdcc4=['./userNotification.events','save','remove','update','emit','removeListener','register','length','userNotification:'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xdcc4,0xea));var _0x4dcc=function(_0x3929fb,_0x4d2593){_0x3929fb=_0x3929fb-0x0;var _0x2898fb=_0xdcc4[_0x3929fb];return _0x2898fb;};'use strict';var UserNotificationEvents=require(_0x4dcc('0x0'));var events=[_0x4dcc('0x1'),_0x4dcc('0x2'),_0x4dcc('0x3')];function createListener(_0x17fde8,_0x4b6388){return function(_0x128a7b){_0x4b6388[_0x4dcc('0x4')](_0x17fde8,_0x128a7b);};}function removeListener(_0x416d97,_0x30c165){return function(){UserNotificationEvents[_0x4dcc('0x5')](_0x416d97,_0x30c165);};}exports[_0x4dcc('0x6')]=function(_0x5ce6e6){for(var _0x1f8ef7=0x0,_0x5561be=events[_0x4dcc('0x7')];_0x1f8ef7<_0x5561be;_0x1f8ef7++){var _0x1634f2=events[_0x1f8ef7];var _0x461e9c=createListener(_0x4dcc('0x8')+_0x1634f2,_0x5ce6e6);UserNotificationEvents['on'](_0x1634f2,_0x461e9c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index edc0aaa..3ba5349 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 _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 +var _0xa5f7=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x23d274,_0x7e1ebe){var _0x2b0f72=function(_0x464e30){while(--_0x464e30){_0x23d274['push'](_0x23d274['shift']());}};_0x2b0f72(++_0x7e1ebe);}(_0xa5f7,0xd0));var _0x7a5f=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xa5f7[_0x903228];return _0xcec81d;};'use strict';var multer=require('multer');var util=require(_0x7a5f('0x0'));var path=require(_0x7a5f('0x1'));var timeout=require(_0x7a5f('0x2'));var express=require('express');var router=express[_0x7a5f('0x3')]();var auth=require(_0x7a5f('0x4'));var interaction=require(_0x7a5f('0x5'));var config=require(_0x7a5f('0x6'));module[_0x7a5f('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index a06f11f..63ec9ff 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 _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 +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x295469,_0x16afe4){var _0x584b02=function(_0x5bcb66){while(--_0x5bcb66){_0x295469['push'](_0x295469['shift']());}};_0x584b02(++_0x16afe4);}(_0xe706,0xa3));var _0x6e70=function(_0x584789,_0x1f4b10){_0x584789=_0x584789-0x0;var _0x57c028=_0xe706[_0x584789];return _0x57c028;};'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 742dcba..70012fe 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 _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 +var _0x5282=['define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x38ed42,_0x3d9a37){var _0x474931=function(_0x1fa601){while(--_0x1fa601){_0x38ed42['push'](_0x38ed42['shift']());}};_0x474931(++_0x3d9a37);}(_0x5282,0x162));var _0x2528=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0x5282[_0xf44d98];return _0x5ebb04;};'use strict';var _=require(_0x2528('0x0'));var util=require(_0x2528('0x1'));var logger=require('../../config/logger')(_0x2528('0x2'));var moment=require('moment');var BPromise=require(_0x2528('0x3'));var rp=require(_0x2528('0x4'));var fs=require('fs');var path=require(_0x2528('0x5'));var rimraf=require(_0x2528('0x6'));var config=require(_0x2528('0x7'));var attributes=require(_0x2528('0x8'));module[_0x2528('0x9')]=function(_0xfa3216,_0x56dbec){return _0xfa3216[_0x2528('0xa')](_0x2528('0xb'),attributes,{'tableName':_0x2528('0xc'),'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 1ac4740..414af5e 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 _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 +var _0x6b63=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent'];(function(_0x21060f,_0x433842){var _0x526ca7=function(_0xfd3eb3){while(--_0xfd3eb3){_0x21060f['push'](_0x21060f['shift']());}};_0x526ca7(++_0x433842);}(_0x6b63,0x1e0));var _0x36b6=function(_0x651b52,_0x2b4db3){_0x651b52=_0x651b52-0x0;var _0x362104=_0x6b63[_0x651b52];return _0x362104;};'use strict';var _=require(_0x36b6('0x0'));var util=require(_0x36b6('0x1'));var moment=require(_0x36b6('0x2'));var BPromise=require(_0x36b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x36b6('0x4'))['db'];var utils=require(_0x36b6('0x5'));var logger=require(_0x36b6('0x6'))(_0x36b6('0x7'));var config=require(_0x36b6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x36b6('0x9')][_0x36b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99742a,_0x5302e1,_0xdb99ec){return new BPromise(function(_0x4577fa,_0x3ca633){return client[_0x36b6('0xb')](_0x99742a,_0xdb99ec)['then'](function(_0xad0eb0){logger[_0x36b6('0xc')](_0x36b6('0xd'),_0x5302e1,'request\x20sent');logger[_0x36b6('0xe')](_0x36b6('0xf'),_0x5302e1,'request\x20sent',JSON['stringify'](_0xad0eb0));if(_0xad0eb0[_0x36b6('0x10')]){if(_0xad0eb0[_0x36b6('0x10')][_0x36b6('0x11')]===0x1f4){logger[_0x36b6('0x10')](_0x36b6('0xd'),_0x5302e1,_0xad0eb0[_0x36b6('0x10')][_0x36b6('0x12')]);return _0x3ca633(_0xad0eb0[_0x36b6('0x10')][_0x36b6('0x12')]);}logger['error'](_0x36b6('0xd'),_0x5302e1,_0xad0eb0[_0x36b6('0x10')][_0x36b6('0x12')]);return _0x4577fa(_0xad0eb0['error'][_0x36b6('0x12')]);}else{logger[_0x36b6('0xc')](_0x36b6('0xd'),_0x5302e1,_0x36b6('0x13'));_0x4577fa(_0xad0eb0['result'][_0x36b6('0x12')]);}})['catch'](function(_0x446940){logger[_0x36b6('0x10')](_0x36b6('0xd'),_0x5302e1,_0x446940);_0x3ca633(_0x446940);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 18e629d..4b2976d 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 _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 +var _0xd1e6=['/:id/sections','/:id/resources','post','create','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x5990d7,_0x272454){var _0x14bdbb=function(_0x8384de){while(--_0x8384de){_0x5990d7['push'](_0x5990d7['shift']());}};_0x14bdbb(++_0x272454);}(_0xd1e6,0x159));var _0x6d1e=function(_0x5927ab,_0x354328){_0x5927ab=_0x5927ab-0x0;var _0x10b3e0=_0xd1e6[_0x5927ab];return _0x10b3e0;};'use strict';var multer=require(_0x6d1e('0x0'));var util=require(_0x6d1e('0x1'));var path=require(_0x6d1e('0x2'));var timeout=require(_0x6d1e('0x3'));var express=require(_0x6d1e('0x4'));var router=express[_0x6d1e('0x5')]();var auth=require(_0x6d1e('0x6'));var interaction=require(_0x6d1e('0x7'));var config=require('../../config/environment');var controller=require(_0x6d1e('0x8'));router[_0x6d1e('0x9')]('/',auth[_0x6d1e('0xa')](),controller[_0x6d1e('0xb')]);router[_0x6d1e('0x9')](_0x6d1e('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6d1e('0x9')](_0x6d1e('0xd'),auth[_0x6d1e('0xa')](),controller[_0x6d1e('0xe')]);router['get'](_0x6d1e('0xf'),auth['isAuthenticated'](),controller['getSections']);router[_0x6d1e('0x9')](_0x6d1e('0x10'),auth[_0x6d1e('0xa')](),controller['getResources']);router[_0x6d1e('0x11')]('/',auth[_0x6d1e('0xa')](),controller[_0x6d1e('0x12')]);router['post'](_0x6d1e('0x13'),auth['isAuthenticated'](),controller[_0x6d1e('0x14')]);router[_0x6d1e('0x11')](_0x6d1e('0xf'),auth[_0x6d1e('0xa')](),controller[_0x6d1e('0x15')]);router['post'](_0x6d1e('0x10'),auth['isAuthenticated'](),controller[_0x6d1e('0x16')]);router[_0x6d1e('0x17')]('/:id',auth[_0x6d1e('0xa')](),controller[_0x6d1e('0x18')]);router[_0x6d1e('0x19')]('/:id',auth[_0x6d1e('0xa')](),controller[_0x6d1e('0x1a')]);router[_0x6d1e('0x19')]('/:id/sections',auth[_0x6d1e('0xa')](),controller[_0x6d1e('0x1b')]);router[_0x6d1e('0x19')](_0x6d1e('0x10'),auth[_0x6d1e('0xa')](),controller[_0x6d1e('0x1c')]);module[_0x6d1e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 4d1a777..98a348e 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 _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 +var _0x0294=['setDataValue','getDataValue','crudPermissions','split','sequelize','exports','STRING'];(function(_0x8ec1b5,_0x489642){var _0x8e1dff=function(_0x28e33d){while(--_0x28e33d){_0x8ec1b5['push'](_0x8ec1b5['shift']());}};_0x8e1dff(++_0x489642);}(_0x0294,0xb3));var _0x4029=function(_0x3d7670,_0xd5dc58){_0x3d7670=_0x3d7670-0x0;var _0x3ae54f=_0x0294[_0x3d7670];return _0x3ae54f;};'use strict';var Sequelize=require(_0x4029('0x0'));module[_0x4029('0x1')]={'name':{'type':Sequelize[_0x4029('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x4029('0x2')],'set':function(_0x2ae427){this[_0x4029('0x3')]('crudPermissions',_0x2ae427?_0x2ae427['join'](''):[]);},'get':function(){return this[_0x4029('0x4')](_0x4029('0x5'))?this[_0x4029('0x4')]('crudPermissions')[_0x4029('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4029('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index d09d280..0678de8 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 _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 +var _0x025c=['limit','Content-Range','then','sendStatus','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','catch','show','include','find','create','body','clone','params','get','createdAt','updatedAt','crudPermissions','UserProfileSection','findAll','each','autoAssociation','omit','sectionId','userProfileId','Resources','update','destroy','describe','addSections','sequelize','transaction','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','subsections','findOne','forEach','resourceId','bulkCreate','removeResources','getResources','undefined','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','parentSections','ignore','isEmpty','all','order','sort','AnalyticExtractedReport','foreignKey','associatedResources','field','reportType','default','DefaultReports','CustomReports','rows','CmContact','Tag','Tags','tag','ThroughTags','color','value','toLowerCase','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','JscriptyProject','contacts','Lists','ListId','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','voicerecordings','Agents','User','role','agent','membername','VoiceQueues','VoiceQueue','inbound','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','whatsappqueues','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','agents','admin','user','Telephones','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Interval','pauses','Pause','scheduler','sounds','Sound','tags','templates','Template','triggers','trunks','Trunk','variables','Variable','plugins','Plugin','metrics','AnalyticMetric','WhatsappAccount','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./userProfile.socket','status','end','json','count','offset'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x025c,0x1ad));var _0xc025=function(_0x1d732c,_0x4f2f25){_0x1d732c=_0x1d732c-0x0;var _0x1c4a05=_0x025c[_0x1d732c];return _0x1c4a05;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc025('0x0'));var rimraf=require(_0xc025('0x1'));var zipdir=require(_0xc025('0x2'));var jsonpatch=require(_0xc025('0x3'));var rp=require(_0xc025('0x4'));var moment=require(_0xc025('0x5'));var BPromise=require(_0xc025('0x6'));var Mustache=require(_0xc025('0x7'));var util=require(_0xc025('0x8'));var path=require('path');var sox=require(_0xc025('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc025('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc025('0xb'));var toCsv=require(_0xc025('0xc'));var querystring=require('querystring');var Papa=require(_0xc025('0xd'));var Redis=require(_0xc025('0xe'));var authService=require(_0xc025('0xf'));var qs=require(_0xc025('0x10'));var as=require(_0xc025('0x11'));var hardwareService=require(_0xc025('0x12'));var logger=require(_0xc025('0x13'))(_0xc025('0x14'));var utils=require(_0xc025('0x15'));var config=require(_0xc025('0x16'));var licenseUtil=require(_0xc025('0x17'));var db=require(_0xc025('0x18'))['db'];config[_0xc025('0x19')]=_['defaults'](config[_0xc025('0x19')],{'host':_0xc025('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc025('0x19')]));require(_0xc025('0x1b'))['register'](socket);function respondWithStatusCode(_0xd599cf,_0x34053b){_0x34053b=_0x34053b||0xcc;return function(_0x59c3fb){if(_0x59c3fb){return _0xd599cf['sendStatus'](_0x34053b);}return _0xd599cf[_0xc025('0x1c')](_0x34053b)[_0xc025('0x1d')]();};}function respondWithResult(_0x5bec19,_0x3db10b){_0x3db10b=_0x3db10b||0xc8;return function(_0x52c743){if(_0x52c743){return _0x5bec19[_0xc025('0x1c')](_0x3db10b)[_0xc025('0x1e')](_0x52c743);}};}function respondWithFilteredResult(_0x5b1ff3,_0x1bbcff){return function(_0x159a26){if(_0x159a26){var _0x4e6853=_0x159a26[_0xc025('0x1f')],_0x110789=_0x1bbcff[_0xc025('0x20')],_0x49e6b1=_0x1bbcff[_0xc025('0x20')]+_0x1bbcff[_0xc025('0x21')],_0x45f408;if(_0x49e6b1>=_0x4e6853){_0x49e6b1=_0x4e6853;_0x45f408=0xc8;}else{_0x45f408=0xce;}_0x5b1ff3[_0xc025('0x1c')](_0x45f408);return _0x5b1ff3['set'](_0xc025('0x22'),_0x110789+'-'+_0x49e6b1+'/'+_0x4e6853)[_0xc025('0x1e')](_0x159a26);}return null;};}function patchUpdates(_0x21cc31){return function(_0x39a609){try{jsonpatch['apply'](_0x39a609,_0x21cc31,!![]);}catch(_0x59276e){return BPromise['reject'](_0x59276e);}return _0x39a609['save']();};}function saveUpdates(_0x519098,_0x436a01){return function(_0x30779a){if(_0x30779a){return _0x30779a['update'](_0x519098)[_0xc025('0x23')](function(_0x5a19b6){return _0x5a19b6;});}return null;};}function removeEntity(_0x1eccaa,_0x3e0ca5){return function(_0x546a8e){if(_0x546a8e){return _0x546a8e['destroy']()[_0xc025('0x23')](function(){_0x1eccaa[_0xc025('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e6f63,_0x442bce){return function(_0x2268d2){if(!_0x2268d2){_0x2e6f63[_0xc025('0x24')](0x194);}return _0x2268d2;};}function handleError(_0x1192b5,_0x1232fa){_0x1232fa=_0x1232fa||0x1f4;return function(_0x3b7b94){logger[_0xc025('0x25')](_0x3b7b94[_0xc025('0x26')]);if(_0x3b7b94['name']){delete _0x3b7b94[_0xc025('0x27')];}_0x1192b5[_0xc025('0x1c')](_0x1232fa)[_0xc025('0x28')](_0x3b7b94);};}exports[_0xc025('0x29')]=function(_0x412985,_0x2938fd){var _0x48b151={},_0x4158c9={},_0x481d23={'count':0x0,'rows':[]};var _0x3225e4=_[_0xc025('0x2a')](db[_0xc025('0x2b')][_0xc025('0x2c')],function(_0x3e9272){return{'name':_0x3e9272[_0xc025('0x2d')],'type':_0x3e9272[_0xc025('0x2e')]['key']};});_0x4158c9[_0xc025('0x2f')]=_[_0xc025('0x2a')](_0x3225e4,_0xc025('0x27'));_0x4158c9[_0xc025('0x30')]=_[_0xc025('0x31')](_0x412985[_0xc025('0x30')]);_0x4158c9['filters']=_[_0xc025('0x32')](_0x4158c9[_0xc025('0x2f')],_0x4158c9['query']);_0x48b151[_0xc025('0x33')]=_['intersection'](_0x4158c9['model'],qs['fields'](_0x412985[_0xc025('0x30')][_0xc025('0x34')]));_0x48b151[_0xc025('0x33')]=_0x48b151[_0xc025('0x33')][_0xc025('0x35')]?_0x48b151[_0xc025('0x33')]:_0x4158c9['model'];if(!_0x412985[_0xc025('0x30')][_0xc025('0x36')](_0xc025('0x37'))){_0x48b151[_0xc025('0x21')]=qs[_0xc025('0x21')](_0x412985[_0xc025('0x30')][_0xc025('0x21')]);_0x48b151['offset']=qs[_0xc025('0x20')](_0x412985[_0xc025('0x30')][_0xc025('0x20')]);}_0x48b151['order']=qs['sort'](_0x412985[_0xc025('0x30')]['sort']);_0x48b151[_0xc025('0x38')]=qs[_0xc025('0x39')](_[_0xc025('0x3a')](_0x412985[_0xc025('0x30')],_0x4158c9[_0xc025('0x39')]),_0x3225e4);if(_0x412985[_0xc025('0x30')][_0xc025('0x3b')]){_0x48b151[_0xc025('0x38')]=_['merge'](_0x48b151[_0xc025('0x38')],{'$or':_['map'](_0x3225e4,function(_0x3dae9e){if(_0x3dae9e[_0xc025('0x2e')]!==_0xc025('0x3c')){var _0x2e51bc={};_0x2e51bc[_0x3dae9e[_0xc025('0x27')]]={'$like':'%'+_0x412985['query'][_0xc025('0x3b')]+'%'};return _0x2e51bc;}})});}_0x48b151=_[_0xc025('0x3d')]({},_0x48b151,_0x412985[_0xc025('0x3e')]);var _0x2d5c88={'where':_0x48b151['where']};return db['UserProfile'][_0xc025('0x1f')](_0x2d5c88)[_0xc025('0x23')](function(_0x12aa44){_0x481d23['count']=_0x12aa44;if(_0x412985[_0xc025('0x30')][_0xc025('0x3f')]){_0x48b151['include']=[{'all':!![]}];}return db[_0xc025('0x2b')]['findAll'](_0x48b151);})['then'](function(_0xdd5ee3){_0x481d23['rows']=_0xdd5ee3;return _0x481d23;})[_0xc025('0x23')](respondWithFilteredResult(_0x2938fd,_0x48b151))[_0xc025('0x40')](handleError(_0x2938fd,null));};exports[_0xc025('0x41')]=function(_0x2986d8,_0x3c3fab){var _0x16cc85={'raw':![],'where':{'id':_0x2986d8['params']['id']}},_0x2ff812={};_0x2ff812['model']=_[_0xc025('0x31')](db[_0xc025('0x2b')][_0xc025('0x2c')]);_0x2ff812[_0xc025('0x30')]=_['keys'](_0x2986d8['query']);_0x2ff812[_0xc025('0x39')]=_[_0xc025('0x32')](_0x2ff812[_0xc025('0x2f')],_0x2ff812[_0xc025('0x30')]);_0x16cc85[_0xc025('0x33')]=_[_0xc025('0x32')](_0x2ff812['model'],qs[_0xc025('0x34')](_0x2986d8[_0xc025('0x30')]['fields']));_0x16cc85[_0xc025('0x33')]=_0x16cc85['attributes'][_0xc025('0x35')]?_0x16cc85[_0xc025('0x33')]:_0x2ff812[_0xc025('0x2f')];if(_0x2986d8[_0xc025('0x30')][_0xc025('0x3f')]){_0x16cc85[_0xc025('0x42')]=[{'all':!![]}];}_0x16cc85=_['merge']({},_0x16cc85,_0x2986d8[_0xc025('0x3e')]);return db[_0xc025('0x2b')][_0xc025('0x43')](_0x16cc85)['then'](handleEntityNotFound(_0x3c3fab,null))[_0xc025('0x23')](respondWithResult(_0x3c3fab,null))[_0xc025('0x40')](handleError(_0x3c3fab,null));};exports[_0xc025('0x44')]=function(_0x3ff5c4,_0x347a1c){return db[_0xc025('0x2b')][_0xc025('0x44')](_0x3ff5c4[_0xc025('0x45')],{})[_0xc025('0x23')](respondWithResult(_0x347a1c,0xc9))[_0xc025('0x40')](handleError(_0x347a1c,null));};exports[_0xc025('0x46')]=function(_0x446efd,_0x35b745){var _0x1ad041={'where':{'id':_0x446efd[_0xc025('0x47')]['id']}},_0x33da2e={};_0x33da2e['model']=_[_0xc025('0x31')](db[_0xc025('0x2b')][_0xc025('0x2c')]);_0x1ad041[_0xc025('0x33')]=_['intersection'](_0x33da2e[_0xc025('0x2f')],qs['fields'](_0x446efd[_0xc025('0x30')][_0xc025('0x34')]));_0x1ad041[_0xc025('0x33')]=_0x1ad041[_0xc025('0x33')][_0xc025('0x35')]?_0x1ad041[_0xc025('0x33')]:_0x33da2e['model'];if(_0x446efd['query'][_0xc025('0x3f')]){_0x1ad041[_0xc025('0x42')]=[{'all':!![]}];}_0x1ad041=_[_0xc025('0x3d')]({},_0x1ad041,_0x446efd['options']);return db[_0xc025('0x2b')]['find'](_0x1ad041)[_0xc025('0x23')](handleEntityNotFound(_0x35b745,null))[_0xc025('0x23')](function(_0x8b3a06){if(_0x8b3a06){var _0x505d45=_0x8b3a06[_0xc025('0x48')]({'plain':!![]});_0x505d45=qs['omit'](_0x505d45,['id',_0xc025('0x49'),_0xc025('0x4a'),_0xc025('0x4b')]);_0x446efd['body']=_['omit'](_0x446efd[_0xc025('0x45')],['id',_0xc025('0x49'),_0xc025('0x4a')]);return db['sequelize']['transaction'](function(_0x2613a2){return db[_0xc025('0x2b')][_0xc025('0x44')](_['merge'](_0x505d45,_0x446efd[_0xc025('0x45')]),{'include':_0x446efd[_0xc025('0x30')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x2613a2})[_0xc025('0x23')](function(_0x15183b){var _0x58123a=_0x15183b[_0xc025('0x48')]({'plain':!![]});return db[_0xc025('0x4c')][_0xc025('0x4d')]({'where':{'userProfileId':_0x446efd[_0xc025('0x47')]['id']},'raw':!![]})[_0xc025('0x23')](function(_0xc5e56b){if(_0xc5e56b){return BPromise[_0xc025('0x4e')](_0xc5e56b,function(_0x5ae87d){return new BPromise(function(_0x165591,_0x56b006){if(_0x5ae87d[_0xc025('0x4f')]===null||_0x5ae87d[_0xc025('0x4f')]===0x1)_0x165591(null);return db['UserProfileResource'][_0xc025('0x4d')]({'where':{'sectionId':_0x5ae87d['id']},'raw':!![]})['then'](function(_0x307a9d){var _0x1a7410=_['map'](_0x307a9d,function(_0xac2337){return qs[_0xc025('0x50')](_0xac2337,['id',_0xc025('0x49'),'updatedAt',_0xc025('0x51')]);});_0x165591(_0x1a7410);})[_0xc025('0x40')](function(_0x171cf6){_0x56b006(_0x171cf6);});})[_0xc025('0x23')](function(_0x25115e){var _0x34781f=qs['omit'](_0x5ae87d,['id',_0xc025('0x49'),_0xc025('0x4a')]);_0x34781f[_0xc025('0x52')]=_0x58123a['id'];if(_0x25115e)_0x34781f[_0xc025('0x53')]=_0x25115e;return _0x34781f;})[_0xc025('0x23')](function(_0x4d548b){return db[_0xc025('0x4c')]['create'](_0x4d548b,{'include':[{'model':db['UserProfileResource'],'as':_0xc025('0x53')}],'raw':!![],'transaction':_0x2613a2});});})[_0xc025('0x23')](function(){return _0x58123a;});}});});});}})[_0xc025('0x23')](respondWithResult(_0x35b745,0xc9))[_0xc025('0x40')](handleError(_0x35b745,null));};exports[_0xc025('0x54')]=function(_0x4bd0b3,_0x44a730){if(_0x4bd0b3[_0xc025('0x45')]['id']){delete _0x4bd0b3['body']['id'];}return db[_0xc025('0x2b')][_0xc025('0x43')]({'where':{'id':_0x4bd0b3[_0xc025('0x47')]['id']}})[_0xc025('0x23')](handleEntityNotFound(_0x44a730,null))[_0xc025('0x23')](saveUpdates(_0x4bd0b3[_0xc025('0x45')],null))['then'](respondWithResult(_0x44a730,null))['catch'](handleError(_0x44a730,null));};exports[_0xc025('0x55')]=function(_0x337fc4,_0xea71a){return db[_0xc025('0x2b')]['find']({'where':{'id':_0x337fc4[_0xc025('0x47')]['id']}})[_0xc025('0x23')](handleEntityNotFound(_0xea71a,null))[_0xc025('0x23')](removeEntity(_0xea71a,null))[_0xc025('0x40')](handleError(_0xea71a,null));};exports['describe']=function(_0x2cbfa6,_0x10d8ae){return db[_0xc025('0x2b')][_0xc025('0x56')]()[_0xc025('0x23')](respondWithResult(_0x10d8ae,null))[_0xc025('0x40')](handleError(_0x10d8ae,null));};exports[_0xc025('0x57')]=function(_0x37a507,_0x1a8aa5){var _0x18a849=_0x37a507[_0xc025('0x45')];return db[_0xc025('0x2b')][_0xc025('0x43')]({'where':{'id':_0x37a507[_0xc025('0x47')]['id']}})[_0xc025('0x23')](handleEntityNotFound(_0x1a8aa5,null))[_0xc025('0x23')](function(_0x17aa56){if(_0x17aa56){return db[_0xc025('0x58')][_0xc025('0x59')](function(_0x15d556){return db[_0xc025('0x4c')]['destroy']({'where':{'userProfileId':_0x37a507[_0xc025('0x47')]['id'],'sectionId':_[_0xc025('0x2a')](_0x18a849,function(_0x1a570b){return _0x1a570b[_0xc025('0x51')];})},'transaction':_0x15d556})[_0xc025('0x23')](function(){var _0x528efd=_[_0xc025('0x2a')](_0x18a849,function(_0x331bdd){_0x331bdd[_0xc025('0x52')]=_0x37a507[_0xc025('0x47')]['id'];return _0x331bdd;});var _0x3a97a9=[];return BPromise[_0xc025('0x4e')](_0x528efd,function(_0x5e1703){return db[_0xc025('0x4c')][_0xc025('0x44')](_0x5e1703,{'include':[{'model':db[_0xc025('0x5a')],'as':_0xc025('0x53')}],'raw':!![],'transaction':_0x15d556})[_0xc025('0x23')](function(_0x1a6deb){_0x3a97a9[_0xc025('0x5b')](_0x1a6deb['get']({'plain':!![]}));});})[_0xc025('0x23')](function(){return _0x3a97a9;});});});}})[_0xc025('0x23')](function(_0xb11424){return _0xb11424;})[_0xc025('0x23')](respondWithResult(_0x1a8aa5,null))[_0xc025('0x40')](handleError(_0x1a8aa5,null));};exports[_0xc025('0x5c')]=function(_0x38647e,_0x550937){var _0x1141cd;return db[_0xc025('0x2b')][_0xc025('0x43')]({'where':{'id':_0x38647e['params']['id']},'attributes':['id',_0xc025('0x27')]})[_0xc025('0x23')](handleEntityNotFound(_0x550937,null))[_0xc025('0x23')](function(_0x247fd6){if(_0x247fd6){_0x1141cd=_0x247fd6;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x38647e[_0xc025('0x47')]['id'],'sectionId':_0x38647e[_0xc025('0x30')][_0xc025('0x5d')]}});}})[_0xc025('0x23')](function(){return _0x1141cd;})[_0xc025('0x23')](respondWithStatusCode(_0x550937,null))[_0xc025('0x40')](handleError(_0x550937,null));};exports[_0xc025('0x5e')]=function(_0x59be3b,_0x2fe768){var _0x4cdc56=[];var _0x252e79=[];return db[_0xc025('0x4c')][_0xc025('0x4d')]({'where':{'userProfileId':_0x59be3b['params']['id']},'raw':!![]})[_0xc025('0x23')](function(_0x4f162a){_0x4cdc56=_[_0xc025('0x3b')](_0x4f162a,function(_0x540932){return _0x540932[_0xc025('0x5f')]===0x1||_['includes']([0x3eb,0x709],_0x540932['sectionId']);});if(!_['isEmpty'](_0x4cdc56)){return _[_0xc025('0x2a')](_0x4cdc56,function(_0x2016bb){return _0x2016bb[_0xc025('0x51')];});}else{return;}})['then'](function(_0x19e23d){if(_0x19e23d)_0x252e79=_0x19e23d;if(_[_0xc025('0x60')](_0x252e79,0x64)){var _0x4afaad=_['find'](_0x4cdc56,{'sectionId':0x64});return hasDefaultDashboard(_0x4afaad)[_0xc025('0x23')](function(_0x3740f7){return _[_0xc025('0x2a')](_0x4cdc56,function(_0x901cde){if(_0x901cde['sectionId']===0x64){_0x901cde[_0xc025('0x61')]=_0x3740f7;}return _0x901cde;});});}else{return;}})[_0xc025('0x23')](function(_0x9784f8){if(_0x9784f8)_0x4cdc56=_0x9784f8;if(_[_0xc025('0x60')](_0x252e79,0x3eb)){var _0x338e72=_[_0xc025('0x43')](_0x4cdc56,{'sectionId':0x3eb});return getCustomDashboards(_0x338e72)['then'](function(_0x5f5ad6){return _[_0xc025('0x2a')](_0x4cdc56,function(_0x158b91){if(_0x338e72[_0xc025('0x5f')]){if(_0x158b91['sectionId']===0x3eb){_0x158b91['subsections']=_0x5f5ad6;}}else{if(_0x158b91[_0xc025('0x51')]===0x64){_0x158b91['subsections']=_0x5f5ad6;}}return _0x158b91;});});}else{return;}})['then'](function(_0x5bf675){if(_0x5bf675)_0x4cdc56=_0x5bf675;if(_[_0xc025('0x60')](_0x252e79,0x709)){var _0xa92c59=_[_0xc025('0x43')](_0x4cdc56,{'sectionId':0x709});return getPlugins(_0xa92c59)['then'](function(_0x36c8ff){if(_0xa92c59[_0xc025('0x5f')]){return _[_0xc025('0x2a')](_0x4cdc56,function(_0x2fd2ff){if(_0x2fd2ff[_0xc025('0x51')]===0x709){_0x2fd2ff['subsections']=_0x36c8ff;}return _0x2fd2ff;});}else{var _0x3416fe={'sectionId':0x76c,'enabled':0x1,'subsections':_0x36c8ff};var _0x36ef30=_[_0xc025('0x2a')](_0x4cdc56);_0x36ef30['push'](_0x3416fe);return _0x36ef30;}});}else{return;}})[_0xc025('0x23')](function(_0x145cd5){if(_0x145cd5)_0x4cdc56=_0x145cd5;return _[_0xc025('0x3b')](_0x4cdc56,[_0xc025('0x5f'),0x1]);})[_0xc025('0x23')](respondWithResult(_0x2fe768,null))[_0xc025('0x40')](handleError(_0x2fe768,null));};function hasDefaultDashboard(_0x432228){var _0xc9067b=[0x65];return new BPromise(function(_0x202916,_0x4aa92d){try{if(_0x432228[_0xc025('0x4f')]){_0x202916(_0xc9067b);}else{return db[_0xc025('0x5a')][_0xc025('0x62')]({'where':{'sectionId':_0x432228['id']},'raw':!![]})[_0xc025('0x23')](function(_0x61d973){_0x61d973?_0x202916(_0xc9067b):_0x202916();});}}catch(_0x28ce09){_0x4aa92d(_0x28ce09);}});}function getCustomDashboards(_0x5094c2){var _0x4bfcd8=[];return new BPromise(function(_0x3d6b8b,_0x475df0){try{if(_0x5094c2['autoAssociation']){return db['Dashboard'][_0xc025('0x4d')]({'raw':!![]})[_0xc025('0x23')](function(_0x1d8d9b){_0x1d8d9b[_0xc025('0x63')](function(_0x4f4e0c){_0x4bfcd8[_0xc025('0x5b')](_0x4f4e0c['id']+0x1869f);});_0x3d6b8b(_0x4bfcd8);});}else{return db[_0xc025('0x5a')][_0xc025('0x4d')]({'where':{'sectionId':_0x5094c2['id']},'raw':!![]})[_0xc025('0x23')](function(_0x18fcac){_0x18fcac[_0xc025('0x63')](function(_0x249b85){_0x4bfcd8['push'](_0x249b85[_0xc025('0x64')]+0x1869f);});_0x3d6b8b(_0x4bfcd8);});}}catch(_0x3bdf8d){_0x475df0(_0x3bdf8d);}});}function getPlugins(_0x4f2c4f){var _0x393233=[];return new BPromise(function(_0x273924,_0x31b746){try{if(_0x4f2c4f[_0xc025('0x4f')]){return db['Plugin'][_0xc025('0x4d')]({'raw':!![]})[_0xc025('0x23')](function(_0xaf53cf){_0xaf53cf[_0xc025('0x63')](function(_0x31b89d){_0x393233[_0xc025('0x5b')](_0x31b89d['id']+0x15b38);});_0x273924(_0x393233);});}else{return db['UserProfileResource'][_0xc025('0x4d')]({'where':{'sectionId':_0x4f2c4f['id']},'raw':!![]})['then'](function(_0x1590de){_0x1590de[_0xc025('0x63')](function(_0x531063){_0x393233[_0xc025('0x5b')](_0x531063[_0xc025('0x64')]+0x15b38);});_0x273924(_0x393233);});}}catch(_0x59855f){_0x31b746(_0x59855f);}});}exports['addResources']=function(_0x4d8243,_0x343acf){return db['UserProfile'][_0xc025('0x43')]({'where':{'id':_0x4d8243[_0xc025('0x47')]['id']}})[_0xc025('0x23')](handleEntityNotFound(_0x343acf,null))[_0xc025('0x23')](function(_0x520d8a){if(_0x520d8a){return db[_0xc025('0x58')][_0xc025('0x59')](function(_0x1ed830){return db[_0xc025('0x4c')][_0xc025('0x4d')]({'where':{'userProfileId':_0x4d8243[_0xc025('0x47')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x42f789){if(_0x42f789){return db[_0xc025('0x4c')][_0xc025('0x55')]({'where':{'userProfileId':_0x4d8243[_0xc025('0x47')]['id'],'id':_[_0xc025('0x2a')](_0x42f789,function(_0x5312a4){return _0x5312a4['id'];})},'transaction':_0x1ed830});}})[_0xc025('0x23')](function(_0x17a0cf){var _0x80d2d2=_['map'](_0x4d8243[_0xc025('0x45')],function(_0x27cd76){_0x27cd76[_0xc025('0x52')]=_0x4d8243[_0xc025('0x47')]['id'];return _0x27cd76;});return db[_0xc025('0x4c')]['bulkCreate'](_0x80d2d2,{'raw':!![],'transaction':_0x1ed830});})[_0xc025('0x23')](function(_0x4a83dc){var _0x4b60ed=_[_0xc025('0x3b')](_[_0xc025('0x2a')](_0x4a83dc,function(_0xaabbb){return _0xaabbb[_0xc025('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b60ed){return db[_0xc025('0x4c')][_0xc025('0x4d')]({'where':{'userProfileId':_0x4d8243['params']['id'],'sectionId':_[_0xc025('0x2a')](_0x4b60ed,function(_0x5b4616){return _0x5b4616[_0xc025('0x51')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xc025('0x23')](function(_0x2b4aa1){var _0x2b5fb0=_['map'](_0x4d8243['body'],function(_0x4fde6c){_0x4fde6c[_0xc025('0x52')]=_0x4d8243[_0xc025('0x47')]['id'];return _0x4fde6c;});return db[_0xc025('0x5a')][_0xc025('0x65')](_0x2b5fb0,{'raw':!![],'transaction':_0x1ed830});});}})[_0xc025('0x40')](handleError(_0x343acf,null));});}})[_0xc025('0x23')](function(_0x263b8d){var _0x253e71=_[_0xc025('0x2a')](_0x263b8d,function(_0x404527){return _0x404527['get']({'plain':!![]});});})[_0xc025('0x23')](respondWithResult(_0x343acf,null))[_0xc025('0x40')](handleError(_0x343acf,null));};exports[_0xc025('0x66')]=function(_0x4d8a84,_0x49bb3c,_0x54b89c){return db[_0xc025('0x2b')][_0xc025('0x43')]({'where':{'id':_0x4d8a84[_0xc025('0x47')]['id']}})[_0xc025('0x23')](handleEntityNotFound(_0x49bb3c,null))['then'](function(_0x23209d){if(_0x23209d){return _0x23209d['removeResources'](_0x4d8a84[_0xc025('0x30')]['ids']);}})[_0xc025('0x23')](respondWithStatusCode(_0x49bb3c,null))[_0xc025('0x40')](handleError(_0x49bb3c,null));};exports[_0xc025('0x67')]=function(_0x2a63e8,_0x58551b){var _0x3e38f5={'raw':![],'where':{}};var _0x4dc148={};var _0x24fccb={'count':0x0,'rows':[]};var _0x1118b3=_0x2a63e8[_0xc025('0x30')]['section'];if(typeof _0x1118b3===_0xc025('0x68')){throw new db[(_0xc025('0x69'))][(_0xc025('0x6a'))](_0xc025('0x6b'));}var _0x377fb0=_0x2a63e8[_0xc025('0x30')][_0xc025('0x6c')]||![];var _0x1dcc26=getQueryModels(_0x1118b3,_0x377fb0);if(typeof _0x1dcc26[_0xc025('0x6d')]===_0xc025('0x68')){throw new db[(_0xc025('0x69'))][(_0xc025('0x6a'))]('Invalid\x20section\x20\x27'+_0x1118b3+'\x27');}var _0x44cee7=[];if(!_['isEmpty'](_0x1dcc26[_0xc025('0x6e')])){_0x44cee7=_0x1dcc26[_0xc025('0x6e')];}else{_0x44cee7=[{'name':_0x1118b3}];}return db['UserProfile'][_0xc025('0x62')]({'where':{'id':_0x2a63e8[_0xc025('0x47')]['id']}})[_0xc025('0x23')](handleEntityNotFound(_0x58551b,null))['then'](function(_0x93d55f){if(_0x93d55f){var _0x64cc4f=[];for(var _0xf8c951=0x0;_0xf8c951<_0x44cee7[_0xc025('0x35')];_0xf8c951++){_0x64cc4f['push'](db[_0xc025('0x4c')][_0xc025('0x62')]({'where':{'userProfileId':_0x93d55f['id'],'name':_0x44cee7[_0xf8c951]['name']},'raw':!![]}));}return BPromise['all'](_0x64cc4f);}})['then'](function(_0x16af32){var _0x433ce8=_[_0xc025('0x3b')](_0x16af32,function(_0xded24d){return _0xded24d?_0xded24d:undefined;});var _0xfe9401=_[_0xc025('0x3b')](_0x44cee7,[_0xc025('0x6f'),!![]]);var _0x308a6d=_[_0xc025('0x70')](_0x433ce8)&&_['isEmpty'](_0xfe9401)?null:_['union'](_0xfe9401,_0x433ce8);if(_0x308a6d){var _0x44d661=[];for(var _0x104931=0x0;_0x104931<_0x308a6d[_0xc025('0x35')];_0x104931++){var _0x42e255=_[_0xc025('0x43')](_0x44cee7,function(_0x11604e){return _0x308a6d[_0x104931]?_0x11604e[_0xc025('0x27')]===_0x308a6d[_0x104931]['name']:null;});if(_0x42e255){if(_0x308a6d[_0x104931][_0xc025('0x6f')]){_0x44d661[_0xc025('0x5b')](getAllResources(_0x1dcc26[_0xc025('0x6d')],_0x308a6d[_0x104931]));}else{if(!_0x308a6d[_0x104931]['autoAssociation']){_0x44d661[_0xc025('0x5b')](getAllowedResources(_0x42e255,_0x308a6d[_0x104931],_0x1dcc26[_0xc025('0x6d')]));}else{if(_0x42e255[_0xc025('0x2f')]){_0x44d661['push'](getAllFilteredResources(_0x42e255,_0x308a6d[_0x104931]));}}}}}return BPromise[_0xc025('0x71')](_0x44d661);}else{return null;}})[_0xc025('0x23')](function(_0x9d6035){var _0x18a3d5=_0x9d6035;var _0x165f49=null;if(_0x18a3d5){_0x165f49=_0x18a3d5[_0xc025('0x35')]===0x1?_0x18a3d5[0x0]:null;}if(_0x165f49||_0x18a3d5){var _0x12269a=db[_0x1dcc26[_0xc025('0x6d')]]['rawAttributes'];_0x4dc148['model']=_[_0xc025('0x31')](_0x12269a);_0x4dc148['query']=_['keys'](_0x2a63e8[_0xc025('0x30')]);_0x4dc148[_0xc025('0x39')]=_[_0xc025('0x32')](_0x4dc148[_0xc025('0x2f')],_0x4dc148[_0xc025('0x30')]);_0x3e38f5[_0xc025('0x33')]=_[_0xc025('0x32')](_0x4dc148['model'],qs['fields'](_0x2a63e8['query'][_0xc025('0x34')]));_0x3e38f5['attributes']=_0x3e38f5[_0xc025('0x33')][_0xc025('0x35')]?_0x3e38f5['attributes']:_0x4dc148[_0xc025('0x2f')];if(!_0x2a63e8[_0xc025('0x30')]['hasOwnProperty'](_0xc025('0x37'))){_0x3e38f5[_0xc025('0x21')]=qs['limit'](_0x2a63e8[_0xc025('0x30')][_0xc025('0x21')]);_0x3e38f5[_0xc025('0x20')]=qs[_0xc025('0x20')](_0x2a63e8[_0xc025('0x30')][_0xc025('0x20')]);}_0x3e38f5[_0xc025('0x72')]=qs['sort'](_0x2a63e8['query'][_0xc025('0x73')]);_0x3e38f5[_0xc025('0x38')]=qs[_0xc025('0x39')](_[_0xc025('0x3a')](_0x2a63e8['query'],_0x4dc148[_0xc025('0x39')]));if(_0x2a63e8[_0xc025('0x30')][_0xc025('0x3b')]){_0x3e38f5[_0xc025('0x38')]=_[_0xc025('0x3d')](_0x3e38f5['where'],{'$or':_[_0xc025('0x2a')](_0x12269a,function(_0x350da9){if(_0x350da9[_0xc025('0x2e')]['key']!=='VIRTUAL'){var _0x19b36e={};_0x19b36e[_0x350da9['field']]={'$like':'%'+_0x2a63e8['query']['filter']+'%'};return _0x19b36e;}})});}var _0x32f2ee=[];if(_0x165f49){var _0x16184b=_[_0xc025('0x43')](_0x44cee7,[_0xc025('0x27'),_0x165f49[_0xc025('0x27')]]);if(_0x16184b['field']){var _0x41604f={};if(_0x1dcc26[_0xc025('0x6d')]===_0xc025('0x74')){_0x41604f[_0x16184b[_0xc025('0x75')]]=_[_0xc025('0x2a')](_0x165f49[_0xc025('0x76')],'id');}else{_0x41604f[_0x16184b[_0xc025('0x75')]]=_0x165f49['associatedResources'];}_0x32f2ee[_0xc025('0x5b')](_0x41604f);}else{_0x3e38f5[_0xc025('0x38')]['id']=_0x165f49[_0xc025('0x76')];}}else{for(var _0x5a49ba=0x0;_0x5a49ba<_0x18a3d5[_0xc025('0x35')];_0x5a49ba++){var _0x16184b=_[_0xc025('0x43')](_0x44cee7,[_0xc025('0x27'),_0x18a3d5[_0x5a49ba]['name']]);if(_0x16184b[_0xc025('0x77')]){var _0x41604f={};_0x41604f[_0x16184b['foreignKey']]=_0x18a3d5[_0x5a49ba]['associatedResources'];_0x32f2ee[_0xc025('0x5b')](_0x41604f);}else{if(!_0x3e38f5[_0xc025('0x38')]['id'])_0x3e38f5[_0xc025('0x38')]['id']=[];_0x18a3d5[_0x5a49ba][_0xc025('0x76')][_0xc025('0x63')](function(_0x52f773){_0x3e38f5[_0xc025('0x38')]['id'][_0xc025('0x5b')](_0x52f773);});}}}if(!_['isEmpty'](_0x32f2ee)){_0x3e38f5[_0xc025('0x38')]=_['merge'](_0x3e38f5[_0xc025('0x38')],{'$and':{'$or':_0x32f2ee}});}_0x3e38f5=_[_0xc025('0x3d')]({},_0x3e38f5,_0x2a63e8[_0xc025('0x3e')]);if(_0x165f49&&!_0x165f49[_0xc025('0x4f')]&&_0x1dcc26[_0xc025('0x6d')]===_0xc025('0x74')){if(_0x2a63e8[_0xc025('0x30')][_0xc025('0x3f')]){_0x3e38f5[_0xc025('0x42')]=[{'all':!![]}];}return db[_0x1dcc26[_0xc025('0x6d')]][_0xc025('0x4d')](_0x3e38f5)[_0xc025('0x23')](function(_0x2b8393){var _0x1f06f7=[];_0x2b8393[_0xc025('0x63')](function(_0x35ba03){var _0x191cbf;switch(_0x35ba03[_0xc025('0x78')]){case _0xc025('0x79'):_0x191cbf=_[_0xc025('0x43')](_0x165f49[_0xc025('0x76')],function(_0x595170){return _0x595170['id']===_0x35ba03['reportId']&&_0x595170['type']===_0xc025('0x7a');});break;case'custom':_0x191cbf=_[_0xc025('0x43')](_0x165f49['associatedResources'],function(_0xb0c701){return _0xb0c701['id']===_0x35ba03['reportId']&&_0xb0c701[_0xc025('0x2e')]===_0xc025('0x7b');});break;}if(_0x191cbf)_0x1f06f7[_0xc025('0x5b')](_0x35ba03);});_0x24fccb[_0xc025('0x1f')]=_0x1f06f7[_0xc025('0x35')];_0x24fccb[_0xc025('0x7c')]=_0x1f06f7;return _0x24fccb;});}else{return db[_0x1dcc26[_0xc025('0x6d')]][_0xc025('0x1f')]({'where':_0x3e38f5[_0xc025('0x38')]})['then'](function(_0x1ff24a){_0x24fccb[_0xc025('0x1f')]=_0x1ff24a;if(_0x2a63e8['query']['includeAll']){if(_0x1dcc26[_0xc025('0x6d')]===_0xc025('0x7d')){_0x3e38f5['include']=[{'model':db[_0xc025('0x7e')],'as':_0xc025('0x7f'),'attributes':['id','name','color'],'required':_0x2a63e8[_0xc025('0x30')][_0xc025('0x80')]?!![]:![]},{'model':db[_0xc025('0x7e')],'as':_0xc025('0x81'),'attributes':['id',_0xc025('0x27'),_0xc025('0x82')],'through':_0x2a63e8[_0xc025('0x30')][_0xc025('0x80')]?{'attributes':[],'where':{'TagId':_0x2a63e8[_0xc025('0x30')][_0xc025('0x80')]||undefined}}:{},'required':_0x2a63e8[_0xc025('0x30')]['tag']?!![]:![]}];}else{_0x3e38f5['include']=[{'all':!![]}];}}return db[_0x1dcc26[_0xc025('0x6d')]]['findAll'](_0x3e38f5);})[_0xc025('0x23')](function(_0x1453f8){_0x24fccb[_0xc025('0x7c')]=_0x1453f8;return _0x24fccb;});}}else{return _0x24fccb;}})[_0xc025('0x23')](respondWithFilteredResult(_0x58551b,_0x3e38f5))[_0xc025('0x40')](handleError(_0x58551b,null));};function getAllResources(_0xe07b9e,_0x3ff36b){return new BPromise(function(_0x3ed4cd,_0x2cc77a){if(_0x3ff36b){var _0x5436b1=_0x3ff36b[_0xc025('0x3b')]?{[_0x3ff36b['filter'][_0xc025('0x77')]]:_0x3ff36b['filter'][_0xc025('0x83')]}:undefined;return db[_0xe07b9e]['findAll']({'where':_0x5436b1,'raw':!![]})['then'](function(_0x2dc1af){_0x3ff36b[_0xc025('0x76')]=_[_0xc025('0x2a')](_0x2dc1af,'id');_0x3ed4cd(_0x3ff36b);})['catch'](function(_0x127296){_0x2cc77a(_0x127296);});}else{_0x3ed4cd(null);}});}function getAllFilteredResources(_0x108083,_0x1c8b53){return new BPromise(function(_0x5389aa,_0xff3c03){var _0x2c2e55=_0x108083[_0xc025('0x3b')]?{[_0x108083['filter'][_0xc025('0x77')]]:_0x108083['filter'][_0xc025('0x83')]}:undefined;return db[_0x108083[_0xc025('0x2f')]][_0xc025('0x4d')]({'where':_0x2c2e55,'raw':!![]})[_0xc025('0x23')](function(_0x944e01){_0x1c8b53[_0xc025('0x76')]=_['map'](_0x944e01,function(_0x164235){return _0x164235[_0xc025('0x27')];});_0x5389aa(_0x1c8b53);})[_0xc025('0x40')](function(_0x163a4c){_0xff3c03(_0x163a4c);});});}function getAllowedResources(_0x2bb7a4,_0x8ab6ab,_0x535a16){return new BPromise(function(_0x19a434,_0x303579){if(_0x8ab6ab){return db['UserProfileResource'][_0xc025('0x4d')]({'where':{'sectionId':_0x8ab6ab['id']},'raw':!![]})[_0xc025('0x23')](function(_0x372270){if(_0x2bb7a4[_0xc025('0x77')]&&_0x2bb7a4[_0xc025('0x77')]!=='id'){_0x8ab6ab[_0xc025('0x76')]=_[_0xc025('0x2a')](_0x372270,function(_0x3117b9){return _0x3117b9[_0x2bb7a4[_0xc025('0x77')]];});}else{if(_0x535a16==='AnalyticExtractedReport'){_0x8ab6ab['associatedResources']=_['map'](_0x372270,function(_0x2eaa09){return{'id':_0x2eaa09['resourceId'],'type':_0x2eaa09[_0xc025('0x2e')]};});}else{_0x8ab6ab[_0xc025('0x76')]=_[_0xc025('0x2a')](_0x372270,function(_0x3f0fa4){return _0x3f0fa4[_0xc025('0x64')];});}}_0x19a434(_0x8ab6ab);})[_0xc025('0x40')](function(_0x42595e){_0x303579(_0x42595e);});}else{_0x19a434(null);}});}function getQueryModels(_0x11b83f,_0x532f2f){var _0x4ee8a1=_0x11b83f[_0xc025('0x84')]();var _0x2df3f5={'childModel':undefined,'parentSections':[]};switch(_0x4ee8a1){case'squareprojects':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x85');break;case _0xc025('0x86'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x87');break;case _0xc025('0x88'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x89');_0x2df3f5[_0xc025('0x6e')]=[{'name':_0xc025('0x8a'),'field':_0xc025('0x27'),'foreignKey':'projectName'}];break;case'projects':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x8b');break;case _0xc025('0x8c'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x7d');_0x2df3f5[_0xc025('0x6e')]=[{'name':_0xc025('0x8d'),'field':'id','foreignKey':_0xc025('0x8e')}];break;case _0xc025('0x8f'):_0x2df3f5[_0xc025('0x6d')]='CmList';break;case _0xc025('0x90'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x91');break;case _0xc025('0x92'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x93');break;case _0xc025('0x94'):_0x2df3f5['childModel']=_0xc025('0x95');break;case _0xc025('0x96'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x97');break;case _0xc025('0x98'):_0x2df3f5[_0xc025('0x6d')]='FaxQueue';break;case _0xc025('0x99'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0x9a');break;case _0xc025('0x9b'):case _0xc025('0x9c'):case _0xc025('0x9d'):_0x2df3f5[_0xc025('0x6d')]='VoiceExtension';break;case _0xc025('0x9e'):_0x2df3f5['childModel']=_0xc025('0x9f');break;case _0xc025('0xa0'):_0x2df3f5[_0xc025('0x6d')]='VoiceMail';break;case _0xc025('0xa1'):_0x2df3f5['childModel']='VoiceRecording';_0x2df3f5[_0xc025('0x6e')]=[{'name':_0xc025('0xa2'),'field':_0xc025('0x27'),'foreignKey':'membername','model':_0xc025('0xa3'),'filter':{'field':_0xc025('0xa4'),'value':[_0xc025('0xa5')]}},{'name':'Telephones','field':_0xc025('0x27'),'foreignKey':_0xc025('0xa6'),'model':_0xc025('0xa3'),'filter':{'field':_0xc025('0xa4'),'value':['telephone']}},{'name':_0xc025('0xa7'),'field':_0xc025('0x27'),'foreignKey':'queue','model':_0xc025('0xa8'),'filter':{'field':_0xc025('0x2e'),'value':[_0xc025('0xa9')]}},{'name':'QueueCampaigns','field':_0xc025('0x27'),'foreignKey':_0xc025('0xaa'),'model':'VoiceQueue','filter':{'field':'type','value':['outbound']}}];break;case _0xc025('0xab'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xac');break;case _0xc025('0xad'):_0x2df3f5['childModel']=_0xc025('0xae');break;case _0xc025('0xaf'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xb0');break;case _0xc025('0xb1'):_0x2df3f5['childModel']='Campaign';break;case'mailqueues':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xb2');break;case'mailaccounts':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xb3');break;case _0xc025('0xb4'):_0x2df3f5[_0xc025('0x6d')]='MailSubstatus';break;case _0xc025('0xb5'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xb6');break;case _0xc025('0xb7'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xb8');break;case _0xc025('0xb9'):_0x2df3f5['childModel']='SmsQueue';break;case'smsaccounts':_0x2df3f5['childModel']='SmsAccount';break;case _0xc025('0xba'):_0x2df3f5[_0xc025('0x6d')]='WhatsappQueue';break;case _0xc025('0xbb'):_0x2df3f5[_0xc025('0x6d')]='WhatsappAccount';break;case _0xc025('0xbc'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xbd');break;case _0xc025('0xbe'):case _0xc025('0xbf'):_0x2df3f5[_0xc025('0x6d')]='VoiceQueue';if(_0x532f2f){_0x2df3f5['parentSections']=[{'name':'VoiceQueues'},{'name':_0xc025('0xc0')}];}break;case'users':case _0xc025('0xc1'):case'telephones':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xa3');if(_0x532f2f){_0x2df3f5[_0xc025('0x6e')]=[{'name':'Users','filter':{'field':_0xc025('0xa4'),'value':[_0xc025('0xc2'),_0xc025('0xc3')]},'ignore':!![]},{'name':_0xc025('0xa2')},{'name':_0xc025('0xc4')}];}break;case _0xc025('0xc5'):_0x2df3f5[_0xc025('0x6d')]='ZendeskAccount';break;case _0xc025('0xc6'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xc7');break;case _0xc025('0xc8'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xc9');break;case _0xc025('0xca'):_0x2df3f5[_0xc025('0x6d')]='SugarcrmAccount';break;case _0xc025('0xcb'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xcc');break;case _0xc025('0xcd'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xce');break;case _0xc025('0xcf'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xa3');break;case _0xc025('0xd0'):_0x2df3f5[_0xc025('0x6d')]='CannedAnswer';break;case _0xc025('0xd1'):_0x2df3f5['childModel']=_0xc025('0xd2');break;case _0xc025('0xd3'):_0x2df3f5[_0xc025('0x6d')]='Dashboard';break;case'intervals':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xd4');break;case _0xc025('0xd5'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xd6');break;case _0xc025('0xd7'):_0x2df3f5[_0xc025('0x6d')]='Schedule';break;case _0xc025('0xd8'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xd9');break;case _0xc025('0xda'):_0x2df3f5[_0xc025('0x6d')]='Tag';break;case _0xc025('0xdb'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xdc');break;case _0xc025('0xdd'):_0x2df3f5['childModel']='Trigger';break;case _0xc025('0xde'):_0x2df3f5['childModel']=_0xc025('0xdf');break;case _0xc025('0xe0'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xe1');break;case _0xc025('0xe2'):_0x2df3f5['childModel']=_0xc025('0xe3');break;case'extractedreports':_0x2df3f5['childModel']=_0xc025('0x74');_0x2df3f5[_0xc025('0x6e')]=[{'name':'Reports','field':'id','foreignKey':'reportId'}];break;case _0xc025('0xe4'):_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xe5');break;case'whatsappaccounts':_0x2df3f5[_0xc025('0x6d')]=_0xc025('0xe6');break;default:return _0x2df3f5;}return _0x2df3f5;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6c2f4d8..9ee5718 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 _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 +var _0xdcbd=['hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit'];(function(_0x48cb02,_0x5b1df4){var _0x5d667a=function(_0x23f739){while(--_0x23f739){_0x48cb02['push'](_0x48cb02['shift']());}};_0x5d667a(++_0x5b1df4);}(_0xdcbd,0x125));var _0xddcb=function(_0x307a9f,_0x590b4c){_0x307a9f=_0x307a9f-0x0;var _0x25d8db=_0xdcbd[_0x307a9f];return _0x25d8db;};'use strict';var EventEmitter=require(_0xddcb('0x0'));var UserProfile=require(_0xddcb('0x1'))['db'][_0xddcb('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xddcb('0x3')](0x0);var events={'afterCreate':_0xddcb('0x4'),'afterUpdate':'update','afterDestroy':_0xddcb('0x5')};function emitEvent(_0x35ec23){return function(_0x5a77b1,_0x15bba9,_0x4d6d39){UserProfileEvents[_0xddcb('0x6')](_0x35ec23+':'+_0x5a77b1['id'],_0x5a77b1);UserProfileEvents[_0xddcb('0x6')](_0x35ec23,_0x5a77b1);_0x4d6d39(null);};}for(var e in events){if(events[_0xddcb('0x7')](e)){var event=events[e];UserProfile[_0xddcb('0x8')](e,emitEvent(event));}}module[_0xddcb('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 94e251c..d74f240 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 _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 +var _0x1fad=['exports','define','UserProfile','user_profiles','util','api','moment','bluebird','path','rimraf','../../config/environment','./userProfile.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fad,0x13c));var _0xd1fa=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0x1fad[_0x374ada];return _0x449ed8;};'use strict';var _=require('lodash');var util=require(_0xd1fa('0x0'));var logger=require('../../config/logger')(_0xd1fa('0x1'));var moment=require(_0xd1fa('0x2'));var BPromise=require(_0xd1fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1fa('0x4'));var rimraf=require(_0xd1fa('0x5'));var config=require(_0xd1fa('0x6'));var attributes=require(_0xd1fa('0x7'));module[_0xd1fa('0x8')]=function(_0x5dd3e9,_0x5a8659){return _0x5dd3e9[_0xd1fa('0x9')](_0xd1fa('0xa'),attributes,{'tableName':_0xd1fa('0xb'),'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 4b91a87..b5d11ff 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 _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 +var _0x7217=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});config[_0x7721('0xb')]=_[_0x7721('0xc')](config[_0x7721('0xb')],{'host':_0x7721('0xd'),'port':0x18eb});var socket=require(_0x7721('0xe'))(new Redis(config[_0x7721('0xb')]));require(_0x7721('0xf'))[_0x7721('0x10')](socket);function respondWithRpcPromise(_0x138740,_0x2c3986,_0x578d59){return new BPromise(function(_0x461d1a,_0x29bc8f){return client[_0x7721('0x11')](_0x138740,_0x578d59)[_0x7721('0x12')](function(_0xa8977c){logger[_0x7721('0x13')](_0x7721('0x14'),_0x2c3986,_0x7721('0x15'));logger['debug'](_0x7721('0x16'),_0x2c3986,_0x7721('0x15'),JSON['stringify'](_0xa8977c));if(_0xa8977c[_0x7721('0x17')]){if(_0xa8977c[_0x7721('0x17')][_0x7721('0x18')]===0x1f4){logger[_0x7721('0x17')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x29bc8f(_0xa8977c['error']['message']);}logger['error'](_0x7721('0x14'),_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x461d1a(_0xa8977c[_0x7721('0x17')]['message']);}else{logger[_0x7721('0x13')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0x7721('0x15'));_0x461d1a(_0xa8977c['result'][_0x7721('0x19')]);}})[_0x7721('0x1a')](function(_0x3ab5a5){logger[_0x7721('0x17')](_0x7721('0x14'),_0x2c3986,_0x3ab5a5);_0x29bc8f(_0x3ab5a5);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 6533370..8a7c31a 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 _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 +var _0xfebe=['./userProfile.events','save','update','emit','register','length','userProfile:'];(function(_0x4bdf38,_0x9555bb){var _0x15bf3e=function(_0x20aebd){while(--_0x20aebd){_0x4bdf38['push'](_0x4bdf38['shift']());}};_0x15bf3e(++_0x9555bb);}(_0xfebe,0x150));var _0xefeb=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0xfebe[_0x3ebb04];return _0x535db0;};'use strict';var UserProfileEvents=require(_0xefeb('0x0'));var events=[_0xefeb('0x1'),'remove',_0xefeb('0x2')];function createListener(_0x442b63,_0x3fb1d8){return function(_0x45e0ae){_0x3fb1d8[_0xefeb('0x3')](_0x442b63,_0x45e0ae);};}function removeListener(_0x232efc,_0x31e049){return function(){UserProfileEvents['removeListener'](_0x232efc,_0x31e049);};}exports[_0xefeb('0x4')]=function(_0x291b1c){for(var _0x1426b8=0x0,_0x46500e=events[_0xefeb('0x5')];_0x1426b8<_0x46500e;_0x1426b8++){var _0x5ce5f6=events[_0x1426b8];var _0x2b20eb=createListener(_0xefeb('0x6')+_0x5ce5f6,_0x291b1c);UserProfileEvents['on'](_0x5ce5f6,_0x2b20eb);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 23b0655..fbf912f 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 _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 +var _0xfb65=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','post','/:id','update'];(function(_0x400fd1,_0x49a95a){var _0x706d54=function(_0x566d8e){while(--_0x566d8e){_0x400fd1['push'](_0x400fd1['shift']());}};_0x706d54(++_0x49a95a);}(_0xfb65,0xb7));var _0x5fb6=function(_0xe4c712,_0x1e26d5){_0xe4c712=_0xe4c712-0x0;var _0x101962=_0xfb65[_0xe4c712];return _0x101962;};'use strict';var multer=require(_0x5fb6('0x0'));var util=require(_0x5fb6('0x1'));var path=require(_0x5fb6('0x2'));var timeout=require(_0x5fb6('0x3'));var express=require('express');var router=express[_0x5fb6('0x4')]();var auth=require(_0x5fb6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth[_0x5fb6('0x9')](),controller[_0x5fb6('0xa')]);router[_0x5fb6('0x8')](_0x5fb6('0xb'),auth[_0x5fb6('0x9')](),controller['describe']);router[_0x5fb6('0x8')]('/:id',auth[_0x5fb6('0x9')](),controller['show']);router[_0x5fb6('0xc')]('/',auth[_0x5fb6('0x9')](),controller['create']);router['put'](_0x5fb6('0xd'),auth['isAuthenticated'](),controller[_0x5fb6('0xe')]);router[_0x5fb6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5fb6('0x10')]);module[_0x5fb6('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 2e40488..43ce710 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 _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 +var _0xd94d=['exports','STRING'];(function(_0x24a312,_0x816625){var _0x4ac91f=function(_0x55e130){while(--_0x55e130){_0x24a312['push'](_0x24a312['shift']());}};_0x4ac91f(++_0x816625);}(_0xd94d,0xea));var _0xdd94=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd94d[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module[_0xdd94('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xdd94('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 40ce2a7..fb1b227 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 _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 +var _0x46ed=['include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','UserProfileResource','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','params'];(function(_0x28e1c4,_0x417a56){var _0x3b5e87=function(_0x3012c9){while(--_0x3012c9){_0x28e1c4['push'](_0x28e1c4['shift']());}};_0x3b5e87(++_0x417a56);}(_0x46ed,0x168));var _0xd46e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x46ed[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=_0x417402[_0xd46e('0x1c')],_0x36a317=_0x44a620[_0xd46e('0x1d')],_0x47fa8f=_0x44a620['offset']+_0x44a620['limit'],_0x1d50a5;if(_0x47fa8f>=_0x3d72ce){_0x47fa8f=_0x3d72ce;_0x1d50a5=0xc8;}else{_0x1d50a5=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x1d50a5);return _0x3b6d25[_0xd46e('0x1e')]('Content-Range',_0x36a317+'-'+_0x47fa8f+'/'+_0x3d72ce)['json'](_0x417402);}return null;};}function patchUpdates(_0x2d6f2c){return function(_0x2f2571){try{jsonpatch[_0xd46e('0x1f')](_0x2f2571,_0x2d6f2c,!![]);}catch(_0x2273c5){return BPromise[_0xd46e('0x20')](_0x2273c5);}return _0x2f2571[_0xd46e('0x21')]();};}function saveUpdates(_0x3b5fa4,_0x327b7e){return function(_0xb4940){if(_0xb4940){return _0xb4940[_0xd46e('0x22')](_0x3b5fa4)[_0xd46e('0x23')](function(_0x5ba94d){return _0x5ba94d;});}return null;};}function removeEntity(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')]()[_0xd46e('0x23')](function(){_0x259072[_0xd46e('0x1b')](0xcc)[_0xd46e('0x25')]();});}};}function handleEntityNotFound(_0x8a1be,_0x62dea5){return function(_0x4cf899){if(!_0x4cf899){_0x8a1be[_0xd46e('0x1a')](0x194);}return _0x4cf899;};}function handleError(_0x5424e5,_0x4b8f6a){_0x4b8f6a=_0x4b8f6a||0x1f4;return function(_0x371054){logger[_0xd46e('0x26')](_0x371054[_0xd46e('0x27')]);if(_0x371054[_0xd46e('0x28')]){delete _0x371054[_0xd46e('0x28')];}_0x5424e5[_0xd46e('0x1b')](_0x4b8f6a)[_0xd46e('0x29')](_0x371054);};}exports['index']=function(_0x45d789,_0x3c301a){var _0xddbce9={},_0x17db79={},_0x96f15c={'count':0x0,'rows':[]};var _0x16e941=_['map'](db[_0xd46e('0x2a')][_0xd46e('0x2b')],function(_0x2d1afe){return{'name':_0x2d1afe[_0xd46e('0x2c')],'type':_0x2d1afe[_0xd46e('0x2d')][_0xd46e('0x2e')]};});_0x17db79[_0xd46e('0x2f')]=_[_0xd46e('0x30')](_0x16e941,_0xd46e('0x28'));_0x17db79[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x45d789[_0xd46e('0x31')]);_0x17db79[_0xd46e('0x33')]=_['intersection'](_0x17db79[_0xd46e('0x2f')],_0x17db79[_0xd46e('0x31')]);_0xddbce9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x17db79['model'],qs[_0xd46e('0x36')](_0x45d789[_0xd46e('0x31')]['fields']));_0xddbce9[_0xd46e('0x34')]=_0xddbce9[_0xd46e('0x34')]['length']?_0xddbce9[_0xd46e('0x34')]:_0x17db79[_0xd46e('0x2f')];if(!_0x45d789[_0xd46e('0x31')]['hasOwnProperty']('nolimit')){_0xddbce9[_0xd46e('0x37')]=qs[_0xd46e('0x37')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x37')]);_0xddbce9[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x1d')]);}_0xddbce9['order']=qs[_0xd46e('0x38')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x38')]);_0xddbce9[_0xd46e('0x39')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3a')](_0x45d789[_0xd46e('0x31')],_0x17db79['filters']),_0x16e941);if(_0x45d789[_0xd46e('0x31')][_0xd46e('0x3b')]){_0xddbce9['where']=_[_0xd46e('0x3c')](_0xddbce9[_0xd46e('0x39')],{'$or':_[_0xd46e('0x30')](_0x16e941,function(_0x3b6e67){if(_0x3b6e67['type']!==_0xd46e('0x3d')){var _0x3ecf34={};_0x3ecf34[_0x3b6e67[_0xd46e('0x28')]]={'$like':'%'+_0x45d789[_0xd46e('0x31')][_0xd46e('0x3b')]+'%'};return _0x3ecf34;}})});}_0xddbce9=_[_0xd46e('0x3c')]({},_0xddbce9,_0x45d789[_0xd46e('0x3e')]);var _0x411318={'where':_0xddbce9['where']};return db[_0xd46e('0x2a')][_0xd46e('0x1c')](_0x411318)[_0xd46e('0x23')](function(_0x25657a){_0x96f15c[_0xd46e('0x1c')]=_0x25657a;if(_0x45d789['query'][_0xd46e('0x3f')]){_0xddbce9['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0xddbce9);})['then'](function(_0x17c3d9){_0x96f15c['rows']=_0x17c3d9;return _0x96f15c;})[_0xd46e('0x23')](respondWithFilteredResult(_0x3c301a,_0xddbce9))[_0xd46e('0x40')](handleError(_0x3c301a,null));};exports['show']=function(_0x462477,_0x4114e6){var _0x3bd5e9={'raw':![],'where':{'id':_0x462477[_0xd46e('0x41')]['id']}},_0x31ba12={};_0x31ba12[_0xd46e('0x2f')]=_[_0xd46e('0x32')](db[_0xd46e('0x2a')][_0xd46e('0x2b')]);_0x31ba12[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x462477['query']);_0x31ba12['filters']=_['intersection'](_0x31ba12[_0xd46e('0x2f')],_0x31ba12['query']);_0x3bd5e9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x31ba12[_0xd46e('0x2f')],qs[_0xd46e('0x36')](_0x462477[_0xd46e('0x31')][_0xd46e('0x36')]));_0x3bd5e9[_0xd46e('0x34')]=_0x3bd5e9[_0xd46e('0x34')]['length']?_0x3bd5e9[_0xd46e('0x34')]:_0x31ba12['model'];if(_0x462477[_0xd46e('0x31')][_0xd46e('0x3f')]){_0x3bd5e9[_0xd46e('0x42')]=[{'all':!![]}];}_0x3bd5e9=_[_0xd46e('0x3c')]({},_0x3bd5e9,_0x462477[_0xd46e('0x3e')]);return db['UserProfileResource'][_0xd46e('0x43')](_0x3bd5e9)[_0xd46e('0x23')](handleEntityNotFound(_0x4114e6,null))[_0xd46e('0x23')](respondWithResult(_0x4114e6,null))[_0xd46e('0x40')](handleError(_0x4114e6,null));};exports[_0xd46e('0x44')]=function(_0x587784,_0x11fdda){return db[_0xd46e('0x2a')][_0xd46e('0x44')](_0x587784[_0xd46e('0x45')],{})[_0xd46e('0x23')](respondWithResult(_0x11fdda,0xc9))['catch'](handleError(_0x11fdda,null));};exports[_0xd46e('0x22')]=function(_0x3ea9e6,_0x45baf1){if(_0x3ea9e6[_0xd46e('0x45')]['id']){delete _0x3ea9e6[_0xd46e('0x45')]['id'];}return db[_0xd46e('0x2a')][_0xd46e('0x43')]({'where':{'id':_0x3ea9e6[_0xd46e('0x41')]['id']}})['then'](handleEntityNotFound(_0x45baf1,null))[_0xd46e('0x23')](saveUpdates(_0x3ea9e6[_0xd46e('0x45')],null))[_0xd46e('0x23')](respondWithResult(_0x45baf1,null))[_0xd46e('0x40')](handleError(_0x45baf1,null));};exports[_0xd46e('0x24')]=function(_0x4e84c8,_0x4ae314){return db[_0xd46e('0x2a')][_0xd46e('0x43')]({'where':{'id':_0x4e84c8[_0xd46e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ae314,null))['then'](removeEntity(_0x4ae314,null))[_0xd46e('0x40')](handleError(_0x4ae314,null));};exports[_0xd46e('0x46')]=function(_0x52354f,_0x2eee92){return db[_0xd46e('0x2a')][_0xd46e('0x46')]()[_0xd46e('0x23')](respondWithResult(_0x2eee92,null))[_0xd46e('0x40')](handleError(_0x2eee92,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 235cf38..0dc12aa 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 _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 +var _0x1c46=['user_profile_has_resources','compositeIndex','resourceId','sectionId','util','../../config/logger','api','moment','bluebird','../../config/environment','./userProfileResource.attributes','UserProfileResource'];(function(_0x2c8902,_0x1f3aa0){var _0x1f1267=function(_0x4906d5){while(--_0x4906d5){_0x2c8902['push'](_0x2c8902['shift']());}};_0x1f1267(++_0x1f3aa0);}(_0x1c46,0xc4));var _0x61c4=function(_0x204264,_0x2c19d9){_0x204264=_0x204264-0x0;var _0x287e46=_0x1c46[_0x204264];return _0x287e46;};'use strict';var _=require('lodash');var util=require(_0x61c4('0x0'));var logger=require(_0x61c4('0x1'))(_0x61c4('0x2'));var moment=require(_0x61c4('0x3'));var BPromise=require(_0x61c4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x61c4('0x5'));var attributes=require(_0x61c4('0x6'));module['exports']=function(_0x2449bb,_0x2e5c80){return _0x2449bb['define'](_0x61c4('0x7'),attributes,{'tableName':_0x61c4('0x8'),'paranoid':![],'indexes':[{'name':_0x61c4('0x9'),'fields':[_0x61c4('0xa'),_0x61c4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index e703da9..44db88f 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 _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 +var _0xa8ec=['error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12ceba,_0x59ba15){var _0x36c243=function(_0x4f44c9){while(--_0x4f44c9){_0x12ceba['push'](_0x12ceba['shift']());}};_0x36c243(++_0x59ba15);}(_0xa8ec,0xff));var _0xca8e=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xa8ec[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xca8e('0x0'));var util=require('util');var moment=require(_0xca8e('0x1'));var BPromise=require(_0xca8e('0x2'));var rs=require(_0xca8e('0x3'));var fs=require('fs');var Redis=require(_0xca8e('0x4'));var db=require(_0xca8e('0x5'))['db'];var utils=require(_0xca8e('0x6'));var logger=require(_0xca8e('0x7'))(_0xca8e('0x8'));var config=require(_0xca8e('0x9'));var jayson=require(_0xca8e('0xa'));var client=jayson[_0xca8e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dff57,_0x3f92f1,_0x22685b){return new BPromise(function(_0x13cb02,_0x1a1af9){return client['request'](_0x5dff57,_0x22685b)['then'](function(_0x1f5737){logger[_0xca8e('0xc')](_0xca8e('0xd'),_0x3f92f1,_0xca8e('0xe'));logger[_0xca8e('0xf')](_0xca8e('0x10'),_0x3f92f1,_0xca8e('0xe'),JSON[_0xca8e('0x11')](_0x1f5737));if(_0x1f5737['error']){if(_0x1f5737[_0xca8e('0x12')]['code']===0x1f4){logger[_0xca8e('0x12')](_0xca8e('0xd'),_0x3f92f1,_0x1f5737[_0xca8e('0x12')][_0xca8e('0x13')]);return _0x1a1af9(_0x1f5737[_0xca8e('0x12')]['message']);}logger[_0xca8e('0x12')](_0xca8e('0xd'),_0x3f92f1,_0x1f5737[_0xca8e('0x12')][_0xca8e('0x13')]);return _0x13cb02(_0x1f5737[_0xca8e('0x12')][_0xca8e('0x13')]);}else{logger[_0xca8e('0xc')](_0xca8e('0xd'),_0x3f92f1,'request\x20sent');_0x13cb02(_0x1f5737[_0xca8e('0x14')][_0xca8e('0x13')]);}})['catch'](function(_0x331ebf){logger['error'](_0xca8e('0xd'),_0x3f92f1,_0x331ebf);_0x1a1af9(_0x331ebf);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index cdfa13c..da7f34b 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 _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 +var _0xf374=['/describe','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf374,0xa1));var _0x4f37=function(_0xad9695,_0x5a7050){_0xad9695=_0xad9695-0x0;var _0x29e1ce=_0xf374[_0xad9695];return _0x29e1ce;};'use strict';var multer=require(_0x4f37('0x0'));var util=require(_0x4f37('0x1'));var path=require(_0x4f37('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f37('0x3'));var router=express[_0x4f37('0x4')]();var auth=require(_0x4f37('0x5'));var interaction=require(_0x4f37('0x6'));var config=require(_0x4f37('0x7'));var controller=require('./userProfileSection.controller');router[_0x4f37('0x8')]('/',auth[_0x4f37('0x9')](),controller['index']);router[_0x4f37('0x8')](_0x4f37('0xa'),auth[_0x4f37('0x9')](),controller[_0x4f37('0xb')]);router[_0x4f37('0x8')](_0x4f37('0xc'),auth[_0x4f37('0x9')](),controller['show']);router[_0x4f37('0xd')]('/',auth[_0x4f37('0x9')](),controller['create']);router[_0x4f37('0xe')]('/:id',auth[_0x4f37('0x9')](),controller[_0x4f37('0xf')]);router[_0x4f37('0x10')](_0x4f37('0xc'),auth['isAuthenticated'](),controller[_0x4f37('0x11')]);module[_0x4f37('0x12')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5fc1f09..85f88a4 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 _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 +var _0x1a66=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x487380,_0x156561){var _0x537411=function(_0x4a24c1){while(--_0x4a24c1){_0x487380['push'](_0x487380['shift']());}};_0x537411(++_0x156561);}(_0x1a66,0x102));var _0x61a6=function(_0x96d4a3,_0x57abca){_0x96d4a3=_0x96d4a3-0x0;var _0x11d70d=_0x1a66[_0x96d4a3];return _0x11d70d;};'use strict';var Sequelize=require(_0x61a6('0x0'));module[_0x61a6('0x1')]={'name':{'type':Sequelize[_0x61a6('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x61a6('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x61a6('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x61a6('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2f486d){this[_0x61a6('0x5')](_0x61a6('0x6'),_0x2f486d?_0x2f486d['join'](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this['getDataValue'](_0x61a6('0x6'))[_0x61a6('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b4e781a..d09bf1e 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 _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 +var _0x55a8=['filters','intersection','model','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','includeAll','rows','catch','params','include','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','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','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','type','key','query','keys'];(function(_0x3bf3f1,_0x5b8238){var _0x5a0c0c=function(_0x303fac){while(--_0x303fac){_0x3bf3f1['push'](_0x3bf3f1['shift']());}};_0x5a0c0c(++_0x5b8238);}(_0x55a8,0xad));var _0x855a=function(_0x46e2d2,_0x1934e9){_0x46e2d2=_0x46e2d2-0x0;var _0x1332fc=_0x55a8[_0x46e2d2];return _0x1332fc;};'use strict';var pdf=require(_0x855a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x855a('0x1'));var zipdir=require(_0x855a('0x2'));var jsonpatch=require(_0x855a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x855a('0x4'));var Mustache=require(_0x855a('0x5'));var util=require(_0x855a('0x6'));var path=require(_0x855a('0x7'));var sox=require(_0x855a('0x8'));var csv=require(_0x855a('0x9'));var ejs=require(_0x855a('0xa'));var fs=require('fs');var _=require(_0x855a('0xb'));var squel=require(_0x855a('0xc'));var crypto=require(_0x855a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x855a('0xe'));var toCsv=require(_0x855a('0x9'));var querystring=require(_0x855a('0xf'));var Papa=require(_0x855a('0x10'));var Redis=require(_0x855a('0x11'));var authService=require(_0x855a('0x12'));var qs=require(_0x855a('0x13'));var as=require(_0x855a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x855a('0x15'))(_0x855a('0x16'));var utils=require(_0x855a('0x17'));var config=require(_0x855a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x855a('0x19'))['db'];function respondWithStatusCode(_0xe59d2b,_0x5cb22f){_0x5cb22f=_0x5cb22f||0xcc;return function(_0x4a1a85){if(_0x4a1a85){return _0xe59d2b['sendStatus'](_0x5cb22f);}return _0xe59d2b[_0x855a('0x1a')](_0x5cb22f)[_0x855a('0x1b')]();};}function respondWithResult(_0x2899b7,_0x5ef0e5){_0x5ef0e5=_0x5ef0e5||0xc8;return function(_0x581cc1){if(_0x581cc1){return _0x2899b7[_0x855a('0x1a')](_0x5ef0e5)['json'](_0x581cc1);}};}function respondWithFilteredResult(_0x2918ec,_0x31a200){return function(_0x560f2c){if(_0x560f2c){var _0x15abfa=_0x560f2c[_0x855a('0x1c')],_0x36c518=_0x31a200[_0x855a('0x1d')],_0x355f9a=_0x31a200['offset']+_0x31a200['limit'],_0x384e9;if(_0x355f9a>=_0x15abfa){_0x355f9a=_0x15abfa;_0x384e9=0xc8;}else{_0x384e9=0xce;}_0x2918ec['status'](_0x384e9);return _0x2918ec[_0x855a('0x1e')](_0x855a('0x1f'),_0x36c518+'-'+_0x355f9a+'/'+_0x15abfa)['json'](_0x560f2c);}return null;};}function patchUpdates(_0x48bb90){return function(_0x446bee){try{jsonpatch[_0x855a('0x20')](_0x446bee,_0x48bb90,!![]);}catch(_0x47493f){return BPromise[_0x855a('0x21')](_0x47493f);}return _0x446bee[_0x855a('0x22')]();};}function saveUpdates(_0x394224,_0x14ed4a){return function(_0x252d06){if(_0x252d06){return _0x252d06[_0x855a('0x23')](_0x394224)[_0x855a('0x24')](function(_0x58b986){return _0x58b986;});}return null;};}function removeEntity(_0x1329ff,_0x557371){return function(_0x56b5fa){if(_0x56b5fa){return _0x56b5fa[_0x855a('0x25')]()[_0x855a('0x24')](function(){_0x1329ff[_0x855a('0x1a')](0xcc)[_0x855a('0x1b')]();});}};}function handleEntityNotFound(_0x24a097,_0x1241ef){return function(_0x2400b9){if(!_0x2400b9){_0x24a097[_0x855a('0x26')](0x194);}return _0x2400b9;};}function handleError(_0x9cc304,_0x24d95c){_0x24d95c=_0x24d95c||0x1f4;return function(_0x8870){logger[_0x855a('0x27')](_0x8870[_0x855a('0x28')]);if(_0x8870[_0x855a('0x29')]){delete _0x8870['name'];}_0x9cc304[_0x855a('0x1a')](_0x24d95c)[_0x855a('0x2a')](_0x8870);};}exports[_0x855a('0x2b')]=function(_0x3195f2,_0x51ddd3){var _0x2b8487={},_0x36682b={},_0x40defa={'count':0x0,'rows':[]};var _0x1681b0=_[_0x855a('0x2c')](db['UserProfileSection']['rawAttributes'],function(_0x12f444){return{'name':_0x12f444['fieldName'],'type':_0x12f444[_0x855a('0x2d')][_0x855a('0x2e')]};});_0x36682b['model']=_[_0x855a('0x2c')](_0x1681b0,'name');_0x36682b[_0x855a('0x2f')]=_[_0x855a('0x30')](_0x3195f2[_0x855a('0x2f')]);_0x36682b[_0x855a('0x31')]=_[_0x855a('0x32')](_0x36682b[_0x855a('0x33')],_0x36682b[_0x855a('0x2f')]);_0x2b8487[_0x855a('0x34')]=_[_0x855a('0x32')](_0x36682b[_0x855a('0x33')],qs[_0x855a('0x35')](_0x3195f2[_0x855a('0x2f')][_0x855a('0x35')]));_0x2b8487[_0x855a('0x34')]=_0x2b8487[_0x855a('0x34')][_0x855a('0x36')]?_0x2b8487[_0x855a('0x34')]:_0x36682b[_0x855a('0x33')];if(!_0x3195f2['query']['hasOwnProperty'](_0x855a('0x37'))){_0x2b8487[_0x855a('0x38')]=qs[_0x855a('0x38')](_0x3195f2[_0x855a('0x2f')][_0x855a('0x38')]);_0x2b8487['offset']=qs[_0x855a('0x1d')](_0x3195f2[_0x855a('0x2f')][_0x855a('0x1d')]);}_0x2b8487['order']=qs[_0x855a('0x39')](_0x3195f2[_0x855a('0x2f')][_0x855a('0x39')]);_0x2b8487[_0x855a('0x3a')]=qs[_0x855a('0x31')](_[_0x855a('0x3b')](_0x3195f2[_0x855a('0x2f')],_0x36682b['filters']),_0x1681b0);if(_0x3195f2[_0x855a('0x2f')][_0x855a('0x3c')]){_0x2b8487[_0x855a('0x3a')]=_[_0x855a('0x3d')](_0x2b8487[_0x855a('0x3a')],{'$or':_['map'](_0x1681b0,function(_0x145938){if(_0x145938['type']!==_0x855a('0x3e')){var _0x59daa9={};_0x59daa9[_0x145938[_0x855a('0x29')]]={'$like':'%'+_0x3195f2['query']['filter']+'%'};return _0x59daa9;}})});}_0x2b8487=_[_0x855a('0x3d')]({},_0x2b8487,_0x3195f2[_0x855a('0x3f')]);var _0x42da23={'where':_0x2b8487[_0x855a('0x3a')]};return db[_0x855a('0x40')][_0x855a('0x1c')](_0x42da23)['then'](function(_0x3836a6){_0x40defa[_0x855a('0x1c')]=_0x3836a6;if(_0x3195f2[_0x855a('0x2f')][_0x855a('0x41')]){_0x2b8487['include']=[{'all':!![]}];}return db[_0x855a('0x40')]['findAll'](_0x2b8487);})['then'](function(_0x5ea51b){_0x40defa[_0x855a('0x42')]=_0x5ea51b;return _0x40defa;})[_0x855a('0x24')](respondWithFilteredResult(_0x51ddd3,_0x2b8487))[_0x855a('0x43')](handleError(_0x51ddd3,null));};exports['show']=function(_0xa9d9c2,_0x127091){var _0xb34fb7={'raw':![],'where':{'id':_0xa9d9c2[_0x855a('0x44')]['id']}},_0x1d808d={};_0x1d808d[_0x855a('0x33')]=_[_0x855a('0x30')](db[_0x855a('0x40')]['rawAttributes']);_0x1d808d[_0x855a('0x2f')]=_['keys'](_0xa9d9c2[_0x855a('0x2f')]);_0x1d808d['filters']=_[_0x855a('0x32')](_0x1d808d['model'],_0x1d808d[_0x855a('0x2f')]);_0xb34fb7['attributes']=_[_0x855a('0x32')](_0x1d808d[_0x855a('0x33')],qs['fields'](_0xa9d9c2['query'][_0x855a('0x35')]));_0xb34fb7['attributes']=_0xb34fb7['attributes'][_0x855a('0x36')]?_0xb34fb7[_0x855a('0x34')]:_0x1d808d['model'];if(_0xa9d9c2[_0x855a('0x2f')][_0x855a('0x41')]){_0xb34fb7[_0x855a('0x45')]=[{'all':!![]}];}_0xb34fb7=_[_0x855a('0x3d')]({},_0xb34fb7,_0xa9d9c2[_0x855a('0x3f')]);return db['UserProfileSection'][_0x855a('0x46')](_0xb34fb7)[_0x855a('0x24')](handleEntityNotFound(_0x127091,null))['then'](respondWithResult(_0x127091,null))[_0x855a('0x43')](handleError(_0x127091,null));};exports[_0x855a('0x47')]=function(_0x1d2509,_0x30359d){return db['UserProfileSection'][_0x855a('0x47')](_0x1d2509[_0x855a('0x48')],{})['then'](respondWithResult(_0x30359d,0xc9))[_0x855a('0x43')](handleError(_0x30359d,null));};exports[_0x855a('0x23')]=function(_0x266a37,_0x3d5c1d){if(_0x266a37[_0x855a('0x48')]['id']){delete _0x266a37[_0x855a('0x48')]['id'];}return db[_0x855a('0x40')][_0x855a('0x46')]({'where':{'id':_0x266a37[_0x855a('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d5c1d,null))[_0x855a('0x24')](saveUpdates(_0x266a37[_0x855a('0x48')],null))[_0x855a('0x24')](respondWithResult(_0x3d5c1d,null))[_0x855a('0x43')](handleError(_0x3d5c1d,null));};exports[_0x855a('0x25')]=function(_0x5f54ad,_0x40784d){return db['UserProfileSection'][_0x855a('0x46')]({'where':{'id':_0x5f54ad[_0x855a('0x44')]['id']}})[_0x855a('0x24')](handleEntityNotFound(_0x40784d,null))[_0x855a('0x24')](removeEntity(_0x40784d,null))[_0x855a('0x43')](handleError(_0x40784d,null));};exports[_0x855a('0x49')]=function(_0xd71836,_0x4e46eb){return db[_0x855a('0x40')][_0x855a('0x49')]()[_0x855a('0x24')](respondWithResult(_0x4e46eb,null))[_0x855a('0x43')](handleError(_0x4e46eb,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a015572..ecf29c0 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 _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 +var _0x1fee=['path','rimraf','../../config/environment','./userProfileSection.attributes','exports','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1fee,0x12e));var _0xe1fe=function(_0x587ef4,_0x293991){_0x587ef4=_0x587ef4-0x0;var _0x275768=_0x1fee[_0x587ef4];return _0x275768;};'use strict';var _=require(_0xe1fe('0x0'));var util=require(_0xe1fe('0x1'));var logger=require(_0xe1fe('0x2'))(_0xe1fe('0x3'));var moment=require(_0xe1fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xe1fe('0x5'));var fs=require('fs');var path=require(_0xe1fe('0x6'));var rimraf=require(_0xe1fe('0x7'));var config=require(_0xe1fe('0x8'));var attributes=require(_0xe1fe('0x9'));module[_0xe1fe('0xa')]=function(_0x8b3fd,_0x3c5fb1){return _0x8b3fd['define']('UserProfileSection',attributes,{'tableName':_0xe1fe('0xb'),'paranoid':![],'indexes':[{'name':_0xe1fe('0xc'),'fields':['sectionId',_0xe1fe('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c8f569e..63a6ea3 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 _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 +var _0x324c=['code','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x439534,_0x4ff786){var _0x211660=function(_0x338e7e){while(--_0x338e7e){_0x439534['push'](_0x439534['shift']());}};_0x211660(++_0x4ff786);}(_0x324c,0x1bc));var _0xc324=function(_0x5af316,_0x19cd9d){_0x5af316=_0x5af316-0x0;var _0x469e1e=_0x324c[_0x5af316];return _0x469e1e;};'use strict';var _=require(_0xc324('0x0'));var util=require(_0xc324('0x1'));var moment=require(_0xc324('0x2'));var BPromise=require(_0xc324('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc324('0x4'));var logger=require(_0xc324('0x5'))(_0xc324('0x6'));var config=require(_0xc324('0x7'));var jayson=require(_0xc324('0x8'));var client=jayson[_0xc324('0x9')][_0xc324('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bae7f,_0x11098e,_0x25feba){return new BPromise(function(_0x41c634,_0x22ca6a){return client[_0xc324('0xb')](_0x1bae7f,_0x25feba)[_0xc324('0xc')](function(_0x2ed16e){logger['info'](_0xc324('0xd'),_0x11098e,'request\x20sent');logger['debug'](_0xc324('0xe'),_0x11098e,_0xc324('0xf'),JSON[_0xc324('0x10')](_0x2ed16e));if(_0x2ed16e[_0xc324('0x11')]){if(_0x2ed16e[_0xc324('0x11')][_0xc324('0x12')]===0x1f4){logger[_0xc324('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x11098e,_0x2ed16e[_0xc324('0x11')][_0xc324('0x13')]);return _0x22ca6a(_0x2ed16e[_0xc324('0x11')]['message']);}logger[_0xc324('0x11')](_0xc324('0xd'),_0x11098e,_0x2ed16e[_0xc324('0x11')]['message']);return _0x41c634(_0x2ed16e['error'][_0xc324('0x13')]);}else{logger['info'](_0xc324('0xd'),_0x11098e,'request\x20sent');_0x41c634(_0x2ed16e[_0xc324('0x14')][_0xc324('0x13')]);}})[_0xc324('0x15')](function(_0x10175d){logger[_0xc324('0x11')](_0xc324('0xd'),_0x11098e,_0x10175d);_0x22ca6a(_0x10175d);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 888b213..4f532d3 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 _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 +var _0xd847=['connect-timeout','express','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x2e7631,_0x4a3727){var _0x5d2767=function(_0x3e1a1e){while(--_0x3e1a1e){_0x2e7631['push'](_0x2e7631['shift']());}};_0x5d2767(++_0x4a3727);}(_0xd847,0xcd));var _0x7d84=function(_0x124e25,_0x2be1d8){_0x124e25=_0x124e25-0x0;var _0xa448c1=_0xd847[_0x124e25];return _0xa448c1;};'use strict';var multer=require(_0x7d84('0x0'));var util=require(_0x7d84('0x1'));var path=require(_0x7d84('0x2'));var timeout=require(_0x7d84('0x3'));var express=require(_0x7d84('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7d84('0x5'));var config=require(_0x7d84('0x6'));module[_0x7d84('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 36626fb..762c29a 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(_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 +var _0xd8b0=['exports','sequelize'];(function(_0x984ff7,_0x3b21ee){var _0x41942a=function(_0x2c95d9){while(--_0x2c95d9){_0x984ff7['push'](_0x984ff7['shift']());}};_0x41942a(++_0x3b21ee);}(_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 174d8fa..68462d2 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 _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 +var _0x1b35=['UserSmsQueue','user_has_sms_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x1b35,0x66));var _0x51b3=function(_0x6c564a,_0x2e2c12){_0x6c564a=_0x6c564a-0x0;var _0x571bbe=_0x1b35[_0x6c564a];return _0x571bbe;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51b3('0x0'))(_0x51b3('0x1'));var moment=require(_0x51b3('0x2'));var BPromise=require(_0x51b3('0x3'));var rp=require(_0x51b3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x51b3('0x5'));var config=require(_0x51b3('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x51b3('0x7')]=function(_0x4f51ee,_0x3d0238){return _0x4f51ee['define'](_0x51b3('0x8'),attributes,{'tableName':_0x51b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 6967b73..96ca5c4 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 _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 +var _0x46c9=['debug','stringify','error','code','message','UserSmsQueue,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x46c9,0xfa));var _0x946c=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0x46c9[_0x10f68e];return _0x4c8372;};'use strict';var _=require('lodash');var util=require(_0x946c('0x0'));var moment=require(_0x946c('0x1'));var BPromise=require(_0x946c('0x2'));var rs=require(_0x946c('0x3'));var fs=require('fs');var Redis=require(_0x946c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x946c('0x5'))(_0x946c('0x6'));var config=require(_0x946c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x946c('0x8')][_0x946c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ecf89,_0x2ca960,_0x4117e4){return new BPromise(function(_0x3bc4b1,_0x478b1d){return client[_0x946c('0xa')](_0x2ecf89,_0x4117e4)[_0x946c('0xb')](function(_0x30f152){logger[_0x946c('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x2ca960,_0x946c('0xd'));logger[_0x946c('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x2ca960,_0x946c('0xd'),JSON[_0x946c('0xf')](_0x30f152));if(_0x30f152[_0x946c('0x10')]){if(_0x30f152['error'][_0x946c('0x11')]===0x1f4){logger[_0x946c('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2ca960,_0x30f152['error'][_0x946c('0x12')]);return _0x478b1d(_0x30f152[_0x946c('0x10')][_0x946c('0x12')]);}logger[_0x946c('0x10')](_0x946c('0x13'),_0x2ca960,_0x30f152[_0x946c('0x10')][_0x946c('0x12')]);return _0x3bc4b1(_0x30f152[_0x946c('0x10')][_0x946c('0x12')]);}else{logger['info'](_0x946c('0x13'),_0x2ca960,_0x946c('0xd'));_0x3bc4b1(_0x30f152[_0x946c('0x14')]['message']);}})[_0x946c('0x15')](function(_0x3d9db3){logger[_0x946c('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x2ca960,_0x3d9db3);_0x478b1d(_0x3d9db3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 939a16b..cc8f4eb 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 _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 +var _0x525a=['../../config/environment','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x17f091,_0x58fc06){var _0x2ce0f8=function(_0x52b765){while(--_0x52b765){_0x17f091['push'](_0x17f091['shift']());}};_0x2ce0f8(++_0x58fc06);}(_0x525a,0x110));var _0xa525=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x525a[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0xa525('0x0'));var util=require(_0xa525('0x1'));var path=require('path');var timeout=require(_0xa525('0x2'));var express=require(_0xa525('0x3'));var router=express[_0xa525('0x4')]();var auth=require(_0xa525('0x5'));var interaction=require(_0xa525('0x6'));var config=require(_0xa525('0x7'));module[_0xa525('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 5eb2bbe..4dd68cb 100644 --- a/server/api/userVoiceQueue/userVoiceQueue.attributes.js +++ b/server/api/userVoiceQueue/userVoiceQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['exports','INTEGER'];(function(_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 +var _0xbaf0=['exports','INTEGER'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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 dfaf5de..5b7ff51 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 _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 +var _0x4d9e=['lodash','api','bluebird','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x465a51,_0xa52a3e){_0x465a51=_0x465a51-0x0;var _0x21cadb=_0x4d9e[_0x465a51];return _0x21cadb;};'use strict';var _=require(_0xe4d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe4d9('0x1'));var moment=require('moment');var BPromise=require(_0xe4d9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4d9('0x3'));var rimraf=require(_0xe4d9('0x4'));var config=require('../../config/environment');var attributes=require(_0xe4d9('0x5'));module[_0xe4d9('0x6')]=function(_0x278035,_0x34c2a2){return _0x278035[_0xe4d9('0x7')](_0xe4d9('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 807eb2b..411a02a 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 _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 +var _0x134b=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3665b9,_0x3b5d4f){var _0x524099=function(_0x876977){while(--_0x876977){_0x3665b9['push'](_0x3665b9['shift']());}};_0x524099(++_0x3b5d4f);}(_0x134b,0x78));var _0xb134=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x134b[_0x313c96];return _0x522f53;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb134('0x0'));var BPromise=require(_0xb134('0x1'));var rs=require(_0xb134('0x2'));var fs=require('fs');var Redis=require(_0xb134('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb134('0x4'));var logger=require(_0xb134('0x5'))(_0xb134('0x6'));var config=require(_0xb134('0x7'));var jayson=require(_0xb134('0x8'));var client=jayson[_0xb134('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f34c5,_0x56f4ef,_0x181a64){return new BPromise(function(_0x2d6842,_0x551892){return client[_0xb134('0xa')](_0x4f34c5,_0x181a64)[_0xb134('0xb')](function(_0x3149a0){logger['info'](_0xb134('0xc'),_0x56f4ef,_0xb134('0xd'));logger[_0xb134('0xe')](_0xb134('0xf'),_0x56f4ef,_0xb134('0xd'),JSON[_0xb134('0x10')](_0x3149a0));if(_0x3149a0[_0xb134('0x11')]){if(_0x3149a0['error']['code']===0x1f4){logger[_0xb134('0x11')](_0xb134('0xc'),_0x56f4ef,_0x3149a0['error'][_0xb134('0x12')]);return _0x551892(_0x3149a0[_0xb134('0x11')]['message']);}logger[_0xb134('0x11')](_0xb134('0xc'),_0x56f4ef,_0x3149a0[_0xb134('0x11')][_0xb134('0x12')]);return _0x2d6842(_0x3149a0[_0xb134('0x11')][_0xb134('0x12')]);}else{logger[_0xb134('0x13')](_0xb134('0xc'),_0x56f4ef,_0xb134('0xd'));_0x2d6842(_0x3149a0['result'][_0xb134('0x12')]);}})['catch'](function(_0x9254c9){logger[_0xb134('0x11')](_0xb134('0xc'),_0x56f4ef,_0x9254c9);_0x551892(_0x9254c9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f69fb2d..beefddb 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 _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 +var _0xb021=['multer','util','path','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x595d24,_0x44ba66){var _0x5a207d=function(_0x86dcaf){while(--_0x86dcaf){_0x595d24['push'](_0x595d24['shift']());}};_0x5a207d(++_0x44ba66);}(_0xb021,0x18c));var _0x1b02=function(_0x107844,_0x41926f){_0x107844=_0x107844-0x0;var _0x40c2b5=_0xb021[_0x107844];return _0x40c2b5;};'use strict';var multer=require(_0x1b02('0x0'));var util=require(_0x1b02('0x1'));var path=require(_0x1b02('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x1b02('0x3'));var interaction=require(_0x1b02('0x4'));var config=require('../../config/environment');module[_0x1b02('0x5')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f2dae91..0fc4159 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 _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 +var _0x7c2f=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x49b584,_0x22097e){var _0x3494e1=function(_0x18f8fa){while(--_0x18f8fa){_0x49b584['push'](_0x49b584['shift']());}};_0x3494e1(++_0x22097e);}(_0x7c2f,0x7d));var _0xf7c2=function(_0x5d6fdc,_0x9f72e){_0x5d6fdc=_0x5d6fdc-0x0;var _0x26f4eb=_0x7c2f[_0x5d6fdc];return _0x26f4eb;};'use strict';var Sequelize=require(_0xf7c2('0x0'));module[_0xf7c2('0x1')]={'uniqueid':{'type':Sequelize[_0xf7c2('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xf7c2('0x3')},'membername':{'type':Sequelize[_0xf7c2('0x4')],'allowNull':![],'comment':_0xf7c2('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7c2('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xf7c2('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf7c2('0x4')],'allowNull':![],'unique':_0xf7c2('0x5'),'comment':_0xf7c2('0x3')},'penalty':{'type':Sequelize[_0xf7c2('0x2')](0xb),'defaultValue':0x0,'comment':_0xf7c2('0x3')},'paused':{'type':Sequelize[_0xf7c2('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 bc83a64..9b78783 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 _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 +var _0xe4e4=['setMaxListeners','update','remove','emit','exports','events'];(function(_0x4209f2,_0xbe2935){var _0x5a44e4=function(_0x2fca9c){while(--_0x2fca9c){_0x4209f2['push'](_0x4209f2['shift']());}};_0x5a44e4(++_0xbe2935);}(_0xe4e4,0xa1));var _0x4e4e=function(_0x238693,_0xd8e706){_0x238693=_0x238693-0x0;var _0x8c93d0=_0xe4e4[_0x238693];return _0x8c93d0;};'use strict';var EventEmitter=require(_0x4e4e('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x4e4e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e4e('0x2'),'afterDestroy':_0x4e4e('0x3')};function emitEvent(_0xb2fd24){return function(_0x3ecdfa,_0x214650,_0x17c868){UserVoiceQueueRtEvents[_0x4e4e('0x4')](_0xb2fd24+':'+_0x3ecdfa['id'],_0x3ecdfa);UserVoiceQueueRtEvents[_0x4e4e('0x4')](_0xb2fd24,_0x3ecdfa);_0x17c868(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x4e4e('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 550fa89..f4c369f 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 _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 +var _0x7f42=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x4e2ad5,_0x2ce51e){var _0x1d8bb9=function(_0xd8153){while(--_0xd8153){_0x4e2ad5['push'](_0x4e2ad5['shift']());}};_0x1d8bb9(++_0x2ce51e);}(_0x7f42,0x11e));var _0x27f4=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x7f42[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x27f4('0x0'));var logger=require(_0x27f4('0x1'))(_0x27f4('0x2'));var moment=require(_0x27f4('0x3'));var BPromise=require('bluebird');var rp=require(_0x27f4('0x4'));var fs=require('fs');var path=require(_0x27f4('0x5'));var rimraf=require(_0x27f4('0x6'));var config=require(_0x27f4('0x7'));var attributes=require(_0x27f4('0x8'));module[_0x27f4('0x9')]=function(_0xf80dce,_0x5304bf){return _0xf80dce[_0x27f4('0xa')](_0x27f4('0xb'),attributes,{'tableName':_0x27f4('0xc'),'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 3f0f5f6..3f52164 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 _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 +var _0x02cf=['socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses','findAll','options','where','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x213518,_0x51e022){var _0x1baf75=function(_0x5c8444){while(--_0x5c8444){_0x213518['push'](_0x213518['shift']());}};_0x1baf75(++_0x51e022);}(_0x02cf,0x105));var _0xf02c=function(_0x296893,_0x184e8a){_0x296893=_0x296893-0x0;var _0x39ab5d=_0x02cf[_0x296893];return _0x39ab5d;};'use strict';var _=require(_0xf02c('0x0'));var util=require('util');var moment=require(_0xf02c('0x1'));var BPromise=require(_0xf02c('0x2'));var rs=require(_0xf02c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf02c('0x4'));var logger=require('../../config/logger')(_0xf02c('0x5'));var config=require(_0xf02c('0x6'));var jayson=require(_0xf02c('0x7'));var client=jayson[_0xf02c('0x8')][_0xf02c('0x9')]({'port':0x232a});config[_0xf02c('0xa')]=_['defaults'](config[_0xf02c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf02c('0xb'))(new Redis(config['redis']));require(_0xf02c('0xc'))[_0xf02c('0xd')](socket);function respondWithRpcPromise(_0x303146,_0x46c42a,_0x8b0e5d){return new BPromise(function(_0x4bc445,_0x174124){return client[_0xf02c('0xe')](_0x303146,_0x8b0e5d)['then'](function(_0x3d92c6){logger[_0xf02c('0xf')](_0xf02c('0x10'),_0x46c42a,_0xf02c('0x11'));logger[_0xf02c('0x12')](_0xf02c('0x13'),_0x46c42a,_0xf02c('0x11'),JSON[_0xf02c('0x14')](_0x3d92c6));if(_0x3d92c6['error']){if(_0x3d92c6[_0xf02c('0x15')][_0xf02c('0x16')]===0x1f4){logger[_0xf02c('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x46c42a,_0x3d92c6[_0xf02c('0x15')][_0xf02c('0x17')]);return _0x174124(_0x3d92c6[_0xf02c('0x15')][_0xf02c('0x17')]);}logger['error'](_0xf02c('0x10'),_0x46c42a,_0x3d92c6['error'][_0xf02c('0x17')]);return _0x4bc445(_0x3d92c6['error'][_0xf02c('0x17')]);}else{logger[_0xf02c('0xf')](_0xf02c('0x10'),_0x46c42a,_0xf02c('0x11'));_0x4bc445(_0x3d92c6[_0xf02c('0x18')][_0xf02c('0x17')]);}})[_0xf02c('0x19')](function(_0x5aa3c8){logger[_0xf02c('0x15')](_0xf02c('0x10'),_0x46c42a,_0x5aa3c8);_0x174124(_0x5aa3c8);});});}exports[_0xf02c('0x1a')]=function(_0x106006){var _0x18d731=this;return new Promise(function(_0x90bec7,_0x269c97){return db['UserVoiceQueueRt'][_0xf02c('0x1b')]({'raw':_0x106006[_0xf02c('0x1c')]?_0x106006[_0xf02c('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x106006[_0xf02c('0x1c')]?_0x106006[_0xf02c('0x1c')][_0xf02c('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xf02c('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xf02c('0x1f')](_0xf02c('0x20')))),_0xf02c('0x21')]]})['then'](function(_0x2c819d){logger[_0xf02c('0xf')](_0xf02c('0x1a'),_0x106006);logger['debug'](_0xf02c('0x1a'),_0x106006,JSON[_0xf02c('0x14')](_0x2c819d));_0x90bec7(_0x2c819d);})[_0xf02c('0x19')](function(_0x95dd8e){logger[_0xf02c('0x15')](_0xf02c('0x1a'),_0x95dd8e['message'],_0x106006);_0x269c97(_0x18d731[_0xf02c('0x15')](0x1f4,_0x95dd8e[_0xf02c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 2b7ffca..6817b2a 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 _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 +var _0x6446=['save','remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x40f09a,_0x3743b6){var _0x2eb96c=function(_0xe6203d){while(--_0xe6203d){_0x40f09a['push'](_0x40f09a['shift']());}};_0x2eb96c(++_0x3743b6);}(_0x6446,0x194));var _0x6644=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x6446[_0x409deb];return _0x15a4f7;};'use strict';var UserVoiceQueueRtEvents=require(_0x6644('0x0'));var events=[_0x6644('0x1'),_0x6644('0x2'),_0x6644('0x3')];function createListener(_0x1c1217,_0x480334){return function(_0x301c85){_0x480334[_0x6644('0x4')](_0x1c1217,_0x301c85);};}function removeListener(_0x2d4e9e,_0x357b92){return function(){UserVoiceQueueRtEvents[_0x6644('0x5')](_0x2d4e9e,_0x357b92);};}exports[_0x6644('0x6')]=function(_0x25f5ce){for(var _0x51a780=0x0,_0x5f04dc=events[_0x6644('0x7')];_0x51a780<_0x5f04dc;_0x51a780++){var _0x4c2b5b=events[_0x51a780];var _0x3c144d=createListener(_0x6644('0x8')+_0x4c2b5b,_0x25f5ce);UserVoiceQueueRtEvents['on'](_0x4c2b5b,_0x3c144d);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 2c9ae16..c7b3089 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 _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 +var _0x5fe9=['util','express','Router','../../components/auth/service','../../components/interaction/service','multer'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5fe9,0x149));var _0x95fe=function(_0x112c20,_0xa14d0d){_0x112c20=_0x112c20-0x0;var _0x2e1c0e=_0x5fe9[_0x112c20];return _0x2e1c0e;};'use strict';var multer=require(_0x95fe('0x0'));var util=require(_0x95fe('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x95fe('0x2'));var router=express[_0x95fe('0x3')]();var auth=require(_0x95fe('0x4'));var interaction=require(_0x95fe('0x5'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6c32264..2e6e914 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 _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 +var _0xd8b0=['exports','sequelize'];(function(_0x268a56,_0x3f1b88){var _0x54a565=function(_0x22f88f){while(--_0x22f88f){_0x268a56['push'](_0x268a56['shift']());}};_0x54a565(++_0x3f1b88);}(_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/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 28650f4..27deb9a 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 _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 +var _0xefda=['../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','api','moment','request-promise','path','rimraf'];(function(_0x53bf7d,_0x3a17b4){var _0x4b4105=function(_0x208d92){while(--_0x208d92){_0x53bf7d['push'](_0x53bf7d['shift']());}};_0x4b4105(++_0x3a17b4);}(_0xefda,0x96));var _0xaefd=function(_0x150cca,_0x84becb){_0x150cca=_0x150cca-0x0;var _0x26cb10=_0xefda[_0x150cca];return _0x26cb10;};'use strict';var _=require(_0xaefd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaefd('0x1'));var moment=require(_0xaefd('0x2'));var BPromise=require('bluebird');var rp=require(_0xaefd('0x3'));var fs=require('fs');var path=require(_0xaefd('0x4'));var rimraf=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var attributes=require(_0xaefd('0x7'));module[_0xaefd('0x8')]=function(_0x497258,_0x3677ea){return _0x497258[_0xaefd('0x9')](_0xaefd('0xa'),attributes,{'tableName':_0xaefd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 793192b..4dc840a 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(_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 +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(_0x103da9,_0x42b69e){var _0xf56fef=function(_0x445e9c){while(--_0x445e9c){_0x103da9['push'](_0x103da9['shift']());}};_0xf56fef(++_0x42b69e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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 86219c3..233a909 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 _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 +var _0x76d4=['index','get','/:id','show','post','create','put','update','delete','util','path','Router','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0x76d4,0x1b9));var _0x476d=function(_0x283ebd,_0x383db3){_0x283ebd=_0x283ebd-0x0;var _0x35eb2d=_0x76d4[_0x283ebd];return _0x35eb2d;};'use strict';var multer=require('multer');var util=require(_0x476d('0x0'));var path=require(_0x476d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x476d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x476d('0x3'));var config=require(_0x476d('0x4'));var controller=require(_0x476d('0x5'));router['get']('/',auth[_0x476d('0x6')](),controller[_0x476d('0x7')]);router[_0x476d('0x8')](_0x476d('0x9'),auth[_0x476d('0x6')](),controller[_0x476d('0xa')]);router[_0x476d('0xb')]('/',auth[_0x476d('0x6')](),controller[_0x476d('0xc')]);router[_0x476d('0xd')](_0x476d('0x9'),auth[_0x476d('0x6')](),controller[_0x476d('0xe')]);router[_0x476d('0xf')](_0x476d('0x9'),auth[_0x476d('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 8c052d7..29d9018 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 _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 +var _0x10aa=['sequelize','name','STRING'];(function(_0x5a06e0,_0x13ff07){var _0x2f992d=function(_0x47e3d0){while(--_0x47e3d0){_0x5a06e0['push'](_0x5a06e0['shift']());}};_0x2f992d(++_0x13ff07);}(_0x10aa,0x1d1));var _0xa10a=function(_0x1146be,_0x296e2d){_0x1146be=_0x1146be-0x0;var _0x446283=_0x10aa[_0x1146be];return _0x446283;};'use strict';var Sequelize=require(_0xa10a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xa10a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa10a('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 3585fb2..a8a3fd4 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 _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 +var _0x7264=['index','map','Variable','type','key','keys','query','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','send'];(function(_0x346a1b,_0x3503b5){var _0x2b569b=function(_0xe69649){while(--_0xe69649){_0x346a1b['push'](_0x346a1b['shift']());}};_0x2b569b(++_0x3503b5);}(_0x7264,0x1b5));var _0x4726=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x7264[_0x6131cd];return _0x47e916;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4726('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4726('0x1'));var jsonpatch=require(_0x4726('0x2'));var rp=require(_0x4726('0x3'));var moment=require('moment');var BPromise=require(_0x4726('0x4'));var Mustache=require(_0x4726('0x5'));var util=require(_0x4726('0x6'));var path=require(_0x4726('0x7'));var sox=require(_0x4726('0x8'));var csv=require(_0x4726('0x9'));var ejs=require(_0x4726('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4726('0xb'));var crypto=require(_0x4726('0xc'));var jsforce=require(_0x4726('0xd'));var deskjs=require(_0x4726('0xe'));var toCsv=require(_0x4726('0x9'));var querystring=require('querystring');var Papa=require(_0x4726('0xf'));var Redis=require(_0x4726('0x10'));var authService=require(_0x4726('0x11'));var qs=require(_0x4726('0x12'));var as=require(_0x4726('0x13'));var hardwareService=require(_0x4726('0x14'));var logger=require(_0x4726('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4726('0x16'))['db'];function respondWithStatusCode(_0x58f593,_0x521aef){_0x521aef=_0x521aef||0xcc;return function(_0x1378ac){if(_0x1378ac){return _0x58f593[_0x4726('0x17')](_0x521aef);}return _0x58f593[_0x4726('0x18')](_0x521aef)[_0x4726('0x19')]();};}function respondWithResult(_0x2ccecf,_0x37971a){_0x37971a=_0x37971a||0xc8;return function(_0xffa9d2){if(_0xffa9d2){return _0x2ccecf[_0x4726('0x18')](_0x37971a)[_0x4726('0x1a')](_0xffa9d2);}};}function respondWithFilteredResult(_0x118193,_0x5d189e){return function(_0x152620){if(_0x152620){var _0x36d121=_0x152620[_0x4726('0x1b')],_0x589d6a=_0x5d189e[_0x4726('0x1c')],_0x131c0c=_0x5d189e[_0x4726('0x1c')]+_0x5d189e[_0x4726('0x1d')],_0x3d47b5;if(_0x131c0c>=_0x36d121){_0x131c0c=_0x36d121;_0x3d47b5=0xc8;}else{_0x3d47b5=0xce;}_0x118193[_0x4726('0x18')](_0x3d47b5);return _0x118193['set'](_0x4726('0x1e'),_0x589d6a+'-'+_0x131c0c+'/'+_0x36d121)['json'](_0x152620);}return null;};}function patchUpdates(_0x1ef8dd){return function(_0x4aac18){try{jsonpatch[_0x4726('0x1f')](_0x4aac18,_0x1ef8dd,!![]);}catch(_0x373e69){return BPromise[_0x4726('0x20')](_0x373e69);}return _0x4aac18[_0x4726('0x21')]();};}function saveUpdates(_0x3c9f60,_0x70f49b){return function(_0x2b02ba){if(_0x2b02ba){return _0x2b02ba[_0x4726('0x22')](_0x3c9f60)[_0x4726('0x23')](function(_0xc3e13a){return _0xc3e13a;});}return null;};}function removeEntity(_0x45e8a0,_0x11a18a){return function(_0x1b5d30){if(_0x1b5d30){return _0x1b5d30[_0x4726('0x24')]()['then'](function(){var _0x172e63=_0x1b5d30['get']({'plain':!![]});var _0x2d7c74=_0x4726('0x25');return db[_0x4726('0x26')][_0x4726('0x24')]({'where':{'type':_0x2d7c74,'resourceId':_0x172e63['id']}})[_0x4726('0x23')](function(){return _0x1b5d30;});})[_0x4726('0x23')](function(){_0x45e8a0[_0x4726('0x18')](0xcc)[_0x4726('0x19')]();});}};}function handleEntityNotFound(_0x277fc3,_0x2f1d54){return function(_0x518e53){if(!_0x518e53){_0x277fc3['sendStatus'](0x194);}return _0x518e53;};}function handleError(_0x5f44a3,_0x4579df){_0x4579df=_0x4579df||0x1f4;return function(_0x507b41){logger[_0x4726('0x27')](_0x507b41[_0x4726('0x28')]);if(_0x507b41['name']){delete _0x507b41[_0x4726('0x29')];}_0x5f44a3[_0x4726('0x18')](_0x4579df)[_0x4726('0x2a')](_0x507b41);};}exports[_0x4726('0x2b')]=function(_0x36f495,_0x3747c3){var _0x5b9661={},_0x23fce6={},_0x3607ec={'count':0x0,'rows':[]};var _0x928148=_[_0x4726('0x2c')](db[_0x4726('0x2d')]['rawAttributes'],function(_0x5a48bd){return{'name':_0x5a48bd['fieldName'],'type':_0x5a48bd[_0x4726('0x2e')][_0x4726('0x2f')]};});_0x23fce6['model']=_[_0x4726('0x2c')](_0x928148,_0x4726('0x29'));_0x23fce6['query']=_[_0x4726('0x30')](_0x36f495[_0x4726('0x31')]);_0x23fce6[_0x4726('0x32')]=_[_0x4726('0x33')](_0x23fce6['model'],_0x23fce6[_0x4726('0x31')]);_0x5b9661[_0x4726('0x34')]=_[_0x4726('0x33')](_0x23fce6[_0x4726('0x35')],qs[_0x4726('0x36')](_0x36f495[_0x4726('0x31')][_0x4726('0x36')]));_0x5b9661[_0x4726('0x34')]=_0x5b9661[_0x4726('0x34')][_0x4726('0x37')]?_0x5b9661[_0x4726('0x34')]:_0x23fce6[_0x4726('0x35')];if(!_0x36f495['query']['hasOwnProperty'](_0x4726('0x38'))){_0x5b9661['limit']=qs[_0x4726('0x1d')](_0x36f495[_0x4726('0x31')][_0x4726('0x1d')]);_0x5b9661['offset']=qs[_0x4726('0x1c')](_0x36f495[_0x4726('0x31')][_0x4726('0x1c')]);}_0x5b9661[_0x4726('0x39')]=qs[_0x4726('0x3a')](_0x36f495['query'][_0x4726('0x3a')]);_0x5b9661[_0x4726('0x3b')]=qs[_0x4726('0x32')](_['pick'](_0x36f495[_0x4726('0x31')],_0x23fce6['filters']),_0x928148);if(_0x36f495[_0x4726('0x31')][_0x4726('0x3c')]){_0x5b9661[_0x4726('0x3b')]=_[_0x4726('0x3d')](_0x5b9661[_0x4726('0x3b')],{'$or':_[_0x4726('0x2c')](_0x928148,function(_0x71a877){if(_0x71a877[_0x4726('0x2e')]!=='VIRTUAL'){var _0x1196e4={};_0x1196e4[_0x71a877[_0x4726('0x29')]]={'$like':'%'+_0x36f495[_0x4726('0x31')][_0x4726('0x3c')]+'%'};return _0x1196e4;}})});}_0x5b9661=_[_0x4726('0x3d')]({},_0x5b9661,_0x36f495['options']);var _0x418a9f={'where':_0x5b9661[_0x4726('0x3b')]};return db[_0x4726('0x2d')][_0x4726('0x1b')](_0x418a9f)[_0x4726('0x23')](function(_0x437724){_0x3607ec[_0x4726('0x1b')]=_0x437724;if(_0x36f495[_0x4726('0x31')][_0x4726('0x3e')]){_0x5b9661['include']=[{'all':!![]}];}return db[_0x4726('0x2d')][_0x4726('0x3f')](_0x5b9661);})['then'](function(_0x24c943){_0x3607ec[_0x4726('0x40')]=_0x24c943;return _0x3607ec;})[_0x4726('0x23')](respondWithFilteredResult(_0x3747c3,_0x5b9661))[_0x4726('0x41')](handleError(_0x3747c3,null));};exports[_0x4726('0x42')]=function(_0x2324c4,_0x3e59a3){var _0x320c77={'raw':!![],'where':{'id':_0x2324c4[_0x4726('0x43')]['id']}},_0x2e03e7={};_0x2e03e7[_0x4726('0x35')]=_[_0x4726('0x30')](db['Variable'][_0x4726('0x44')]);_0x2e03e7[_0x4726('0x31')]=_[_0x4726('0x30')](_0x2324c4[_0x4726('0x31')]);_0x2e03e7[_0x4726('0x32')]=_[_0x4726('0x33')](_0x2e03e7[_0x4726('0x35')],_0x2e03e7[_0x4726('0x31')]);_0x320c77['attributes']=_[_0x4726('0x33')](_0x2e03e7[_0x4726('0x35')],qs[_0x4726('0x36')](_0x2324c4['query'][_0x4726('0x36')]));_0x320c77[_0x4726('0x34')]=_0x320c77[_0x4726('0x34')][_0x4726('0x37')]?_0x320c77[_0x4726('0x34')]:_0x2e03e7[_0x4726('0x35')];if(_0x2324c4[_0x4726('0x31')][_0x4726('0x3e')]){_0x320c77[_0x4726('0x45')]=[{'all':!![]}];}_0x320c77=_[_0x4726('0x3d')]({},_0x320c77,_0x2324c4[_0x4726('0x46')]);return db[_0x4726('0x2d')][_0x4726('0x47')](_0x320c77)['then'](handleEntityNotFound(_0x3e59a3,null))[_0x4726('0x23')](respondWithResult(_0x3e59a3,null))[_0x4726('0x41')](handleError(_0x3e59a3,null));};exports[_0x4726('0x48')]=function(_0x48f197,_0x2af810){return db[_0x4726('0x2d')][_0x4726('0x48')](_0x48f197[_0x4726('0x49')],{})[_0x4726('0x23')](function(_0x10696f){var _0x541bf0=_0x48f197[_0x4726('0x4a')][_0x4726('0x4b')]({'plain':!![]});if(!_0x541bf0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x541bf0[_0x4726('0x4c')]===_0x4726('0x4a')){var _0xd6e321=_0x10696f[_0x4726('0x4b')]({'plain':!![]});var _0x4b8cc7=_0x4726('0x25');return db[_0x4726('0x4d')][_0x4726('0x47')]({'where':{'name':_0x4b8cc7,'userProfileId':_0x541bf0[_0x4726('0x4e')]},'raw':!![]})[_0x4726('0x23')](function(_0x403615){if(_0x403615&&_0x403615[_0x4726('0x4f')]===0x0){return db[_0x4726('0x26')][_0x4726('0x48')]({'name':_0xd6e321['name'],'resourceId':_0xd6e321['id'],'type':_0x403615[_0x4726('0x29')],'sectionId':_0x403615['id']},{})[_0x4726('0x23')](function(){return _0x10696f;});}else{return _0x10696f;}})[_0x4726('0x41')](function(_0x342345){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x342345);throw _0x342345;});}return _0x10696f;})[_0x4726('0x23')](respondWithResult(_0x2af810,0xc9))['catch'](handleError(_0x2af810,null));};exports['update']=function(_0x140ecf,_0x40a73a){if(_0x140ecf['body']['id']){delete _0x140ecf[_0x4726('0x49')]['id'];}return db[_0x4726('0x2d')][_0x4726('0x47')]({'where':{'id':_0x140ecf[_0x4726('0x43')]['id']}})[_0x4726('0x23')](handleEntityNotFound(_0x40a73a,null))[_0x4726('0x23')](saveUpdates(_0x140ecf['body'],null))[_0x4726('0x23')](respondWithResult(_0x40a73a,null))[_0x4726('0x41')](handleError(_0x40a73a,null));};exports['destroy']=function(_0x25a7c9,_0x3644e8){return db[_0x4726('0x2d')][_0x4726('0x47')]({'where':{'id':_0x25a7c9['params']['id']}})[_0x4726('0x23')](handleEntityNotFound(_0x3644e8,null))[_0x4726('0x23')](removeEntity(_0x3644e8,null))[_0x4726('0x41')](handleError(_0x3644e8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index e7cf648..5115b07 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 _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 +var _0xad68=['path','rimraf','../../config/environment','./variable.attributes','exports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5cb5cd,_0x6d4a7b){var _0x59caa6=function(_0x39bb7f){while(--_0x39bb7f){_0x5cb5cd['push'](_0x5cb5cd['shift']());}};_0x59caa6(++_0x6d4a7b);}(_0xad68,0x102));var _0x8ad6=function(_0x5874ca,_0xf90b52){_0x5874ca=_0x5874ca-0x0;var _0x4b41d7=_0xad68[_0x5874ca];return _0x4b41d7;};'use strict';var _=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var logger=require(_0x8ad6('0x2'))(_0x8ad6('0x3'));var moment=require('moment');var BPromise=require(_0x8ad6('0x4'));var rp=require(_0x8ad6('0x5'));var fs=require('fs');var path=require(_0x8ad6('0x6'));var rimraf=require(_0x8ad6('0x7'));var config=require(_0x8ad6('0x8'));var attributes=require(_0x8ad6('0x9'));module[_0x8ad6('0xa')]=function(_0x4cc20e,_0x2ac999){return _0x4cc20e['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 6e4b3e3..78246b9 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 _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 +var _0x346b=['error','code','message','request\x20sent','result','catch','ShowVariable','Variable','find','options','raw','attributes','map','include','model','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3071ab,_0x574a59){var _0x2f458c=function(_0x1eb9c7){while(--_0x1eb9c7){_0x3071ab['push'](_0x3071ab['shift']());}};_0x2f458c(++_0x574a59);}(_0x346b,0x10f));var _0xb346=function(_0x3e2827,_0x5436bf){_0x3e2827=_0x3e2827-0x0;var _0x2d0a84=_0x346b[_0x3e2827];return _0x2d0a84;};'use strict';var _=require('lodash');var util=require(_0xb346('0x0'));var moment=require(_0xb346('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb346('0x2'));var db=require(_0xb346('0x3'))['db'];var utils=require(_0xb346('0x4'));var logger=require(_0xb346('0x5'))(_0xb346('0x6'));var config=require(_0xb346('0x7'));var jayson=require(_0xb346('0x8'));var client=jayson[_0xb346('0x9')][_0xb346('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e65,_0x23c03b,_0x3f2132){return new BPromise(function(_0x45f7a5,_0x2faaab){return client['request'](_0x4a6e65,_0x3f2132)[_0xb346('0xb')](function(_0x696a4a){logger[_0xb346('0xc')](_0xb346('0xd'),_0x23c03b,'request\x20sent');logger[_0xb346('0xe')](_0xb346('0xf'),_0x23c03b,'request\x20sent',JSON[_0xb346('0x10')](_0x696a4a));if(_0x696a4a[_0xb346('0x11')]){if(_0x696a4a[_0xb346('0x11')][_0xb346('0x12')]===0x1f4){logger[_0xb346('0x11')](_0xb346('0xd'),_0x23c03b,_0x696a4a[_0xb346('0x11')][_0xb346('0x13')]);return _0x2faaab(_0x696a4a[_0xb346('0x11')]['message']);}logger[_0xb346('0x11')]('Variable,\x20%s,\x20%s',_0x23c03b,_0x696a4a[_0xb346('0x11')][_0xb346('0x13')]);return _0x45f7a5(_0x696a4a['error']['message']);}else{logger[_0xb346('0xc')](_0xb346('0xd'),_0x23c03b,_0xb346('0x14'));_0x45f7a5(_0x696a4a[_0xb346('0x15')][_0xb346('0x13')]);}})[_0xb346('0x16')](function(_0x1f8cd1){logger[_0xb346('0x11')](_0xb346('0xd'),_0x23c03b,_0x1f8cd1);_0x2faaab(_0x1f8cd1);});});}exports[_0xb346('0x17')]=function(_0x559271){var _0x3685ff=this;return new Promise(function(_0x20632e,_0x3e58df){return db[_0xb346('0x18')][_0xb346('0x19')]({'raw':_0x559271[_0xb346('0x1a')]?_0x559271[_0xb346('0x1a')][_0xb346('0x1b')]===undefined?!![]:![]:!![],'where':_0x559271[_0xb346('0x1a')]?_0x559271['options']['where']||null:null,'attributes':_0x559271[_0xb346('0x1a')]?_0x559271[_0xb346('0x1a')][_0xb346('0x1c')]||null:null,'include':_0x559271[_0xb346('0x1a')]?_0x559271[_0xb346('0x1a')]['include']?_[_0xb346('0x1d')](_0x559271['options'][_0xb346('0x1e')],function(_0xea5321){return{'model':db[_0xea5321['model']],'as':_0xea5321['as'],'attributes':_0xea5321[_0xb346('0x1c')],'include':_0xea5321[_0xb346('0x1e')]?_['map'](_0xea5321[_0xb346('0x1e')],function(_0x30106b){return{'model':db[_0x30106b[_0xb346('0x1f')]],'as':_0x30106b['as'],'attributes':_0x30106b[_0xb346('0x1c')],'include':_0x30106b['include']?_[_0xb346('0x1d')](_0x30106b[_0xb346('0x1e')],function(_0x515098){return{'model':db[_0x515098[_0xb346('0x1f')]],'as':_0x515098['as'],'attributes':_0x515098[_0xb346('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb346('0xb')](function(_0x2ccf2f){logger[_0xb346('0xc')](_0xb346('0x17'),_0x559271);logger[_0xb346('0xe')](_0xb346('0x17'),_0x559271,JSON[_0xb346('0x10')](_0x2ccf2f));_0x20632e(_0x2ccf2f);})[_0xb346('0x16')](function(_0x518ada){logger[_0xb346('0x11')]('ShowVariable',_0x518ada[_0xb346('0x13')],_0x559271);_0x3e58df(_0x3685ff[_0xb346('0x11')](0x1f4,_0x518ada[_0xb346('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 91b8e80..7b7f42e 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 _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 +var _0xca04=['canUpdate','fetch','isAuthenticated','reset','/pull','pull','/restart','/migrations','migrations','exports','express','../../components/auth/service','index','get'];(function(_0x9cc070,_0x3fa274){var _0x2b93bc=function(_0xa49df5){while(--_0xa49df5){_0x9cc070['push'](_0x9cc070['shift']());}};_0x2b93bc(++_0x3fa274);}(_0xca04,0xa4));var _0x4ca0=function(_0x5169d4,_0x28e920){_0x5169d4=_0x5169d4-0x0;var _0x2625f9=_0xca04[_0x5169d4];return _0x2625f9;};'use strict';var express=require(_0x4ca0('0x0'));var router=express['Router']();var auth=require(_0x4ca0('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0x4ca0('0x2')]);router[_0x4ca0('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0x4ca0('0x4')](),controller[_0x4ca0('0x5')]);router['get']('/reset',auth[_0x4ca0('0x6')](),auth['canUpdate'](),controller[_0x4ca0('0x7')]);router['get'](_0x4ca0('0x8'),auth[_0x4ca0('0x6')](),auth[_0x4ca0('0x4')](),controller[_0x4ca0('0x9')]);router[_0x4ca0('0x3')](_0x4ca0('0xa'),auth['isAuthenticated'](),controller['restart']);router[_0x4ca0('0x3')](_0x4ca0('0xb'),controller[_0x4ca0('0xc')]);module[_0x4ca0('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3984f9d..b0f57c2 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 _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 +var _0x0ef4=['lodash','pkginfo','child_process','exec','../../mysqldb','../../config/pm2','simple-git','root','index','exports','version','query','latest','tags','2.0.0','status','json','fetch','origin','error','info','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','length','replace','.js','push','sort','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','join','UniqueConstraintError','Database\x20already\x20up-to-date','path'];(function(_0x1fd97c,_0x5e9dcf){var _0x3c1e3f=function(_0xda7186){while(--_0xda7186){_0x1fd97c['push'](_0x1fd97c['shift']());}};_0x3c1e3f(++_0x5e9dcf);}(_0x0ef4,0xc7));var _0x40ef=function(_0x1b76e6,_0x598520){_0x1b76e6=_0x1b76e6-0x0;var _0x333b53=_0x0ef4[_0x1b76e6];return _0x333b53;};'use strict';var Umzug=require('umzug');var path=require(_0x40ef('0x0'));var fs=require('fs');var _=require(_0x40ef('0x1'));var pkginfo=require(_0x40ef('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x40ef('0x3'))[_0x40ef('0x4')];var db=require(_0x40ef('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x40ef('0x6'));var logger=require('../../config/logger')('update');var git=require(_0x40ef('0x7'))(config[_0x40ef('0x8')]);exports[_0x40ef('0x9')]=function(_0x7d0e82,_0x439a37){var _0x517e33={'current':module[_0x40ef('0xa')][_0x40ef('0xb')],'phonebar':0x2};if(_0x7d0e82[_0x40ef('0xc')]&&_0x7d0e82['query'][_0x40ef('0xd')]){return git['fetch']()[_0x40ef('0xe')](function(_0x255145,_0x23c74e){_0x517e33[_0x40ef('0xd')]=(_0x255145?module['exports'][_0x40ef('0xb')]:_0x23c74e[_0x40ef('0xd')])||_0x40ef('0xf');return _0x439a37[_0x40ef('0x10')](0xc8)[_0x40ef('0x11')](_0x517e33);});}else{return _0x439a37[_0x40ef('0x10')](0xc8)[_0x40ef('0x11')](_0x517e33);}};exports[_0x40ef('0x12')]=function(_0x905f41,_0x3d5a16){return git[_0x40ef('0x12')]([_0x40ef('0x13'),'master'],function(_0x5018e2){if(_0x5018e2){logger[_0x40ef('0x14')](_0x5018e2);return _0x3d5a16['status'](0x1f4)[_0x40ef('0x11')](_0x5018e2);}logger[_0x40ef('0x15')]('git\x20fetch');return _0x3d5a16[_0x40ef('0x10')](0xc8)[_0x40ef('0x11')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x40ef('0x16')]=function(_0x598145,_0x3a3ba2){return git[_0x40ef('0x16')]([_0x40ef('0x17'),'FETCH_HEAD'],function(_0x4e0257){if(_0x4e0257){logger[_0x40ef('0x14')](_0x4e0257);return _0x3a3ba2['status'](0x1f4)[_0x40ef('0x11')](_0x4e0257);}logger['info'](_0x40ef('0x18'));return _0x3a3ba2[_0x40ef('0x10')](0xc8)['json']({'output':_0x40ef('0x19')});});};exports[_0x40ef('0x1a')]=function(_0xa60df3,_0x4a2cc5){exec(_0x40ef('0x1b'),function(_0x4cef12,_0x3fb29c,_0x5d2d53){logger[_0x40ef('0x15')](_0x3fb29c);logger[_0x40ef('0x15')](_0x5d2d53);if(_0x4cef12){logger[_0x40ef('0x14')](_0x4cef12);return _0x4a2cc5[_0x40ef('0x10')](0x1f4)[_0x40ef('0x11')](_0x4cef12);}return _0x4a2cc5[_0x40ef('0x10')](0xc8)[_0x40ef('0x11')]({'output':_0x3fb29c});});};exports[_0x40ef('0x1c')]=function(_0xcb7712,_0x5edcc7){return pm2[_0x40ef('0x1c')](_0x40ef('0x1d'))[_0x40ef('0x1e')](function(_0x3eab2c){logger['info'](_0x40ef('0x1f'),_0x3eab2c);return _0x5edcc7[_0x40ef('0x10')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x40ef('0x20')](function(_0x35c0f0){logger['error'](_0x35c0f0);return _0x5edcc7['status'](0x1f4)['json'](_0x35c0f0);});};exports[_0x40ef('0x21')]=function(_0x570145,_0x5c87c9){var _0xa1846c=fs[_0x40ef('0x22')](path['join'](config[_0x40ef('0x8')],'server',_0x40ef('0x21')));var _0x13552e=[];for(var _0x3bb058=0x0;_0x3bb058<_0xa1846c[_0x40ef('0x23')];_0x3bb058++){var _0xe32e08=_0xa1846c[_0x3bb058][_0x40ef('0x24')](_0x40ef('0x25'),'');if(compareVersions(module[_0x40ef('0xa')][_0x40ef('0xb')],_0xe32e08)===-0x1){_0x13552e[_0x40ef('0x26')](_0xe32e08);}}if(_0x13552e['length']){var _0x5673d4=_0x13552e[_0x40ef('0x27')](compareVersions);var _0x297055=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x40ef('0xb')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db[_0x40ef('0x28')][_0x40ef('0x29')],function(){throw new Error(_0x40ef('0x2a'));}],'path':path['join'](config[_0x40ef('0x8')],_0x40ef('0x2b'),_0x40ef('0x21')),'pattern':/\.js$/}});_0x297055['up']({'migrations':_[_0x40ef('0x2c')](_0x5673d4,function(_0x497598){return _0x497598+'.js';})})[_0x40ef('0x1e')](function(){return _0x5c87c9['status'](0xc8)['json']({'output':_0x40ef('0x2d')+module[_0x40ef('0xa')]['version']+_0x40ef('0x2e')+_['last'](_0x5673d4),'migrations':_[_0x40ef('0x2f')](_0x5673d4)});})['catch'](function(_0x269e85){if(_0x269e85 instanceof db[_0x40ef('0x28')][_0x40ef('0x30')]){return _0x5c87c9[_0x40ef('0x10')](0xc8)['json']({'output':_0x40ef('0x31')});}else{return _0x5c87c9['status'](0x1f4)[_0x40ef('0x11')](_0x269e85);}});}else{return _0x5c87c9['status'](0xc8)['json']({'output':_0x40ef('0x31')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index f54c019..9492f8c 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 _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 +var _0x9605=['destroy','exports','util','Router','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update','delete'];(function(_0x32f981,_0x36023e){var _0x33111c=function(_0x45129b){while(--_0x45129b){_0x32f981['push'](_0x32f981['shift']());}};_0x33111c(++_0x36023e);}(_0x9605,0x1a6));var _0x5960=function(_0xafcfcb,_0x5867aa){_0xafcfcb=_0xafcfcb-0x0;var _0x5a988d=_0x9605[_0xafcfcb];return _0x5a988d;};'use strict';var multer=require('multer');var util=require(_0x5960('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5960('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5960('0x2'));var controller=require(_0x5960('0x3'));router[_0x5960('0x4')]('/',auth[_0x5960('0x5')](),controller['index']);router[_0x5960('0x4')]('/describe',auth['isAuthenticated'](),controller[_0x5960('0x6')]);router[_0x5960('0x4')](_0x5960('0x7'),auth[_0x5960('0x5')](),controller[_0x5960('0x8')]);router[_0x5960('0x9')]('/',auth[_0x5960('0x5')](),controller['create']);router[_0x5960('0xa')](_0x5960('0x7'),auth[_0x5960('0x5')](),controller[_0x5960('0xb')]);router[_0x5960('0xc')](_0x5960('0x7'),auth['isAuthenticated'](),controller[_0x5960('0xd')]);module[_0x5960('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 40e5223..176b4a9 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 _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 +var _0xeff8=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x24116c,_0x431ab1){var _0xf3d7fd=function(_0x4e1664){while(--_0x4e1664){_0x24116c['push'](_0x24116c['shift']());}};_0xf3d7fd(++_0x431ab1);}(_0xeff8,0x186));var _0x8eff=function(_0x4914e2,_0x48be8f){_0x4914e2=_0x4914e2-0x0;var _0x2dcd07=_0xeff8[_0x4914e2];return _0x2dcd07;};'use strict';var Sequelize=require(_0x8eff('0x0'));module[_0x8eff('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8eff('0x2')]},'calleridnum':{'type':Sequelize[_0x8eff('0x2')]},'calleridname':{'type':Sequelize[_0x8eff('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x8eff('0x2')]},'membername':{'type':Sequelize[_0x8eff('0x2')]},'agentcalledAt':{'type':Sequelize[_0x8eff('0x3')]},'agentconnectAt':{'type':Sequelize[_0x8eff('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x8eff('0x3')]},'agentdumpAt':{'type':Sequelize[_0x8eff('0x3')]},'holdtime':{'type':Sequelize[_0x8eff('0x4')]},'agentcomplete':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x8eff('0x4')]},'agentacw':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x8eff('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8eff('0x2')]},'channelstate':{'type':Sequelize[_0x8eff('0x4')]},'channelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x8eff('0x2')]},'language':{'type':Sequelize[_0x8eff('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8eff('0x2')]},'exten':{'type':Sequelize[_0x8eff('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x8eff('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8eff('0x2')]},'destcalleridname':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8eff('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8eff('0x2')]},'destaccountcode':{'type':Sequelize[_0x8eff('0x2')]},'destcontext':{'type':Sequelize[_0x8eff('0x2')]},'destexten':{'type':Sequelize[_0x8eff('0x2')]},'destpriority':{'type':Sequelize[_0x8eff('0x2')]},'destuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x8eff('0x2')]},'transfer':{'type':Sequelize[_0x8eff('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x8eff('0x2')],'comment':_0x8eff('0x6')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x8eff('0x2')]},'agententerreason':{'type':Sequelize[_0x8eff('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 8e1337a..c2802ff 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 _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 +var _0xc8c7=['options','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceAgentReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter'];(function(_0x554339,_0x23da3c){var _0x3f5507=function(_0x4455b1){while(--_0x4455b1){_0x554339['push'](_0x554339['shift']());}};_0x3f5507(++_0x23da3c);}(_0xc8c7,0x12f));var _0x7c8c=function(_0x46bdf4,_0x28b6ba){_0x46bdf4=_0x46bdf4-0x0;var _0xcf1fc=_0xc8c7[_0x46bdf4];return _0xcf1fc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7c8c('0x0'));var rimraf=require(_0x7c8c('0x1'));var zipdir=require(_0x7c8c('0x2'));var jsonpatch=require(_0x7c8c('0x3'));var rp=require(_0x7c8c('0x4'));var moment=require(_0x7c8c('0x5'));var BPromise=require(_0x7c8c('0x6'));var Mustache=require(_0x7c8c('0x7'));var util=require('util');var path=require(_0x7c8c('0x8'));var sox=require(_0x7c8c('0x9'));var csv=require(_0x7c8c('0xa'));var ejs=require(_0x7c8c('0xb'));var fs=require('fs');var _=require(_0x7c8c('0xc'));var squel=require('squel');var crypto=require(_0x7c8c('0xd'));var jsforce=require(_0x7c8c('0xe'));var deskjs=require(_0x7c8c('0xf'));var toCsv=require(_0x7c8c('0xa'));var querystring=require(_0x7c8c('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7c8c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c8c('0x12'));var logger=require(_0x7c8c('0x13'))(_0x7c8c('0x14'));var utils=require(_0x7c8c('0x15'));var config=require(_0x7c8c('0x16'));var licenseUtil=require(_0x7c8c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46ebeb,_0x3a1d89){_0x3a1d89=_0x3a1d89||0xcc;return function(_0x2ab9c5){if(_0x2ab9c5){return _0x46ebeb[_0x7c8c('0x18')](_0x3a1d89);}return _0x46ebeb[_0x7c8c('0x19')](_0x3a1d89)['end']();};}function respondWithResult(_0x465ce0,_0x331e38){_0x331e38=_0x331e38||0xc8;return function(_0x167384){if(_0x167384){return _0x465ce0[_0x7c8c('0x19')](_0x331e38)[_0x7c8c('0x1a')](_0x167384);}};}function respondWithFilteredResult(_0x16e100,_0x209db5){return function(_0x1612a1){if(_0x1612a1){var _0x143dab=_0x1612a1[_0x7c8c('0x1b')],_0x543f65=_0x209db5[_0x7c8c('0x1c')],_0x4efb06=_0x209db5[_0x7c8c('0x1c')]+_0x209db5[_0x7c8c('0x1d')],_0x3a50ed;if(_0x4efb06>=_0x143dab){_0x4efb06=_0x143dab;_0x3a50ed=0xc8;}else{_0x3a50ed=0xce;}_0x16e100[_0x7c8c('0x19')](_0x3a50ed);return _0x16e100[_0x7c8c('0x1e')](_0x7c8c('0x1f'),_0x543f65+'-'+_0x4efb06+'/'+_0x143dab)[_0x7c8c('0x1a')](_0x1612a1);}return null;};}function patchUpdates(_0x42af79){return function(_0x103939){try{jsonpatch['apply'](_0x103939,_0x42af79,!![]);}catch(_0x4ff56b){return BPromise[_0x7c8c('0x20')](_0x4ff56b);}return _0x103939[_0x7c8c('0x21')]();};}function saveUpdates(_0x199f97,_0x458f22){return function(_0x19290c){if(_0x19290c){return _0x19290c[_0x7c8c('0x22')](_0x199f97)[_0x7c8c('0x23')](function(_0x31e81b){return _0x31e81b;});}return null;};}function removeEntity(_0x42ad23,_0x2616fc){return function(_0x7c411d){if(_0x7c411d){return _0x7c411d[_0x7c8c('0x24')]()[_0x7c8c('0x23')](function(){_0x42ad23[_0x7c8c('0x19')](0xcc)[_0x7c8c('0x25')]();});}};}function handleEntityNotFound(_0x5ea044,_0x21856e){return function(_0x352b52){if(!_0x352b52){_0x5ea044[_0x7c8c('0x18')](0x194);}return _0x352b52;};}function handleError(_0x4a8da5,_0x28a31b){_0x28a31b=_0x28a31b||0x1f4;return function(_0xd1acde){logger[_0x7c8c('0x26')](_0xd1acde['stack']);if(_0xd1acde[_0x7c8c('0x27')]){delete _0xd1acde['name'];}_0x4a8da5[_0x7c8c('0x19')](_0x28a31b)[_0x7c8c('0x28')](_0xd1acde);};}exports[_0x7c8c('0x29')]=function(_0x1e26f6,_0x58df58){var _0x414ce3={},_0x38f3c6={},_0x53a4e8={'count':0x0,'rows':[]};var _0x283287=_[_0x7c8c('0x2a')](db[_0x7c8c('0x2b')][_0x7c8c('0x2c')],function(_0x18bd2c){return{'name':_0x18bd2c[_0x7c8c('0x2d')],'type':_0x18bd2c[_0x7c8c('0x2e')][_0x7c8c('0x2f')]};});_0x38f3c6[_0x7c8c('0x30')]=_[_0x7c8c('0x2a')](_0x283287,_0x7c8c('0x27'));_0x38f3c6[_0x7c8c('0x31')]=_[_0x7c8c('0x32')](_0x1e26f6[_0x7c8c('0x31')]);_0x38f3c6[_0x7c8c('0x33')]=_[_0x7c8c('0x34')](_0x38f3c6[_0x7c8c('0x30')],_0x38f3c6[_0x7c8c('0x31')]);_0x414ce3[_0x7c8c('0x35')]=_[_0x7c8c('0x34')](_0x38f3c6[_0x7c8c('0x30')],qs[_0x7c8c('0x36')](_0x1e26f6[_0x7c8c('0x31')]['fields']));_0x414ce3[_0x7c8c('0x35')]=_0x414ce3[_0x7c8c('0x35')]['length']?_0x414ce3[_0x7c8c('0x35')]:_0x38f3c6[_0x7c8c('0x30')];if(!_0x1e26f6['query'][_0x7c8c('0x37')](_0x7c8c('0x38'))){_0x414ce3['limit']=qs[_0x7c8c('0x1d')](_0x1e26f6[_0x7c8c('0x31')][_0x7c8c('0x1d')]);_0x414ce3[_0x7c8c('0x1c')]=qs[_0x7c8c('0x1c')](_0x1e26f6['query'][_0x7c8c('0x1c')]);}_0x414ce3[_0x7c8c('0x39')]=qs['sort'](_0x1e26f6[_0x7c8c('0x31')]['sort']);_0x414ce3[_0x7c8c('0x3a')]=qs[_0x7c8c('0x33')](_['pick'](_0x1e26f6[_0x7c8c('0x31')],_0x38f3c6[_0x7c8c('0x33')]),_0x283287);if(_0x1e26f6[_0x7c8c('0x31')]['filter']){_0x414ce3['where']=_[_0x7c8c('0x3b')](_0x414ce3[_0x7c8c('0x3a')],{'$or':_['map'](_0x283287,function(_0x496e42){if(_0x496e42[_0x7c8c('0x2e')]!==_0x7c8c('0x3c')){var _0x5a94f7={};_0x5a94f7[_0x496e42[_0x7c8c('0x27')]]={'$like':'%'+_0x1e26f6[_0x7c8c('0x31')][_0x7c8c('0x3d')]+'%'};return _0x5a94f7;}})});}_0x414ce3=_[_0x7c8c('0x3b')]({},_0x414ce3,_0x1e26f6[_0x7c8c('0x3e')]);var _0x4a903f={'where':_0x414ce3['where']};return db[_0x7c8c('0x2b')][_0x7c8c('0x1b')](_0x4a903f)['then'](function(_0x2f29f6){_0x53a4e8['count']=_0x2f29f6;if(_0x1e26f6[_0x7c8c('0x31')][_0x7c8c('0x3f')]){_0x414ce3[_0x7c8c('0x40')]=[{'all':!![]}];}return db[_0x7c8c('0x2b')]['findAll'](_0x414ce3);})[_0x7c8c('0x23')](function(_0x1f0eed){_0x53a4e8['rows']=_0x1f0eed;return _0x53a4e8;})[_0x7c8c('0x23')](respondWithFilteredResult(_0x58df58,_0x414ce3))[_0x7c8c('0x41')](handleError(_0x58df58,null));};exports[_0x7c8c('0x42')]=function(_0x1aedd8,_0xe6075c){var _0x58f897={'raw':![],'where':{'id':_0x1aedd8[_0x7c8c('0x43')]['id']}},_0x250a9b={};_0x250a9b[_0x7c8c('0x30')]=_['keys'](db[_0x7c8c('0x2b')]['rawAttributes']);_0x250a9b[_0x7c8c('0x31')]=_['keys'](_0x1aedd8[_0x7c8c('0x31')]);_0x250a9b['filters']=_['intersection'](_0x250a9b[_0x7c8c('0x30')],_0x250a9b[_0x7c8c('0x31')]);_0x58f897[_0x7c8c('0x35')]=_[_0x7c8c('0x34')](_0x250a9b[_0x7c8c('0x30')],qs[_0x7c8c('0x36')](_0x1aedd8['query'][_0x7c8c('0x36')]));_0x58f897['attributes']=_0x58f897[_0x7c8c('0x35')][_0x7c8c('0x44')]?_0x58f897['attributes']:_0x250a9b[_0x7c8c('0x30')];if(_0x1aedd8[_0x7c8c('0x31')][_0x7c8c('0x3f')]){_0x58f897[_0x7c8c('0x40')]=[{'all':!![]}];}_0x58f897=_[_0x7c8c('0x3b')]({},_0x58f897,_0x1aedd8[_0x7c8c('0x3e')]);return db[_0x7c8c('0x2b')][_0x7c8c('0x45')](_0x58f897)[_0x7c8c('0x23')](handleEntityNotFound(_0xe6075c,null))['then'](respondWithResult(_0xe6075c,null))[_0x7c8c('0x41')](handleError(_0xe6075c,null));};exports[_0x7c8c('0x46')]=function(_0x33ac87,_0x2d34bc){return db[_0x7c8c('0x2b')][_0x7c8c('0x46')](_0x33ac87[_0x7c8c('0x47')],{})['then'](respondWithResult(_0x2d34bc,0xc9))[_0x7c8c('0x41')](handleError(_0x2d34bc,null));};exports[_0x7c8c('0x22')]=function(_0x1dea17,_0x656568){if(_0x1dea17[_0x7c8c('0x47')]['id']){delete _0x1dea17[_0x7c8c('0x47')]['id'];}return db[_0x7c8c('0x2b')]['find']({'where':{'id':_0x1dea17[_0x7c8c('0x43')]['id']}})[_0x7c8c('0x23')](handleEntityNotFound(_0x656568,null))[_0x7c8c('0x23')](saveUpdates(_0x1dea17[_0x7c8c('0x47')],null))[_0x7c8c('0x23')](respondWithResult(_0x656568,null))['catch'](handleError(_0x656568,null));};exports[_0x7c8c('0x24')]=function(_0x4b2f9b,_0xd4e111){return db[_0x7c8c('0x2b')][_0x7c8c('0x45')]({'where':{'id':_0x4b2f9b[_0x7c8c('0x43')]['id']}})[_0x7c8c('0x23')](handleEntityNotFound(_0xd4e111,null))[_0x7c8c('0x23')](removeEntity(_0xd4e111,null))['catch'](handleError(_0xd4e111,null));};exports[_0x7c8c('0x48')]=function(_0x14b898,_0x3d3e85){return db[_0x7c8c('0x2b')]['describe']()[_0x7c8c('0x23')](respondWithResult(_0x3d3e85,null))[_0x7c8c('0x41')](handleError(_0x3d3e85,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 87dfc97..3d9306f 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 _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 +var _0x933c=['api','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','lodash','util','../../config/logger'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x933c,0x99));var _0xc933=function(_0x286fdc,_0x29d7d9){_0x286fdc=_0x286fdc-0x0;var _0x578183=_0x933c[_0x286fdc];return _0x578183;};'use strict';var _=require(_0xc933('0x0'));var util=require(_0xc933('0x1'));var logger=require(_0xc933('0x2'))(_0xc933('0x3'));var moment=require(_0xc933('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc933('0x5'));var rimraf=require(_0xc933('0x6'));var config=require(_0xc933('0x7'));var attributes=require(_0xc933('0x8'));module[_0xc933('0x9')]=function(_0x458a30,_0x554462){return _0x458a30[_0xc933('0xa')]('VoiceAgentReport',attributes,{'tableName':_0xc933('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc933('0xc'),'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 389851a..e8efb83 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 _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 +var _0x3b4f=['request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3089e8,_0x7053a5){var _0x31d87a=function(_0x5e8ceb){while(--_0x5e8ceb){_0x3089e8['push'](_0x3089e8['shift']());}};_0x31d87a(++_0x7053a5);}(_0x3b4f,0x7d));var _0xf3b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b4f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf3b4('0x0'));var util=require(_0xf3b4('0x1'));var moment=require(_0xf3b4('0x2'));var BPromise=require(_0xf3b4('0x3'));var rs=require(_0xf3b4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf3b4('0x5'));var logger=require(_0xf3b4('0x6'))(_0xf3b4('0x7'));var config=require(_0xf3b4('0x8'));var jayson=require(_0xf3b4('0x9'));var client=jayson['client'][_0xf3b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b3934,_0x466e5e,_0x206245){return new BPromise(function(_0xeb6c09,_0xeedcab){return client[_0xf3b4('0xb')](_0x1b3934,_0x206245)['then'](function(_0x345e96){logger['info'](_0xf3b4('0xc'),_0x466e5e,_0xf3b4('0xd'));logger[_0xf3b4('0xe')](_0xf3b4('0xf'),_0x466e5e,_0xf3b4('0xd'),JSON[_0xf3b4('0x10')](_0x345e96));if(_0x345e96[_0xf3b4('0x11')]){if(_0x345e96[_0xf3b4('0x11')]['code']===0x1f4){logger[_0xf3b4('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x466e5e,_0x345e96[_0xf3b4('0x11')][_0xf3b4('0x12')]);return _0xeedcab(_0x345e96['error'][_0xf3b4('0x12')]);}logger[_0xf3b4('0x11')](_0xf3b4('0xc'),_0x466e5e,_0x345e96[_0xf3b4('0x11')][_0xf3b4('0x12')]);return _0xeb6c09(_0x345e96[_0xf3b4('0x11')]['message']);}else{logger[_0xf3b4('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x466e5e,_0xf3b4('0xd'));_0xeb6c09(_0x345e96[_0xf3b4('0x14')][_0xf3b4('0x12')]);}})[_0xf3b4('0x15')](function(_0x5c4089){logger[_0xf3b4('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x466e5e,_0x5c4089);_0xeedcab(_0x5c4089);});});}exports[_0xf3b4('0x16')]=function(_0x577122){var _0x55c647=this;return new Promise(function(_0x5dc08a,_0x298e21){return db[_0xf3b4('0x17')][_0xf3b4('0x18')](_0x577122[_0xf3b4('0x19')],{'raw':_0x577122[_0xf3b4('0x1a')]?_0x577122[_0xf3b4('0x1a')][_0xf3b4('0x1b')]===undefined?!![]:![]:!![]})[_0xf3b4('0x1c')](function(_0x227dcf){logger[_0xf3b4('0x13')](_0xf3b4('0x16'),_0x577122);logger[_0xf3b4('0xe')](_0xf3b4('0x16'),_0x577122,JSON[_0xf3b4('0x10')](_0x227dcf));_0x5dc08a(_0x227dcf);})['catch'](function(_0x31ac25){logger[_0xf3b4('0x11')](_0xf3b4('0x16'),_0x31ac25[_0xf3b4('0x12')],_0x577122);_0x298e21(_0x55c647['error'](0x1f4,_0x31ac25[_0xf3b4('0x12')]));});});};exports[_0xf3b4('0x1d')]=function(_0x10e482){var _0x4afd45=this;return new Promise(function(_0x56cd3c,_0x58dfee){return db['VoiceAgentReport'][_0xf3b4('0x1e')](_0x10e482[_0xf3b4('0x19')],{'raw':_0x10e482['options']?_0x10e482[_0xf3b4('0x1a')][_0xf3b4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e482[_0xf3b4('0x1a')]?_0x10e482[_0xf3b4('0x1a')][_0xf3b4('0x1f')]||null:null,'attributes':_0x10e482[_0xf3b4('0x1a')]?_0x10e482[_0xf3b4('0x1a')][_0xf3b4('0x20')]||null:null,'limit':_0x10e482[_0xf3b4('0x1a')]?_0x10e482[_0xf3b4('0x1a')][_0xf3b4('0x21')]||null:null})['then'](function(_0x416587){logger[_0xf3b4('0x13')](_0xf3b4('0x1d'),_0x10e482);logger['debug'](_0xf3b4('0x1d'),_0x10e482,JSON[_0xf3b4('0x10')](_0x416587));_0x56cd3c(_0x416587);})[_0xf3b4('0x15')](function(_0xa1d56){logger[_0xf3b4('0x11')](_0xf3b4('0x1d'),_0xa1d56[_0xf3b4('0x12')],_0x10e482);_0x58dfee(_0x4afd45['error'](0x1f4,_0xa1d56[_0xf3b4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fd9a483..6d7b59f 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 _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 +var _0xeb0b=['util','connect-timeout','express','../../components/auth/service','../../config/environment','get','/describe','isAuthenticated','/:id','update','delete','destroy','exports'];(function(_0x209ab8,_0x3d35e1){var _0x41e22d=function(_0x5df70a){while(--_0x5df70a){_0x209ab8['push'](_0x209ab8['shift']());}};_0x41e22d(++_0x3d35e1);}(_0xeb0b,0x12b));var _0xbeb0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xeb0b[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xbeb0('0x0'));var path=require('path');var timeout=require(_0xbeb0('0x1'));var express=require(_0xbeb0('0x2'));var router=express['Router']();var auth=require(_0xbeb0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbeb0('0x4'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbeb0('0x5')](_0xbeb0('0x6'),auth[_0xbeb0('0x7')](),controller['describe']);router[_0xbeb0('0x5')](_0xbeb0('0x8'),auth[_0xbeb0('0x7')](),controller['show']);router['post']('/',auth[_0xbeb0('0x7')](),controller['create']);router['put']('/:id',auth[_0xbeb0('0x7')](),controller[_0xbeb0('0x9')]);router[_0xbeb0('0xa')](_0xbeb0('0x8'),auth[_0xbeb0('0x7')](),controller[_0xbeb0('0xb')]);module[_0xbeb0('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 5c629da..2c7a568 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 _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 +var _0xc949=['inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal'];(function(_0x21bce8,_0x53aaeb){var _0x51678f=function(_0x25fd73){while(--_0x25fd73){_0x21bce8['push'](_0x21bce8['shift']());}};_0x51678f(++_0x53aaeb);}(_0xc949,0x181));var _0x9c94=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xc949[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x9c94('0x1')]},'type':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x3'),_0x9c94('0x4'),'outbound',_0x9c94('0x5'),_0x9c94('0x6'),'dialer')},'tag':{'type':Sequelize[_0x9c94('0x1')]},'accountcode':{'type':Sequelize[_0x9c94('0x1')]},'source':{'type':Sequelize[_0x9c94('0x1')]},'destination':{'type':Sequelize[_0x9c94('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9c94('0x1')]},'channel':{'type':Sequelize[_0x9c94('0x1')]},'destinationchannel':{'type':Sequelize[_0x9c94('0x1')]},'lastapplication':{'type':Sequelize[_0x9c94('0x1')]},'lastdata':{'type':Sequelize[_0x9c94('0x7')]},'starttime':{'type':Sequelize[_0x9c94('0x8')]},'systemanswertime':{'type':Sequelize[_0x9c94('0x8')]},'answertime':{'type':Sequelize[_0x9c94('0x8')]},'endtime':{'type':Sequelize[_0x9c94('0x8')]},'duration':{'type':Sequelize[_0x9c94('0x9')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x9c94('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9c94('0x1')]},'amaflags':{'type':Sequelize[_0x9c94('0x1')]},'userfield':{'type':Sequelize[_0x9c94('0x1')]},'userDisposition':{'type':Sequelize[_0x9c94('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x9c94('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x9c94('0x1')]},'note':{'type':Sequelize[_0x9c94('0x1')]},'prefix':{'type':Sequelize[_0x9c94('0x1')]},'routeid':{'type':Sequelize[_0x9c94('0x9')]},'sipcallid':{'type':Sequelize[_0x9c94('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 4e0c9ab..adfbfa3 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(_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 +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(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'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 d818dbf..81c7562 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 _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 +var _0xbe34=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','lodash'];(function(_0xc83282,_0x46f68d){var _0x450058=function(_0x454e02){while(--_0x454e02){_0xc83282['push'](_0xc83282['shift']());}};_0x450058(++_0x46f68d);}(_0xbe34,0x1c2));var _0x4be3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbe34[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4be3('0x0'));var util=require(_0x4be3('0x1'));var logger=require('../../config/logger')(_0x4be3('0x2'));var moment=require(_0x4be3('0x3'));var BPromise=require(_0x4be3('0x4'));var rp=require(_0x4be3('0x5'));var fs=require('fs');var path=require(_0x4be3('0x6'));var rimraf=require(_0x4be3('0x7'));var config=require(_0x4be3('0x8'));var attributes=require(_0x4be3('0x9'));module['exports']=function(_0x2c82be,_0x5eb46e){return _0x2c82be[_0x4be3('0xa')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 56a7527..646330c 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 _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 +var _0xe7e6=['info','result','catch','GetVoiceCallReport','options','raw','limit','include','map','model','attributes','debug','CreateVoiceCallReport','VoiceCallReport','create','body','UpdateVoiceCallReport','update','where','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x47f0f3,_0x5e6c65){var _0x184eaa=function(_0x323963){while(--_0x323963){_0x47f0f3['push'](_0x47f0f3['shift']());}};_0x184eaa(++_0x5e6c65);}(_0xe7e6,0x157));var _0x6e7e=function(_0x5d2ea8,_0x2810ac){_0x5d2ea8=_0x5d2ea8-0x0;var _0x5c560a=_0xe7e6[_0x5d2ea8];return _0x5c560a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6e7e('0x0'));var fs=require('fs');var Redis=require(_0x6e7e('0x1'));var db=require(_0x6e7e('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e7e('0x3'))(_0x6e7e('0x4'));var config=require(_0x6e7e('0x5'));var jayson=require(_0x6e7e('0x6'));var client=jayson[_0x6e7e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17bea5,_0x2394f0,_0x30cbb2){return new BPromise(function(_0x4ecdbd,_0x31ef6c){return client[_0x6e7e('0x8')](_0x17bea5,_0x30cbb2)[_0x6e7e('0x9')](function(_0x6662bc){logger['info'](_0x6e7e('0xa'),_0x2394f0,_0x6e7e('0xb'));logger['debug'](_0x6e7e('0xc'),_0x2394f0,_0x6e7e('0xb'),JSON[_0x6e7e('0xd')](_0x6662bc));if(_0x6662bc[_0x6e7e('0xe')]){if(_0x6662bc[_0x6e7e('0xe')][_0x6e7e('0xf')]===0x1f4){logger[_0x6e7e('0xe')](_0x6e7e('0xa'),_0x2394f0,_0x6662bc['error']['message']);return _0x31ef6c(_0x6662bc[_0x6e7e('0xe')][_0x6e7e('0x10')]);}logger[_0x6e7e('0xe')](_0x6e7e('0xa'),_0x2394f0,_0x6662bc[_0x6e7e('0xe')][_0x6e7e('0x10')]);return _0x4ecdbd(_0x6662bc['error'][_0x6e7e('0x10')]);}else{logger[_0x6e7e('0x11')](_0x6e7e('0xa'),_0x2394f0,_0x6e7e('0xb'));_0x4ecdbd(_0x6662bc[_0x6e7e('0x12')][_0x6e7e('0x10')]);}})[_0x6e7e('0x13')](function(_0x53f5e6){logger[_0x6e7e('0xe')](_0x6e7e('0xa'),_0x2394f0,_0x53f5e6);_0x31ef6c(_0x53f5e6);});});}exports[_0x6e7e('0x14')]=function(_0x364cef){var _0xa3fc3d=this;return new Promise(function(_0x2d9ead,_0x4729bc){return db['VoiceCallReport']['findAll']({'raw':_0x364cef[_0x6e7e('0x15')]?_0x364cef[_0x6e7e('0x15')][_0x6e7e('0x16')]===undefined?!![]:![]:!![],'where':_0x364cef[_0x6e7e('0x15')]?_0x364cef[_0x6e7e('0x15')]['where']||null:null,'attributes':_0x364cef[_0x6e7e('0x15')]?_0x364cef['options']['attributes']||null:null,'limit':_0x364cef['options']?_0x364cef[_0x6e7e('0x15')][_0x6e7e('0x17')]||null:null,'include':_0x364cef[_0x6e7e('0x15')]?_0x364cef[_0x6e7e('0x15')][_0x6e7e('0x18')]?_[_0x6e7e('0x19')](_0x364cef['options'][_0x6e7e('0x18')],function(_0x383604){return{'model':db[_0x383604[_0x6e7e('0x1a')]],'as':_0x383604['as'],'attributes':_0x383604[_0x6e7e('0x1b')],'include':_0x383604[_0x6e7e('0x18')]?_['map'](_0x383604['include'],function(_0x20baf7){return{'model':db[_0x20baf7['model']],'as':_0x20baf7['as'],'attributes':_0x20baf7[_0x6e7e('0x1b')],'include':_0x20baf7[_0x6e7e('0x18')]?_[_0x6e7e('0x19')](_0x20baf7[_0x6e7e('0x18')],function(_0x27d075){return{'model':db[_0x27d075[_0x6e7e('0x1a')]],'as':_0x27d075['as'],'attributes':_0x27d075[_0x6e7e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6e7e('0x9')](function(_0x40ec72){logger[_0x6e7e('0x11')]('GetVoiceCallReport',_0x364cef);logger[_0x6e7e('0x1c')]('GetVoiceCallReport',_0x364cef,JSON['stringify'](_0x40ec72));_0x2d9ead(_0x40ec72);})[_0x6e7e('0x13')](function(_0x202067){logger[_0x6e7e('0xe')]('GetVoiceCallReport',_0x202067[_0x6e7e('0x10')],_0x364cef);_0x4729bc(_0xa3fc3d[_0x6e7e('0xe')](0x1f4,_0x202067[_0x6e7e('0x10')]));});});};exports[_0x6e7e('0x1d')]=function(_0x62de2c){var _0x85a12a=this;return new Promise(function(_0x616286,_0x5f0db3){return db[_0x6e7e('0x1e')][_0x6e7e('0x1f')](_0x62de2c[_0x6e7e('0x20')],{'raw':_0x62de2c[_0x6e7e('0x15')]?_0x62de2c['options'][_0x6e7e('0x16')]===undefined?!![]:![]:!![]})[_0x6e7e('0x9')](function(_0x95f8b6){logger[_0x6e7e('0x11')](_0x6e7e('0x1d'),_0x62de2c);logger[_0x6e7e('0x1c')](_0x6e7e('0x1d'),_0x62de2c,JSON[_0x6e7e('0xd')](_0x95f8b6));_0x616286(_0x95f8b6);})[_0x6e7e('0x13')](function(_0x1de20d){logger[_0x6e7e('0xe')](_0x6e7e('0x1d'),_0x1de20d[_0x6e7e('0x10')],_0x62de2c);_0x5f0db3(_0x85a12a[_0x6e7e('0xe')](0x1f4,_0x1de20d['message']));});});};exports[_0x6e7e('0x21')]=function(_0x506de4){var _0x2ae42e=this;return new Promise(function(_0x5e7b62,_0x5999d4){return db[_0x6e7e('0x1e')][_0x6e7e('0x22')](_0x506de4[_0x6e7e('0x20')],{'raw':_0x506de4[_0x6e7e('0x15')]?_0x506de4[_0x6e7e('0x15')][_0x6e7e('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x506de4[_0x6e7e('0x15')]?_0x506de4['options'][_0x6e7e('0x23')]||null:null,'attributes':_0x506de4[_0x6e7e('0x15')]?_0x506de4[_0x6e7e('0x15')][_0x6e7e('0x1b')]||null:null,'limit':_0x506de4[_0x6e7e('0x15')]?_0x506de4['options'][_0x6e7e('0x17')]||null:null})['then'](function(_0x22763b){logger['info'](_0x6e7e('0x21'),_0x506de4);logger['debug'](_0x6e7e('0x21'),_0x506de4,JSON[_0x6e7e('0xd')](_0x22763b));_0x5e7b62(_0x22763b);})[_0x6e7e('0x13')](function(_0x5a78c9){logger['error']('UpdateVoiceCallReport',_0x5a78c9[_0x6e7e('0x10')],_0x506de4);_0x5999d4(_0x2ae42e[_0x6e7e('0xe')](0x1f4,_0x5a78c9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 2f01aba..15d551e 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 _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 +var _0x8c79=['express','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','show','put','/:id','delete','destroy','exports','multer'];(function(_0x4a339d,_0x44afb0){var _0x1e3c3a=function(_0x20df8c){while(--_0x20df8c){_0x4a339d['push'](_0x4a339d['shift']());}};_0x1e3c3a(++_0x44afb0);}(_0x8c79,0xa8));var _0x98c7=function(_0x2c54c0,_0x187cb3){_0x2c54c0=_0x2c54c0-0x0;var _0x34980f=_0x8c79[_0x2c54c0];return _0x34980f;};'use strict';var multer=require(_0x98c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x98c7('0x1'));var router=express['Router']();var auth=require(_0x98c7('0x2'));var interaction=require(_0x98c7('0x3'));var config=require('../../config/environment');var controller=require(_0x98c7('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x98c7('0x5')]('/:id',auth[_0x98c7('0x6')](),controller[_0x98c7('0x7')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x98c7('0x8')](_0x98c7('0x9'),auth[_0x98c7('0x6')](),controller['update']);router[_0x98c7('0xa')]('/:id',auth[_0x98c7('0x6')](),controller[_0x98c7('0xb')]);module[_0x98c7('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 10ef07b..3bde0d5 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 _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 +var _0x0de4=['STRING','name','setDataValue','getDataValue','options','BOOLEAN','sequelize','exports'];(function(_0x36e274,_0x161715){var _0x2ffce9=function(_0x2a3bbe){while(--_0x2a3bbe){_0x36e274['push'](_0x36e274['shift']());}};_0x2ffce9(++_0x161715);}(_0x0de4,0x176));var _0x40de=function(_0x3fdf20,_0x53d95b){_0x3fdf20=_0x3fdf20-0x0;var _0x5ed2e2=_0x0de4[_0x3fdf20];return _0x5ed2e2;};'use strict';var Sequelize=require(_0x40de('0x0'));module[_0x40de('0x1')]={'name':{'type':Sequelize[_0x40de('0x2')]},'prefix':{'type':Sequelize[_0x40de('0x2')],'unique':_0x40de('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x40de('0x2')],'set':function(_0x2066d1){this[_0x40de('0x4')]('options',_0x2066d1?_0x2066d1['join'](''):[]);},'get':function(){return this[_0x40de('0x5')](_0x40de('0x6'))?this[_0x40de('0x5')](_0x40de('0x6'))['split'](''):[];}},'auth':{'type':Sequelize[_0x40de('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x40de('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x40de('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8663f08..e3b99b1 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 _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 +var _0xa854=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','Content-Range','apply','reject','save','update','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x1d3eed,_0x5b65e2){var _0x78cca1=function(_0x2fa628){while(--_0x2fa628){_0x1d3eed['push'](_0x1d3eed['shift']());}};_0x78cca1(++_0x5b65e2);}(_0xa854,0x19e));var _0x4a85=function(_0x50bdf1,_0x4285f5){_0x50bdf1=_0x50bdf1-0x0;var _0x29d3be=_0xa854[_0x50bdf1];return _0x29d3be;};'use strict';var pdf=require(_0x4a85('0x0'));var emlformat=require(_0x4a85('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4a85('0x2'));var jsonpatch=require(_0x4a85('0x3'));var rp=require(_0x4a85('0x4'));var moment=require('moment');var BPromise=require(_0x4a85('0x5'));var Mustache=require(_0x4a85('0x6'));var util=require(_0x4a85('0x7'));var path=require(_0x4a85('0x8'));var sox=require(_0x4a85('0x9'));var csv=require(_0x4a85('0xa'));var ejs=require(_0x4a85('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4a85('0xc'));var jsforce=require(_0x4a85('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4a85('0xa'));var querystring=require('querystring');var Papa=require(_0x4a85('0xe'));var Redis=require(_0x4a85('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4a85('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4a85('0x11'))(_0x4a85('0x12'));var utils=require('../../config/utils');var config=require(_0x4a85('0x13'));var licenseUtil=require(_0x4a85('0x14'));var db=require(_0x4a85('0x15'))['db'];function respondWithStatusCode(_0xc8a1be,_0x51191d){_0x51191d=_0x51191d||0xcc;return function(_0xdcb23e){if(_0xdcb23e){return _0xc8a1be[_0x4a85('0x16')](_0x51191d);}return _0xc8a1be[_0x4a85('0x17')](_0x51191d)[_0x4a85('0x18')]();};}function respondWithResult(_0x3ffe22,_0x40727a){_0x40727a=_0x40727a||0xc8;return function(_0x28634c){if(_0x28634c){return _0x3ffe22[_0x4a85('0x17')](_0x40727a)['json'](_0x28634c);}};}function respondWithFilteredResult(_0x348663,_0x147c70){return function(_0x38d673){if(_0x38d673){var _0x34d533=_0x38d673['count'],_0xc0a609=_0x147c70['offset'],_0x218229=_0x147c70[_0x4a85('0x19')]+_0x147c70['limit'],_0xaca583;if(_0x218229>=_0x34d533){_0x218229=_0x34d533;_0xaca583=0xc8;}else{_0xaca583=0xce;}_0x348663[_0x4a85('0x17')](_0xaca583);return _0x348663['set'](_0x4a85('0x1a'),_0xc0a609+'-'+_0x218229+'/'+_0x34d533)['json'](_0x38d673);}return null;};}function patchUpdates(_0x441a8e){return function(_0x4ae068){try{jsonpatch[_0x4a85('0x1b')](_0x4ae068,_0x441a8e,!![]);}catch(_0x61c299){return BPromise[_0x4a85('0x1c')](_0x61c299);}return _0x4ae068[_0x4a85('0x1d')]();};}function saveUpdates(_0x44e8dd,_0x351b74){return function(_0x17ddaa){if(_0x17ddaa){return _0x17ddaa[_0x4a85('0x1e')](_0x44e8dd)[_0x4a85('0x1f')](function(_0x189a45){return _0x189a45;});}return null;};}function removeEntity(_0x18ac40,_0x5e7967){return function(_0x50e642){if(_0x50e642){return _0x50e642['destroy']()[_0x4a85('0x1f')](function(){var _0x3a0513=_0x50e642[_0x4a85('0x20')]({'plain':!![]});var _0x10baeb=_0x4a85('0x21');return db[_0x4a85('0x22')]['destroy']({'where':{'type':_0x10baeb,'resourceId':_0x3a0513['id']}})[_0x4a85('0x1f')](function(){return _0x50e642;});})['then'](function(){_0x18ac40[_0x4a85('0x17')](0xcc)[_0x4a85('0x18')]();});}};}function handleEntityNotFound(_0x4c7f96,_0x1546da){return function(_0x356480){if(!_0x356480){_0x4c7f96[_0x4a85('0x16')](0x194);}return _0x356480;};}function handleError(_0x241fe0,_0x5157e1){_0x5157e1=_0x5157e1||0x1f4;return function(_0x45c816){logger[_0x4a85('0x23')](_0x45c816[_0x4a85('0x24')]);if(_0x45c816[_0x4a85('0x25')]){delete _0x45c816[_0x4a85('0x25')];}_0x241fe0['status'](_0x5157e1)[_0x4a85('0x26')](_0x45c816);};}exports[_0x4a85('0x27')]=function(_0x57684b,_0xe1844e){var _0x48c737={},_0x3297ed={},_0x3c81f0={'count':0x0,'rows':[]};var _0x4333a4=_[_0x4a85('0x28')](db[_0x4a85('0x29')][_0x4a85('0x2a')],function(_0x4eee80){return{'name':_0x4eee80[_0x4a85('0x2b')],'type':_0x4eee80['type'][_0x4a85('0x2c')]};});_0x3297ed[_0x4a85('0x2d')]=_[_0x4a85('0x28')](_0x4333a4,_0x4a85('0x25'));_0x3297ed[_0x4a85('0x2e')]=_[_0x4a85('0x2f')](_0x57684b[_0x4a85('0x2e')]);_0x3297ed[_0x4a85('0x30')]=_[_0x4a85('0x31')](_0x3297ed[_0x4a85('0x2d')],_0x3297ed['query']);_0x48c737[_0x4a85('0x32')]=_[_0x4a85('0x31')](_0x3297ed[_0x4a85('0x2d')],qs[_0x4a85('0x33')](_0x57684b['query'][_0x4a85('0x33')]));_0x48c737[_0x4a85('0x32')]=_0x48c737['attributes']['length']?_0x48c737[_0x4a85('0x32')]:_0x3297ed[_0x4a85('0x2d')];if(!_0x57684b[_0x4a85('0x2e')][_0x4a85('0x34')](_0x4a85('0x35'))){_0x48c737[_0x4a85('0x36')]=qs[_0x4a85('0x36')](_0x57684b[_0x4a85('0x2e')][_0x4a85('0x36')]);_0x48c737['offset']=qs['offset'](_0x57684b[_0x4a85('0x2e')]['offset']);}_0x48c737[_0x4a85('0x37')]=qs[_0x4a85('0x38')](_0x57684b[_0x4a85('0x2e')]['sort']);_0x48c737[_0x4a85('0x39')]=qs[_0x4a85('0x30')](_[_0x4a85('0x3a')](_0x57684b[_0x4a85('0x2e')],_0x3297ed[_0x4a85('0x30')]),_0x4333a4);if(_0x57684b[_0x4a85('0x2e')][_0x4a85('0x3b')]){_0x48c737[_0x4a85('0x39')]=_[_0x4a85('0x3c')](_0x48c737[_0x4a85('0x39')],{'$or':_[_0x4a85('0x28')](_0x4333a4,function(_0x319b15){if(_0x319b15[_0x4a85('0x3d')]!==_0x4a85('0x3e')){var _0x547f94={};_0x547f94[_0x319b15['name']]={'$like':'%'+_0x57684b[_0x4a85('0x2e')][_0x4a85('0x3b')]+'%'};return _0x547f94;}})});}_0x48c737=_['merge']({},_0x48c737,_0x57684b[_0x4a85('0x3f')]);var _0x10155e={'where':_0x48c737[_0x4a85('0x39')]};return db['VoiceChanSpy'][_0x4a85('0x40')](_0x10155e)[_0x4a85('0x1f')](function(_0x11671b){_0x3c81f0[_0x4a85('0x40')]=_0x11671b;if(_0x57684b[_0x4a85('0x2e')][_0x4a85('0x41')]){_0x48c737[_0x4a85('0x42')]=[{'all':!![]}];}return db[_0x4a85('0x29')][_0x4a85('0x43')](_0x48c737);})[_0x4a85('0x1f')](function(_0x4443e6){_0x3c81f0[_0x4a85('0x44')]=_0x4443e6;return _0x3c81f0;})['then'](respondWithFilteredResult(_0xe1844e,_0x48c737))[_0x4a85('0x45')](handleError(_0xe1844e,null));};exports[_0x4a85('0x46')]=function(_0x518749,_0x13d837){var _0x18f06a={'raw':![],'where':{'id':_0x518749[_0x4a85('0x47')]['id']}},_0x558921={};_0x558921[_0x4a85('0x2d')]=_[_0x4a85('0x2f')](db[_0x4a85('0x29')][_0x4a85('0x2a')]);_0x558921['query']=_['keys'](_0x518749[_0x4a85('0x2e')]);_0x558921[_0x4a85('0x30')]=_[_0x4a85('0x31')](_0x558921[_0x4a85('0x2d')],_0x558921[_0x4a85('0x2e')]);_0x18f06a[_0x4a85('0x32')]=_[_0x4a85('0x31')](_0x558921['model'],qs[_0x4a85('0x33')](_0x518749['query']['fields']));_0x18f06a['attributes']=_0x18f06a[_0x4a85('0x32')][_0x4a85('0x48')]?_0x18f06a[_0x4a85('0x32')]:_0x558921[_0x4a85('0x2d')];if(_0x518749[_0x4a85('0x2e')][_0x4a85('0x41')]){_0x18f06a[_0x4a85('0x42')]=[{'all':!![]}];}_0x18f06a=_[_0x4a85('0x3c')]({},_0x18f06a,_0x518749['options']);return db[_0x4a85('0x29')][_0x4a85('0x49')](_0x18f06a)[_0x4a85('0x1f')](handleEntityNotFound(_0x13d837,null))['then'](respondWithResult(_0x13d837,null))['catch'](handleError(_0x13d837,null));};exports[_0x4a85('0x4a')]=function(_0x147722,_0x304512){return db[_0x4a85('0x29')][_0x4a85('0x4a')](_0x147722[_0x4a85('0x4b')],{})[_0x4a85('0x1f')](function(_0x1264f8){var _0x20f3c3=_0x147722['user'][_0x4a85('0x20')]({'plain':!![]});if(!_0x20f3c3)throw new Error(_0x4a85('0x4c'));if(_0x20f3c3['role']===_0x4a85('0x4d')){var _0x397a91=_0x1264f8['get']({'plain':!![]});var _0x41d25f=_0x4a85('0x21');return db['UserProfileSection'][_0x4a85('0x49')]({'where':{'name':_0x41d25f,'userProfileId':_0x20f3c3[_0x4a85('0x4e')]},'raw':!![]})[_0x4a85('0x1f')](function(_0x420fe3){if(_0x420fe3&&_0x420fe3[_0x4a85('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x397a91[_0x4a85('0x25')],'resourceId':_0x397a91['id'],'type':_0x420fe3['name'],'sectionId':_0x420fe3['id']},{})[_0x4a85('0x1f')](function(){return _0x1264f8;});}else{return _0x1264f8;}})['catch'](function(_0xd49d66){logger['error'](_0x4a85('0x50'),_0xd49d66);throw _0xd49d66;});}return _0x1264f8;})[_0x4a85('0x1f')](respondWithResult(_0x304512,0xc9))[_0x4a85('0x45')](handleError(_0x304512,null));};exports[_0x4a85('0x1e')]=function(_0x14212e,_0x289854){if(_0x14212e[_0x4a85('0x4b')]['id']){delete _0x14212e[_0x4a85('0x4b')]['id'];}return db[_0x4a85('0x29')][_0x4a85('0x49')]({'where':{'id':_0x14212e[_0x4a85('0x47')]['id']}})[_0x4a85('0x1f')](handleEntityNotFound(_0x289854,null))[_0x4a85('0x1f')](saveUpdates(_0x14212e[_0x4a85('0x4b')],null))[_0x4a85('0x1f')](respondWithResult(_0x289854,null))[_0x4a85('0x45')](handleError(_0x289854,null));};exports[_0x4a85('0x51')]=function(_0x3fd259,_0x179791){return db[_0x4a85('0x29')][_0x4a85('0x49')]({'where':{'id':_0x3fd259[_0x4a85('0x47')]['id']}})['then'](handleEntityNotFound(_0x179791,null))[_0x4a85('0x1f')](removeEntity(_0x179791,null))['catch'](handleError(_0x179791,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 1c9c8f9..bcb4cd1 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 _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 +var _0x296f=['bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','%s%s','prefix','push','merge','format','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','name','options','join','length','concat','internal','User','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x296f,0xf0));var _0xf296=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x296f[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var BPromise=require(_0xf296('0x2'));var attributes=require(_0xf296('0x3'));var getUserApplications=function(_0x3d544e,_0x3718fe,_0x4d9940){var _0x4ca5e9=0x1;var _0x3cb080=[];var _0x1319ea={'context':_0x3718fe['context']||'from-sip','exten':util['format'](_0xf296('0x4'),_0x3d544e[_0xf296('0x5')],_0x4d9940),'type':'system','isApp':![],'ChanSpyId':_0x3d544e['id'],'UserId':_0x3718fe['id']};_0x3cb080[_0xf296('0x6')](_[_0xf296('0x7')]({'app':'Set','appdata':util[_0xf296('0x8')]('CDR(type)=%s',_0xf296('0x9')),'priority':_0x4ca5e9++},_0x1319ea));if(_0x3d544e[_0xf296('0xa')]){_0x3cb080[_0xf296('0x6')](_['merge']({'app':_0xf296('0xb'),'appdata':util[_0xf296('0x8')](_0xf296('0xc'),_0x3d544e['recordingFormat']),'priority':_0x4ca5e9++},_0x1319ea));}if(_0x3d544e[_0xf296('0xd')]){_0x3cb080[_0xf296('0x6')](_[_0xf296('0x7')]({'app':_0xf296('0xe'),'appdata':_0x3d544e[_0xf296('0xf')],'priority':_0x4ca5e9++},_0x1319ea));}_0x3cb080['push'](_['merge']({'app':_0xf296('0x10'),'appdata':util[_0xf296('0x8')]('SIP/%s,%s',_0x3718fe[_0xf296('0x11')],_0x3d544e[_0xf296('0x12')]?_0x3d544e['options'][_0xf296('0x13')](''):''),'priority':_0x4ca5e9++},_0x1319ea));if(_0x3d544e[_0xf296('0xa')]){_0x3cb080['push'](_['merge']({'app':'StopMixMonitor','priority':_0x4ca5e9++},_0x1319ea));}return _0x3cb080;};var getChanSpyApplications=function(_0x25ba1e,_0x422b54){var _0x1f3b5b=[];for(var _0x3d3225=0x0,_0x103bd6=0x1;_0x3d3225<_0x422b54[_0xf296('0x14')];_0x3d3225++,_0x103bd6=0x1){_0x1f3b5b=_0x1f3b5b[_0xf296('0x15')](getUserApplications(_0x25ba1e,_0x422b54[_0x3d3225],_0x422b54[_0x3d3225][_0xf296('0x16')]));if(_0x422b54[_0x3d3225]['internal']!=_0x422b54[_0x3d3225][_0xf296('0x11')]){_0x1f3b5b=_0x1f3b5b[_0xf296('0x15')](getUserApplications(_0x25ba1e,_0x422b54[_0x3d3225],_0x422b54[_0x3d3225][_0xf296('0x11')]));}}return _0x1f3b5b;};var getChanSpyPromise=function(_0x2dce6e,_0x468a31){return new BPromise(function(_0x3e90ef,_0x50b3c0){return _0x2dce6e[_0xf296('0x17')]['findAll']({'attributes':['id',_0xf296('0x11'),_0xf296('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xf296('0x18')](function(_0x3bdc0e){if(_0x3bdc0e){return _0x3e90ef(getChanSpyApplications(_0x468a31,_0x3bdc0e));}return _0x3e90ef([]);})[_0xf296('0x19')](function(_0x4f337b){_0x50b3c0(_0x4f337b);});});};module[_0xf296('0x1a')]=function(_0x396227,_0x4c5bfa){var _0x35b08e=_0x396227[_0xf296('0x1b')];return _0x396227[_0xf296('0x1c')](_0xf296('0x1d'),attributes,{'tableName':_0xf296('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15d49c,_0x520415,_0xbf51bb){return getChanSpyPromise(_0x35b08e,_0x15d49c)[_0xf296('0x18')](function(_0xd4dc36){if(_0xd4dc36&&_0xd4dc36[_0xf296('0x14')]){return _0x35b08e[_0xf296('0x1f')][_0xf296('0x20')](_0xd4dc36);}})['then'](function(){_0xbf51bb();})[_0xf296('0x19')](function(_0x300c87){_0xbf51bb(_0x300c87);});},'afterUpdate':function(_0x32398e,_0x3f5067,_0x380831){return _0x35b08e[_0xf296('0x1f')][_0xf296('0x21')]({'where':{'ChanSpyId':_0x32398e['id']}})[_0xf296('0x18')](function(){return getChanSpyPromise(_0x35b08e,_0x32398e);})[_0xf296('0x18')](function(_0x57b4e5){if(_0x57b4e5&&_0x57b4e5['length']){return _0x35b08e['VoiceExtension'][_0xf296('0x20')](_0x57b4e5);}})[_0xf296('0x18')](function(){_0x380831();})[_0xf296('0x19')](function(_0xc76eef){_0x380831(_0xc76eef);});},'afterDestroy':function(_0x36ad6b,_0x5cb5eb,_0x95d538){return _0x35b08e['VoiceExtension'][_0xf296('0x21')]({'where':{'ChanSpyId':_0x36ad6b['id']}})['then'](function(){_0x95d538();})[_0xf296('0x19')](function(_0x32895d){_0x95d538(_0x32895d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8eb78d1..1404cb2 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 _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 +var _0xd14f=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','catch'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xd14f,0x1a4));var _0xfd14=function(_0x5de842,_0x3f47cf){_0x5de842=_0x5de842-0x0;var _0x55c6fc=_0xd14f[_0x5de842];return _0x55c6fc;};'use strict';var _=require(_0xfd14('0x0'));var util=require(_0xfd14('0x1'));var moment=require(_0xfd14('0x2'));var BPromise=require(_0xfd14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfd14('0x4'));var logger=require(_0xfd14('0x5'))(_0xfd14('0x6'));var config=require('../../config/environment');var jayson=require(_0xfd14('0x7'));var client=jayson[_0xfd14('0x8')][_0xfd14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2055bf,_0x180c35,_0x298ccd){return new BPromise(function(_0x276afb,_0x6c3a3c){return client[_0xfd14('0xa')](_0x2055bf,_0x298ccd)[_0xfd14('0xb')](function(_0x4e6637){logger[_0xfd14('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x180c35,_0xfd14('0xd'));logger['debug'](_0xfd14('0xe'),_0x180c35,_0xfd14('0xd'),JSON[_0xfd14('0xf')](_0x4e6637));if(_0x4e6637['error']){if(_0x4e6637[_0xfd14('0x10')]['code']===0x1f4){logger[_0xfd14('0x10')](_0xfd14('0x11'),_0x180c35,_0x4e6637[_0xfd14('0x10')][_0xfd14('0x12')]);return _0x6c3a3c(_0x4e6637[_0xfd14('0x10')][_0xfd14('0x12')]);}logger[_0xfd14('0x10')](_0xfd14('0x11'),_0x180c35,_0x4e6637[_0xfd14('0x10')][_0xfd14('0x12')]);return _0x276afb(_0x4e6637[_0xfd14('0x10')][_0xfd14('0x12')]);}else{logger[_0xfd14('0xc')](_0xfd14('0x11'),_0x180c35,_0xfd14('0xd'));_0x276afb(_0x4e6637['result'][_0xfd14('0x12')]);}})[_0xfd14('0x13')](function(_0x94d34e){logger[_0xfd14('0x10')](_0xfd14('0x11'),_0x180c35,_0x94d34e);_0x6c3a3c(_0x94d34e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 858e731..c45ef97 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 _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 +var _0x0049=['../../components/auth/service','../../config/environment','./voiceContext.controller','index','get','isAuthenticated','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0x0049,0xc2));var _0x9004=function(_0x4ba2a3,_0x429271){_0x4ba2a3=_0x4ba2a3-0x0;var _0x5c65bc=_0x0049[_0x4ba2a3];return _0x5c65bc;};'use strict';var multer=require(_0x9004('0x0'));var util=require(_0x9004('0x1'));var path=require(_0x9004('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9004('0x3')]();var auth=require(_0x9004('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9004('0x5'));var controller=require(_0x9004('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x9004('0x7')]);router[_0x9004('0x8')]('/:id',auth[_0x9004('0x9')](),controller[_0x9004('0xa')]);router[_0x9004('0xb')]('/',auth[_0x9004('0x9')](),controller[_0x9004('0xc')]);router['put'](_0x9004('0xd'),auth['isAuthenticated'](),controller[_0x9004('0xe')]);router[_0x9004('0xf')](_0x9004('0xd'),auth[_0x9004('0x9')](),controller[_0x9004('0x10')]);module[_0x9004('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 cdd4a01..41f9285 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(_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 +var _0x3e74=['name','sequelize','STRING'];(function(_0x332ddf,_0x1ed1b5){var _0x4798a9=function(_0x313ebf){while(--_0x313ebf){_0x332ddf['push'](_0x332ddf['shift']());}};_0x4798a9(++_0x1ed1b5);}(_0x3e74,0x175));var _0x43e7=function(_0x16efbc,_0x412ba5){_0x16efbc=_0x16efbc-0x0;var _0x52e0f8=_0x3e74[_0x16efbc];return _0x52e0f8;};'use strict';var Sequelize=require(_0x43e7('0x0'));module['exports']={'name':{'type':Sequelize[_0x43e7('0x1')],'unique':_0x43e7('0x2')},'description':{'type':Sequelize[_0x43e7('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index fe70280..de04aad 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 _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 +var _0xae7b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','create','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','body','readFileSync','server/files/templates/context.ejs','utf8','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse'];(function(_0x277978,_0x457e56){var _0x564e3c=function(_0x362b2e){while(--_0x362b2e){_0x277978['push'](_0x277978['shift']());}};_0x564e3c(++_0x457e56);}(_0xae7b,0xbe));var _0xbae7=function(_0x10c25c,_0x17c9e5){_0x10c25c=_0x10c25c-0x0;var _0x3de806=_0xae7b[_0x10c25c];return _0x3de806;};'use strict';var pdf=require(_0xbae7('0x0'));var emlformat=require(_0xbae7('0x1'));var rimraf=require(_0xbae7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbae7('0x3'));var moment=require(_0xbae7('0x4'));var BPromise=require(_0xbae7('0x5'));var Mustache=require(_0xbae7('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbae7('0x7'));var csv=require(_0xbae7('0x8'));var ejs=require(_0xbae7('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbae7('0xa'));var crypto=require('crypto');var jsforce=require(_0xbae7('0xb'));var deskjs=require(_0xbae7('0xc'));var toCsv=require(_0xbae7('0x8'));var querystring=require('querystring');var Papa=require(_0xbae7('0xd'));var Redis=require('ioredis');var authService=require(_0xbae7('0xe'));var qs=require(_0xbae7('0xf'));var as=require(_0xbae7('0x10'));var hardwareService=require(_0xbae7('0x11'));var logger=require('../../config/logger')(_0xbae7('0x12'));var utils=require(_0xbae7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xbae7('0x14'));var db=require('../../mysqldb')['db'];var jayson=require(_0xbae7('0x15'));var client=jayson[_0xbae7('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4800d4,_0x44bdbb,_0x66c04b,_0x43e4ca){return new BPromise(function(_0x25d1a,_0x4cc0a9){var _0x31f6e5=_0x43e4ca||client;return _0x31f6e5['request'](_0x4800d4,_0x66c04b)['then'](function(_0x249669){logger[_0xbae7('0x17')](_0xbae7('0x18'),_0x44bdbb,_0xbae7('0x19'));logger[_0xbae7('0x1a')](_0xbae7('0x1b'),_0x44bdbb,'request\x20sent',JSON[_0xbae7('0x1c')](_0x249669));if(_0x249669[_0xbae7('0x1d')]){if(_0x249669[_0xbae7('0x1d')][_0xbae7('0x1e')]===0x1f4){logger[_0xbae7('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x44bdbb,_0x249669['error']['message']);return _0x4cc0a9(_0x249669[_0xbae7('0x1d')][_0xbae7('0x1f')]);}logger[_0xbae7('0x1d')](_0xbae7('0x18'),_0x44bdbb,_0x249669[_0xbae7('0x1d')]['message']);return _0x25d1a(_0x249669[_0xbae7('0x1d')][_0xbae7('0x1f')]);}else{logger[_0xbae7('0x17')](_0xbae7('0x18'),_0x44bdbb,_0xbae7('0x19'));_0x25d1a(_0x249669[_0xbae7('0x20')][_0xbae7('0x1f')]);}})[_0xbae7('0x21')](function(_0x361271){logger[_0xbae7('0x1d')](_0xbae7('0x18'),_0x44bdbb,_0x361271);_0x4cc0a9(_0x361271);});});}function respondWithStatusCode(_0x384ea6,_0x32f8eb){_0x32f8eb=_0x32f8eb||0xcc;return function(_0x5c0245){if(_0x5c0245){return _0x384ea6['sendStatus'](_0x32f8eb);}return _0x384ea6[_0xbae7('0x22')](_0x32f8eb)[_0xbae7('0x23')]();};}function respondWithResult(_0x33e757,_0x375df5){_0x375df5=_0x375df5||0xc8;return function(_0x61170a){if(_0x61170a){return _0x33e757[_0xbae7('0x22')](_0x375df5)[_0xbae7('0x24')](_0x61170a);}};}function respondWithFilteredResult(_0x1b5caa,_0x1399bc){return function(_0x3e104e){if(_0x3e104e){var _0x3df1f1=_0x3e104e['count'],_0x3523f0=_0x1399bc[_0xbae7('0x25')],_0x47eb5d=_0x1399bc[_0xbae7('0x25')]+_0x1399bc[_0xbae7('0x26')],_0x5865f4;if(_0x47eb5d>=_0x3df1f1){_0x47eb5d=_0x3df1f1;_0x5865f4=0xc8;}else{_0x5865f4=0xce;}_0x1b5caa[_0xbae7('0x22')](_0x5865f4);return _0x1b5caa[_0xbae7('0x27')](_0xbae7('0x28'),_0x3523f0+'-'+_0x47eb5d+'/'+_0x3df1f1)['json'](_0x3e104e);}return null;};}function patchUpdates(_0x5d702f){return function(_0x41d4fa){try{jsonpatch[_0xbae7('0x29')](_0x41d4fa,_0x5d702f,!![]);}catch(_0x34feff){return BPromise[_0xbae7('0x2a')](_0x34feff);}return _0x41d4fa[_0xbae7('0x2b')]();};}function saveUpdates(_0x2ddce5,_0x590cfa){return function(_0x3ba648){if(_0x3ba648){return _0x3ba648[_0xbae7('0x2c')](_0x2ddce5)[_0xbae7('0x2d')](function(_0x1f586d){return _0x1f586d;});}return null;};}function removeEntity(_0x467949,_0x18e61e){return function(_0x1153f0){if(_0x1153f0){return _0x1153f0[_0xbae7('0x2e')]()[_0xbae7('0x2d')](function(){var _0x364cf9=_0x1153f0[_0xbae7('0x2f')]({'plain':!![]});var _0x3da51d='Contexts';return db[_0xbae7('0x30')][_0xbae7('0x2e')]({'where':{'type':_0x3da51d,'resourceId':_0x364cf9['id']}})[_0xbae7('0x2d')](function(){return _0x1153f0;});})['then'](function(){_0x467949[_0xbae7('0x22')](0xcc)[_0xbae7('0x23')]();});}};}function handleEntityNotFound(_0x5c417e,_0x245dde){return function(_0x1f27fb){if(!_0x1f27fb){_0x5c417e[_0xbae7('0x31')](0x194);}return _0x1f27fb;};}function handleError(_0xfbedad,_0x41aab0){_0x41aab0=_0x41aab0||0x1f4;return function(_0x2b0f60){logger[_0xbae7('0x1d')](_0x2b0f60[_0xbae7('0x32')]);if(_0x2b0f60[_0xbae7('0x33')]){delete _0x2b0f60['name'];}_0xfbedad['status'](_0x41aab0)[_0xbae7('0x34')](_0x2b0f60);};}exports[_0xbae7('0x35')]=function(_0x519a0d,_0x1194be){var _0x43d138={},_0x30e471={},_0x28afe4={'count':0x0,'rows':[]};var _0x16b26=_[_0xbae7('0x36')](db[_0xbae7('0x37')][_0xbae7('0x38')],function(_0x4df6c9){return{'name':_0x4df6c9['fieldName'],'type':_0x4df6c9[_0xbae7('0x39')]['key']};});_0x30e471[_0xbae7('0x3a')]=_['map'](_0x16b26,_0xbae7('0x33'));_0x30e471[_0xbae7('0x3b')]=_[_0xbae7('0x3c')](_0x519a0d[_0xbae7('0x3b')]);_0x30e471[_0xbae7('0x3d')]=_[_0xbae7('0x3e')](_0x30e471['model'],_0x30e471[_0xbae7('0x3b')]);_0x43d138['attributes']=_['intersection'](_0x30e471[_0xbae7('0x3a')],qs[_0xbae7('0x3f')](_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x3f')]));_0x43d138[_0xbae7('0x40')]=_0x43d138['attributes'][_0xbae7('0x41')]?_0x43d138[_0xbae7('0x40')]:_0x30e471[_0xbae7('0x3a')];if(!_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x42')]('nolimit')){_0x43d138[_0xbae7('0x26')]=qs['limit'](_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x26')]);_0x43d138[_0xbae7('0x25')]=qs[_0xbae7('0x25')](_0x519a0d[_0xbae7('0x3b')]['offset']);}_0x43d138[_0xbae7('0x43')]=qs[_0xbae7('0x44')](_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x44')]);_0x43d138[_0xbae7('0x45')]=qs[_0xbae7('0x3d')](_[_0xbae7('0x46')](_0x519a0d['query'],_0x30e471[_0xbae7('0x3d')]),_0x16b26);if(_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x47')]){_0x43d138[_0xbae7('0x45')]=_[_0xbae7('0x48')](_0x43d138[_0xbae7('0x45')],{'$or':_['map'](_0x16b26,function(_0x5c41b4){if(_0x5c41b4[_0xbae7('0x39')]!==_0xbae7('0x49')){var _0x4d267c={};_0x4d267c[_0x5c41b4[_0xbae7('0x33')]]={'$like':'%'+_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x47')]+'%'};return _0x4d267c;}})});}_0x43d138=_[_0xbae7('0x48')]({},_0x43d138,_0x519a0d[_0xbae7('0x4a')]);var _0x4f79ba={'where':_0x43d138[_0xbae7('0x45')]};return db[_0xbae7('0x37')][_0xbae7('0x4b')](_0x4f79ba)[_0xbae7('0x2d')](function(_0x5d7e7a){_0x28afe4[_0xbae7('0x4b')]=_0x5d7e7a;if(_0x519a0d[_0xbae7('0x3b')][_0xbae7('0x4c')]){_0x43d138[_0xbae7('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0xbae7('0x4e')](_0x43d138);})[_0xbae7('0x2d')](function(_0x16a7fe){_0x28afe4[_0xbae7('0x4f')]=_0x16a7fe;return _0x28afe4;})['then'](respondWithFilteredResult(_0x1194be,_0x43d138))[_0xbae7('0x21')](handleError(_0x1194be,null));};exports[_0xbae7('0x50')]=function(_0xb6df1f,_0x363b7b){var _0x30b469={'raw':![],'where':{'id':_0xb6df1f['params']['id']}},_0x494ecc={};_0x494ecc['model']=_[_0xbae7('0x3c')](db[_0xbae7('0x37')][_0xbae7('0x38')]);_0x494ecc[_0xbae7('0x3b')]=_[_0xbae7('0x3c')](_0xb6df1f['query']);_0x494ecc['filters']=_[_0xbae7('0x3e')](_0x494ecc[_0xbae7('0x3a')],_0x494ecc[_0xbae7('0x3b')]);_0x30b469['attributes']=_[_0xbae7('0x3e')](_0x494ecc[_0xbae7('0x3a')],qs[_0xbae7('0x3f')](_0xb6df1f[_0xbae7('0x3b')][_0xbae7('0x3f')]));_0x30b469['attributes']=_0x30b469[_0xbae7('0x40')]['length']?_0x30b469[_0xbae7('0x40')]:_0x494ecc[_0xbae7('0x3a')];if(_0xb6df1f[_0xbae7('0x3b')][_0xbae7('0x4c')]){_0x30b469[_0xbae7('0x4d')]=[{'all':!![]}];}_0x30b469=_[_0xbae7('0x48')]({},_0x30b469,_0xb6df1f['options']);return db[_0xbae7('0x37')][_0xbae7('0x51')](_0x30b469)['then'](handleEntityNotFound(_0x363b7b,null))['then'](respondWithResult(_0x363b7b,null))['catch'](handleError(_0x363b7b,null));};exports['create']=function(_0x35efe1,_0x257cf4,_0x77e014){var _0x38952c;return db[_0xbae7('0x37')][_0xbae7('0x52')](_0x35efe1['body'],{'raw':!![]})[_0xbae7('0x2d')](function(_0x424d3a){_0x38952c=_0x424d3a;return db[_0xbae7('0x37')][_0xbae7('0x4e')]({'raw':!![]});})['then'](function(_0x3b71f5){var _0x168474=fs['readFileSync'](path[_0xbae7('0x53')](config[_0xbae7('0x54')],'server/files/templates/context.ejs'),'utf8');var _0x4686c9=ejs[_0xbae7('0x55')](_0x168474,{'contexts':_0x3b71f5||[]});fs[_0xbae7('0x56')](_0xbae7('0x57'),_0x4686c9);})[_0xbae7('0x2d')](function(){return respondWithRpcPromise(_0xbae7('0x58'),_0xbae7('0x52'),{'module':_0xbae7('0x59')});})[_0xbae7('0x2d')](function(){var _0x16d1e5=_0x35efe1['user'][_0xbae7('0x2f')]({'plain':!![]});if(!_0x16d1e5)throw new Error(_0xbae7('0x5a'));if(_0x16d1e5[_0xbae7('0x5b')]===_0xbae7('0x5c')){var _0x2897aa=_0x38952c[_0xbae7('0x2f')]({'plain':!![]});return db['UserProfileSection'][_0xbae7('0x51')]({'where':{'name':_0xbae7('0x5d'),'userProfileId':_0x16d1e5[_0xbae7('0x5e')]},'raw':!![]})[_0xbae7('0x2d')](function(_0x4c3c57){if(_0x4c3c57&&_0x4c3c57[_0xbae7('0x5f')]===0x0){return db['UserProfileResource'][_0xbae7('0x52')]({'name':_0x2897aa[_0xbae7('0x33')],'resourceId':_0x2897aa['id'],'type':_0x4c3c57[_0xbae7('0x33')],'sectionId':_0x4c3c57['id']},{})[_0xbae7('0x2d')](function(){return _0x38952c;});}else{return _0x38952c;}})[_0xbae7('0x21')](function(_0x5ea811){logger[_0xbae7('0x1d')](_0xbae7('0x60'),_0x5ea811);throw _0x5ea811;});}return _0x38952c;})[_0xbae7('0x2d')](respondWithResult(_0x257cf4,0xc9))['catch'](handleError(_0x257cf4,null));};exports['update']=function(_0x5e6159,_0x5c2fc5,_0x195460){var _0x542dd4;return db[_0xbae7('0x37')][_0xbae7('0x51')]({'where':{'id':_0x5e6159[_0xbae7('0x61')]['id']}})[_0xbae7('0x2d')](handleEntityNotFound(_0x5c2fc5,null))['then'](saveUpdates(_0x5e6159[_0xbae7('0x62')],null))[_0xbae7('0x2d')](function(_0x2ece04){if(_0x2ece04){_0x542dd4=_0x2ece04;return db[_0xbae7('0x37')][_0xbae7('0x4e')]({'raw':!![]});}})[_0xbae7('0x2d')](function(_0x492e10){var _0x41b198=fs[_0xbae7('0x63')](path[_0xbae7('0x53')](config[_0xbae7('0x54')],'server/files/templates/context.ejs'),'utf8');var _0x56fdb3=ejs[_0xbae7('0x55')](_0x41b198,{'contexts':_0x492e10||[]});fs[_0xbae7('0x56')](_0xbae7('0x57'),_0x56fdb3);})[_0xbae7('0x2d')](function(){return respondWithRpcPromise(_0xbae7('0x58'),'update',{'module':_0xbae7('0x59')});})[_0xbae7('0x2d')](function(){return _0x542dd4;})['then'](respondWithResult(_0x5c2fc5,null))[_0xbae7('0x21')](handleError(_0x5c2fc5,null));};exports[_0xbae7('0x2e')]=function(_0x1ac563,_0x2ee732,_0x4bac9b){var _0x5dac31;return db['VoiceContext'][_0xbae7('0x51')]({'where':{'id':_0x1ac563[_0xbae7('0x61')]['id']}})[_0xbae7('0x2d')](handleEntityNotFound(_0x2ee732,null))[_0xbae7('0x2d')](removeEntity(_0x2ee732,null))[_0xbae7('0x2d')](function(){return db['VoiceContext'][_0xbae7('0x4e')]({'raw':!![]});})[_0xbae7('0x2d')](function(_0x288e01){var _0x3e7a7b=fs[_0xbae7('0x63')](path[_0xbae7('0x53')](config['root'],_0xbae7('0x64')),_0xbae7('0x65'));var _0x5c8684=ejs['render'](_0x3e7a7b,{'contexts':_0x288e01});fs[_0xbae7('0x56')](_0xbae7('0x57'),_0x5c8684);return respondWithRpcPromise(_0xbae7('0x58'),_0xbae7('0x2e'),{'module':'chan_sip.so'});})['catch'](handleError(_0x2ee732,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 27477e5..73edb62 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 _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 +var _0xc138=['define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes','exports'];(function(_0xc26950,_0x2d7860){var _0x1f2293=function(_0x5948e0){while(--_0x5948e0){_0xc26950['push'](_0xc26950['shift']());}};_0x1f2293(++_0x2d7860);}(_0xc138,0x153));var _0x8c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc138[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8c13('0x0'));var util=require(_0x8c13('0x1'));var logger=require(_0x8c13('0x2'))(_0x8c13('0x3'));var moment=require(_0x8c13('0x4'));var BPromise=require(_0x8c13('0x5'));var rp=require(_0x8c13('0x6'));var fs=require('fs');var path=require(_0x8c13('0x7'));var rimraf=require(_0x8c13('0x8'));var config=require('../../config/environment');var attributes=require(_0x8c13('0x9'));module[_0x8c13('0xa')]=function(_0x22ef79,_0x32d8ed){return _0x22ef79[_0x8c13('0xb')](_0x8c13('0xc'),attributes,{'tableName':_0x8c13('0xd'),'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 5b9637d..8de5ac2 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 _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 +var _0x51dc=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51dc,0xbc));var _0xc51d=function(_0x2c167d,_0x82f72b){_0x2c167d=_0x2c167d-0x0;var _0x522c83=_0x51dc[_0x2c167d];return _0x522c83;};'use strict';var _=require('lodash');var util=require(_0xc51d('0x0'));var moment=require(_0xc51d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc51d('0x2'));var db=require(_0xc51d('0x3'))['db'];var utils=require(_0xc51d('0x4'));var logger=require(_0xc51d('0x5'))(_0xc51d('0x6'));var config=require(_0xc51d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc51d('0x8')][_0xc51d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd46c89,_0x1e4a61,_0x17023a){return new BPromise(function(_0x3f315a,_0x107b0e){return client[_0xc51d('0xa')](_0xd46c89,_0x17023a)[_0xc51d('0xb')](function(_0x454f07){logger[_0xc51d('0xc')](_0xc51d('0xd'),_0x1e4a61,'request\x20sent');logger['debug'](_0xc51d('0xe'),_0x1e4a61,_0xc51d('0xf'),JSON[_0xc51d('0x10')](_0x454f07));if(_0x454f07[_0xc51d('0x11')]){if(_0x454f07[_0xc51d('0x11')]['code']===0x1f4){logger[_0xc51d('0x11')](_0xc51d('0xd'),_0x1e4a61,_0x454f07[_0xc51d('0x11')][_0xc51d('0x12')]);return _0x107b0e(_0x454f07[_0xc51d('0x11')][_0xc51d('0x12')]);}logger[_0xc51d('0x11')]('VoiceContext,\x20%s,\x20%s',_0x1e4a61,_0x454f07['error'][_0xc51d('0x12')]);return _0x3f315a(_0x454f07[_0xc51d('0x11')][_0xc51d('0x12')]);}else{logger[_0xc51d('0xc')](_0xc51d('0xd'),_0x1e4a61,'request\x20sent');_0x3f315a(_0x454f07[_0xc51d('0x13')]['message']);}})[_0xc51d('0x14')](function(_0x13b05c){logger[_0xc51d('0x11')]('VoiceContext,\x20%s,\x20%s',_0x1e4a61,_0x13b05c);_0x107b0e(_0x13b05c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 656127f..a150791 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 _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 +var _0x5e57=['describe','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','/describe'];(function(_0x53f8c3,_0x12608a){var _0x514b2a=function(_0x2f4696){while(--_0x2f4696){_0x53f8c3['push'](_0x53f8c3['shift']());}};_0x514b2a(++_0x12608a);}(_0x5e57,0xc7));var _0x75e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e57[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x75e5('0x0'));var util=require(_0x75e5('0x1'));var path=require(_0x75e5('0x2'));var timeout=require(_0x75e5('0x3'));var express=require(_0x75e5('0x4'));var router=express['Router']();var auth=require(_0x75e5('0x5'));var interaction=require(_0x75e5('0x6'));var config=require(_0x75e5('0x7'));var controller=require(_0x75e5('0x8'));router[_0x75e5('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x75e5('0x9')](_0x75e5('0xa'),auth['isAuthenticated'](),controller[_0x75e5('0xb')]);router[_0x75e5('0x9')](_0x75e5('0xc'),auth[_0x75e5('0xd')](),controller[_0x75e5('0xe')]);router[_0x75e5('0xf')]('/',auth['isAuthenticated'](),controller[_0x75e5('0x10')]);router[_0x75e5('0x11')](_0x75e5('0xc'),auth[_0x75e5('0xd')](),controller['update']);router[_0x75e5('0x12')](_0x75e5('0xc'),auth[_0x75e5('0xd')](),controller[_0x75e5('0x13')]);module[_0x75e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0c9e8fa..ae7ea04 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 _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 +var _0x60fc=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x59693c,_0x221483){var _0x5f322d=function(_0x7ef4ac){while(--_0x7ef4ac){_0x59693c['push'](_0x59693c['shift']());}};_0x5f322d(++_0x221483);}(_0x60fc,0x9d));var _0xc60f=function(_0x12a623,_0x11ac78){_0x12a623=_0x12a623-0x0;var _0x4c989a=_0x60fc[_0x12a623];return _0x4c989a;};'use strict';var Sequelize=require(_0xc60f('0x0'));module[_0xc60f('0x1')]={'privilege':{'type':Sequelize[_0xc60f('0x2')]},'channel':{'type':Sequelize[_0xc60f('0x2')]},'channelstate':{'type':Sequelize[_0xc60f('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc60f('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc60f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc60f('0x2')]},'connectedlinename':{'type':Sequelize[_0xc60f('0x2')]},'language':{'type':Sequelize[_0xc60f('0x2')]},'accountcode':{'type':Sequelize[_0xc60f('0x2')]},'context':{'type':Sequelize[_0xc60f('0x2')]},'exten':{'type':Sequelize[_0xc60f('0x2')]},'priority':{'type':Sequelize[_0xc60f('0x3')]},'uniqueid':{'type':Sequelize[_0xc60f('0x2')]},'linkedid':{'type':Sequelize[_0xc60f('0x2')]},'destchannel':{'type':Sequelize[_0xc60f('0x2')]},'destchannelstate':{'type':Sequelize[_0xc60f('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc60f('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc60f('0x2')]},'destcalleridname':{'type':Sequelize[_0xc60f('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc60f('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc60f('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc60f('0x2')]},'destexten':{'type':Sequelize[_0xc60f('0x2')]},'destpriority':{'type':Sequelize[_0xc60f('0x3')]},'destuniqueid':{'type':Sequelize[_0xc60f('0x2')]},'destlinkedid':{'type':Sequelize[_0xc60f('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xc60f('0x2')]},'starttime':{'type':Sequelize[_0xc60f('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc60f('0x4')]},'lastevent':{'type':Sequelize[_0xc60f('0x2')],'comment':_0xc60f('0x5')},'routeId':{'type':Sequelize[_0xc60f('0x3')]},'duration':{'type':Sequelize[_0xc60f('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xc60f('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 0ab822b..58793af 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 _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 +var _0xb49d=['limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','squel','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xb49d,0x19b));var _0xdb49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb49d[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xdb49('0x0'));var emlformat=require(_0xdb49('0x1'));var rimraf=require(_0xdb49('0x2'));var zipdir=require(_0xdb49('0x3'));var jsonpatch=require(_0xdb49('0x4'));var rp=require(_0xdb49('0x5'));var moment=require('moment');var BPromise=require(_0xdb49('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdb49('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdb49('0x8'));var crypto=require('crypto');var jsforce=require(_0xdb49('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xdb49('0xa'));var querystring=require('querystring');var Papa=require(_0xdb49('0xb'));var Redis=require('ioredis');var authService=require(_0xdb49('0xc'));var qs=require(_0xdb49('0xd'));var as=require(_0xdb49('0xe'));var hardwareService=require(_0xdb49('0xf'));var logger=require(_0xdb49('0x10'))(_0xdb49('0x11'));var utils=require(_0xdb49('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xdb49('0x13'));var db=require(_0xdb49('0x14'))['db'];function respondWithStatusCode(_0x5b94ae,_0xb53d5d){_0xb53d5d=_0xb53d5d||0xcc;return function(_0x5ab10a){if(_0x5ab10a){return _0x5b94ae[_0xdb49('0x15')](_0xb53d5d);}return _0x5b94ae['status'](_0xb53d5d)[_0xdb49('0x16')]();};}function respondWithResult(_0x3c51d1,_0xe1162b){_0xe1162b=_0xe1162b||0xc8;return function(_0x179dd7){if(_0x179dd7){return _0x3c51d1[_0xdb49('0x17')](_0xe1162b)[_0xdb49('0x18')](_0x179dd7);}};}function respondWithFilteredResult(_0x1d1bdf,_0x3472f9){return function(_0x6953b4){if(_0x6953b4){var _0x59abcf=_0x6953b4[_0xdb49('0x19')],_0x5ac78d=_0x3472f9[_0xdb49('0x1a')],_0x231c39=_0x3472f9[_0xdb49('0x1a')]+_0x3472f9[_0xdb49('0x1b')],_0x207f77;if(_0x231c39>=_0x59abcf){_0x231c39=_0x59abcf;_0x207f77=0xc8;}else{_0x207f77=0xce;}_0x1d1bdf['status'](_0x207f77);return _0x1d1bdf[_0xdb49('0x1c')](_0xdb49('0x1d'),_0x5ac78d+'-'+_0x231c39+'/'+_0x59abcf)[_0xdb49('0x18')](_0x6953b4);}return null;};}function patchUpdates(_0xa9ee6a){return function(_0x4310d3){try{jsonpatch[_0xdb49('0x1e')](_0x4310d3,_0xa9ee6a,!![]);}catch(_0x17a91b){return BPromise[_0xdb49('0x1f')](_0x17a91b);}return _0x4310d3[_0xdb49('0x20')]();};}function saveUpdates(_0x27dc29,_0x4a1e62){return function(_0x628a99){if(_0x628a99){return _0x628a99[_0xdb49('0x21')](_0x27dc29)['then'](function(_0x412ab2){return _0x412ab2;});}return null;};}function removeEntity(_0xdfa809,_0x54a238){return function(_0x3f8167){if(_0x3f8167){return _0x3f8167[_0xdb49('0x22')]()[_0xdb49('0x23')](function(){_0xdfa809[_0xdb49('0x17')](0xcc)[_0xdb49('0x16')]();});}};}function handleEntityNotFound(_0x3e1242,_0x3d0f1a){return function(_0x1ec4c5){if(!_0x1ec4c5){_0x3e1242[_0xdb49('0x15')](0x194);}return _0x1ec4c5;};}function handleError(_0x2d21c1,_0x1512b2){_0x1512b2=_0x1512b2||0x1f4;return function(_0x47ca25){logger['error'](_0x47ca25[_0xdb49('0x24')]);if(_0x47ca25[_0xdb49('0x25')]){delete _0x47ca25['name'];}_0x2d21c1[_0xdb49('0x17')](_0x1512b2)[_0xdb49('0x26')](_0x47ca25);};}exports[_0xdb49('0x27')]=function(_0x49534f,_0x3dc787){var _0x38ca54={},_0x278781={},_0x1a909b={'count':0x0,'rows':[]};var _0x15c7c8=_[_0xdb49('0x28')](db[_0xdb49('0x29')][_0xdb49('0x2a')],function(_0x1f566d){return{'name':_0x1f566d[_0xdb49('0x2b')],'type':_0x1f566d[_0xdb49('0x2c')][_0xdb49('0x2d')]};});_0x278781[_0xdb49('0x2e')]=_[_0xdb49('0x28')](_0x15c7c8,_0xdb49('0x25'));_0x278781[_0xdb49('0x2f')]=_[_0xdb49('0x30')](_0x49534f['query']);_0x278781[_0xdb49('0x31')]=_[_0xdb49('0x32')](_0x278781[_0xdb49('0x2e')],_0x278781[_0xdb49('0x2f')]);_0x38ca54[_0xdb49('0x33')]=_[_0xdb49('0x32')](_0x278781[_0xdb49('0x2e')],qs['fields'](_0x49534f[_0xdb49('0x2f')][_0xdb49('0x34')]));_0x38ca54[_0xdb49('0x33')]=_0x38ca54['attributes'][_0xdb49('0x35')]?_0x38ca54['attributes']:_0x278781[_0xdb49('0x2e')];if(!_0x49534f[_0xdb49('0x2f')][_0xdb49('0x36')](_0xdb49('0x37'))){_0x38ca54[_0xdb49('0x1b')]=qs[_0xdb49('0x1b')](_0x49534f[_0xdb49('0x2f')][_0xdb49('0x1b')]);_0x38ca54['offset']=qs['offset'](_0x49534f['query'][_0xdb49('0x1a')]);}_0x38ca54[_0xdb49('0x38')]=qs[_0xdb49('0x39')](_0x49534f[_0xdb49('0x2f')][_0xdb49('0x39')]);_0x38ca54[_0xdb49('0x3a')]=qs['filters'](_[_0xdb49('0x3b')](_0x49534f[_0xdb49('0x2f')],_0x278781[_0xdb49('0x31')]),_0x15c7c8);if(_0x49534f[_0xdb49('0x2f')][_0xdb49('0x3c')]){_0x38ca54[_0xdb49('0x3a')]=_[_0xdb49('0x3d')](_0x38ca54[_0xdb49('0x3a')],{'$or':_[_0xdb49('0x28')](_0x15c7c8,function(_0x59aa18){if(_0x59aa18[_0xdb49('0x2c')]!==_0xdb49('0x3e')){var _0xa53ba={};_0xa53ba[_0x59aa18['name']]={'$like':'%'+_0x49534f['query'][_0xdb49('0x3c')]+'%'};return _0xa53ba;}})});}_0x38ca54=_[_0xdb49('0x3d')]({},_0x38ca54,_0x49534f[_0xdb49('0x3f')]);var _0x45fe55={'where':_0x38ca54[_0xdb49('0x3a')]};return db['VoiceDialReport'][_0xdb49('0x19')](_0x45fe55)['then'](function(_0x4219c8){_0x1a909b[_0xdb49('0x19')]=_0x4219c8;if(_0x49534f[_0xdb49('0x2f')]['includeAll']){_0x38ca54[_0xdb49('0x40')]=[{'all':!![]}];}return db[_0xdb49('0x29')]['findAll'](_0x38ca54);})[_0xdb49('0x23')](function(_0x684b8b){_0x1a909b['rows']=_0x684b8b;return _0x1a909b;})[_0xdb49('0x23')](respondWithFilteredResult(_0x3dc787,_0x38ca54))[_0xdb49('0x41')](handleError(_0x3dc787,null));};exports[_0xdb49('0x42')]=function(_0x2f192f,_0x3d19e4){var _0x3a1ddf={'raw':!![],'where':{'id':_0x2f192f[_0xdb49('0x43')]['id']}},_0x40d537={};_0x40d537[_0xdb49('0x2e')]=_[_0xdb49('0x30')](db[_0xdb49('0x29')][_0xdb49('0x2a')]);_0x40d537[_0xdb49('0x2f')]=_['keys'](_0x2f192f['query']);_0x40d537['filters']=_[_0xdb49('0x32')](_0x40d537[_0xdb49('0x2e')],_0x40d537[_0xdb49('0x2f')]);_0x3a1ddf[_0xdb49('0x33')]=_[_0xdb49('0x32')](_0x40d537[_0xdb49('0x2e')],qs[_0xdb49('0x34')](_0x2f192f[_0xdb49('0x2f')]['fields']));_0x3a1ddf[_0xdb49('0x33')]=_0x3a1ddf[_0xdb49('0x33')][_0xdb49('0x35')]?_0x3a1ddf[_0xdb49('0x33')]:_0x40d537[_0xdb49('0x2e')];if(_0x2f192f[_0xdb49('0x2f')][_0xdb49('0x44')]){_0x3a1ddf[_0xdb49('0x40')]=[{'all':!![]}];}_0x3a1ddf=_[_0xdb49('0x3d')]({},_0x3a1ddf,_0x2f192f['options']);return db[_0xdb49('0x29')]['find'](_0x3a1ddf)['then'](handleEntityNotFound(_0x3d19e4,null))['then'](respondWithResult(_0x3d19e4,null))[_0xdb49('0x41')](handleError(_0x3d19e4,null));};exports[_0xdb49('0x45')]=function(_0x927773,_0x53109c){return db['VoiceDialReport']['create'](_0x927773['body'],{})[_0xdb49('0x23')](respondWithResult(_0x53109c,0xc9))[_0xdb49('0x41')](handleError(_0x53109c,null));};exports[_0xdb49('0x21')]=function(_0x428a12,_0x41c5ad){if(_0x428a12[_0xdb49('0x46')]['id']){delete _0x428a12[_0xdb49('0x46')]['id'];}return db[_0xdb49('0x29')]['find']({'where':{'id':_0x428a12['params']['id']}})[_0xdb49('0x23')](handleEntityNotFound(_0x41c5ad,null))[_0xdb49('0x23')](saveUpdates(_0x428a12[_0xdb49('0x46')],null))[_0xdb49('0x23')](respondWithResult(_0x41c5ad,null))[_0xdb49('0x41')](handleError(_0x41c5ad,null));};exports['destroy']=function(_0x4132c0,_0x51e9c3){return db[_0xdb49('0x29')][_0xdb49('0x47')]({'where':{'id':_0x4132c0[_0xdb49('0x43')]['id']}})['then'](handleEntityNotFound(_0x51e9c3,null))[_0xdb49('0x23')](removeEntity(_0x51e9c3,null))['catch'](handleError(_0x51e9c3,null));};exports['describe']=function(_0x2627a7,_0x1d150e){return db[_0xdb49('0x29')][_0xdb49('0x48')]()[_0xdb49('0x23')](respondWithResult(_0x1d150e,null))[_0xdb49('0x41')](handleError(_0x1d150e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index c2fc6df..dab4e9d 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 _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 +var _0x7020=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1de43c,_0xaa29de){var _0x296d3e=function(_0x50b76f){while(--_0x50b76f){_0x1de43c['push'](_0x1de43c['shift']());}};_0x296d3e(++_0xaa29de);}(_0x7020,0x14f));var _0x0702=function(_0x4e99c2,_0x1003b5){_0x4e99c2=_0x4e99c2-0x0;var _0x1cf56f=_0x7020[_0x4e99c2];return _0x1cf56f;};'use strict';var _=require(_0x0702('0x0'));var util=require(_0x0702('0x1'));var logger=require(_0x0702('0x2'))('api');var moment=require(_0x0702('0x3'));var BPromise=require('bluebird');var rp=require(_0x0702('0x4'));var fs=require('fs');var path=require(_0x0702('0x5'));var rimraf=require(_0x0702('0x6'));var config=require(_0x0702('0x7'));var attributes=require(_0x0702('0x8'));module[_0x0702('0x9')]=function(_0x482cc8,_0x28ddcf){return _0x482cc8['define']('VoiceDialReport',attributes,{'tableName':_0x0702('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 7b4ac69..8004dd6 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 _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 +var _0x89f1=['attributes','limit','UpdateVoiceDialReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','catch','update','body','where'];(function(_0x5b2a9b,_0x228aa6){var _0x386eea=function(_0x608216){while(--_0x608216){_0x5b2a9b['push'](_0x5b2a9b['shift']());}};_0x386eea(++_0x228aa6);}(_0x89f1,0x83));var _0x189f=function(_0x34ebf3,_0x5935c5){_0x34ebf3=_0x34ebf3-0x0;var _0x3a634d=_0x89f1[_0x34ebf3];return _0x3a634d;};'use strict';var _=require(_0x189f('0x0'));var util=require(_0x189f('0x1'));var moment=require(_0x189f('0x2'));var BPromise=require(_0x189f('0x3'));var rs=require(_0x189f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x189f('0x5'))['db'];var utils=require(_0x189f('0x6'));var logger=require(_0x189f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x189f('0x8'));var client=jayson['client'][_0x189f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30e00a,_0x31299e,_0x83f989){return new BPromise(function(_0x5e986d,_0x2d648d){return client['request'](_0x30e00a,_0x83f989)[_0x189f('0xa')](function(_0x14ab68){logger[_0x189f('0xb')](_0x189f('0xc'),_0x31299e,'request\x20sent');logger[_0x189f('0xd')](_0x189f('0xe'),_0x31299e,_0x189f('0xf'),JSON['stringify'](_0x14ab68));if(_0x14ab68[_0x189f('0x10')]){if(_0x14ab68[_0x189f('0x10')][_0x189f('0x11')]===0x1f4){logger[_0x189f('0x10')](_0x189f('0xc'),_0x31299e,_0x14ab68['error'][_0x189f('0x12')]);return _0x2d648d(_0x14ab68[_0x189f('0x10')][_0x189f('0x12')]);}logger[_0x189f('0x10')](_0x189f('0xc'),_0x31299e,_0x14ab68[_0x189f('0x10')]['message']);return _0x5e986d(_0x14ab68[_0x189f('0x10')]['message']);}else{logger[_0x189f('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x31299e,_0x189f('0xf'));_0x5e986d(_0x14ab68['result'][_0x189f('0x12')]);}})['catch'](function(_0x339f25){logger[_0x189f('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x31299e,_0x339f25);_0x2d648d(_0x339f25);});});}exports[_0x189f('0x13')]=function(_0x4d4ce2){var _0x4f4455=this;return new Promise(function(_0x5d9aaf,_0x25f4e5){return db[_0x189f('0x14')][_0x189f('0x15')](_0x4d4ce2['body'],{'raw':_0x4d4ce2[_0x189f('0x16')]?_0x4d4ce2[_0x189f('0x16')][_0x189f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x1467d6){logger['info'](_0x189f('0x13'),_0x4d4ce2);logger[_0x189f('0xd')]('CreateVoiceDialReport',_0x4d4ce2,JSON[_0x189f('0x18')](_0x1467d6));_0x5d9aaf(_0x1467d6);})[_0x189f('0x19')](function(_0x367b0d){logger[_0x189f('0x10')](_0x189f('0x13'),_0x367b0d[_0x189f('0x12')],_0x4d4ce2);_0x25f4e5(_0x4f4455['error'](0x1f4,_0x367b0d[_0x189f('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x2e9477){var _0x288039=this;return new Promise(function(_0x499697,_0x48806b){return db['VoiceDialReport'][_0x189f('0x1a')](_0x2e9477[_0x189f('0x1b')],{'raw':_0x2e9477[_0x189f('0x16')]?_0x2e9477[_0x189f('0x16')][_0x189f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9477['options']?_0x2e9477[_0x189f('0x16')][_0x189f('0x1c')]||null:null,'attributes':_0x2e9477['options']?_0x2e9477[_0x189f('0x16')][_0x189f('0x1d')]||null:null,'limit':_0x2e9477[_0x189f('0x16')]?_0x2e9477[_0x189f('0x16')][_0x189f('0x1e')]||null:null})[_0x189f('0xa')](function(_0x213322){logger['info'](_0x189f('0x1f'),_0x2e9477);logger[_0x189f('0xd')](_0x189f('0x1f'),_0x2e9477,JSON[_0x189f('0x18')](_0x213322));_0x499697(_0x213322);})[_0x189f('0x19')](function(_0x56c9e7){logger[_0x189f('0x10')](_0x189f('0x1f'),_0x56c9e7[_0x189f('0x12')],_0x2e9477);_0x48806b(_0x288039[_0x189f('0x10')](0x1f4,_0x56c9e7[_0x189f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a02acea..910413a 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 _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 +var _0xe295=['update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','isAuthenticated','get','/:id','show','post','create','/:id/applications','addApplications','put'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe295,0x143));var _0x5e29=function(_0x47a491,_0x45e171){_0x47a491=_0x47a491-0x0;var _0x3b176b=_0xe295[_0x47a491];return _0x3b176b;};'use strict';var multer=require('multer');var util=require(_0x5e29('0x0'));var path=require(_0x5e29('0x1'));var timeout=require(_0x5e29('0x2'));var express=require(_0x5e29('0x3'));var router=express[_0x5e29('0x4')]();var auth=require(_0x5e29('0x5'));var interaction=require(_0x5e29('0x6'));var config=require('../../config/environment');var controller=require(_0x5e29('0x7'));router['get']('/',auth[_0x5e29('0x8')](),controller['index']);router[_0x5e29('0x9')](_0x5e29('0xa'),auth[_0x5e29('0x8')](),controller[_0x5e29('0xb')]);router[_0x5e29('0xc')]('/',auth[_0x5e29('0x8')](),controller[_0x5e29('0xd')]);router[_0x5e29('0xc')](_0x5e29('0xe'),auth[_0x5e29('0x8')](),controller[_0x5e29('0xf')]);router[_0x5e29('0x10')](_0x5e29('0xa'),auth[_0x5e29('0x8')](),controller[_0x5e29('0x11')]);router['delete']('/:id',auth[_0x5e29('0x8')](),controller[_0x5e29('0x12')]);module[_0x5e29('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 65eeb97..e922b58 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(_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 +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x2473cb,_0x3149dd){var _0x53c48f=function(_0x13d8c3){while(--_0x13d8c3){_0x2473cb['push'](_0x2473cb['shift']());}};_0x53c48f(++_0x3149dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 b28986c..0bfafbe 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 _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 +var _0x8aae=['sendStatus','stack','index','VoiceExtension','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','destroy','create','body','startsWith','exten','concat','user','role','internal','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','context','description','cutdigits','addApplications','findOne','sequelize','VoiceExtensionId','findAndCountAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','json','count','offset','limit','status','set','Content-Range','save','update','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','find','type','name','UserProfileResource'];(function(_0x1af02c,_0x23d017){var _0x38137c=function(_0x9a710c){while(--_0x9a710c){_0x1af02c['push'](_0x1af02c['shift']());}};_0x38137c(++_0x23d017);}(_0x8aae,0x162));var _0xe8aa=function(_0x10810b,_0x263788){_0x10810b=_0x10810b-0x0;var _0x22adb5=_0x8aae[_0x10810b];return _0x22adb5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe8aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8aa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8aa('0x2'));var moment=require(_0xe8aa('0x3'));var BPromise=require(_0xe8aa('0x4'));var Mustache=require(_0xe8aa('0x5'));var util=require(_0xe8aa('0x6'));var path=require('path');var sox=require(_0xe8aa('0x7'));var csv=require(_0xe8aa('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe8aa('0x9'));var crypto=require('crypto');var jsforce=require(_0xe8aa('0xa'));var deskjs=require(_0xe8aa('0xb'));var toCsv=require(_0xe8aa('0x8'));var querystring=require(_0xe8aa('0xc'));var Papa=require(_0xe8aa('0xd'));var Redis=require(_0xe8aa('0xe'));var authService=require(_0xe8aa('0xf'));var qs=require(_0xe8aa('0x10'));var as=require(_0xe8aa('0x11'));var hardwareService=require(_0xe8aa('0x12'));var logger=require('../../config/logger')(_0xe8aa('0x13'));var utils=require(_0xe8aa('0x14'));var config=require(_0xe8aa('0x15'));var licenseUtil=require(_0xe8aa('0x16'));var db=require(_0xe8aa('0x17'))['db'];config[_0xe8aa('0x18')]=_['defaults'](config['redis'],{'host':_0xe8aa('0x19'),'port':0x18eb});var socket=require(_0xe8aa('0x1a'))(new Redis(config[_0xe8aa('0x18')]));require('./voiceExtension.socket')[_0xe8aa('0x1b')](socket);function respondWithStatusCode(_0x3ddeaf,_0x340c33){_0x340c33=_0x340c33||0xcc;return function(_0x42e0e8){if(_0x42e0e8){return _0x3ddeaf['sendStatus'](_0x340c33);}return _0x3ddeaf['status'](_0x340c33)[_0xe8aa('0x1c')]();};}function respondWithResult(_0x36ae31,_0x19ee2a){_0x19ee2a=_0x19ee2a||0xc8;return function(_0x54ee73){if(_0x54ee73){return _0x36ae31['status'](_0x19ee2a)[_0xe8aa('0x1d')](_0x54ee73);}};}function respondWithFilteredResult(_0x3c34a2,_0x1771d0){return function(_0x5eda8b){if(_0x5eda8b){var _0x5e4503=_0x5eda8b[_0xe8aa('0x1e')],_0x59202b=_0x1771d0[_0xe8aa('0x1f')],_0x4bca42=_0x1771d0['offset']+_0x1771d0[_0xe8aa('0x20')],_0x1209af;if(_0x4bca42>=_0x5e4503){_0x4bca42=_0x5e4503;_0x1209af=0xc8;}else{_0x1209af=0xce;}_0x3c34a2[_0xe8aa('0x21')](_0x1209af);return _0x3c34a2[_0xe8aa('0x22')](_0xe8aa('0x23'),_0x59202b+'-'+_0x4bca42+'/'+_0x5e4503)[_0xe8aa('0x1d')](_0x5eda8b);}return null;};}function patchUpdates(_0x493210){return function(_0x5bc80c){try{jsonpatch['apply'](_0x5bc80c,_0x493210,!![]);}catch(_0x52aa41){return BPromise['reject'](_0x52aa41);}return _0x5bc80c[_0xe8aa('0x24')]();};}function saveUpdates(_0x1f2d66,_0x57843e){return function(_0x440d34){if(_0x440d34){return _0x440d34[_0xe8aa('0x25')](_0x1f2d66)[_0xe8aa('0x26')](function(_0x5b540a){return _0x5b540a;});}return null;};}function removeEntity(_0x5e5b39,_0x200694){return function(_0x42bd5f){if(_0x42bd5f){return _0x42bd5f['destroy']()[_0xe8aa('0x26')](function(){var _0x352151=_0x42bd5f[_0xe8aa('0x27')]({'plain':!![]});var _0x4e0f3a=[{'name':_0xe8aa('0x28'),'value':_0xe8aa('0x29'),'ignore':![]},{'name':_0xe8aa('0x2a'),'value':_0xe8aa('0x2b'),'ignore':![]},{'name':_0xe8aa('0x2c'),'value':'internal','ignore':![]}];var _0x51a090=_(_0x4e0f3a)[_0xe8aa('0x2d')](_0xe8aa('0x2e'))[_0xe8aa('0x2f')](_0xe8aa('0x30'))['value']();if(_[_0xe8aa('0x31')](_0x51a090,_0x352151['type'])){return;}var _0x14d805=_[_0xe8aa('0x32')](_0x4e0f3a,[_0xe8aa('0x30'),_0x352151[_0xe8aa('0x33')]])[_0xe8aa('0x34')];return db[_0xe8aa('0x35')]['destroy']({'where':{'type':_0x14d805,'resourceId':_0x352151['id']}})[_0xe8aa('0x26')](function(){return _0x42bd5f;});})[_0xe8aa('0x26')](function(){_0x5e5b39[_0xe8aa('0x21')](0xcc)[_0xe8aa('0x1c')]();});}};}function handleEntityNotFound(_0x160592,_0x1bfc70){return function(_0x1be288){if(!_0x1be288){_0x160592[_0xe8aa('0x36')](0x194);}return _0x1be288;};}function handleError(_0x21ddca,_0x1bac3c){_0x1bac3c=_0x1bac3c||0x1f4;return function(_0x19120c){logger['error'](_0x19120c[_0xe8aa('0x37')]);if(_0x19120c[_0xe8aa('0x34')]){delete _0x19120c[_0xe8aa('0x34')];}_0x21ddca[_0xe8aa('0x21')](_0x1bac3c)['send'](_0x19120c);};}exports[_0xe8aa('0x38')]=function(_0x1e0c98,_0x4082cc){var _0xd2adc2={},_0x169f35={},_0x4b9d21={'count':0x0,'rows':[]};var _0x202dfc=_['map'](db[_0xe8aa('0x39')][_0xe8aa('0x3a')],function(_0x17fff1){return{'name':_0x17fff1[_0xe8aa('0x3b')],'type':_0x17fff1['type']['key']};});_0x169f35[_0xe8aa('0x3c')]=_[_0xe8aa('0x2f')](_0x202dfc,_0xe8aa('0x34'));_0x169f35[_0xe8aa('0x3d')]=_['keys'](_0x1e0c98[_0xe8aa('0x3d')]);_0x169f35['filters']=_[_0xe8aa('0x3e')](_0x169f35[_0xe8aa('0x3c')],_0x169f35[_0xe8aa('0x3d')]);_0xd2adc2[_0xe8aa('0x3f')]=_[_0xe8aa('0x3e')](_0x169f35['model'],qs[_0xe8aa('0x40')](_0x1e0c98[_0xe8aa('0x3d')]['fields']));_0xd2adc2[_0xe8aa('0x3f')]=_0xd2adc2[_0xe8aa('0x3f')][_0xe8aa('0x41')]?_0xd2adc2[_0xe8aa('0x3f')]:_0x169f35[_0xe8aa('0x3c')];if(!_0x1e0c98['query'][_0xe8aa('0x42')](_0xe8aa('0x43'))){_0xd2adc2['limit']=qs['limit'](_0x1e0c98[_0xe8aa('0x3d')]['limit']);_0xd2adc2[_0xe8aa('0x1f')]=qs[_0xe8aa('0x1f')](_0x1e0c98[_0xe8aa('0x3d')]['offset']);}_0xd2adc2['order']=qs[_0xe8aa('0x44')](_0x1e0c98[_0xe8aa('0x3d')][_0xe8aa('0x44')]);_0xd2adc2[_0xe8aa('0x45')]=qs[_0xe8aa('0x46')](_['pick'](_0x1e0c98[_0xe8aa('0x3d')],_0x169f35[_0xe8aa('0x46')]),_0x202dfc);if(_0x1e0c98[_0xe8aa('0x3d')][_0xe8aa('0x2d')]){_0xd2adc2[_0xe8aa('0x45')]=_[_0xe8aa('0x47')](_0xd2adc2['where'],{'$or':_[_0xe8aa('0x2f')](_0x202dfc,function(_0x33bfa5){if(_0x33bfa5['type']!==_0xe8aa('0x48')){var _0x1f5dda={};_0x1f5dda[_0x33bfa5[_0xe8aa('0x34')]]={'$like':'%'+_0x1e0c98[_0xe8aa('0x3d')][_0xe8aa('0x2d')]+'%'};return _0x1f5dda;}})});}_0xd2adc2=_[_0xe8aa('0x47')]({},_0xd2adc2,_0x1e0c98[_0xe8aa('0x49')]);var _0x5a91a8={'where':_0xd2adc2[_0xe8aa('0x45')]};return db[_0xe8aa('0x39')][_0xe8aa('0x1e')](_0x5a91a8)['then'](function(_0x31e27c){_0x4b9d21[_0xe8aa('0x1e')]=_0x31e27c;if(_0x1e0c98[_0xe8aa('0x3d')][_0xe8aa('0x4a')]){_0xd2adc2[_0xe8aa('0x4b')]=[{'all':!![]}];}return db[_0xe8aa('0x39')]['findAll'](_0xd2adc2);})[_0xe8aa('0x26')](function(_0xe53d49){_0x4b9d21[_0xe8aa('0x4c')]=_0xe53d49;return _0x4b9d21;})[_0xe8aa('0x26')](respondWithFilteredResult(_0x4082cc,_0xd2adc2))[_0xe8aa('0x4d')](handleError(_0x4082cc,null));};exports['show']=function(_0x5aeb53,_0x3bbae3){var _0x3e3513={'raw':![],'where':{'id':_0x5aeb53[_0xe8aa('0x4e')]['id']}},_0x44c51b={};_0x44c51b['model']=_[_0xe8aa('0x4f')](db[_0xe8aa('0x39')][_0xe8aa('0x3a')]);_0x44c51b[_0xe8aa('0x3d')]=_[_0xe8aa('0x4f')](_0x5aeb53[_0xe8aa('0x3d')]);_0x44c51b[_0xe8aa('0x46')]=_[_0xe8aa('0x3e')](_0x44c51b[_0xe8aa('0x3c')],_0x44c51b[_0xe8aa('0x3d')]);_0x3e3513[_0xe8aa('0x3f')]=_[_0xe8aa('0x3e')](_0x44c51b[_0xe8aa('0x3c')],qs['fields'](_0x5aeb53[_0xe8aa('0x3d')][_0xe8aa('0x40')]));_0x3e3513[_0xe8aa('0x3f')]=_0x3e3513[_0xe8aa('0x3f')][_0xe8aa('0x41')]?_0x3e3513['attributes']:_0x44c51b['model'];if(_0x5aeb53[_0xe8aa('0x3d')][_0xe8aa('0x4a')]){_0x3e3513[_0xe8aa('0x4b')]=[{'all':!![]}];}_0x3e3513=_[_0xe8aa('0x47')]({},_0x3e3513,_0x5aeb53[_0xe8aa('0x49')]);return db[_0xe8aa('0x39')]['find'](_0x3e3513)[_0xe8aa('0x26')](handleEntityNotFound(_0x3bbae3,null))[_0xe8aa('0x26')](respondWithResult(_0x3bbae3,null))[_0xe8aa('0x4d')](handleError(_0x3bbae3,null));};exports[_0xe8aa('0x50')]=function(_0xce5f34,_0x2dc85a){return db[_0xe8aa('0x39')]['find']({'where':{'id':_0xce5f34[_0xe8aa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2dc85a,null))[_0xe8aa('0x26')](removeEntity(_0x2dc85a,null))[_0xe8aa('0x4d')](handleError(_0x2dc85a,null));};exports[_0xe8aa('0x51')]=function(_0x5e57e8,_0x14a544){if(_0x5e57e8[_0xe8aa('0x52')][_0xe8aa('0x33')]===_0xe8aa('0x2b')&&!_[_0xe8aa('0x53')](_0x5e57e8['body'][_0xe8aa('0x54')],'_')){_0x5e57e8[_0xe8aa('0x52')][_0xe8aa('0x54')]='_'[_0xe8aa('0x55')](_0x5e57e8[_0xe8aa('0x52')][_0xe8aa('0x54')]);}return db[_0xe8aa('0x39')][_0xe8aa('0x51')](_0x5e57e8[_0xe8aa('0x52')],{'raw':![]})[_0xe8aa('0x26')](function(_0x1e2bc3){var _0x27e560=_0x5e57e8[_0xe8aa('0x56')]['get']({'plain':!![]});if(!_0x27e560)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x27e560[_0xe8aa('0x57')]===_0xe8aa('0x56')){var _0xf29eff=_0x1e2bc3['get']({'plain':!![]});var _0x453996=[{'name':'InboundRoutes','value':'inbound'},{'name':_0xe8aa('0x2a'),'value':_0xe8aa('0x2b')},{'name':_0xe8aa('0x2c'),'value':_0xe8aa('0x58')}];var _0x1de7c6=_[_0xe8aa('0x32')](_0x453996,[_0xe8aa('0x30'),_0xf29eff[_0xe8aa('0x33')]])[_0xe8aa('0x34')];return db[_0xe8aa('0x59')]['find']({'where':{'name':_0x1de7c6,'userProfileId':_0x27e560['userProfileId']},'raw':!![]})[_0xe8aa('0x26')](function(_0x5b2d77){if(_0x5b2d77&&_0x5b2d77[_0xe8aa('0x5a')]===0x0){return db[_0xe8aa('0x35')]['create']({'name':_0xf29eff[_0xe8aa('0x34')],'resourceId':_0xf29eff['id'],'type':_0x5b2d77[_0xe8aa('0x34')],'sectionId':_0x5b2d77['id']},{})[_0xe8aa('0x26')](function(){return _0x1e2bc3;});}else{return _0x1e2bc3;}})[_0xe8aa('0x4d')](function(_0x402cce){logger[_0xe8aa('0x5b')](_0xe8aa('0x5c'),_0x402cce);throw _0x402cce;});}return _0x1e2bc3;})[_0xe8aa('0x26')](respondWithResult(_0x14a544,0xc9))[_0xe8aa('0x4d')](handleError(_0x14a544,null));};exports['update']=function(_0x317b06,_0x55fa34){if(_0x317b06[_0xe8aa('0x52')]['id']){delete _0x317b06[_0xe8aa('0x52')]['id'];}return db[_0xe8aa('0x39')][_0xe8aa('0x32')]({'where':{'id':_0x317b06[_0xe8aa('0x4e')]['id']}})[_0xe8aa('0x26')](handleEntityNotFound(_0x55fa34,null))['then'](function(_0xc16d9d){if(_0xc16d9d){return db[_0xe8aa('0x39')][_0xe8aa('0x25')](_[_0xe8aa('0x5d')](_0x317b06[_0xe8aa('0x52')],[_0xe8aa('0x54'),_0xe8aa('0x5e'),_0xe8aa('0x5f'),'recordingFormat',_0xe8aa('0x60'),'mandatoryDisposition']),{'where':{'context':_0xc16d9d[_0xe8aa('0x5e')],'exten':_0xc16d9d['exten']},'individualHooks':!![]})[_0xe8aa('0x26')](function(_0x1e3131){return _0x1e3131;});}return null;})['then'](respondWithStatusCode(_0x55fa34,null))[_0xe8aa('0x4d')](handleError(_0x55fa34,null));};exports[_0xe8aa('0x61')]=function(_0x559a03,_0x587296,_0x2a22de){return db[_0xe8aa('0x39')][_0xe8aa('0x62')]({'where':{'id':_0x559a03[_0xe8aa('0x4e')]['id']}})['then'](handleEntityNotFound(_0x587296,null))[_0xe8aa('0x26')](function(_0x273451){if(_0x273451){return db[_0xe8aa('0x63')]['transaction'](function(_0x4dcbf1){return db['VoiceExtension'][_0xe8aa('0x50')]({'where':{'VoiceExtensionId':_0x559a03[_0xe8aa('0x4e')]['id']},'transaction':_0x4dcbf1})[_0xe8aa('0x26')](function(_0x3a60b3){var _0x506427=_['map'](_0x559a03['body'],function(_0x113a7c){_0x113a7c[_0xe8aa('0x64')]=_0x559a03[_0xe8aa('0x4e')]['id'];return _0x113a7c;});return db['VoiceExtension']['bulkCreate'](_0x506427,{'transaction':_0x4dcbf1});});})['then'](function(){return db[_0xe8aa('0x39')][_0xe8aa('0x65')]({'where':{'isApp':!![],'VoiceExtensionId':_0x559a03['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x587296,null))['catch'](handleError(_0x587296,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c21bacf..f3ede90 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 _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 +var _0xc13e=['remove','emit','hasOwnProperty','hook','events','setMaxListeners','update'];(function(_0x8a765,_0x10dfab){var _0x107e98=function(_0x51ad10){while(--_0x51ad10){_0x8a765['push'](_0x8a765['shift']());}};_0x107e98(++_0x10dfab);}(_0xc13e,0x9e));var _0xec13=function(_0x44effa,_0xa69827){_0x44effa=_0x44effa-0x0;var _0x22c14c=_0xc13e[_0x44effa];return _0x22c14c;};'use strict';var EventEmitter=require(_0xec13('0x0'));var VoiceExtension=require('../../mysqldb')['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xec13('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec13('0x2'),'afterDestroy':_0xec13('0x3')};function emitEvent(_0x3a7b7f){return function(_0x41de97,_0x123ff,_0x2fef17){VoiceExtensionEvents[_0xec13('0x4')](_0x3a7b7f+':'+_0x41de97['id'],_0x41de97);VoiceExtensionEvents[_0xec13('0x4')](_0x3a7b7f,_0x41de97);_0x2fef17(null);};}for(var e in events){if(events[_0xec13('0x5')](e)){var event=events[e];VoiceExtension[_0xec13('0x6')](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 b8c98ca..214ad70 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 _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 +var _0x0de8=['./voiceExtension.attributes','exports','voice_extensions','lodash','../../config/logger','moment','rimraf','../../config/environment'];(function(_0x32f3d0,_0x18caa6){var _0x3cfb65=function(_0x1b97ba){while(--_0x1b97ba){_0x32f3d0['push'](_0x32f3d0['shift']());}};_0x3cfb65(++_0x18caa6);}(_0x0de8,0x153));var _0x80de=function(_0x2594dc,_0x33b3d0){_0x2594dc=_0x2594dc-0x0;var _0x4c4506=_0x0de8[_0x2594dc];return _0x4c4506;};'use strict';var _=require(_0x80de('0x0'));var util=require('util');var logger=require(_0x80de('0x1'))('api');var moment=require(_0x80de('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x80de('0x3'));var config=require(_0x80de('0x4'));var attributes=require(_0x80de('0x5'));module[_0x80de('0x6')]=function(_0x1aec50,_0xe78ad3){return _0x1aec50['define']('VoiceExtension',attributes,{'tableName':_0x80de('0x7'),'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 559344a..92e7ad6 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 _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 +var _0xb57c=['VoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceExtension'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb57c,0x158));var _0xcb57=function(_0x41b248,_0x3ef064){_0x41b248=_0x41b248-0x0;var _0x407d58=_0xb57c[_0x41b248];return _0x407d58;};'use strict';var _=require(_0xcb57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb57('0x1'));var fs=require('fs');var Redis=require(_0xcb57('0x2'));var db=require(_0xcb57('0x3'))['db'];var utils=require(_0xcb57('0x4'));var logger=require(_0xcb57('0x5'))('rpc');var config=require(_0xcb57('0x6'));var jayson=require(_0xcb57('0x7'));var client=jayson['client'][_0xcb57('0x8')]({'port':0x232a});config[_0xcb57('0x9')]=_[_0xcb57('0xa')](config['redis'],{'host':_0xcb57('0xb'),'port':0x18eb});var socket=require(_0xcb57('0xc'))(new Redis(config[_0xcb57('0x9')]));require(_0xcb57('0xd'))[_0xcb57('0xe')](socket);function respondWithRpcPromise(_0x39aad9,_0xd4d863,_0xf5d134){return new BPromise(function(_0x29a23e,_0x8a9a40){return client['request'](_0x39aad9,_0xf5d134)[_0xcb57('0xf')](function(_0x5d8f3a){logger[_0xcb57('0x10')](_0xcb57('0x11'),_0xd4d863,_0xcb57('0x12'));logger['debug'](_0xcb57('0x13'),_0xd4d863,_0xcb57('0x12'),JSON[_0xcb57('0x14')](_0x5d8f3a));if(_0x5d8f3a['error']){if(_0x5d8f3a[_0xcb57('0x15')][_0xcb57('0x16')]===0x1f4){logger[_0xcb57('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xd4d863,_0x5d8f3a[_0xcb57('0x15')][_0xcb57('0x17')]);return _0x8a9a40(_0x5d8f3a[_0xcb57('0x15')][_0xcb57('0x17')]);}logger[_0xcb57('0x15')]('VoiceExtension,\x20%s,\x20%s',_0xd4d863,_0x5d8f3a[_0xcb57('0x15')][_0xcb57('0x17')]);return _0x29a23e(_0x5d8f3a[_0xcb57('0x15')][_0xcb57('0x17')]);}else{logger['info'](_0xcb57('0x11'),_0xd4d863,'request\x20sent');_0x29a23e(_0x5d8f3a['result']['message']);}})[_0xcb57('0x18')](function(_0x2d4e){logger['error'](_0xcb57('0x11'),_0xd4d863,_0x2d4e);_0x8a9a40(_0x2d4e);});});}exports[_0xcb57('0x19')]=function(_0x2b0694){var _0x1846e5=this;return new Promise(function(_0x2378c2,_0x5c8aef){return db[_0xcb57('0x1a')][_0xcb57('0x1b')]({'raw':_0x2b0694[_0xcb57('0x1c')]?_0x2b0694['options'][_0xcb57('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b0694[_0xcb57('0x1c')]?_0x2b0694[_0xcb57('0x1c')][_0xcb57('0x1e')]||null:null,'attributes':_0x2b0694[_0xcb57('0x1c')]?_0x2b0694[_0xcb57('0x1c')][_0xcb57('0x1f')]||null:null,'limit':_0x2b0694['options']?_0x2b0694[_0xcb57('0x1c')][_0xcb57('0x20')]||null:null,'include':_0x2b0694['options']?_0x2b0694[_0xcb57('0x1c')]['include']?_[_0xcb57('0x21')](_0x2b0694[_0xcb57('0x1c')][_0xcb57('0x22')],function(_0x544e1b){return{'model':db[_0x544e1b[_0xcb57('0x23')]],'as':_0x544e1b['as'],'attributes':_0x544e1b[_0xcb57('0x1f')],'include':_0x544e1b['include']?_[_0xcb57('0x21')](_0x544e1b[_0xcb57('0x22')],function(_0x6f43b2){return{'model':db[_0x6f43b2[_0xcb57('0x23')]],'as':_0x6f43b2['as'],'attributes':_0x6f43b2[_0xcb57('0x1f')],'include':_0x6f43b2['include']?_[_0xcb57('0x21')](_0x6f43b2[_0xcb57('0x22')],function(_0x25dbf4){return{'model':db[_0x25dbf4['model']],'as':_0x25dbf4['as'],'attributes':_0x25dbf4['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb57('0xf')](function(_0xa4e224){logger[_0xcb57('0x10')](_0xcb57('0x19'),_0x2b0694);logger[_0xcb57('0x24')](_0xcb57('0x19'),_0x2b0694,JSON[_0xcb57('0x14')](_0xa4e224));_0x2378c2(_0xa4e224);})[_0xcb57('0x18')](function(_0xb83f08){logger['error'](_0xcb57('0x19'),_0xb83f08[_0xcb57('0x17')],_0x2b0694);_0x5c8aef(_0x1846e5[_0xcb57('0x15')](0x1f4,_0xb83f08[_0xcb57('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 60f0615..1710915 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 _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 +var _0x06b1=['removeListener','length','voiceExtension:','save','remove','emit'];(function(_0x3c898a,_0x51f096){var _0x221bb6=function(_0x426dd1){while(--_0x426dd1){_0x3c898a['push'](_0x3c898a['shift']());}};_0x221bb6(++_0x51f096);}(_0x06b1,0x171));var _0x106b=function(_0x27c1ec,_0x254263){_0x27c1ec=_0x27c1ec-0x0;var _0x4e3172=_0x06b1[_0x27c1ec];return _0x4e3172;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x106b('0x0'),_0x106b('0x1'),'update'];function createListener(_0x1848bd,_0x2a76be){return function(_0x3480fe){_0x2a76be[_0x106b('0x2')](_0x1848bd,_0x3480fe);};}function removeListener(_0x174fb9,_0x29cd05){return function(){VoiceExtensionEvents[_0x106b('0x3')](_0x174fb9,_0x29cd05);};}exports['register']=function(_0x5f4603){for(var _0x6c335c=0x0,_0x19df62=events[_0x106b('0x4')];_0x6c335c<_0x19df62;_0x6c335c++){var _0x236d17=events[_0x6c335c];var _0x563d73=createListener(_0x106b('0x5')+_0x236d17,_0x5f4603);VoiceExtensionEvents['on'](_0x236d17,_0x563d73);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index fcd4184..f16cb67 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 _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 +var _0x3a61=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','util','path','express','Router','../../components/auth/service'];(function(_0x4dcf64,_0x2bc0c2){var _0x10bb29=function(_0x271f1e){while(--_0x271f1e){_0x4dcf64['push'](_0x4dcf64['shift']());}};_0x10bb29(++_0x2bc0c2);}(_0x3a61,0xe4));var _0x13a6=function(_0x5e1990,_0x1700b2){_0x5e1990=_0x5e1990-0x0;var _0x34430c=_0x3a61[_0x5e1990];return _0x34430c;};'use strict';var multer=require(_0x13a6('0x0'));var util=require(_0x13a6('0x1'));var path=require(_0x13a6('0x2'));var timeout=require('connect-timeout');var express=require(_0x13a6('0x3'));var router=express[_0x13a6('0x4')]();var auth=require(_0x13a6('0x5'));var interaction=require(_0x13a6('0x6'));var config=require(_0x13a6('0x7'));var controller=require('./voiceMail.controller');router[_0x13a6('0x8')]('/',auth[_0x13a6('0x9')](),controller['index']);router[_0x13a6('0x8')]('/:id',auth[_0x13a6('0x9')](),controller[_0x13a6('0xa')]);router[_0x13a6('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x13a6('0xb')]('/',auth[_0x13a6('0x9')](),controller[_0x13a6('0xc')]);router[_0x13a6('0xd')]('/:id',auth[_0x13a6('0x9')](),controller[_0x13a6('0xe')]);router[_0x13a6('0xf')](_0x13a6('0x10'),auth[_0x13a6('0x9')](),controller[_0x13a6('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index dbca85f..bedde61 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 _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 +var _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x13f6bb,_0x1d625f){var _0x413673=function(_0x6dacf6){while(--_0x6dacf6){_0x13f6bb['push'](_0x13f6bb['shift']());}};_0x413673(++_0x1d625f);}(_0x13f6,0x124));var _0x613f=function(_0xda858e,_0x350d96){_0xda858e=_0xda858e-0x0;var _0x5a0bbb=_0x13f6[_0xda858e];return _0x5a0bbb;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x613f('0x2'),'unique':_0x613f('0x3')},'mailbox':{'type':Sequelize[_0x613f('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x613f('0x4')]},'fullname':{'type':Sequelize[_0x613f('0x4')]},'email':{'type':Sequelize[_0x613f('0x4')],'validate':{'isEmail':!![]},'set':function(_0x5c9aa9){this[_0x613f('0x5')](_0x613f('0x6'),typeof _0x5c9aa9==='string'&&_0x5c9aa9['trim']()?_0x5c9aa9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x613f('0x4')],'defaultValue':_0x613f('0x7')},'attach':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x613f('0x4')]},'review':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x613f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x613f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'stamp':{'type':_0x613f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x613f('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x613f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x613f('0xd')],'get':function(){return this[_0x613f('0xe')](_0x613f('0xf'))+_0x613f('0x10')+this[_0x613f('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 6a8f29a..a546ae3 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 _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 +var _0x032e=['filter','merge','VIRTUAL','options','VoiceMail','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x032e,0x1cc));var _0xe032=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x032e[_0xbb091];return _0x467a04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe032('0x0'));var rimraf=require(_0xe032('0x1'));var zipdir=require(_0xe032('0x2'));var jsonpatch=require(_0xe032('0x3'));var rp=require(_0xe032('0x4'));var moment=require('moment');var BPromise=require(_0xe032('0x5'));var Mustache=require(_0xe032('0x6'));var util=require(_0xe032('0x7'));var path=require(_0xe032('0x8'));var sox=require(_0xe032('0x9'));var csv=require(_0xe032('0xa'));var ejs=require(_0xe032('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe032('0xc'));var crypto=require(_0xe032('0xd'));var jsforce=require(_0xe032('0xe'));var deskjs=require(_0xe032('0xf'));var toCsv=require(_0xe032('0xa'));var querystring=require(_0xe032('0x10'));var Papa=require('papaparse');var Redis=require(_0xe032('0x11'));var authService=require(_0xe032('0x12'));var qs=require(_0xe032('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe032('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xe032('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe032('0x16'))['db'];function respondWithStatusCode(_0x48555b,_0x405184){_0x405184=_0x405184||0xcc;return function(_0x12c535){if(_0x12c535){return _0x48555b[_0xe032('0x17')](_0x405184);}return _0x48555b[_0xe032('0x18')](_0x405184)[_0xe032('0x19')]();};}function respondWithResult(_0x140e56,_0x10aac3){_0x10aac3=_0x10aac3||0xc8;return function(_0x1cc0bb){if(_0x1cc0bb){return _0x140e56[_0xe032('0x18')](_0x10aac3)[_0xe032('0x1a')](_0x1cc0bb);}};}function respondWithFilteredResult(_0x23883c,_0x16a36e){return function(_0x3f3010){if(_0x3f3010){var _0x40a175=_0x3f3010['count'],_0x2dc16f=_0x16a36e[_0xe032('0x1b')],_0x2e868b=_0x16a36e['offset']+_0x16a36e[_0xe032('0x1c')],_0x49c0c6;if(_0x2e868b>=_0x40a175){_0x2e868b=_0x40a175;_0x49c0c6=0xc8;}else{_0x49c0c6=0xce;}_0x23883c[_0xe032('0x18')](_0x49c0c6);return _0x23883c[_0xe032('0x1d')](_0xe032('0x1e'),_0x2dc16f+'-'+_0x2e868b+'/'+_0x40a175)[_0xe032('0x1a')](_0x3f3010);}return null;};}function patchUpdates(_0x3ca2d0){return function(_0x39031b){try{jsonpatch[_0xe032('0x1f')](_0x39031b,_0x3ca2d0,!![]);}catch(_0x1a6281){return BPromise[_0xe032('0x20')](_0x1a6281);}return _0x39031b[_0xe032('0x21')]();};}function saveUpdates(_0x230656,_0x35093e){return function(_0x3930a3){if(_0x3930a3){return _0x3930a3[_0xe032('0x22')](_0x230656)[_0xe032('0x23')](function(_0x35c3a9){return _0x35c3a9;});}return null;};}function removeEntity(_0x448e8a,_0x39f019){return function(_0x5e37f9){if(_0x5e37f9){return _0x5e37f9[_0xe032('0x24')]()['then'](function(){var _0x3122db=_0x5e37f9[_0xe032('0x25')]({'plain':!![]});var _0x330030=_0xe032('0x26');return db[_0xe032('0x27')][_0xe032('0x24')]({'where':{'type':_0x330030,'resourceId':_0x3122db['id']}})[_0xe032('0x23')](function(){return _0x5e37f9;});})[_0xe032('0x23')](function(){_0x448e8a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cf48c,_0x441fe9){return function(_0xdbc726){if(!_0xdbc726){_0x2cf48c[_0xe032('0x17')](0x194);}return _0xdbc726;};}function handleError(_0x1d83c2,_0x4cc91e){_0x4cc91e=_0x4cc91e||0x1f4;return function(_0x3542c7){logger[_0xe032('0x28')](_0x3542c7[_0xe032('0x29')]);if(_0x3542c7['name']){delete _0x3542c7[_0xe032('0x2a')];}_0x1d83c2['status'](_0x4cc91e)[_0xe032('0x2b')](_0x3542c7);};}exports[_0xe032('0x2c')]=function(_0x322c9c,_0x1911fb){var _0x5f16e8={},_0x425e9a={},_0x4bdaad={'count':0x0,'rows':[]};var _0x5bf7a3=_['map'](db['VoiceMail']['rawAttributes'],function(_0x159484){return{'name':_0x159484[_0xe032('0x2d')],'type':_0x159484[_0xe032('0x2e')]['key']};});_0x425e9a['model']=_[_0xe032('0x2f')](_0x5bf7a3,_0xe032('0x2a'));_0x425e9a[_0xe032('0x30')]=_[_0xe032('0x31')](_0x322c9c[_0xe032('0x30')]);_0x425e9a[_0xe032('0x32')]=_[_0xe032('0x33')](_0x425e9a[_0xe032('0x34')],_0x425e9a[_0xe032('0x30')]);_0x5f16e8['attributes']=_['intersection'](_0x425e9a[_0xe032('0x34')],qs[_0xe032('0x35')](_0x322c9c['query'][_0xe032('0x35')]));_0x5f16e8[_0xe032('0x36')]=_0x5f16e8[_0xe032('0x36')][_0xe032('0x37')]?_0x5f16e8[_0xe032('0x36')]:_0x425e9a[_0xe032('0x34')];if(!_0x322c9c[_0xe032('0x30')][_0xe032('0x38')](_0xe032('0x39'))){_0x5f16e8['limit']=qs[_0xe032('0x1c')](_0x322c9c[_0xe032('0x30')][_0xe032('0x1c')]);_0x5f16e8[_0xe032('0x1b')]=qs[_0xe032('0x1b')](_0x322c9c[_0xe032('0x30')][_0xe032('0x1b')]);}_0x5f16e8[_0xe032('0x3a')]=qs['sort'](_0x322c9c['query'][_0xe032('0x3b')]);_0x5f16e8[_0xe032('0x3c')]=qs[_0xe032('0x32')](_[_0xe032('0x3d')](_0x322c9c['query'],_0x425e9a[_0xe032('0x32')]),_0x5bf7a3);if(_0x322c9c[_0xe032('0x30')][_0xe032('0x3e')]){_0x5f16e8[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x5f16e8[_0xe032('0x3c')],{'$or':_[_0xe032('0x2f')](_0x5bf7a3,function(_0x377b69){if(_0x377b69['type']!==_0xe032('0x40')){var _0x4c6163={};_0x4c6163[_0x377b69[_0xe032('0x2a')]]={'$like':'%'+_0x322c9c[_0xe032('0x30')][_0xe032('0x3e')]+'%'};return _0x4c6163;}})});}_0x5f16e8=_[_0xe032('0x3f')]({},_0x5f16e8,_0x322c9c[_0xe032('0x41')]);var _0x20959c={'where':_0x5f16e8['where']};return db[_0xe032('0x42')]['count'](_0x20959c)['then'](function(_0x315dc3){_0x4bdaad['count']=_0x315dc3;if(_0x322c9c[_0xe032('0x30')]['includeAll']){_0x5f16e8['include']=[{'all':!![]}];}return db['VoiceMail'][_0xe032('0x43')](_0x5f16e8);})[_0xe032('0x23')](function(_0x21021a){_0x4bdaad[_0xe032('0x44')]=_0x21021a;return _0x4bdaad;})[_0xe032('0x23')](respondWithFilteredResult(_0x1911fb,_0x5f16e8))[_0xe032('0x45')](handleError(_0x1911fb,null));};exports[_0xe032('0x46')]=function(_0x10523b,_0x177c47){var _0x1361d9={'raw':!![],'where':{'id':_0x10523b[_0xe032('0x47')]['id']}},_0x3903af={};_0x3903af[_0xe032('0x34')]=_[_0xe032('0x31')](db[_0xe032('0x42')][_0xe032('0x48')]);_0x3903af['query']=_['keys'](_0x10523b[_0xe032('0x30')]);_0x3903af[_0xe032('0x32')]=_[_0xe032('0x33')](_0x3903af[_0xe032('0x34')],_0x3903af[_0xe032('0x30')]);_0x1361d9[_0xe032('0x36')]=_['intersection'](_0x3903af[_0xe032('0x34')],qs[_0xe032('0x35')](_0x10523b[_0xe032('0x30')][_0xe032('0x35')]));_0x1361d9[_0xe032('0x36')]=_0x1361d9[_0xe032('0x36')][_0xe032('0x37')]?_0x1361d9[_0xe032('0x36')]:_0x3903af['model'];if(_0x10523b['query']['includeAll']){_0x1361d9[_0xe032('0x49')]=[{'all':!![]}];}_0x1361d9=_['merge']({},_0x1361d9,_0x10523b[_0xe032('0x41')]);return db[_0xe032('0x42')][_0xe032('0x4a')](_0x1361d9)[_0xe032('0x23')](handleEntityNotFound(_0x177c47,null))[_0xe032('0x23')](respondWithResult(_0x177c47,null))[_0xe032('0x45')](handleError(_0x177c47,null));};exports['create']=function(_0x1b8960,_0x43537f){return db[_0xe032('0x42')][_0xe032('0x4b')](_0x1b8960[_0xe032('0x4c')],{})['then'](function(_0x523c92){var _0x31fd6a=_0x1b8960[_0xe032('0x4d')][_0xe032('0x25')]({'plain':!![]});if(!_0x31fd6a)throw new Error(_0xe032('0x4e'));if(_0x31fd6a[_0xe032('0x4f')]===_0xe032('0x4d')){var _0x2c812b=_0x523c92[_0xe032('0x25')]({'plain':!![]});var _0x466c7b='Voicemails';return db[_0xe032('0x50')]['find']({'where':{'name':_0x466c7b,'userProfileId':_0x31fd6a['userProfileId']},'raw':!![]})['then'](function(_0x3c5621){if(_0x3c5621&&_0x3c5621[_0xe032('0x51')]===0x0){return db[_0xe032('0x27')]['create']({'name':_0x2c812b[_0xe032('0x2a')],'resourceId':_0x2c812b['id'],'type':_0x3c5621['name'],'sectionId':_0x3c5621['id']},{})['then'](function(){return _0x523c92;});}else{return _0x523c92;}})['catch'](function(_0x4ce01a){logger[_0xe032('0x28')](_0xe032('0x52'),_0x4ce01a);throw _0x4ce01a;});}return _0x523c92;})[_0xe032('0x23')](respondWithResult(_0x43537f,0xc9))['catch'](handleError(_0x43537f,null));};exports[_0xe032('0x22')]=function(_0x51dd18,_0x2701f2){if(_0x51dd18[_0xe032('0x4c')]['id']){delete _0x51dd18['body']['id'];}return db['VoiceMail'][_0xe032('0x4a')]({'where':{'id':_0x51dd18[_0xe032('0x47')]['id']}})[_0xe032('0x23')](handleEntityNotFound(_0x2701f2,null))[_0xe032('0x23')](saveUpdates(_0x51dd18['body'],null))[_0xe032('0x23')](respondWithResult(_0x2701f2,null))[_0xe032('0x45')](handleError(_0x2701f2,null));};exports[_0xe032('0x24')]=function(_0x34c5ea,_0x58840c){return db[_0xe032('0x42')][_0xe032('0x4a')]({'where':{'id':_0x34c5ea[_0xe032('0x47')]['id']}})[_0xe032('0x23')](handleEntityNotFound(_0x58840c,null))['then'](removeEntity(_0x58840c,null))['catch'](handleError(_0x58840c,null));};exports['getMessages']=function(_0x576a88,_0x17df9b,_0x1b0e08){return db['VoiceMail'][_0xe032('0x53')]({'where':{'id':_0x576a88['params']['id']}})[_0xe032('0x23')](handleEntityNotFound(_0x17df9b,null))[_0xe032('0x23')](function(_0x378ca8){var _0x908f0a;var _0x15c639={},_0x51efe2={};_0x51efe2[_0xe032('0x34')]=_[_0xe032('0x31')](db[_0xe032('0x54')][_0xe032('0x48')]);_0x51efe2[_0xe032('0x30')]=_[_0xe032('0x31')](_0x576a88[_0xe032('0x30')]);_0x51efe2[_0xe032('0x32')]=_[_0xe032('0x33')](_0x51efe2[_0xe032('0x34')],_0x51efe2[_0xe032('0x30')]);_0x15c639[_0xe032('0x36')]=_['intersection'](_0x51efe2[_0xe032('0x34')],qs[_0xe032('0x35')](_0x576a88[_0xe032('0x30')][_0xe032('0x35')]));_0x15c639[_0xe032('0x36')]=_0x15c639[_0xe032('0x36')][_0xe032('0x37')]?_0x15c639['attributes']:_0x51efe2['model'];if(!_0x576a88[_0xe032('0x30')][_0xe032('0x38')](_0xe032('0x39'))){_0x15c639['limit']=qs[_0xe032('0x1c')](_0x576a88[_0xe032('0x30')][_0xe032('0x1c')]);_0x15c639['offset']=qs[_0xe032('0x1b')](_0x576a88[_0xe032('0x30')]['offset']);}_0x15c639['order']=qs[_0xe032('0x3b')](_0x576a88['query']['sort']);_0x15c639[_0xe032('0x3c')]=qs['filters'](_['pick'](_0x576a88[_0xe032('0x30')],_0x51efe2[_0xe032('0x32')]));if(_0x576a88['query']['filter']){_0x15c639[_0xe032('0x3c')]=_[_0xe032('0x3f')](_0x15c639[_0xe032('0x3c')],{'$or':_[_0xe032('0x2f')](_0x15c639['attributes'],function(_0x549e25){var _0x197e5a={};_0x197e5a[_0x549e25]={'$like':'%'+_0x576a88[_0xe032('0x30')][_0xe032('0x3e')]+'%'};return _0x197e5a;})});}_0x15c639['where']=_[_0xe032('0x3f')](_0x15c639[_0xe032('0x3c')],{'mailboxuser':_0x378ca8[_0xe032('0x55')]});_0x15c639=_[_0xe032('0x3f')]({},_0x15c639,_0x576a88['options']);return db[_0xe032('0x54')][_0xe032('0x56')](_0x15c639)[_0xe032('0x23')](respondWithFilteredResult(_0x17df9b,_0x15c639));})[_0xe032('0x45')](handleError(_0x17df9b,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 82f2d02..792cf72 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 _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 +var _0x832b=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','mailbox_context','context','util','moment','bluebird'];(function(_0x4620fb,_0x4f4f88){var _0x55555a=function(_0x229b98){while(--_0x229b98){_0x4620fb['push'](_0x4620fb['shift']());}};_0x55555a(++_0x4f4f88);}(_0x832b,0x194));var _0xb832=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x832b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb832('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb832('0x1'));var BPromise=require(_0xb832('0x2'));var rp=require(_0xb832('0x3'));var fs=require('fs');var path=require(_0xb832('0x4'));var rimraf=require(_0xb832('0x5'));var config=require(_0xb832('0x6'));var attributes=require(_0xb832('0x7'));module['exports']=function(_0xb39e60,_0x4060a0){return _0xb39e60['define'](_0xb832('0x8'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xb832('0x9'),'fields':['mailbox',_0xb832('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index ed79ec3..6964f6d 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 _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 +var _0xd20c=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x20d6b2,_0x3fbdad){var _0x3cf4f3=function(_0x222a22){while(--_0x222a22){_0x20d6b2['push'](_0x20d6b2['shift']());}};_0x3cf4f3(++_0x3fbdad);}(_0xd20c,0x8f));var _0xcd20=function(_0x44c81f,_0xdb5984){_0x44c81f=_0x44c81f-0x0;var _0x1d7083=_0xd20c[_0x44c81f];return _0x1d7083;};'use strict';var _=require(_0xcd20('0x0'));var util=require(_0xcd20('0x1'));var moment=require(_0xcd20('0x2'));var BPromise=require(_0xcd20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd20('0x4'));var db=require(_0xcd20('0x5'))['db'];var utils=require(_0xcd20('0x6'));var logger=require('../../config/logger')(_0xcd20('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xcd20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35618e,_0x3e2e4e,_0x2cb69b){return new BPromise(function(_0xb2be37,_0x6e1d5a){return client['request'](_0x35618e,_0x2cb69b)[_0xcd20('0x9')](function(_0x571f18){logger[_0xcd20('0xa')](_0xcd20('0xb'),_0x3e2e4e,_0xcd20('0xc'));logger[_0xcd20('0xd')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3e2e4e,'request\x20sent',JSON[_0xcd20('0xe')](_0x571f18));if(_0x571f18[_0xcd20('0xf')]){if(_0x571f18[_0xcd20('0xf')][_0xcd20('0x10')]===0x1f4){logger['error'](_0xcd20('0xb'),_0x3e2e4e,_0x571f18[_0xcd20('0xf')][_0xcd20('0x11')]);return _0x6e1d5a(_0x571f18[_0xcd20('0xf')]['message']);}logger[_0xcd20('0xf')](_0xcd20('0xb'),_0x3e2e4e,_0x571f18[_0xcd20('0xf')][_0xcd20('0x11')]);return _0xb2be37(_0x571f18[_0xcd20('0xf')][_0xcd20('0x11')]);}else{logger[_0xcd20('0xa')](_0xcd20('0xb'),_0x3e2e4e,_0xcd20('0xc'));_0xb2be37(_0x571f18[_0xcd20('0x12')][_0xcd20('0x11')]);}})[_0xcd20('0x13')](function(_0x22f1f6){logger[_0xcd20('0xf')](_0xcd20('0xb'),_0x3e2e4e,_0x22f1f6);_0x6e1d5a(_0x22f1f6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6845297..ac6d8f5 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 _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 +var _0x5fc3=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x4dab14,_0x164ea0){var _0xf41aa=function(_0x305d50){while(--_0x305d50){_0x4dab14['push'](_0x4dab14['shift']());}};_0xf41aa(++_0x164ea0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0x5fc3[_0x4b784d];return _0x2cdeaf;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0x8')](_0x35fc('0xc'),auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth[_0x35fc('0x9')](),controller['create']);router[_0x35fc('0xf')](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 6623e22..28abfc6 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 _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 +var _0x0416=['long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0xaa1173,_0x266cd9){var _0x4f8d17=function(_0x26b6f2){while(--_0x26b6f2){_0xaa1173['push'](_0xaa1173['shift']());}};_0x4f8d17(++_0x266cd9);}(_0x0416,0x172));var _0x6041=function(_0xe67bc4,_0x121121){_0xe67bc4=_0xe67bc4-0x0;var _0x3df827=_0x0416[_0xe67bc4];return _0x3df827;};'use strict';var Sequelize=require(_0x6041('0x0'));module[_0x6041('0x1')]={'name':{'type':Sequelize[_0x6041('0x2')],'get':function(_0x454827){return this[_0x6041('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6041('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6041('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6041('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x6041('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x6041('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x6041('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x6041('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6041('0x5')],'defaultValue':''},'stamp':{'type':_0x6041('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index fba7483..e9cc161 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 _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 +var _0x2624=['where','filter','options','VoiceMailMessage','includeAll','rows','catch','show','params','rawAttributes','intersection','merge','create','body','find','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','stack','name','index','map','fieldName','model','differenceBy','query','keys','filters','fields','attributes','length','order','sort'];(function(_0x544ad5,_0x16f253){var _0x56885f=function(_0x2e7fe3){while(--_0x2e7fe3){_0x544ad5['push'](_0x544ad5['shift']());}};_0x56885f(++_0x16f253);}(_0x2624,0xb2));var _0x4262=function(_0x20b548,_0x393b3d){_0x20b548=_0x20b548-0x0;var _0x234316=_0x2624[_0x20b548];return _0x234316;};'use strict';var pdf=require(_0x4262('0x0'));var emlformat=require(_0x4262('0x1'));var rimraf=require(_0x4262('0x2'));var zipdir=require(_0x4262('0x3'));var jsonpatch=require(_0x4262('0x4'));var rp=require(_0x4262('0x5'));var moment=require(_0x4262('0x6'));var BPromise=require(_0x4262('0x7'));var Mustache=require(_0x4262('0x8'));var util=require(_0x4262('0x9'));var path=require(_0x4262('0xa'));var sox=require(_0x4262('0xb'));var csv=require(_0x4262('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4262('0xd'));var squel=require(_0x4262('0xe'));var crypto=require('crypto');var jsforce=require(_0x4262('0xf'));var deskjs=require(_0x4262('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4262('0x11'));var authService=require(_0x4262('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4262('0x13'));var logger=require(_0x4262('0x14'))(_0x4262('0x15'));var utils=require(_0x4262('0x16'));var config=require(_0x4262('0x17'));var licenseUtil=require(_0x4262('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x469dd5,_0x1f607f){_0x1f607f=_0x1f607f||0xcc;return function(_0x39c16f){if(_0x39c16f){return _0x469dd5[_0x4262('0x19')](_0x1f607f);}return _0x469dd5[_0x4262('0x1a')](_0x1f607f)[_0x4262('0x1b')]();};}function respondWithResult(_0x12d3dc,_0x5a3525){_0x5a3525=_0x5a3525||0xc8;return function(_0x2d95bd){if(_0x2d95bd){return _0x12d3dc[_0x4262('0x1a')](_0x5a3525)[_0x4262('0x1c')](_0x2d95bd);}};}function respondWithFilteredResult(_0x1f0285,_0x472be8){return function(_0x5e74b2){if(_0x5e74b2){var _0x5c0604=_0x5e74b2[_0x4262('0x1d')],_0x3d064f=_0x472be8['offset'],_0x3dd845=_0x472be8[_0x4262('0x1e')]+_0x472be8[_0x4262('0x1f')],_0x14b116;if(_0x3dd845>=_0x5c0604){_0x3dd845=_0x5c0604;_0x14b116=0xc8;}else{_0x14b116=0xce;}_0x1f0285[_0x4262('0x1a')](_0x14b116);return _0x1f0285[_0x4262('0x20')]('Content-Range',_0x3d064f+'-'+_0x3dd845+'/'+_0x5c0604)[_0x4262('0x1c')](_0x5e74b2);}return null;};}function patchUpdates(_0x116a94){return function(_0x333ee9){try{jsonpatch['apply'](_0x333ee9,_0x116a94,!![]);}catch(_0xb2e67c){return BPromise[_0x4262('0x21')](_0xb2e67c);}return _0x333ee9['save']();};}function saveUpdates(_0x28761f,_0x36d978){return function(_0x548b85){if(_0x548b85){return _0x548b85[_0x4262('0x22')](_0x28761f)[_0x4262('0x23')](function(_0x7e44da){return _0x7e44da;});}return null;};}function removeEntity(_0x3b13ec,_0x4e6c7e){return function(_0x124d66){if(_0x124d66){return _0x124d66[_0x4262('0x24')]()[_0x4262('0x23')](function(){_0x3b13ec[_0x4262('0x1a')](0xcc)[_0x4262('0x1b')]();});}};}function handleEntityNotFound(_0x12f171,_0x501166){return function(_0x59fa98){if(!_0x59fa98){_0x12f171[_0x4262('0x19')](0x194);}return _0x59fa98;};}function handleError(_0x5567ab,_0xea2d1b){_0xea2d1b=_0xea2d1b||0x1f4;return function(_0x59c664){logger[_0x4262('0x25')](_0x59c664[_0x4262('0x26')]);if(_0x59c664[_0x4262('0x27')]){delete _0x59c664[_0x4262('0x27')];}_0x5567ab['status'](_0xea2d1b)['send'](_0x59c664);};}exports[_0x4262('0x28')]=function(_0x571412,_0x48ac47){var _0x39a969={},_0x322a01={},_0x30afa7={'count':0x0,'rows':[]};var _0x39d127=_[_0x4262('0x29')](db['VoiceMailMessage']['rawAttributes'],function(_0x3c54f1){return{'name':_0x3c54f1[_0x4262('0x2a')],'type':_0x3c54f1['type']['key']};});_0x322a01[_0x4262('0x2b')]=_[_0x4262('0x2c')](_[_0x4262('0x29')](_0x39d127,_0x4262('0x27')),[_0x4262('0x27')]);_0x322a01[_0x4262('0x2d')]=_[_0x4262('0x2e')](_0x571412[_0x4262('0x2d')]);_0x322a01[_0x4262('0x2f')]=_['intersection'](_0x322a01[_0x4262('0x2b')],_0x322a01['query']);_0x39a969['attributes']=_['intersection'](_0x322a01[_0x4262('0x2b')],qs[_0x4262('0x30')](_0x571412[_0x4262('0x2d')]['fields']));_0x39a969['attributes']=_0x39a969[_0x4262('0x31')][_0x4262('0x32')]?_0x39a969[_0x4262('0x31')]:_0x322a01[_0x4262('0x2b')];if(!_0x571412[_0x4262('0x2d')]['hasOwnProperty']('nolimit')){_0x39a969[_0x4262('0x1f')]=qs[_0x4262('0x1f')](_0x571412['query'][_0x4262('0x1f')]);_0x39a969[_0x4262('0x1e')]=qs['offset'](_0x571412[_0x4262('0x2d')][_0x4262('0x1e')]);}_0x39a969[_0x4262('0x33')]=qs[_0x4262('0x34')](_0x571412[_0x4262('0x2d')][_0x4262('0x34')]);_0x39a969[_0x4262('0x35')]=qs['filters'](_['pick'](_0x571412[_0x4262('0x2d')],_0x322a01[_0x4262('0x2f')]),_0x39d127);if(_0x571412[_0x4262('0x2d')][_0x4262('0x36')]){_0x39a969[_0x4262('0x35')]=_['merge'](_0x39a969[_0x4262('0x35')],{'$or':_[_0x4262('0x29')](_0x39d127,function(_0x45bf22){if(_0x45bf22['type']!=='VIRTUAL'){var _0x689f3f={};_0x689f3f[_0x45bf22['name']]={'$like':'%'+_0x571412['query']['filter']+'%'};return _0x689f3f;}})});}_0x39a969=_['merge']({},_0x39a969,_0x571412[_0x4262('0x37')]);var _0x37da68={'where':_0x39a969[_0x4262('0x35')]};return db[_0x4262('0x38')][_0x4262('0x1d')](_0x37da68)['then'](function(_0x1848ef){_0x30afa7[_0x4262('0x1d')]=_0x1848ef;if(_0x571412['query'][_0x4262('0x39')]){_0x39a969['include']=[{'all':!![]}];}return db[_0x4262('0x38')]['findAll'](_0x39a969);})[_0x4262('0x23')](function(_0x558626){_0x30afa7[_0x4262('0x3a')]=_0x558626;return _0x30afa7;})[_0x4262('0x23')](respondWithFilteredResult(_0x48ac47,_0x39a969))[_0x4262('0x3b')](handleError(_0x48ac47,null));};exports[_0x4262('0x3c')]=function(_0xaa3b7e,_0x354877){var _0x253e1f={'raw':!![],'where':{'id':_0xaa3b7e[_0x4262('0x3d')]['id']}},_0x2b7e3f={};_0x2b7e3f[_0x4262('0x2b')]=_[_0x4262('0x2e')](db[_0x4262('0x38')][_0x4262('0x3e')]);_0x2b7e3f[_0x4262('0x2d')]=_['keys'](_0xaa3b7e['query']);_0x2b7e3f[_0x4262('0x2f')]=_[_0x4262('0x3f')](_0x2b7e3f['model'],_0x2b7e3f[_0x4262('0x2d')]);_0x253e1f[_0x4262('0x31')]=_[_0x4262('0x3f')](_0x2b7e3f[_0x4262('0x2b')],qs[_0x4262('0x30')](_0xaa3b7e[_0x4262('0x2d')][_0x4262('0x30')]));_0x253e1f[_0x4262('0x31')]=_0x253e1f[_0x4262('0x31')][_0x4262('0x32')]?_0x253e1f['attributes']:_0x2b7e3f[_0x4262('0x2b')];if(_0xaa3b7e[_0x4262('0x2d')][_0x4262('0x39')]){_0x253e1f['include']=[{'all':!![]}];}_0x253e1f=_[_0x4262('0x40')]({},_0x253e1f,_0xaa3b7e[_0x4262('0x37')]);return db['VoiceMailMessage']['find'](_0x253e1f)[_0x4262('0x23')](handleEntityNotFound(_0x354877,null))[_0x4262('0x23')](respondWithResult(_0x354877,null))[_0x4262('0x3b')](handleError(_0x354877,null));};exports['create']=function(_0x1a2e97,_0x40b789){return db[_0x4262('0x38')][_0x4262('0x41')](_0x1a2e97[_0x4262('0x42')],{})['then'](respondWithResult(_0x40b789,0xc9))[_0x4262('0x3b')](handleError(_0x40b789,null));};exports['update']=function(_0x3022cd,_0x209a42){if(_0x3022cd[_0x4262('0x42')]['id']){delete _0x3022cd[_0x4262('0x42')]['id'];}return db[_0x4262('0x38')][_0x4262('0x43')]({'where':{'id':_0x3022cd[_0x4262('0x3d')]['id']}})['then'](handleEntityNotFound(_0x209a42,null))[_0x4262('0x23')](saveUpdates(_0x3022cd[_0x4262('0x42')],null))['then'](respondWithResult(_0x209a42,null))['catch'](handleError(_0x209a42,null));};exports[_0x4262('0x24')]=function(_0xeabeb1,_0x123d10){return db['VoiceMailMessage'][_0x4262('0x43')]({'where':{'id':_0xeabeb1['params']['id']}})[_0x4262('0x23')](handleEntityNotFound(_0x123d10,null))[_0x4262('0x23')](removeEntity(_0x123d10,null))['catch'](handleError(_0x123d10,null));};exports['download']=function(_0x6075fe,_0x46aa3f,_0x3b97ba){return db[_0x4262('0x38')][_0x4262('0x43')]({'where':{'id':_0x6075fe['params']['id']},'attributes':['id',_0x4262('0x44'),_0x4262('0x45')]})['then'](handleEntityNotFound(_0x46aa3f,null))['then'](function(_0x50b543){if(_0x50b543){if(!_0x50b543[_0x4262('0x44')]){throw new db[(_0x4262('0x46'))][(_0x4262('0x47'))]('VoiceMailMessage\x20not\x20found');}var _0x540e98={'Content-Type':_0x4262('0x48'),'Content-Disposition':_0x4262('0x49')};if(_0x50b543[_0x4262('0x45')]){_0x540e98[_0x4262('0x4a')]=_0x4262('0x4b')+_0x50b543[_0x4262('0x45')]+'.wav\x22';}_0x46aa3f['set'](_0x540e98);return _0x46aa3f[_0x4262('0x4c')](new Buffer(_0x50b543[_0x4262('0x44')]));}})['catch'](handleError(_0x46aa3f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 47e50d4..d058405 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 _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 +var _0xf1e2=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xf1e2,0x136));var _0x2f1e=function(_0x756af5,_0x35834c){_0x756af5=_0x756af5-0x0;var _0x1e8aff=_0xf1e2[_0x756af5];return _0x1e8aff;};'use strict';var _=require(_0x2f1e('0x0'));var util=require(_0x2f1e('0x1'));var logger=require('../../config/logger')(_0x2f1e('0x2'));var moment=require(_0x2f1e('0x3'));var BPromise=require(_0x2f1e('0x4'));var rp=require(_0x2f1e('0x5'));var fs=require('fs');var path=require(_0x2f1e('0x6'));var rimraf=require(_0x2f1e('0x7'));var config=require(_0x2f1e('0x8'));var attributes=require(_0x2f1e('0x9'));module['exports']=function(_0x3c8a2b,_0x284d1e){return _0x3c8a2b['define'](_0x2f1e('0xa'),attributes,{'tableName':_0x2f1e('0xb'),'paranoid':![],'indexes':[{'name':_0x2f1e('0xc'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d8d1535..f4bb28b 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 _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 +var _0x7a54=['info','VoiceMailMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x4f580b,_0x57267a){_0x4f580b=_0x4f580b-0x0;var _0x9d76f2=_0x7a54[_0x4f580b];return _0x9d76f2;};'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')]('VoiceMailMessage,\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/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index a3442cf..7d13688 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 _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 +var _0xd4bc=['destroy','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','create','addSound','put','update','delete'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xd4bc,0x193));var _0xcd4b=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0xd4bc[_0x2cc711];return _0x31a52e;};'use strict';var multer=require(_0xcd4b('0x0'));var util=require(_0xcd4b('0x1'));var path=require(_0xcd4b('0x2'));var timeout=require(_0xcd4b('0x3'));var express=require(_0xcd4b('0x4'));var router=express[_0xcd4b('0x5')]();var auth=require(_0xcd4b('0x6'));var interaction=require(_0xcd4b('0x7'));var config=require(_0xcd4b('0x8'));var controller=require(_0xcd4b('0x9'));router[_0xcd4b('0xa')]('/',auth[_0xcd4b('0xb')](),controller[_0xcd4b('0xc')]);router[_0xcd4b('0xa')](_0xcd4b('0xd'),auth['isAuthenticated'](),controller[_0xcd4b('0xe')]);router['get']('/:id/sounds',auth[_0xcd4b('0xb')](),controller[_0xcd4b('0xf')]);router[_0xcd4b('0x10')]('/',auth[_0xcd4b('0xb')](),controller[_0xcd4b('0x11')]);router[_0xcd4b('0x10')]('/:id/sounds',auth['isAuthenticated'](),controller[_0xcd4b('0x12')]);router[_0xcd4b('0x13')](_0xcd4b('0xd'),auth[_0xcd4b('0xb')](),controller[_0xcd4b('0x14')]);router[_0xcd4b('0x15')](_0xcd4b('0xd'),auth[_0xcd4b('0xb')](),controller[_0xcd4b('0x16')]);router[_0xcd4b('0x15')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xcd4b('0x17')]);module[_0xcd4b('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index edbf55c..4b49f6b 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 _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 +var _0x25ac=['STRING','name','custom','files','mp3','BOOLEAN','sequelize','exports'];(function(_0x16eb8c,_0x2d9785){var _0x3e498d=function(_0x3c56ce){while(--_0x3c56ce){_0x16eb8c['push'](_0x16eb8c['shift']());}};_0x3e498d(++_0x2d9785);}(_0x25ac,0x1ae));var _0xc25a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc25a('0x0'));module[_0xc25a('0x1')]={'name':{'type':Sequelize[_0xc25a('0x2')],'allowNull':![],'unique':_0xc25a('0x3')},'mode':{'type':Sequelize['ENUM'](_0xc25a('0x4'),_0xc25a('0x5'),'mp3nb','quietmp3nb','quietmp3',_0xc25a('0x6')),'allowNull':!![],'defaultValue':_0xc25a('0x5')},'directory':{'type':Sequelize[_0xc25a('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xc25a('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc25a('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xc25a('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xc25a('0x7')],'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 469b926..2414734 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 _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 +var _0x19ff=['show','params','length','find','update','body','create','sequelize','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','format','basename','save_name','extname','%s.%s','removeSound','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','Content-Range','apply','reject','save','then','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','catch'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0x19ff,0x92));var _0xf19f=function(_0x127fab,_0x59aae8){_0x127fab=_0x127fab-0x0;var _0x849de6=_0x19ff[_0x127fab];return _0x849de6;};'use strict';var pdf=require(_0xf19f('0x0'));var emlformat=require(_0xf19f('0x1'));var rimraf=require(_0xf19f('0x2'));var zipdir=require(_0xf19f('0x3'));var jsonpatch=require(_0xf19f('0x4'));var rp=require(_0xf19f('0x5'));var moment=require('moment');var BPromise=require(_0xf19f('0x6'));var Mustache=require(_0xf19f('0x7'));var util=require(_0xf19f('0x8'));var path=require('path');var sox=require(_0xf19f('0x9'));var csv=require(_0xf19f('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf19f('0xb'));var squel=require(_0xf19f('0xc'));var crypto=require(_0xf19f('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf19f('0xa'));var querystring=require(_0xf19f('0xe'));var Papa=require('papaparse');var Redis=require(_0xf19f('0xf'));var authService=require(_0xf19f('0x10'));var qs=require(_0xf19f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf19f('0x12'));var utils=require('../../config/utils');var config=require(_0xf19f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf19f('0x14'))['db'];function respondWithStatusCode(_0x410ac2,_0x45954d){_0x45954d=_0x45954d||0xcc;return function(_0x22fa1e){if(_0x22fa1e){return _0x410ac2[_0xf19f('0x15')](_0x45954d);}return _0x410ac2['status'](_0x45954d)[_0xf19f('0x16')]();};}function respondWithResult(_0x138a7c,_0x4f6a62){_0x4f6a62=_0x4f6a62||0xc8;return function(_0x405d9a){if(_0x405d9a){return _0x138a7c['status'](_0x4f6a62)[_0xf19f('0x17')](_0x405d9a);}};}function respondWithFilteredResult(_0x37dfe5,_0x23814d){return function(_0x2fedb4){if(_0x2fedb4){var _0x4a6e15=_0x2fedb4['count'],_0x4326fc=_0x23814d[_0xf19f('0x18')],_0x437c27=_0x23814d[_0xf19f('0x18')]+_0x23814d[_0xf19f('0x19')],_0x243c1f;if(_0x437c27>=_0x4a6e15){_0x437c27=_0x4a6e15;_0x243c1f=0xc8;}else{_0x243c1f=0xce;}_0x37dfe5[_0xf19f('0x1a')](_0x243c1f);return _0x37dfe5['set'](_0xf19f('0x1b'),_0x4326fc+'-'+_0x437c27+'/'+_0x4a6e15)[_0xf19f('0x17')](_0x2fedb4);}return null;};}function patchUpdates(_0x44d64e){return function(_0x99c6dd){try{jsonpatch[_0xf19f('0x1c')](_0x99c6dd,_0x44d64e,!![]);}catch(_0x54380a){return BPromise[_0xf19f('0x1d')](_0x54380a);}return _0x99c6dd[_0xf19f('0x1e')]();};}function saveUpdates(_0x18b151,_0x54ae9e){return function(_0x58d841){if(_0x58d841){return _0x58d841['update'](_0x18b151)[_0xf19f('0x1f')](function(_0x5bab15){return _0x5bab15;});}return null;};}function removeEntity(_0x1e4ae8,_0x5c1dac){return function(_0x36bdcc){if(_0x36bdcc){return _0x36bdcc['destroy']()[_0xf19f('0x1f')](function(){var _0x31b7a7=_0x36bdcc['get']({'plain':!![]});var _0x365335=_0xf19f('0x20');return db[_0xf19f('0x21')][_0xf19f('0x22')]({'where':{'type':_0x365335,'resourceId':_0x31b7a7['id']}})[_0xf19f('0x1f')](function(){return _0x36bdcc;});})[_0xf19f('0x1f')](function(){_0x1e4ae8[_0xf19f('0x1a')](0xcc)[_0xf19f('0x16')]();});}};}function handleEntityNotFound(_0x1f3d78,_0x5bdf95){return function(_0x8fa57b){if(!_0x8fa57b){_0x1f3d78[_0xf19f('0x15')](0x194);}return _0x8fa57b;};}function handleError(_0x3af8f4,_0x30d8ee){_0x30d8ee=_0x30d8ee||0x1f4;return function(_0x4c569c){logger[_0xf19f('0x23')](_0x4c569c[_0xf19f('0x24')]);if(_0x4c569c[_0xf19f('0x25')]){delete _0x4c569c[_0xf19f('0x25')];}_0x3af8f4['status'](_0x30d8ee)[_0xf19f('0x26')](_0x4c569c);};}exports['index']=function(_0x90d82e,_0x1adf62){var _0x48eb3e={},_0x71b49c={},_0x463f3e={'count':0x0,'rows':[]};var _0x14ccde=_[_0xf19f('0x27')](db[_0xf19f('0x28')][_0xf19f('0x29')],function(_0x4c868){return{'name':_0x4c868[_0xf19f('0x2a')],'type':_0x4c868[_0xf19f('0x2b')][_0xf19f('0x2c')]};});_0x71b49c[_0xf19f('0x2d')]=_[_0xf19f('0x27')](_0x14ccde,_0xf19f('0x25'));_0x71b49c['query']=_[_0xf19f('0x2e')](_0x90d82e[_0xf19f('0x2f')]);_0x71b49c[_0xf19f('0x30')]=_[_0xf19f('0x31')](_0x71b49c['model'],_0x71b49c[_0xf19f('0x2f')]);_0x48eb3e[_0xf19f('0x32')]=_[_0xf19f('0x31')](_0x71b49c[_0xf19f('0x2d')],qs[_0xf19f('0x33')](_0x90d82e[_0xf19f('0x2f')][_0xf19f('0x33')]));_0x48eb3e[_0xf19f('0x32')]=_0x48eb3e['attributes']['length']?_0x48eb3e['attributes']:_0x71b49c[_0xf19f('0x2d')];if(!_0x90d82e[_0xf19f('0x2f')]['hasOwnProperty'](_0xf19f('0x34'))){_0x48eb3e[_0xf19f('0x19')]=qs[_0xf19f('0x19')](_0x90d82e[_0xf19f('0x2f')][_0xf19f('0x19')]);_0x48eb3e[_0xf19f('0x18')]=qs[_0xf19f('0x18')](_0x90d82e[_0xf19f('0x2f')][_0xf19f('0x18')]);}_0x48eb3e[_0xf19f('0x35')]=qs['sort'](_0x90d82e[_0xf19f('0x2f')][_0xf19f('0x36')]);_0x48eb3e['where']=qs['filters'](_[_0xf19f('0x37')](_0x90d82e[_0xf19f('0x2f')],_0x71b49c[_0xf19f('0x30')]),_0x14ccde);if(_0x90d82e['query'][_0xf19f('0x38')]){_0x48eb3e[_0xf19f('0x39')]=_[_0xf19f('0x3a')](_0x48eb3e[_0xf19f('0x39')],{'$or':_[_0xf19f('0x27')](_0x14ccde,function(_0x2395ab){if(_0x2395ab[_0xf19f('0x2b')]!=='VIRTUAL'){var _0x116891={};_0x116891[_0x2395ab['name']]={'$like':'%'+_0x90d82e['query']['filter']+'%'};return _0x116891;}})});}_0x48eb3e=_[_0xf19f('0x3a')]({},_0x48eb3e,_0x90d82e[_0xf19f('0x3b')]);var _0x25947c={'where':_0x48eb3e[_0xf19f('0x39')]};return db[_0xf19f('0x28')][_0xf19f('0x3c')](_0x25947c)[_0xf19f('0x1f')](function(_0x53170c){_0x463f3e[_0xf19f('0x3c')]=_0x53170c;if(_0x90d82e[_0xf19f('0x2f')][_0xf19f('0x3d')]){_0x48eb3e[_0xf19f('0x3e')]=[{'all':!![]}];}return db[_0xf19f('0x28')]['findAll'](_0x48eb3e);})[_0xf19f('0x1f')](function(_0x18bae7){_0x463f3e['rows']=_0x18bae7;return _0x463f3e;})[_0xf19f('0x1f')](respondWithFilteredResult(_0x1adf62,_0x48eb3e))[_0xf19f('0x3f')](handleError(_0x1adf62,null));};exports[_0xf19f('0x40')]=function(_0x256c38,_0x26da43){var _0x5835e7={'raw':![],'where':{'id':_0x256c38[_0xf19f('0x41')]['id']}},_0x221f34={};_0x221f34[_0xf19f('0x2d')]=_['keys'](db[_0xf19f('0x28')]['rawAttributes']);_0x221f34[_0xf19f('0x2f')]=_['keys'](_0x256c38[_0xf19f('0x2f')]);_0x221f34[_0xf19f('0x30')]=_[_0xf19f('0x31')](_0x221f34[_0xf19f('0x2d')],_0x221f34[_0xf19f('0x2f')]);_0x5835e7[_0xf19f('0x32')]=_[_0xf19f('0x31')](_0x221f34[_0xf19f('0x2d')],qs[_0xf19f('0x33')](_0x256c38['query'][_0xf19f('0x33')]));_0x5835e7[_0xf19f('0x32')]=_0x5835e7['attributes'][_0xf19f('0x42')]?_0x5835e7[_0xf19f('0x32')]:_0x221f34[_0xf19f('0x2d')];if(_0x256c38['query'][_0xf19f('0x3d')]){_0x5835e7[_0xf19f('0x3e')]=[{'all':!![]}];}_0x5835e7=_[_0xf19f('0x3a')]({},_0x5835e7,_0x256c38['options']);return db[_0xf19f('0x28')][_0xf19f('0x43')](_0x5835e7)['then'](handleEntityNotFound(_0x26da43,null))['then'](respondWithResult(_0x26da43,null))[_0xf19f('0x3f')](handleError(_0x26da43,null));};exports[_0xf19f('0x44')]=function(_0x1a566f,_0x3f0769){if(_0x1a566f[_0xf19f('0x45')]['id']){delete _0x1a566f['body']['id'];}return db[_0xf19f('0x28')][_0xf19f('0x43')]({'where':{'id':_0x1a566f[_0xf19f('0x41')]['id']}})[_0xf19f('0x1f')](handleEntityNotFound(_0x3f0769,null))[_0xf19f('0x1f')](saveUpdates(_0x1a566f[_0xf19f('0x45')],null))[_0xf19f('0x1f')](respondWithResult(_0x3f0769,null))[_0xf19f('0x3f')](handleError(_0x3f0769,null));};exports[_0xf19f('0x46')]=function(_0x3ea657,_0x404722,_0x295172){return db[_0xf19f('0x47')][_0xf19f('0x48')](function(_0x52b3d6){if(_0x3ea657[_0xf19f('0x45')]['mode']===_0xf19f('0x49')){_0x3ea657['body'][_0xf19f('0x4a')]=path[_0xf19f('0x4b')](config[_0xf19f('0x4c')],_0xf19f('0x4d'),_0x3ea657['body'][_0xf19f('0x25')]);}return db[_0xf19f('0x28')][_0xf19f('0x46')](_0x3ea657['body'],{'transaction':_0x52b3d6})[_0xf19f('0x1f')](function(_0xb30025){if(_0x3ea657[_0xf19f('0x45')][_0xf19f('0x4e')]===_0xf19f('0x49')){fs[_0xf19f('0x4f')](_0xb30025[_0xf19f('0x4a')],parseInt(_0xf19f('0x50'),0x8));}var _0x50ea39=_0x3ea657[_0xf19f('0x51')]['get']({'plain':!![]});if(!_0x50ea39)throw new Error(_0xf19f('0x52'));if(_0x50ea39[_0xf19f('0x53')]===_0xf19f('0x51')){var _0x17afca=_0xb30025[_0xf19f('0x54')]({'plain':!![]});return db[_0xf19f('0x55')][_0xf19f('0x43')]({'where':{'name':'MusicOnHolds','userProfileId':_0x50ea39['userProfileId']},'raw':!![]})['then'](function(_0x5c878b){if(_0x5c878b&&_0x5c878b['autoAssociation']===0x0){return db['UserProfileResource'][_0xf19f('0x46')]({'name':_0x17afca[_0xf19f('0x25')],'resourceId':_0x17afca['id'],'type':_0x5c878b['name'],'sectionId':_0x5c878b['id']},{})['then'](function(){return _0xb30025;});}else{return _0xb30025;}})[_0xf19f('0x3f')](function(_0x54b7ad){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54b7ad);});}return _0xb30025;});})[_0xf19f('0x1f')](respondWithResult(_0x404722,0xc9))[_0xf19f('0x3f')](handleError(_0x404722,null));};exports['destroy']=function(_0x47fd44,_0x322ae0,_0xba912){var _0x53c258;return db[_0xf19f('0x28')][_0xf19f('0x43')]({'where':{'id':_0x47fd44['params']['id']}})['then'](function(_0x4bcfec){if(_0x4bcfec){return db['sequelize'][_0xf19f('0x48')](function(_0xcf65ff){return _0x4bcfec[_0xf19f('0x22')]({'transaction':_0xcf65ff,'raw':!![]})[_0xf19f('0x1f')](function(_0x51e0a0){if(_0x51e0a0[_0xf19f('0x4a')]){fs[_0xf19f('0x56')](_0x51e0a0[_0xf19f('0x4a')])[_0xf19f('0x57')](function(_0x1c9152){fs[_0xf19f('0x58')](path[_0xf19f('0x4b')](_0x51e0a0[_0xf19f('0x4a')],_0x1c9152));});fs[_0xf19f('0x59')](_0x51e0a0[_0xf19f('0x4a')]);}return _0x51e0a0;});})['catch'](function(_0x2087b7){throw new db[(_0xf19f('0x5a'))][(_0xf19f('0x5b'))](_0x2087b7[_0xf19f('0x5c')]);});}})[_0xf19f('0x1f')](handleEntityNotFound(_0x322ae0,null))['then'](removeEntity(_0x322ae0,null))[_0xf19f('0x3f')](handleError(_0x322ae0,null));};exports[_0xf19f('0x5d')]=function(_0x3b9d58,_0x19a653,_0x52d6f4){return db[_0xf19f('0x47')][_0xf19f('0x48')](function(_0x1e527d){var _0xff8ea4;return db[_0xf19f('0x28')]['find']({'where':{'id':_0x3b9d58['params']['id']}})[_0xf19f('0x1f')](function(_0x528518){if(_0x528518){_0xff8ea4=_0x528518;return _0x528518['addSound'](_0x3b9d58[_0xf19f('0x45')]['id'],{'transaction':_0x1e527d});}})[_0xf19f('0x1f')](function(_0x146bd1){if(_0x146bd1){return db[_0xf19f('0x5e')][_0xf19f('0x5f')]({'where':{'id':_0x3b9d58[_0xf19f('0x45')]['id']},'attributes':['id',_0xf19f('0x25'),'save_name',_0xf19f('0x60'),_0xf19f('0x61')],'raw':!![]});}})['then'](function(_0x58a107){if(_0x58a107){var _0x56535e=path['join'](config[_0xf19f('0x4c')],'server/files/sounds/converted',util[_0xf19f('0x62')]('%s.%s',path[_0xf19f('0x63')](_0x58a107[_0xf19f('0x64')],path[_0xf19f('0x65')](_0x58a107['save_name'])),_0x58a107[_0xf19f('0x60')]));var _0x38abbe=path[_0xf19f('0x4b')](config[_0xf19f('0x4c')],_0xf19f('0x4d'),_0xff8ea4[_0xf19f('0x25')],util[_0xf19f('0x62')](_0xf19f('0x66'),_0x58a107[_0xf19f('0x25')],_0x58a107[_0xf19f('0x60')]));fs['symlinkSync'](_0x56535e,_0x38abbe);return _0x58a107;}})['catch'](function(_0x50f9a6){throw new db['Sequelize'][(_0xf19f('0x5b'))](_0x50f9a6[_0xf19f('0x5c')]);});})[_0xf19f('0x1f')](handleEntityNotFound(_0x19a653,null))[_0xf19f('0x1f')](respondWithResult(_0x19a653,0xc9))[_0xf19f('0x3f')](handleError(_0x19a653,null));};exports['removeSound']=function(_0x1e30c6,_0x328a8b,_0x4aee6c){return db[_0xf19f('0x47')]['transaction'](function(_0x26726c){var _0xc48409;return db[_0xf19f('0x28')][_0xf19f('0x5f')]({'where':{'id':_0x1e30c6['params']['id']}})[_0xf19f('0x1f')](handleEntityNotFound(_0x328a8b,null))[_0xf19f('0x1f')](function(_0x56e9d6){if(_0x56e9d6){_0xc48409=_0x56e9d6;return _0x56e9d6[_0xf19f('0x67')](_0x1e30c6[_0xf19f('0x41')]['id2']);}})[_0xf19f('0x1f')](function(_0xd65170){if(_0xd65170){return db[_0xf19f('0x5e')][_0xf19f('0x5f')]({'where':{'id':_0x1e30c6['params']['id2']},'attributes':['id',_0xf19f('0x25'),'save_name','converted_format',_0xf19f('0x61')],'raw':!![]});}})[_0xf19f('0x1f')](function(_0x5553ca){if(_0x5553ca){fs['unlinkSync'](path[_0xf19f('0x4b')](_0xc48409[_0xf19f('0x4a')],util[_0xf19f('0x62')]('%s.%s',_0x5553ca['name'],_0x5553ca[_0xf19f('0x60')])));return _0x5553ca;}})[_0xf19f('0x3f')](function(_0x1ec246){throw new db[(_0xf19f('0x5a'))][(_0xf19f('0x5b'))](_0x1ec246[_0xf19f('0x5c')]);});})['then'](handleEntityNotFound(_0x328a8b,null))[_0xf19f('0x1f')](respondWithStatusCode(_0x328a8b,0xcc))[_0xf19f('0x3f')](handleError(_0x328a8b,null));};exports[_0xf19f('0x68')]=function(_0x586d54,_0x54c623,_0x5c7088){var _0x45407d={};var _0x1674c1={};var _0x3175c5;var _0x5ece05;return db['VoiceMusicOnHold'][_0xf19f('0x5f')]({'where':{'id':_0x586d54[_0xf19f('0x41')]['id']}})['then'](handleEntityNotFound(_0x54c623,null))[_0xf19f('0x1f')](function(_0x4c17e1){if(_0x4c17e1){_0x3175c5=_0x4c17e1;_0x1674c1['model']=_[_0xf19f('0x2e')](db[_0xf19f('0x5e')][_0xf19f('0x29')]);_0x1674c1[_0xf19f('0x2f')]=_[_0xf19f('0x2e')](_0x586d54[_0xf19f('0x2f')]);_0x1674c1[_0xf19f('0x30')]=_[_0xf19f('0x31')](_0x1674c1[_0xf19f('0x2d')],_0x1674c1[_0xf19f('0x2f')]);_0x45407d[_0xf19f('0x32')]=_[_0xf19f('0x31')](_0x1674c1[_0xf19f('0x2d')],qs['fields'](_0x586d54[_0xf19f('0x2f')][_0xf19f('0x33')]));_0x45407d[_0xf19f('0x32')]=_0x45407d[_0xf19f('0x32')][_0xf19f('0x42')]?_0x45407d['attributes']:_0x1674c1[_0xf19f('0x2d')];_0x45407d[_0xf19f('0x35')]=qs[_0xf19f('0x36')](_0x586d54['query'][_0xf19f('0x36')]);_0x45407d[_0xf19f('0x39')]=qs['filters'](_[_0xf19f('0x37')](_0x586d54['query'],_0x1674c1[_0xf19f('0x30')]));if(_0x586d54[_0xf19f('0x2f')]['filter']){_0x45407d[_0xf19f('0x39')]=_[_0xf19f('0x3a')](_0x45407d[_0xf19f('0x39')],{'$or':_[_0xf19f('0x27')](_0x45407d['attributes'],function(_0x303956){var _0x5b6d6e={};_0x5b6d6e[_0x303956]={'$like':'%'+_0x586d54[_0xf19f('0x2f')]['filter']+'%'};return _0x5b6d6e;})});}_0x45407d=_[_0xf19f('0x3a')]({},_0x45407d,_0x586d54['options']);return _0x3175c5[_0xf19f('0x68')](_0x45407d);}})[_0xf19f('0x1f')](function(_0x5ea115){if(_0x5ea115){_0x5ece05=_0x5ea115[_0xf19f('0x42')];if(!_0x586d54[_0xf19f('0x2f')]['hasOwnProperty'](_0xf19f('0x34'))){_0x45407d['limit']=qs[_0xf19f('0x19')](_0x586d54[_0xf19f('0x2f')]['limit']);_0x45407d[_0xf19f('0x18')]=qs[_0xf19f('0x18')](_0x586d54[_0xf19f('0x2f')][_0xf19f('0x18')]);}return _0x3175c5[_0xf19f('0x68')](_0x45407d);}})['then'](function(_0x5e5bc8){if(_0x5e5bc8){return _0x5e5bc8?{'count':_0x5ece05,'rows':_0x5e5bc8}:null;}})[_0xf19f('0x1f')](respondWithResult(_0x54c623,null))[_0xf19f('0x3f')](handleError(_0x54c623,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 7c356e2..750d25c 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 _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 +var _0x4f72=['exports','voice_musiconhold','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes'];(function(_0x3dc48d,_0x3f0807){var _0x21c884=function(_0x4ceaa4){while(--_0x4ceaa4){_0x3dc48d['push'](_0x3dc48d['shift']());}};_0x21c884(++_0x3f0807);}(_0x4f72,0x65));var _0x24f7=function(_0x2c6301,_0x4188f5){_0x2c6301=_0x2c6301-0x0;var _0x44866f=_0x4f72[_0x2c6301];return _0x44866f;};'use strict';var _=require(_0x24f7('0x0'));var util=require(_0x24f7('0x1'));var logger=require(_0x24f7('0x2'))(_0x24f7('0x3'));var moment=require('moment');var BPromise=require(_0x24f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24f7('0x5'));var rimraf=require(_0x24f7('0x6'));var config=require(_0x24f7('0x7'));var attributes=require(_0x24f7('0x8'));module[_0x24f7('0x9')]=function(_0x4ad08c,_0x4e4bde){return _0x4ad08c['define']('VoiceMusicOnHold',attributes,{'tableName':_0x24f7('0xa'),'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 7c61da2..09f0872 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 _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 +var _0xf9b5=['then','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoiceMusicOnHold,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5020e5,_0x6c4aab){var _0x397d05=function(_0x3b2527){while(--_0x3b2527){_0x5020e5['push'](_0x5020e5['shift']());}};_0x397d05(++_0x6c4aab);}(_0xf9b5,0x1ec));var _0x5f9b=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xf9b5[_0x5f3905];return _0x2923b1;};'use strict';var _=require(_0x5f9b('0x0'));var util=require(_0x5f9b('0x1'));var moment=require(_0x5f9b('0x2'));var BPromise=require(_0x5f9b('0x3'));var rs=require(_0x5f9b('0x4'));var fs=require('fs');var Redis=require(_0x5f9b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f9b('0x6'));var logger=require('../../config/logger')(_0x5f9b('0x7'));var config=require(_0x5f9b('0x8'));var jayson=require(_0x5f9b('0x9'));var client=jayson['client'][_0x5f9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7920,_0x2bb46e,_0x3c737d){return new BPromise(function(_0x238e6c,_0x5d7238){return client[_0x5f9b('0xb')](_0x4b7920,_0x3c737d)[_0x5f9b('0xc')](function(_0x3eed7d){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2bb46e,_0x5f9b('0xd'));logger[_0x5f9b('0xe')](_0x5f9b('0xf'),_0x2bb46e,'request\x20sent',JSON[_0x5f9b('0x10')](_0x3eed7d));if(_0x3eed7d[_0x5f9b('0x11')]){if(_0x3eed7d[_0x5f9b('0x11')][_0x5f9b('0x12')]===0x1f4){logger[_0x5f9b('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2bb46e,_0x3eed7d[_0x5f9b('0x11')][_0x5f9b('0x13')]);return _0x5d7238(_0x3eed7d['error'][_0x5f9b('0x13')]);}logger[_0x5f9b('0x11')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2bb46e,_0x3eed7d[_0x5f9b('0x11')][_0x5f9b('0x13')]);return _0x238e6c(_0x3eed7d[_0x5f9b('0x11')][_0x5f9b('0x13')]);}else{logger[_0x5f9b('0x14')](_0x5f9b('0x15'),_0x2bb46e,'request\x20sent');_0x238e6c(_0x3eed7d[_0x5f9b('0x16')][_0x5f9b('0x13')]);}})[_0x5f9b('0x17')](function(_0xadfeb7){logger[_0x5f9b('0x11')](_0x5f9b('0x15'),_0x2bb46e,_0xadfeb7);_0x5d7238(_0xadfeb7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index aa1a527..adf9900 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 _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 +var _0x24d6=['index','/describe','describe','/:id','/:id/users','getAgents','post','addAgents','put','update','delete','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x39106d,_0x4d5fef){var _0x42d497=function(_0x4a239c){while(--_0x4a239c){_0x39106d['push'](_0x39106d['shift']());}};_0x42d497(++_0x4d5fef);}(_0x24d6,0x97));var _0x624d=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0x24d6[_0x2af160];return _0x439d67;};'use strict';var multer=require(_0x624d('0x0'));var util=require('util');var path=require(_0x624d('0x1'));var timeout=require('connect-timeout');var express=require(_0x624d('0x2'));var router=express[_0x624d('0x3')]();var auth=require(_0x624d('0x4'));var interaction=require(_0x624d('0x5'));var config=require(_0x624d('0x6'));var controller=require(_0x624d('0x7'));router[_0x624d('0x8')]('/',auth[_0x624d('0x9')](),controller[_0x624d('0xa')]);router[_0x624d('0x8')](_0x624d('0xb'),auth[_0x624d('0x9')](),controller[_0x624d('0xc')]);router[_0x624d('0x8')](_0x624d('0xd'),auth[_0x624d('0x9')](),controller['show']);router['get'](_0x624d('0xe'),auth[_0x624d('0x9')](),controller[_0x624d('0xf')]);router['post']('/',auth[_0x624d('0x9')](),controller['create']);router[_0x624d('0x10')](_0x624d('0xe'),auth[_0x624d('0x9')](),controller[_0x624d('0x11')]);router[_0x624d('0x12')](_0x624d('0xd'),auth[_0x624d('0x9')](),controller[_0x624d('0x13')]);router['delete'](_0x624d('0xd'),auth[_0x624d('0x9')](),controller['destroy']);router[_0x624d('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0x624d('0x15')]);module[_0x624d('0x16')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d859a0f..fdeac5b 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 _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 +var _0xb299=['name','system-','getDataValue','INTEGER','sequelize','STRING'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xb299,0x1c0));var _0x9b29=function(_0x8e8ff,_0x47b895){_0x8e8ff=_0x8e8ff-0x0;var _0x2c0906=_0xb299[_0x8e8ff];return _0x2c0906;};'use strict';var Sequelize=require(_0x9b29('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b29('0x1')],'allowNull':![],'unique':_0x9b29('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x176492){return _0x9b29('0x3')+this[_0x9b29('0x4')](_0x9b29('0x2'))+'-';}},'description':{'type':Sequelize[_0x9b29('0x1')]},'callerIdAll':{'type':Sequelize[_0x9b29('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x9b29('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 3e3d35e..8e01f10 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 _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 +var _0xfc65=['register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','findAll','rows','catch','show','includeAll','include','VoicePrefix','find','params','describe','sequelize','transaction','create','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','Voice\x20Prefix\x20Extension','priority','prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','NoOp','No\x20callerid\x20available','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','body','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','nolimit','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfc65,0x1e1));var _0x5fc6=function(_0x166402,_0x126530){_0x166402=_0x166402-0x0;var _0x622ab0=_0xfc65[_0x166402];return _0x622ab0;};'use strict';var pdf=require(_0x5fc6('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5fc6('0x1'));var jsonpatch=require(_0x5fc6('0x2'));var rp=require(_0x5fc6('0x3'));var moment=require(_0x5fc6('0x4'));var BPromise=require(_0x5fc6('0x5'));var Mustache=require(_0x5fc6('0x6'));var util=require(_0x5fc6('0x7'));var path=require(_0x5fc6('0x8'));var sox=require(_0x5fc6('0x9'));var csv=require(_0x5fc6('0xa'));var ejs=require(_0x5fc6('0xb'));var fs=require('fs');var _=require(_0x5fc6('0xc'));var squel=require(_0x5fc6('0xd'));var crypto=require('crypto');var jsforce=require(_0x5fc6('0xe'));var deskjs=require(_0x5fc6('0xf'));var toCsv=require(_0x5fc6('0xa'));var querystring=require(_0x5fc6('0x10'));var Papa=require(_0x5fc6('0x11'));var Redis=require(_0x5fc6('0x12'));var authService=require(_0x5fc6('0x13'));var qs=require(_0x5fc6('0x14'));var as=require(_0x5fc6('0x15'));var hardwareService=require(_0x5fc6('0x16'));var logger=require('../../config/logger')(_0x5fc6('0x17'));var utils=require('../../config/utils');var config=require(_0x5fc6('0x18'));var licenseUtil=require(_0x5fc6('0x19'));var db=require(_0x5fc6('0x1a'))['db'];config[_0x5fc6('0x1b')]=_['defaults'](config[_0x5fc6('0x1b')],{'host':_0x5fc6('0x1c'),'port':0x18eb});var socket=require(_0x5fc6('0x1d'))(new Redis(config[_0x5fc6('0x1b')]));require(_0x5fc6('0x1e'))[_0x5fc6('0x1f')](socket);function respondWithStatusCode(_0x23424e,_0x24beb4){_0x24beb4=_0x24beb4||0xcc;return function(_0x1daf72){if(_0x1daf72){return _0x23424e[_0x5fc6('0x20')](_0x24beb4);}return _0x23424e['status'](_0x24beb4)['end']();};}function respondWithResult(_0x3b35b2,_0x45f10e){_0x45f10e=_0x45f10e||0xc8;return function(_0x5cb1c7){if(_0x5cb1c7){return _0x3b35b2[_0x5fc6('0x21')](_0x45f10e)[_0x5fc6('0x22')](_0x5cb1c7);}};}function respondWithFilteredResult(_0x191cf3,_0x2f2661){return function(_0x241bfb){if(_0x241bfb){var _0x29e82f=_0x241bfb[_0x5fc6('0x23')],_0x569bbc=_0x2f2661[_0x5fc6('0x24')],_0x202975=_0x2f2661['offset']+_0x2f2661[_0x5fc6('0x25')],_0x4363c1;if(_0x202975>=_0x29e82f){_0x202975=_0x29e82f;_0x4363c1=0xc8;}else{_0x4363c1=0xce;}_0x191cf3[_0x5fc6('0x21')](_0x4363c1);return _0x191cf3[_0x5fc6('0x26')](_0x5fc6('0x27'),_0x569bbc+'-'+_0x202975+'/'+_0x29e82f)[_0x5fc6('0x22')](_0x241bfb);}return null;};}function patchUpdates(_0x29f587){return function(_0x3d415f){try{jsonpatch[_0x5fc6('0x28')](_0x3d415f,_0x29f587,!![]);}catch(_0xfd8379){return BPromise[_0x5fc6('0x29')](_0xfd8379);}return _0x3d415f['save']();};}function saveUpdates(_0x1a3c0d,_0x3e0585){return function(_0x45e60a){if(_0x45e60a){return _0x45e60a[_0x5fc6('0x2a')](_0x1a3c0d)[_0x5fc6('0x2b')](function(_0x1480a3){return _0x1480a3;});}return null;};}function removeEntity(_0xb7946,_0x2a38d3){return function(_0x4e4029){if(_0x4e4029){return _0x4e4029[_0x5fc6('0x2c')]()[_0x5fc6('0x2b')](function(){var _0x1db1f0=_0x4e4029[_0x5fc6('0x2d')]({'plain':!![]});var _0x391392=_0x5fc6('0x2e');return db['UserProfileResource'][_0x5fc6('0x2c')]({'where':{'type':_0x391392,'resourceId':_0x1db1f0['id']}})[_0x5fc6('0x2b')](function(){return _0x4e4029;});})['then'](function(){_0xb7946[_0x5fc6('0x21')](0xcc)[_0x5fc6('0x2f')]();});}};}function handleEntityNotFound(_0x1f2d56,_0x19d630){return function(_0x2abeeb){if(!_0x2abeeb){_0x1f2d56['sendStatus'](0x194);}return _0x2abeeb;};}function handleError(_0x17f2b2,_0x2134ca){_0x2134ca=_0x2134ca||0x1f4;return function(_0x21066b){logger[_0x5fc6('0x30')](_0x21066b[_0x5fc6('0x31')]);if(_0x21066b[_0x5fc6('0x32')]){delete _0x21066b[_0x5fc6('0x32')];}_0x17f2b2[_0x5fc6('0x21')](_0x2134ca)[_0x5fc6('0x33')](_0x21066b);};}exports['index']=function(_0x11d7fc,_0x5ae36d){var _0x11bd4c={},_0x2a3440={},_0xa36fe7={'count':0x0,'rows':[]};var _0x18ddf=_[_0x5fc6('0x34')](db['VoicePrefix'][_0x5fc6('0x35')],function(_0x330f9b){return{'name':_0x330f9b[_0x5fc6('0x36')],'type':_0x330f9b[_0x5fc6('0x37')][_0x5fc6('0x38')]};});_0x2a3440[_0x5fc6('0x39')]=_[_0x5fc6('0x34')](_0x18ddf,_0x5fc6('0x32'));_0x2a3440['query']=_[_0x5fc6('0x3a')](_0x11d7fc[_0x5fc6('0x3b')]);_0x2a3440['filters']=_['intersection'](_0x2a3440[_0x5fc6('0x39')],_0x2a3440[_0x5fc6('0x3b')]);_0x11bd4c['attributes']=_[_0x5fc6('0x3c')](_0x2a3440[_0x5fc6('0x39')],qs[_0x5fc6('0x3d')](_0x11d7fc[_0x5fc6('0x3b')]['fields']));_0x11bd4c['attributes']=_0x11bd4c[_0x5fc6('0x3e')][_0x5fc6('0x3f')]?_0x11bd4c['attributes']:_0x2a3440['model'];if(!_0x11d7fc[_0x5fc6('0x3b')][_0x5fc6('0x40')]('nolimit')){_0x11bd4c[_0x5fc6('0x25')]=qs['limit'](_0x11d7fc[_0x5fc6('0x3b')][_0x5fc6('0x25')]);_0x11bd4c[_0x5fc6('0x24')]=qs[_0x5fc6('0x24')](_0x11d7fc['query'][_0x5fc6('0x24')]);}_0x11bd4c[_0x5fc6('0x41')]=qs[_0x5fc6('0x42')](_0x11d7fc[_0x5fc6('0x3b')][_0x5fc6('0x42')]);_0x11bd4c[_0x5fc6('0x43')]=qs['filters'](_[_0x5fc6('0x44')](_0x11d7fc['query'],_0x2a3440[_0x5fc6('0x45')]),_0x18ddf);if(_0x11d7fc[_0x5fc6('0x3b')]['filter']){_0x11bd4c[_0x5fc6('0x43')]=_[_0x5fc6('0x46')](_0x11bd4c['where'],{'$or':_['map'](_0x18ddf,function(_0x14f2a7){if(_0x14f2a7[_0x5fc6('0x37')]!==_0x5fc6('0x47')){var _0x3883a9={};_0x3883a9[_0x14f2a7[_0x5fc6('0x32')]]={'$like':'%'+_0x11d7fc[_0x5fc6('0x3b')][_0x5fc6('0x48')]+'%'};return _0x3883a9;}})});}_0x11bd4c=_[_0x5fc6('0x46')]({},_0x11bd4c,_0x11d7fc[_0x5fc6('0x49')]);var _0x1b72a3={'where':_0x11bd4c[_0x5fc6('0x43')]};return db['VoicePrefix'][_0x5fc6('0x23')](_0x1b72a3)[_0x5fc6('0x2b')](function(_0x358b29){_0xa36fe7[_0x5fc6('0x23')]=_0x358b29;if(_0x11d7fc[_0x5fc6('0x3b')]['includeAll']){_0x11bd4c['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x5fc6('0x4a')](_0x11bd4c);})[_0x5fc6('0x2b')](function(_0x419a91){_0xa36fe7[_0x5fc6('0x4b')]=_0x419a91;return _0xa36fe7;})['then'](respondWithFilteredResult(_0x5ae36d,_0x11bd4c))[_0x5fc6('0x4c')](handleError(_0x5ae36d,null));};exports[_0x5fc6('0x4d')]=function(_0x2c55e0,_0xed38cf){var _0x3be426={'raw':![],'where':{'id':_0x2c55e0['params']['id']}},_0x2a2ef6={};_0x2a2ef6[_0x5fc6('0x39')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x2a2ef6[_0x5fc6('0x3b')]=_['keys'](_0x2c55e0[_0x5fc6('0x3b')]);_0x2a2ef6[_0x5fc6('0x45')]=_[_0x5fc6('0x3c')](_0x2a2ef6['model'],_0x2a2ef6[_0x5fc6('0x3b')]);_0x3be426['attributes']=_[_0x5fc6('0x3c')](_0x2a2ef6[_0x5fc6('0x39')],qs['fields'](_0x2c55e0[_0x5fc6('0x3b')]['fields']));_0x3be426[_0x5fc6('0x3e')]=_0x3be426[_0x5fc6('0x3e')][_0x5fc6('0x3f')]?_0x3be426[_0x5fc6('0x3e')]:_0x2a2ef6['model'];if(_0x2c55e0[_0x5fc6('0x3b')][_0x5fc6('0x4e')]){_0x3be426[_0x5fc6('0x4f')]=[{'all':!![]}];}_0x3be426=_[_0x5fc6('0x46')]({},_0x3be426,_0x2c55e0['options']);return db[_0x5fc6('0x50')][_0x5fc6('0x51')](_0x3be426)[_0x5fc6('0x2b')](handleEntityNotFound(_0xed38cf,null))[_0x5fc6('0x2b')](respondWithResult(_0xed38cf,null))[_0x5fc6('0x4c')](handleError(_0xed38cf,null));};exports[_0x5fc6('0x2c')]=function(_0x2bfa97,_0x49eb58){return db[_0x5fc6('0x50')][_0x5fc6('0x51')]({'where':{'id':_0x2bfa97[_0x5fc6('0x52')]['id']}})['then'](handleEntityNotFound(_0x49eb58,null))[_0x5fc6('0x2b')](removeEntity(_0x49eb58,null))[_0x5fc6('0x4c')](handleError(_0x49eb58,null));};exports[_0x5fc6('0x53')]=function(_0x474dbd,_0x46dbfd){return db[_0x5fc6('0x50')][_0x5fc6('0x53')]()[_0x5fc6('0x2b')](respondWithResult(_0x46dbfd,null))[_0x5fc6('0x4c')](handleError(_0x46dbfd,null));};exports['create']=function(_0x30614c,_0xa94085){var _0x4149a3;return db[_0x5fc6('0x54')][_0x5fc6('0x55')](function(_0x57d49d){return db[_0x5fc6('0x50')][_0x5fc6('0x56')](_0x30614c['body'],{'transaction':_0x57d49d})[_0x5fc6('0x2b')](function(_0x115b70){_0x4149a3=_0x115b70[_0x5fc6('0x2d')]({'plain':!![]});return db[_0x5fc6('0x57')][_0x5fc6('0x51')]({'where':{'id':_0x4149a3[_0x5fc6('0x58')]},'raw':!![]})[_0x5fc6('0x2b')](function(_0x561baa){return createVoicePrefixExtensions(_0x4149a3,_0x561baa,_0x57d49d);});});})['then'](function(){var _0x4e11e8=_0x30614c[_0x5fc6('0x59')][_0x5fc6('0x2d')]({'plain':!![]});if(!_0x4e11e8)throw new Error(_0x5fc6('0x5a'));if(_0x4e11e8['role']===_0x5fc6('0x59')){var _0x220684=_0x4149a3;return db['UserProfileSection'][_0x5fc6('0x51')]({'where':{'name':_0x5fc6('0x2e'),'userProfileId':_0x4e11e8[_0x5fc6('0x5b')]},'raw':!![]})['then'](function(_0x2acc84){if(_0x2acc84&&_0x2acc84[_0x5fc6('0x5c')]===0x0){return db['UserProfileResource'][_0x5fc6('0x56')]({'name':_0x220684[_0x5fc6('0x32')],'resourceId':_0x220684['id'],'type':_0x2acc84[_0x5fc6('0x32')],'sectionId':_0x2acc84['id']},{})[_0x5fc6('0x2b')](function(){return _0x4149a3;});}else{return _0x4149a3;}})[_0x5fc6('0x4c')](function(_0x2a664c){logger[_0x5fc6('0x30')](_0x5fc6('0x5d'),_0x2a664c);throw _0x2a664c;});}return _0x4149a3;})[_0x5fc6('0x2b')](respondWithResult(_0xa94085,null))['catch'](handleError(_0xa94085,null));};function Extension(_0x4d5ec3,_0x5c3c4c,_0x11fb1c,_0x58244a){this[_0x5fc6('0x5e')]=_0x5fc6('0x5f');this[_0x5fc6('0x60')]=_0x4d5ec3;this['app']=_0x11fb1c;this[_0x5fc6('0x37')]=_0x5fc6('0x61');this[_0x5fc6('0x62')]=_0x5fc6('0x63');this[_0x5fc6('0x64')]=_0x5c3c4c;this['appdata']=_0x58244a;}function createVoicePrefixExtensions(_0x49ffb3,_0x487eee,_0x53a441){return new BPromise(function(_0x182b5e,_0x117614){var _0x599341=new Extension(formatPrefixName(_0x49ffb3[_0x5fc6('0x65')]),0x1,'NoOp','Voice\x20Prefix');_0x599341['VoicePrefixId']=_0x49ffb3['id'];return db[_0x5fc6('0x57')]['create'](_0x599341,{'transaction':_0x53a441})[_0x5fc6('0x2b')](function(_0x24c73f){var _0x377097=_0x24c73f['get']({'plain':!![]});var _0x2b73ab=_[_0x5fc6('0x34')](addVoicePrefixExtensions(_0x49ffb3,_0x487eee),function(_0x1f767d){_0x1f767d['VoiceExtensionId']=_0x377097['id'];_0x1f767d[_0x5fc6('0x66')]=_0x49ffb3['id'];return _0x1f767d;});return db[_0x5fc6('0x57')][_0x5fc6('0x67')](_0x2b73ab,{'transaction':_0x53a441})[_0x5fc6('0x2b')](function(_0x32842d){if(!_0x32842d){return _0x117614(_0x5fc6('0x68'));}else{return _0x182b5e(_0x32842d);}})[_0x5fc6('0x4c')](function(_0x3dfa9e){return _0x117614(_0x3dfa9e);});});;});};function addVoicePrefixExtensions(_0x4089d7,_0x408f03){var _0x176db6=[];var _0x3f9a6e=formatPrefixName(_0x4089d7[_0x5fc6('0x65')]);_0x176db6['push'](new Extension(_0x3f9a6e,0x2,_0x5fc6('0x69'),_0x5fc6('0x6a')+_0x4089d7[_0x5fc6('0x32')]));if(_0x4089d7[_0x5fc6('0x6b')]){_0x176db6[_0x5fc6('0x6c')](new Extension(_0x3f9a6e,0x3,_0x5fc6('0x69'),'PREFIX-CALLERIDALL='+_0x4089d7['callerIdAll']));}else{_0x176db6[_0x5fc6('0x6c')](new Extension(_0x3f9a6e,0x3,_0x5fc6('0x6d'),_0x5fc6('0x6e')));}_0x176db6[_0x5fc6('0x6c')](new Extension(_0x3f9a6e,0x4,'goto',_0x408f03[_0x5fc6('0x5e')]+','+_0x5fc6('0x6f')+(0x8+_0x4089d7[_0x5fc6('0x32')][_0x5fc6('0x3f')])+'}'+','+0x1));return _0x176db6;}function formatPrefixName(_0x3683fb){var _0x3c8e4a='_';for(var _0x5039b6=0x0;_0x5039b6<_0x3683fb[_0x5fc6('0x3f')];_0x5039b6++){if(_0x3683fb[_0x5fc6('0x70')](_0x5039b6)=='-'){_0x3c8e4a+=_0x3683fb[_0x5fc6('0x70')](_0x5039b6);}else{_0x3c8e4a+='['+_0x3683fb[_0x5fc6('0x70')](_0x5039b6)+']';}}_0x3c8e4a+='.';return _0x3c8e4a;}exports[_0x5fc6('0x2a')]=function(_0x50bf18,_0xbb348a,_0x145ffd){var _0x1aa902=_0x50bf18['body'];_0x1aa902[_0x5fc6('0x65')]=_0x5fc6('0x71')+_0x1aa902['name']+'-';return db[_0x5fc6('0x54')][_0x5fc6('0x55')](function(_0x4838c9){return db[_0x5fc6('0x50')][_0x5fc6('0x2a')](_0x1aa902,{'where':{'id':_0x1aa902['id']},'transaction':_0x4838c9})['then'](function(){return db[_0x5fc6('0x57')][_0x5fc6('0x2c')]({'where':{'VoicePrefixId':_0x1aa902['id']},'transaction':_0x4838c9})[_0x5fc6('0x2b')](function(){return db[_0x5fc6('0x57')]['find']({'where':{'id':_0x1aa902[_0x5fc6('0x58')]},'raw':!![]})[_0x5fc6('0x2b')](function(_0x248656){return createVoicePrefixExtensions(_0x1aa902,_0x248656,_0x4838c9);});});});})[_0x5fc6('0x2b')](function(){return db[_0x5fc6('0x50')][_0x5fc6('0x72')](_0x1aa902['id']);})[_0x5fc6('0x2b')](respondWithResult(_0xbb348a,null))['catch'](handleError(_0xbb348a,null));};exports['addAgents']=function(_0x2f8953,_0x11ee25,_0x1aa050){return db[_0x5fc6('0x50')][_0x5fc6('0x51')]({'where':{'id':_0x2f8953['params']['id']}})[_0x5fc6('0x2b')](handleEntityNotFound(_0x11ee25,null))[_0x5fc6('0x2b')](function(_0x3a041d){if(_0x3a041d){return _0x3a041d[_0x5fc6('0x73')](_0x2f8953['body'][_0x5fc6('0x74')],_[_0x5fc6('0x75')](_0x2f8953[_0x5fc6('0x76')],['ids','id'])||{})[_0x5fc6('0x77')](function(_0x279c74){for(var _0x210b76=0x0;_0x210b76<_0x2f8953[_0x5fc6('0x76')][_0x5fc6('0x74')][_0x5fc6('0x3f')];_0x210b76+=0x1){socket[_0x5fc6('0x78')](_0x5fc6('0x79'),{'UserId':_0x2f8953[_0x5fc6('0x76')][_0x5fc6('0x74')][_0x210b76],'VoicePrefixId':_0x2f8953[_0x5fc6('0x52')]['id']});}return _0x279c74;});}})['then'](respondWithResult(_0x11ee25,null))[_0x5fc6('0x4c')](handleError(_0x11ee25,null));};exports['removeAgents']=function(_0x5b6492,_0x39e517,_0x21519c){return db[_0x5fc6('0x50')][_0x5fc6('0x51')]({'where':{'id':_0x5b6492[_0x5fc6('0x52')]['id']}})[_0x5fc6('0x2b')](handleEntityNotFound(_0x39e517,null))[_0x5fc6('0x2b')](function(_0x4c0c5a){if(_0x4c0c5a){return _0x4c0c5a[_0x5fc6('0x7a')](_0x5b6492['query']['ids'])['then'](function(){if(_[_0x5fc6('0x7b')](_0x5b6492[_0x5fc6('0x3b')][_0x5fc6('0x74')])){for(var _0x77b4ab=0x0;_0x77b4ab<_0x5b6492[_0x5fc6('0x3b')][_0x5fc6('0x74')][_0x5fc6('0x3f')];_0x77b4ab+=0x1){socket['emit'](_0x5fc6('0x7c'),{'UserId':Number(_0x5b6492[_0x5fc6('0x3b')][_0x5fc6('0x74')][_0x77b4ab]),'VoicePrefixId':Number(_0x5b6492[_0x5fc6('0x52')]['id'])});}}else{socket[_0x5fc6('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x5b6492['query'][_0x5fc6('0x74')]),'VoicePrefixId':Number(_0x5b6492[_0x5fc6('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x39e517,null))['catch'](handleError(_0x39e517,null));};exports[_0x5fc6('0x7d')]=function(_0x556daa,_0x241e03,_0x3edd1a){var _0x5bcf85={};var _0x2129d4={};var _0x37d20c;var _0x37b2d6;return db[_0x5fc6('0x50')]['findOne']({'where':{'id':_0x556daa[_0x5fc6('0x52')]['id']}})[_0x5fc6('0x2b')](handleEntityNotFound(_0x241e03,null))[_0x5fc6('0x2b')](function(_0x48627f){if(_0x48627f){_0x37d20c=_0x48627f;_0x2129d4[_0x5fc6('0x39')]=_[_0x5fc6('0x3a')](db[_0x5fc6('0x7e')][_0x5fc6('0x35')]);_0x2129d4[_0x5fc6('0x3b')]=_['keys'](_0x556daa[_0x5fc6('0x3b')]);_0x2129d4[_0x5fc6('0x45')]=_[_0x5fc6('0x3c')](_0x2129d4[_0x5fc6('0x39')],_0x2129d4['query']);_0x5bcf85[_0x5fc6('0x3e')]=_[_0x5fc6('0x3c')](_0x2129d4[_0x5fc6('0x39')],qs['fields'](_0x556daa['query'][_0x5fc6('0x3d')]));_0x5bcf85[_0x5fc6('0x3e')]=_0x5bcf85[_0x5fc6('0x3e')]['length']?_0x5bcf85[_0x5fc6('0x3e')]:_0x2129d4[_0x5fc6('0x39')];_0x5bcf85['order']=qs[_0x5fc6('0x42')](_0x556daa[_0x5fc6('0x3b')][_0x5fc6('0x42')]);_0x5bcf85[_0x5fc6('0x43')]=qs[_0x5fc6('0x45')](_['pick'](_0x556daa[_0x5fc6('0x3b')],_0x2129d4['filters']));if(_0x556daa[_0x5fc6('0x3b')][_0x5fc6('0x48')]){_0x5bcf85['where']=_[_0x5fc6('0x46')](_0x5bcf85[_0x5fc6('0x43')],{'$or':_[_0x5fc6('0x34')](_0x5bcf85[_0x5fc6('0x3e')],function(_0x5167d8){var _0x17d49f={};_0x17d49f[_0x5167d8]={'$like':'%'+_0x556daa[_0x5fc6('0x3b')][_0x5fc6('0x48')]+'%'};return _0x17d49f;})});}_0x5bcf85=_[_0x5fc6('0x46')]({},_0x5bcf85,_0x556daa['options']);return _0x37d20c[_0x5fc6('0x7d')](_0x5bcf85);}})[_0x5fc6('0x2b')](function(_0x1da895){if(_0x1da895){_0x37b2d6=_0x1da895[_0x5fc6('0x3f')];if(!_0x556daa['query']['hasOwnProperty'](_0x5fc6('0x7f'))){_0x5bcf85[_0x5fc6('0x25')]=qs[_0x5fc6('0x25')](_0x556daa[_0x5fc6('0x3b')][_0x5fc6('0x25')]);_0x5bcf85[_0x5fc6('0x24')]=qs['offset'](_0x556daa['query']['offset']);}return _0x37d20c[_0x5fc6('0x7d')](_0x5bcf85);}})['then'](function(_0x3de8a1){if(_0x3de8a1){return _0x3de8a1?{'count':_0x37b2d6,'rows':_0x3de8a1}:null;}})[_0x5fc6('0x2b')](respondWithResult(_0x241e03,null))[_0x5fc6('0x4c')](handleError(_0x241e03,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5eb6c96..20eedcf 100644 --- a/server/api/voicePrefix/voicePrefix.events.js +++ b/server/api/voicePrefix/voicePrefix.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_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 +var _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xedd9,0xfc));var _0x9edd=function(_0x3deea3,_0x4a8f49){_0x3deea3=_0x3deea3-0x0;var _0x4ed13a=_0xedd9[_0x3deea3];return _0x4ed13a;};'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 6427b22..c9ba3f4 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 _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 +var _0x0ebc=['voice_prefixes','util','api','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x2b8e51,_0x15eff0){var _0x44958f=function(_0x558f27){while(--_0x558f27){_0x2b8e51['push'](_0x2b8e51['shift']());}};_0x44958f(++_0x15eff0);}(_0x0ebc,0xa1));var _0xc0eb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0ebc[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0xc0eb('0x0'));var logger=require('../../config/logger')(_0xc0eb('0x1'));var moment=require('moment');var BPromise=require(_0xc0eb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0eb('0x3'));var config=require(_0xc0eb('0x4'));var attributes=require(_0xc0eb('0x5'));module[_0xc0eb('0x6')]=function(_0x1dc7db,_0x32f082){return _0x1dc7db[_0xc0eb('0x7')](_0xc0eb('0x8'),attributes,{'tableName':_0xc0eb('0x9'),'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 4cc4991..fe53745 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 _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 +var _0xaf67=['../../config/environment','jayson/promise','client','redis','defaults','localhost','register','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xaf67,0x16f));var _0x7af6=function(_0x4976b7,_0xf674d7){_0x4976b7=_0x4976b7-0x0;var _0x23d1a7=_0xaf67[_0x4976b7];return _0x23d1a7;};'use strict';var _=require(_0x7af6('0x0'));var util=require(_0x7af6('0x1'));var moment=require('moment');var BPromise=require(_0x7af6('0x2'));var rs=require(_0x7af6('0x3'));var fs=require('fs');var Redis=require(_0x7af6('0x4'));var db=require(_0x7af6('0x5'))['db'];var utils=require(_0x7af6('0x6'));var logger=require('../../config/logger')(_0x7af6('0x7'));var config=require(_0x7af6('0x8'));var jayson=require(_0x7af6('0x9'));var client=jayson[_0x7af6('0xa')]['http']({'port':0x232a});config[_0x7af6('0xb')]=_[_0x7af6('0xc')](config['redis'],{'host':_0x7af6('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7af6('0xb')]));require('./voicePrefix.socket')[_0x7af6('0xe')](socket);function respondWithRpcPromise(_0x1a6a63,_0x419106,_0xecf873){return new BPromise(function(_0x204bb5,_0x54fc76){return client['request'](_0x1a6a63,_0xecf873)['then'](function(_0x154949){logger['info'](_0x7af6('0xf'),_0x419106,_0x7af6('0x10'));logger[_0x7af6('0x11')](_0x7af6('0x12'),_0x419106,_0x7af6('0x10'),JSON[_0x7af6('0x13')](_0x154949));if(_0x154949[_0x7af6('0x14')]){if(_0x154949['error'][_0x7af6('0x15')]===0x1f4){logger[_0x7af6('0x14')](_0x7af6('0xf'),_0x419106,_0x154949['error'][_0x7af6('0x16')]);return _0x54fc76(_0x154949[_0x7af6('0x14')]['message']);}logger[_0x7af6('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x419106,_0x154949[_0x7af6('0x14')][_0x7af6('0x16')]);return _0x204bb5(_0x154949[_0x7af6('0x14')][_0x7af6('0x16')]);}else{logger[_0x7af6('0x17')](_0x7af6('0xf'),_0x419106,_0x7af6('0x10'));_0x204bb5(_0x154949[_0x7af6('0x18')]['message']);}})['catch'](function(_0x317781){logger[_0x7af6('0x14')](_0x7af6('0xf'),_0x419106,_0x317781);_0x54fc76(_0x317781);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index ed88adf..c6ee1ff 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 _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 +var _0x26d9=['removeListener','register','length','voicePrefix:','./voicePrefix.events','remove','update','emit'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x26d9,0x1bc));var _0x926d=function(_0x3243f5,_0x39baf5){_0x3243f5=_0x3243f5-0x0;var _0x2ce826=_0x26d9[_0x3243f5];return _0x2ce826;};'use strict';var VoicePrefixEvents=require(_0x926d('0x0'));var events=['save',_0x926d('0x1'),_0x926d('0x2')];function createListener(_0x4727ab,_0x4f9013){return function(_0x458e82){_0x4f9013[_0x926d('0x3')](_0x4727ab,_0x458e82);};}function removeListener(_0xaa118b,_0x1e286c){return function(){VoicePrefixEvents[_0x926d('0x4')](_0xaa118b,_0x1e286c);};}exports[_0x926d('0x5')]=function(_0x1777e7){for(var _0x17e165=0x0,_0x5c8ced=events[_0x926d('0x6')];_0x17e165<_0x5c8ced;_0x17e165++){var _0x214990=events[_0x17e165];var _0x194539=createListener(_0x926d('0x7')+_0x214990,_0x1777e7);VoicePrefixEvents['on'](_0x214990,_0x194539);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 84aa8a0..41e1ac9 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 _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 +var _0x2708=['/:id/teams','getTeams','/:id/users','getAgents','getMembers','/:id/lists','getLists','post','/:id/clone','clone','addAgents','addLists','/:id/blacklists','put','/:id','destroy','delete','removeAgents','removeBlackLists','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','index','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2708,0x190));var _0x8270=function(_0x35032c,_0x3f2450){_0x35032c=_0x35032c-0x0;var _0x5d7d0b=_0x2708[_0x35032c];return _0x5d7d0b;};'use strict';var multer=require(_0x8270('0x0'));var util=require(_0x8270('0x1'));var path=require(_0x8270('0x2'));var timeout=require(_0x8270('0x3'));var express=require('express');var router=express[_0x8270('0x4')]();var auth=require(_0x8270('0x5'));var interaction=require(_0x8270('0x6'));var config=require('../../config/environment');var controller=require(_0x8270('0x7'));router[_0x8270('0x8')]('/',auth['isAuthenticated'](),controller[_0x8270('0x9')]);router[_0x8270('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8270('0xa'),auth[_0x8270('0xb')](),controller[_0x8270('0xc')]);router['get'](_0x8270('0xd'),auth[_0x8270('0xb')](),controller[_0x8270('0xe')]);router[_0x8270('0x8')](_0x8270('0xf'),auth[_0x8270('0xb')](),controller[_0x8270('0x10')]);router[_0x8270('0x8')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x8270('0x11')]);router[_0x8270('0x8')](_0x8270('0x12'),auth[_0x8270('0xb')](),controller[_0x8270('0x13')]);router[_0x8270('0x8')](_0x8270('0x14'),auth[_0x8270('0xb')](),controller[_0x8270('0x15')]);router[_0x8270('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x8270('0x16')]);router['get'](_0x8270('0x17'),auth['isAuthenticated'](),controller[_0x8270('0x18')]);router[_0x8270('0x8')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0x8270('0x19')]('/',auth[_0x8270('0xb')](),controller['create']);router[_0x8270('0x19')](_0x8270('0x1a'),auth[_0x8270('0xb')](),controller[_0x8270('0x1b')]);router['post'](_0x8270('0x12'),auth[_0x8270('0xb')](),controller['addTeams']);router[_0x8270('0x19')](_0x8270('0x14'),auth[_0x8270('0xb')](),controller[_0x8270('0x1c')]);router[_0x8270('0x19')](_0x8270('0x17'),auth[_0x8270('0xb')](),controller[_0x8270('0x1d')]);router[_0x8270('0x19')](_0x8270('0x1e'),auth[_0x8270('0xb')](),controller['addBlackLists']);router[_0x8270('0x1f')](_0x8270('0x20'),auth[_0x8270('0xb')](),controller['update']);router['delete'](_0x8270('0x20'),auth[_0x8270('0xb')](),controller[_0x8270('0x21')]);router[_0x8270('0x22')](_0x8270('0x12'),auth[_0x8270('0xb')](),controller['removeTeams']);router[_0x8270('0x22')](_0x8270('0x14'),auth[_0x8270('0xb')](),controller[_0x8270('0x23')]);router[_0x8270('0x22')](_0x8270('0x17'),auth['isAuthenticated'](),controller['removeLists']);router[_0x8270('0x22')]('/:id/blacklists',auth[_0x8270('0xb')](),controller[_0x8270('0x24')]);module[_0x8270('0x25')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 89a048c..94954cf 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(_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 +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(_0x20ea26,_0x5512f8){var _0xcbc4d7=function(_0x160a5d){while(--_0x160a5d){_0x20ea26['push'](_0x20ea26['shift']());}};_0xcbc4d7(++_0x5512f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 510b8bc..0207137 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','every','all','union','compact','transaction','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','omit','spread','userVoiceQueue:save','push','isArray','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','value','includes','type','find','UserProfileResource','end','error','name','send','index','VoiceQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','rows','catch','show','params','length','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','outbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','role','UserProfileSection','getHoppers','findOne','VoiceQueueId','CmHopper','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','removeTeams','ids','select'];(function(_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 +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(_0xe2d5da,_0xdcf6e0){var _0x5b8cd9=function(_0x37988b){while(--_0x37988b){_0xe2d5da['push'](_0xe2d5da['shift']());}};_0x5b8cd9(++_0xdcf6e0);}(_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 diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5e4ae61..7d85553 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 _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 +var _0x5a7f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x3c09e8,_0x4eacdc){var _0x539150=function(_0x343f56){while(--_0x343f56){_0x3c09e8['push'](_0x3c09e8['shift']());}};_0x539150(++_0x4eacdc);}(_0x5a7f,0xfe));var _0xf5a7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5a7f[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0xf5a7('0x0'));var VoiceQueue=require(_0xf5a7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf5a7('0x2')](0x0);var events={'afterCreate':_0xf5a7('0x3'),'afterUpdate':_0xf5a7('0x4'),'afterDestroy':_0xf5a7('0x5')};function emitEvent(_0x40c039){return function(_0x5012b1,_0x5717f3,_0x4a293a){VoiceQueueEvents['emit'](_0x40c039+':'+_0x5012b1['id'],_0x5012b1);VoiceQueueEvents[_0xf5a7('0x6')](_0x40c039,_0x5012b1);_0x4a293a(null);};}for(var e in events){if(events[_0xf5a7('0x7')](e)){var event=events[e];VoiceQueue[_0xf5a7('0x8')](e,emitEvent(event));}}module[_0xf5a7('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 5e39857..4c9c811 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 _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 +var _0xd4de=['api','moment','bluebird','path','./voiceQueue.attributes','exports','VoiceQueue','lodash','util','../../config/logger'];(function(_0x2fe72f,_0x2fc902){var _0xb8b0f2=function(_0x36c100){while(--_0x36c100){_0x2fe72f['push'](_0x2fe72f['shift']());}};_0xb8b0f2(++_0x2fc902);}(_0xd4de,0x101));var _0xed4d=function(_0xb91080,_0x4352a7){_0xb91080=_0xb91080-0x0;var _0x2e0dcc=_0xd4de[_0xb91080];return _0x2e0dcc;};'use strict';var _=require(_0xed4d('0x0'));var util=require(_0xed4d('0x1'));var logger=require(_0xed4d('0x2'))(_0xed4d('0x3'));var moment=require(_0xed4d('0x4'));var BPromise=require(_0xed4d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xed4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed4d('0x7'));module[_0xed4d('0x8')]=function(_0x33d57c,_0x5c3650){return _0x33d57c['define'](_0xed4d('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a645ab2..8357973 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 _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 +var _0x9abe=['VoiceQueue','findAll','options','where','limit','include','map','model','attributes','then','ShowVoiceQueue','find','raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue'];(function(_0x2652ef,_0x234230){var _0x2db578=function(_0x56b137){while(--_0x56b137){_0x2652ef['push'](_0x2652ef['shift']());}};_0x2db578(++_0x234230);}(_0x9abe,0x1db));var _0xe9ab=function(_0x36b776,_0x5c5c76){_0x36b776=_0x36b776-0x0;var _0x36cbec=_0x9abe[_0x36b776];return _0x36cbec;};'use strict';var _=require('lodash');var util=require(_0xe9ab('0x0'));var moment=require(_0xe9ab('0x1'));var BPromise=require(_0xe9ab('0x2'));var rs=require(_0xe9ab('0x3'));var fs=require('fs');var Redis=require(_0xe9ab('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe9ab('0x5'));var logger=require(_0xe9ab('0x6'))(_0xe9ab('0x7'));var config=require(_0xe9ab('0x8'));var jayson=require(_0xe9ab('0x9'));var client=jayson[_0xe9ab('0xa')][_0xe9ab('0xb')]({'port':0x232a});config[_0xe9ab('0xc')]=_[_0xe9ab('0xd')](config['redis'],{'host':_0xe9ab('0xe'),'port':0x18eb});var socket=require(_0xe9ab('0xf'))(new Redis(config[_0xe9ab('0xc')]));require(_0xe9ab('0x10'))[_0xe9ab('0x11')](socket);function respondWithRpcPromise(_0x36f2f6,_0x1ea35d,_0x5607df){return new BPromise(function(_0x5cee77,_0x3e0d07){return client[_0xe9ab('0x12')](_0x36f2f6,_0x5607df)['then'](function(_0x27dfa7){logger[_0xe9ab('0x13')](_0xe9ab('0x14'),_0x1ea35d,_0xe9ab('0x15'));logger[_0xe9ab('0x16')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1ea35d,_0xe9ab('0x15'),JSON[_0xe9ab('0x17')](_0x27dfa7));if(_0x27dfa7[_0xe9ab('0x18')]){if(_0x27dfa7[_0xe9ab('0x18')][_0xe9ab('0x19')]===0x1f4){logger[_0xe9ab('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x1ea35d,_0x27dfa7[_0xe9ab('0x18')][_0xe9ab('0x1a')]);return _0x3e0d07(_0x27dfa7[_0xe9ab('0x18')][_0xe9ab('0x1a')]);}logger[_0xe9ab('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x1ea35d,_0x27dfa7[_0xe9ab('0x18')][_0xe9ab('0x1a')]);return _0x5cee77(_0x27dfa7[_0xe9ab('0x18')]['message']);}else{logger[_0xe9ab('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x1ea35d,_0xe9ab('0x15'));_0x5cee77(_0x27dfa7['result']['message']);}})[_0xe9ab('0x1b')](function(_0xdd04e7){logger[_0xe9ab('0x18')](_0xe9ab('0x14'),_0x1ea35d,_0xdd04e7);_0x3e0d07(_0xdd04e7);});});}exports[_0xe9ab('0x1c')]=function(_0x2b2081){var _0xce86f9=this;return new Promise(function(_0x4b10f2,_0x236c1f){return db[_0xe9ab('0x1d')][_0xe9ab('0x1e')]({'raw':_0x2b2081[_0xe9ab('0x1f')]?_0x2b2081[_0xe9ab('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2b2081['options']?_0x2b2081[_0xe9ab('0x1f')][_0xe9ab('0x20')]||null:null,'attributes':_0x2b2081[_0xe9ab('0x1f')]?_0x2b2081['options']['attributes']||null:null,'limit':_0x2b2081[_0xe9ab('0x1f')]?_0x2b2081[_0xe9ab('0x1f')][_0xe9ab('0x21')]||null:null,'include':_0x2b2081['options']?_0x2b2081[_0xe9ab('0x1f')][_0xe9ab('0x22')]?_[_0xe9ab('0x23')](_0x2b2081['options'][_0xe9ab('0x22')],function(_0x1d561a){return{'model':db[_0x1d561a[_0xe9ab('0x24')]],'as':_0x1d561a['as'],'attributes':_0x1d561a[_0xe9ab('0x25')],'include':_0x1d561a[_0xe9ab('0x22')]?_['map'](_0x1d561a['include'],function(_0x3fd2f1){return{'model':db[_0x3fd2f1[_0xe9ab('0x24')]],'as':_0x3fd2f1['as'],'attributes':_0x3fd2f1[_0xe9ab('0x25')],'include':_0x3fd2f1[_0xe9ab('0x22')]?_['map'](_0x3fd2f1['include'],function(_0x530bed){return{'model':db[_0x530bed['model']],'as':_0x530bed['as'],'attributes':_0x530bed['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9ab('0x26')](function(_0x4488d0){logger[_0xe9ab('0x13')]('GetVoiceQueue',_0x2b2081);logger[_0xe9ab('0x16')](_0xe9ab('0x1c'),_0x2b2081,JSON[_0xe9ab('0x17')](_0x4488d0));_0x4b10f2(_0x4488d0);})[_0xe9ab('0x1b')](function(_0x29e4ac){logger[_0xe9ab('0x18')](_0xe9ab('0x1c'),_0x29e4ac[_0xe9ab('0x1a')],_0x2b2081);_0x236c1f(_0xce86f9[_0xe9ab('0x18')](0x1f4,_0x29e4ac[_0xe9ab('0x1a')]));});});};exports[_0xe9ab('0x27')]=function(_0x470890){var _0x4fdf49=this;return new Promise(function(_0x16c5a3,_0x498dca){return db[_0xe9ab('0x1d')][_0xe9ab('0x28')]({'raw':_0x470890[_0xe9ab('0x1f')]?_0x470890[_0xe9ab('0x1f')][_0xe9ab('0x29')]===undefined?!![]:![]:!![],'where':_0x470890['options']?_0x470890[_0xe9ab('0x1f')][_0xe9ab('0x20')]||null:null,'attributes':_0x470890[_0xe9ab('0x1f')]?_0x470890['options'][_0xe9ab('0x25')]||null:null,'include':_0x470890['options']?_0x470890[_0xe9ab('0x1f')][_0xe9ab('0x22')]?_[_0xe9ab('0x23')](_0x470890[_0xe9ab('0x1f')]['include'],function(_0x298be3){return{'model':db[_0x298be3[_0xe9ab('0x24')]],'as':_0x298be3['as'],'attributes':_0x298be3[_0xe9ab('0x25')],'include':_0x298be3['include']?_[_0xe9ab('0x23')](_0x298be3[_0xe9ab('0x22')],function(_0xe9c6d5){return{'model':db[_0xe9c6d5[_0xe9ab('0x24')]],'as':_0xe9c6d5['as'],'attributes':_0xe9c6d5[_0xe9ab('0x25')],'include':_0xe9c6d5['include']?_[_0xe9ab('0x23')](_0xe9c6d5[_0xe9ab('0x22')],function(_0x50fde7){return{'model':db[_0x50fde7[_0xe9ab('0x24')]],'as':_0x50fde7['as'],'attributes':_0x50fde7[_0xe9ab('0x25')]};}):[]};}):[]};}):[]:[]})[_0xe9ab('0x26')](function(_0x2a7452){logger['info'](_0xe9ab('0x27'),_0x470890);logger[_0xe9ab('0x16')](_0xe9ab('0x27'),_0x470890,JSON[_0xe9ab('0x17')](_0x2a7452));_0x16c5a3(_0x2a7452);})[_0xe9ab('0x1b')](function(_0x5d9551){logger[_0xe9ab('0x18')](_0xe9ab('0x27'),_0x5d9551[_0xe9ab('0x1a')],_0x470890);_0x498dca(_0x4fdf49[_0xe9ab('0x18')](0x1f4,_0x5d9551['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index a801184..b4e05de 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 _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 +var _0x99dc=['register','./voiceQueue.events','save','remove','update','emit','removeListener'];(function(_0x269fe8,_0x4ec3fe){var _0x59c0a5=function(_0x49f010){while(--_0x49f010){_0x269fe8['push'](_0x269fe8['shift']());}};_0x59c0a5(++_0x4ec3fe);}(_0x99dc,0xa2));var _0xc99d=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x99dc[_0x3e6d5d];return _0x238923;};'use strict';var VoiceQueueEvents=require(_0xc99d('0x0'));var events=[_0xc99d('0x1'),_0xc99d('0x2'),_0xc99d('0x3')];function createListener(_0x2c1301,_0x3e6719){return function(_0x24f8c0){_0x3e6719[_0xc99d('0x4')](_0x2c1301,_0x24f8c0);};}function removeListener(_0x4913cf,_0x287aac){return function(){VoiceQueueEvents[_0xc99d('0x5')](_0x4913cf,_0x287aac);};}exports[_0xc99d('0x6')]=function(_0x2c863b){for(var _0x2734ce=0x0,_0x4f508f=events['length'];_0x2734ce<_0x4f508f;_0x2734ce++){var _0x4c594b=events[_0x2734ce];var _0x359195=createListener('voiceQueue:'+_0x4c594b,_0x2c863b);VoiceQueueEvents['on'](_0x4c594b,_0x359195);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7a6f44c..2ff9423 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 _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 +var _0x38b8=['exports','multer','path','connect-timeout','Router','../../config/environment','./voiceQueueReport.controller','index','get','isAuthenticated','describe','getVoiceQueuesReport','post','create','put','/:id','delete','destroy'];(function(_0x765fc,_0x233557){var _0x5e1936=function(_0x32a2c5){while(--_0x32a2c5){_0x765fc['push'](_0x765fc['shift']());}};_0x5e1936(++_0x233557);}(_0x38b8,0x7f));var _0x838b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x38b8[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x838b('0x0'));var util=require('util');var path=require(_0x838b('0x1'));var timeout=require(_0x838b('0x2'));var express=require('express');var router=express[_0x838b('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x838b('0x4'));var controller=require(_0x838b('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x838b('0x6')]);router[_0x838b('0x7')]('/describe',auth[_0x838b('0x8')](),controller[_0x838b('0x9')]);router['get']('/index',auth[_0x838b('0x8')](),controller[_0x838b('0xa')]);router[_0x838b('0x7')]('/:id',auth[_0x838b('0x8')](),controller['show']);router[_0x838b('0xb')]('/',auth[_0x838b('0x8')](),controller[_0x838b('0xc')]);router[_0x838b('0xd')](_0x838b('0xe'),auth[_0x838b('0x8')](),controller['update']);router[_0x838b('0xf')](_0x838b('0xe'),auth[_0x838b('0x8')](),controller[_0x838b('0x10')]);module[_0x838b('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ee689d1..80172dd 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.attributes.js +++ b/server/api/voiceQueueReport/voiceQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','seconds'];(function(_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 +var _0x0713=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x4b2ed7,_0x5b3100){var _0x55a953=function(_0x4b7abd){while(--_0x4b7abd){_0x4b2ed7['push'](_0x4b2ed7['shift']());}};_0x55a953(++_0x5b3100);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x3071('0x0')]={'type':{'type':Sequelize[_0x3071('0x1')]},'uniqueid':{'type':Sequelize[_0x3071('0x1')]},'calleridnum':{'type':Sequelize[_0x3071('0x1')]},'calleridname':{'type':Sequelize[_0x3071('0x1')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x3071('0x2')],'set':function(_0x33a70c){var _0x3137c8=moment(_0x33a70c);var _0xabd7b6=moment(this[_0x3071('0x3')](_0x3071('0x4')))[_0x3071('0x5')](_0x3071('0x6'));var _0x22274c=_0x3137c8[_0x3071('0x7')](_0xabd7b6,_0x3071('0x8'));this[_0x3071('0x9')]('queuecallerleaveAt',_0x33a70c);this[_0x3071('0x9')](_0x3071('0xa'),_0x22274c||null);}},'position':{'type':Sequelize[_0x3071('0xb')]},'count':{'type':Sequelize[_0x3071('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexit':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3071('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0x3071('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3071('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3071('0x1')]},'accountcode':{'type':Sequelize[_0x3071('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3071('0x1')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3071('0xb')]},'mohtime':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3071('0x1')]},'transfer':{'type':Sequelize[_0x3071('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3071('0x1')],'comment':_0x3071('0xd')},'transferexten':{'type':Sequelize[_0x3071('0x1')]},'transferuniqueid':{'type':Sequelize[_0x3071('0x1')]},'disposition':{'type':Sequelize[_0x3071('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3071('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x3071('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 65e3521..d24380d 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(_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 +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(_0x1f4204,_0x246087){var _0x417d82=function(_0x16646e){while(--_0x16646e){_0x1f4204['push'](_0x1f4204['shift']());}};_0x417d82(++_0x246087);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 726ccc0..eb293aa 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 _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 +var _0x2c8b=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x35e39e,_0x9614b9){var _0x4a1159=function(_0x1e7381){while(--_0x1e7381){_0x35e39e['push'](_0x35e39e['shift']());}};_0x4a1159(++_0x9614b9);}(_0x2c8b,0x155));var _0xb2c8=function(_0x17d6ec,_0x2cf267){_0x17d6ec=_0x17d6ec-0x0;var _0x19baf8=_0x2c8b[_0x17d6ec];return _0x19baf8;};'use strict';var EventEmitter=require(_0xb2c8('0x0'));var VoiceQueueReport=require(_0xb2c8('0x1'))['db'][_0xb2c8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xb2c8('0x3')](0x0);var events={'afterCreate':_0xb2c8('0x4'),'afterUpdate':'update','afterDestroy':_0xb2c8('0x5')};function emitEvent(_0x2b02ae){return function(_0xb28071,_0x464b57,_0x44bc9b){VoiceQueueReportEvents[_0xb2c8('0x6')](_0x2b02ae+':'+_0xb28071['id'],_0xb28071);VoiceQueueReportEvents[_0xb2c8('0x6')](_0x2b02ae,_0xb28071);_0x44bc9b(null);};}for(var e in events){if(events[_0xb2c8('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xb2c8('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 91b0ed7..61aa26b 100644 --- a/server/api/voiceQueueReport/voiceQueueReport.model.js +++ b/server/api/voiceQueueReport/voiceQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['VoiceQueueReport','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceQueueReport.attributes','exports','define'];(function(_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 +var _0x757a=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','util','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0x3f4583,_0x56ad0b){var _0x3b6ba9=function(_0x2271da){while(--_0x2271da){_0x3f4583['push'](_0x3f4583['shift']());}};_0x3b6ba9(++_0x56ad0b);}(_0x757a,0xde));var _0xa757=function(_0x16e7f4,_0x1f2c0a){_0x16e7f4=_0x16e7f4-0x0;var _0x3e5039=_0x757a[_0x16e7f4];return _0x3e5039;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'fields':[_0xa757('0xa')]},{'fields':[_0xa757('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 783f9c7..e872955 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 _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 +var _0xc289=['localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','debug','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x3b510a,_0x5bde5c){var _0x28a77f=function(_0xe1018c){while(--_0xe1018c){_0x3b510a['push'](_0x3b510a['shift']());}};_0x28a77f(++_0x5bde5c);}(_0xc289,0x7c));var _0x9c28=function(_0x5d6da1,_0x46ced7){_0x5d6da1=_0x5d6da1-0x0;var _0x91b913=_0xc289[_0x5d6da1];return _0x91b913;};'use strict';var _=require(_0x9c28('0x0'));var util=require('util');var moment=require(_0x9c28('0x1'));var BPromise=require(_0x9c28('0x2'));var rs=require(_0x9c28('0x3'));var fs=require('fs');var Redis=require(_0x9c28('0x4'));var db=require(_0x9c28('0x5'))['db'];var utils=require(_0x9c28('0x6'));var logger=require(_0x9c28('0x7'))(_0x9c28('0x8'));var config=require(_0x9c28('0x9'));var jayson=require(_0x9c28('0xa'));var client=jayson['client'][_0x9c28('0xb')]({'port':0x232a});config[_0x9c28('0xc')]=_[_0x9c28('0xd')](config[_0x9c28('0xc')],{'host':_0x9c28('0xe'),'port':0x18eb});var socket=require(_0x9c28('0xf'))(new Redis(config[_0x9c28('0xc')]));require('./voiceQueueReport.socket')[_0x9c28('0x10')](socket);function respondWithRpcPromise(_0x16dad9,_0x8e2ba6,_0x45bc28){return new BPromise(function(_0x4c1c56,_0x3229f5){return client[_0x9c28('0x11')](_0x16dad9,_0x45bc28)[_0x9c28('0x12')](function(_0x277d69){logger[_0x9c28('0x13')](_0x9c28('0x14'),_0x8e2ba6,'request\x20sent');logger['debug'](_0x9c28('0x15'),_0x8e2ba6,_0x9c28('0x16'),JSON[_0x9c28('0x17')](_0x277d69));if(_0x277d69['error']){if(_0x277d69[_0x9c28('0x18')][_0x9c28('0x19')]===0x1f4){logger[_0x9c28('0x18')](_0x9c28('0x14'),_0x8e2ba6,_0x277d69['error'][_0x9c28('0x1a')]);return _0x3229f5(_0x277d69['error'][_0x9c28('0x1a')]);}logger[_0x9c28('0x18')](_0x9c28('0x14'),_0x8e2ba6,_0x277d69[_0x9c28('0x18')][_0x9c28('0x1a')]);return _0x4c1c56(_0x277d69[_0x9c28('0x18')]['message']);}else{logger[_0x9c28('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x8e2ba6,_0x9c28('0x16'));_0x4c1c56(_0x277d69[_0x9c28('0x1b')][_0x9c28('0x1a')]);}})[_0x9c28('0x1c')](function(_0x33d677){logger[_0x9c28('0x18')](_0x9c28('0x14'),_0x8e2ba6,_0x33d677);_0x3229f5(_0x33d677);});});}exports[_0x9c28('0x1d')]=function(_0x3c3102){var _0x4888ec=this;return new Promise(function(_0x312c9e,_0x53064b){return db['VoiceQueueReport'][_0x9c28('0x1e')]({'raw':_0x3c3102['options']?_0x3c3102[_0x9c28('0x1f')][_0x9c28('0x20')]===undefined?!![]:![]:!![],'where':_0x3c3102['options']?_0x3c3102[_0x9c28('0x1f')][_0x9c28('0x21')]||null:null,'attributes':_0x3c3102['options']?_0x3c3102[_0x9c28('0x1f')][_0x9c28('0x22')]||null:null,'limit':_0x3c3102['options']?_0x3c3102[_0x9c28('0x1f')][_0x9c28('0x23')]||null:null,'include':_0x3c3102[_0x9c28('0x1f')]?_0x3c3102[_0x9c28('0x1f')]['include']?_['map'](_0x3c3102[_0x9c28('0x1f')][_0x9c28('0x24')],function(_0x173cdf){return{'model':db[_0x173cdf[_0x9c28('0x25')]],'as':_0x173cdf['as'],'attributes':_0x173cdf['attributes'],'include':_0x173cdf[_0x9c28('0x24')]?_['map'](_0x173cdf[_0x9c28('0x24')],function(_0x500367){return{'model':db[_0x500367['model']],'as':_0x500367['as'],'attributes':_0x500367[_0x9c28('0x22')],'include':_0x500367[_0x9c28('0x24')]?_[_0x9c28('0x26')](_0x500367[_0x9c28('0x24')],function(_0x249110){return{'model':db[_0x249110[_0x9c28('0x25')]],'as':_0x249110['as'],'attributes':_0x249110[_0x9c28('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9c28('0x12')](function(_0x1914b5){logger[_0x9c28('0x13')](_0x9c28('0x1d'),_0x3c3102);logger[_0x9c28('0x27')]('GetVoiceQueueReport',_0x3c3102,JSON[_0x9c28('0x17')](_0x1914b5));_0x312c9e(_0x1914b5);})['catch'](function(_0x796c3b){logger[_0x9c28('0x18')]('GetVoiceQueueReport',_0x796c3b[_0x9c28('0x1a')],_0x3c3102);_0x53064b(_0x4888ec[_0x9c28('0x18')](0x1f4,_0x796c3b['message']));});});};exports[_0x9c28('0x28')]=function(_0xe46fab){var _0x4338bb=this;return new Promise(function(_0x193c69,_0x22eda8){return db[_0x9c28('0x29')][_0x9c28('0x2a')](_0xe46fab[_0x9c28('0x2b')],{'raw':_0xe46fab['options']?_0xe46fab[_0x9c28('0x1f')][_0x9c28('0x20')]===undefined?!![]:![]:!![]})[_0x9c28('0x12')](function(_0x4d315b){logger['info'](_0x9c28('0x28'),_0xe46fab);logger[_0x9c28('0x27')](_0x9c28('0x28'),_0xe46fab,JSON['stringify'](_0x4d315b));_0x193c69(_0x4d315b);})['catch'](function(_0x184981){logger['error'](_0x9c28('0x28'),_0x184981[_0x9c28('0x1a')],_0xe46fab);_0x22eda8(_0x4338bb[_0x9c28('0x18')](0x1f4,_0x184981['message']));});});};exports[_0x9c28('0x2c')]=function(_0x5a47c6){var _0x7207bc=this;return new Promise(function(_0x3f1998,_0x2667b4){return db[_0x9c28('0x29')][_0x9c28('0x2d')](_0x5a47c6[_0x9c28('0x2b')],{'raw':_0x5a47c6['options']?_0x5a47c6['options'][_0x9c28('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a47c6[_0x9c28('0x1f')]?_0x5a47c6[_0x9c28('0x1f')]['where']||null:null,'attributes':_0x5a47c6[_0x9c28('0x1f')]?_0x5a47c6[_0x9c28('0x1f')][_0x9c28('0x22')]||null:null,'limit':_0x5a47c6[_0x9c28('0x1f')]?_0x5a47c6['options'][_0x9c28('0x23')]||null:null})[_0x9c28('0x12')](function(_0x117027){logger['info'](_0x9c28('0x2c'),_0x5a47c6);logger[_0x9c28('0x27')](_0x9c28('0x2c'),_0x5a47c6,JSON[_0x9c28('0x17')](_0x117027));_0x3f1998(_0x117027);})[_0x9c28('0x1c')](function(_0x1e71d9){logger[_0x9c28('0x18')](_0x9c28('0x2c'),_0x1e71d9[_0x9c28('0x1a')],_0x5a47c6);_0x2667b4(_0x7207bc['error'](0x1f4,_0x1e71d9['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 590e02c..b7c0ce9 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 _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 +var _0x2b1f=['update','removeListener','register','length','voiceQueueReport:','save'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x2b1f,0x1df));var _0xf2b1=function(_0x24689f,_0x4fff42){_0x24689f=_0x24689f-0x0;var _0x2c1c51=_0x2b1f[_0x24689f];return _0x2c1c51;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xf2b1('0x0'),'remove',_0xf2b1('0x1')];function createListener(_0x3ccd27,_0x13add7){return function(_0x4395f2){_0x13add7['emit'](_0x3ccd27,_0x4395f2);};}function removeListener(_0x1ed8be,_0xb44e36){return function(){VoiceQueueReportEvents[_0xf2b1('0x2')](_0x1ed8be,_0xb44e36);};}exports[_0xf2b1('0x3')]=function(_0x404e3f){for(var _0x4532bf=0x0,_0x42f38f=events[_0xf2b1('0x4')];_0x4532bf<_0x42f38f;_0x4532bf++){var _0x2f2b44=events[_0x4532bf];var _0x139661=createListener(_0xf2b1('0x5')+_0x2f2b44,_0x404e3f);VoiceQueueReportEvents['on'](_0x2f2b44,_0x139661);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 252751c..30725ea 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 _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 +var _0x7eea=['isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','post'];(function(_0x282f96,_0x2be4be){var _0x12d02b=function(_0x51cc9d){while(--_0x51cc9d){_0x282f96['push'](_0x282f96['shift']());}};_0x12d02b(++_0x2be4be);}(_0x7eea,0x7e));var _0xa7ee=function(_0x1d7a33,_0x1223d9){_0x1d7a33=_0x1d7a33-0x0;var _0x2448ae=_0x7eea[_0x1d7a33];return _0x2448ae;};'use strict';var multer=require(_0xa7ee('0x0'));var util=require(_0xa7ee('0x1'));var path=require(_0xa7ee('0x2'));var timeout=require(_0xa7ee('0x3'));var express=require(_0xa7ee('0x4'));var router=express[_0xa7ee('0x5')]();var auth=require(_0xa7ee('0x6'));var interaction=require(_0xa7ee('0x7'));var config=require(_0xa7ee('0x8'));var controller=require(_0xa7ee('0x9'));router[_0xa7ee('0xa')]('/',auth['isAuthenticated'](),controller[_0xa7ee('0xb')]);router[_0xa7ee('0xa')](_0xa7ee('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xa7ee('0xd')]('/',auth[_0xa7ee('0xe')](),controller['create']);router[_0xa7ee('0xf')]('/:id',auth[_0xa7ee('0xe')](),controller[_0xa7ee('0x10')]);router[_0xa7ee('0x11')](_0xa7ee('0xc'),auth[_0xa7ee('0xe')](),controller[_0xa7ee('0x12')]);module[_0xa7ee('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6e93b50..393d3d4 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 _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 +var _0x5c41=['STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x2a78d9,_0x271b92){var _0x293145=function(_0x164b12){while(--_0x164b12){_0x2a78d9['push'](_0x2a78d9['shift']());}};_0x293145(++_0x271b92);}(_0x5c41,0x159));var _0x15c4=function(_0x1b09a8,_0x231b0a){_0x1b09a8=_0x1b09a8-0x0;var _0x3fd46a=_0x5c41[_0x1b09a8];return _0x3fd46a;};'use strict';var Sequelize=require(_0x15c4('0x0'));var moment=require(_0x15c4('0x1'));module[_0x15c4('0x2')]={'time':{'type':Sequelize[_0x15c4('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x15c4('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x15c4('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x15c4('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x15c4('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x15c4('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x15c4('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x15c4('0x4')](_0x15c4('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 19b2834..2599296 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 _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 +var _0xba03=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','VoiceQueuesLog','includeAll','include','rows','catch','params','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x18afcd,_0x4dc5f3){var _0x109c04=function(_0xe26eb2){while(--_0xe26eb2){_0x18afcd['push'](_0x18afcd['shift']());}};_0x109c04(++_0x4dc5f3);}(_0xba03,0x1df));var _0x3ba0=function(_0x24d9b7,_0xf5a33a){_0x24d9b7=_0x24d9b7-0x0;var _0x1f8c21=_0xba03[_0x24d9b7];return _0x1f8c21;};'use strict';var pdf=require(_0x3ba0('0x0'));var emlformat=require(_0x3ba0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3ba0('0x2'));var jsonpatch=require(_0x3ba0('0x3'));var rp=require(_0x3ba0('0x4'));var moment=require(_0x3ba0('0x5'));var BPromise=require(_0x3ba0('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3ba0('0x7'));var csv=require('to-csv');var ejs=require(_0x3ba0('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3ba0('0x9'));var crypto=require(_0x3ba0('0xa'));var jsforce=require(_0x3ba0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3ba0('0xc'));var querystring=require(_0x3ba0('0xd'));var Papa=require(_0x3ba0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ba0('0xf'));var as=require(_0x3ba0('0x10'));var hardwareService=require(_0x3ba0('0x11'));var logger=require('../../config/logger')(_0x3ba0('0x12'));var utils=require(_0x3ba0('0x13'));var config=require(_0x3ba0('0x14'));var licenseUtil=require(_0x3ba0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e91e6,_0x4d4aef){_0x4d4aef=_0x4d4aef||0xcc;return function(_0x4d399b){if(_0x4d399b){return _0x3e91e6[_0x3ba0('0x16')](_0x4d4aef);}return _0x3e91e6[_0x3ba0('0x17')](_0x4d4aef)[_0x3ba0('0x18')]();};}function respondWithResult(_0x5c0750,_0x383b4c){_0x383b4c=_0x383b4c||0xc8;return function(_0x388070){if(_0x388070){return _0x5c0750[_0x3ba0('0x17')](_0x383b4c)['json'](_0x388070);}};}function respondWithFilteredResult(_0x25276f,_0x27ad80){return function(_0x318ec1){if(_0x318ec1){var _0xa4012c=_0x318ec1[_0x3ba0('0x19')],_0x1cc516=_0x27ad80[_0x3ba0('0x1a')],_0xefdafa=_0x27ad80[_0x3ba0('0x1a')]+_0x27ad80[_0x3ba0('0x1b')],_0x4aaf0f;if(_0xefdafa>=_0xa4012c){_0xefdafa=_0xa4012c;_0x4aaf0f=0xc8;}else{_0x4aaf0f=0xce;}_0x25276f[_0x3ba0('0x17')](_0x4aaf0f);return _0x25276f[_0x3ba0('0x1c')](_0x3ba0('0x1d'),_0x1cc516+'-'+_0xefdafa+'/'+_0xa4012c)[_0x3ba0('0x1e')](_0x318ec1);}return null;};}function patchUpdates(_0x2cdb68){return function(_0x4d894c){try{jsonpatch[_0x3ba0('0x1f')](_0x4d894c,_0x2cdb68,!![]);}catch(_0x38c77b){return BPromise[_0x3ba0('0x20')](_0x38c77b);}return _0x4d894c['save']();};}function saveUpdates(_0x116c5e,_0x184601){return function(_0x28ea99){if(_0x28ea99){return _0x28ea99[_0x3ba0('0x21')](_0x116c5e)[_0x3ba0('0x22')](function(_0x287a96){return _0x287a96;});}return null;};}function removeEntity(_0x126563,_0x42edde){return function(_0x13d551){if(_0x13d551){return _0x13d551[_0x3ba0('0x23')]()['then'](function(){_0x126563[_0x3ba0('0x17')](0xcc)[_0x3ba0('0x18')]();});}};}function handleEntityNotFound(_0x355757,_0xfafb2b){return function(_0x12c5ae){if(!_0x12c5ae){_0x355757[_0x3ba0('0x16')](0x194);}return _0x12c5ae;};}function handleError(_0x1d460e,_0x522d46){_0x522d46=_0x522d46||0x1f4;return function(_0x1da64d){logger['error'](_0x1da64d[_0x3ba0('0x24')]);if(_0x1da64d['name']){delete _0x1da64d[_0x3ba0('0x25')];}_0x1d460e[_0x3ba0('0x17')](_0x522d46)[_0x3ba0('0x26')](_0x1da64d);};}exports[_0x3ba0('0x27')]=function(_0x54de35,_0x1dcd9c){var _0x1a1ef6={},_0x3fa3a6={},_0x27ce53={'count':0x0,'rows':[]};var _0x42ab0f=_['map'](db['VoiceQueuesLog'][_0x3ba0('0x28')],function(_0x1556af){return{'name':_0x1556af[_0x3ba0('0x29')],'type':_0x1556af[_0x3ba0('0x2a')]['key']};});_0x3fa3a6[_0x3ba0('0x2b')]=_[_0x3ba0('0x2c')](_0x42ab0f,'name');_0x3fa3a6[_0x3ba0('0x2d')]=_[_0x3ba0('0x2e')](_0x54de35[_0x3ba0('0x2d')]);_0x3fa3a6[_0x3ba0('0x2f')]=_[_0x3ba0('0x30')](_0x3fa3a6[_0x3ba0('0x2b')],_0x3fa3a6[_0x3ba0('0x2d')]);_0x1a1ef6[_0x3ba0('0x31')]=_['intersection'](_0x3fa3a6[_0x3ba0('0x2b')],qs[_0x3ba0('0x32')](_0x54de35[_0x3ba0('0x2d')][_0x3ba0('0x32')]));_0x1a1ef6[_0x3ba0('0x31')]=_0x1a1ef6[_0x3ba0('0x31')][_0x3ba0('0x33')]?_0x1a1ef6[_0x3ba0('0x31')]:_0x3fa3a6[_0x3ba0('0x2b')];if(!_0x54de35[_0x3ba0('0x2d')][_0x3ba0('0x34')](_0x3ba0('0x35'))){_0x1a1ef6[_0x3ba0('0x1b')]=qs[_0x3ba0('0x1b')](_0x54de35[_0x3ba0('0x2d')][_0x3ba0('0x1b')]);_0x1a1ef6[_0x3ba0('0x1a')]=qs[_0x3ba0('0x1a')](_0x54de35[_0x3ba0('0x2d')][_0x3ba0('0x1a')]);}_0x1a1ef6[_0x3ba0('0x36')]=qs[_0x3ba0('0x37')](_0x54de35['query'][_0x3ba0('0x37')]);_0x1a1ef6['where']=qs[_0x3ba0('0x2f')](_[_0x3ba0('0x38')](_0x54de35[_0x3ba0('0x2d')],_0x3fa3a6[_0x3ba0('0x2f')]),_0x42ab0f);if(_0x54de35[_0x3ba0('0x2d')]['filter']){_0x1a1ef6[_0x3ba0('0x39')]=_['merge'](_0x1a1ef6[_0x3ba0('0x39')],{'$or':_[_0x3ba0('0x2c')](_0x42ab0f,function(_0x237d36){if(_0x237d36['type']!==_0x3ba0('0x3a')){var _0x8a5902={};_0x8a5902[_0x237d36[_0x3ba0('0x25')]]={'$like':'%'+_0x54de35[_0x3ba0('0x2d')][_0x3ba0('0x3b')]+'%'};return _0x8a5902;}})});}_0x1a1ef6=_[_0x3ba0('0x3c')]({},_0x1a1ef6,_0x54de35[_0x3ba0('0x3d')]);var _0x37795c={'where':_0x1a1ef6[_0x3ba0('0x39')]};return db[_0x3ba0('0x3e')][_0x3ba0('0x19')](_0x37795c)['then'](function(_0x51eb35){_0x27ce53['count']=_0x51eb35;if(_0x54de35[_0x3ba0('0x2d')][_0x3ba0('0x3f')]){_0x1a1ef6[_0x3ba0('0x40')]=[{'all':!![]}];}return db[_0x3ba0('0x3e')]['findAll'](_0x1a1ef6);})['then'](function(_0x5dd4e9){_0x27ce53[_0x3ba0('0x41')]=_0x5dd4e9;return _0x27ce53;})[_0x3ba0('0x22')](respondWithFilteredResult(_0x1dcd9c,_0x1a1ef6))[_0x3ba0('0x42')](handleError(_0x1dcd9c,null));};exports['show']=function(_0x1ac70c,_0x3fef9a){var _0x348aa2={'raw':!![],'where':{'id':_0x1ac70c[_0x3ba0('0x43')]['id']}},_0x30aeac={};_0x30aeac['model']=_[_0x3ba0('0x2e')](db['VoiceQueuesLog'][_0x3ba0('0x28')]);_0x30aeac[_0x3ba0('0x2d')]=_[_0x3ba0('0x2e')](_0x1ac70c[_0x3ba0('0x2d')]);_0x30aeac[_0x3ba0('0x2f')]=_[_0x3ba0('0x30')](_0x30aeac[_0x3ba0('0x2b')],_0x30aeac['query']);_0x348aa2[_0x3ba0('0x31')]=_[_0x3ba0('0x30')](_0x30aeac['model'],qs[_0x3ba0('0x32')](_0x1ac70c[_0x3ba0('0x2d')][_0x3ba0('0x32')]));_0x348aa2[_0x3ba0('0x31')]=_0x348aa2['attributes'][_0x3ba0('0x33')]?_0x348aa2[_0x3ba0('0x31')]:_0x30aeac[_0x3ba0('0x2b')];if(_0x1ac70c[_0x3ba0('0x2d')][_0x3ba0('0x3f')]){_0x348aa2['include']=[{'all':!![]}];}_0x348aa2=_[_0x3ba0('0x3c')]({},_0x348aa2,_0x1ac70c[_0x3ba0('0x3d')]);return db[_0x3ba0('0x3e')][_0x3ba0('0x44')](_0x348aa2)[_0x3ba0('0x22')](handleEntityNotFound(_0x3fef9a,null))[_0x3ba0('0x22')](respondWithResult(_0x3fef9a,null))[_0x3ba0('0x42')](handleError(_0x3fef9a,null));};exports[_0x3ba0('0x45')]=function(_0xb4b8a,_0x3152b0){return db['VoiceQueuesLog'][_0x3ba0('0x45')](_0xb4b8a[_0x3ba0('0x46')],{})[_0x3ba0('0x22')](respondWithResult(_0x3152b0,0xc9))['catch'](handleError(_0x3152b0,null));};exports['update']=function(_0x1c8ced,_0x2c5dca){if(_0x1c8ced['body']['id']){delete _0x1c8ced[_0x3ba0('0x46')]['id'];}return db['VoiceQueuesLog'][_0x3ba0('0x44')]({'where':{'id':_0x1c8ced[_0x3ba0('0x43')]['id']}})[_0x3ba0('0x22')](handleEntityNotFound(_0x2c5dca,null))[_0x3ba0('0x22')](saveUpdates(_0x1c8ced[_0x3ba0('0x46')],null))[_0x3ba0('0x22')](respondWithResult(_0x2c5dca,null))['catch'](handleError(_0x2c5dca,null));};exports[_0x3ba0('0x23')]=function(_0xc4ca9f,_0x3569dd){return db[_0x3ba0('0x3e')][_0x3ba0('0x44')]({'where':{'id':_0xc4ca9f[_0x3ba0('0x43')]['id']}})[_0x3ba0('0x22')](handleEntityNotFound(_0x3569dd,null))[_0x3ba0('0x22')](removeEntity(_0x3569dd,null))['catch'](handleError(_0x3569dd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 19241d0..cf94926 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 _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 +var _0xd346=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0xd346,0xa5));var _0x6d34=function(_0x7f7dc6,_0x4ccdd0){_0x7f7dc6=_0x7f7dc6-0x0;var _0xc9280=_0xd346[_0x7f7dc6];return _0xc9280;};'use strict';var _=require(_0x6d34('0x0'));var util=require(_0x6d34('0x1'));var logger=require(_0x6d34('0x2'))('api');var moment=require(_0x6d34('0x3'));var BPromise=require(_0x6d34('0x4'));var rp=require(_0x6d34('0x5'));var fs=require('fs');var path=require(_0x6d34('0x6'));var rimraf=require(_0x6d34('0x7'));var config=require(_0x6d34('0x8'));var attributes=require(_0x6d34('0x9'));module[_0x6d34('0xa')]=function(_0x58c4e5,_0x57813b){return _0x58c4e5[_0x6d34('0xb')](_0x6d34('0xc'),attributes,{'tableName':_0x6d34('0xd'),'paranoid':![],'indexes':[{'name':_0x6d34('0xe'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d47dd70..3c80e04 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 _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 +var _0xdd6e=['request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x222362,_0x4967cd){var _0x1a3039=function(_0x196d32){while(--_0x196d32){_0x222362['push'](_0x222362['shift']());}};_0x1a3039(++_0x4967cd);}(_0xdd6e,0xa5));var _0xedd6=function(_0x5c59d7,_0x178512){_0x5c59d7=_0x5c59d7-0x0;var _0x20b059=_0xdd6e[_0x5c59d7];return _0x20b059;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var moment=require(_0xedd6('0x2'));var BPromise=require(_0xedd6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedd6('0x4'));var db=require(_0xedd6('0x5'))['db'];var utils=require(_0xedd6('0x6'));var logger=require(_0xedd6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xedd6('0x8')][_0xedd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5300a5,_0x135950,_0x30d933){return new BPromise(function(_0x15f317,_0x29743a){return client[_0xedd6('0xa')](_0x5300a5,_0x30d933)['then'](function(_0x4c282c){logger[_0xedd6('0xb')](_0xedd6('0xc'),_0x135950,'request\x20sent');logger[_0xedd6('0xd')](_0xedd6('0xe'),_0x135950,_0xedd6('0xf'),JSON[_0xedd6('0x10')](_0x4c282c));if(_0x4c282c['error']){if(_0x4c282c[_0xedd6('0x11')]['code']===0x1f4){logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);return _0x29743a(_0x4c282c['error'][_0xedd6('0x12')]);}logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);return _0x15f317(_0x4c282c[_0xedd6('0x11')][_0xedd6('0x12')]);}else{logger[_0xedd6('0xb')](_0xedd6('0xc'),_0x135950,_0xedd6('0xf'));_0x15f317(_0x4c282c[_0xedd6('0x13')][_0xedd6('0x12')]);}})['catch'](function(_0x278c18){logger[_0xedd6('0x11')](_0xedd6('0xc'),_0x135950,_0x278c18);_0x29743a(_0x278c18);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 59fcf8b..f18669c 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 _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 +var _0x3b6b=['isAuthenticated','index','/describe','describe','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4efdbd,_0x210ff9){var _0x40885f=function(_0x1bfc4e){while(--_0x1bfc4e){_0x4efdbd['push'](_0x4efdbd['shift']());}};_0x40885f(++_0x210ff9);}(_0x3b6b,0xc8));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb3b6('0x0'));var util=require(_0xb3b6('0x1'));var path=require('path');var timeout=require(_0xb3b6('0x2'));var express=require('express');var router=express[_0xb3b6('0x3')]();var auth=require(_0xb3b6('0x4'));var interaction=require(_0xb3b6('0x5'));var config=require(_0xb3b6('0x6'));var controller=require('./voiceRecording.controller');router[_0xb3b6('0x7')]('/',auth[_0xb3b6('0x8')](),controller[_0xb3b6('0x9')]);router[_0xb3b6('0x7')](_0xb3b6('0xa'),auth['isAuthenticated'](),controller[_0xb3b6('0xb')]);router[_0xb3b6('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xb3b6('0xc')]);router['get'](_0xb3b6('0xd'),auth[_0xb3b6('0x8')](),controller[_0xb3b6('0xe')]);router[_0xb3b6('0x7')]('/:id/downloads',controller[_0xb3b6('0xf')]);router[_0xb3b6('0x7')](_0xb3b6('0x10'),auth[_0xb3b6('0x8')](),controller[_0xb3b6('0x11')]);router[_0xb3b6('0x12')]('/',auth[_0xb3b6('0x8')](),controller[_0xb3b6('0x13')]);router[_0xb3b6('0x12')](_0xb3b6('0x10'),auth[_0xb3b6('0x8')](),controller[_0xb3b6('0x14')]);router[_0xb3b6('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xb3b6('0x16')]);router[_0xb3b6('0x17')]('/:id',auth[_0xb3b6('0x8')](),controller[_0xb3b6('0x18')]);module[_0xb3b6('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d2acbff..888b3ea 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 _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 +var _0xfa89=['BOOLEAN','DATE','getDataValue','createdAt','format','updatedAt','MM-DD-YYYY\x20HH:mm','toString','sequelize','moment','path','exports','extname','value','STRING','setDataValue','membername','split','INTEGER','TEXT','FLOAT'];(function(_0x362b0a,_0x4f7a43){var _0x46b639=function(_0x4bad6c){while(--_0x4bad6c){_0x362b0a['push'](_0x362b0a['shift']());}};_0x46b639(++_0x4f7a43);}(_0xfa89,0x1d6));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9fa8('0x0'));var moment=require(_0x9fa8('0x1'));var path=require(_0x9fa8('0x2'));module[_0x9fa8('0x3')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue']('value')?path[_0x9fa8('0x4')](this['getDataValue'](_0x9fa8('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x9fa8('0x6')]},'channel':{'type':Sequelize[_0x9fa8('0x6')],'set':function(_0x24e96a){if(_0x24e96a){this[_0x9fa8('0x7')]('channel',_0x24e96a);this[_0x9fa8('0x7')](_0x9fa8('0x8'),_0x24e96a[_0x9fa8('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x9fa8('0x6')]},'calleridnum':{'type':Sequelize[_0x9fa8('0x6')]},'calleridname':{'type':Sequelize[_0x9fa8('0x6')]},'connectedlinenum':{'type':Sequelize[_0x9fa8('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x9fa8('0x6')]},'context':{'type':Sequelize[_0x9fa8('0x6')]},'exten':{'type':Sequelize[_0x9fa8('0x6')]},'value':{'type':Sequelize[_0x9fa8('0x6')]},'type':{'type':Sequelize[_0x9fa8('0x6')]},'rating':{'type':Sequelize[_0x9fa8('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x9fa8('0x6')]},'userSecondDisposition':{'type':Sequelize[_0x9fa8('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x9fa8('0x6')]},'location':{'type':Sequelize['TEXT']},'transcribeName':{'type':Sequelize[_0x9fa8('0x6')]},'transcribeStatus':{'type':Sequelize[_0x9fa8('0x6')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize[_0x9fa8('0xb')]},'fileText':{'type':Sequelize['TEXT']},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x9fa8('0x6')]},'sPositive':{'type':Sequelize[_0x9fa8('0xc')]},'sNegative':{'type':Sequelize['FLOAT']},'sNeutral':{'type':Sequelize[_0x9fa8('0xc')]},'sMixed':{'type':Sequelize[_0x9fa8('0xc')]},'tempSentiment':{'type':Sequelize[_0x9fa8('0xd')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x9fa8('0xe')],'get':function(){return moment(this[_0x9fa8('0xf')](_0x9fa8('0x10')))[_0x9fa8('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x9fa8('0x12')))['format'](_0x9fa8('0x13'))[_0x9fa8('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a02e3ee..1532276 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 _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 +var _0x53f7=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','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','Content-Range','reject','save','update','then','stack','name','send','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','VoiceRecording','includeAll','include','findAll','catch','params','options','body','find','describe','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','download','filename','extname','unlink','VoiceRecording\x20not\x20found','../../components/encryptor','sequelize','MD5','col','token','push','$and','format','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','rimraf'];(function(_0xf0adf6,_0x40bdee){var _0x567134=function(_0x510c2c){while(--_0x510c2c){_0xf0adf6['push'](_0xf0adf6['shift']());}};_0x567134(++_0x40bdee);}(_0x53f7,0x126));var _0x753f=function(_0x26d51f,_0x1de895){_0x26d51f=_0x26d51f-0x0;var _0x48305d=_0x53f7[_0x26d51f];return _0x48305d;};'use strict';var pdf=require(_0x753f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x753f('0x1'));var zipdir=require(_0x753f('0x2'));var jsonpatch=require(_0x753f('0x3'));var rp=require(_0x753f('0x4'));var moment=require('moment');var BPromise=require(_0x753f('0x5'));var Mustache=require(_0x753f('0x6'));var util=require(_0x753f('0x7'));var path=require('path');var sox=require(_0x753f('0x8'));var csv=require(_0x753f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x753f('0xa'));var squel=require(_0x753f('0xb'));var crypto=require(_0x753f('0xc'));var jsforce=require(_0x753f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x753f('0x9'));var querystring=require(_0x753f('0xe'));var Papa=require(_0x753f('0xf'));var AWS=require(_0x753f('0x10'));var uuidv4=require(_0x753f('0x11'));var Redis=require(_0x753f('0x12'));var authService=require(_0x753f('0x13'));var qs=require(_0x753f('0x14'));var as=require(_0x753f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x753f('0x16'))(_0x753f('0x17'));var utils=require(_0x753f('0x18'));var config=require(_0x753f('0x19'));var licenseUtil=require(_0x753f('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x257f09,_0x49b351){_0x49b351=_0x49b351||0xcc;return function(_0x11883c){if(_0x11883c){return _0x257f09[_0x753f('0x1b')](_0x49b351);}return _0x257f09[_0x753f('0x1c')](_0x49b351)[_0x753f('0x1d')]();};}function respondWithResult(_0xe091d7,_0x516e0a){_0x516e0a=_0x516e0a||0xc8;return function(_0x36f8f9){if(_0x36f8f9){return _0xe091d7[_0x753f('0x1c')](_0x516e0a)[_0x753f('0x1e')](_0x36f8f9);}};}function respondWithFilteredResult(_0x3e4187,_0x1ed5e0){return function(_0x5d0be8){if(_0x5d0be8){var _0x262604=_0x5d0be8[_0x753f('0x1f')],_0x340f22=_0x1ed5e0[_0x753f('0x20')],_0x441940=_0x1ed5e0[_0x753f('0x20')]+_0x1ed5e0[_0x753f('0x21')],_0x589783;if(_0x441940>=_0x262604){_0x441940=_0x262604;_0x589783=0xc8;}else{_0x589783=0xce;}_0x3e4187[_0x753f('0x1c')](_0x589783);return _0x3e4187[_0x753f('0x22')](_0x753f('0x23'),_0x340f22+'-'+_0x441940+'/'+_0x262604)[_0x753f('0x1e')](_0x5d0be8);}return null;};}function patchUpdates(_0x5752f2){return function(_0x227b1b){try{jsonpatch['apply'](_0x227b1b,_0x5752f2,!![]);}catch(_0x4c5dfd){return BPromise[_0x753f('0x24')](_0x4c5dfd);}return _0x227b1b[_0x753f('0x25')]();};}function saveUpdates(_0x17fb76,_0x582337){return function(_0x52c731){if(_0x52c731){return _0x52c731[_0x753f('0x26')](_0x17fb76)[_0x753f('0x27')](function(_0x36c46c){return _0x36c46c;});}return null;};}function removeEntity(_0x19e57,_0xbc3e81){return function(_0x42249c){if(_0x42249c){return _0x42249c['destroy']()[_0x753f('0x27')](function(){_0x19e57['status'](0xcc)[_0x753f('0x1d')]();});}};}function handleEntityNotFound(_0x44afe7,_0x1fae4e){return function(_0x23b130){if(!_0x23b130){_0x44afe7[_0x753f('0x1b')](0x194);}return _0x23b130;};}function handleError(_0x228f7a,_0x146709){_0x146709=_0x146709||0x1f4;return function(_0x4de458){logger['error'](_0x4de458[_0x753f('0x28')]);if(_0x4de458[_0x753f('0x29')]){delete _0x4de458[_0x753f('0x29')];}_0x228f7a['status'](_0x146709)[_0x753f('0x2a')](_0x4de458);};}exports['index']=function(_0x3e9ef9,_0x2a5be7){var _0x154068={},_0x333a70={},_0x5be59c={'count':0x0,'rows':[]};var _0x32acb2=_['map'](db['VoiceRecording'][_0x753f('0x2b')],function(_0x31895d){return{'name':_0x31895d[_0x753f('0x2c')],'type':_0x31895d[_0x753f('0x2d')]['key']};});_0x333a70[_0x753f('0x2e')]=_['differenceBy'](_['map'](_0x32acb2,_0x753f('0x29')),['format']);_0x333a70[_0x753f('0x2f')]=_[_0x753f('0x30')](_0x3e9ef9[_0x753f('0x2f')]);_0x333a70[_0x753f('0x31')]=_[_0x753f('0x32')](_0x333a70[_0x753f('0x2e')],_0x333a70[_0x753f('0x2f')]);_0x154068[_0x753f('0x33')]=_['intersection'](_0x333a70[_0x753f('0x2e')],qs[_0x753f('0x34')](_0x3e9ef9[_0x753f('0x2f')][_0x753f('0x34')]));_0x154068[_0x753f('0x33')]=_0x154068[_0x753f('0x33')][_0x753f('0x35')]?_0x154068[_0x753f('0x33')]:_0x333a70[_0x753f('0x2e')];if(!_0x3e9ef9[_0x753f('0x2f')][_0x753f('0x36')]('nolimit')){_0x154068[_0x753f('0x21')]=qs['limit'](_0x3e9ef9[_0x753f('0x2f')][_0x753f('0x21')]);_0x154068[_0x753f('0x20')]=qs['offset'](_0x3e9ef9[_0x753f('0x2f')][_0x753f('0x20')]);}_0x154068[_0x753f('0x37')]=qs[_0x753f('0x38')](_0x3e9ef9['query'][_0x753f('0x38')]);_0x154068[_0x753f('0x39')]=qs[_0x753f('0x31')](_[_0x753f('0x3a')](_0x3e9ef9['query'],_0x333a70[_0x753f('0x31')]),_0x32acb2);if(_0x3e9ef9['query'][_0x753f('0x3b')]){_0x154068[_0x753f('0x39')]=_['merge'](_0x154068[_0x753f('0x39')],{'$or':_['map'](_0x32acb2,function(_0xb96cfd){if(_0xb96cfd[_0x753f('0x2d')]!==_0x753f('0x3c')){var _0x41a049={};_0x41a049[_0xb96cfd[_0x753f('0x29')]]={'$like':'%'+_0x3e9ef9['query'][_0x753f('0x3b')]+'%'};return _0x41a049;}})});}_0x154068=_[_0x753f('0x3d')]({},_0x154068,_0x3e9ef9['options']);var _0x557b8d={'where':_0x154068[_0x753f('0x39')]};return db[_0x753f('0x3e')][_0x753f('0x1f')](_0x557b8d)['then'](function(_0x39e9a6){_0x5be59c[_0x753f('0x1f')]=_0x39e9a6;if(_0x3e9ef9[_0x753f('0x2f')][_0x753f('0x3f')]){_0x154068[_0x753f('0x40')]=[{'all':!![]}];}return db[_0x753f('0x3e')][_0x753f('0x41')](_0x154068);})[_0x753f('0x27')](function(_0x24c650){_0x5be59c['rows']=_0x24c650;return _0x5be59c;})[_0x753f('0x27')](respondWithFilteredResult(_0x2a5be7,_0x154068))[_0x753f('0x42')](handleError(_0x2a5be7,null));};exports['show']=function(_0x210db7,_0x46a5b7){var _0x47a6c9={'raw':![],'where':{'id':_0x210db7[_0x753f('0x43')]['id']}},_0x19d73a={};_0x19d73a[_0x753f('0x2e')]=_[_0x753f('0x30')](db['VoiceRecording'][_0x753f('0x2b')]);_0x19d73a[_0x753f('0x2f')]=_[_0x753f('0x30')](_0x210db7[_0x753f('0x2f')]);_0x19d73a['filters']=_['intersection'](_0x19d73a[_0x753f('0x2e')],_0x19d73a[_0x753f('0x2f')]);_0x47a6c9[_0x753f('0x33')]=_[_0x753f('0x32')](_0x19d73a[_0x753f('0x2e')],qs[_0x753f('0x34')](_0x210db7[_0x753f('0x2f')][_0x753f('0x34')]));_0x47a6c9[_0x753f('0x33')]=_0x47a6c9[_0x753f('0x33')]['length']?_0x47a6c9[_0x753f('0x33')]:_0x19d73a[_0x753f('0x2e')];if(_0x210db7[_0x753f('0x2f')]['includeAll']){_0x47a6c9[_0x753f('0x40')]=[{'all':!![]}];}_0x47a6c9=_[_0x753f('0x3d')]({},_0x47a6c9,_0x210db7[_0x753f('0x44')]);return db[_0x753f('0x3e')]['find'](_0x47a6c9)[_0x753f('0x27')](handleEntityNotFound(_0x46a5b7,null))[_0x753f('0x27')](respondWithResult(_0x46a5b7,null))[_0x753f('0x42')](handleError(_0x46a5b7,null));};exports['create']=function(_0x6328bd,_0x2ae022){return db['VoiceRecording']['create'](_0x6328bd[_0x753f('0x45')],{})[_0x753f('0x27')](respondWithResult(_0x2ae022,0xc9))['catch'](handleError(_0x2ae022,null));};exports[_0x753f('0x26')]=function(_0x3a944d,_0x5b24a3){if(_0x3a944d[_0x753f('0x45')]['id']){delete _0x3a944d[_0x753f('0x45')]['id'];}return db[_0x753f('0x3e')][_0x753f('0x46')]({'where':{'id':_0x3a944d[_0x753f('0x43')]['id']}})[_0x753f('0x27')](handleEntityNotFound(_0x5b24a3,null))[_0x753f('0x27')](saveUpdates(_0x3a944d[_0x753f('0x45')],null))[_0x753f('0x27')](respondWithResult(_0x5b24a3,null))[_0x753f('0x42')](handleError(_0x5b24a3,null));};exports[_0x753f('0x47')]=function(_0x1b839e,_0x44e2b3){return db['VoiceRecording'][_0x753f('0x47')]()[_0x753f('0x27')](respondWithResult(_0x44e2b3,null))['catch'](handleError(_0x44e2b3,null));};exports['download']=function(_0xaddf01,_0x2f58d6,_0x8a178f){var _0x285d36=require('../../components/encryptor');var _0x5bb120=![];var _0x3e4680={};if(_0xaddf01[_0x753f('0x2f')]['type']&&_0xaddf01[_0x753f('0x2f')][_0x753f('0x2d')]===_0x753f('0x48')){_0x3e4680[_0x753f('0x48')]=_0xaddf01[_0x753f('0x43')]['id'];}else{_0x3e4680['id']=_0xaddf01['params']['id'];}return db[_0x753f('0x3e')][_0x753f('0x46')]({'where':_0x3e4680,'attributes':['id',_0x753f('0x49')],'raw':!![]})[_0x753f('0x27')](handleEntityNotFound(_0x2f58d6,null))[_0x753f('0x27')](function(_0x38c6b7){if(_0x38c6b7){var _0xc94220=_0x38c6b7['value'];var _0x39226a=util['format'](_0x753f('0x4a'),_0xc94220);if(fs[_0x753f('0x4b')](_0x39226a)){_0x5bb120=!![];return _0x285d36[_0x753f('0x4c')](_0x39226a,_0xc94220,config[_0x753f('0x4d')][_0x753f('0x4e')])[_0x753f('0x27')](function(){return _0x38c6b7;});}return _0x38c6b7;}})['then'](function(_0x2014c7){if(_0x2014c7){var _0x583e4f=_0x2014c7[_0x753f('0x49')];if(!fs[_0x753f('0x4b')](_0x583e4f)){throw new db[(_0x753f('0x4f'))][(_0x753f('0x50'))]('VoiceRecording\x20not\x20found');}if(_0x2014c7['filename']){return _0x2f58d6[_0x753f('0x51')](_0x583e4f,_0x2014c7[_0x753f('0x52')]+path[_0x753f('0x53')](_0x583e4f),function(){if(_0x5bb120){fs[_0x753f('0x54')](_0x583e4f);}});}else{return _0x2f58d6[_0x753f('0x51')](_0x583e4f,function(_0x30cae2){if(_0x5bb120){fs[_0x753f('0x54')](_0x583e4f);}});}}})[_0x753f('0x42')](function(_0x47622c){if(_0x47622c['message']===_0x753f('0x55')){_0x2f58d6[_0x753f('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x2f58d6,null);}});};exports['downloads']=function(_0x50bb8b,_0xb4202c,_0x63dba){var _0x1f2fcf=require(_0x753f('0x56'));var _0x310553=![];var _0x122df3={'$and':[db[_0x753f('0x57')][_0x753f('0x39')](db[_0x753f('0x57')]['fn'](_0x753f('0x58'),db['sequelize'][_0x753f('0x59')]('uniqueid')),_0x50bb8b[_0x753f('0x2f')][_0x753f('0x5a')])]};if(_0x50bb8b[_0x753f('0x2f')]['type']&&_0x50bb8b[_0x753f('0x2f')][_0x753f('0x2d')]===_0x753f('0x48')){_0x122df3['$and'][_0x753f('0x5b')]({'uniqueid':_0x50bb8b['params']['id']});}else{_0x122df3[_0x753f('0x5c')][_0x753f('0x5b')]({'id':_0x50bb8b['params']['id']});}return db[_0x753f('0x3e')][_0x753f('0x46')]({'where':_0x122df3,'attributes':['id',_0x753f('0x49')],'raw':!![]})[_0x753f('0x27')](handleEntityNotFound(_0xb4202c,null))[_0x753f('0x27')](function(_0x2f5a3f){if(_0x2f5a3f){var _0x3bc97d=util[_0x753f('0x5d')](_0x753f('0x4a'),_0x2f5a3f[_0x753f('0x49')]);if(fs[_0x753f('0x4b')](_0x3bc97d)){_0x310553=!![];return _0x1f2fcf[_0x753f('0x4c')](_0x3bc97d,_0x2f5a3f[_0x753f('0x49')],config['secrets'][_0x753f('0x4e')])[_0x753f('0x27')](function(){return _0x2f5a3f;});}return _0x2f5a3f;}})[_0x753f('0x27')](function(_0x16f279){if(_0x16f279){if(!fs[_0x753f('0x4b')](_0x16f279[_0x753f('0x49')])){throw new db['Sequelize'][(_0x753f('0x50'))](_0x753f('0x55'));}if(_0x16f279['filename']){return _0xb4202c['download'](_0x16f279[_0x753f('0x49')],_0x16f279[_0x753f('0x52')]+path[_0x753f('0x53')](_0x16f279[_0x753f('0x49')]),function(){if(_0x310553){fs['unlink'](_0x16f279[_0x753f('0x49')]);}});}else{return _0xb4202c[_0x753f('0x51')](_0x16f279['value'],function(_0x39f3b3){if(_0x310553){fs[_0x753f('0x54')](_0x16f279[_0x753f('0x49')]);}});}}})[_0x753f('0x42')](handleError(_0xb4202c,null));};exports[_0x753f('0x5e')]=function(_0x475e48,_0x30062e){return db[_0x753f('0x3e')]['find']({'where':{'id':_0x475e48[_0x753f('0x43')]['id']}})['then'](function(_0x1f47fa){if(!_0x1f47fa)throw new ReferenceError(_0x753f('0x5f'));return _0x1f47fa;})['then'](function(_0x3327f3){var _0x152991=_0x3327f3[_0x753f('0x49')];logger[_0x753f('0x60')](_0x753f('0x61'),_0x152991);if(!_[_0x753f('0x62')](_0x3327f3[_0x753f('0x49')])&&fs[_0x753f('0x4b')](_0x152991)){logger[_0x753f('0x60')](_0x753f('0x63')+_0x152991+_0x753f('0x64'));fs['unlinkSync'](_0x152991);}_0x152991=_0x152991+_0x753f('0x65');if(!_[_0x753f('0x62')](_0x3327f3[_0x753f('0x49')])&&fs[_0x753f('0x4b')](_0x152991)){logger[_0x753f('0x60')](_0x753f('0x63')+_0x152991+_0x753f('0x64'));fs[_0x753f('0x66')](_0x152991);}return _0x3327f3;})[_0x753f('0x27')](function(_0x5d60b4){if(!_0x5d60b4)throw new InternalError();return _0x5d60b4['destroy']();})[_0x753f('0x27')](function(){_0x30062e[_0x753f('0x1c')](0xcc)[_0x753f('0x1d')]();})[_0x753f('0x42')](handleError(_0x30062e,null));};function getBucketslist(_0x1e420a,_0x245805,_0x359ee0){return new Promise(function(_0x24f8bd,_0x83dd68){var _0x2c21c4=new AWS['S3']({'accessKeyId':_0x245805,'secretAccessKey':_0x1e420a,'region':_0x359ee0});_0x2c21c4[_0x753f('0x67')]({},function(_0x50b600,_0x5c3a03){if(_0x50b600){return _0x83dd68(_0x50b600);}else{return _0x24f8bd(_0x5c3a03);}});});}function createBucket(_0x905140,_0xdb938,_0x405110,_0x4a7c2e){return new Promise(function(_0x7309d,_0x496ecd){var _0x33faad=new AWS['S3']({'accessKeyId':_0xdb938,'secretAccessKey':_0x905140,'region':_0x405110});_0x33faad[_0x753f('0x68')]({'Bucket':_0x4a7c2e},function(_0x381f98,_0x5aded1){if(_0x381f98){return _0x496ecd(_0x381f98);}else{return _0x7309d(_0x5aded1);}});});}function uploadFile(_0x519669,_0x36878c,_0x163ecd,_0x4b5e9e,_0x12bbf8,_0x99de87){return new Promise(function(_0xdb969e,_0x469a7c){var _0x5deda3=new AWS['S3']({'accessKeyId':_0x36878c,'secretAccessKey':_0x519669,'region':_0x163ecd});_0x5deda3[_0x753f('0x69')]({'Bucket':_0x4b5e9e,'Key':_0x12bbf8,'Body':_0x99de87},function(_0x273848,_0xdae0b4){if(_0x273848){return _0x469a7c(_0x273848);}else{return _0xdb969e(_0xdae0b4);}});});}function startTranscribe(_0x536580,_0x1b535c,_0x296335,_0x3be97f,_0x322ded,_0x3fc653){return new Promise(function(_0x5733a9,_0x277143){var _0x5ec237=new AWS[(_0x753f('0x6a'))]({'accessKeyId':_0x1b535c,'secretAccessKey':_0x536580,'region':_0x296335});_0x5ec237[_0x753f('0x6b')]({'TranscriptionJobName':_0x3be97f,'LanguageCode':_0x322ded,'Media':{'MediaFileUri':_0x3fc653}},function(_0x357cfc,_0x2ab33d){if(_0x357cfc){return _0x277143(_0x357cfc);}else{return _0x5733a9(_0x2ab33d);}});});}function transcribe(_0x463ab0,_0x10ded9,_0x46a926,_0x38f8a5,_0xaa7dd,_0x5497a9,_0x3749b2){return new Promise(function(_0x235d1b,_0xf9a931){var _0x40d646={};logger['info'](util['format'](_0x753f('0x6c'),_0x463ab0,_0xaa7dd));return uploadFile(_0x10ded9,_0x46a926,_0x38f8a5,_0xaa7dd,path['basename'](_0x5497a9),fs[_0x753f('0x6d')](_0x5497a9))[_0x753f('0x27')](function(_0x65929c){logger[_0x753f('0x60')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x463ab0,_0xaa7dd,_0x65929c[_0x753f('0x6e')]));_0x40d646[_0x753f('0x6f')]=_0x65929c['Bucket'];_0x40d646[_0x753f('0x70')]=_0x65929c['Location'];logger['info'](util[_0x753f('0x5d')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x463ab0));return startTranscribe(_0x10ded9,_0x46a926,_0x38f8a5,uuidv4(),_0x3749b2,_0x65929c[_0x753f('0x6e')]);})[_0x753f('0x27')](function(_0x44a44d){logger[_0x753f('0x60')](util['format'](_0x753f('0x71'),_0x463ab0,_0x44a44d['TranscriptionJob'][_0x753f('0x72')]));_0x40d646[_0x753f('0x73')]=_0x44a44d[_0x753f('0x74')]['TranscriptionJobName'];_0x40d646[_0x753f('0x75')]=_0x44a44d[_0x753f('0x74')][_0x753f('0x76')];return _0x235d1b(_0x40d646);})[_0x753f('0x42')](function(_0x489145){return _0xf9a931(_0x489145);});});}exports[_0x753f('0x77')]=function(_0x46f086,_0x20a94f,_0x57a645){var _0x6c81ab;var _0x3b0221;var _0x13081f;var _0x1ca36e=require(_0x753f('0x56'));return db[_0x753f('0x3e')][_0x753f('0x78')]({'where':{'id':_0x46f086[_0x753f('0x43')]['id']}})[_0x753f('0x27')](function(_0x3c5e4f){if(_0x3c5e4f){var _0xb23d63=util[_0x753f('0x5d')](_0x753f('0x4a'),_0x3c5e4f[_0x753f('0x49')]);if(fs['existsSync'](_0xb23d63)){cypher=!![];return _0x1ca36e[_0x753f('0x4c')](_0xb23d63,_0x3c5e4f[_0x753f('0x49')],config[_0x753f('0x4d')][_0x753f('0x4e')])[_0x753f('0x27')](function(){return _0x3c5e4f;});}return _0x3c5e4f;}})[_0x753f('0x27')](function(_0x59a33e){if(!_0x59a33e){throw new db['Sequelize'][(_0x753f('0x50'))](_0x753f('0x79'));}_0x3b0221=_0x59a33e;return db[_0x753f('0x7a')][_0x753f('0x78')]({'where':{'id':0x1}});})[_0x753f('0x27')](handleEntityNotFound(_0x20a94f,null))[_0x753f('0x27')](function(_0x116df2){if(_0x116df2){_0x6c81ab=_0x116df2;if(!_0x6c81ab['transcribe']||!_0x6c81ab[_0x753f('0x7b')]||!_0x6c81ab['transcribeRegion']||!_0x6c81ab[_0x753f('0x7c')]||!_0x6c81ab['bucket']){throw new db[(_0x753f('0x4f'))][(_0x753f('0x50'))](_0x753f('0x7d'));}if(_0x46f086['body'][_0x753f('0x7e')]&&(!_0x6c81ab[_0x753f('0x7f')]||!_0x6c81ab[_0x753f('0x80')]||!_0x6c81ab[_0x753f('0x81')]||!_0x6c81ab[_0x753f('0x7c')]||!_0x6c81ab[_0x753f('0x6f')])){throw new db[(_0x753f('0x4f'))][(_0x753f('0x50'))](_0x753f('0x82'));}return db[_0x753f('0x83')]['findOne']({'where':{'id':_0x6c81ab['transcribeAccountId']}});}})[_0x753f('0x27')](function(_0xcfae09){if(!_0xcfae09){throw new db[(_0x753f('0x4f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xcfae09[_0x753f('0x84')]||!_0xcfae09[_0x753f('0x85')]){throw new db[(_0x753f('0x4f'))][(_0x753f('0x50'))]('Cloud\x20Provider\x20not\x20configured');}_0x13081f=_0xcfae09;return getBucketslist(_0x13081f[_0x753f('0x84')],_0x13081f[_0x753f('0x85')],_0x6c81ab[_0x753f('0x86')]);})[_0x753f('0x27')](function(_0x31ea53){if(_0x31ea53&&_0x31ea53[_0x753f('0x87')]){var _0x5e9c85=_[_0x753f('0x46')](_0x31ea53[_0x753f('0x87')],function(_0x34649d){return _0x34649d[_0x753f('0x88')]===_0x6c81ab['bucket'];});if(!_0x5e9c85){logger[_0x753f('0x60')](util[_0x753f('0x5d')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x46f086[_0x753f('0x43')]['id'],_0x6c81ab['bucket']));return createBucket(_0x13081f[_0x753f('0x84')],_0x13081f[_0x753f('0x85')],_0x6c81ab[_0x753f('0x86')],_0x6c81ab[_0x753f('0x6f')]);}logger[_0x753f('0x60')](util[_0x753f('0x5d')](_0x753f('0x89'),_0x46f086[_0x753f('0x43')]['id'],_0x6c81ab[_0x753f('0x6f')]));return;}})[_0x753f('0x27')](function(_0x13376a){if(_0x3b0221['transcribeStatus']===_0x753f('0x8a')){return transcribe(_0x46f086[_0x753f('0x43')]['id'],_0x13081f[_0x753f('0x84')],_0x13081f[_0x753f('0x85')],_0x6c81ab[_0x753f('0x86')],_0x6c81ab[_0x753f('0x6f')],_0x3b0221[_0x753f('0x49')],_0x6c81ab[_0x753f('0x7c')]);}else{logger[_0x753f('0x60')](util[_0x753f('0x5d')](_0x753f('0x8b'),_0x46f086['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x753f('0x27')](function(_0xcc01aa){if(_0xcc01aa){_0xcc01aa[_0x753f('0x8c')]=_0x46f086[_0x753f('0x45')][_0x753f('0x7e')];return _0x3b0221[_0x753f('0x8d')](_0xcc01aa);}})[_0x753f('0x27')](respondWithResult(_0x20a94f,null))['catch'](handleError(_0x20a94f,null));};function writeFile(_0x4a820d,_0x380bd5){return new Promise(function(_0x741357,_0x4e5367){fs[_0x753f('0x8e')](_0x380bd5,_0x4a820d,function(_0x1161d2,_0x37a15c){if(_0x1161d2){return _0x4e5367(_0x1161d2);}else{return _0x741357(_0x37a15c);}});});}exports[_0x753f('0x8f')]=function(_0x1b08a4,_0x28d08d,_0x481de4){return db[_0x753f('0x3e')][_0x753f('0x78')]({'where':{'id':_0x1b08a4[_0x753f('0x43')]['id']}})[_0x753f('0x27')](handleEntityNotFound(_0x28d08d))[_0x753f('0x27')](function(_0x3bd440){if(_0x3bd440&&_0x3bd440[_0x753f('0x90')]){var _0x186d4e=_0x3bd440['fileText'];var _0x4ac370=config[_0x753f('0x91')]+'/server/files/transcribes/transcribe_'+_0x3bd440['id']+_0x753f('0x92');if(fs[_0x753f('0x4b')](_0x4ac370)){return _0x4ac370;}return writeFile(_0x186d4e,_0x4ac370)['then'](function(){return _0x4ac370;});}else{throw new db[(_0x753f('0x4f'))][(_0x753f('0x50'))](_0x753f('0x93'));}})[_0x753f('0x27')](function(_0x3f6468){return _0x28d08d[_0x753f('0x51')](_0x3f6468);})[_0x753f('0x42')](handleError(_0x28d08d));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9dcdb54..9bbf695 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 _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 +var _0x2c94=['bluebird','rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment'];(function(_0x507126,_0x3dd5c3){var _0x5ca642=function(_0x3e56c9){while(--_0x3e56c9){_0x507126['push'](_0x507126['shift']());}};_0x5ca642(++_0x3dd5c3);}(_0x2c94,0x194));var _0x42c9=function(_0x337d94,_0x872e36){_0x337d94=_0x337d94-0x0;var _0x26fb5e=_0x2c94[_0x337d94];return _0x26fb5e;};'use strict';var _=require('lodash');var util=require(_0x42c9('0x0'));var logger=require(_0x42c9('0x1'))(_0x42c9('0x2'));var moment=require(_0x42c9('0x3'));var BPromise=require(_0x42c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42c9('0x5'));var config=require(_0x42c9('0x6'));var attributes=require('./voiceRecording.attributes');module[_0x42c9('0x7')]=function(_0x3721e8,_0x1c98f0){return _0x3721e8[_0x42c9('0x8')](_0x42c9('0x9'),attributes,{'tableName':_0x42c9('0xa'),'paranoid':![],'indexes':[{'name':_0x42c9('0xb'),'fields':[_0x42c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index af3e4bb..cc2e3cd 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(_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 +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(_0x1d6e3d,_0x51b0c5){var _0x27d1e4=function(_0x37d6c4){while(--_0x37d6c4){_0x1d6e3d['push'](_0x1d6e3d['shift']());}};_0x27d1e4(++_0x51b0c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 0ea75b7..59dbf47 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 _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 +var _0xc942=['create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','show','post'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xc942,0xd8));var _0x2c94=function(_0xe2c826,_0x3be10e){_0xe2c826=_0xe2c826-0x0;var _0x18430c=_0xc942[_0xe2c826];return _0x18430c;};'use strict';var multer=require(_0x2c94('0x0'));var util=require(_0x2c94('0x1'));var path=require(_0x2c94('0x2'));var timeout=require(_0x2c94('0x3'));var express=require('express');var router=express[_0x2c94('0x4')]();var auth=require(_0x2c94('0x5'));var interaction=require(_0x2c94('0x6'));var config=require(_0x2c94('0x7'));var controller=require(_0x2c94('0x8'));router[_0x2c94('0x9')]('/',auth[_0x2c94('0xa')](),controller[_0x2c94('0xb')]);router[_0x2c94('0x9')](_0x2c94('0xc'),auth[_0x2c94('0xa')](),controller['describe']);router[_0x2c94('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2c94('0xd')]);router[_0x2c94('0xe')]('/',auth[_0x2c94('0xa')](),controller[_0x2c94('0xf')]);router[_0x2c94('0x10')](_0x2c94('0x11'),auth[_0x2c94('0xa')](),controller[_0x2c94('0x12')]);router[_0x2c94('0x13')](_0x2c94('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x2c94('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 91253fb..c633d7f 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 _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 +var _0xf54e=['Yes','sequelize','ENUM','blind','attended','STRING'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xf54e,0xc7));var _0xef54=function(_0x41886e,_0x2f9b3e){_0x41886e=_0x41886e-0x0;var _0x10e7f4=_0xf54e[_0x41886e];return _0x10e7f4;};'use strict';var Sequelize=require(_0xef54('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xef54('0x1')](_0xef54('0x2'),_0xef54('0x3'))},'result':{'type':Sequelize[_0xef54('0x4')]},'transfererchannel':{'type':Sequelize[_0xef54('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xef54('0x4')]},'transferercalleridname':{'type':Sequelize[_0xef54('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xef54('0x4')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xef54('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xef54('0x4')]},'transfereechannel':{'type':Sequelize[_0xef54('0x4')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xef54('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xef54('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xef54('0x4')]},'transfereeexten':{'type':Sequelize[_0xef54('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xef54('0x4')]},'isexternal':{'type':Sequelize[_0xef54('0x1')](_0xef54('0x5'),'No')},'context':{'type':Sequelize[_0xef54('0x4')]},'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 0740d52..dafa50c 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 _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 +var _0xc42f=['fieldName','type','key','model','map','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','count','includeAll','include','rows','catch','show','params','VoiceTransferReport','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes'];(function(_0x211e68,_0x5d1f87){var _0x366432=function(_0x548baa){while(--_0x548baa){_0x211e68['push'](_0x211e68['shift']());}};_0x366432(++_0x5d1f87);}(_0xc42f,0xab));var _0xfc42=function(_0x460235,_0x24b3c3){_0x460235=_0x460235-0x0;var _0x4aa834=_0xc42f[_0x460235];return _0x4aa834;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc42('0x0'));var rimraf=require(_0xfc42('0x1'));var zipdir=require(_0xfc42('0x2'));var jsonpatch=require(_0xfc42('0x3'));var rp=require(_0xfc42('0x4'));var moment=require('moment');var BPromise=require(_0xfc42('0x5'));var Mustache=require(_0xfc42('0x6'));var util=require(_0xfc42('0x7'));var path=require('path');var sox=require(_0xfc42('0x8'));var csv=require('to-csv');var ejs=require(_0xfc42('0x9'));var fs=require('fs');var _=require(_0xfc42('0xa'));var squel=require(_0xfc42('0xb'));var crypto=require('crypto');var jsforce=require(_0xfc42('0xc'));var deskjs=require(_0xfc42('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfc42('0xe'));var Papa=require(_0xfc42('0xf'));var Redis=require(_0xfc42('0x10'));var authService=require(_0xfc42('0x11'));var qs=require(_0xfc42('0x12'));var as=require(_0xfc42('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfc42('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfc42('0x15'))['db'];function respondWithStatusCode(_0x165105,_0x45c2ad){_0x45c2ad=_0x45c2ad||0xcc;return function(_0x3719ab){if(_0x3719ab){return _0x165105[_0xfc42('0x16')](_0x45c2ad);}return _0x165105[_0xfc42('0x17')](_0x45c2ad)[_0xfc42('0x18')]();};}function respondWithResult(_0x6632ec,_0x1cf41b){_0x1cf41b=_0x1cf41b||0xc8;return function(_0x28c3db){if(_0x28c3db){return _0x6632ec[_0xfc42('0x17')](_0x1cf41b)[_0xfc42('0x19')](_0x28c3db);}};}function respondWithFilteredResult(_0xf1aa9f,_0x4a5176){return function(_0x40279a){if(_0x40279a){var _0x1bf598=_0x40279a['count'],_0xa10a48=_0x4a5176[_0xfc42('0x1a')],_0x4f8336=_0x4a5176[_0xfc42('0x1a')]+_0x4a5176[_0xfc42('0x1b')],_0x19a502;if(_0x4f8336>=_0x1bf598){_0x4f8336=_0x1bf598;_0x19a502=0xc8;}else{_0x19a502=0xce;}_0xf1aa9f['status'](_0x19a502);return _0xf1aa9f['set']('Content-Range',_0xa10a48+'-'+_0x4f8336+'/'+_0x1bf598)['json'](_0x40279a);}return null;};}function patchUpdates(_0x221cdd){return function(_0x4990d0){try{jsonpatch[_0xfc42('0x1c')](_0x4990d0,_0x221cdd,!![]);}catch(_0x8ec423){return BPromise['reject'](_0x8ec423);}return _0x4990d0[_0xfc42('0x1d')]();};}function saveUpdates(_0xeb740e,_0x513e9f){return function(_0x50c674){if(_0x50c674){return _0x50c674[_0xfc42('0x1e')](_0xeb740e)[_0xfc42('0x1f')](function(_0x4a5af9){return _0x4a5af9;});}return null;};}function removeEntity(_0xe88c18,_0x39fae4){return function(_0x57cabe){if(_0x57cabe){return _0x57cabe[_0xfc42('0x20')]()[_0xfc42('0x1f')](function(){_0xe88c18[_0xfc42('0x17')](0xcc)[_0xfc42('0x18')]();});}};}function handleEntityNotFound(_0xd1a1df,_0x44e568){return function(_0x3f3a86){if(!_0x3f3a86){_0xd1a1df[_0xfc42('0x16')](0x194);}return _0x3f3a86;};}function handleError(_0x4001a2,_0x2250de){_0x2250de=_0x2250de||0x1f4;return function(_0x2f9347){logger[_0xfc42('0x21')](_0x2f9347[_0xfc42('0x22')]);if(_0x2f9347[_0xfc42('0x23')]){delete _0x2f9347[_0xfc42('0x23')];}_0x4001a2['status'](_0x2250de)[_0xfc42('0x24')](_0x2f9347);};}exports[_0xfc42('0x25')]=function(_0x394c60,_0x2e68b2){var _0x2521a7={},_0x107a31={},_0x526b99={'count':0x0,'rows':[]};var _0x48ee03=_['map'](db['VoiceTransferReport'][_0xfc42('0x26')],function(_0x44fa68){return{'name':_0x44fa68[_0xfc42('0x27')],'type':_0x44fa68[_0xfc42('0x28')][_0xfc42('0x29')]};});_0x107a31[_0xfc42('0x2a')]=_[_0xfc42('0x2b')](_0x48ee03,_0xfc42('0x23'));_0x107a31[_0xfc42('0x2c')]=_[_0xfc42('0x2d')](_0x394c60['query']);_0x107a31[_0xfc42('0x2e')]=_['intersection'](_0x107a31[_0xfc42('0x2a')],_0x107a31[_0xfc42('0x2c')]);_0x2521a7['attributes']=_['intersection'](_0x107a31['model'],qs[_0xfc42('0x2f')](_0x394c60[_0xfc42('0x2c')][_0xfc42('0x2f')]));_0x2521a7[_0xfc42('0x30')]=_0x2521a7[_0xfc42('0x30')][_0xfc42('0x31')]?_0x2521a7['attributes']:_0x107a31['model'];if(!_0x394c60[_0xfc42('0x2c')][_0xfc42('0x32')]('nolimit')){_0x2521a7['limit']=qs[_0xfc42('0x1b')](_0x394c60[_0xfc42('0x2c')][_0xfc42('0x1b')]);_0x2521a7[_0xfc42('0x1a')]=qs[_0xfc42('0x1a')](_0x394c60[_0xfc42('0x2c')][_0xfc42('0x1a')]);}_0x2521a7[_0xfc42('0x33')]=qs[_0xfc42('0x34')](_0x394c60[_0xfc42('0x2c')]['sort']);_0x2521a7[_0xfc42('0x35')]=qs[_0xfc42('0x2e')](_[_0xfc42('0x36')](_0x394c60['query'],_0x107a31['filters']),_0x48ee03);if(_0x394c60[_0xfc42('0x2c')][_0xfc42('0x37')]){_0x2521a7[_0xfc42('0x35')]=_[_0xfc42('0x38')](_0x2521a7[_0xfc42('0x35')],{'$or':_[_0xfc42('0x2b')](_0x48ee03,function(_0x343afe){if(_0x343afe[_0xfc42('0x28')]!=='VIRTUAL'){var _0xb544af={};_0xb544af[_0x343afe[_0xfc42('0x23')]]={'$like':'%'+_0x394c60[_0xfc42('0x2c')][_0xfc42('0x37')]+'%'};return _0xb544af;}})});}_0x2521a7=_[_0xfc42('0x38')]({},_0x2521a7,_0x394c60['options']);var _0x5782d0={'where':_0x2521a7[_0xfc42('0x35')]};return db['VoiceTransferReport']['count'](_0x5782d0)[_0xfc42('0x1f')](function(_0x3c1acb){_0x526b99[_0xfc42('0x39')]=_0x3c1acb;if(_0x394c60[_0xfc42('0x2c')][_0xfc42('0x3a')]){_0x2521a7[_0xfc42('0x3b')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x2521a7);})[_0xfc42('0x1f')](function(_0xaf626c){_0x526b99[_0xfc42('0x3c')]=_0xaf626c;return _0x526b99;})[_0xfc42('0x1f')](respondWithFilteredResult(_0x2e68b2,_0x2521a7))[_0xfc42('0x3d')](handleError(_0x2e68b2,null));};exports[_0xfc42('0x3e')]=function(_0x1c190e,_0x41eb5f){var _0x412784={'raw':!![],'where':{'id':_0x1c190e[_0xfc42('0x3f')]['id']}},_0x13f2be={};_0x13f2be[_0xfc42('0x2a')]=_[_0xfc42('0x2d')](db[_0xfc42('0x40')][_0xfc42('0x26')]);_0x13f2be[_0xfc42('0x2c')]=_[_0xfc42('0x2d')](_0x1c190e[_0xfc42('0x2c')]);_0x13f2be[_0xfc42('0x2e')]=_['intersection'](_0x13f2be[_0xfc42('0x2a')],_0x13f2be[_0xfc42('0x2c')]);_0x412784['attributes']=_[_0xfc42('0x41')](_0x13f2be[_0xfc42('0x2a')],qs['fields'](_0x1c190e[_0xfc42('0x2c')][_0xfc42('0x2f')]));_0x412784[_0xfc42('0x30')]=_0x412784[_0xfc42('0x30')][_0xfc42('0x31')]?_0x412784[_0xfc42('0x30')]:_0x13f2be[_0xfc42('0x2a')];if(_0x1c190e[_0xfc42('0x2c')][_0xfc42('0x3a')]){_0x412784[_0xfc42('0x3b')]=[{'all':!![]}];}_0x412784=_[_0xfc42('0x38')]({},_0x412784,_0x1c190e['options']);return db[_0xfc42('0x40')][_0xfc42('0x42')](_0x412784)[_0xfc42('0x1f')](handleEntityNotFound(_0x41eb5f,null))['then'](respondWithResult(_0x41eb5f,null))[_0xfc42('0x3d')](handleError(_0x41eb5f,null));};exports['create']=function(_0x40278d,_0x5e3281){return db[_0xfc42('0x40')][_0xfc42('0x43')](_0x40278d[_0xfc42('0x44')],{})[_0xfc42('0x1f')](respondWithResult(_0x5e3281,0xc9))[_0xfc42('0x3d')](handleError(_0x5e3281,null));};exports[_0xfc42('0x1e')]=function(_0x451edc,_0x4d6cb8){if(_0x451edc[_0xfc42('0x44')]['id']){delete _0x451edc[_0xfc42('0x44')]['id'];}return db[_0xfc42('0x40')][_0xfc42('0x42')]({'where':{'id':_0x451edc[_0xfc42('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d6cb8,null))[_0xfc42('0x1f')](saveUpdates(_0x451edc[_0xfc42('0x44')],null))[_0xfc42('0x1f')](respondWithResult(_0x4d6cb8,null))[_0xfc42('0x3d')](handleError(_0x4d6cb8,null));};exports[_0xfc42('0x20')]=function(_0x4b2288,_0x1dd932){return db[_0xfc42('0x40')][_0xfc42('0x42')]({'where':{'id':_0x4b2288['params']['id']}})[_0xfc42('0x1f')](handleEntityNotFound(_0x1dd932,null))[_0xfc42('0x1f')](removeEntity(_0x1dd932,null))[_0xfc42('0x3d')](handleError(_0x1dd932,null));};exports['describe']=function(_0x1368aa,_0xe02678){return db[_0xfc42('0x40')][_0xfc42('0x45')]()[_0xfc42('0x1f')](respondWithResult(_0xe02678,null))['catch'](handleError(_0xe02678,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index c88a950..323597b 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 _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 +var _0x3a40=['rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1da62c,_0x2ffdbb){var _0x528c63=function(_0x17a18b){while(--_0x17a18b){_0x1da62c['push'](_0x1da62c['shift']());}};_0x528c63(++_0x2ffdbb);}(_0x3a40,0x1ab));var _0x03a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a40[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x03a4('0x0'));var util=require(_0x03a4('0x1'));var logger=require(_0x03a4('0x2'))(_0x03a4('0x3'));var moment=require(_0x03a4('0x4'));var BPromise=require(_0x03a4('0x5'));var rp=require(_0x03a4('0x6'));var fs=require('fs');var path=require(_0x03a4('0x7'));var rimraf=require(_0x03a4('0x8'));var config=require(_0x03a4('0x9'));var attributes=require(_0x03a4('0xa'));module[_0x03a4('0xb')]=function(_0xa10c61,_0xb5b49b){return _0xa10c61[_0x03a4('0xc')](_0x03a4('0xd'),attributes,{'tableName':_0x03a4('0xe'),'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 1932d99..f12c076 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 _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 +var _0x6d4e=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4bfcbe,_0x4630f5){var _0x5b65e6=function(_0x5dcfc8){while(--_0x5dcfc8){_0x4bfcbe['push'](_0x4bfcbe['shift']());}};_0x5b65e6(++_0x4630f5);}(_0x6d4e,0x12e));var _0xe6d4=function(_0xf1af27,_0x598bb1){_0xf1af27=_0xf1af27-0x0;var _0x46b274=_0x6d4e[_0xf1af27];return _0x46b274;};'use strict';var _=require(_0xe6d4('0x0'));var util=require(_0xe6d4('0x1'));var moment=require(_0xe6d4('0x2'));var BPromise=require(_0xe6d4('0x3'));var rs=require(_0xe6d4('0x4'));var fs=require('fs');var Redis=require(_0xe6d4('0x5'));var db=require(_0xe6d4('0x6'))['db'];var utils=require(_0xe6d4('0x7'));var logger=require(_0xe6d4('0x8'))(_0xe6d4('0x9'));var config=require(_0xe6d4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe6d4('0xb')][_0xe6d4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e56b2,_0x25397f,_0x1c5205){return new BPromise(function(_0x90a6e0,_0x1390c8){return client[_0xe6d4('0xd')](_0x5e56b2,_0x1c5205)[_0xe6d4('0xe')](function(_0x28c7ed){logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x25397f,'request\x20sent');logger[_0xe6d4('0x11')](_0xe6d4('0x12'),_0x25397f,_0xe6d4('0x13'),JSON[_0xe6d4('0x14')](_0x28c7ed));if(_0x28c7ed['error']){if(_0x28c7ed['error'][_0xe6d4('0x15')]===0x1f4){logger['error'](_0xe6d4('0x10'),_0x25397f,_0x28c7ed['error'][_0xe6d4('0x16')]);return _0x1390c8(_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);}logger[_0xe6d4('0x17')](_0xe6d4('0x10'),_0x25397f,_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);return _0x90a6e0(_0x28c7ed[_0xe6d4('0x17')][_0xe6d4('0x16')]);}else{logger[_0xe6d4('0xf')](_0xe6d4('0x10'),_0x25397f,'request\x20sent');_0x90a6e0(_0x28c7ed[_0xe6d4('0x18')][_0xe6d4('0x16')]);}})[_0xe6d4('0x19')](function(_0x20e83a){logger[_0xe6d4('0x17')](_0xe6d4('0x10'),_0x25397f,_0x20e83a);_0x1390c8(_0x20e83a);});});}exports[_0xe6d4('0x1a')]=function(_0x3ed6e4){var _0x1de7fb=this;return new Promise(function(_0x18bd1e,_0xc09df7){return db[_0xe6d4('0x1b')][_0xe6d4('0x1c')](_0x3ed6e4[_0xe6d4('0x1d')],{'raw':_0x3ed6e4[_0xe6d4('0x1e')]?_0x3ed6e4[_0xe6d4('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xe6d4('0xe')](function(_0x27b7c3){logger['info'](_0xe6d4('0x1a'),_0x3ed6e4);logger[_0xe6d4('0x11')](_0xe6d4('0x1a'),_0x3ed6e4,JSON[_0xe6d4('0x14')](_0x27b7c3));_0x18bd1e(_0x27b7c3);})[_0xe6d4('0x19')](function(_0x1091da){logger[_0xe6d4('0x17')](_0xe6d4('0x1a'),_0x1091da[_0xe6d4('0x16')],_0x3ed6e4);_0xc09df7(_0x1de7fb[_0xe6d4('0x17')](0x1f4,_0x1091da[_0xe6d4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index e446d47..5627693 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 _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 +var _0x12fd=['answer','/hold','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer'];(function(_0x2823d8,_0x47e3f6){var _0x531b3c=function(_0x2cfc22){while(--_0x2cfc22){_0x2823d8['push'](_0x2823d8['shift']());}};_0x531b3c(++_0x47e3f6);}(_0x12fd,0x199));var _0xd12f=function(_0x53703f,_0x138157){_0x53703f=_0x53703f-0x0;var _0x2a0e81=_0x12fd[_0x53703f];return _0x2a0e81;};'use strict';var express=require(_0xd12f('0x0'));var router=express[_0xd12f('0x1')]();var auth=require(_0xd12f('0x2'));var controller=require(_0xd12f('0x3'));router[_0xd12f('0x4')]('/originate',auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller[_0xd12f('0x7')]);router[_0xd12f('0x4')](_0xd12f('0x8'),auth[_0xd12f('0x5')](),auth['canUpdate'](),controller[_0xd12f('0x9')]);router['post'](_0xd12f('0xa'),auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller[_0xd12f('0xb')]);router['post'](_0xd12f('0xc'),auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller['hold']);router['post']('/unhold',auth[_0xd12f('0x5')](),auth[_0xd12f('0x6')](),controller['unhold']);router['post']('/calls',auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller['calls']);router[_0xd12f('0x4')](_0xd12f('0xd'),auth['isAuthenticated'](),auth[_0xd12f('0x6')](),controller[_0xd12f('0xe')]);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 6ec2550..2a85cd1 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 _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 +var _0xa7d8=['all','filter','UserId','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','stringify','emit','log','error','status','send','name','NotFound','then','code','message','result','User','findOne','agent','rows','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','catch','hangup','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','format','unhold\x20executed!','calls\x20fired:'];(function(_0x116ea0,_0x980666){var _0x1601a8=function(_0xfdae49){while(--_0xfdae49){_0x116ea0['push'](_0x116ea0['shift']());}};_0x1601a8(++_0x980666);}(_0xa7d8,0x94));var _0x8a7d=function(_0x5a4b8d,_0x4a71db){_0x5a4b8d=_0x5a4b8d-0x0;var _0x3b19fd=_0xa7d8[_0x5a4b8d];return _0x3b19fd;};'use strict';var path=require(_0x8a7d('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x8a7d('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8a7d('0x2'));var BPromise=require(_0x8a7d('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8a7d('0x4')][_0x8a7d('0x5')]({'port':0x232a});var logger=require(_0x8a7d('0x6'))(_0x8a7d('0x7'));var Redis=require(_0x8a7d('0x8'));config[_0x8a7d('0x9')]=_['defaults'](config[_0x8a7d('0x9')],{'host':_0x8a7d('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a7d('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],_0x8a7d('0xc')]},'callNumber':{'type':_0x8a7d('0xd'),'required':[!![],_0x8a7d('0xe')]},'callerId':{'type':_0x8a7d('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8a7d('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],_0x8a7d('0xc')]},'sessionId':{'type':_0x8a7d('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8a7d('0xc')]},'sessionId':{'type':_0x8a7d('0xd'),'required':[!![],_0x8a7d('0xf')]},'transferNumber':{'type':_0x8a7d('0xd'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],_0x8a7d('0xc')]},'sessionId':{'type':_0x8a7d('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],_0x8a7d('0xc')]},'sessionId':{'type':_0x8a7d('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],_0x8a7d('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8a7d('0xb'),'required':[!![],_0x8a7d('0xc')]}});function emit(_0x1b8932,_0x15889c,_0x430ff8){logger['info'](_0x1b8932,_0x15889c,JSON[_0x8a7d('0x10')](_0x430ff8));io['to'](_0x1b8932)[_0x8a7d('0x11')](_0x15889c,_0x430ff8);}function handleError(_0xdb2337){return function(_0x1d44a4){console[_0x8a7d('0x12')]('handleError:',_0x1d44a4,_0x1d44a4 instanceof RangeError);logger[_0x8a7d('0x13')](_0x1d44a4['stack']);if(_0x1d44a4 instanceof RangeError){if(_0x1d44a4['name']){delete _0x1d44a4['name'];}_0xdb2337[_0x8a7d('0x14')](0x194)[_0x8a7d('0x15')](_0x1d44a4);}else{if(_0x1d44a4[_0x8a7d('0x16')]){delete _0x1d44a4[_0x8a7d('0x16')];}_0xdb2337[_0x8a7d('0x14')](0x1f4)[_0x8a7d('0x15')](_0x1d44a4);}};}function checkError(){return function(_0xcdb881){if(!_0xcdb881){throw new RangeError(_0x8a7d('0x17'));}return _0xcdb881;};}function respondWithRpcPromise(_0x156718,_0x313b7e){return new BPromise(function(_0x164a70,_0x34d247){var _0x1b2eeb=amiClient;return _0x1b2eeb['request'](_0x156718,_0x313b7e)[_0x8a7d('0x18')](function(_0x5dfa31){if(_0x5dfa31[_0x8a7d('0x13')]){if(_0x5dfa31[_0x8a7d('0x13')][_0x8a7d('0x19')]===0x1f4){return _0x34d247(_0x5dfa31[_0x8a7d('0x13')]['message']);}return _0x164a70(_0x5dfa31[_0x8a7d('0x13')][_0x8a7d('0x1a')]);}else{_0x164a70(_0x5dfa31[_0x8a7d('0x1b')]);}})['catch'](function(_0x35a123){_0x34d247(_0x35a123);});});}function getAgent(_0x44c532){return db[_0x8a7d('0x1c')][_0x8a7d('0x1d')]({'where':{'id':_0x44c532,'role':_0x8a7d('0x1e')}})[_0x8a7d('0x18')](checkError());}function getAgentCheckSession(_0x9e4de0,_0xbbfd01){return new BPromise(function(_0x54389e,_0xdc95e1){var _0x3725e9=respondWithRpcPromise('VoiceChannels');var _0x4dafc0=getAgent(_0x9e4de0);Promise['all']([_0x3725e9,_0x4dafc0])[_0x8a7d('0x18')](function(_0x18310d){var _0x322732=_0x18310d[0x0];var _0x5ad9c0=_0x18310d[0x1];var _0x156b97=_['filter'](_0x322732[_0x8a7d('0x1f')],function(_0x10f129){return _0x10f129['UserId']==_0x5ad9c0['id']&&_0x10f129[_0x8a7d('0x20')]==_0xbbfd01;});if(_0x156b97[_0x8a7d('0x21')]==0x1){_0x54389e(_0x5ad9c0);}else{_0xdc95e1(new RangeError(_0x8a7d('0x22')+_0xbbfd01+'\x20not\x20found!'));}});});}exports[_0x8a7d('0x23')]=function(_0x59e05a,_0x3689f2){logger[_0x8a7d('0x24')](_0x8a7d('0x25'),_0x59e05a[_0x8a7d('0x26')]);var _0x1bb810=originateValidation[_0x8a7d('0x27')](_0x59e05a[_0x8a7d('0x26')]);if(_0x1bb810[_0x8a7d('0x21')]>0x0){return _0x3689f2[_0x8a7d('0x14')](0x190)[_0x8a7d('0x28')](_0x1bb810);}var _0x2dac74=_0x59e05a[_0x8a7d('0x26')][_0x8a7d('0x29')];var _0x33c8fc=_0x59e05a[_0x8a7d('0x26')][_0x8a7d('0x2a')];var _0x9b2012=_0x59e05a[_0x8a7d('0x26')][_0x8a7d('0x2b')];var _0x5005fb=_0x59e05a[_0x8a7d('0x26')][_0x8a7d('0x2c')];return getAgent(_0x2dac74)[_0x8a7d('0x18')](function(_0x19510b){logger['info'](_0x8a7d('0x2d'),_0x19510b[_0x8a7d('0x16')]);emit(util['format'](_0x8a7d('0x2e'),_0x19510b[_0x8a7d('0x16')]),'webbar:originate',{'callNumber':_0x33c8fc,'callerId':_0x9b2012,'callbackUrl':_0x5005fb});return _0x3689f2[_0x8a7d('0x14')](0xc8)[_0x8a7d('0x28')]({'error':![],'message':_0x8a7d('0x2f')});})[_0x8a7d('0x30')](handleError(_0x3689f2));};exports[_0x8a7d('0x31')]=function(_0x30fc77,_0x1c44f4){logger[_0x8a7d('0x24')]('hangup\x20fired:',_0x30fc77[_0x8a7d('0x26')]);var _0x39a00d=hangupValidation[_0x8a7d('0x27')](_0x30fc77['body']);if(_0x39a00d['length']>0x0){return _0x1c44f4['status'](0x190)[_0x8a7d('0x28')](_0x39a00d);}var _0x37f032=_0x30fc77[_0x8a7d('0x26')][_0x8a7d('0x29')];var _0x5987f2=_0x30fc77['body'][_0x8a7d('0x20')];return getAgent(_0x37f032)[_0x8a7d('0x18')](function(_0x3363aa){logger[_0x8a7d('0x24')](_0x8a7d('0x2d'),_0x3363aa[_0x8a7d('0x16')]);emit(util['format']('user:%s',_0x3363aa['name']),_0x8a7d('0x32'),{'sessionId':_0x5987f2});return _0x1c44f4[_0x8a7d('0x14')](0xc8)['json']({'error':![],'message':_0x8a7d('0x33')});})[_0x8a7d('0x30')](handleError(_0x1c44f4));};exports['answer']=function(_0x49283b,_0x495120){logger['info'](_0x8a7d('0x34'),_0x49283b[_0x8a7d('0x26')]);var _0x32bc1e=answerValidation[_0x8a7d('0x27')](_0x49283b[_0x8a7d('0x26')]);if(_0x32bc1e[_0x8a7d('0x21')]>0x0){return _0x495120[_0x8a7d('0x14')](0x190)['json'](_0x32bc1e);}var _0x16e6f1=_0x49283b[_0x8a7d('0x26')][_0x8a7d('0x29')];var _0x50a40f=_0x49283b['body'][_0x8a7d('0x20')];return getAgent(_0x16e6f1)['then'](function(_0x274e0f){logger[_0x8a7d('0x24')]('entityFound:',_0x274e0f[_0x8a7d('0x16')]);emit(util['format'](_0x8a7d('0x2e'),_0x274e0f['name']),_0x8a7d('0x35'),{'sessionId':_0x50a40f});return _0x495120['status'](0xc8)['json']({'error':![],'message':_0x8a7d('0x36')});})[_0x8a7d('0x30')](handleError(_0x495120));};exports[_0x8a7d('0x37')]=function(_0x1ad58f,_0xf1428d){logger['info'](_0x8a7d('0x38'),_0x1ad58f[_0x8a7d('0x26')]);var _0x592c50=holdValidation[_0x8a7d('0x27')](_0x1ad58f[_0x8a7d('0x26')]);if(_0x592c50['length']>0x0){return _0xf1428d['status'](0x190)['json'](_0x592c50);}var _0xd19778=_0x1ad58f[_0x8a7d('0x26')]['userId'];var _0x3777d3=_0x1ad58f[_0x8a7d('0x26')][_0x8a7d('0x20')];return getAgent(_0xd19778)[_0x8a7d('0x18')](function(_0x1bdda1){logger[_0x8a7d('0x24')](_0x8a7d('0x2d'),_0x1bdda1[_0x8a7d('0x16')]);emit(util['format'](_0x8a7d('0x2e'),_0x1bdda1[_0x8a7d('0x16')]),_0x8a7d('0x39'),{'sessionId':_0x3777d3});return _0xf1428d[_0x8a7d('0x14')](0xc8)[_0x8a7d('0x28')]({'error':![],'message':_0x8a7d('0x3a')});})['catch'](handleError(_0xf1428d));};exports['unhold']=function(_0x2cab17,_0x1fcf77){logger[_0x8a7d('0x24')]('unhold\x20fired:',_0x2cab17[_0x8a7d('0x26')]);var _0x5c2f46=unholdValidation[_0x8a7d('0x27')](_0x2cab17[_0x8a7d('0x26')]);if(_0x5c2f46[_0x8a7d('0x21')]>0x0){return _0x1fcf77['status'](0x190)[_0x8a7d('0x28')](_0x5c2f46);}var _0xc30bb5=_0x2cab17[_0x8a7d('0x26')][_0x8a7d('0x29')];var _0xa2a2af=_0x2cab17[_0x8a7d('0x26')][_0x8a7d('0x20')];return getAgent(_0xc30bb5)[_0x8a7d('0x18')](function(_0x327eac){logger[_0x8a7d('0x24')]('entityFound:',_0x327eac[_0x8a7d('0x16')]);emit(util[_0x8a7d('0x3b')](_0x8a7d('0x2e'),_0x327eac['name']),'webbar:unhold',{'sessionId':_0xa2a2af});return _0x1fcf77[_0x8a7d('0x14')](0xc8)[_0x8a7d('0x28')]({'error':![],'message':_0x8a7d('0x3c')});})[_0x8a7d('0x30')](handleError(_0x1fcf77));};exports['calls']=function(_0x48c9d3,_0x2d93cf){logger[_0x8a7d('0x24')](_0x8a7d('0x3d'),_0x2d93cf[_0x8a7d('0x26')]);var _0x38416a=callsValidation[_0x8a7d('0x27')](_0x48c9d3[_0x8a7d('0x26')]);if(_0x38416a[_0x8a7d('0x21')]>0x0){return _0x2d93cf[_0x8a7d('0x14')](0x190)['json'](_0x38416a);}var _0x27efdf=_0x48c9d3[_0x8a7d('0x26')]['userId'];var _0x5272df=respondWithRpcPromise('VoiceChannels');var _0x434f6e=getAgent(_0x27efdf);return Promise[_0x8a7d('0x3e')]([_0x5272df,_0x434f6e])['then'](function(_0x146784){var _0x4ab63d=_0x146784[0x0];var _0x33c803=_0x146784[0x1];var _0x4309e2=_[_0x8a7d('0x3f')](_0x4ab63d['rows'],function(_0x5e0eca){return _0x5e0eca[_0x8a7d('0x40')]==_0x33c803['id'];});return _0x2d93cf[_0x8a7d('0x14')](0xc8)['json']({'count':_0x4309e2['length'],'rows':_0x4309e2});})[_0x8a7d('0x30')](handleError(_0x2d93cf));};exports['conference']=function(_0x4cf992,_0x7ebd35){logger[_0x8a7d('0x24')]('conference\x20fired:',_0x4cf992[_0x8a7d('0x26')]);var _0xfcfeee=conferenceValidation[_0x8a7d('0x27')](_0x4cf992[_0x8a7d('0x26')]);if(_0xfcfeee['length']>0x0){return _0x7ebd35[_0x8a7d('0x14')](0x190)[_0x8a7d('0x28')](_0xfcfeee);}var _0xeb511b=_0x4cf992['body'][_0x8a7d('0x29')];return getAgent(_0xeb511b)['then'](function(_0x17c814){logger['info'](_0x8a7d('0x2d'),_0x17c814[_0x8a7d('0x16')]);emit(util[_0x8a7d('0x3b')](_0x8a7d('0x2e'),_0x17c814[_0x8a7d('0x16')]),_0x8a7d('0x41'));return _0x7ebd35[_0x8a7d('0x14')](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x8a7d('0x30')](handleError(_0x7ebd35));};exports[_0x8a7d('0x42')]=function(_0x5706e7,_0x12a03d){logger['info']('transfer\x20fired:',_0x5706e7[_0x8a7d('0x26')]);var _0x1e1e43=transferValidation['validate'](_0x5706e7[_0x8a7d('0x26')]);if(_0x1e1e43[_0x8a7d('0x21')]>0x0){return _0x12a03d[_0x8a7d('0x14')](0x190)[_0x8a7d('0x28')](_0x1e1e43);}var _0x4b4da7=_0x5706e7[_0x8a7d('0x26')]['userId'];var _0x27fa11=_0x5706e7[_0x8a7d('0x26')][_0x8a7d('0x20')];var _0x5c3c16=_0x5706e7['body'][_0x8a7d('0x43')];return getAgent(_0x4b4da7)[_0x8a7d('0x18')](function(_0x2bdb5a){logger[_0x8a7d('0x24')](_0x8a7d('0x2d'),_0x2bdb5a[_0x8a7d('0x16')]);emit(util[_0x8a7d('0x3b')](_0x8a7d('0x2e'),_0x2bdb5a['name']),_0x8a7d('0x44'),{'sessionId':_0x27fa11,'transferNumber':_0x5c3c16});return _0x12a03d['status'](0xc8)['json']({'error':![],'message':_0x8a7d('0x45')});})[_0x8a7d('0x30')](handleError(_0x12a03d));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 5c880de..2d619ca 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 _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 +var _0x2272=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','create','post','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x2272,0xd8));var _0x2227=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2272[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var path=require(_0x2227('0x2'));var timeout=require(_0x2227('0x3'));var express=require(_0x2227('0x4'));var router=express['Router']();var auth=require(_0x2227('0x5'));var interaction=require(_0x2227('0x6'));var config=require(_0x2227('0x7'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x2227('0x8')](),controller[_0x2227('0x9')]);router[_0x2227('0xa')](_0x2227('0xb'),auth[_0x2227('0x8')](),controller[_0x2227('0xc')]);router[_0x2227('0xa')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0xe')]);router['get'](_0x2227('0xf'),auth['isAuthenticated'](),controller[_0x2227('0x10')]);router[_0x2227('0xa')](_0x2227('0x11'),auth[_0x2227('0x8')](),controller[_0x2227('0x12')]);router['get'](_0x2227('0x13'),auth[_0x2227('0x8')](),controller[_0x2227('0x14')]);router[_0x2227('0xa')](_0x2227('0x15'),auth[_0x2227('0x8')](),controller['getApplications']);router['post']('/',auth['isAuthenticated'](),controller[_0x2227('0x16')]);router['post'](_0x2227('0xf'),auth[_0x2227('0x8')](),controller['addDisposition']);router[_0x2227('0x17')](_0x2227('0x11'),auth[_0x2227('0x8')](),controller[_0x2227('0x18')]);router[_0x2227('0x17')](_0x2227('0x13'),auth['isAuthenticated'](),controller[_0x2227('0x19')]);router[_0x2227('0x17')](_0x2227('0x15'),auth['isAuthenticated'](),controller[_0x2227('0x1a')]);router[_0x2227('0x17')](_0x2227('0x1b'),controller[_0x2227('0x1c')]);router[_0x2227('0x17')](_0x2227('0x1d'),auth[_0x2227('0x8')](),controller['send']);router[_0x2227('0x1e')]('/:id',auth[_0x2227('0x8')](),controller[_0x2227('0x1f')]);router[_0x2227('0x20')](_0x2227('0xd'),auth[_0x2227('0x8')](),controller[_0x2227('0x21')]);router[_0x2227('0x20')](_0x2227('0xf'),auth[_0x2227('0x8')](),controller[_0x2227('0x22')]);router[_0x2227('0x20')]('/:id/canned_answers',auth[_0x2227('0x8')](),controller[_0x2227('0x23')]);router['delete'](_0x2227('0x13'),auth[_0x2227('0x8')](),controller['removeAgents']);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 4fe1787..8c3d670 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 _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 +var _0x923b=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x487bbb,_0x502920){var _0x2f05ab=function(_0x1d5b62){while(--_0x1d5b62){_0x487bbb['push'](_0x487bbb['shift']());}};_0x2f05ab(++_0x502920);}(_0x923b,0xe2));var _0xb923=function(_0x4fdcc0,_0x560a01){_0x4fdcc0=_0x4fdcc0-0x0;var _0xc0ce94=_0x923b[_0x4fdcc0];return _0xc0ce94;};'use strict';var Sequelize=require(_0xb923('0x0'));var rs=require(_0xb923('0x1'));module['exports']={'name':{'type':Sequelize[_0xb923('0x2')],'unique':_0xb923('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xb923('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xb923('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xb923('0x2')]},'type':{'type':Sequelize[_0xb923('0x4')](_0xb923('0x5'))},'accountSid':{'type':Sequelize[_0xb923('0x2')]},'authToken':{'type':Sequelize[_0xb923('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb923('0x6');}},'notificationSound':{'type':Sequelize[_0xb923('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xb923('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb923('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb923('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb923('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb923('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xb923('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xb923('0xa'),'set':function(_0x37e325){if(!_0x37e325){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0xb923('0xb')](_0xb923('0xc'),_0x37e325);}},'description':{'type':Sequelize[_0xb923('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 15d2a31..a2d7955 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 _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 +var _0x8d42=['agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','\x0a','List','WhatsappInteraction','WhatsappMessage','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','save','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','count','include','findAll','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','describe','WhatsappAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','rows','removeAnswers','addAgents','omit','spread','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','whatsapp','Applications','applications','orderBy','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','CompanyId','mobile','type','twilio','from','From','replace','Body','messageId','MessageSid','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8d42,0x179));var _0x28d4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d42[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x28d4('0x0'));var emlformat=require(_0x28d4('0x1'));var rimraf=require(_0x28d4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28d4('0x3'));var rp=require('request-promise');var moment=require(_0x28d4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x28d4('0x5'));var path=require(_0x28d4('0x6'));var sox=require(_0x28d4('0x7'));var csv=require(_0x28d4('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x28d4('0x9'));var squel=require(_0x28d4('0xa'));var crypto=require(_0x28d4('0xb'));var jsforce=require(_0x28d4('0xc'));var deskjs=require(_0x28d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x28d4('0xe'));var Papa=require(_0x28d4('0xf'));var Redis=require(_0x28d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x28d4('0x11'));var as=require(_0x28d4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x28d4('0x13'))(_0x28d4('0x14'));var utils=require(_0x28d4('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x28d4('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x28d4('0x17')](config[_0x28d4('0x18')],{'host':_0x28d4('0x19'),'port':0x18eb});var socket=require(_0x28d4('0x1a'))(new Redis(config[_0x28d4('0x18')]));require(_0x28d4('0x1b'))['register'](socket);var jayson=require(_0x28d4('0x1c'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x54e7b7,_0x46b739,_0x33d1d8,_0x5880da){return new BPromise(function(_0x172e7d,_0x4521e4){var _0x409050=_0x5880da||client;return _0x409050[_0x28d4('0x1d')](_0x54e7b7,_0x33d1d8)[_0x28d4('0x1e')](function(_0x2a9c18){logger[_0x28d4('0x1f')](_0x28d4('0x20'),_0x46b739,_0x28d4('0x21'));logger[_0x28d4('0x22')](_0x28d4('0x23'),_0x46b739,'request\x20sent',JSON[_0x28d4('0x24')](_0x2a9c18));if(_0x2a9c18[_0x28d4('0x25')]){if(_0x2a9c18[_0x28d4('0x25')][_0x28d4('0x26')]===0x1f4){logger[_0x28d4('0x25')](_0x28d4('0x20'),_0x46b739,_0x2a9c18[_0x28d4('0x25')][_0x28d4('0x27')]);return _0x4521e4(_0x2a9c18[_0x28d4('0x25')][_0x28d4('0x27')]);}logger[_0x28d4('0x25')](_0x28d4('0x20'),_0x46b739,_0x2a9c18[_0x28d4('0x25')][_0x28d4('0x27')]);return _0x172e7d(_0x2a9c18[_0x28d4('0x25')]['message']);}else{logger['info'](_0x28d4('0x20'),_0x46b739,'request\x20sent');_0x172e7d(_0x2a9c18[_0x28d4('0x28')][_0x28d4('0x27')]);}})[_0x28d4('0x29')](function(_0x63bc13){logger[_0x28d4('0x25')](_0x28d4('0x20'),_0x46b739,_0x63bc13);_0x4521e4(_0x63bc13);});});}function respondWithStatusCode(_0x4246c2,_0x408525){_0x408525=_0x408525||0xcc;return function(_0x39f752){if(_0x39f752){return _0x4246c2[_0x28d4('0x2a')](_0x408525);}return _0x4246c2[_0x28d4('0x2b')](_0x408525)[_0x28d4('0x2c')]();};}function respondWithResult(_0x45306d,_0x4de650){_0x4de650=_0x4de650||0xc8;return function(_0x57097b){if(_0x57097b){return _0x45306d[_0x28d4('0x2b')](_0x4de650)[_0x28d4('0x2d')](_0x57097b);}};}function respondWithFilteredResult(_0x190a8c,_0x131105){return function(_0xd25099){if(_0xd25099){var _0x371807=_0xd25099['count'],_0x2bb2b6=_0x131105[_0x28d4('0x2e')],_0x875f0d=_0x131105[_0x28d4('0x2e')]+_0x131105[_0x28d4('0x2f')],_0x254de1;if(_0x875f0d>=_0x371807){_0x875f0d=_0x371807;_0x254de1=0xc8;}else{_0x254de1=0xce;}_0x190a8c[_0x28d4('0x2b')](_0x254de1);return _0x190a8c['set'](_0x28d4('0x30'),_0x2bb2b6+'-'+_0x875f0d+'/'+_0x371807)[_0x28d4('0x2d')](_0xd25099);}return null;};}function patchUpdates(_0x202cd3){return function(_0x205c86){try{jsonpatch['apply'](_0x205c86,_0x202cd3,!![]);}catch(_0x31402a){return BPromise['reject'](_0x31402a);}return _0x205c86[_0x28d4('0x31')]();};}function saveUpdates(_0x156ac6,_0x5e9c8a){return function(_0x3056af){if(_0x3056af){return _0x3056af['update'](_0x156ac6)[_0x28d4('0x1e')](function(_0x50aa1a){return _0x50aa1a;});}return null;};}function removeEntity(_0x573188,_0x44b54b){return function(_0x4cf7df){if(_0x4cf7df){return _0x4cf7df[_0x28d4('0x32')]()[_0x28d4('0x1e')](function(){var _0x2ab804=_0x4cf7df[_0x28d4('0x33')]({'plain':!![]});var _0x4e4436=_0x28d4('0x34');return db[_0x28d4('0x35')][_0x28d4('0x32')]({'where':{'type':_0x4e4436,'resourceId':_0x2ab804['id']}})[_0x28d4('0x1e')](function(){return _0x4cf7df;});})[_0x28d4('0x1e')](function(){_0x573188[_0x28d4('0x2b')](0xcc)[_0x28d4('0x2c')]();});}};}function handleEntityNotFound(_0x538b67,_0x3d143c){return function(_0x18fe54){if(!_0x18fe54){_0x538b67[_0x28d4('0x2a')](0x194);}return _0x18fe54;};}function handleError(_0x4dccc1,_0x1c7119){_0x1c7119=_0x1c7119||0x1f4;return function(_0x186b0f){logger[_0x28d4('0x25')](_0x186b0f['stack']);if(_0x186b0f[_0x28d4('0x36')]){delete _0x186b0f['name'];}_0x4dccc1[_0x28d4('0x2b')](_0x1c7119)[_0x28d4('0x37')](_0x186b0f);};}exports[_0x28d4('0x38')]=function(_0x207864,_0x51b375){var _0x585dc1={'include':[{'model':db[_0x28d4('0x39')],'as':_0x28d4('0x3a')}]},_0x4d4bb8={},_0x4c6899={'count':0x0,'rows':[]};var _0x3f359a=_[_0x28d4('0x3b')](db['WhatsappAccount'][_0x28d4('0x3c')],function(_0x583563){return{'name':_0x583563[_0x28d4('0x3d')],'type':_0x583563['type']['key']};});_0x4d4bb8[_0x28d4('0x3e')]=_[_0x28d4('0x3b')](_0x3f359a,_0x28d4('0x36'));_0x4d4bb8[_0x28d4('0x3f')]=_['keys'](_0x207864[_0x28d4('0x3f')]);_0x4d4bb8[_0x28d4('0x40')]=_['intersection'](_0x4d4bb8['model'],_0x4d4bb8[_0x28d4('0x3f')]);_0x585dc1[_0x28d4('0x41')]=_[_0x28d4('0x42')](_0x4d4bb8[_0x28d4('0x3e')],qs[_0x28d4('0x43')](_0x207864['query'][_0x28d4('0x43')]));_0x585dc1[_0x28d4('0x41')]=_0x585dc1['attributes'][_0x28d4('0x44')]?_0x585dc1['attributes']:_0x4d4bb8[_0x28d4('0x3e')];if(!_0x207864[_0x28d4('0x3f')]['hasOwnProperty'](_0x28d4('0x45'))){_0x585dc1['limit']=qs[_0x28d4('0x2f')](_0x207864[_0x28d4('0x3f')][_0x28d4('0x2f')]);_0x585dc1['offset']=qs[_0x28d4('0x2e')](_0x207864['query']['offset']);}_0x585dc1[_0x28d4('0x46')]=qs[_0x28d4('0x47')](_0x207864[_0x28d4('0x3f')][_0x28d4('0x47')]);_0x585dc1[_0x28d4('0x48')]=qs['filters'](_[_0x28d4('0x49')](_0x207864[_0x28d4('0x3f')],_0x4d4bb8['filters']),_0x3f359a);if(_0x207864[_0x28d4('0x3f')][_0x28d4('0x4a')]){_0x585dc1[_0x28d4('0x48')]=_[_0x28d4('0x4b')](_0x585dc1['where'],{'$or':_[_0x28d4('0x3b')](_0x3f359a,function(_0x2432c6){if(_0x2432c6['type']!==_0x28d4('0x4c')){var _0x339e48={};_0x339e48[_0x2432c6[_0x28d4('0x36')]]={'$like':'%'+_0x207864['query'][_0x28d4('0x4a')]+'%'};return _0x339e48;}})});}_0x585dc1=_['merge']({},_0x585dc1,_0x207864[_0x28d4('0x4d')]);var _0x2ebd25={'where':_0x585dc1[_0x28d4('0x48')]};return db[_0x28d4('0x4e')][_0x28d4('0x4f')](_0x2ebd25)[_0x28d4('0x1e')](function(_0xea5659){_0x4c6899[_0x28d4('0x4f')]=_0xea5659;if(_0x207864[_0x28d4('0x3f')]['includeAll']){_0x585dc1[_0x28d4('0x50')]=[{'all':!![]}];}return db[_0x28d4('0x4e')][_0x28d4('0x51')](_0x585dc1);})[_0x28d4('0x1e')](function(_0x4bfc22){_0x4c6899['rows']=_0x4bfc22;return _0x4c6899;})[_0x28d4('0x1e')](respondWithFilteredResult(_0x51b375,_0x585dc1))['catch'](handleError(_0x51b375,null));};exports['show']=function(_0x2d7f33,_0x50dc43){var _0x47838b={'raw':![],'where':{'id':_0x2d7f33[_0x28d4('0x52')]['id']},'include':[{'model':db[_0x28d4('0x39')],'as':_0x28d4('0x3a')}]},_0x83f2a={};_0x83f2a[_0x28d4('0x3e')]=_[_0x28d4('0x53')](db['WhatsappAccount'][_0x28d4('0x3c')]);_0x83f2a[_0x28d4('0x3f')]=_[_0x28d4('0x53')](_0x2d7f33[_0x28d4('0x3f')]);_0x83f2a['filters']=_[_0x28d4('0x42')](_0x83f2a[_0x28d4('0x3e')],_0x83f2a[_0x28d4('0x3f')]);_0x47838b['attributes']=_[_0x28d4('0x42')](_0x83f2a[_0x28d4('0x3e')],qs[_0x28d4('0x43')](_0x2d7f33[_0x28d4('0x3f')][_0x28d4('0x43')]));_0x47838b['attributes']=_0x47838b[_0x28d4('0x41')][_0x28d4('0x44')]?_0x47838b[_0x28d4('0x41')]:_0x83f2a[_0x28d4('0x3e')];if(_0x2d7f33['query'][_0x28d4('0x54')]){_0x47838b['include']=[{'all':!![]}];}_0x47838b=_[_0x28d4('0x4b')]({},_0x47838b,_0x2d7f33[_0x28d4('0x4d')]);return db[_0x28d4('0x4e')]['find'](_0x47838b)['then'](handleEntityNotFound(_0x50dc43,null))['then'](respondWithResult(_0x50dc43,null))[_0x28d4('0x29')](handleError(_0x50dc43,null));};exports['create']=function(_0x5cd65a,_0x5b6649){return db[_0x28d4('0x4e')][_0x28d4('0x55')](_0x5cd65a[_0x28d4('0x56')],{})[_0x28d4('0x1e')](function(_0x1e38ca){var _0x15644b=_0x5cd65a[_0x28d4('0x57')][_0x28d4('0x33')]({'plain':!![]});if(!_0x15644b)throw new Error(_0x28d4('0x58'));if(_0x15644b[_0x28d4('0x59')]==='user'){var _0xf10eb5=_0x1e38ca[_0x28d4('0x33')]({'plain':!![]});var _0x43313f=_0x28d4('0x34');return db[_0x28d4('0x5a')][_0x28d4('0x5b')]({'where':{'name':_0x43313f,'userProfileId':_0x15644b[_0x28d4('0x5c')]},'raw':!![]})[_0x28d4('0x1e')](function(_0x1d5ec2){if(_0x1d5ec2&&_0x1d5ec2[_0x28d4('0x5d')]===0x0){return db[_0x28d4('0x35')][_0x28d4('0x55')]({'name':_0xf10eb5[_0x28d4('0x36')],'resourceId':_0xf10eb5['id'],'type':_0x1d5ec2['name'],'sectionId':_0x1d5ec2['id']},{})[_0x28d4('0x1e')](function(){return _0x1e38ca;});}else{return _0x1e38ca;}})[_0x28d4('0x29')](function(_0x2c5361){logger[_0x28d4('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c5361);throw _0x2c5361;});}return _0x1e38ca;})[_0x28d4('0x1e')](respondWithResult(_0x5b6649,0xc9))['catch'](handleError(_0x5b6649,null));};exports[_0x28d4('0x5e')]=function(_0x1c458f,_0x126014){if(_0x1c458f[_0x28d4('0x56')]['id']){delete _0x1c458f[_0x28d4('0x56')]['id'];}return db['WhatsappAccount'][_0x28d4('0x5b')]({'where':{'id':_0x1c458f[_0x28d4('0x52')]['id']},'include':[{'model':db[_0x28d4('0x39')],'as':_0x28d4('0x3a')}]})[_0x28d4('0x1e')](handleEntityNotFound(_0x126014,null))[_0x28d4('0x1e')](saveUpdates(_0x1c458f[_0x28d4('0x56')],null))[_0x28d4('0x1e')](respondWithResult(_0x126014,null))[_0x28d4('0x29')](handleError(_0x126014,null));};exports['destroy']=function(_0x2e8e7b,_0x12d006){return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x2e8e7b['params']['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x12d006,null))[_0x28d4('0x1e')](removeEntity(_0x12d006,null))['catch'](handleError(_0x12d006,null));};exports['describe']=function(_0x3ef84a,_0x4eca5d){return db[_0x28d4('0x4e')][_0x28d4('0x5f')]()[_0x28d4('0x1e')](respondWithResult(_0x4eca5d,null))[_0x28d4('0x29')](handleError(_0x4eca5d,null));};exports['addDisposition']=function(_0x4d5763,_0x43e89f,_0x2a92df){if(_0x4d5763['body']['id']){delete _0x4d5763[_0x28d4('0x56')]['id'];}return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x4d5763[_0x28d4('0x52')]['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x43e89f,null))[_0x28d4('0x1e')](function(_0x41b9f1){if(_0x41b9f1){_0x4d5763[_0x28d4('0x56')][_0x28d4('0x60')]=_0x41b9f1['id'];return db[_0x28d4('0x61')]['create'](_0x4d5763[_0x28d4('0x56')]);}})[_0x28d4('0x1e')](respondWithResult(_0x43e89f,null))[_0x28d4('0x29')](handleError(_0x43e89f,null));};exports['getDispositions']=function(_0x4f42ad,_0x50ecc4,_0xd4c86a){var _0x6cf0c4={'raw':![],'where':{}};var _0x4ec855={};var _0x26725f={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x28d4('0x62')]({'where':{'id':_0x4f42ad[_0x28d4('0x52')]['id']}})['then'](handleEntityNotFound(_0x50ecc4,null))[_0x28d4('0x1e')](function(_0x2de69a){if(_0x2de69a){_0x4ec855[_0x28d4('0x3e')]=_[_0x28d4('0x53')](db[_0x28d4('0x61')][_0x28d4('0x3c')]);_0x4ec855['query']=_['keys'](_0x4f42ad[_0x28d4('0x3f')]);_0x4ec855[_0x28d4('0x40')]=_[_0x28d4('0x42')](_0x4ec855[_0x28d4('0x3e')],_0x4ec855[_0x28d4('0x3f')]);_0x6cf0c4[_0x28d4('0x41')]=_[_0x28d4('0x42')](_0x4ec855[_0x28d4('0x3e')],qs['fields'](_0x4f42ad['query'][_0x28d4('0x43')]));_0x6cf0c4[_0x28d4('0x41')]=_0x6cf0c4[_0x28d4('0x41')]['length']?_0x6cf0c4['attributes']:_0x4ec855[_0x28d4('0x3e')];if(!_0x4f42ad[_0x28d4('0x3f')][_0x28d4('0x63')](_0x28d4('0x45'))){_0x6cf0c4[_0x28d4('0x2f')]=qs[_0x28d4('0x2f')](_0x4f42ad['query']['limit']);_0x6cf0c4[_0x28d4('0x2e')]=qs[_0x28d4('0x2e')](_0x4f42ad[_0x28d4('0x3f')][_0x28d4('0x2e')]);}_0x6cf0c4[_0x28d4('0x46')]=qs[_0x28d4('0x47')](_0x4f42ad['query'][_0x28d4('0x47')]);_0x6cf0c4[_0x28d4('0x48')]=qs[_0x28d4('0x40')](_[_0x28d4('0x49')](_0x4f42ad[_0x28d4('0x3f')],_0x4ec855[_0x28d4('0x40')]));_0x6cf0c4[_0x28d4('0x48')]['WhatsappAccountId']=_0x2de69a['id'];if(_0x4f42ad['query']['filter']){_0x6cf0c4['where']=_['merge'](_0x6cf0c4[_0x28d4('0x48')],{'$or':_['map'](_0x6cf0c4[_0x28d4('0x41')],function(_0x5f2cce){var _0x54597e={};_0x54597e[_0x5f2cce]={'$like':'%'+_0x4f42ad[_0x28d4('0x3f')][_0x28d4('0x4a')]+'%'};return _0x54597e;})});}_0x6cf0c4=_[_0x28d4('0x4b')]({},_0x6cf0c4,_0x4f42ad['options']);return db['Disposition'][_0x28d4('0x4f')]({'where':_0x6cf0c4['where']})[_0x28d4('0x1e')](function(_0x2a8b4a){_0x26725f['count']=_0x2a8b4a;if(_0x4f42ad[_0x28d4('0x3f')]['includeAll']){_0x6cf0c4[_0x28d4('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x6cf0c4);})[_0x28d4('0x1e')](function(_0x1a5c2a){_0x26725f['rows']=_0x1a5c2a;return _0x26725f;});}})['then'](respondWithFilteredResult(_0x50ecc4,_0x6cf0c4))['catch'](handleError(_0x50ecc4,null));};exports[_0x28d4('0x64')]=function(_0x19242c,_0x182d25,_0x2abb33){return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x19242c[_0x28d4('0x52')]['id']}})['then'](handleEntityNotFound(_0x182d25,null))[_0x28d4('0x1e')](function(_0xcc2036){if(_0xcc2036){return _0xcc2036['removeDispositions'](_0x19242c['query'][_0x28d4('0x65')]);}})['then'](respondWithStatusCode(_0x182d25,null))[_0x28d4('0x29')](handleError(_0x182d25,null));};exports[_0x28d4('0x66')]=function(_0x19fa84,_0x4e4d78,_0x580df3){if(_0x19fa84[_0x28d4('0x56')]['id']){delete _0x19fa84[_0x28d4('0x56')]['id'];}return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x19fa84['params']['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x4e4d78,null))['then'](function(_0x2a449f){if(_0x2a449f){_0x19fa84[_0x28d4('0x56')][_0x28d4('0x60')]=_0x2a449f['id'];return db[_0x28d4('0x67')][_0x28d4('0x55')](_0x19fa84['body']);}})[_0x28d4('0x1e')](respondWithResult(_0x4e4d78,null))['catch'](handleError(_0x4e4d78,null));};exports['getAnswers']=function(_0x5f4327,_0x46072c,_0x36b9a5){var _0x44c276={'raw':![],'where':{}};var _0x5b3625={};var _0x5c393e={'count':0x0,'rows':[]};return db[_0x28d4('0x4e')][_0x28d4('0x62')]({'where':{'id':_0x5f4327['params']['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x46072c,null))[_0x28d4('0x1e')](function(_0x5c042e){if(_0x5c042e){_0x5b3625[_0x28d4('0x3e')]=_[_0x28d4('0x53')](db[_0x28d4('0x67')][_0x28d4('0x3c')]);_0x5b3625[_0x28d4('0x3f')]=_[_0x28d4('0x53')](_0x5f4327[_0x28d4('0x3f')]);_0x5b3625[_0x28d4('0x40')]=_[_0x28d4('0x42')](_0x5b3625[_0x28d4('0x3e')],_0x5b3625[_0x28d4('0x3f')]);_0x44c276[_0x28d4('0x41')]=_[_0x28d4('0x42')](_0x5b3625[_0x28d4('0x3e')],qs[_0x28d4('0x43')](_0x5f4327[_0x28d4('0x3f')][_0x28d4('0x43')]));_0x44c276[_0x28d4('0x41')]=_0x44c276[_0x28d4('0x41')]['length']?_0x44c276['attributes']:_0x5b3625['model'];if(!_0x5f4327['query']['hasOwnProperty'](_0x28d4('0x45'))){_0x44c276[_0x28d4('0x2f')]=qs['limit'](_0x5f4327[_0x28d4('0x3f')][_0x28d4('0x2f')]);_0x44c276[_0x28d4('0x2e')]=qs[_0x28d4('0x2e')](_0x5f4327['query'][_0x28d4('0x2e')]);}_0x44c276['order']=qs['sort'](_0x5f4327[_0x28d4('0x3f')][_0x28d4('0x47')]);_0x44c276[_0x28d4('0x48')]=qs['filters'](_[_0x28d4('0x49')](_0x5f4327[_0x28d4('0x3f')],_0x5b3625['filters']));_0x44c276[_0x28d4('0x48')][_0x28d4('0x60')]=_0x5c042e['id'];if(_0x5f4327[_0x28d4('0x3f')][_0x28d4('0x4a')]){_0x44c276[_0x28d4('0x48')]=_['merge'](_0x44c276['where'],{'$or':_['map'](_0x44c276[_0x28d4('0x41')],function(_0xcec81e){var _0x56ffff={};_0x56ffff[_0xcec81e]={'$like':'%'+_0x5f4327[_0x28d4('0x3f')][_0x28d4('0x4a')]+'%'};return _0x56ffff;})});}_0x44c276=_['merge']({},_0x44c276,_0x5f4327[_0x28d4('0x4d')]);return db[_0x28d4('0x67')][_0x28d4('0x4f')]({'where':_0x44c276[_0x28d4('0x48')]})[_0x28d4('0x1e')](function(_0x2aaeb9){_0x5c393e[_0x28d4('0x4f')]=_0x2aaeb9;if(_0x5f4327[_0x28d4('0x3f')][_0x28d4('0x54')]){_0x44c276['include']=[{'all':!![]}];}return db[_0x28d4('0x67')][_0x28d4('0x51')](_0x44c276);})['then'](function(_0x2ca4e0){_0x5c393e[_0x28d4('0x68')]=_0x2ca4e0;return _0x5c393e;});}})[_0x28d4('0x1e')](respondWithFilteredResult(_0x46072c,_0x44c276))[_0x28d4('0x29')](handleError(_0x46072c,null));};exports[_0x28d4('0x69')]=function(_0x1cb93f,_0x1ec6eb,_0x34e3d7){return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x1cb93f[_0x28d4('0x52')]['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x1ec6eb,null))[_0x28d4('0x1e')](function(_0x206ac2){if(_0x206ac2){return _0x206ac2['removeAnswers'](_0x1cb93f[_0x28d4('0x3f')][_0x28d4('0x65')]);}})[_0x28d4('0x1e')](respondWithStatusCode(_0x1ec6eb,null))[_0x28d4('0x29')](handleError(_0x1ec6eb,null));};exports[_0x28d4('0x6a')]=function(_0x5e7f7b,_0x2bc118,_0x5eb812){return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x5e7f7b[_0x28d4('0x52')]['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x2bc118,null))[_0x28d4('0x1e')](function(_0x1daaa8){if(_0x1daaa8){return _0x1daaa8[_0x28d4('0x6a')](_0x5e7f7b['body']['ids'],_[_0x28d4('0x6b')](_0x5e7f7b[_0x28d4('0x56')],[_0x28d4('0x65'),'id'])||{})[_0x28d4('0x6c')](function(_0x320060){for(var _0x56b77e=0x0;_0x56b77e<_0x5e7f7b['body']['ids'][_0x28d4('0x44')];_0x56b77e+=0x1){socket['emit']('userWhatsappAccount:save',{'UserId':_0x5e7f7b[_0x28d4('0x56')][_0x28d4('0x65')][_0x56b77e],'WhatsappAccountId':_0x5e7f7b['params']['id']});}return _0x320060;});}})[_0x28d4('0x1e')](respondWithResult(_0x2bc118,null))['catch'](handleError(_0x2bc118,null));};exports[_0x28d4('0x6d')]=function(_0x5b6e05,_0x3d35f4,_0x56b4fd){return db['WhatsappAccount'][_0x28d4('0x5b')]({'where':{'id':_0x5b6e05[_0x28d4('0x52')]['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x3d35f4,null))[_0x28d4('0x1e')](function(_0x50fc68){if(_0x50fc68){return _0x50fc68[_0x28d4('0x6d')](_0x5b6e05[_0x28d4('0x3f')]['ids'])[_0x28d4('0x1e')](function(){if(_[_0x28d4('0x6e')](_0x5b6e05[_0x28d4('0x3f')][_0x28d4('0x65')])){for(var _0x2d4747=0x0;_0x2d4747<_0x5b6e05[_0x28d4('0x3f')][_0x28d4('0x65')][_0x28d4('0x44')];_0x2d4747+=0x1){socket[_0x28d4('0x6f')](_0x28d4('0x70'),{'UserId':Number(_0x5b6e05[_0x28d4('0x3f')][_0x28d4('0x65')][_0x2d4747]),'WhatsappAccountId':Number(_0x5b6e05[_0x28d4('0x52')]['id'])});}}else{socket[_0x28d4('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x5b6e05[_0x28d4('0x3f')]['ids']),'WhatsappAccountId':Number(_0x5b6e05[_0x28d4('0x52')]['id'])});}});}})[_0x28d4('0x1e')](respondWithStatusCode(_0x3d35f4,null))[_0x28d4('0x29')](handleError(_0x3d35f4,null));};exports[_0x28d4('0x71')]=function(_0x24420d,_0x4ccbd6,_0x40c591){var _0x373cc7={};var _0x4582dc={};var _0x204d3e;var _0x5d5c57;return db['WhatsappAccount']['findOne']({'where':{'id':_0x24420d[_0x28d4('0x52')]['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x4ccbd6,null))[_0x28d4('0x1e')](function(_0x40a5f4){if(_0x40a5f4){_0x204d3e=_0x40a5f4;_0x4582dc[_0x28d4('0x3e')]=_[_0x28d4('0x53')](db[_0x28d4('0x72')]['rawAttributes']);_0x4582dc[_0x28d4('0x3f')]=_[_0x28d4('0x53')](_0x24420d['query']);_0x4582dc[_0x28d4('0x40')]=_[_0x28d4('0x42')](_0x4582dc['model'],_0x4582dc[_0x28d4('0x3f')]);_0x373cc7['attributes']=_[_0x28d4('0x42')](_0x4582dc[_0x28d4('0x3e')],qs[_0x28d4('0x43')](_0x24420d[_0x28d4('0x3f')][_0x28d4('0x43')]));_0x373cc7[_0x28d4('0x41')]=_0x373cc7[_0x28d4('0x41')]['length']?_0x373cc7[_0x28d4('0x41')]:_0x4582dc[_0x28d4('0x3e')];_0x373cc7[_0x28d4('0x46')]=qs['sort'](_0x24420d[_0x28d4('0x3f')][_0x28d4('0x47')]);_0x373cc7['where']=qs[_0x28d4('0x40')](_[_0x28d4('0x49')](_0x24420d[_0x28d4('0x3f')],_0x4582dc[_0x28d4('0x40')]));if(_0x24420d[_0x28d4('0x3f')][_0x28d4('0x4a')]){_0x373cc7['where']=_[_0x28d4('0x4b')](_0x373cc7['where'],{'$or':_[_0x28d4('0x3b')](_0x373cc7[_0x28d4('0x41')],function(_0x53601e){var _0x59a78d={};_0x59a78d[_0x53601e]={'$like':'%'+_0x24420d['query'][_0x28d4('0x4a')]+'%'};return _0x59a78d;})});}_0x373cc7=_[_0x28d4('0x4b')]({},_0x373cc7,_0x24420d[_0x28d4('0x4d')]);return _0x204d3e[_0x28d4('0x71')](_0x373cc7);}})['then'](function(_0x3486ab){if(_0x3486ab){_0x5d5c57=_0x3486ab['length'];if(!_0x24420d[_0x28d4('0x3f')][_0x28d4('0x63')](_0x28d4('0x45'))){_0x373cc7['limit']=qs[_0x28d4('0x2f')](_0x24420d[_0x28d4('0x3f')][_0x28d4('0x2f')]);_0x373cc7['offset']=qs['offset'](_0x24420d[_0x28d4('0x3f')]['offset']);}return _0x204d3e[_0x28d4('0x71')](_0x373cc7);}})[_0x28d4('0x1e')](function(_0x5d80fb){if(_0x5d80fb){return _0x5d80fb?{'count':_0x5d5c57,'rows':_0x5d80fb}:null;}})[_0x28d4('0x1e')](respondWithResult(_0x4ccbd6,null))[_0x28d4('0x29')](handleError(_0x4ccbd6,null));};exports[_0x28d4('0x73')]=function(_0x244935,_0x5d56fc,_0x3c9d3e){return db[_0x28d4('0x4e')][_0x28d4('0x62')]({'where':{'id':_0x244935[_0x28d4('0x52')]['id']}})['then'](handleEntityNotFound(_0x5d56fc,null))[_0x28d4('0x1e')](function(_0x431f30){if(_0x431f30){return db[_0x28d4('0x74')][_0x28d4('0x75')](function(_0x4aa603){return db[_0x28d4('0x76')]['destroy']({'where':{'WhatsappAccountId':_0x244935[_0x28d4('0x52')]['id']},'transaction':_0x4aa603})[_0x28d4('0x1e')](function(_0x430783){var _0x395702=_['map'](_0x244935['body'],function(_0x1b8284){_0x1b8284[_0x28d4('0x60')]=_0x244935[_0x28d4('0x52')]['id'];return _0x1b8284;});return db[_0x28d4('0x76')][_0x28d4('0x77')](_0x395702,{'transaction':_0x4aa603});});})[_0x28d4('0x1e')](function(){return db[_0x28d4('0x76')][_0x28d4('0x78')]({'where':{'WhatsappAccountId':_0x244935[_0x28d4('0x52')]['id']},'order':_0x28d4('0x79')});});}})[_0x28d4('0x1e')](respondWithResult(_0x5d56fc,null))[_0x28d4('0x29')](handleError(_0x5d56fc,null));};exports[_0x28d4('0x7a')]=function(_0x559455,_0x117717,_0x32ee2e){var _0x35ab2f={};var _0x958cd2={};var _0x4c83af;var _0x235142;return db[_0x28d4('0x4e')][_0x28d4('0x62')]({'where':{'id':_0x559455[_0x28d4('0x52')]['id']}})[_0x28d4('0x1e')](handleEntityNotFound(_0x117717,null))[_0x28d4('0x1e')](function(_0x4726c6){if(_0x4726c6){_0x4c83af=_0x4726c6;_0x958cd2[_0x28d4('0x3e')]=_[_0x28d4('0x53')](db[_0x28d4('0x76')][_0x28d4('0x3c')]);_0x958cd2[_0x28d4('0x3f')]=_[_0x28d4('0x53')](_0x559455[_0x28d4('0x3f')]);_0x958cd2[_0x28d4('0x40')]=_['intersection'](_0x958cd2[_0x28d4('0x3e')],_0x958cd2[_0x28d4('0x3f')]);_0x35ab2f[_0x28d4('0x41')]=_[_0x28d4('0x42')](_0x958cd2[_0x28d4('0x3e')],qs[_0x28d4('0x43')](_0x559455[_0x28d4('0x3f')][_0x28d4('0x43')]));_0x35ab2f[_0x28d4('0x41')]=_0x35ab2f['attributes'][_0x28d4('0x44')]?_0x35ab2f[_0x28d4('0x41')]:_0x958cd2[_0x28d4('0x3e')];_0x35ab2f[_0x28d4('0x46')]=qs['sort'](_0x559455[_0x28d4('0x3f')]['sort']);_0x35ab2f[_0x28d4('0x48')]=qs[_0x28d4('0x40')](_['pick'](_0x559455[_0x28d4('0x3f')],_0x958cd2['filters']));if(_0x559455[_0x28d4('0x3f')]['filter']){_0x35ab2f[_0x28d4('0x48')]=_[_0x28d4('0x4b')](_0x35ab2f[_0x28d4('0x48')],{'$or':_[_0x28d4('0x3b')](_0x35ab2f[_0x28d4('0x41')],function(_0x1fedc6){var _0x926b55={};_0x926b55[_0x1fedc6]={'$like':'%'+_0x559455[_0x28d4('0x3f')]['filter']+'%'};return _0x926b55;})});}_0x35ab2f=_[_0x28d4('0x4b')]({},_0x35ab2f,_0x559455['options']);return _0x4c83af['getApplications'](_0x35ab2f);}})['then'](function(_0x31a9e1){if(_0x31a9e1){_0x235142=_0x31a9e1[_0x28d4('0x44')];if(!_0x559455['query'][_0x28d4('0x63')](_0x28d4('0x45'))){_0x35ab2f[_0x28d4('0x2f')]=qs[_0x28d4('0x2f')](_0x559455[_0x28d4('0x3f')][_0x28d4('0x2f')]);_0x35ab2f['offset']=qs[_0x28d4('0x2e')](_0x559455['query']['offset']);}return _0x4c83af[_0x28d4('0x7a')](_0x35ab2f);}})[_0x28d4('0x1e')](function(_0x104e80){if(_0x104e80){return _0x104e80?{'count':_0x235142,'rows':_0x104e80}:null;}})[_0x28d4('0x1e')](respondWithResult(_0x117717,null))[_0x28d4('0x29')](handleError(_0x117717,null));};exports['notify']=function(_0x2b5534,_0x27ea79,_0x42b39b){var _0x2df872={'channel':_0x28d4('0x7b')};var _0xe3a6c6=[];var _0x3bb3f6=[];var _0x53570b={};return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0x2b5534[_0x28d4('0x52')]['id']},'include':[{'model':db[_0x28d4('0x76')],'as':_0x28d4('0x7c')}]})[_0x28d4('0x1e')](handleEntityNotFound(_0x27ea79,null))[_0x28d4('0x1e')](function(_0x8cfb4e){_0x2df872['account']=_0x8cfb4e;_0x2df872[_0x28d4('0x7d')]=_[_0x28d4('0x7e')](_0x8cfb4e['Applications'],[_0x28d4('0x79')],[_0x28d4('0x7f')]);if(_0x2df872[_0x28d4('0x80')]['Applications']){delete _0x2df872[_0x28d4('0x80')][_0x28d4('0x7c')];}return db[_0x28d4('0x81')]['describe']();})[_0x28d4('0x1e')](function(_0xeab822){if(!_0xeab822){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))](_0x28d4('0x84'));}_0xe3a6c6=_['difference'](_[_0x28d4('0x53')](_0xeab822),[_0x28d4('0x85'),'updatedAt']);_0x3bb3f6=_['difference'](_[_0x28d4('0x53')](_0xeab822),[_0x28d4('0x85'),_0x28d4('0x86'),_0x28d4('0x87'),'ListId']);_0x2df872[_0x28d4('0x56')]={'mapKey':_0x28d4('0x88')};if(_0x2df872[_0x28d4('0x80')][_0x28d4('0x89')]&&_0x2df872['account'][_0x28d4('0x89')]===_0x28d4('0x8a')){_0x2df872['body'][_0x28d4('0x8b')]=_0x2b5534['body'][_0x28d4('0x8c')][_0x28d4('0x8d')]('whatsapp:','');_0x2df872[_0x28d4('0x56')][_0x28d4('0x56')]=_0x2b5534[_0x28d4('0x56')][_0x28d4('0x8e')];_0x2df872['body'][_0x28d4('0x8f')]=_0x2b5534[_0x28d4('0x56')][_0x28d4('0x90')];}if(_0x2df872['body']['id']){delete _0x2df872[_0x28d4('0x56')]['id'];}if(_['isNil'](_0x2df872[_0x28d4('0x56')][_0x28d4('0x8b')])){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2df872[_0x28d4('0x56')]['body'])||_0x2df872[_0x28d4('0x56')][_0x28d4('0x56')]===''){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))](_0x28d4('0x91'));}if(_[_0x28d4('0x92')](_0x2df872['body'][_0x28d4('0x93')])){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))](_0x28d4('0x94')+_0x3bb3f6);}if(!_[_0x28d4('0x95')](_0x3bb3f6,_0x2df872[_0x28d4('0x56')][_0x28d4('0x93')])){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))](_0x28d4('0x96')+_0x3bb3f6);}_0x53570b[_0x2df872[_0x28d4('0x56')][_0x28d4('0x93')]]=_0x2df872[_0x28d4('0x56')][_0x28d4('0x8b')];return db[_0x28d4('0x97')][_0x28d4('0x5b')]({'where':{'id':_0x2df872[_0x28d4('0x80')][_0x28d4('0x98')]},'include':[{'model':db[_0x28d4('0x81')],'as':_0x28d4('0x99'),'where':_0x53570b,'limit':0x1,'order':[[_0x28d4('0x86'),_0x28d4('0x9a')]]}]});})[_0x28d4('0x1e')](handleEntityNotFound(_0x27ea79,null))['then'](function(_0x156278){if(_0x156278){_0x2df872[_0x28d4('0x9b')]=_['omit'](_0x156278,['Contacts']);if(_0x156278['Contacts'][_0x28d4('0x44')]){return _0x156278[_0x28d4('0x99')][0x0];}var _0x3815a2=_['defaults'](_0x2df872[_0x28d4('0x56')],{'firstName':_0x2df872[_0x28d4('0x56')][_0x28d4('0x8b')],'ListId':_0x156278['id']});_0x3815a2[_0x2df872[_0x28d4('0x56')][_0x28d4('0x93')]]=_0x2df872[_0x28d4('0x56')]['from'];return db[_0x28d4('0x81')][_0x28d4('0x55')](_0x3815a2,{'fields':_0xe3a6c6,'raw':!![]});}})['then'](handleEntityNotFound(_0x27ea79,null))[_0x28d4('0x1e')](function(_0x24929b){if(_0x24929b){_0x2df872[_0x28d4('0x9c')]=_0x24929b;var _0x283193={'ContactId':_0x24929b['id'],'phone':_0x2df872[_0x28d4('0x56')][_0x28d4('0x8b')],'WhatsappAccountId':_0x2b5534[_0x28d4('0x52')]['id']};var _0x12f872={'ContactId':_0x24929b['id'],'WhatsappAccountId':_0x2b5534[_0x28d4('0x52')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x28d4('0x5b')]({'where':_0x12f872})[_0x28d4('0x1e')](function(_0x3f8cbe){if(_0x3f8cbe){return[_0x3f8cbe,![]];}return db['WhatsappInteraction'][_0x28d4('0x55')](_0x283193)[_0x28d4('0x1e')](function(_0x3ebfc9){return[_0x3ebfc9,!![]];});});}})[_0x28d4('0x6c')](function(_0x4a1a2b,_0x2780eb){_0x2df872[_0x28d4('0x9d')]=_0x4a1a2b[_0x28d4('0x33')]({'plain':!![]});_0x2df872[_0x28d4('0x9d')][_0x28d4('0x9e')]=![];if(_0x2780eb){if(_0x2df872[_0x28d4('0x80')][_0x28d4('0x9f')]){_0x2df872['applications'][_0x28d4('0xa0')]({'id':0x0,'priority':_0x2df872['applications'][_0x28d4('0x44')]+0x1,'app':_0x28d4('0xa1'),'appdata':_0x28d4('0xa2'),'interval':_0x28d4('0xa3')});}_0x2df872[_0x28d4('0x9d')]['created']=!![];}return db['WhatsappMessage'][_0x28d4('0x55')]({'phone':_0x2df872[_0x28d4('0x56')][_0x28d4('0x8b')],'messageId':_0x2df872[_0x28d4('0x56')][_0x28d4('0x8f')],'body':_0x2df872[_0x28d4('0x56')]['body'],'WhatsappAccountId':_0x2b5534[_0x28d4('0x52')]['id'],'WhatsappInteractionId':_0x4a1a2b['id'],'direction':'in','ContactId':_0x4a1a2b[_0x28d4('0xa4')],'AttachmentId':_0x2df872[_0x28d4('0x56')]['AttachmentId']});})[_0x28d4('0x1e')](function(_0x4a9e2d){_0x2df872[_0x28d4('0x27')]=_0x4a9e2d;if(_0x2df872['interaction'][_0x28d4('0xa5')]){return db[_0x28d4('0x72')][_0x28d4('0x5b')]({'attributes':['id',_0x28d4('0x36')],'where':{'id':_0x2df872[_0x28d4('0x9d')]['UserId']}})[_0x28d4('0x1e')](function(_0x1f7f59){if(_0x1f7f59){_0x2df872[_0x28d4('0x7d')]['unshift']({'id':0x0,'priority':0x0,'app':_0x28d4('0xa6'),'appdata':_0x1f7f59['name']+','+(_0x2df872[_0x28d4('0x80')]['waitForTheAssignedAgent']||0xa),'interval':_0x28d4('0xa3')});}return respondWithRpcPromise('Start','startRouting',_0x2df872);});}return respondWithRpcPromise(_0x28d4('0xa7'),_0x28d4('0xa8'),_0x2df872);})[_0x28d4('0x1e')](function(_0x1b71ee){if(_0x1b71ee){var _0xf64b5b=0xc8;var _0x14dab6=_0x28d4('0xa9');logger[_0x28d4('0x1f')](_0x28d4('0x23'),_0x14dab6,_0xf64b5b,'entity\x20found');logger[_0x28d4('0x22')](_0x28d4('0xaa'),_0x14dab6,_0xf64b5b,_0x28d4('0xab'),JSON[_0x28d4('0x24')](_0x1b71ee));if(_0x2df872[_0x28d4('0x80')][_0x28d4('0x89')]===_0x28d4('0x8a')){return _0x27ea79['status'](_0xf64b5b)[_0x28d4('0xac')](_0x28d4('0xad'),_0x28d4('0xae'))[_0x28d4('0x37')](_0x28d4('0xaf'));}else{return _0x27ea79[_0x28d4('0x2b')](_0xf64b5b)[_0x28d4('0x2d')](_0x1b71ee);}}})[_0x28d4('0x29')](handleError(_0x27ea79,null));};exports[_0x28d4('0x37')]=function(_0xf38a81,_0x3c592b,_0x24c295){var _0x26d86f,_0x2526e2,_0x2dd1b1;if(_[_0x28d4('0x92')](_0xf38a81[_0x28d4('0x56')]['body'])||_0xf38a81[_0x28d4('0x56')][_0x28d4('0x56')]===''){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))](_0x28d4('0x91'));}if(_[_0x28d4('0x92')](_0xf38a81[_0x28d4('0x56')]['to'])){throw new db[(_0x28d4('0x82'))][(_0x28d4('0x83'))]('to\x20is\x20mandatory');}_0x26d86f=_0xf38a81[_0x28d4('0x56')]['to'];return db[_0x28d4('0x4e')][_0x28d4('0x5b')]({'where':{'id':_0xf38a81['params']['id']},'include':[{'model':db[_0x28d4('0x97')],'as':_0x28d4('0xb0'),'include':[{'model':db[_0x28d4('0x81')],'as':_0x28d4('0x99'),'where':{'mobile':_0x26d86f},'limit':0x1,'order':[['updatedAt',_0x28d4('0x9a')]]}]}]})['then'](handleEntityNotFound(_0x3c592b,null))[_0x28d4('0x1e')](function(_0x1d814f){if(_0x1d814f&&_0x1d814f['List']){_0x2526e2=_0x1d814f[_0x28d4('0x33')]({'plain':!![]});if(_0x2526e2[_0x28d4('0xb0')]&&_0x2526e2[_0x28d4('0xb0')][_0x28d4('0x99')][_0x28d4('0x44')]){return _0x2526e2[_0x28d4('0xb0')][_0x28d4('0x99')][0x0];}return db[_0x28d4('0x81')]['create'](_[_0x28d4('0x17')](_0xf38a81[_0x28d4('0x56')],{'firstName':_0x26d86f,'mobile':_0x26d86f,'phone':_0x26d86f,'ListId':_0x2526e2[_0x28d4('0x98')]}));}})['then'](handleEntityNotFound(_0x3c592b,null))[_0x28d4('0x1e')](function(_0x2f71c7){if(_0x2f71c7){_0x2dd1b1=_0x2f71c7;return db['WhatsappInteraction'][_0x28d4('0x5b')]({'where':{'ContactId':_0x2dd1b1['id'],'closed':![],'WhatsappAccountId':_0x2526e2['id']}})[_0x28d4('0x1e')](function(_0x51e4df){if(_0x51e4df){return[_0x51e4df,![]];}return db[_0x28d4('0xb1')][_0x28d4('0x55')]({'UserId':_0xf38a81[_0x28d4('0x57')]['id'],'ContactId':_0x2dd1b1['id'],'WhatsappAccountId':_0x2526e2['id'],'phone':_0x26d86f,'firstMsgDirection':'out','Messages':[_[_0x28d4('0x4b')](_0xf38a81[_0x28d4('0x56')],{'read':![],'body':_0xf38a81['body'][_0x28d4('0x56')],'phone':_0x26d86f,'WhatsappAccountId':_0x2526e2['id'],'UserId':_0xf38a81[_0x28d4('0x57')]['id'],'ContactId':_0x2dd1b1['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x28d4('0x1e')](function(_0x5e3d35){return[_0x5e3d35,!![]];});});}})[_0x28d4('0x6c')](function(_0x15cba0,_0x24e59f){if(_0x24e59f){return _0x15cba0;}return db[_0x28d4('0xb2')][_0x28d4('0x55')](_[_0x28d4('0x4b')](_0xf38a81[_0x28d4('0x56')],{'read':![],'body':_0xf38a81['body'][_0x28d4('0x56')],'phone':_0x26d86f,'WhatsappAccountId':_0x2526e2['id'],'WhatsappInteractionId':_0x15cba0['id'],'UserId':_0xf38a81[_0x28d4('0x57')]['id'],'ContactId':_0x2dd1b1['id']}))['then'](function(_0x2509b0){_0x15cba0['dataValues'][_0x28d4('0xb3')]=[];_0x15cba0[_0x28d4('0xb4')][_0x28d4('0xb3')][_0x28d4('0xa0')](_0x2509b0['dataValues']);return _0x15cba0;});})[_0x28d4('0x1e')](respondWithResult(_0x3c592b,null))[_0x28d4('0x29')](handleError(_0x3c592b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 511d000..894bff3 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 _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 +var _0x4351=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount'];(function(_0x4f5cbf,_0x1ce0ce){var _0x105ce0=function(_0x2ca7b5){while(--_0x2ca7b5){_0x4f5cbf['push'](_0x4f5cbf['shift']());}};_0x105ce0(++_0x1ce0ce);}(_0x4351,0x1b5));var _0x1435=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x4351[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0x1435('0x0'));var WhatsappAccount=require(_0x1435('0x1'))['db'][_0x1435('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1435('0x3')](0x0);var events={'afterCreate':_0x1435('0x4'),'afterUpdate':_0x1435('0x5'),'afterDestroy':_0x1435('0x6')};function emitEvent(_0x1b5f1e){return function(_0x2fc1f2,_0x2fa227,_0x111bc6){WhatsappAccountEvents[_0x1435('0x7')](_0x1b5f1e+':'+_0x2fc1f2['id'],_0x2fc1f2);WhatsappAccountEvents[_0x1435('0x7')](_0x1b5f1e,_0x2fc1f2);_0x111bc6(null);};}for(var e in events){if(events[_0x1435('0x8')](e)){var event=events[e];WhatsappAccount[_0x1435('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 89dc794..779f192 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 _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 +var _0x5289=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts'];(function(_0x4c6547,_0x5cb0b6){var _0x1f0e77=function(_0x50c7b5){while(--_0x50c7b5){_0x4c6547['push'](_0x4c6547['shift']());}};_0x1f0e77(++_0x5cb0b6);}(_0x5289,0x78));var _0x9528=function(_0x2509dc,_0x569858){_0x2509dc=_0x2509dc-0x0;var _0xf62d3=_0x5289[_0x2509dc];return _0xf62d3;};'use strict';var _=require(_0x9528('0x0'));var util=require(_0x9528('0x1'));var logger=require(_0x9528('0x2'))(_0x9528('0x3'));var moment=require(_0x9528('0x4'));var BPromise=require('bluebird');var rp=require(_0x9528('0x5'));var fs=require('fs');var path=require(_0x9528('0x6'));var rimraf=require('rimraf');var config=require(_0x9528('0x7'));var attributes=require(_0x9528('0x8'));module['exports']=function(_0x419d0b,_0x376d54){return _0x419d0b[_0x9528('0x9')](_0x9528('0xa'),attributes,{'tableName':_0x9528('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 87aeee4..03a70e0 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 _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 +var _0x6e6c=['randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','catch','ShowWhatsappAccount','find','options','raw','attributes','map','include','model','debug','lodash','util','bluebird'];(function(_0x496333,_0x1c47d6){var _0x44256e=function(_0x58767d){while(--_0x58767d){_0x496333['push'](_0x496333['shift']());}};_0x44256e(++_0x1c47d6);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});config[_0xc6e6('0x8')]=_[_0xc6e6('0x9')](config['redis'],{'host':_0xc6e6('0xa'),'port':0x18eb});var socket=require(_0xc6e6('0xb'))(new Redis(config['redis']));require(_0xc6e6('0xc'))['register'](socket);function respondWithRpcPromise(_0x172aa9,_0x3b2f50,_0x29f78a){return new BPromise(function(_0x3ddf6f,_0x12596b){return client[_0xc6e6('0xd')](_0x172aa9,_0x29f78a)[_0xc6e6('0xe')](function(_0x10aae5){logger[_0xc6e6('0xf')]('WhatsappAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));logger['debug'](_0xc6e6('0x11'),_0x3b2f50,_0xc6e6('0x10'),JSON[_0xc6e6('0x12')](_0x10aae5));if(_0x10aae5[_0xc6e6('0x13')]){if(_0x10aae5['error'][_0xc6e6('0x14')]===0x1f4){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x12596b(_0x10aae5['error'][_0xc6e6('0x16')]);}logger[_0xc6e6('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x3ddf6f(_0x10aae5[_0xc6e6('0x13')]['message']);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));_0x3ddf6f(_0x10aae5['result'][_0xc6e6('0x16')]);}})[_0xc6e6('0x17')](function(_0x1ecc8f){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x1ecc8f);_0x12596b(_0x1ecc8f);});});}exports[_0xc6e6('0x18')]=function(_0x34b879){var _0x2761c4=this;return new Promise(function(_0x28cbc3,_0x3d734d){return db['WhatsappAccount'][_0xc6e6('0x19')]({'raw':_0x34b879['options']?_0x34b879[_0xc6e6('0x1a')][_0xc6e6('0x1b')]===undefined?!![]:![]:!![],'where':_0x34b879[_0xc6e6('0x1a')]?_0x34b879[_0xc6e6('0x1a')]['where']||null:null,'attributes':_0x34b879[_0xc6e6('0x1a')]?_0x34b879[_0xc6e6('0x1a')][_0xc6e6('0x1c')]||null:null,'include':_0x34b879[_0xc6e6('0x1a')]?_0x34b879[_0xc6e6('0x1a')]['include']?_[_0xc6e6('0x1d')](_0x34b879['options'][_0xc6e6('0x1e')],function(_0x1ec62a){return{'model':db[_0x1ec62a[_0xc6e6('0x1f')]],'as':_0x1ec62a['as'],'attributes':_0x1ec62a[_0xc6e6('0x1c')],'include':_0x1ec62a['include']?_[_0xc6e6('0x1d')](_0x1ec62a['include'],function(_0x28577b){return{'model':db[_0x28577b['model']],'as':_0x28577b['as'],'attributes':_0x28577b[_0xc6e6('0x1c')],'include':_0x28577b[_0xc6e6('0x1e')]?_[_0xc6e6('0x1d')](_0x28577b[_0xc6e6('0x1e')],function(_0x66a240){return{'model':db[_0x66a240['model']],'as':_0x66a240['as'],'attributes':_0x66a240[_0xc6e6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc6e6('0xe')](function(_0x166313){logger[_0xc6e6('0xf')]('ShowWhatsappAccount',_0x34b879);logger[_0xc6e6('0x20')]('ShowWhatsappAccount',_0x34b879,JSON[_0xc6e6('0x12')](_0x166313));_0x28cbc3(_0x166313);})[_0xc6e6('0x17')](function(_0x12c616){logger[_0xc6e6('0x13')](_0xc6e6('0x18'),_0x12c616[_0xc6e6('0x16')],_0x34b879);_0x3d734d(_0x2761c4[_0xc6e6('0x13')](0x1f4,_0x12c616[_0xc6e6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index db2681b..1567743 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 _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 +var _0x2366=['removeListener','length','save','update','emit'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0x2366,0x18d));var _0x6236=function(_0x1e1e6c,_0x1100fd){_0x1e1e6c=_0x1e1e6c-0x0;var _0x3197d0=_0x2366[_0x1e1e6c];return _0x3197d0;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x6236('0x0'),'remove',_0x6236('0x1')];function createListener(_0x5e00c3,_0x55a595){return function(_0x3b0e74){_0x55a595[_0x6236('0x2')](_0x5e00c3,_0x3b0e74);};}function removeListener(_0x52f282,_0x296006){return function(){WhatsappAccountEvents[_0x6236('0x3')](_0x52f282,_0x296006);};}exports['register']=function(_0x19dd93){for(var _0x1983e5=0x0,_0x20e3ab=events[_0x6236('0x4')];_0x1983e5<_0x20e3ab;_0x1983e5++){var _0x8c6c77=events[_0x1983e5];var _0x50b25b=createListener('whatsappAccount:'+_0x8c6c77,_0x19dd93);WhatsappAccountEvents['on'](_0x8c6c77,_0x50b25b);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 6dca332..2204c95 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 _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 +var _0x29f4=['index','/:id','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated'];(function(_0x28ffb1,_0x319e2a){var _0x334914=function(_0x120725){while(--_0x120725){_0x28ffb1['push'](_0x28ffb1['shift']());}};_0x334914(++_0x319e2a);}(_0x29f4,0x17d));var _0x429f=function(_0x5a31af,_0x5218a6){_0x5a31af=_0x5a31af-0x0;var _0x37d294=_0x29f4[_0x5a31af];return _0x37d294;};'use strict';var multer=require('multer');var util=require(_0x429f('0x0'));var path=require(_0x429f('0x1'));var timeout=require(_0x429f('0x2'));var express=require(_0x429f('0x3'));var router=express[_0x429f('0x4')]();var auth=require(_0x429f('0x5'));var interaction=require(_0x429f('0x6'));var config=require(_0x429f('0x7'));var controller=require(_0x429f('0x8'));router['get']('/',auth[_0x429f('0x9')](),controller[_0x429f('0xa')]);router['get'](_0x429f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x429f('0xc')]('/',auth[_0x429f('0x9')](),controller[_0x429f('0xd')]);router[_0x429f('0xe')]('/:id',auth[_0x429f('0x9')](),controller[_0x429f('0xf')]);router['delete'](_0x429f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x429f('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 17caded..8fb651f 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 _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 +var _0x2cc1=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x262bc4,_0x2dfff7){var _0x35d164=function(_0x3f8e9c){while(--_0x3f8e9c){_0x262bc4['push'](_0x262bc4['shift']());}};_0x35d164(++_0x2dfff7);}(_0x2cc1,0x1a1));var _0x12cc=function(_0x1c4c1a,_0x1e4d6b){_0x1c4c1a=_0x1c4c1a-0x0;var _0x434002=_0x2cc1[_0x1c4c1a];return _0x434002;};'use strict';var Sequelize=require(_0x12cc('0x0'));module[_0x12cc('0x1')]={'priority':{'type':Sequelize[_0x12cc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x12cc('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x12cc('0x3')]},'interval':{'type':Sequelize[_0x12cc('0x3')],'defaultValue':_0x12cc('0x4')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 596fcd3..7d89a64 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 _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 +var _0x2a98=['name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','then','stack','send','WhatsappApplication','rawAttributes','fieldName','key','model','map'];(function(_0x4f036a,_0x3b7e4c){var _0x57e8cc=function(_0x1fd122){while(--_0x1fd122){_0x4f036a['push'](_0x4f036a['shift']());}};_0x57e8cc(++_0x3b7e4c);}(_0x2a98,0x14e));var _0x82a9=function(_0x130adf,_0x287807){_0x130adf=_0x130adf-0x0;var _0x5484db=_0x2a98[_0x130adf];return _0x5484db;};'use strict';var pdf=require(_0x82a9('0x0'));var emlformat=require(_0x82a9('0x1'));var rimraf=require(_0x82a9('0x2'));var zipdir=require(_0x82a9('0x3'));var jsonpatch=require(_0x82a9('0x4'));var rp=require(_0x82a9('0x5'));var moment=require(_0x82a9('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x82a9('0x7'));var path=require(_0x82a9('0x8'));var sox=require(_0x82a9('0x9'));var csv=require('to-csv');var ejs=require(_0x82a9('0xa'));var fs=require('fs');var _=require(_0x82a9('0xb'));var squel=require(_0x82a9('0xc'));var crypto=require(_0x82a9('0xd'));var jsforce=require(_0x82a9('0xe'));var deskjs=require(_0x82a9('0xf'));var toCsv=require(_0x82a9('0x10'));var querystring=require(_0x82a9('0x11'));var Papa=require(_0x82a9('0x12'));var Redis=require(_0x82a9('0x13'));var authService=require(_0x82a9('0x14'));var qs=require(_0x82a9('0x15'));var as=require(_0x82a9('0x16'));var hardwareService=require(_0x82a9('0x17'));var logger=require(_0x82a9('0x18'))(_0x82a9('0x19'));var utils=require(_0x82a9('0x1a'));var config=require(_0x82a9('0x1b'));var licenseUtil=require(_0x82a9('0x1c'));var db=require(_0x82a9('0x1d'))['db'];function respondWithStatusCode(_0x6bf183,_0x6f72c2){_0x6f72c2=_0x6f72c2||0xcc;return function(_0x887901){if(_0x887901){return _0x6bf183[_0x82a9('0x1e')](_0x6f72c2);}return _0x6bf183['status'](_0x6f72c2)[_0x82a9('0x1f')]();};}function respondWithResult(_0x4d275b,_0x442f5){_0x442f5=_0x442f5||0xc8;return function(_0x546a41){if(_0x546a41){return _0x4d275b[_0x82a9('0x20')](_0x442f5)[_0x82a9('0x21')](_0x546a41);}};}function respondWithFilteredResult(_0x4d1940,_0xe81e9b){return function(_0x3f8f77){if(_0x3f8f77){var _0x56a1ee=_0x3f8f77[_0x82a9('0x22')],_0x3dfdf0=_0xe81e9b[_0x82a9('0x23')],_0x3f9fe5=_0xe81e9b[_0x82a9('0x23')]+_0xe81e9b[_0x82a9('0x24')],_0x57b86c;if(_0x3f9fe5>=_0x56a1ee){_0x3f9fe5=_0x56a1ee;_0x57b86c=0xc8;}else{_0x57b86c=0xce;}_0x4d1940[_0x82a9('0x20')](_0x57b86c);return _0x4d1940['set']('Content-Range',_0x3dfdf0+'-'+_0x3f9fe5+'/'+_0x56a1ee)[_0x82a9('0x21')](_0x3f8f77);}return null;};}function patchUpdates(_0x5ca15a){return function(_0x35a546){try{jsonpatch[_0x82a9('0x25')](_0x35a546,_0x5ca15a,!![]);}catch(_0x513e78){return BPromise[_0x82a9('0x26')](_0x513e78);}return _0x35a546[_0x82a9('0x27')]();};}function saveUpdates(_0x888f4e,_0x3c6338){return function(_0x4d8e30){if(_0x4d8e30){return _0x4d8e30[_0x82a9('0x28')](_0x888f4e)['then'](function(_0xf220fc){return _0xf220fc;});}return null;};}function removeEntity(_0x5809d0,_0x4cc6f9){return function(_0x36dd60){if(_0x36dd60){return _0x36dd60[_0x82a9('0x29')]()[_0x82a9('0x2a')](function(){_0x5809d0[_0x82a9('0x20')](0xcc)[_0x82a9('0x1f')]();});}};}function handleEntityNotFound(_0x24424d,_0x401c4b){return function(_0x279c06){if(!_0x279c06){_0x24424d[_0x82a9('0x1e')](0x194);}return _0x279c06;};}function handleError(_0xed5fb9,_0x11c30d){_0x11c30d=_0x11c30d||0x1f4;return function(_0x5ec131){logger['error'](_0x5ec131[_0x82a9('0x2b')]);if(_0x5ec131['name']){delete _0x5ec131['name'];}_0xed5fb9[_0x82a9('0x20')](_0x11c30d)[_0x82a9('0x2c')](_0x5ec131);};}exports['index']=function(_0xfa4718,_0x340f45){var _0x5cf59d={},_0x44e10f={},_0x33b722={'count':0x0,'rows':[]};var _0x4ea0b1=_['map'](db[_0x82a9('0x2d')][_0x82a9('0x2e')],function(_0x3b78a5){return{'name':_0x3b78a5[_0x82a9('0x2f')],'type':_0x3b78a5['type'][_0x82a9('0x30')]};});_0x44e10f[_0x82a9('0x31')]=_[_0x82a9('0x32')](_0x4ea0b1,_0x82a9('0x33'));_0x44e10f[_0x82a9('0x34')]=_[_0x82a9('0x35')](_0xfa4718[_0x82a9('0x34')]);_0x44e10f[_0x82a9('0x36')]=_['intersection'](_0x44e10f[_0x82a9('0x31')],_0x44e10f[_0x82a9('0x34')]);_0x5cf59d[_0x82a9('0x37')]=_[_0x82a9('0x38')](_0x44e10f[_0x82a9('0x31')],qs[_0x82a9('0x39')](_0xfa4718[_0x82a9('0x34')][_0x82a9('0x39')]));_0x5cf59d[_0x82a9('0x37')]=_0x5cf59d[_0x82a9('0x37')][_0x82a9('0x3a')]?_0x5cf59d[_0x82a9('0x37')]:_0x44e10f[_0x82a9('0x31')];if(!_0xfa4718[_0x82a9('0x34')][_0x82a9('0x3b')]('nolimit')){_0x5cf59d[_0x82a9('0x24')]=qs['limit'](_0xfa4718[_0x82a9('0x34')][_0x82a9('0x24')]);_0x5cf59d[_0x82a9('0x23')]=qs[_0x82a9('0x23')](_0xfa4718[_0x82a9('0x34')][_0x82a9('0x23')]);}_0x5cf59d[_0x82a9('0x3c')]=qs['sort'](_0xfa4718[_0x82a9('0x34')]['sort']);_0x5cf59d[_0x82a9('0x3d')]=qs[_0x82a9('0x36')](_[_0x82a9('0x3e')](_0xfa4718[_0x82a9('0x34')],_0x44e10f[_0x82a9('0x36')]),_0x4ea0b1);if(_0xfa4718['query']['filter']){_0x5cf59d[_0x82a9('0x3d')]=_[_0x82a9('0x3f')](_0x5cf59d[_0x82a9('0x3d')],{'$or':_[_0x82a9('0x32')](_0x4ea0b1,function(_0x4f534c){if(_0x4f534c[_0x82a9('0x40')]!==_0x82a9('0x41')){var _0x486aad={};_0x486aad[_0x4f534c['name']]={'$like':'%'+_0xfa4718[_0x82a9('0x34')][_0x82a9('0x42')]+'%'};return _0x486aad;}})});}_0x5cf59d=_[_0x82a9('0x3f')]({},_0x5cf59d,_0xfa4718[_0x82a9('0x43')]);var _0x495c75={'where':_0x5cf59d[_0x82a9('0x3d')]};return db[_0x82a9('0x2d')][_0x82a9('0x22')](_0x495c75)[_0x82a9('0x2a')](function(_0x433abb){_0x33b722[_0x82a9('0x22')]=_0x433abb;if(_0xfa4718[_0x82a9('0x34')][_0x82a9('0x44')]){_0x5cf59d[_0x82a9('0x45')]=[{'all':!![]}];}return db[_0x82a9('0x2d')][_0x82a9('0x46')](_0x5cf59d);})[_0x82a9('0x2a')](function(_0x37065f){_0x33b722[_0x82a9('0x47')]=_0x37065f;return _0x33b722;})[_0x82a9('0x2a')](respondWithFilteredResult(_0x340f45,_0x5cf59d))[_0x82a9('0x48')](handleError(_0x340f45,null));};exports[_0x82a9('0x49')]=function(_0x5cede2,_0x5e7c31){var _0x3df06a={'raw':!![],'where':{'id':_0x5cede2[_0x82a9('0x4a')]['id']}},_0x32e256={};_0x32e256[_0x82a9('0x31')]=_[_0x82a9('0x35')](db[_0x82a9('0x2d')][_0x82a9('0x2e')]);_0x32e256[_0x82a9('0x34')]=_['keys'](_0x5cede2[_0x82a9('0x34')]);_0x32e256[_0x82a9('0x36')]=_['intersection'](_0x32e256[_0x82a9('0x31')],_0x32e256[_0x82a9('0x34')]);_0x3df06a[_0x82a9('0x37')]=_[_0x82a9('0x38')](_0x32e256[_0x82a9('0x31')],qs['fields'](_0x5cede2[_0x82a9('0x34')][_0x82a9('0x39')]));_0x3df06a[_0x82a9('0x37')]=_0x3df06a[_0x82a9('0x37')][_0x82a9('0x3a')]?_0x3df06a[_0x82a9('0x37')]:_0x32e256['model'];if(_0x5cede2['query'][_0x82a9('0x44')]){_0x3df06a[_0x82a9('0x45')]=[{'all':!![]}];}_0x3df06a=_[_0x82a9('0x3f')]({},_0x3df06a,_0x5cede2[_0x82a9('0x43')]);return db[_0x82a9('0x2d')]['find'](_0x3df06a)[_0x82a9('0x2a')](handleEntityNotFound(_0x5e7c31,null))[_0x82a9('0x2a')](respondWithResult(_0x5e7c31,null))[_0x82a9('0x48')](handleError(_0x5e7c31,null));};exports['create']=function(_0x72aedb,_0x393bf5){return db[_0x82a9('0x2d')][_0x82a9('0x4b')](_0x72aedb['body'],{})[_0x82a9('0x2a')](respondWithResult(_0x393bf5,0xc9))[_0x82a9('0x48')](handleError(_0x393bf5,null));};exports[_0x82a9('0x28')]=function(_0x1c6815,_0x47209b){if(_0x1c6815['body']['id']){delete _0x1c6815[_0x82a9('0x4c')]['id'];}return db[_0x82a9('0x2d')]['find']({'where':{'id':_0x1c6815[_0x82a9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x47209b,null))[_0x82a9('0x2a')](saveUpdates(_0x1c6815[_0x82a9('0x4c')],null))[_0x82a9('0x2a')](respondWithResult(_0x47209b,null))[_0x82a9('0x48')](handleError(_0x47209b,null));};exports[_0x82a9('0x29')]=function(_0x55402c,_0xac792c){return db['WhatsappApplication']['find']({'where':{'id':_0x55402c['params']['id']}})[_0x82a9('0x2a')](handleEntityNotFound(_0xac792c,null))['then'](removeEntity(_0xac792c,null))[_0x82a9('0x48')](handleError(_0xac792c,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ff93f03..86782b7 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 _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 +var _0xc041=['define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes'];(function(_0x376971,_0x3d9579){var _0x2286ff=function(_0x10c7db){while(--_0x10c7db){_0x376971['push'](_0x376971['shift']());}};_0x2286ff(++_0x3d9579);}(_0xc041,0x131));var _0x1c04=function(_0x503287,_0x252ead){_0x503287=_0x503287-0x0;var _0x3709ef=_0xc041[_0x503287];return _0x3709ef;};'use strict';var _=require('lodash');var util=require(_0x1c04('0x0'));var logger=require(_0x1c04('0x1'))(_0x1c04('0x2'));var moment=require(_0x1c04('0x3'));var BPromise=require(_0x1c04('0x4'));var rp=require(_0x1c04('0x5'));var fs=require('fs');var path=require(_0x1c04('0x6'));var rimraf=require(_0x1c04('0x7'));var config=require(_0x1c04('0x8'));var attributes=require(_0x1c04('0x9'));module['exports']=function(_0x1b8b56,_0x359831){return _0x1b8b56[_0x1c04('0xa')](_0x1c04('0xb'),attributes,{'tableName':_0x1c04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1c04('0xd'),'collate':_0x1c04('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 0be26e7..b6a5dbc 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 _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 +var _0xa630=['client','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b1eb0,_0x34966c){var _0x530d24=function(_0x36a8f3){while(--_0x36a8f3){_0x3b1eb0['push'](_0x3b1eb0['shift']());}};_0x530d24(++_0x34966c);}(_0xa630,0xbe));var _0x0a63=function(_0x6128bd,_0x123a90){_0x6128bd=_0x6128bd-0x0;var _0x19513f=_0xa630[_0x6128bd];return _0x19513f;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a63('0x4'))(_0x0a63('0x5'));var config=require(_0x0a63('0x6'));var jayson=require(_0x0a63('0x7'));var client=jayson[_0x0a63('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2760b0,_0x3d5f0b,_0xc2dcd7){return new BPromise(function(_0x41d21d,_0x12a7df){return client[_0x0a63('0x9')](_0x2760b0,_0xc2dcd7)['then'](function(_0x688acd){logger[_0x0a63('0xa')](_0x0a63('0xb'),_0x3d5f0b,_0x0a63('0xc'));logger[_0x0a63('0xd')](_0x0a63('0xe'),_0x3d5f0b,_0x0a63('0xc'),JSON[_0x0a63('0xf')](_0x688acd));if(_0x688acd[_0x0a63('0x10')]){if(_0x688acd[_0x0a63('0x10')]['code']===0x1f4){logger[_0x0a63('0x10')](_0x0a63('0xb'),_0x3d5f0b,_0x688acd[_0x0a63('0x10')][_0x0a63('0x11')]);return _0x12a7df(_0x688acd['error'][_0x0a63('0x11')]);}logger['error'](_0x0a63('0xb'),_0x3d5f0b,_0x688acd[_0x0a63('0x10')][_0x0a63('0x11')]);return _0x41d21d(_0x688acd[_0x0a63('0x10')][_0x0a63('0x11')]);}else{logger[_0x0a63('0xa')](_0x0a63('0xb'),_0x3d5f0b,_0x0a63('0xc'));_0x41d21d(_0x688acd['result'][_0x0a63('0x11')]);}})['catch'](function(_0x282856){logger[_0x0a63('0x10')](_0x0a63('0xb'),_0x3d5f0b,_0x282856);_0x12a7df(_0x282856);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 2f0935a..1f35e46 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 _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 +var _0x9980=['exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getMessages','download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','whatsappinteraction:update','delete','whatsappinteraction:destroy','removeTags'];(function(_0x543780,_0x4adb4b){var _0x3a8095=function(_0x1bca41){while(--_0x1bca41){_0x543780['push'](_0x543780['shift']());}};_0x3a8095(++_0x4adb4b);}(_0x9980,0x1ef));var _0x0998=function(_0x2860ab,_0x27440f){_0x2860ab=_0x2860ab-0x0;var _0x3037c4=_0x9980[_0x2860ab];return _0x3037c4;};'use strict';var multer=require('multer');var util=require(_0x0998('0x0'));var path=require(_0x0998('0x1'));var timeout=require(_0x0998('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0998('0x3'));var interaction=require(_0x0998('0x4'));var config=require(_0x0998('0x5'));var controller=require('./whatsappInteraction.controller');router[_0x0998('0x6')]('/',auth[_0x0998('0x7')](),controller[_0x0998('0x8')]);router[_0x0998('0x6')](_0x0998('0x9'),auth[_0x0998('0x7')](),controller['describe']);router['get'](_0x0998('0xa'),auth[_0x0998('0x7')](),controller[_0x0998('0xb')]);router[_0x0998('0x6')]('/:id/messages',auth[_0x0998('0x7')](),controller[_0x0998('0xc')]);router[_0x0998('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x0998('0xd')]);router[_0x0998('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0998('0xe')](_0x0998('0xf'),auth[_0x0998('0x7')](),controller[_0x0998('0x10')]);router['post'](_0x0998('0x11'),auth[_0x0998('0x7')](),interaction[_0x0998('0x12')](_0x0998('0x13'),_0x0998('0x14')),controller['addTags']);router['put'](_0x0998('0xa'),auth[_0x0998('0x7')](),interaction[_0x0998('0x12')](_0x0998('0x13'),_0x0998('0x15')),controller['update']);router[_0x0998('0x16')]('/:id',auth[_0x0998('0x7')](),interaction[_0x0998('0x12')]('whatsapp',_0x0998('0x17')),controller['destroy']);router[_0x0998('0x16')](_0x0998('0x11'),auth[_0x0998('0x7')](),controller[_0x0998('0x18')]);module[_0x0998('0x19')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index c39df9d..7c032e0 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 _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 +var _0xcdd2=['ENUM','out','sequelize','moment','BOOLEAN','STRING','DATE'];(function(_0x70404,_0x507113){var _0x2da0b9=function(_0x3fa2a9){while(--_0x3fa2a9){_0x70404['push'](_0x70404['shift']());}};_0x2da0b9(++_0x507113);}(_0xcdd2,0x13d));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2cdd('0x0'));var moment=require(_0x2cdd('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2cdd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2cdd('0x3')]},'secondDisposition':{'type':Sequelize[_0x2cdd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2cdd('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x2cdd('0x3')]},'read1stAt':{'type':Sequelize[_0x2cdd('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2cdd('0x5')]('in',_0x2cdd('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2cdd('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2cdd('0x5')]('in',_0x2cdd('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b98f48d..39f026e 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6ac=['getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','WhatsappAccountId','sequelize','toString','keyBy','merge','unreadMessages','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','show','params','includeAll','include','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','firstName','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Whatsapp','YYYY-MM-DD','N.A.','createdAt','closed','closedAt','disposition','Messages','existsSync','createReadStream','createWriteStream','out','System','lastName','basename','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','from','select','u.fullname','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','where','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role'];(function(_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 +var _0x1a85=['createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','count','toString','merge','WhatsappInteraction','a.key','Account.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','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','keys','includeAll','include','options','body','params','describe','addMessage','ids','getMessages','findOne','WhatsappMessage','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','root','server','tmp','join','files','attachments','transcript-%d-%s.zip','Attachment','direction','secret','WhatsappAccount','Account','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\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','Whatsapp','YYYY-MM-DD','N.A.','closed','closedAt','disposition','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','sendStatus','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','Users','fullname','Tags','TagIds','split','push','catch','index','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','left_join','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','UserId','some','compact','isEmpty','forEach','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?'];(function(_0x4c532d,_0x34759a){var _0x109022=function(_0x69e627){while(--_0x69e627){_0x4c532d['push'](_0x4c532d['shift']());}};_0x109022(++_0x34759a);}(_0x1a85,0x178));var _0x51a8=function(_0x49f856,_0x26dc54){_0x49f856=_0x49f856-0x0;var _0x1bacb6=_0x1a85[_0x49f856];return _0x1bacb6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x51a8('0x0'));var zipdir=require(_0x51a8('0x1'));var jsonpatch=require(_0x51a8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x51a8('0x3'));var Mustache=require(_0x51a8('0x4'));var util=require(_0x51a8('0x5'));var path=require('path');var sox=require(_0x51a8('0x6'));var csv=require('to-csv');var ejs=require(_0x51a8('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=_0x45a433['count'],_0x23539e=_0x1c2f25[_0x51a8('0x20')],_0x3bc1a2=_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x21')],_0x544886;if(_0x3bc1a2>=_0xd52230){_0x3bc1a2=_0xd52230;_0x544886=0xc8;}else{_0x544886=0xce;}_0x516abc[_0x51a8('0x1d')](_0x544886);return _0x516abc[_0x51a8('0x22')](_0x51a8('0x23'),_0x23539e+'-'+_0x3bc1a2+'/'+_0xd52230)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x3bf5b6){return function(_0x5ac1c0){try{jsonpatch[_0x51a8('0x24')](_0x5ac1c0,_0x3bf5b6,!![]);}catch(_0x53438c){return BPromise[_0x51a8('0x25')](_0x53438c);}return _0x5ac1c0[_0x51a8('0x26')]();};}function saveUpdates(_0x8bda40,_0x3759d6){return function(_0x51f737){if(_0x51f737){return _0x51f737[_0x51a8('0x27')](_0x8bda40)['then'](function(_0x47f063){return _0x47f063;});}return null;};}function removeEntity(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x28')]()[_0x51a8('0x29')](function(){_0x23d26a[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0x2f2f05,_0x291ed6){return function(_0x1326a2){if(!_0x1326a2){_0x2f2f05['sendStatus'](0x194);}return _0x1326a2;};}function handleError(_0x273ce2,_0x1b7577){_0x1b7577=_0x1b7577||0x1f4;return function(_0xca5746){logger[_0x51a8('0x2a')](_0xca5746[_0x51a8('0x2b')]);if(_0xca5746[_0x51a8('0x2c')]){delete _0xca5746[_0x51a8('0x2c')];}_0x273ce2[_0x51a8('0x1d')](_0x1b7577)[_0x51a8('0x2d')](_0xca5746);};}function getInteractionUsers(_0x4b5cda,_0x20c6b5){return new BPromise(function(_0x347a02,_0x4a1548){try{if(_0x20c6b5[_0x4b5cda['id']]){_0x4b5cda[_0x51a8('0x2e')]=_['map'](_0x20c6b5[_0x4b5cda['id']],function(_0x276424){return{'id':_0x276424['id'],'fullname':_0x276424[_0x51a8('0x2f')]};});}}catch(_0x143f46){_0x4a1548(_0x143f46);}_0x347a02(_0x4b5cda);});}function getInteractionTags(_0x41df56,_0x2136b4){return new BPromise(function(_0x4ea271,_0x10c19b){try{if(_0x41df56['TagIds']){_0x41df56[_0x51a8('0x30')]=[];_0x41df56[_0x51a8('0x31')][_0x51a8('0x32')](',')['forEach'](function(_0x2080a1){_0x41df56['Tags'][_0x51a8('0x33')](_0x2136b4[_0x2080a1]);});}delete _0x41df56[_0x51a8('0x31')];}catch(_0x1ba6a7){_0x10c19b(_0x1ba6a7);}_0x4ea271(_0x41df56);});}function updateWhatsappInteraction(_0x224099,_0x193e0f,_0x50195b){return new BPromise(function(_0x1167b8,_0x53b3b6){return getInteractionUsers(_0x224099,_0x50195b)[_0x51a8('0x29')](function(_0x2d977b){return getInteractionTags(_0x2d977b,_0x193e0f);})[_0x51a8('0x29')](function(_0x578fc6){_0x1167b8(_0x578fc6);})[_0x51a8('0x34')](function(_0xdc6cc7){_0x53b3b6(_0xdc6cc7);});});}exports[_0x51a8('0x35')]=function(_0x2429f8,_0x41c020){var _0x49ab37={},_0x4c2b3d={},_0x4d3114={'count':0x0,'rows':[]};var _0x21b871=_[_0x51a8('0x36')](db['WhatsappInteraction'][_0x51a8('0x37')],function(_0x4ec0ac){return{'name':_0x4ec0ac[_0x51a8('0x38')],'type':_0x4ec0ac[_0x51a8('0x39')][_0x51a8('0x3a')]};});_0x4c2b3d[_0x51a8('0x3b')]=_[_0x51a8('0x36')](_0x21b871,_0x51a8('0x2c'));_0x4c2b3d['query']=_['keys'](_0x2429f8[_0x51a8('0x3c')]);_0x4c2b3d['filters']=_['intersection'](_0x4c2b3d['model'],_0x4c2b3d[_0x51a8('0x3c')]);_0x49ab37[_0x51a8('0x3d')]=_[_0x51a8('0x3e')](_0x4c2b3d['model'],qs[_0x51a8('0x3f')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x3f')]));_0x49ab37[_0x51a8('0x3d')]=_0x49ab37['attributes'][_0x51a8('0x40')]?_0x49ab37[_0x51a8('0x3d')]:_0x4c2b3d[_0x51a8('0x3b')];if(!_0x2429f8['query'][_0x51a8('0x41')]('nolimit')){_0x49ab37[_0x51a8('0x21')]=qs[_0x51a8('0x21')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x21')]);_0x49ab37['offset']=qs[_0x51a8('0x20')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x20')]);}_0x49ab37[_0x51a8('0x42')]=qs[_0x51a8('0x43')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x43')]);_0x49ab37[_0x51a8('0x44')]=qs[_0x51a8('0x45')](_['pick'](_0x2429f8[_0x51a8('0x3c')],_0x4c2b3d[_0x51a8('0x45')]),_0x21b871);var _0x4c7c67=[];var _0x53409d=squel[_0x51a8('0x46')]()[_0x51a8('0x47')]('id')[_0x51a8('0x47')](_0x51a8('0x2c'))[_0x51a8('0x47')](_0x51a8('0x48'))[_0x51a8('0x49')](_0x51a8('0x4a'));var _0x26ad89=squel[_0x51a8('0x46')]()['field'](_0x51a8('0x4b'))[_0x51a8('0x47')](_0x51a8('0x4c'))[_0x51a8('0x47')](_0x51a8('0x4d'))[_0x51a8('0x49')]('user_has_whatsapp_interactions','ui')[_0x51a8('0x4e')]('users','u',_0x51a8('0x4f'));var _0x3a33f3=squel[_0x51a8('0x46')]()[_0x51a8('0x49')](_0x51a8('0x50'),'i')['left_join']('cm_contacts','c',_0x51a8('0x51'))[_0x51a8('0x4e')](_0x51a8('0x52'),'o',_0x51a8('0x53'))[_0x51a8('0x4e')]('whatsapp_accounts','a','a.id\x20=\x20i.WhatsappAccountId')[_0x51a8('0x4e')](_0x51a8('0x54'),'me',_0x51a8('0x55'))[_0x51a8('0x4e')](_0x51a8('0x56'),'it',_0x51a8('0x57'))[_0x51a8('0x4e')](_0x51a8('0x4a'),'t',_0x51a8('0x58'));var _0x4d29ab=squel['expr']();var _0x5db030=[];var _0x3e2d6c=squel[_0x51a8('0x59')]();var _0x103897;if(_0x2429f8['query'][_0x51a8('0x5a')]){_0x103897=as[_0x51a8('0x5b')](_0x2429f8['query'][_0x51a8('0x5a')]);var _0x4fb93c=_0x103897['sqlOperator'];for(var _0xbf828b=0x0;_0xbf828b<_0x103897[_0x51a8('0x5c')][_0x51a8('0x40')];_0xbf828b++){var _0x56d7f1=_0x103897['conditions'][_0xbf828b];var _0x3a8f1e='i';var _0x5b0398=_[_0x51a8('0x5d')](_0x21b871,[_0x51a8('0x2c'),_0x56d7f1[_0x51a8('0x47')]]);if(!_0x5b0398){switch(_0x56d7f1[_0x51a8('0x47')]){case _0x51a8('0x5e'):if(_0x56d7f1[_0x51a8('0x5f')]==0x1){_0x3a33f3[_0x51a8('0x60')]('`'+_0x56d7f1[_0x51a8('0x47')]+_0x51a8('0x61'));}else{_0x3a33f3['having']('`'+_0x56d7f1[_0x51a8('0x47')]+_0x51a8('0x62'));}break;case _0x51a8('0x63'):if(_0x56d7f1[_0x51a8('0x64')]==='$substring'){if(_0x56d7f1[_0x51a8('0x5f')]['split']('\x20')[_0x51a8('0x40')]>0x1){_0x4d29ab[_0x4fb93c](_0x51a8('0x65'),qs['getFullTextValue'](_0x56d7f1['value']),null);}else{var _0x2628d4='%'+_0x56d7f1[_0x51a8('0x5f')]+'%';_0x4d29ab[_0x4fb93c](_0x51a8('0x66'),_0x2628d4,_0x2628d4,_0x2628d4);}}else{_0x5b0398=_[_0x51a8('0x5d')](_0x21b871,[_0x51a8('0x2c'),'ContactId']);_0x56d7f1[_0x51a8('0x47')]=_0x51a8('0x67');_0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);}break;case _0x51a8('0x6b'):var _0x62966a=_0x56d7f1[_0x51a8('0x5f')]['split'](',')['map'](function(_0x4ba203){return Number(_0x4ba203);});_0x62966a['forEach'](function(_0x2048c6){_0x3e2d6c['or'](_0x51a8('0x6c'),'%,'+_0x2048c6+',%');});_0x5db030=_['union'](_0x5db030,_0x62966a);break;case _0x51a8('0x6d'):if(_0x56d7f1['operator']===_0x51a8('0x6e')){_0x4d29ab[_0x4fb93c]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x56d7f1[_0x51a8('0x5f')]+'%',null);}else{_0x5b0398=_[_0x51a8('0x5d')](_0x21b871,['name','UserId']);_0x56d7f1['field']=_0x51a8('0x6f');_0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);}break;case'body':_0x390c25=as[_0x51a8('0x68')]('me',null,_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25[_0x51a8('0x69')],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25[_0x51a8('0x5f')][_0x51a8('0x1e')]);break;}}else{var _0x390c25=as[_0x51a8('0x68')](_0x3a8f1e,_0x5b0398[_0x51a8('0x39')],_0x56d7f1);_0x4d29ab[_0x4fb93c](_0x390c25['text'],_0x390c25['value'][_0x51a8('0x6a')],_0x390c25['value']['end']);}}}else{var _0x50a6ad=_(_0x2429f8['query'])['keys']()[_0x51a8('0x36')](function(_0x529b2f){return _[_0x51a8('0x70')](_0x21b871,[_0x51a8('0x2c'),_0x529b2f])?_0x529b2f:undefined;})[_0x51a8('0x71')]()[_0x51a8('0x5f')]();if(!_[_0x51a8('0x72')](_0x50a6ad)){_0x50a6ad[_0x51a8('0x73')](function(_0x28c539){if(_0x28c539===_0x51a8('0x74')){_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x75'),[]['concat'](_0x2429f8[_0x51a8('0x3c')][_0x28c539]));}else if(_0x28c539===_0x51a8('0x76')){var _0x31ee59=JSON['parse'](_0x2429f8['query'][_0x28c539])['$gte'];var _0x10c22e=JSON[_0x51a8('0x77')](_0x2429f8[_0x51a8('0x3c')][_0x28c539])[_0x51a8('0x78')];_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x79'),_0x31ee59,_0x10c22e);}else{if(_0x2429f8[_0x51a8('0x3c')][_0x28c539]===_0x51a8('0x7a')){_0x3a33f3[_0x51a8('0x44')]('i.'+_0x28c539+_0x51a8('0x7b'));}else{_0x3a33f3[_0x51a8('0x44')]('i.'+_0x28c539+_0x51a8('0x7c'),_0x2429f8[_0x51a8('0x3c')][_0x28c539]);}}});}if(_0x2429f8['query'][_0x51a8('0x7d')]){if(_0x2429f8[_0x51a8('0x3c')]['read']==0x1){_0x3a33f3[_0x51a8('0x60')]('`unreadMessages`\x20=\x200');}else{_0x3a33f3['having']('`unreadMessages`\x20>\x200');}}if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')]){_0x5db030=_[_0x51a8('0x7f')](_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')])?_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x7e')]:new Array(_0x2429f8['query']['tag']);_0x5db030['forEach'](function(_0x44e496){_0x3e2d6c['or'](_0x51a8('0x6c'),'%,'+_0x44e496+',%');});}if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x80')]){var _0x32a40b=_0x2429f8[_0x51a8('0x3c')]['filter'][_0x51a8('0x81')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x51a8('0x82')](_0x32a40b)){_0x4d29ab['or'](_0x51a8('0x83'),_0x32a40b+'%')['or'](_0x51a8('0x84'),_0x32a40b+'%');}else{_0x4d29ab['or'](_0x51a8('0x85'),qs[_0x51a8('0x86')](_0x32a40b))['or'](_0x51a8('0x87'),_0x32a40b+'%');}}}_0x3a33f3[_0x51a8('0x44')](_0x4d29ab);_0x3a33f3[_0x51a8('0x88')](_0x51a8('0x89'));var _0x39fcef={'type':db[_0x51a8('0x8a')]['QueryTypes']['SELECT'],'raw':!![]};var _0x21912f=_0x3a33f3[_0x51a8('0x8b')]();_0x21912f[_0x51a8('0x47')](_0x51a8('0x89'));_0x21912f['field'](_0x51a8('0x8c'),'unreadMessages');if(_0x49ab37[_0x51a8('0x42')]){_0x49ab37[_0x51a8('0x42')][_0x51a8('0x73')](function(_0x24fcc3){var _0x190632=_0x24fcc3[0x0]===_0x51a8('0x8d')?_0x24fcc3[0x0]:'i.'+_0x24fcc3[0x0];_0x3a33f3[_0x51a8('0x42')](_0x190632,_0x24fcc3[0x1]===_0x51a8('0x8e')?![]:!![]);});}if(!_[_0x51a8('0x72')](_0x5db030)){_0x3a33f3['having'](_0x3e2d6c);_0x21912f[_0x51a8('0x44')](_0x51a8('0x8f'),_0x5db030);}BPromise[_0x51a8('0x90')]()[_0x51a8('0x29')](function(){if(!_0x103897){if(_0x2429f8['query']['WhatsappAccountId'])return;_0x21912f[_0x51a8('0x44')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x3a33f3['where']('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2429f8[_0x51a8('0x91')]['role']!=='agent')return;return _0x2429f8[_0x51a8('0x91')][_0x51a8('0x92')]({'attributes':['id'],'raw':!![]})[_0x51a8('0x29')](function(_0x5be0ce){if(_[_0x51a8('0x72')](_0x5be0ce)){_0x21912f[_0x51a8('0x44')](_0x51a8('0x93'));_0x3a33f3['where'](_0x51a8('0x93'));}else{_0x21912f[_0x51a8('0x44')](_0x51a8('0x75'),_[_0x51a8('0x36')](_0x5be0ce,'id'));_0x3a33f3[_0x51a8('0x44')](_0x51a8('0x75'),_[_0x51a8('0x36')](_0x5be0ce,'id'));}});})[_0x51a8('0x29')](function(){if(_0x2429f8[_0x51a8('0x91')]['role']===_0x51a8('0x94')&&!_0x103897&&!_0x2429f8[_0x51a8('0x3c')]['WhatsappAccountId'])return[];return db[_0x51a8('0x95')][_0x51a8('0x3c')](_0x21912f['toString'](),_0x39fcef);})[_0x51a8('0x29')](function(_0x132ce5){_0x4d3114[_0x51a8('0x96')]=_0x132ce5[_0x51a8('0x40')];if(_0x4d3114[_0x51a8('0x96')]===0x0)return[];return db['sequelize'][_0x51a8('0x3c')](_0x53409d[_0x51a8('0x97')](),_0x39fcef)[_0x51a8('0x29')](function(_0x1d587e){_0x4c7c67=_['keyBy'](_0x1d587e,'id');_0x39fcef=_[_0x51a8('0x98')](_0x39fcef,{'model':db[_0x51a8('0x99')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2429f8[_0x51a8('0x3c')][_0x51a8('0x3f')]){_0x49ab37[_0x51a8('0x3d')][_0x51a8('0x73')](function(_0xf718e){_0x3a33f3[_0x51a8('0x47')]('i.'+_0xf718e);});}else{_0x3a33f3['field'](_0x51a8('0x8c'),_0x51a8('0x5e'));_0x3a33f3['field'](_0x51a8('0x9a'),_0x51a8('0x9b'));_0x3a33f3['field'](_0x51a8('0x9c'),'Account.mandatoryDisposition');_0x3a33f3['field'](_0x51a8('0x9d'),_0x51a8('0x8d'));_0x3a33f3[_0x51a8('0x47')]('i.*');_0x3a33f3['field'](_0x51a8('0x9e'),'Contact.firstName');_0x3a33f3[_0x51a8('0x47')](_0x51a8('0x9f'),_0x51a8('0xa0'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa1'),_0x51a8('0xa2'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa3'),_0x51a8('0xa4'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa5'),_0x51a8('0xa6'));_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xa7'),_0x51a8('0xa8'));_0x3a33f3['field']('o.fullname',_0x51a8('0xa9'));_0x3a33f3['field']('o.internal','Owner.internal');_0x3a33f3[_0x51a8('0x47')](_0x51a8('0xaa'),_0x51a8('0x31'));}if(_0x49ab37[_0x51a8('0x21')])_0x3a33f3['limit'](_0x49ab37[_0x51a8('0x21')]);if(_0x49ab37[_0x51a8('0x20')])_0x3a33f3['offset'](_0x49ab37[_0x51a8('0x20')]);return db[_0x51a8('0x95')]['query'](_0x3a33f3['toString'](),_0x39fcef);})[_0x51a8('0x29')](function(_0x835bff){_0x26ad89[_0x51a8('0x44')](_0x51a8('0xab'),_[_0x51a8('0x36')](_0x835bff,'id'));return db[_0x51a8('0x95')]['query'](_0x26ad89[_0x51a8('0x97')](),_0x39fcef)[_0x51a8('0x29')](function(_0x181f8b){var _0x566d62=_[_0x51a8('0xac')](_0x181f8b,_0x51a8('0xad'));var _0x1db1e0=[];_0x835bff['forEach'](function(_0x149fa4){_0x1db1e0[_0x51a8('0x33')](updateWhatsappInteraction(_0x149fa4,_0x4c7c67,_0x566d62));});return BPromise['all'](_0x1db1e0);});});})[_0x51a8('0x29')](function(_0x529916){_0x4d3114[_0x51a8('0xae')]=_0x529916;return _0x4d3114;})[_0x51a8('0x29')](respondWithFilteredResult(_0x41c020,_0x49ab37))[_0x51a8('0x34')](handleError(_0x41c020,null));};exports[_0x51a8('0xaf')]=function(_0x41621c,_0x700df1){var _0x398d27={'raw':![],'where':{'id':_0x41621c['params']['id']}},_0x42d0ad={};_0x42d0ad[_0x51a8('0x3b')]=_[_0x51a8('0xb0')](db[_0x51a8('0x99')][_0x51a8('0x37')]);_0x42d0ad[_0x51a8('0x3c')]=_['keys'](_0x41621c['query']);_0x42d0ad[_0x51a8('0x45')]=_[_0x51a8('0x3e')](_0x42d0ad[_0x51a8('0x3b')],_0x42d0ad[_0x51a8('0x3c')]);_0x398d27[_0x51a8('0x3d')]=_['intersection'](_0x42d0ad[_0x51a8('0x3b')],qs['fields'](_0x41621c[_0x51a8('0x3c')][_0x51a8('0x3f')]));_0x398d27['attributes']=_0x398d27[_0x51a8('0x3d')]['length']?_0x398d27[_0x51a8('0x3d')]:_0x42d0ad[_0x51a8('0x3b')];if(_0x41621c[_0x51a8('0x3c')][_0x51a8('0xb1')]){_0x398d27[_0x51a8('0xb2')]=[{'all':!![]}];}_0x398d27=_['merge']({},_0x398d27,_0x41621c[_0x51a8('0xb3')]);return db[_0x51a8('0x99')]['find'](_0x398d27)[_0x51a8('0x29')](handleEntityNotFound(_0x700df1,null))[_0x51a8('0x29')](respondWithResult(_0x700df1,null))['catch'](handleError(_0x700df1,null));};exports['create']=function(_0x24b2a9,_0x158c45){return db[_0x51a8('0x99')]['create'](_0x24b2a9[_0x51a8('0xb4')],{})[_0x51a8('0x29')](respondWithResult(_0x158c45,0xc9))[_0x51a8('0x34')](handleError(_0x158c45,null));};exports[_0x51a8('0x27')]=function(_0x336269,_0x21f861){if(_0x336269[_0x51a8('0xb4')]['id']){delete _0x336269['body']['id'];}return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x336269[_0x51a8('0xb5')]['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x21f861,null))['then'](saveUpdates(_0x336269['body'],null))[_0x51a8('0x29')](respondWithResult(_0x21f861,null))[_0x51a8('0x34')](handleError(_0x21f861,null));};exports['destroy']=function(_0x4ea00f,_0x5b44ba){return db[_0x51a8('0x99')]['find']({'where':{'id':_0x4ea00f['params']['id']}})['then'](handleEntityNotFound(_0x5b44ba,null))[_0x51a8('0x29')](removeEntity(_0x5b44ba,null))['catch'](handleError(_0x5b44ba,null));};exports[_0x51a8('0xb6')]=function(_0x2d820c,_0x52403f){return db['WhatsappInteraction'][_0x51a8('0xb6')]()['then'](respondWithResult(_0x52403f,null))[_0x51a8('0x34')](handleError(_0x52403f,null));};exports[_0x51a8('0xb7')]=function(_0x4bf480,_0x39938f,_0x88625a){return db['WhatsappMessage'][_0x51a8('0x5d')]({'where':{'id':_0x4bf480[_0x51a8('0xb5')]['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x39938f,null))['then'](function(_0x2af315){if(_0x2af315){return _0x2af315[_0x51a8('0xb7')](_0x4bf480[_0x51a8('0xb4')]['ids'],_['omit'](_0x4bf480[_0x51a8('0xb4')],[_0x51a8('0xb8'),'id'])||{});}})[_0x51a8('0x29')](respondWithResult(_0x39938f,null))[_0x51a8('0x34')](handleError(_0x39938f,null));};exports[_0x51a8('0xb9')]=function(_0x475014,_0x35cd5d,_0x64e49d){var _0x1482ff={'raw':![],'where':{}};var _0x570ba0={};var _0x2a8aa1={'count':0x0,'rows':[]};return db[_0x51a8('0x99')][_0x51a8('0xba')]({'where':{'id':_0x475014['params']['id']}})['then'](handleEntityNotFound(_0x35cd5d,null))[_0x51a8('0x29')](function(_0x318478){if(_0x318478){_0x570ba0[_0x51a8('0x3b')]=_[_0x51a8('0xb0')](db[_0x51a8('0xbb')]['rawAttributes']);_0x570ba0['query']=_[_0x51a8('0xb0')](_0x475014[_0x51a8('0x3c')]);_0x570ba0['filters']=_[_0x51a8('0x3e')](_0x570ba0[_0x51a8('0x3b')],_0x570ba0[_0x51a8('0x3c')]);_0x1482ff[_0x51a8('0x3d')]=_[_0x51a8('0x3e')](_0x570ba0['model'],qs['fields'](_0x475014[_0x51a8('0x3c')]['fields']));_0x1482ff[_0x51a8('0x3d')]=_0x1482ff['attributes'][_0x51a8('0x40')]?_0x1482ff[_0x51a8('0x3d')]:_0x570ba0['model'];if(!_0x475014[_0x51a8('0x3c')][_0x51a8('0x41')](_0x51a8('0xbc'))){_0x1482ff[_0x51a8('0x21')]=qs['limit'](_0x475014['query'][_0x51a8('0x21')]);_0x1482ff[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x475014[_0x51a8('0x3c')]['offset']);}_0x1482ff[_0x51a8('0x42')]=qs['sort'](_0x475014[_0x51a8('0x3c')]['sort']);_0x1482ff[_0x51a8('0x44')]=qs[_0x51a8('0x45')](_[_0x51a8('0xbd')](_0x475014[_0x51a8('0x3c')],_0x570ba0['filters']));_0x1482ff[_0x51a8('0x44')]['WhatsappInteractionId']=_0x318478['id'];if(_0x475014[_0x51a8('0x3c')][_0x51a8('0x80')]){_0x1482ff[_0x51a8('0x44')]=_['merge'](_0x1482ff[_0x51a8('0x44')],{'$or':_[_0x51a8('0x36')](_0x1482ff[_0x51a8('0x3d')],function(_0x4e636b){var _0x5e541d={};_0x5e541d[_0x4e636b]={'$like':'%'+_0x475014[_0x51a8('0x3c')][_0x51a8('0x80')]+'%'};return _0x5e541d;})});}if(_0x475014[_0x51a8('0x3c')][_0x51a8('0xbe')]){var _0x4c3d87=_0x475014['query'][_0x51a8('0xbe')]['split'](',');var _0x1b9cd4={};_0x1b9cd4[_0x4c3d87[0x0]]={'$gte':moment(_0x4c3d87[0x1])[_0x51a8('0xbf')](_0x51a8('0xc0'))};_0x1482ff[_0x51a8('0x44')]=_[_0x51a8('0x98')](_0x1482ff[_0x51a8('0x44')],_0x1b9cd4);}_0x1482ff=_[_0x51a8('0x98')]({},_0x1482ff,_0x475014['options']);return db['WhatsappMessage']['count']({'where':_0x1482ff[_0x51a8('0x44')]})[_0x51a8('0x29')](function(_0x2600c3){_0x2a8aa1[_0x51a8('0x96')]=_0x2600c3;if(_0x475014[_0x51a8('0x3c')]['includeAll']){_0x1482ff[_0x51a8('0xb2')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x51a8('0xc1')](_0x1482ff);})[_0x51a8('0x29')](function(_0x1dcdd9){_0x2a8aa1[_0x51a8('0xae')]=_0x1dcdd9;return _0x2a8aa1;});}})['then'](respondWithFilteredResult(_0x35cd5d,_0x1482ff))['catch'](handleError(_0x35cd5d,null));};exports[_0x51a8('0xc2')]=function(_0x542cc4,_0x289366,_0x4252e7){return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x542cc4['params']['id']}})[_0x51a8('0x29')](handleEntityNotFound(_0x289366,null))[_0x51a8('0x29')](function(_0x441ee7){if(_0x441ee7){return _0x441ee7[_0x51a8('0xc3')](_0x542cc4[_0x51a8('0xb4')][_0x51a8('0xb8')],_[_0x51a8('0xc4')](_0x542cc4[_0x51a8('0xb4')],[_0x51a8('0xb8'),'id'])||{})[_0x51a8('0xc5')](function(){return db[_0x51a8('0x6b')]['findAll']({'attributes':['id',_0x51a8('0x2c'),_0x51a8('0x48')],'where':{'id':_0x542cc4[_0x51a8('0xb4')][_0x51a8('0xb8')]}});})[_0x51a8('0x29')](function(_0x4c2cfa){socket[_0x51a8('0xc6')](_0x51a8('0xc7'),{'id':Number(_0x542cc4[_0x51a8('0xb5')]['id']),'tags':_0x4c2cfa||[]});return{'id':Number(_0x542cc4['params']['id']),'tags':_0x4c2cfa||[]};});}})[_0x51a8('0x29')](respondWithResult(_0x289366,null))[_0x51a8('0x34')](handleError(_0x289366,null));};exports[_0x51a8('0xc8')]=function(_0x4a2353,_0x399db9,_0x2209e4){return db[_0x51a8('0x99')][_0x51a8('0x5d')]({'where':{'id':_0x4a2353['params']['id']}})['then'](handleEntityNotFound(_0x399db9,null))['then'](function(_0x1e957d){if(_0x1e957d){return _0x1e957d['removeTags'](_0x4a2353['query'][_0x51a8('0xb8')]);}})[_0x51a8('0x29')](respondWithStatusCode(_0x399db9,null))[_0x51a8('0x34')](handleError(_0x399db9,null));};exports[_0x51a8('0xc9')]=function(_0x1ec08a,_0x462183){var _0x5b316b=moment()[_0x51a8('0xca')]()[_0x51a8('0x97')]();var _0x577fce=path['join'](config[_0x51a8('0xcb')],_0x51a8('0xcc'),'files',_0x51a8('0xcd'));var _0x19dd35=path[_0x51a8('0xce')](config[_0x51a8('0xcb')],_0x51a8('0xcc'),_0x51a8('0xcf'),_0x51a8('0xd0'));var _0x16dce5=path[_0x51a8('0xce')](_0x577fce,_0x5b316b);var _0x1568bf=util[_0x51a8('0xbf')](_0x51a8('0xd1'),_0x1ec08a[_0x51a8('0xb5')]['id'],_0x5b316b);var _0xfedb52=path[_0x51a8('0xce')](_0x577fce,_0x1568bf);var _0x5804c7=[];_0x5804c7[_0x51a8('0x33')]({'model':db[_0x51a8('0x6d')],'as':'User','attributes':['id',_0x51a8('0x2f')],'raw':!![]});_0x5804c7[_0x51a8('0x33')]({'model':db['CmContact'],'as':_0x51a8('0x63'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1ec08a[_0x51a8('0x3c')]['attachments']){_0x5804c7[_0x51a8('0x33')]({'model':db[_0x51a8('0xd2')],'as':_0x51a8('0xd2'),'raw':!![]});}var _0x3b9e0c=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body','createdAt',_0x51a8('0xd3'),_0x51a8('0xd4'),_0x51a8('0x7d')],'include':_0x5804c7}];_0x3b9e0c[_0x51a8('0x33')]({'model':db[_0x51a8('0xd5')],'as':_0x51a8('0xd6'),'attributes':['id',_0x51a8('0x2c')]});_0x3b9e0c['push']({'model':db['User'],'as':_0x51a8('0xd7'),'attributes':['id','fullname']});return db['WhatsappInteraction'][_0x51a8('0x5d')]({'where':{'id':_0x1ec08a[_0x51a8('0xb5')]['id']},'include':_0x3b9e0c})[_0x51a8('0x29')](handleEntityNotFound(_0x462183,null))[_0x51a8('0x29')](function(_0x3c609c){if(_0x3c609c){var _0x3c76e4=_0x3c609c[_0x51a8('0xd8')]({'plain':!![]});fs[_0x51a8('0xd9')](_0x16dce5);var _0x83dfed={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x51a8('0xda')}},'footer':{'height':_0x51a8('0xdb'),'contents':{'default':util[_0x51a8('0xbf')](_0x51a8('0xdc'),util[_0x51a8('0xbf')](_0x51a8('0xdd'),_0x51a8('0xde'),_0x3c76e4['id']),moment()[_0x51a8('0xbf')](_0x51a8('0xdf'))[_0x51a8('0x97')]())}}};var _0x4a55c0={'channel':'Whatsapp','account':_0x3c76e4['Account'][_0x51a8('0x2c')],'agent':_0x3c76e4[_0x51a8('0xd7')]?_0x3c76e4[_0x51a8('0xd7')]['fullname']:_0x51a8('0xe0'),'createdAt':moment(_0x3c76e4[_0x51a8('0x76')])[_0x51a8('0xbf')](_0x51a8('0xc0'))['toString'](),'closedAt':_0x3c76e4[_0x51a8('0xe1')]?moment(_0x3c76e4[_0x51a8('0xe2')])['format'](_0x51a8('0xc0'))['toString']():'','disposition':_0x3c76e4[_0x51a8('0xe3')],'messages':_(_0x3c76e4[_0x51a8('0xe4')])[_0x51a8('0x80')]({'secret':![]})[_0x51a8('0x36')](function(_0x5592e6){if(_0x5592e6[_0x51a8('0xd2')]){var _0x4ad6a8=path['join'](_0x19dd35,_0x5592e6[_0x51a8('0xd2')][_0x51a8('0xe5')]);if(fs[_0x51a8('0xe6')](_0x4ad6a8)){fs[_0x51a8('0xe7')](_0x4ad6a8)[_0x51a8('0xe8')](fs[_0x51a8('0xe9')](path[_0x51a8('0xce')](_0x16dce5,_0x5592e6['Attachment'][_0x51a8('0xe5')])));}}return{'date':moment(_0x5592e6[_0x51a8('0x76')])[_0x51a8('0xbf')](_0x51a8('0xc0'))['toString'](),'sender':_0x5592e6[_0x51a8('0xd3')]===_0x51a8('0xea')?_0x5592e6[_0x51a8('0x6d')]?_0x5592e6[_0x51a8('0x6d')]['fullname']:_0x51a8('0xeb'):_0x5592e6[_0x51a8('0x63')][_0x51a8('0xec')]+(_0x5592e6[_0x51a8('0x63')]['lastName']?'\x20'+_0x5592e6[_0x51a8('0x63')][_0x51a8('0xed')]:''),'body':_0x5592e6[_0x51a8('0xd2')]?_0x5592e6[_0x51a8('0xd2')][_0x51a8('0xe5')]:_0x5592e6[_0x51a8('0xb4')],'direction':_0x5592e6[_0x51a8('0xd3')]===_0x51a8('0xea')?'A':'C','secret':_0x5592e6[_0x51a8('0xd4')],'read':_0x5592e6[_0x51a8('0x7d')],'attachment':_0x5592e6['Attachment']};})['value']()};return ejs[_0x51a8('0xee')](path['join'](config[_0x51a8('0xcb')],_0x51a8('0xcc'),_0x51a8('0xef'),_0x51a8('0xf0')),{'interaction':_0x4a55c0})[_0x51a8('0x29')](function(_0xc445ba){return new BPromise(function(_0xa6c131,_0x4a3278){pdf['create'](_0xc445ba,_0x83dfed)[_0x51a8('0xf1')](path[_0x51a8('0xce')](_0x16dce5,_0x51a8('0xf2')+_0x3c76e4['id']+'-'+_0x5b316b+_0x51a8('0xf3')),function(_0x3bd73b,_0x12b472){if(_0x3bd73b)return _0x4a3278(_0x3bd73b);_0xa6c131(_0x12b472);});});})[_0x51a8('0x29')](function(){return new BPromise(function(_0x326f86,_0x410051){zipdir(_0x16dce5,{'saveTo':_0xfedb52},function(_0x2e3e68,_0xf07549){if(_0x2e3e68)return _0x410051(_0x2e3e68);return _0x326f86(_0xf07549);});})['then'](function(){return new BPromise(function(_0x49b426,_0x310086){rimraf(_0x16dce5,function(_0x1ca255){if(_0x1ca255)_0x310086(_0x1ca255);return _0x49b426();});});})[_0x51a8('0x29')](function(){return _0x462183[_0x51a8('0xc9')](_0xfedb52,_0x1568bf,function(_0xa18052){if(_0xa18052){console[_0x51a8('0xf4')]('err',_0xa18052);}else{fs[_0x51a8('0xf5')](_0xfedb52);}});});});}else{return _0x462183[_0x51a8('0xf6')](0xc8);}})['catch'](handleError(_0x462183,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 571a590..0d7c2ba 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 _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 +var _0x4fe2=['unreadMessages','length','emit','catch','hook','exports','events','WhatsappInteraction','../../mysqldb','setMaxListeners','save','remove','setDataValue','Users','map','findAll','then'];(function(_0x12a554,_0x3d7ef8){var _0x244ba0=function(_0x5eb5ff){while(--_0x5eb5ff){_0x12a554['push'](_0x12a554['shift']());}};_0x244ba0(++_0x3d7ef8);}(_0x4fe2,0x8e));var _0x24fe=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4fe2[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require(_0x24fe('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0x24fe('0x1')];var WhatsappMessage=require(_0x24fe('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x24fe('0x3')](0x0);var events={'afterCreate':_0x24fe('0x4'),'afterUpdate':'update','afterDestroy':_0x24fe('0x5')};function emitEvent(_0x4c3261){return function(_0x1f682f,_0x1b4d76,_0x55f3c1){_0x1f682f['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1dd35f){_0x1f682f[_0x24fe('0x6')](_0x24fe('0x7'),_0x1dd35f[_0x24fe('0x8')](function(_0x553bdd){return{'id':_0x553bdd['id']};}));return WhatsappMessage[_0x24fe('0x9')]({'where':{'WhatsappInteractionId':_0x1f682f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x24fe('0xa')](function(_0x3fe331){_0x1f682f[_0x24fe('0x6')](_0x24fe('0xb'),_0x3fe331[_0x24fe('0xc')]);WhatsappInteractionEvents['emit'](_0x4c3261+':'+_0x1f682f['id'],_0x1f682f);WhatsappInteractionEvents[_0x24fe('0xd')](_0x4c3261,_0x1f682f);_0x55f3c1(null);})[_0x24fe('0xe')](_0x55f3c1(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x24fe('0xf')](e,emitEvent(event));}}module[_0x24fe('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 d3988e8..73da8f8 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 _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 +var _0xf90b=['define','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x2d9f30,_0x258111){var _0x243932=function(_0x2eca4a){while(--_0x2eca4a){_0x2d9f30['push'](_0x2d9f30['shift']());}};_0x243932(++_0x258111);}(_0xf90b,0x146));var _0xbf90=function(_0x5644d3,_0x331159){_0x5644d3=_0x5644d3-0x0;var _0x560bd8=_0xf90b[_0x5644d3];return _0x560bd8;};'use strict';var _=require(_0xbf90('0x0'));var util=require(_0xbf90('0x1'));var logger=require(_0xbf90('0x2'))(_0xbf90('0x3'));var moment=require(_0xbf90('0x4'));var BPromise=require(_0xbf90('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf90('0x6'));var rimraf=require(_0xbf90('0x7'));var config=require(_0xbf90('0x8'));var attributes=require(_0xbf90('0x9'));module['exports']=function(_0x5223a1,_0x5a961c){return _0x5223a1[_0xbf90('0xa')]('WhatsappInteraction',attributes,{'tableName':_0xbf90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x303ba7,_0x14977a,_0x1c85ef){if(_0x303ba7['changed'](_0xbf90('0xc'))){_0x303ba7[_0xbf90('0xd')]=moment()[_0xbf90('0xe')](_0xbf90('0xf'));}_0x1c85ef(null,_0x303ba7);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 81f27ad..7600dd8 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 _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 +var _0x95ed=['message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','stringify','find','where','ids','omit','spread','AddTags','util','moment','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x476a99,_0x3ae5d5){var _0x5a60da=function(_0x4b7883){while(--_0x4b7883){_0x476a99['push'](_0x476a99['shift']());}};_0x5a60da(++_0x3ae5d5);}(_0x95ed,0x1e5));var _0xd95e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x95ed[_0xc67528];return _0x38e26d;};'use strict';var _=require('lodash');var util=require(_0xd95e('0x0'));var moment=require(_0xd95e('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(_0xd95e('0x2'));var logger=require('../../config/logger')(_0xd95e('0x3'));var config=require(_0xd95e('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xd95e('0x5')][_0xd95e('0x6')]({'port':0x232a});config[_0xd95e('0x7')]=_[_0xd95e('0x8')](config[_0xd95e('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xd95e('0x9'))(new Redis(config[_0xd95e('0x7')]));require('./whatsappInteraction.socket')[_0xd95e('0xa')](socket);function respondWithRpcPromise(_0x278c22,_0xb28adc,_0x310993){return new BPromise(function(_0x623889,_0x3395ba){return client[_0xd95e('0xb')](_0x278c22,_0x310993)[_0xd95e('0xc')](function(_0x54b3fc){logger['info'](_0xd95e('0xd'),_0xb28adc,_0xd95e('0xe'));logger[_0xd95e('0xf')](_0xd95e('0x10'),_0xb28adc,'request\x20sent',JSON['stringify'](_0x54b3fc));if(_0x54b3fc[_0xd95e('0x11')]){if(_0x54b3fc[_0xd95e('0x11')][_0xd95e('0x12')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0xb28adc,_0x54b3fc[_0xd95e('0x11')][_0xd95e('0x13')]);return _0x3395ba(_0x54b3fc[_0xd95e('0x11')][_0xd95e('0x13')]);}logger[_0xd95e('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb28adc,_0x54b3fc['error']['message']);return _0x623889(_0x54b3fc[_0xd95e('0x11')]['message']);}else{logger[_0xd95e('0x14')](_0xd95e('0xd'),_0xb28adc,_0xd95e('0xe'));_0x623889(_0x54b3fc[_0xd95e('0x15')][_0xd95e('0x13')]);}})[_0xd95e('0x16')](function(_0x12926a){logger[_0xd95e('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0xb28adc,_0x12926a);_0x3395ba(_0x12926a);});});}exports[_0xd95e('0x17')]=function(_0x1825ed){var _0x3393c9=this;return new Promise(function(_0x4a65f8,_0x447167){return db[_0xd95e('0x18')][_0xd95e('0x19')](_0x1825ed[_0xd95e('0x1a')],{'raw':_0x1825ed[_0xd95e('0x1b')]?_0x1825ed[_0xd95e('0x1b')][_0xd95e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1825ed[_0xd95e('0x1b')]?_0x1825ed[_0xd95e('0x1b')]['where']||null:null,'attributes':_0x1825ed[_0xd95e('0x1b')]?_0x1825ed[_0xd95e('0x1b')]['attributes']||null:null,'limit':_0x1825ed['options']?_0x1825ed[_0xd95e('0x1b')]['limit']||null:null})[_0xd95e('0xc')](function(_0x164af4){logger['info'](_0xd95e('0x17'),_0x1825ed);logger['debug'](_0xd95e('0x17'),_0x1825ed,JSON[_0xd95e('0x1d')](_0x164af4));_0x4a65f8(_0x164af4);})['catch'](function(_0x4f8663){logger[_0xd95e('0x11')](_0xd95e('0x17'),_0x4f8663['message'],_0x1825ed);_0x447167(_0x3393c9[_0xd95e('0x11')](0x1f4,_0x4f8663[_0xd95e('0x13')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3c7944){return new Promise(function(_0x538aa8,_0x15ec64){return db['WhatsappInteraction'][_0xd95e('0x1e')]({'where':_0x3c7944[_0xd95e('0x1b')]?_0x3c7944[_0xd95e('0x1b')][_0xd95e('0x1f')]||null:null})[_0xd95e('0xc')](function(_0x33e140){if(_0x33e140){return _0x33e140['addTags'](_0x3c7944['body'][_0xd95e('0x20')],_[_0xd95e('0x21')](_0x3c7944[_0xd95e('0x1a')],[_0xd95e('0x20'),'id'])||{});}})[_0xd95e('0x22')](function(_0x33a54d){logger['info'](_0xd95e('0x23'),_0x3c7944);logger[_0xd95e('0xf')](_0xd95e('0x23'),_0x3c7944,JSON[_0xd95e('0x1d')](_0x33a54d));_0x538aa8(_0x33a54d);})[_0xd95e('0x16')](function(_0x1f0d43){logger[_0xd95e('0x11')](_0xd95e('0x23'),_0x1f0d43['message'],_0x3c7944);_0x15ec64(_this[_0xd95e('0x11')](0x1f4,_0x1f0d43['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7fe0ed7..7bcee8c 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 _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 +var _0xc8fa=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','emit','removeListener'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xc8fa,0x13e));var _0xac8f=function(_0x2fb5d5,_0x17edb0){_0x2fb5d5=_0x2fb5d5-0x0;var _0x547ec5=_0xc8fa[_0x2fb5d5];return _0x547ec5;};'use strict';var WhatsappInteractionEvents=require(_0xac8f('0x0'));var events=[_0xac8f('0x1'),'remove','update'];function createListener(_0x57f1e3,_0x259c9d){return function(_0x1075fe){_0x259c9d[_0xac8f('0x2')](_0x57f1e3,_0x1075fe);};}function removeListener(_0x422292,_0x321e31){return function(){WhatsappInteractionEvents[_0xac8f('0x3')](_0x422292,_0x321e31);};}exports[_0xac8f('0x4')]=function(_0x28b954){for(var _0x3a29a6=0x0,_0x33f98e=events[_0xac8f('0x5')];_0x3a29a6<_0x33f98e;_0x3a29a6++){var _0x39cab4=events[_0x3a29a6];var _0x49518a=createListener(_0xac8f('0x6')+_0x39cab4,_0x28b954);WhatsappInteractionEvents['on'](_0x39cab4,_0x49518a);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 556b9b3..be46620 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 _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 +var _0x78e2=['show','post','tracked','whatsapp','create','status','put','update','/:id/accept','accept','reject','delete','exports','multer','util','path','express','Router','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x11c3a7,_0x4fc46b){var _0x249aa0=function(_0x1023f2){while(--_0x1023f2){_0x11c3a7['push'](_0x11c3a7['shift']());}};_0x249aa0(++_0x4fc46b);}(_0x78e2,0x1c2));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x278e('0x0'));var util=require(_0x278e('0x1'));var path=require(_0x278e('0x2'));var timeout=require('connect-timeout');var express=require(_0x278e('0x3'));var router=express[_0x278e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x278e('0x5'));router[_0x278e('0x6')]('/',auth[_0x278e('0x7')](),controller[_0x278e('0x8')]);router[_0x278e('0x6')](_0x278e('0x9'),auth[_0x278e('0x7')](),controller['describe']);router[_0x278e('0x6')]('/:id',auth[_0x278e('0x7')](),controller[_0x278e('0xa')]);router[_0x278e('0xb')]('/',auth[_0x278e('0x7')](),interaction[_0x278e('0xc')](_0x278e('0xd'),'whatsappmessage:create'),controller[_0x278e('0xe')]);router['post']('/:id/status',controller[_0x278e('0xf')]);router[_0x278e('0x10')]('/:id',auth[_0x278e('0x7')](),controller[_0x278e('0x11')]);router[_0x278e('0x10')](_0x278e('0x12'),auth[_0x278e('0x7')](),controller[_0x278e('0x13')]);router['put']('/:id/reject',auth[_0x278e('0x7')](),controller[_0x278e('0x14')]);router[_0x278e('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x278e('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 40c8782..7fa0523 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 _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 +var _0x410c=['TEXT','BOOLEAN','ENUM','out','STRING','exports'];(function(_0x5eae28,_0x509164){var _0x30b922=function(_0x5c6108){while(--_0x5c6108){_0x5eae28['push'](_0x5eae28['shift']());}};_0x30b922(++_0x509164);}(_0x410c,0x18b));var _0xc410=function(_0xa69d73,_0x585dea){_0xa69d73=_0xa69d73-0x0;var _0xac228d=_0x410c[_0xa69d73];return _0xac228d;};'use strict';var Sequelize=require('sequelize');module[_0xc410('0x0')]={'body':{'type':Sequelize[_0xc410('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc410('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc410('0x3')]('in',_0xc410('0x4')),'defaultValue':_0xc410('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xc410('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xc410('0x5')]},'providerResponse':{'type':Sequelize[_0xc410('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 42f2b88..01524bb 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 _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 +var _0x6d5e=['MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','WhatsappMessage,\x20%s,\x20%s','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','rows','show','params','options','create','body','update','describe','accept','whatsapp','readAt','format','UserId','user','agent','find','CmContact','Contact','get','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','WhatsappInteraction','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0x6d5e,0x103));var _0xe6d5=function(_0x101a7d,_0x36729){_0x101a7d=_0x101a7d-0x0;var _0x131b9e=_0x6d5e[_0x101a7d];return _0x131b9e;};'use strict';var pdf=require(_0xe6d5('0x0'));var emlformat=require(_0xe6d5('0x1'));var rimraf=require(_0xe6d5('0x2'));var zipdir=require(_0xe6d5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe6d5('0x4'));var moment=require(_0xe6d5('0x5'));var BPromise=require(_0xe6d5('0x6'));var Mustache=require(_0xe6d5('0x7'));var util=require(_0xe6d5('0x8'));var path=require(_0xe6d5('0x9'));var sox=require(_0xe6d5('0xa'));var csv=require('to-csv');var ejs=require(_0xe6d5('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe6d5('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe6d5('0xd'));var Papa=require(_0xe6d5('0xe'));var Redis=require(_0xe6d5('0xf'));var authService=require(_0xe6d5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe6d5('0x11'));var hardwareService=require(_0xe6d5('0x12'));var logger=require(_0xe6d5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe6d5('0x14'));var licenseUtil=require(_0xe6d5('0x15'));var db=require(_0xe6d5('0x16'))['db'];config[_0xe6d5('0x17')]=_[_0xe6d5('0x18')](config[_0xe6d5('0x17')],{'host':_0xe6d5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe6d5('0x17')]));require(_0xe6d5('0x1a'))[_0xe6d5('0x1b')](socket);var jayson=require(_0xe6d5('0x1c'));var client=jayson[_0xe6d5('0x1d')][_0xe6d5('0x1e')]({'port':0x232c});var client9002=jayson[_0xe6d5('0x1d')][_0xe6d5('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3c7b7a,_0x49adf8,_0x2a8aa7,_0x2adb34){return new BPromise(function(_0x268ced,_0x4ecc63){var _0x3847d1=_0x2adb34||client;return _0x3847d1[_0xe6d5('0x1f')](_0x3c7b7a,_0x2a8aa7)['then'](function(_0x1f4ce6){logger['info'](_0xe6d5('0x20'),_0x49adf8,'request\x20sent');logger['debug'](_0xe6d5('0x21'),_0x49adf8,'request\x20sent',JSON[_0xe6d5('0x22')](_0x1f4ce6));if(_0x1f4ce6[_0xe6d5('0x23')]){if(_0x1f4ce6[_0xe6d5('0x23')]['code']===0x1f4){logger['error'](_0xe6d5('0x20'),_0x49adf8,_0x1f4ce6[_0xe6d5('0x23')][_0xe6d5('0x24')]);return _0x4ecc63(_0x1f4ce6[_0xe6d5('0x23')][_0xe6d5('0x24')]);}logger['error'](_0xe6d5('0x20'),_0x49adf8,_0x1f4ce6[_0xe6d5('0x23')]['message']);return _0x268ced(_0x1f4ce6[_0xe6d5('0x23')][_0xe6d5('0x24')]);}else{logger[_0xe6d5('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x49adf8,_0xe6d5('0x26'));_0x268ced(_0x1f4ce6[_0xe6d5('0x27')][_0xe6d5('0x24')]);}})[_0xe6d5('0x28')](function(_0x1be7b0){logger[_0xe6d5('0x23')](_0xe6d5('0x20'),_0x49adf8,_0x1be7b0);_0x4ecc63(_0x1be7b0);});});}function respondWithStatusCode(_0x7f7bcd,_0x5546e6){_0x5546e6=_0x5546e6||0xcc;return function(_0x347343){if(_0x347343){return _0x7f7bcd[_0xe6d5('0x29')](_0x5546e6);}return _0x7f7bcd[_0xe6d5('0x2a')](_0x5546e6)[_0xe6d5('0x2b')]();};}function respondWithResult(_0x543934,_0x3c90dc){_0x3c90dc=_0x3c90dc||0xc8;return function(_0x4a4b27){if(_0x4a4b27){return _0x543934[_0xe6d5('0x2a')](_0x3c90dc)[_0xe6d5('0x2c')](_0x4a4b27);}};}function respondWithFilteredResult(_0x4d8a35,_0x2bab45){return function(_0x526786){if(_0x526786){var _0x4377bc=_0x526786[_0xe6d5('0x2d')],_0x1345d1=_0x2bab45[_0xe6d5('0x2e')],_0x4247f5=_0x2bab45[_0xe6d5('0x2e')]+_0x2bab45['limit'],_0x1feccd;if(_0x4247f5>=_0x4377bc){_0x4247f5=_0x4377bc;_0x1feccd=0xc8;}else{_0x1feccd=0xce;}_0x4d8a35[_0xe6d5('0x2a')](_0x1feccd);return _0x4d8a35[_0xe6d5('0x2f')](_0xe6d5('0x30'),_0x1345d1+'-'+_0x4247f5+'/'+_0x4377bc)[_0xe6d5('0x2c')](_0x526786);}return null;};}function patchUpdates(_0x514166){return function(_0x30e550){try{jsonpatch[_0xe6d5('0x31')](_0x30e550,_0x514166,!![]);}catch(_0x4f5c6a){return BPromise[_0xe6d5('0x32')](_0x4f5c6a);}return _0x30e550['save']();};}function saveUpdates(_0x1fe99a,_0x513cbd){return function(_0x1f2fbf){if(_0x1f2fbf){return _0x1f2fbf['update'](_0x1fe99a)[_0xe6d5('0x33')](function(_0x2dc20a){return _0x2dc20a;});}return null;};}function removeEntity(_0x15c847,_0x14960b){return function(_0x556198){if(_0x556198){return _0x556198[_0xe6d5('0x34')]()[_0xe6d5('0x33')](function(){_0x15c847['status'](0xcc)[_0xe6d5('0x2b')]();});}};}function handleEntityNotFound(_0x38c757,_0x5cf193){return function(_0x2663ab){if(!_0x2663ab){_0x38c757[_0xe6d5('0x29')](0x194);}return _0x2663ab;};}function handleError(_0x5de1ae,_0x5a919){_0x5a919=_0x5a919||0x1f4;return function(_0xaa505e){logger[_0xe6d5('0x23')](_0xaa505e[_0xe6d5('0x35')]);if(_0xaa505e[_0xe6d5('0x36')]){delete _0xaa505e[_0xe6d5('0x36')];}_0x5de1ae[_0xe6d5('0x2a')](_0x5a919)[_0xe6d5('0x37')](_0xaa505e);};}exports['index']=function(_0x4b4136,_0x7ce9c6){var _0x3d625f={},_0x39e52e={},_0x2c172e={'count':0x0,'rows':[]};var _0x22cc0f=_[_0xe6d5('0x38')](db[_0xe6d5('0x39')][_0xe6d5('0x3a')],function(_0x7cc756){return{'name':_0x7cc756[_0xe6d5('0x3b')],'type':_0x7cc756[_0xe6d5('0x3c')][_0xe6d5('0x3d')]};});_0x39e52e[_0xe6d5('0x3e')]=_[_0xe6d5('0x38')](_0x22cc0f,_0xe6d5('0x36'));_0x39e52e[_0xe6d5('0x3f')]=_[_0xe6d5('0x40')](_0x4b4136[_0xe6d5('0x3f')]);_0x39e52e[_0xe6d5('0x41')]=_[_0xe6d5('0x42')](_0x39e52e[_0xe6d5('0x3e')],_0x39e52e[_0xe6d5('0x3f')]);_0x3d625f[_0xe6d5('0x43')]=_[_0xe6d5('0x42')](_0x39e52e[_0xe6d5('0x3e')],qs['fields'](_0x4b4136[_0xe6d5('0x3f')][_0xe6d5('0x44')]));_0x3d625f[_0xe6d5('0x43')]=_0x3d625f[_0xe6d5('0x43')][_0xe6d5('0x45')]?_0x3d625f[_0xe6d5('0x43')]:_0x39e52e[_0xe6d5('0x3e')];if(!_0x4b4136[_0xe6d5('0x3f')][_0xe6d5('0x46')](_0xe6d5('0x47'))){_0x3d625f['limit']=qs['limit'](_0x4b4136[_0xe6d5('0x3f')]['limit']);_0x3d625f['offset']=qs[_0xe6d5('0x2e')](_0x4b4136[_0xe6d5('0x3f')][_0xe6d5('0x2e')]);}_0x3d625f[_0xe6d5('0x48')]=qs[_0xe6d5('0x49')](_0x4b4136[_0xe6d5('0x3f')]['sort']);_0x3d625f[_0xe6d5('0x4a')]=qs['filters'](_[_0xe6d5('0x4b')](_0x4b4136[_0xe6d5('0x3f')],_0x39e52e['filters']),_0x22cc0f);if(_0x4b4136[_0xe6d5('0x3f')]['filter']){_0x3d625f['where']=_[_0xe6d5('0x4c')](_0x3d625f['where'],{'$or':_[_0xe6d5('0x38')](_0x22cc0f,function(_0x375487){if(_0x375487[_0xe6d5('0x3c')]!=='VIRTUAL'){var _0x40a615={};_0x40a615[_0x375487[_0xe6d5('0x36')]]={'$like':'%'+_0x4b4136[_0xe6d5('0x3f')][_0xe6d5('0x4d')]+'%'};return _0x40a615;}})});}_0x3d625f=_[_0xe6d5('0x4c')]({},_0x3d625f,_0x4b4136['options']);var _0x422245={'where':_0x3d625f[_0xe6d5('0x4a')]};return db[_0xe6d5('0x39')]['count'](_0x422245)[_0xe6d5('0x33')](function(_0xc696ca){_0x2c172e['count']=_0xc696ca;if(_0x4b4136[_0xe6d5('0x3f')][_0xe6d5('0x4e')]){_0x3d625f[_0xe6d5('0x4f')]=[{'all':!![]}];}return db[_0xe6d5('0x39')]['findAll'](_0x3d625f);})['then'](function(_0x540f15){_0x2c172e[_0xe6d5('0x50')]=_0x540f15;return _0x2c172e;})[_0xe6d5('0x33')](respondWithFilteredResult(_0x7ce9c6,_0x3d625f))[_0xe6d5('0x28')](handleError(_0x7ce9c6,null));};exports[_0xe6d5('0x51')]=function(_0x288493,_0x4bce95){var _0x3e536a={'raw':!![],'where':{'id':_0x288493[_0xe6d5('0x52')]['id']}},_0x172aff={};_0x172aff['model']=_[_0xe6d5('0x40')](db[_0xe6d5('0x39')][_0xe6d5('0x3a')]);_0x172aff[_0xe6d5('0x3f')]=_[_0xe6d5('0x40')](_0x288493['query']);_0x172aff[_0xe6d5('0x41')]=_[_0xe6d5('0x42')](_0x172aff['model'],_0x172aff[_0xe6d5('0x3f')]);_0x3e536a[_0xe6d5('0x43')]=_[_0xe6d5('0x42')](_0x172aff[_0xe6d5('0x3e')],qs[_0xe6d5('0x44')](_0x288493[_0xe6d5('0x3f')][_0xe6d5('0x44')]));_0x3e536a['attributes']=_0x3e536a[_0xe6d5('0x43')]['length']?_0x3e536a[_0xe6d5('0x43')]:_0x172aff[_0xe6d5('0x3e')];if(_0x288493['query'][_0xe6d5('0x4e')]){_0x3e536a['include']=[{'all':!![]}];}_0x3e536a=_[_0xe6d5('0x4c')]({},_0x3e536a,_0x288493[_0xe6d5('0x53')]);return db[_0xe6d5('0x39')]['find'](_0x3e536a)[_0xe6d5('0x33')](handleEntityNotFound(_0x4bce95,null))['then'](respondWithResult(_0x4bce95,null))[_0xe6d5('0x28')](handleError(_0x4bce95,null));};exports[_0xe6d5('0x54')]=function(_0x102665,_0x4e202a){return db[_0xe6d5('0x39')][_0xe6d5('0x54')](_0x102665[_0xe6d5('0x55')],{})[_0xe6d5('0x33')](respondWithResult(_0x4e202a,0xc9))[_0xe6d5('0x28')](handleError(_0x4e202a,null));};exports[_0xe6d5('0x56')]=function(_0x4722bb,_0x16abe2){if(_0x4722bb[_0xe6d5('0x55')]['id']){delete _0x4722bb['body']['id'];}return db[_0xe6d5('0x39')]['find']({'where':{'id':_0x4722bb[_0xe6d5('0x52')]['id']}})[_0xe6d5('0x33')](handleEntityNotFound(_0x16abe2,null))[_0xe6d5('0x33')](saveUpdates(_0x4722bb['body'],null))[_0xe6d5('0x33')](respondWithResult(_0x16abe2,null))['catch'](handleError(_0x16abe2,null));};exports[_0xe6d5('0x34')]=function(_0x39dd3f,_0x27bea4){return db['WhatsappMessage']['find']({'where':{'id':_0x39dd3f[_0xe6d5('0x52')]['id']}})[_0xe6d5('0x33')](handleEntityNotFound(_0x27bea4,null))[_0xe6d5('0x33')](removeEntity(_0x27bea4,null))[_0xe6d5('0x28')](handleError(_0x27bea4,null));};exports[_0xe6d5('0x57')]=function(_0x45c0da,_0x3bce9c){return db['WhatsappMessage'][_0xe6d5('0x57')]()['then'](respondWithResult(_0x3bce9c,null))['catch'](handleError(_0x3bce9c,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xe6d5('0x58')]=function(_0x1397fc,_0x55b4b7,_0x2b32db){var _0x3de322={'agent':{},'channel':_0xe6d5('0x59')};if(_0x1397fc['body']['id']){delete _0x1397fc[_0xe6d5('0x55')]['id'];}_0x1397fc[_0xe6d5('0x55')]['read']=!![];_0x1397fc[_0xe6d5('0x55')][_0xe6d5('0x5a')]=moment()[_0xe6d5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x1397fc[_0xe6d5('0x55')]['UserId']=_0x1397fc[_0xe6d5('0x55')][_0xe6d5('0x5c')]||_0x1397fc[_0xe6d5('0x5d')]['id'];_0x3de322[_0xe6d5('0x5e')]['id']=_0x1397fc[_0xe6d5('0x55')][_0xe6d5('0x5c')];return db[_0xe6d5('0x39')][_0xe6d5('0x5f')]({'where':{'id':_0x1397fc[_0xe6d5('0x52')]['id'],'UserId':null},'include':[{'model':db[_0xe6d5('0x60')],'as':_0xe6d5('0x61')}]})[_0xe6d5('0x33')](handleEntityNotFound(_0x55b4b7,null))['then'](saveUpdates(_0x1397fc[_0xe6d5('0x55')],null))['then'](function(_0x2ff909){if(_0x2ff909){_0x3de322[_0xe6d5('0x24')]=_0x2ff909[_0xe6d5('0x62')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x2ff909['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x55b4b7,null))['then'](function(_0x35a8cd){if(_0x35a8cd){return _0x35a8cd[_0xe6d5('0x56')]({'UserId':_0x1397fc[_0xe6d5('0x55')][_0xe6d5('0x5c')],'read1stAt':_[_0xe6d5('0x63')](_0x35a8cd[_0xe6d5('0x64')])?moment()[_0xe6d5('0x5b')](_0xe6d5('0x65')):undefined});}return null;})['then'](function(_0x21378b){if(_0x21378b){_0x3de322[_0xe6d5('0x66')]=_0x21378b[_0xe6d5('0x62')]({'plain':!![]});interaction_log[_0xe6d5('0x25')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1397fc[_0xe6d5('0x5d')]['id'],_0x1397fc['user'][_0xe6d5('0x36')],_0x1397fc[_0xe6d5('0x5d')]['role'],_0x3de322[_0xe6d5('0x66')]['id'],_0x1397fc['body']?JSON[_0xe6d5('0x22')](_0x1397fc[_0xe6d5('0x55')]):_0xe6d5('0x67'));return respondWithRpcPromise(_0xe6d5('0x68'),'acceptMessage',_0x3de322);}return null;})[_0xe6d5('0x33')](function(_0xa93d1d){if(_0xa93d1d){if(_0x1397fc['body'][_0xe6d5('0x69')]){_0x3de322[_0xe6d5('0x24')][_0xe6d5('0x6a')]=util[_0xe6d5('0x5b')](_0xe6d5('0x6b'),_0x1397fc['user'][_0xe6d5('0x36')]);_0x3de322[_0xe6d5('0x24')][_0xe6d5('0x6c')]=_0x3de322[_0xe6d5('0x6c')];_0x3de322[_0xe6d5('0x24')][_0xe6d5('0x6d')]=_0xe6d5('0x58');return respondWithRpcPromise(_0xe6d5('0x6e'),_0xe6d5('0x6e'),{'event':_0xe6d5('0x6f'),'message':_0x3de322['message']},client9002)['then'](function(){return _0x3de322;});}return _0x3de322;}return null;})[_0xe6d5('0x33')](respondWithResult(_0x55b4b7,null))['catch'](handleError(_0x55b4b7,null));};var interaction_log=require(_0xe6d5('0x13'))(_0xe6d5('0x70'));exports[_0xe6d5('0x32')]=function(_0x1aa540,_0x236dd2,_0x711d2e){var _0x469cb6={'agent':{},'channel':_0xe6d5('0x59')};if(_0x1aa540['body']['id']){delete _0x1aa540[_0xe6d5('0x55')]['id'];}_0x1aa540['body'][_0xe6d5('0x5c')]=_0x1aa540[_0xe6d5('0x55')][_0xe6d5('0x5c')]||_0x1aa540['user']['id'];_0x469cb6['agent']['id']=_0x1aa540[_0xe6d5('0x55')][_0xe6d5('0x5c')];return db[_0xe6d5('0x39')]['find']({'where':{'id':_0x1aa540[_0xe6d5('0x52')]['id'],'UserId':null}})[_0xe6d5('0x33')](handleEntityNotFound(_0x236dd2,null))['then'](function(_0x24f8dd){if(_0x24f8dd){_0x469cb6[_0xe6d5('0x24')]=_0x24f8dd[_0xe6d5('0x62')]({'plain':!![]});return db[_0xe6d5('0x71')]['find']({'where':{'id':_0x24f8dd[_0xe6d5('0x72')]}});}return null;})[_0xe6d5('0x33')](handleEntityNotFound(_0x236dd2,null))[_0xe6d5('0x33')](function(_0x1ab2f0){if(_0x1ab2f0){_0x469cb6['interaction']=_0x1ab2f0[_0xe6d5('0x62')]({'plain':!![]});interaction_log[_0xe6d5('0x25')](_0xe6d5('0x73'),_0x1aa540[_0xe6d5('0x5d')]['id'],_0x1aa540[_0xe6d5('0x5d')]['name'],_0x1aa540[_0xe6d5('0x5d')]['role'],_0x469cb6[_0xe6d5('0x66')]['id'],_0x1aa540[_0xe6d5('0x55')]?JSON['stringify'](_0x1aa540[_0xe6d5('0x55')]):_0xe6d5('0x67'));return respondWithRpcPromise(_0xe6d5('0x74'),'rejectMessage',_0x469cb6);}return null;})['then'](function(_0x2d8d1c){if(_0x2d8d1c){_0x2d8d1c[_0xe6d5('0x24')][_0xe6d5('0x6a')]=util['format']('SIP/%s',_0x1aa540[_0xe6d5('0x5d')][_0xe6d5('0x36')]);_0x2d8d1c[_0xe6d5('0x24')][_0xe6d5('0x6c')]=_0x469cb6['channel'];_0x2d8d1c['message']['event']=_0xe6d5('0x32');respondWithRpcPromise(_0xe6d5('0x6e'),_0xe6d5('0x6e'),{'event':'rejectmessage','message':_0x2d8d1c[_0xe6d5('0x24')]},client9002);return _0x469cb6;}return null;})[_0xe6d5('0x33')](respondWithResult(_0x236dd2,null))[_0xe6d5('0x28')](handleError(_0x236dd2,null));};exports[_0xe6d5('0x2a')]=function(_0x4033e9,_0xeadaea,_0x4d16a9){if(_0x4033e9[_0xe6d5('0x55')]['id']){delete _0x4033e9[_0xe6d5('0x55')]['id'];}var _0x291332;return db[_0xe6d5('0x39')]['find']({'where':{'id':_0x4033e9[_0xe6d5('0x52')]['id']}})[_0xe6d5('0x33')](handleEntityNotFound(_0xeadaea,null))['then'](function(_0x2270fc){if(_0x2270fc){_0x291332=_0x2270fc;return db[_0xe6d5('0x75')][_0xe6d5('0x5f')]({'where':{'id':_0x2270fc[_0xe6d5('0x76')]}});}})['then'](handleEntityNotFound(_0xeadaea,null))['then'](function(_0x4298b1){if(_0x4298b1){logger[_0xe6d5('0x77')](_0xe6d5('0x78'),'status',_0xe6d5('0x79'),_0x4298b1['type'],util['inspect'](_0x4033e9[_0xe6d5('0x55')],{'showHidden':![],'depth':null}));switch(_0x4298b1['type']){case _0xe6d5('0x7a'):if(_0x4033e9[_0xe6d5('0x55')][_0xe6d5('0x7b')]&&_0x4033e9['body'][_0xe6d5('0x7b')]===_0x291332[_0xe6d5('0x7c')]&&_0x4033e9[_0xe6d5('0x55')]['MessageStatus']&&_0x4033e9[_0xe6d5('0x55')][_0xe6d5('0x7d')]==='read'){return _0x291332[_0xe6d5('0x56')]({'read':!![]});}else{logger[_0xe6d5('0x23')](_0xe6d5('0x7e'),_0xe6d5('0x2a'),'twilio',util[_0xe6d5('0x7f')](_0x4033e9[_0xe6d5('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x291332;}})[_0xe6d5('0x33')](respondWithResult(_0xeadaea,null))[_0xe6d5('0x28')](handleError(_0xeadaea,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9f884bc..2e84212 100644 --- a/server/api/whatsappMessage/whatsappMessage.events.js +++ b/server/api/whatsappMessage/whatsappMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_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 +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x5397d2,_0x17a98e){var _0x1d97a0=function(_0x58a42f){while(--_0x58a42f){_0x5397d2['push'](_0x5397d2['shift']());}};_0x1d97a0(++_0x17a98e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c6aed,_0x2a362c){_0x1c6aed=_0x1c6aed-0x0;var _0x360d74=_0x5f2f[_0x1c6aed];return _0x360d74;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 4f5e25d..b49c39d 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 _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 +var _0xf580=['moment','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','update','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x220c1a,_0x13983a){var _0x446efb=function(_0x1972f0){while(--_0x1972f0){_0x220c1a['push'](_0x220c1a['shift']());}};_0x446efb(++_0x13983a);}(_0xf580,0x19c));var _0x0f58=function(_0x58e42a,_0x1365a7){_0x58e42a=_0x58e42a-0x0;var _0x15a97f=_0xf580[_0x58e42a];return _0x15a97f;};'use strict';var _=require(_0x0f58('0x0'));var util=require(_0x0f58('0x1'));var logger=require(_0x0f58('0x2'))(_0x0f58('0x3'));var moment=require(_0x0f58('0x4'));var BPromise=require('bluebird');var rp=require(_0x0f58('0x5'));var fs=require('fs');var path=require(_0x0f58('0x6'));var rimraf=require(_0x0f58('0x7'));var config=require(_0x0f58('0x8'));var attributes=require(_0x0f58('0x9'));module[_0x0f58('0xa')]=function(_0x358392,_0x55a9e6){return _0x358392[_0x0f58('0xb')](_0x0f58('0xc'),attributes,{'tableName':_0x0f58('0xd'),'paranoid':![],'indexes':[{'name':_0x0f58('0xe'),'fields':[_0x0f58('0xe')]},{'name':'fti_whatsapp_messages','fields':[_0x0f58('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2584d3,_0x35da81,_0x16a356){var _0xedc8ae=_0x358392[_0x0f58('0x10')];var _0x579c9b=_0x2584d3[_0x0f58('0x11')]({'plain':!![]});if(_0x579c9b[_0x0f58('0x12')][_0x0f58('0x13')]()==='in'||_0x579c9b[_0x0f58('0x12')]['toLowerCase']()===_0x0f58('0x14')&&!_0x579c9b[_0x0f58('0x15')]&&!_[_0x0f58('0x16')](_0x579c9b['UserId'])){_0xedc8ae[_0x0f58('0x17')]['findOne']({'where':{'id':_0x579c9b[_0x0f58('0x18')]}})['then'](function(_0x3cee6a){if(_0x3cee6a){_0x3cee6a[_0x0f58('0x19')]({'lastMsgAt':_0x579c9b[_0x0f58('0x1a')],'lastMsgDirection':_0x579c9b['direction']['toLowerCase']()});}})[_0x0f58('0x1b')](function(_0x35bb6c){console[_0x0f58('0x1c')](_0x35bb6c);});}if(_0x579c9b[_0x0f58('0x12')]==='out'&&!_0x579c9b[_0x0f58('0x15')]){var _0x5854e7;_0xedc8ae[_0x0f58('0x1d')][_0x0f58('0x1e')]({'where':{'id':_0x579c9b[_0x0f58('0x1f')]},'raw':!![]})[_0x0f58('0x20')](function(_0x388896){_0x5854e7=_0x388896;if(_0x5854e7&&_0x5854e7[_0x0f58('0x21')]){switch(_0x5854e7['type']){case _0x0f58('0x22'):var _0x11a7d9=require('twilio');if(_0x5854e7[_0x0f58('0x23')]&&_0x5854e7[_0x0f58('0x24')]&&_0x5854e7[_0x0f58('0x25')]){var _0x7092a8=new _0x11a7d9(_0x5854e7[_0x0f58('0x23')],_0x5854e7[_0x0f58('0x24')]);_0x7092a8[_0x0f58('0x26')][_0x0f58('0x27')]({'body':_0x579c9b[_0x0f58('0xf')],'to':_0x0f58('0x28')+_0x579c9b[_0x0f58('0x25')],'from':_0x0f58('0x28')+_0x5854e7[_0x0f58('0x25')],'statusCallback':_0x5854e7[_0x0f58('0x29')]+_0x0f58('0x2a')+_0x579c9b['id']+_0x0f58('0x2b')+_0x5854e7['token']})[_0x0f58('0x20')](function(_0x2e4e96){if(_0x2e4e96[_0x0f58('0x2c')]){return _0x2584d3['update']({'messageId':_0x2e4e96[_0x0f58('0x2c')]});}})[_0x0f58('0x1b')](function(_0x1aec96){logger[_0x0f58('0x1c')](_0x0f58('0x2d'),_0x0f58('0x2e'),_0x0f58('0x22'),util[_0x0f58('0x2f')](_0x1aec96,{'showHidden':![],'depth':null}));});}else{logger[_0x0f58('0x1c')](_0x0f58('0x2d'),'afterCreate',_0x0f58('0x22'),_0x0f58('0x30'));}break;}}})[_0x0f58('0x31')](function(){_0x16a356();});}else{_0x16a356();}}},'charset':_0x0f58('0x32'),'collate':_0x0f58('0x33')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 872f071..bc80950 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 _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 +var _0xaf67=['rpc','../../config/environment','jayson/promise','defaults','localhost','redis','./whatsappMessage.socket','register','request','then','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','WhatsappMessage','create','options','CreateWhatsappMessage','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x1b42d3,_0x373a21){var _0x409b46=function(_0x2a6260){while(--_0x2a6260){_0x1b42d3['push'](_0x1b42d3['shift']());}};_0x409b46(++_0x373a21);}(_0xaf67,0xae));var _0x7af6=function(_0x297804,_0x34899c){_0x297804=_0x297804-0x0;var _0x3aa915=_0xaf67[_0x297804];return _0x3aa915;};'use strict';var _=require(_0x7af6('0x0'));var util=require('util');var moment=require(_0x7af6('0x1'));var BPromise=require(_0x7af6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7af6('0x3'));var db=require(_0x7af6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7af6('0x5'))(_0x7af6('0x6'));var config=require(_0x7af6('0x7'));var jayson=require(_0x7af6('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x7af6('0x9')](config['redis'],{'host':_0x7af6('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7af6('0xb')]));require(_0x7af6('0xc'))[_0x7af6('0xd')](socket);function respondWithRpcPromise(_0x43c6dc,_0x426196,_0x26aa18){return new BPromise(function(_0x1a6351,_0x56489f){return client[_0x7af6('0xe')](_0x43c6dc,_0x26aa18)[_0x7af6('0xf')](function(_0x2a6ce4){logger['info'](_0x7af6('0x10'),_0x426196,'request\x20sent');logger[_0x7af6('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x426196,_0x7af6('0x12'),JSON[_0x7af6('0x13')](_0x2a6ce4));if(_0x2a6ce4[_0x7af6('0x14')]){if(_0x2a6ce4['error'][_0x7af6('0x15')]===0x1f4){logger['error'](_0x7af6('0x10'),_0x426196,_0x2a6ce4['error']['message']);return _0x56489f(_0x2a6ce4['error'][_0x7af6('0x16')]);}logger['error'](_0x7af6('0x10'),_0x426196,_0x2a6ce4[_0x7af6('0x14')][_0x7af6('0x16')]);return _0x1a6351(_0x2a6ce4[_0x7af6('0x14')][_0x7af6('0x16')]);}else{logger[_0x7af6('0x17')](_0x7af6('0x10'),_0x426196,_0x7af6('0x12'));_0x1a6351(_0x2a6ce4[_0x7af6('0x18')][_0x7af6('0x16')]);}})['catch'](function(_0x257766){logger[_0x7af6('0x14')](_0x7af6('0x10'),_0x426196,_0x257766);_0x56489f(_0x257766);});});}exports['CreateWhatsappMessage']=function(_0x47b7c0){var _0x42bcd0=this;return new Promise(function(_0xe2b229,_0x12d11f){return db[_0x7af6('0x19')][_0x7af6('0x1a')](_0x47b7c0['body'],{'raw':_0x47b7c0['options']?_0x47b7c0[_0x7af6('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xf3a14f){logger[_0x7af6('0x17')](_0x7af6('0x1c'),_0x47b7c0);logger[_0x7af6('0x11')](_0x7af6('0x1c'),_0x47b7c0,JSON[_0x7af6('0x13')](_0xf3a14f));_0xe2b229(_0xf3a14f);})[_0x7af6('0x1d')](function(_0x5b8497){logger[_0x7af6('0x14')](_0x7af6('0x1c'),_0x5b8497[_0x7af6('0x16')],_0x47b7c0);_0x12d11f(_0x42bcd0['error'](0x1f4,_0x5b8497[_0x7af6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 282c282..cea2736 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 _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 +var _0x9592=['save','remove','update','removeListener','length'];(function(_0x1d5da1,_0x3161b0){var _0x3faa98=function(_0x1ec34e){while(--_0x1ec34e){_0x1d5da1['push'](_0x1d5da1['shift']());}};_0x3faa98(++_0x3161b0);}(_0x9592,0x1c2));var _0x2959=function(_0x91b4c2,_0x5c1f52){_0x91b4c2=_0x91b4c2-0x0;var _0x49e039=_0x9592[_0x91b4c2];return _0x49e039;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0x2959('0x0'),_0x2959('0x1'),_0x2959('0x2')];function createListener(_0x3b4e38,_0x1d8ff6){return function(_0x2ad804){_0x1d8ff6['emit'](_0x3b4e38,_0x2ad804);};}function removeListener(_0x5522eb,_0x52fb70){return function(){WhatsappMessageEvents[_0x2959('0x3')](_0x5522eb,_0x52fb70);};}exports['register']=function(_0x59e11e){for(var _0x58701c=0x0,_0xf4314f=events[_0x2959('0x4')];_0x58701c<_0xf4314f;_0x58701c++){var _0x402a73=events[_0x58701c];var _0x4c463a=createListener('whatsappMessage:'+_0x402a73,_0x59e11e);WhatsappMessageEvents['on'](_0x402a73,_0x4c463a);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5ca7ee3..f23768f 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 _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 +var _0x2037=['util','express','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','delete','removeTeams','removeAgents','exports','multer'];(function(_0x2fe796,_0x1b9201){var _0x200209=function(_0x41deac){while(--_0x41deac){_0x2fe796['push'](_0x2fe796['shift']());}};_0x200209(++_0x1b9201);}(_0x2037,0xae));var _0x7203=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x2037[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x7203('0x0'));var util=require(_0x7203('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7203('0x2'));var router=express['Router']();var auth=require(_0x7203('0x3'));var interaction=require(_0x7203('0x4'));var config=require('../../config/environment');var controller=require(_0x7203('0x5'));router[_0x7203('0x6')]('/',auth[_0x7203('0x7')](),controller[_0x7203('0x8')]);router[_0x7203('0x6')](_0x7203('0x9'),auth[_0x7203('0x7')](),controller[_0x7203('0xa')]);router[_0x7203('0x6')](_0x7203('0xb'),auth[_0x7203('0x7')](),controller[_0x7203('0xc')]);router[_0x7203('0x6')](_0x7203('0xd'),auth[_0x7203('0x7')](),controller['getMembers']);router[_0x7203('0x6')](_0x7203('0xe'),auth[_0x7203('0x7')](),controller[_0x7203('0xf')]);router[_0x7203('0x6')](_0x7203('0x10'),auth[_0x7203('0x7')](),controller[_0x7203('0x11')]);router[_0x7203('0x12')]('/',auth[_0x7203('0x7')](),controller[_0x7203('0x13')]);router['post'](_0x7203('0xe'),auth['isAuthenticated'](),controller[_0x7203('0x14')]);router['post'](_0x7203('0x10'),auth[_0x7203('0x7')](),controller['addAgents']);router['put'](_0x7203('0xb'),auth[_0x7203('0x7')](),controller['update']);router[_0x7203('0x15')]('/:id',auth[_0x7203('0x7')](),controller['destroy']);router[_0x7203('0x15')](_0x7203('0xe'),auth[_0x7203('0x7')](),controller[_0x7203('0x16')]);router['delete'](_0x7203('0x10'),auth['isAuthenticated'](),controller[_0x7203('0x17')]);module[_0x7203('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 9711116..6ee216e 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 _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 +var _0xdc57=['STRING','name','ENUM','sequelize'];(function(_0x872b37,_0x1c45ab){var _0x4faf15=function(_0x52f15e){while(--_0x52f15e){_0x872b37['push'](_0x872b37['shift']());}};_0x4faf15(++_0x1c45ab);}(_0xdc57,0x93));var _0x7dc5=function(_0x45271c,_0x1bf2d8){_0x45271c=_0x45271c-0x0;var _0x44bfda=_0xdc57[_0x45271c];return _0x44bfda;};'use strict';var Sequelize=require(_0x7dc5('0x0'));module['exports']={'name':{'type':Sequelize[_0x7dc5('0x1')],'unique':_0x7dc5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7dc5('0x3')]('rrmemory','beepall','roundrobin')},'description':{'type':Sequelize[_0x7dc5('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ee01568..42f48a2 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 _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 +var _0xa59f=['set','Content-Range','apply','reject','save','update','then','destroy','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','nolimit','limit','order','where','filter','name','merge','options','WhatsappQueue','includeAll','include','findAll','rows','catch','show','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','sort','pick','WhatsappQueueId','UserWhatsappQueue','UserId','whatsappPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','userWhatsappQueue:save','ids','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','union','compact','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','count','offset'];(function(_0x487310,_0x1d2da5){var _0x46b3f5=function(_0x43b697){while(--_0x43b697){_0x487310['push'](_0x487310['shift']());}};_0x46b3f5(++_0x1d2da5);}(_0xa59f,0xf7));var _0xfa59=function(_0x3bd270,_0x57f1d8){_0x3bd270=_0x3bd270-0x0;var _0x502470=_0xa59f[_0x3bd270];return _0x502470;};'use strict';var pdf=require(_0xfa59('0x0'));var emlformat=require(_0xfa59('0x1'));var rimraf=require(_0xfa59('0x2'));var zipdir=require(_0xfa59('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfa59('0x4'));var BPromise=require(_0xfa59('0x5'));var Mustache=require(_0xfa59('0x6'));var util=require(_0xfa59('0x7'));var path=require(_0xfa59('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfa59('0x9'));var squel=require(_0xfa59('0xa'));var crypto=require(_0xfa59('0xb'));var jsforce=require(_0xfa59('0xc'));var deskjs=require(_0xfa59('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfa59('0xe'));var Papa=require(_0xfa59('0xf'));var Redis=require(_0xfa59('0x10'));var authService=require(_0xfa59('0x11'));var qs=require(_0xfa59('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa59('0x13'));var logger=require(_0xfa59('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xfa59('0x15'));var licenseUtil=require(_0xfa59('0x16'));var db=require(_0xfa59('0x17'))['db'];config[_0xfa59('0x18')]=_[_0xfa59('0x19')](config[_0xfa59('0x18')],{'host':_0xfa59('0x1a'),'port':0x18eb});var socket=require(_0xfa59('0x1b'))(new Redis(config[_0xfa59('0x18')]));require(_0xfa59('0x1c'))[_0xfa59('0x1d')](socket);function respondWithStatusCode(_0x5315a7,_0x310b70){_0x310b70=_0x310b70||0xcc;return function(_0x4e7e7c){if(_0x4e7e7c){return _0x5315a7[_0xfa59('0x1e')](_0x310b70);}return _0x5315a7[_0xfa59('0x1f')](_0x310b70)[_0xfa59('0x20')]();};}function respondWithResult(_0x454548,_0x52c472){_0x52c472=_0x52c472||0xc8;return function(_0x3f5153){if(_0x3f5153){return _0x454548[_0xfa59('0x1f')](_0x52c472)['json'](_0x3f5153);}};}function respondWithFilteredResult(_0x4b3363,_0x25c472){return function(_0x107871){if(_0x107871){var _0x5cdbcc=_0x107871[_0xfa59('0x21')],_0x425ffa=_0x25c472[_0xfa59('0x22')],_0x33afde=_0x25c472['offset']+_0x25c472['limit'],_0x272eb2;if(_0x33afde>=_0x5cdbcc){_0x33afde=_0x5cdbcc;_0x272eb2=0xc8;}else{_0x272eb2=0xce;}_0x4b3363[_0xfa59('0x1f')](_0x272eb2);return _0x4b3363[_0xfa59('0x23')](_0xfa59('0x24'),_0x425ffa+'-'+_0x33afde+'/'+_0x5cdbcc)['json'](_0x107871);}return null;};}function patchUpdates(_0x2596ea){return function(_0x2c311c){try{jsonpatch[_0xfa59('0x25')](_0x2c311c,_0x2596ea,!![]);}catch(_0x327d0f){return BPromise[_0xfa59('0x26')](_0x327d0f);}return _0x2c311c[_0xfa59('0x27')]();};}function saveUpdates(_0xf37604,_0x1411f3){return function(_0x327b11){if(_0x327b11){return _0x327b11[_0xfa59('0x28')](_0xf37604)[_0xfa59('0x29')](function(_0x3c6305){return _0x3c6305;});}return null;};}function removeEntity(_0x192819,_0x4ee2dd){return function(_0x1381c9){if(_0x1381c9){return _0x1381c9[_0xfa59('0x2a')]()[_0xfa59('0x29')](function(){var _0x2d2957=_0x1381c9['get']({'plain':!![]});var _0x38c4a3='WhatsappQueues';return db['UserProfileResource'][_0xfa59('0x2a')]({'where':{'type':_0x38c4a3,'resourceId':_0x2d2957['id']}})[_0xfa59('0x29')](function(){return _0x1381c9;});})[_0xfa59('0x29')](function(){_0x192819[_0xfa59('0x1f')](0xcc)[_0xfa59('0x20')]();});}};}function handleEntityNotFound(_0x509f18,_0x3587a7){return function(_0x1e4532){if(!_0x1e4532){_0x509f18['sendStatus'](0x194);}return _0x1e4532;};}function handleError(_0xeb767c,_0x8fd4de){_0x8fd4de=_0x8fd4de||0x1f4;return function(_0x40bbe1){logger['error'](_0x40bbe1['stack']);if(_0x40bbe1['name']){delete _0x40bbe1['name'];}_0xeb767c[_0xfa59('0x1f')](_0x8fd4de)[_0xfa59('0x2b')](_0x40bbe1);};}exports[_0xfa59('0x2c')]=function(_0x41eaab,_0x2d72ae){var _0x8ca048={},_0x5d01a1={},_0x4a0d6c={'count':0x0,'rows':[]};var _0x2330b0=_['map'](db['WhatsappQueue'][_0xfa59('0x2d')],function(_0xaff160){return{'name':_0xaff160[_0xfa59('0x2e')],'type':_0xaff160[_0xfa59('0x2f')][_0xfa59('0x30')]};});_0x5d01a1['model']=_[_0xfa59('0x31')](_0x2330b0,'name');_0x5d01a1['query']=_[_0xfa59('0x32')](_0x41eaab[_0xfa59('0x33')]);_0x5d01a1[_0xfa59('0x34')]=_[_0xfa59('0x35')](_0x5d01a1[_0xfa59('0x36')],_0x5d01a1[_0xfa59('0x33')]);_0x8ca048[_0xfa59('0x37')]=_[_0xfa59('0x35')](_0x5d01a1[_0xfa59('0x36')],qs['fields'](_0x41eaab['query'][_0xfa59('0x38')]));_0x8ca048[_0xfa59('0x37')]=_0x8ca048[_0xfa59('0x37')][_0xfa59('0x39')]?_0x8ca048[_0xfa59('0x37')]:_0x5d01a1['model'];if(!_0x41eaab[_0xfa59('0x33')]['hasOwnProperty'](_0xfa59('0x3a'))){_0x8ca048[_0xfa59('0x3b')]=qs[_0xfa59('0x3b')](_0x41eaab[_0xfa59('0x33')]['limit']);_0x8ca048[_0xfa59('0x22')]=qs[_0xfa59('0x22')](_0x41eaab['query']['offset']);}_0x8ca048[_0xfa59('0x3c')]=qs['sort'](_0x41eaab[_0xfa59('0x33')]['sort']);_0x8ca048[_0xfa59('0x3d')]=qs[_0xfa59('0x34')](_['pick'](_0x41eaab['query'],_0x5d01a1[_0xfa59('0x34')]),_0x2330b0);if(_0x41eaab['query'][_0xfa59('0x3e')]){_0x8ca048[_0xfa59('0x3d')]=_['merge'](_0x8ca048['where'],{'$or':_['map'](_0x2330b0,function(_0x402d9f){if(_0x402d9f[_0xfa59('0x2f')]!=='VIRTUAL'){var _0x200275={};_0x200275[_0x402d9f[_0xfa59('0x3f')]]={'$like':'%'+_0x41eaab['query'][_0xfa59('0x3e')]+'%'};return _0x200275;}})});}_0x8ca048=_[_0xfa59('0x40')]({},_0x8ca048,_0x41eaab[_0xfa59('0x41')]);var _0x38eb51={'where':_0x8ca048[_0xfa59('0x3d')]};return db[_0xfa59('0x42')]['count'](_0x38eb51)[_0xfa59('0x29')](function(_0x976dbd){_0x4a0d6c[_0xfa59('0x21')]=_0x976dbd;if(_0x41eaab[_0xfa59('0x33')][_0xfa59('0x43')]){_0x8ca048[_0xfa59('0x44')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xfa59('0x45')](_0x8ca048);})['then'](function(_0x154402){_0x4a0d6c[_0xfa59('0x46')]=_0x154402;return _0x4a0d6c;})[_0xfa59('0x29')](respondWithFilteredResult(_0x2d72ae,_0x8ca048))[_0xfa59('0x47')](handleError(_0x2d72ae,null));};exports[_0xfa59('0x48')]=function(_0x4b2949,_0x67563){var _0x35d4ad={'raw':!![],'where':{'id':_0x4b2949['params']['id']}},_0x591de1={};_0x591de1['model']=_[_0xfa59('0x32')](db[_0xfa59('0x42')][_0xfa59('0x2d')]);_0x591de1[_0xfa59('0x33')]=_['keys'](_0x4b2949[_0xfa59('0x33')]);_0x591de1[_0xfa59('0x34')]=_[_0xfa59('0x35')](_0x591de1[_0xfa59('0x36')],_0x591de1[_0xfa59('0x33')]);_0x35d4ad['attributes']=_[_0xfa59('0x35')](_0x591de1[_0xfa59('0x36')],qs[_0xfa59('0x38')](_0x4b2949['query'][_0xfa59('0x38')]));_0x35d4ad[_0xfa59('0x37')]=_0x35d4ad['attributes'][_0xfa59('0x39')]?_0x35d4ad[_0xfa59('0x37')]:_0x591de1['model'];if(_0x4b2949[_0xfa59('0x33')][_0xfa59('0x43')]){_0x35d4ad[_0xfa59('0x44')]=[{'all':!![]}];}_0x35d4ad=_[_0xfa59('0x40')]({},_0x35d4ad,_0x4b2949['options']);return db[_0xfa59('0x42')]['find'](_0x35d4ad)['then'](handleEntityNotFound(_0x67563,null))[_0xfa59('0x29')](respondWithResult(_0x67563,null))[_0xfa59('0x47')](handleError(_0x67563,null));};exports['create']=function(_0x36acb9,_0x17b050){return db[_0xfa59('0x42')][_0xfa59('0x49')](_0x36acb9[_0xfa59('0x4a')],{})[_0xfa59('0x29')](function(_0xba19ea){var _0x412772=_0x36acb9[_0xfa59('0x4b')][_0xfa59('0x4c')]({'plain':!![]});if(!_0x412772)throw new Error(_0xfa59('0x4d'));if(_0x412772[_0xfa59('0x4e')]===_0xfa59('0x4b')){var _0x39f156=_0xba19ea['get']({'plain':!![]});var _0x1bd448=_0xfa59('0x4f');return db['UserProfileSection'][_0xfa59('0x50')]({'where':{'name':_0x1bd448,'userProfileId':_0x412772[_0xfa59('0x51')]},'raw':!![]})['then'](function(_0x1c3967){if(_0x1c3967&&_0x1c3967[_0xfa59('0x52')]===0x0){return db[_0xfa59('0x53')][_0xfa59('0x49')]({'name':_0x39f156[_0xfa59('0x3f')],'resourceId':_0x39f156['id'],'type':_0x1c3967[_0xfa59('0x3f')],'sectionId':_0x1c3967['id']},{})[_0xfa59('0x29')](function(){return _0xba19ea;});}else{return _0xba19ea;}})[_0xfa59('0x47')](function(_0x3e439f){logger['error'](_0xfa59('0x54'),_0x3e439f);throw _0x3e439f;});}return _0xba19ea;})[_0xfa59('0x29')](respondWithResult(_0x17b050,0xc9))['catch'](handleError(_0x17b050,null));};exports[_0xfa59('0x28')]=function(_0x51dbbd,_0x2d6896){if(_0x51dbbd[_0xfa59('0x4a')]['id']){delete _0x51dbbd[_0xfa59('0x4a')]['id'];}return db[_0xfa59('0x42')][_0xfa59('0x50')]({'where':{'id':_0x51dbbd[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](handleEntityNotFound(_0x2d6896,null))[_0xfa59('0x29')](saveUpdates(_0x51dbbd['body'],null))[_0xfa59('0x29')](respondWithResult(_0x2d6896,null))[_0xfa59('0x47')](handleError(_0x2d6896,null));};exports[_0xfa59('0x2a')]=function(_0x3377ef,_0x1a4ea2){return db['WhatsappQueue']['find']({'where':{'id':_0x3377ef[_0xfa59('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a4ea2,null))[_0xfa59('0x29')](removeEntity(_0x1a4ea2,null))[_0xfa59('0x47')](handleError(_0x1a4ea2,null));};exports[_0xfa59('0x56')]=function(_0x101323,_0x1d7de5){return db[_0xfa59('0x42')]['describe']()[_0xfa59('0x29')](respondWithResult(_0x1d7de5,null))[_0xfa59('0x47')](handleError(_0x1d7de5,null));};exports[_0xfa59('0x57')]=function(_0x2ad62d,_0x1fdbf6,_0x3b299d){var _0x54c7f4={'raw':!![],'where':{}},_0x547bd9={},_0x59fb9c;return db['WhatsappQueue'][_0xfa59('0x58')]({'where':{'id':_0x2ad62d['params']['id']}})[_0xfa59('0x29')](handleEntityNotFound(_0x1fdbf6,null))[_0xfa59('0x29')](function(_0x120568){if(_0x120568){_0x59fb9c=_0x120568[_0xfa59('0x4c')]({'plain':!![]});_0x547bd9[_0xfa59('0x36')]=_[_0xfa59('0x32')](db['UserWhatsappQueue'][_0xfa59('0x2d')]);_0x547bd9['query']=_[_0xfa59('0x32')](_0x2ad62d[_0xfa59('0x33')]);_0x547bd9[_0xfa59('0x34')]=_['intersection'](_0x547bd9['model'],_0x547bd9['query']);_0x54c7f4[_0xfa59('0x37')]=_['intersection'](_0x547bd9[_0xfa59('0x36')],qs['fields'](_0x2ad62d[_0xfa59('0x33')][_0xfa59('0x38')]));_0x54c7f4[_0xfa59('0x37')]=_0x54c7f4[_0xfa59('0x37')][_0xfa59('0x39')]?_0x54c7f4[_0xfa59('0x37')]:_0x547bd9[_0xfa59('0x36')];if(!_0x2ad62d[_0xfa59('0x33')][_0xfa59('0x59')](_0xfa59('0x3a'))){_0x54c7f4[_0xfa59('0x3b')]=qs[_0xfa59('0x3b')](_0x2ad62d[_0xfa59('0x33')][_0xfa59('0x3b')]);_0x54c7f4[_0xfa59('0x22')]=qs['offset'](_0x2ad62d[_0xfa59('0x33')]['offset']);}_0x54c7f4[_0xfa59('0x3c')]=qs[_0xfa59('0x5a')](_0x2ad62d[_0xfa59('0x33')]['sort']);_0x54c7f4[_0xfa59('0x3d')]=qs[_0xfa59('0x34')](_[_0xfa59('0x5b')](_0x2ad62d[_0xfa59('0x33')],_0x547bd9['filters']));_0x54c7f4['where'][_0xfa59('0x5c')]=_0x120568['id'];if(_0x2ad62d[_0xfa59('0x33')]['filter']){_0x54c7f4[_0xfa59('0x3d')]=_['merge'](_0x54c7f4[_0xfa59('0x3d')],{'$or':_[_0xfa59('0x31')](_0x54c7f4[_0xfa59('0x37')],function(_0x5a7e0c){var _0x2b2ccb={};_0x2b2ccb[_0x5a7e0c]={'$like':'%'+_0x2ad62d[_0xfa59('0x33')]['filter']+'%'};return _0x2b2ccb;})});}_0x54c7f4=_[_0xfa59('0x40')]({},_0x54c7f4,_0x2ad62d[_0xfa59('0x41')]);return db[_0xfa59('0x5d')][_0xfa59('0x45')](_0x54c7f4);}})[_0xfa59('0x29')](function(_0x5913b8){if(_0x5913b8){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x5913b8,_0xfa59('0x5e')),'role':'agent'},'attributes':['id',_0xfa59('0x3f'),_0xfa59('0x5f'),_0xfa59('0x60'),_0xfa59('0x61')]});}})[_0xfa59('0x29')](function(_0x24f73b){if(_0x24f73b){return{'count':_0x24f73b[_0xfa59('0x21')],'rows':_['map'](_0x24f73b[_0xfa59('0x46')],function(_0x23d1c6){return{'membername':_0x23d1c6[_0xfa59('0x3f')],'UserId':_0x23d1c6['id'],'queue_name':_0x59fb9c['name'],'WhatsappQueueId':_0x59fb9c['id'],'interface':util[_0xfa59('0x62')]('%s/%s',_0xfa59('0x63'),_0x23d1c6[_0xfa59('0x3f')]),'penalty':0x0,'paused':_0x23d1c6['whatsappPause'],'createdAt':_0x23d1c6[_0xfa59('0x61')],'updatedAt':_0x23d1c6[_0xfa59('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfa59('0x29')](respondWithFilteredResult(_0x1fdbf6,_0x54c7f4))['catch'](handleError(_0x1fdbf6,null));};exports[_0xfa59('0x64')]=function(_0x210a52,_0x1e3530,_0x574772){var _0x3796d1={};var _0x50871f={};var _0x1533b0;var _0x565a99;return db[_0xfa59('0x42')][_0xfa59('0x58')]({'where':{'id':_0x210a52[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](handleEntityNotFound(_0x1e3530,null))[_0xfa59('0x29')](function(_0x24dc84){if(_0x24dc84){_0x1533b0=_0x24dc84;_0x50871f['model']=_[_0xfa59('0x32')](db[_0xfa59('0x65')][_0xfa59('0x2d')]);_0x50871f['query']=_[_0xfa59('0x32')](_0x210a52[_0xfa59('0x33')]);_0x50871f[_0xfa59('0x34')]=_[_0xfa59('0x35')](_0x50871f['model'],_0x50871f[_0xfa59('0x33')]);_0x3796d1[_0xfa59('0x37')]=_['intersection'](_0x50871f[_0xfa59('0x36')],qs[_0xfa59('0x38')](_0x210a52['query']['fields']));_0x3796d1[_0xfa59('0x37')]=_0x3796d1['attributes'][_0xfa59('0x39')]?_0x3796d1[_0xfa59('0x37')]:_0x50871f[_0xfa59('0x36')];_0x3796d1['order']=qs[_0xfa59('0x5a')](_0x210a52[_0xfa59('0x33')][_0xfa59('0x5a')]);_0x3796d1['where']=qs[_0xfa59('0x34')](_[_0xfa59('0x5b')](_0x210a52[_0xfa59('0x33')],_0x50871f['filters']));if(_0x210a52[_0xfa59('0x33')][_0xfa59('0x3e')]){_0x3796d1[_0xfa59('0x3d')]=_[_0xfa59('0x40')](_0x3796d1['where'],{'$or':_[_0xfa59('0x31')](_0x3796d1['attributes'],function(_0x2f3975){var _0x42fbe9={};_0x42fbe9[_0x2f3975]={'$like':'%'+_0x210a52[_0xfa59('0x33')][_0xfa59('0x3e')]+'%'};return _0x42fbe9;})});}_0x3796d1=_['merge']({},_0x3796d1,_0x210a52[_0xfa59('0x41')]);return _0x1533b0[_0xfa59('0x64')](_0x3796d1);}})[_0xfa59('0x29')](function(_0x4e6dfc){if(_0x4e6dfc){_0x565a99=_0x4e6dfc['length'];if(!_0x210a52[_0xfa59('0x33')][_0xfa59('0x59')](_0xfa59('0x3a'))){_0x3796d1[_0xfa59('0x3b')]=qs[_0xfa59('0x3b')](_0x210a52['query'][_0xfa59('0x3b')]);_0x3796d1[_0xfa59('0x22')]=qs[_0xfa59('0x22')](_0x210a52['query']['offset']);}return _0x1533b0[_0xfa59('0x64')](_0x3796d1);}})['then'](function(_0x4b083a){if(_0x4b083a){return _0x4b083a?{'count':_0x565a99,'rows':_0x4b083a}:null;}})[_0xfa59('0x29')](respondWithResult(_0x1e3530,null))[_0xfa59('0x47')](handleError(_0x1e3530,null));};exports[_0xfa59('0x66')]=function(_0x33da37,_0x19e6f4,_0x297e87){var _0x3c5cdb=_0x33da37['body']['ids'];return db[_0xfa59('0x65')][_0xfa59('0x45')]({'where':{'id':_0x3c5cdb},'attributes':['id'],'include':[{'model':db[_0xfa59('0x67')],'as':_0xfa59('0x68'),'attributes':['id','name',_0xfa59('0x69'),_0xfa59('0x6a'),_0xfa59('0x6b')],'raw':!![]}]})[_0xfa59('0x29')](function(_0x471f42){if(_0x471f42){var _0x4e2ab4=_[_0xfa59('0x6c')](_0x471f42,function(_0x34f948){var _0x4bbe30=_0x34f948[_0xfa59('0x4c')]({'plain':!![]});return _0x4bbe30['Agents'];});return db[_0xfa59('0x42')][_0xfa59('0x50')]({'where':{'id':_0x33da37[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](function(_0x4f177b){return db['sequelize'][_0xfa59('0x6d')](function(_0x191c8e){return _0x4f177b['addTeams'](_0x3c5cdb,{'transaction':_0x191c8e})[_0xfa59('0x29')](function(){return BPromise['each'](_0x4e2ab4,function(_0x264301){return db[_0xfa59('0x5d')][_0xfa59('0x6e')]({'where':{'UserId':_0x264301['id'],'WhatsappQueueId':_0x33da37[_0xfa59('0x55')]['id']},'transaction':_0x191c8e});});})[_0xfa59('0x29')](function(){_0x4e2ab4['forEach'](function(_0xf1be57){socket['emit'](_0xfa59('0x6f'),{'UserId':_0xf1be57['id'],'WhatsappQueueId':_0x4f177b['id']});});});});});}})[_0xfa59('0x29')](respondWithStatusCode(_0x19e6f4,null))[_0xfa59('0x47')](handleError(_0x19e6f4,null));};exports['removeTeams']=function(_0x3e2ec9,_0x105415,_0x113d8a){return db[_0xfa59('0x65')][_0xfa59('0x45')]({'where':{'id':_0x3e2ec9[_0xfa59('0x33')][_0xfa59('0x70')]},'attributes':['id'],'include':[{'model':db[_0xfa59('0x67')],'as':_0xfa59('0x68'),'attributes':['id'],'raw':!![]}]})[_0xfa59('0x29')](handleEntityNotFound(_0x105415,null))['then'](function(_0x9e112a){var _0x4cd374=_['map'](_0x9e112a,'id');var _0x452076=[];var _0x2620d6=[];var _0x19bf93=squel[_0xfa59('0x71')]();_0x19bf93['field'](_0xfa59('0x72'))[_0xfa59('0x73')](_0xfa59('0x74'),'tq')[_0xfa59('0x75')](_0xfa59('0x76'),'ut',_0xfa59('0x77'))['where'](_0xfa59('0x78'),_0x3e2ec9['params']['id']);for(var _0x26083c=0x0;_0x26083c<_0x9e112a[_0xfa59('0x39')];_0x26083c+=0x1){let _0x278ebb=_0x9e112a[_0x26083c];for(var _0x264184=0x0;_0x264184<_0x278ebb[_0xfa59('0x68')][_0xfa59('0x39')];_0x264184+=0x1){let _0x4dad72=_0x278ebb[_0xfa59('0x68')][_0x264184];var _0x2ad42b=_0x19bf93[_0xfa59('0x79')]();_0x2ad42b[_0xfa59('0x3d')](_0xfa59('0x7a'),_0x4dad72['id']);_0x2620d6[_0xfa59('0x7b')](db[_0xfa59('0x7c')]['query'](_0x2ad42b[_0xfa59('0x7d')](),{'type':db['sequelize']['QueryTypes'][_0xfa59('0x7e')]})[_0xfa59('0x29')](function(_0x20b7b0){if(_0x20b7b0[_0xfa59('0x39')]===0x1){return _0x4dad72['id'];}else{var _0x35e5eb=_[_0xfa59('0x7f')](_[_0xfa59('0x31')](_0x20b7b0,'TeamId'),function(_0x546321){return _[_0xfa59('0x80')](_0x4cd374,_0x546321);});if(_0x35e5eb){return _0x4dad72['id'];}}}));}}return BPromise[_0xfa59('0x81')](_0x2620d6)[_0xfa59('0x29')](function(_0x33d547){_0x452076=_(_0x452076)[_0xfa59('0x82')](_0x33d547)[_0xfa59('0x83')]()['value']();return db[_0xfa59('0x42')][_0xfa59('0x50')]({'where':{'id':_0x3e2ec9[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](function(_0x4271a1){return db[_0xfa59('0x7c')][_0xfa59('0x6d')](function(_0x1913e0){return _0x4271a1[_0xfa59('0x84')](_0x3e2ec9[_0xfa59('0x33')][_0xfa59('0x70')],{'transaction':_0x1913e0})[_0xfa59('0x29')](function(){if(!_[_0xfa59('0x85')](_0x452076)){return _0x4271a1[_0xfa59('0x86')](_0x452076,{'transaction':_0x1913e0});}})['then'](function(){_0x452076['forEach'](function(_0x3ff4a2){socket[_0xfa59('0x87')](_0xfa59('0x88'),{'UserId':_0x3ff4a2,'WhatsappQueueId':_0x4271a1['id']});});});});});});})[_0xfa59('0x29')](respondWithStatusCode(_0x105415,null))[_0xfa59('0x47')](handleError(_0x105415,null));};exports[_0xfa59('0x89')]=function(_0x35aa72,_0xf811a9,_0x2be31b){return db[_0xfa59('0x42')][_0xfa59('0x50')]({'where':{'id':_0x35aa72[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](handleEntityNotFound(_0xf811a9,null))['then'](function(_0x4a5e6e){if(_0x4a5e6e){return _0x4a5e6e[_0xfa59('0x89')](_0x35aa72[_0xfa59('0x4a')][_0xfa59('0x70')],_[_0xfa59('0x8a')](_0x35aa72[_0xfa59('0x4a')],[_0xfa59('0x70'),'id'])||{})['spread'](function(_0x824d4d){for(var _0x3684ee=0x0;_0x3684ee<_0x35aa72[_0xfa59('0x4a')][_0xfa59('0x70')][_0xfa59('0x39')];_0x3684ee+=0x1){socket[_0xfa59('0x87')](_0xfa59('0x6f'),{'UserId':_0x35aa72[_0xfa59('0x4a')][_0xfa59('0x70')][_0x3684ee],'WhatsappQueueId':_0x35aa72[_0xfa59('0x55')]['id']});}return _0x824d4d;});}})[_0xfa59('0x29')](respondWithResult(_0xf811a9,null))['catch'](handleError(_0xf811a9,null));};exports[_0xfa59('0x86')]=function(_0x1710a2,_0x4ca932,_0x4b4c39){return db[_0xfa59('0x42')][_0xfa59('0x50')]({'where':{'id':_0x1710a2[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](handleEntityNotFound(_0x4ca932,null))[_0xfa59('0x29')](function(_0x3d2e09){if(_0x3d2e09){return _0x3d2e09['removeAgents'](_0x1710a2[_0xfa59('0x33')]['ids'])['then'](function(){if(_[_0xfa59('0x8b')](_0x1710a2[_0xfa59('0x33')]['ids'])){for(var _0x594870=0x0;_0x594870<_0x1710a2[_0xfa59('0x33')][_0xfa59('0x70')][_0xfa59('0x39')];_0x594870+=0x1){socket[_0xfa59('0x87')](_0xfa59('0x88'),{'UserId':Number(_0x1710a2['query'][_0xfa59('0x70')][_0x594870]),'WhatsappQueueId':Number(_0x1710a2[_0xfa59('0x55')]['id'])});}}else{socket[_0xfa59('0x87')](_0xfa59('0x88'),{'UserId':Number(_0x1710a2[_0xfa59('0x33')][_0xfa59('0x70')]),'WhatsappQueueId':Number(_0x1710a2[_0xfa59('0x55')]['id'])});}});}})[_0xfa59('0x29')](respondWithStatusCode(_0x4ca932,null))[_0xfa59('0x47')](handleError(_0x4ca932,null));};exports['getAgents']=function(_0x5dbbb0,_0x4e23d9,_0x16dc2c){var _0x26a709={};var _0x4e1502={};var _0x1d539b;var _0xda05eb;return db[_0xfa59('0x42')][_0xfa59('0x58')]({'where':{'id':_0x5dbbb0[_0xfa59('0x55')]['id']}})[_0xfa59('0x29')](handleEntityNotFound(_0x4e23d9,null))[_0xfa59('0x29')](function(_0x2b5503){if(_0x2b5503){_0x1d539b=_0x2b5503;_0x4e1502['model']=_[_0xfa59('0x32')](db[_0xfa59('0x67')][_0xfa59('0x2d')]);_0x4e1502[_0xfa59('0x33')]=_[_0xfa59('0x32')](_0x5dbbb0[_0xfa59('0x33')]);_0x4e1502['filters']=_[_0xfa59('0x35')](_0x4e1502[_0xfa59('0x36')],_0x4e1502[_0xfa59('0x33')]);_0x26a709[_0xfa59('0x37')]=_[_0xfa59('0x35')](_0x4e1502[_0xfa59('0x36')],qs['fields'](_0x5dbbb0[_0xfa59('0x33')]['fields']));_0x26a709[_0xfa59('0x37')]=_0x26a709['attributes'][_0xfa59('0x39')]?_0x26a709[_0xfa59('0x37')]:_0x4e1502[_0xfa59('0x36')];_0x26a709['order']=qs['sort'](_0x5dbbb0['query'][_0xfa59('0x5a')]);_0x26a709[_0xfa59('0x3d')]=qs[_0xfa59('0x34')](_[_0xfa59('0x5b')](_0x5dbbb0[_0xfa59('0x33')],_0x4e1502[_0xfa59('0x34')]));if(_0x5dbbb0['query'][_0xfa59('0x3e')]){_0x26a709[_0xfa59('0x3d')]=_[_0xfa59('0x40')](_0x26a709['where'],{'$or':_[_0xfa59('0x31')](_0x26a709[_0xfa59('0x37')],function(_0x2bbe0c){var _0xb97448={};_0xb97448[_0x2bbe0c]={'$like':'%'+_0x5dbbb0['query'][_0xfa59('0x3e')]+'%'};return _0xb97448;})});}_0x26a709=_[_0xfa59('0x40')]({},_0x26a709,_0x5dbbb0['options']);return _0x1d539b[_0xfa59('0x8c')](_0x26a709);}})[_0xfa59('0x29')](function(_0x5a3549){if(_0x5a3549){_0xda05eb=_0x5a3549[_0xfa59('0x39')];if(!_0x5dbbb0[_0xfa59('0x33')][_0xfa59('0x59')](_0xfa59('0x3a'))){_0x26a709[_0xfa59('0x3b')]=qs[_0xfa59('0x3b')](_0x5dbbb0[_0xfa59('0x33')]['limit']);_0x26a709[_0xfa59('0x22')]=qs[_0xfa59('0x22')](_0x5dbbb0[_0xfa59('0x33')]['offset']);}return _0x1d539b['getAgents'](_0x26a709);}})['then'](function(_0x3fa985){if(_0x3fa985){return _0x3fa985?{'count':_0xda05eb,'rows':_0x3fa985}:null;}})[_0xfa59('0x29')](respondWithResult(_0x4e23d9,null))[_0xfa59('0x47')](handleError(_0x4e23d9,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6172eda..947d8a6 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 _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 +var _0x009f=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappQueue','save','remove','emit'];(function(_0x569d88,_0x4ddc2b){var _0x4ec596=function(_0x17611d){while(--_0x17611d){_0x569d88['push'](_0x569d88['shift']());}};_0x4ec596(++_0x4ddc2b);}(_0x009f,0x1c3));var _0xf009=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x009f[_0x13e741];return _0x3f8bb3;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0xf009('0x0'))['db'][_0xf009('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf009('0x2'),'afterUpdate':'update','afterDestroy':_0xf009('0x3')};function emitEvent(_0x42debd){return function(_0x2edf7b,_0x57c228,_0x2e087f){WhatsappQueueEvents[_0xf009('0x4')](_0x42debd+':'+_0x2edf7b['id'],_0x2edf7b);WhatsappQueueEvents[_0xf009('0x4')](_0x42debd,_0x2edf7b);_0x2e087f(null);};}for(var e in events){if(events[_0xf009('0x5')](e)){var event=events[e];WhatsappQueue[_0xf009('0x6')](e,emitEvent(event));}}module[_0xf009('0x7')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 58a010f..d0e3afe 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 _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 +var _0x308c=['moment','bluebird','request-promise','path','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','api'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0x308c,0x167));var _0xc308=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x308c[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc308('0x0'));var moment=require(_0xc308('0x1'));var BPromise=require(_0xc308('0x2'));var rp=require(_0xc308('0x3'));var fs=require('fs');var path=require(_0xc308('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc308('0x5'));module['exports']=function(_0x414498,_0x59ce1c){return _0x414498[_0xc308('0x6')](_0xc308('0x7'),attributes,{'tableName':_0xc308('0x8'),'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 03bca0c..f65b8d3 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 _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 +var _0xef5e=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','limit','include','map','attributes','model','ShowWhatsappQueue','find','where','lodash'];(function(_0x35b628,_0x4859d3){var _0x259a43=function(_0x52a558){while(--_0x52a558){_0x35b628['push'](_0x35b628['shift']());}};_0x259a43(++_0x4859d3);}(_0xef5e,0xa3));var _0xeef5=function(_0x4bc372,_0x356a97){_0x4bc372=_0x4bc372-0x0;var _0x4ce993=_0xef5e[_0x4bc372];return _0x4ce993;};'use strict';var _=require(_0xeef5('0x0'));var util=require(_0xeef5('0x1'));var moment=require(_0xeef5('0x2'));var BPromise=require(_0xeef5('0x3'));var rs=require(_0xeef5('0x4'));var fs=require('fs');var Redis=require(_0xeef5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xeef5('0x6'));var logger=require(_0xeef5('0x7'))('rpc');var config=require(_0xeef5('0x8'));var jayson=require(_0xeef5('0x9'));var client=jayson[_0xeef5('0xa')][_0xeef5('0xb')]({'port':0x232a});config[_0xeef5('0xc')]=_[_0xeef5('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeef5('0xe'))(new Redis(config[_0xeef5('0xc')]));require(_0xeef5('0xf'))[_0xeef5('0x10')](socket);function respondWithRpcPromise(_0x248b9d,_0x5a67a9,_0x405039){return new BPromise(function(_0x48aa02,_0x51d99b){return client['request'](_0x248b9d,_0x405039)[_0xeef5('0x11')](function(_0x110152){logger[_0xeef5('0x12')](_0xeef5('0x13'),_0x5a67a9,'request\x20sent');logger[_0xeef5('0x14')](_0xeef5('0x15'),_0x5a67a9,_0xeef5('0x16'),JSON[_0xeef5('0x17')](_0x110152));if(_0x110152[_0xeef5('0x18')]){if(_0x110152[_0xeef5('0x18')]['code']===0x1f4){logger[_0xeef5('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x5a67a9,_0x110152['error'][_0xeef5('0x19')]);return _0x51d99b(_0x110152['error'][_0xeef5('0x19')]);}logger['error'](_0xeef5('0x13'),_0x5a67a9,_0x110152[_0xeef5('0x18')]['message']);return _0x48aa02(_0x110152[_0xeef5('0x18')][_0xeef5('0x19')]);}else{logger[_0xeef5('0x12')](_0xeef5('0x13'),_0x5a67a9,_0xeef5('0x16'));_0x48aa02(_0x110152[_0xeef5('0x1a')]['message']);}})[_0xeef5('0x1b')](function(_0x156776){logger['error'](_0xeef5('0x13'),_0x5a67a9,_0x156776);_0x51d99b(_0x156776);});});}exports[_0xeef5('0x1c')]=function(_0x481ece){var _0x267dc6=this;return new Promise(function(_0x4c2624,_0x37f0ba){return db[_0xeef5('0x1d')][_0xeef5('0x1e')]({'raw':_0x481ece[_0xeef5('0x1f')]?_0x481ece[_0xeef5('0x1f')][_0xeef5('0x20')]===undefined?!![]:![]:!![],'where':_0x481ece[_0xeef5('0x1f')]?_0x481ece['options']['where']||null:null,'attributes':_0x481ece[_0xeef5('0x1f')]?_0x481ece[_0xeef5('0x1f')]['attributes']||null:null,'limit':_0x481ece[_0xeef5('0x1f')]?_0x481ece[_0xeef5('0x1f')][_0xeef5('0x21')]||null:null,'include':_0x481ece['options']?_0x481ece['options'][_0xeef5('0x22')]?_[_0xeef5('0x23')](_0x481ece[_0xeef5('0x1f')][_0xeef5('0x22')],function(_0x1514a6){return{'model':db[_0x1514a6['model']],'as':_0x1514a6['as'],'attributes':_0x1514a6[_0xeef5('0x24')],'include':_0x1514a6[_0xeef5('0x22')]?_['map'](_0x1514a6[_0xeef5('0x22')],function(_0x4f552d){return{'model':db[_0x4f552d[_0xeef5('0x25')]],'as':_0x4f552d['as'],'attributes':_0x4f552d[_0xeef5('0x24')],'include':_0x4f552d[_0xeef5('0x22')]?_['map'](_0x4f552d[_0xeef5('0x22')],function(_0x819c7d){return{'model':db[_0x819c7d['model']],'as':_0x819c7d['as'],'attributes':_0x819c7d[_0xeef5('0x24')]};}):[]};}):[]};}):[]:[]})[_0xeef5('0x11')](function(_0x5ed15b){logger[_0xeef5('0x12')](_0xeef5('0x1c'),_0x481ece);logger[_0xeef5('0x14')]('GetWhatsappQueue',_0x481ece,JSON['stringify'](_0x5ed15b));_0x4c2624(_0x5ed15b);})[_0xeef5('0x1b')](function(_0xf507fc){logger['error'](_0xeef5('0x1c'),_0xf507fc[_0xeef5('0x19')],_0x481ece);_0x37f0ba(_0x267dc6[_0xeef5('0x18')](0x1f4,_0xf507fc[_0xeef5('0x19')]));});});};exports[_0xeef5('0x26')]=function(_0x17bdf7){var _0x21e098=this;return new Promise(function(_0xc410d5,_0x25c328){return db['WhatsappQueue'][_0xeef5('0x27')]({'raw':_0x17bdf7[_0xeef5('0x1f')]?_0x17bdf7[_0xeef5('0x1f')][_0xeef5('0x20')]===undefined?!![]:![]:!![],'where':_0x17bdf7[_0xeef5('0x1f')]?_0x17bdf7[_0xeef5('0x1f')][_0xeef5('0x28')]||null:null,'attributes':_0x17bdf7[_0xeef5('0x1f')]?_0x17bdf7[_0xeef5('0x1f')][_0xeef5('0x24')]||null:null,'include':_0x17bdf7['options']?_0x17bdf7[_0xeef5('0x1f')]['include']?_[_0xeef5('0x23')](_0x17bdf7[_0xeef5('0x1f')]['include'],function(_0x83413f){return{'model':db[_0x83413f[_0xeef5('0x25')]],'as':_0x83413f['as'],'attributes':_0x83413f[_0xeef5('0x24')],'include':_0x83413f['include']?_['map'](_0x83413f[_0xeef5('0x22')],function(_0x43d735){return{'model':db[_0x43d735['model']],'as':_0x43d735['as'],'attributes':_0x43d735[_0xeef5('0x24')],'include':_0x43d735['include']?_[_0xeef5('0x23')](_0x43d735[_0xeef5('0x22')],function(_0x5c1049){return{'model':db[_0x5c1049[_0xeef5('0x25')]],'as':_0x5c1049['as'],'attributes':_0x5c1049['attributes']};}):[]};}):[]};}):[]:[]})[_0xeef5('0x11')](function(_0xea5949){logger[_0xeef5('0x12')](_0xeef5('0x26'),_0x17bdf7);logger[_0xeef5('0x14')](_0xeef5('0x26'),_0x17bdf7,JSON[_0xeef5('0x17')](_0xea5949));_0xc410d5(_0xea5949);})['catch'](function(_0x4c14a2){logger[_0xeef5('0x18')](_0xeef5('0x26'),_0x4c14a2[_0xeef5('0x19')],_0x17bdf7);_0x25c328(_0x21e098[_0xeef5('0x18')](0x1f4,_0x4c14a2['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 5617178..fbb0ff0 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 _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 +var _0x0a1a=['whatsappQueue:','./whatsappQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x131162,_0x4c2814){var _0x45285d=function(_0x19fb1f){while(--_0x19fb1f){_0x131162['push'](_0x131162['shift']());}};_0x45285d(++_0x4c2814);}(_0x0a1a,0x161));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappQueueEvents=require(_0xa0a1('0x0'));var events=[_0xa0a1('0x1'),_0xa0a1('0x2'),_0xa0a1('0x3')];function createListener(_0x274e11,_0x149c79){return function(_0x1f92e4){_0x149c79[_0xa0a1('0x4')](_0x274e11,_0x1f92e4);};}function removeListener(_0x56fb50,_0x3450a6){return function(){WhatsappQueueEvents[_0xa0a1('0x5')](_0x56fb50,_0x3450a6);};}exports[_0xa0a1('0x6')]=function(_0x62bdf7){for(var _0xa5b83=0x0,_0x3e0353=events['length'];_0xa5b83<_0x3e0353;_0xa5b83++){var _0x2989ff=events[_0xa5b83];var _0xe8b7b3=createListener(_0xa0a1('0x7')+_0x2989ff,_0x62bdf7);WhatsappQueueEvents['on'](_0x2989ff,_0xe8b7b3);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 56fab26..06ed351 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 _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 +var _0x299a=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4706a6,_0x5a1c63){var _0x1bb705=function(_0x484ebb){while(--_0x484ebb){_0x4706a6['push'](_0x4706a6['shift']());}};_0x1bb705(++_0x5a1c63);}(_0x299a,0x161));var _0xa299=function(_0x460f72,_0x394356){_0x460f72=_0x460f72-0x0;var _0x599d30=_0x299a[_0x460f72];return _0x599d30;};'use strict';var multer=require(_0xa299('0x0'));var util=require(_0xa299('0x1'));var path=require(_0xa299('0x2'));var timeout=require(_0xa299('0x3'));var express=require('express');var router=express[_0xa299('0x4')]();var auth=require(_0xa299('0x5'));var interaction=require(_0xa299('0x6'));var config=require(_0xa299('0x7'));var controller=require(_0xa299('0x8'));router[_0xa299('0x9')]('/',auth[_0xa299('0xa')](),controller[_0xa299('0xb')]);router[_0xa299('0x9')](_0xa299('0xc'),auth[_0xa299('0xa')](),controller[_0xa299('0xd')]);router[_0xa299('0x9')](_0xa299('0xe'),auth[_0xa299('0xa')](),controller[_0xa299('0xf')]);router[_0xa299('0x10')]('/',auth[_0xa299('0xa')](),controller[_0xa299('0x11')]);router['put'](_0xa299('0xe'),auth[_0xa299('0xa')](),controller[_0xa299('0x12')]);router['delete']('/:id',auth[_0xa299('0xa')](),controller['destroy']);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 3fbdc51..3a63616 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 _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 +var _0x7fbe=['STRING','DATE'];(function(_0x30c4b7,_0xc2c007){var _0x264c2d=function(_0x37bb77){while(--_0x37bb77){_0x30c4b7['push'](_0x30c4b7['shift']());}};_0x264c2d(++_0xc2c007);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x137aa6,_0xc9ad62){_0x137aa6=_0x137aa6-0x0;var _0x24cb82=_0x7fbe[_0x137aa6];return _0x24cb82;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fb('0x0')]},'joinAt':{'type':Sequelize[_0xe7fb('0x1')]},'leaveAt':{'type':Sequelize[_0xe7fb('0x1')]},'acceptAt':{'type':Sequelize[_0xe7fb('0x1')]},'exitAt':{'type':Sequelize[_0xe7fb('0x1')]},'reason':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 122decf..04b439d 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 _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 +var _0xd937=['nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','create','body','catch','update','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','then','end','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0xd937,0x137));var _0x7d93=function(_0x441f3a,_0x1e066a){_0x441f3a=_0x441f3a-0x0;var _0x3cb22e=_0xd937[_0x441f3a];return _0x3cb22e;};'use strict';var pdf=require(_0x7d93('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d93('0x1'));var zipdir=require(_0x7d93('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7d93('0x3'));var moment=require('moment');var BPromise=require(_0x7d93('0x4'));var Mustache=require(_0x7d93('0x5'));var util=require(_0x7d93('0x6'));var path=require(_0x7d93('0x7'));var sox=require(_0x7d93('0x8'));var csv=require(_0x7d93('0x9'));var ejs=require(_0x7d93('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7d93('0xb'));var deskjs=require(_0x7d93('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7d93('0xd'));var authService=require(_0x7d93('0xe'));var qs=require(_0x7d93('0xf'));var as=require(_0x7d93('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d93('0x11'))(_0x7d93('0x12'));var utils=require('../../config/utils');var config=require(_0x7d93('0x13'));var licenseUtil=require(_0x7d93('0x14'));var db=require(_0x7d93('0x15'))['db'];function respondWithStatusCode(_0x268437,_0x437b99){_0x437b99=_0x437b99||0xcc;return function(_0x2fa1b7){if(_0x2fa1b7){return _0x268437[_0x7d93('0x16')](_0x437b99);}return _0x268437[_0x7d93('0x17')](_0x437b99)['end']();};}function respondWithResult(_0x2e8c3d,_0x505dad){_0x505dad=_0x505dad||0xc8;return function(_0xf71369){if(_0xf71369){return _0x2e8c3d[_0x7d93('0x17')](_0x505dad)[_0x7d93('0x18')](_0xf71369);}};}function respondWithFilteredResult(_0x2d8f5f,_0x144d84){return function(_0x54e716){if(_0x54e716){var _0x7d73b6=_0x54e716[_0x7d93('0x19')],_0x455a68=_0x144d84[_0x7d93('0x1a')],_0x1be451=_0x144d84[_0x7d93('0x1a')]+_0x144d84[_0x7d93('0x1b')],_0x45cd3f;if(_0x1be451>=_0x7d73b6){_0x1be451=_0x7d73b6;_0x45cd3f=0xc8;}else{_0x45cd3f=0xce;}_0x2d8f5f['status'](_0x45cd3f);return _0x2d8f5f[_0x7d93('0x1c')](_0x7d93('0x1d'),_0x455a68+'-'+_0x1be451+'/'+_0x7d73b6)['json'](_0x54e716);}return null;};}function patchUpdates(_0x29ad5d){return function(_0x3b87cc){try{jsonpatch[_0x7d93('0x1e')](_0x3b87cc,_0x29ad5d,!![]);}catch(_0x5c6bec){return BPromise[_0x7d93('0x1f')](_0x5c6bec);}return _0x3b87cc['save']();};}function saveUpdates(_0x557d55,_0x5dd457){return function(_0x2b659d){if(_0x2b659d){return _0x2b659d['update'](_0x557d55)[_0x7d93('0x20')](function(_0x55a189){return _0x55a189;});}return null;};}function removeEntity(_0x4599a3,_0x39f6d4){return function(_0x537379){if(_0x537379){return _0x537379['destroy']()[_0x7d93('0x20')](function(){_0x4599a3[_0x7d93('0x17')](0xcc)[_0x7d93('0x21')]();});}};}function handleEntityNotFound(_0x39dc2b,_0x1c714c){return function(_0x100a70){if(!_0x100a70){_0x39dc2b[_0x7d93('0x16')](0x194);}return _0x100a70;};}function handleError(_0x31ae91,_0x7dbf5a){_0x7dbf5a=_0x7dbf5a||0x1f4;return function(_0x197076){logger[_0x7d93('0x22')](_0x197076[_0x7d93('0x23')]);if(_0x197076[_0x7d93('0x24')]){delete _0x197076['name'];}_0x31ae91['status'](_0x7dbf5a)[_0x7d93('0x25')](_0x197076);};}exports[_0x7d93('0x26')]=function(_0x2a79e2,_0x42369c){var _0x1ad592={},_0x33725b={},_0x8ef84f={'count':0x0,'rows':[]};var _0x2d4edb=_[_0x7d93('0x27')](db[_0x7d93('0x28')][_0x7d93('0x29')],function(_0x57414e){return{'name':_0x57414e[_0x7d93('0x2a')],'type':_0x57414e[_0x7d93('0x2b')][_0x7d93('0x2c')]};});_0x33725b[_0x7d93('0x2d')]=_['map'](_0x2d4edb,_0x7d93('0x24'));_0x33725b['query']=_[_0x7d93('0x2e')](_0x2a79e2['query']);_0x33725b[_0x7d93('0x2f')]=_[_0x7d93('0x30')](_0x33725b[_0x7d93('0x2d')],_0x33725b[_0x7d93('0x31')]);_0x1ad592[_0x7d93('0x32')]=_[_0x7d93('0x30')](_0x33725b[_0x7d93('0x2d')],qs[_0x7d93('0x33')](_0x2a79e2[_0x7d93('0x31')][_0x7d93('0x33')]));_0x1ad592['attributes']=_0x1ad592['attributes'][_0x7d93('0x34')]?_0x1ad592['attributes']:_0x33725b[_0x7d93('0x2d')];if(!_0x2a79e2[_0x7d93('0x31')][_0x7d93('0x35')](_0x7d93('0x36'))){_0x1ad592[_0x7d93('0x1b')]=qs[_0x7d93('0x1b')](_0x2a79e2[_0x7d93('0x31')][_0x7d93('0x1b')]);_0x1ad592['offset']=qs[_0x7d93('0x1a')](_0x2a79e2['query'][_0x7d93('0x1a')]);}_0x1ad592['order']=qs[_0x7d93('0x37')](_0x2a79e2[_0x7d93('0x31')][_0x7d93('0x37')]);_0x1ad592[_0x7d93('0x38')]=qs['filters'](_[_0x7d93('0x39')](_0x2a79e2['query'],_0x33725b[_0x7d93('0x2f')]),_0x2d4edb);if(_0x2a79e2['query'][_0x7d93('0x3a')]){_0x1ad592[_0x7d93('0x38')]=_[_0x7d93('0x3b')](_0x1ad592[_0x7d93('0x38')],{'$or':_[_0x7d93('0x27')](_0x2d4edb,function(_0x3b8838){if(_0x3b8838[_0x7d93('0x2b')]!==_0x7d93('0x3c')){var _0x48f614={};_0x48f614[_0x3b8838['name']]={'$like':'%'+_0x2a79e2[_0x7d93('0x31')][_0x7d93('0x3a')]+'%'};return _0x48f614;}})});}_0x1ad592=_[_0x7d93('0x3b')]({},_0x1ad592,_0x2a79e2[_0x7d93('0x3d')]);var _0x3dfef1={'where':_0x1ad592[_0x7d93('0x38')]};return db[_0x7d93('0x28')][_0x7d93('0x19')](_0x3dfef1)['then'](function(_0x4624b0){_0x8ef84f['count']=_0x4624b0;if(_0x2a79e2['query'][_0x7d93('0x3e')]){_0x1ad592[_0x7d93('0x3f')]=[{'all':!![]}];}return db[_0x7d93('0x28')][_0x7d93('0x40')](_0x1ad592);})[_0x7d93('0x20')](function(_0x2995b0){_0x8ef84f['rows']=_0x2995b0;return _0x8ef84f;})[_0x7d93('0x20')](respondWithFilteredResult(_0x42369c,_0x1ad592))['catch'](handleError(_0x42369c,null));};exports['show']=function(_0x308b97,_0x285df6){var _0x39bdba={'raw':!![],'where':{'id':_0x308b97[_0x7d93('0x41')]['id']}},_0x379905={};_0x379905[_0x7d93('0x2d')]=_['keys'](db[_0x7d93('0x28')]['rawAttributes']);_0x379905['query']=_[_0x7d93('0x2e')](_0x308b97['query']);_0x379905['filters']=_[_0x7d93('0x30')](_0x379905[_0x7d93('0x2d')],_0x379905[_0x7d93('0x31')]);_0x39bdba['attributes']=_[_0x7d93('0x30')](_0x379905['model'],qs[_0x7d93('0x33')](_0x308b97['query'][_0x7d93('0x33')]));_0x39bdba['attributes']=_0x39bdba[_0x7d93('0x32')][_0x7d93('0x34')]?_0x39bdba[_0x7d93('0x32')]:_0x379905[_0x7d93('0x2d')];if(_0x308b97[_0x7d93('0x31')][_0x7d93('0x3e')]){_0x39bdba['include']=[{'all':!![]}];}_0x39bdba=_[_0x7d93('0x3b')]({},_0x39bdba,_0x308b97['options']);return db['WhatsappQueueReport'][_0x7d93('0x42')](_0x39bdba)[_0x7d93('0x20')](handleEntityNotFound(_0x285df6,null))['then'](respondWithResult(_0x285df6,null))['catch'](handleError(_0x285df6,null));};exports[_0x7d93('0x43')]=function(_0x4d1199,_0x4c6a2c){return db['WhatsappQueueReport'][_0x7d93('0x43')](_0x4d1199[_0x7d93('0x44')],{})[_0x7d93('0x20')](respondWithResult(_0x4c6a2c,0xc9))[_0x7d93('0x45')](handleError(_0x4c6a2c,null));};exports[_0x7d93('0x46')]=function(_0x3b59ab,_0x1c6048){if(_0x3b59ab[_0x7d93('0x44')]['id']){delete _0x3b59ab[_0x7d93('0x44')]['id'];}return db[_0x7d93('0x28')][_0x7d93('0x42')]({'where':{'id':_0x3b59ab[_0x7d93('0x41')]['id']}})[_0x7d93('0x20')](handleEntityNotFound(_0x1c6048,null))[_0x7d93('0x20')](saveUpdates(_0x3b59ab['body'],null))['then'](respondWithResult(_0x1c6048,null))[_0x7d93('0x45')](handleError(_0x1c6048,null));};exports[_0x7d93('0x47')]=function(_0x4d0236,_0x187597){return db[_0x7d93('0x28')][_0x7d93('0x42')]({'where':{'id':_0x4d0236['params']['id']}})[_0x7d93('0x20')](handleEntityNotFound(_0x187597,null))['then'](removeEntity(_0x187597,null))[_0x7d93('0x45')](handleError(_0x187597,null));};exports[_0x7d93('0x48')]=function(_0x54712b,_0x5d2341){return db[_0x7d93('0x28')][_0x7d93('0x48')]()[_0x7d93('0x20')](respondWithResult(_0x5d2341,null))[_0x7d93('0x45')](handleError(_0x5d2341,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c6bec1b..65fb9d2 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 _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 +var _0xeb45=['uniqueid','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x58be2c,_0x545b73){var _0x3fe57a=function(_0x28b589){while(--_0x28b589){_0x58be2c['push'](_0x58be2c['shift']());}};_0x3fe57a(++_0x545b73);}(_0xeb45,0xde));var _0x5eb4=function(_0x306b6d,_0x37f698){_0x306b6d=_0x306b6d-0x0;var _0x568f60=_0xeb45[_0x306b6d];return _0x568f60;};'use strict';var _=require(_0x5eb4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5eb4('0x1'));var BPromise=require(_0x5eb4('0x2'));var rp=require(_0x5eb4('0x3'));var fs=require('fs');var path=require(_0x5eb4('0x4'));var rimraf=require(_0x5eb4('0x5'));var config=require(_0x5eb4('0x6'));var attributes=require(_0x5eb4('0x7'));module[_0x5eb4('0x8')]=function(_0x5c398e,_0x596484){return _0x5c398e[_0x5eb4('0x9')](_0x5eb4('0xa'),attributes,{'tableName':_0x5eb4('0xb'),'paranoid':![],'indexes':[{'name':_0x5eb4('0xc'),'fields':[_0x5eb4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4082388..7712098 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 _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 +var _0x58b4=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw','info','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring'];(function(_0x4651bd,_0x12a42f){var _0xdf510d=function(_0x12e500){while(--_0x12e500){_0x4651bd['push'](_0x4651bd['shift']());}};_0xdf510d(++_0x12a42f);}(_0x58b4,0xea));var _0x458b=function(_0x27cd89,_0x1e27cd){_0x27cd89=_0x27cd89-0x0;var _0x1ad22b=_0x58b4[_0x27cd89];return _0x1ad22b;};'use strict';var _=require(_0x458b('0x0'));var util=require('util');var moment=require(_0x458b('0x1'));var BPromise=require(_0x458b('0x2'));var rs=require(_0x458b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x458b('0x4'))['db'];var utils=require(_0x458b('0x5'));var logger=require(_0x458b('0x6'))(_0x458b('0x7'));var config=require('../../config/environment');var jayson=require(_0x458b('0x8'));var client=jayson[_0x458b('0x9')][_0x458b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1023ad,_0x3535aa,_0x17d518){return new BPromise(function(_0x4cb78c,_0x45d71c){return client[_0x458b('0xb')](_0x1023ad,_0x17d518)[_0x458b('0xc')](function(_0x31ef2d){logger['info'](_0x458b('0xd'),_0x3535aa,_0x458b('0xe'));logger[_0x458b('0xf')](_0x458b('0x10'),_0x3535aa,_0x458b('0xe'),JSON[_0x458b('0x11')](_0x31ef2d));if(_0x31ef2d[_0x458b('0x12')]){if(_0x31ef2d['error'][_0x458b('0x13')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x3535aa,_0x31ef2d[_0x458b('0x12')][_0x458b('0x14')]);return _0x45d71c(_0x31ef2d[_0x458b('0x12')]['message']);}logger[_0x458b('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x3535aa,_0x31ef2d[_0x458b('0x12')][_0x458b('0x14')]);return _0x4cb78c(_0x31ef2d[_0x458b('0x12')]['message']);}else{logger['info'](_0x458b('0xd'),_0x3535aa,_0x458b('0xe'));_0x4cb78c(_0x31ef2d[_0x458b('0x15')][_0x458b('0x14')]);}})[_0x458b('0x16')](function(_0x4bf65a){logger[_0x458b('0x12')](_0x458b('0xd'),_0x3535aa,_0x4bf65a);_0x45d71c(_0x4bf65a);});});}exports['CreateWhatsappQueueReport']=function(_0x3325d6){var _0x35b31c=this;return new Promise(function(_0x7979d9,_0x55528c){return db[_0x458b('0x17')][_0x458b('0x18')](_0x3325d6[_0x458b('0x19')],{'raw':_0x3325d6[_0x458b('0x1a')]?_0x3325d6['options'][_0x458b('0x1b')]===undefined?!![]:![]:!![]})[_0x458b('0xc')](function(_0x453cc1){logger[_0x458b('0x1c')]('CreateWhatsappQueueReport',_0x3325d6);logger['debug'](_0x458b('0x1d'),_0x3325d6,JSON[_0x458b('0x11')](_0x453cc1));_0x7979d9(_0x453cc1);})['catch'](function(_0x2ccdd7){logger[_0x458b('0x12')]('CreateWhatsappQueueReport',_0x2ccdd7[_0x458b('0x14')],_0x3325d6);_0x55528c(_0x35b31c['error'](0x1f4,_0x2ccdd7['message']));});});};exports[_0x458b('0x1e')]=function(_0x112234){var _0x2d8854=this;return new Promise(function(_0x494379,_0xdc74e7){return db[_0x458b('0x17')]['update'](_0x112234['body'],{'raw':_0x112234[_0x458b('0x1a')]?_0x112234[_0x458b('0x1a')][_0x458b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x112234['options']?_0x112234[_0x458b('0x1a')][_0x458b('0x1f')]||null:null,'attributes':_0x112234[_0x458b('0x1a')]?_0x112234['options'][_0x458b('0x20')]||null:null,'limit':_0x112234[_0x458b('0x1a')]?_0x112234[_0x458b('0x1a')][_0x458b('0x21')]||null:null})[_0x458b('0xc')](function(_0x5c3a32){logger[_0x458b('0x1c')](_0x458b('0x1e'),_0x112234);logger[_0x458b('0xf')](_0x458b('0x1e'),_0x112234,JSON[_0x458b('0x11')](_0x5c3a32));_0x494379(_0x5c3a32);})[_0x458b('0x16')](function(_0x238094){logger[_0x458b('0x12')]('UpdateWhatsappQueueReport',_0x238094[_0x458b('0x14')],_0x112234);_0xdc74e7(_0x2d8854['error'](0x1f4,_0x238094[_0x458b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 5ebd7ec..06e3b7e 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 _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 +var _0x7a62=['get','index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','exports','multer','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller'];(function(_0x413727,_0x17adb1){var _0x5f46d7=function(_0xbb668e){while(--_0xbb668e){_0x413727['push'](_0x413727['shift']());}};_0x5f46d7(++_0x17adb1);}(_0x7a62,0x17b));var _0x27a6=function(_0xc67884,_0x48672a){_0xc67884=_0xc67884-0x0;var _0x579654=_0x7a62[_0xc67884];return _0x579654;};'use strict';var multer=require(_0x27a6('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x27a6('0x1')]();var auth=require(_0x27a6('0x2'));var interaction=require(_0x27a6('0x3'));var config=require('../../config/environment');var controller=require(_0x27a6('0x4'));router[_0x27a6('0x5')]('/',auth['isAuthenticated'](),controller[_0x27a6('0x6')]);router[_0x27a6('0x5')](_0x27a6('0x7'),auth[_0x27a6('0x8')](),controller[_0x27a6('0x9')]);router['get'](_0x27a6('0xa'),auth[_0x27a6('0x8')](),controller['show']);router[_0x27a6('0xb')]('/',auth[_0x27a6('0x8')](),controller[_0x27a6('0xc')]);router['put'](_0x27a6('0xa'),auth[_0x27a6('0x8')](),controller[_0x27a6('0xd')]);router[_0x27a6('0xe')]('/:id',auth[_0x27a6('0x8')](),controller['destroy']);module[_0x27a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 31536a1..54a5486 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 _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 +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39872b,_0x343e6b){_0x39872b=_0x39872b-0x0;var _0x55fa18=_0x0b0e[_0x39872b];return _0x55fa18;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 075e0df..1e61117 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 _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 +var _0x67b4=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','type','filter','options','includeAll','include','findAll','rows','catch','params','keys','merge','create','body','find','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model'];(function(_0x539d4b,_0x26f70e){var _0x2c6ec2=function(_0x40c5da){while(--_0x40c5da){_0x539d4b['push'](_0x539d4b['shift']());}};_0x2c6ec2(++_0x26f70e);}(_0x67b4,0x1d7));var _0x467b=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x67b4[_0xc8a931];return _0x28bd27;};'use strict';var pdf=require(_0x467b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x467b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x467b('0x2'));var rp=require(_0x467b('0x3'));var moment=require(_0x467b('0x4'));var BPromise=require(_0x467b('0x5'));var Mustache=require(_0x467b('0x6'));var util=require('util');var path=require(_0x467b('0x7'));var sox=require(_0x467b('0x8'));var csv=require(_0x467b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x467b('0xa'));var squel=require(_0x467b('0xb'));var crypto=require(_0x467b('0xc'));var jsforce=require(_0x467b('0xd'));var deskjs=require(_0x467b('0xe'));var toCsv=require(_0x467b('0x9'));var querystring=require(_0x467b('0xf'));var Papa=require('papaparse');var Redis=require(_0x467b('0x10'));var authService=require(_0x467b('0x11'));var qs=require(_0x467b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x467b('0x13'));var logger=require(_0x467b('0x14'))(_0x467b('0x15'));var utils=require(_0x467b('0x16'));var config=require(_0x467b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x467b('0x18'))['db'];function respondWithStatusCode(_0x4b9a99,_0x443600){_0x443600=_0x443600||0xcc;return function(_0x509115){if(_0x509115){return _0x4b9a99[_0x467b('0x19')](_0x443600);}return _0x4b9a99[_0x467b('0x1a')](_0x443600)[_0x467b('0x1b')]();};}function respondWithResult(_0x1ea92b,_0x1d81a4){_0x1d81a4=_0x1d81a4||0xc8;return function(_0x1ab581){if(_0x1ab581){return _0x1ea92b[_0x467b('0x1a')](_0x1d81a4)[_0x467b('0x1c')](_0x1ab581);}};}function respondWithFilteredResult(_0x5f1dd8,_0x3d2b72){return function(_0x3659ef){if(_0x3659ef){var _0x419273=_0x3659ef[_0x467b('0x1d')],_0x2c7af5=_0x3d2b72[_0x467b('0x1e')],_0x2d1497=_0x3d2b72[_0x467b('0x1e')]+_0x3d2b72['limit'],_0x2779b9;if(_0x2d1497>=_0x419273){_0x2d1497=_0x419273;_0x2779b9=0xc8;}else{_0x2779b9=0xce;}_0x5f1dd8[_0x467b('0x1a')](_0x2779b9);return _0x5f1dd8[_0x467b('0x1f')](_0x467b('0x20'),_0x2c7af5+'-'+_0x2d1497+'/'+_0x419273)[_0x467b('0x1c')](_0x3659ef);}return null;};}function patchUpdates(_0x30cfa4){return function(_0x5e78ba){try{jsonpatch[_0x467b('0x21')](_0x5e78ba,_0x30cfa4,!![]);}catch(_0x1f97ab){return BPromise[_0x467b('0x22')](_0x1f97ab);}return _0x5e78ba['save']();};}function saveUpdates(_0x486555,_0x5289c4){return function(_0x3d9809){if(_0x3d9809){return _0x3d9809[_0x467b('0x23')](_0x486555)[_0x467b('0x24')](function(_0x4178f8){return _0x4178f8;});}return null;};}function removeEntity(_0x33d7f0,_0x50337b){return function(_0xc14a45){if(_0xc14a45){return _0xc14a45[_0x467b('0x25')]()[_0x467b('0x24')](function(){_0x33d7f0[_0x467b('0x1a')](0xcc)[_0x467b('0x1b')]();});}};}function handleEntityNotFound(_0x117821,_0x389399){return function(_0x427d9d){if(!_0x427d9d){_0x117821[_0x467b('0x19')](0x194);}return _0x427d9d;};}function handleError(_0x129f08,_0x1df78e){_0x1df78e=_0x1df78e||0x1f4;return function(_0x5edff7){logger['error'](_0x5edff7[_0x467b('0x26')]);if(_0x5edff7[_0x467b('0x27')]){delete _0x5edff7['name'];}_0x129f08[_0x467b('0x1a')](_0x1df78e)['send'](_0x5edff7);};}exports[_0x467b('0x28')]=function(_0x5cbcb7,_0x2ca2d7){var _0x48e6da={},_0x204acf={},_0x18871a={'count':0x0,'rows':[]};var _0x1ae9b4=_[_0x467b('0x29')](db[_0x467b('0x2a')][_0x467b('0x2b')],function(_0x1f50ff){return{'name':_0x1f50ff[_0x467b('0x2c')],'type':_0x1f50ff['type'][_0x467b('0x2d')]};});_0x204acf[_0x467b('0x2e')]=_[_0x467b('0x29')](_0x1ae9b4,'name');_0x204acf['query']=_['keys'](_0x5cbcb7[_0x467b('0x2f')]);_0x204acf[_0x467b('0x30')]=_[_0x467b('0x31')](_0x204acf[_0x467b('0x2e')],_0x204acf['query']);_0x48e6da[_0x467b('0x32')]=_[_0x467b('0x31')](_0x204acf[_0x467b('0x2e')],qs['fields'](_0x5cbcb7[_0x467b('0x2f')][_0x467b('0x33')]));_0x48e6da[_0x467b('0x32')]=_0x48e6da['attributes'][_0x467b('0x34')]?_0x48e6da[_0x467b('0x32')]:_0x204acf[_0x467b('0x2e')];if(!_0x5cbcb7[_0x467b('0x2f')][_0x467b('0x35')](_0x467b('0x36'))){_0x48e6da[_0x467b('0x37')]=qs[_0x467b('0x37')](_0x5cbcb7[_0x467b('0x2f')]['limit']);_0x48e6da[_0x467b('0x1e')]=qs[_0x467b('0x1e')](_0x5cbcb7[_0x467b('0x2f')][_0x467b('0x1e')]);}_0x48e6da['order']=qs['sort'](_0x5cbcb7['query'][_0x467b('0x38')]);_0x48e6da[_0x467b('0x39')]=qs['filters'](_[_0x467b('0x3a')](_0x5cbcb7[_0x467b('0x2f')],_0x204acf[_0x467b('0x30')]),_0x1ae9b4);if(_0x5cbcb7[_0x467b('0x2f')]['filter']){_0x48e6da['where']=_['merge'](_0x48e6da[_0x467b('0x39')],{'$or':_[_0x467b('0x29')](_0x1ae9b4,function(_0x4febcf){if(_0x4febcf[_0x467b('0x3b')]!=='VIRTUAL'){var _0x5b7cb4={};_0x5b7cb4[_0x4febcf['name']]={'$like':'%'+_0x5cbcb7['query'][_0x467b('0x3c')]+'%'};return _0x5b7cb4;}})});}_0x48e6da=_['merge']({},_0x48e6da,_0x5cbcb7[_0x467b('0x3d')]);var _0x18dd32={'where':_0x48e6da[_0x467b('0x39')]};return db[_0x467b('0x2a')][_0x467b('0x1d')](_0x18dd32)[_0x467b('0x24')](function(_0x33f009){_0x18871a[_0x467b('0x1d')]=_0x33f009;if(_0x5cbcb7['query'][_0x467b('0x3e')]){_0x48e6da[_0x467b('0x3f')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x467b('0x40')](_0x48e6da);})[_0x467b('0x24')](function(_0x363d10){_0x18871a[_0x467b('0x41')]=_0x363d10;return _0x18871a;})[_0x467b('0x24')](respondWithFilteredResult(_0x2ca2d7,_0x48e6da))[_0x467b('0x42')](handleError(_0x2ca2d7,null));};exports['show']=function(_0x2fb0fb,_0x54a527){var _0x4d3b1c={'raw':!![],'where':{'id':_0x2fb0fb[_0x467b('0x43')]['id']}},_0x262f56={};_0x262f56['model']=_[_0x467b('0x44')](db[_0x467b('0x2a')]['rawAttributes']);_0x262f56['query']=_[_0x467b('0x44')](_0x2fb0fb[_0x467b('0x2f')]);_0x262f56[_0x467b('0x30')]=_[_0x467b('0x31')](_0x262f56[_0x467b('0x2e')],_0x262f56[_0x467b('0x2f')]);_0x4d3b1c[_0x467b('0x32')]=_[_0x467b('0x31')](_0x262f56[_0x467b('0x2e')],qs[_0x467b('0x33')](_0x2fb0fb[_0x467b('0x2f')]['fields']));_0x4d3b1c['attributes']=_0x4d3b1c[_0x467b('0x32')]['length']?_0x4d3b1c['attributes']:_0x262f56[_0x467b('0x2e')];if(_0x2fb0fb[_0x467b('0x2f')][_0x467b('0x3e')]){_0x4d3b1c[_0x467b('0x3f')]=[{'all':!![]}];}_0x4d3b1c=_[_0x467b('0x45')]({},_0x4d3b1c,_0x2fb0fb[_0x467b('0x3d')]);return db[_0x467b('0x2a')]['find'](_0x4d3b1c)[_0x467b('0x24')](handleEntityNotFound(_0x54a527,null))[_0x467b('0x24')](respondWithResult(_0x54a527,null))[_0x467b('0x42')](handleError(_0x54a527,null));};exports[_0x467b('0x46')]=function(_0x5e537e,_0x80f31c){return db['WhatsappTransferReport'][_0x467b('0x46')](_0x5e537e[_0x467b('0x47')],{})['then'](respondWithResult(_0x80f31c,0xc9))[_0x467b('0x42')](handleError(_0x80f31c,null));};exports[_0x467b('0x23')]=function(_0x354390,_0x3c12f1){if(_0x354390[_0x467b('0x47')]['id']){delete _0x354390['body']['id'];}return db[_0x467b('0x2a')]['find']({'where':{'id':_0x354390[_0x467b('0x43')]['id']}})[_0x467b('0x24')](handleEntityNotFound(_0x3c12f1,null))[_0x467b('0x24')](saveUpdates(_0x354390[_0x467b('0x47')],null))['then'](respondWithResult(_0x3c12f1,null))[_0x467b('0x42')](handleError(_0x3c12f1,null));};exports[_0x467b('0x25')]=function(_0x5baa5c,_0x2009ff){return db[_0x467b('0x2a')][_0x467b('0x48')]({'where':{'id':_0x5baa5c[_0x467b('0x43')]['id']}})[_0x467b('0x24')](handleEntityNotFound(_0x2009ff,null))['then'](removeEntity(_0x2009ff,null))[_0x467b('0x42')](handleError(_0x2009ff,null));};exports[_0x467b('0x49')]=function(_0x380444,_0x917ff8){return db[_0x467b('0x2a')][_0x467b('0x49')]()['then'](respondWithResult(_0x917ff8,null))[_0x467b('0x42')](handleError(_0x917ff8,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index f5b4bf9..4ef4fb2 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 _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 +var _0x8aab=['api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x293c71,_0x47aacd){var _0x5be12f=function(_0x2840ad){while(--_0x2840ad){_0x293c71['push'](_0x293c71['shift']());}};_0x5be12f(++_0x47aacd);}(_0x8aab,0x8a));var _0xb8aa=function(_0x58ccb4,_0x55c780){_0x58ccb4=_0x58ccb4-0x0;var _0x41c10e=_0x8aab[_0x58ccb4];return _0x41c10e;};'use strict';var _=require(_0xb8aa('0x0'));var util=require(_0xb8aa('0x1'));var logger=require('../../config/logger')(_0xb8aa('0x2'));var moment=require(_0xb8aa('0x3'));var BPromise=require(_0xb8aa('0x4'));var rp=require(_0xb8aa('0x5'));var fs=require('fs');var path=require(_0xb8aa('0x6'));var rimraf=require(_0xb8aa('0x7'));var config=require('../../config/environment');var attributes=require(_0xb8aa('0x8'));module[_0xb8aa('0x9')]=function(_0x3e671c,_0x4aace7){return _0x3e671c[_0xb8aa('0xa')](_0xb8aa('0xb'),attributes,{'tableName':_0xb8aa('0xc'),'paranoid':![],'indexes':[{'name':_0xb8aa('0xd'),'fields':[_0xb8aa('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index bcce91b..cf67e6a 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(_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 +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(_0x5dd26d,_0x494b30){var _0x1c19fe=function(_0x4b6717){while(--_0x4b6717){_0x5dd26d['push'](_0x5dd26d['shift']());}};_0x1c19fe(++_0x494b30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 f1f8fa2..fa31b89 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xe0dc=['app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe0dc,0x190));var _0xce0d=function(_0x5ea797,_0x2d39dd){_0x5ea797=_0x5ea797-0x0;var _0x500783=_0xe0dc[_0x5ea797];return _0x500783;};'use strict';var _=require(_0xce0d('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0xce0d('0x1'));var config=require(_0xce0d('0x2'));var logger=require('./config/logger')(_0xce0d('0x3'));var pm2=require(_0xce0d('0x4'));var pm2Config=require(_0xce0d('0x5'));var schedule=require(_0xce0d('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xce0d('0x7'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xce0d('0x8')][_0xce0d('0x9')]()[_0xce0d('0xa')](function(){return rpc[_0xce0d('0xb')]();})[_0xce0d('0xa')](function(_0x2f82c0){logger[_0xce0d('0xc')](_0x2f82c0);return chat[_0xce0d('0xd')]();})[_0xce0d('0xa')](function(){return whatsapp[_0xce0d('0xd')]();})[_0xce0d('0xa')](function(){return schedule[_0xce0d('0xd')]();})[_0xce0d('0xa')](function(){return transcribe[_0xce0d('0xd')]();})[_0xce0d('0xa')](function(_0x159b09){logger[_0xce0d('0xc')](_0x159b09);return pm2[_0xce0d('0xd')](pm2Config);})[_0xce0d('0xa')](function(_0x4a8b96){logger[_0xce0d('0xc')](_0xce0d('0xe'),_[_0xce0d('0xf')](_[_0xce0d('0x10')](_0x4a8b96,{'status':_0xce0d('0x11')}),_0xce0d('0x12'))[_0xce0d('0x13')]());logger[_0xce0d('0xc')](_0xce0d('0x14'),_[_0xce0d('0xf')](_[_0xce0d('0x10')](_0x4a8b96,function(_0x2db05a){return _0x2db05a[_0xce0d('0x15')]!==_0xce0d('0x11');}),_0xce0d('0x12'))[_0xce0d('0x13')]()||_0xce0d('0x16'));config[_0xce0d('0x17')]&&require(_0xce0d('0x18'))[_0xce0d('0x19')]();require(_0xce0d('0x1a'))[_0xce0d('0x19')]();})[_0xce0d('0x1b')](function(_0x1e03c1){logger[_0xce0d('0x1c')](_0xce0d('0x1d'),_0x1e03c1);process[_0xce0d('0x1e')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 3ea0f3e..c1ca204 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 _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 +var _0xf142=['../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','fullname','email','userpic','voicePause','chatPause','mailPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','hotdesk','interface','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','Basic','User','name','authenticate','Wrong\x20credentials.','startsWith','status','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','update','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','unshift','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb'];(function(_0x2d4cad,_0x50ad1f){var _0x2d1bcf=function(_0x33f50b){while(--_0x33f50b){_0x2d4cad['push'](_0x2d4cad['shift']());}};_0x2d1bcf(++_0x50ad1f);}(_0xf142,0x79));var _0x2f14=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf142[_0x101e7b];return _0x4995c0;};'use strict';var db=require(_0x2f14('0x0'))['db'];var config=require(_0x2f14('0x1'));var hardwareConf=require(_0x2f14('0x2'));var licenseUtil=require(_0x2f14('0x3'));var encryptor=require(_0x2f14('0x4'));var _=require('lodash');var jwt=require(_0x2f14('0x5'));var expressJwt=require(_0x2f14('0x6'));var compose=require(_0x2f14('0x7'));var basicAuth=require(_0x2f14('0x8'));var crypto=require(_0x2f14('0x9'));var BPromise=require(_0x2f14('0xa'));var util=require(_0x2f14('0xb'));var moment=require(_0x2f14('0xc'));var validateJwt=expressJwt({'secret':config[_0x2f14('0xd')][_0x2f14('0xe')]});var userAttributes=['id','role',_0x2f14('0xf'),'name','internal',_0x2f14('0x10'),_0x2f14('0x11'),'permissions','md5secret',_0x2f14('0x12'),_0x2f14('0x13'),_0x2f14('0x14'),'faxPause','smsPause',_0x2f14('0x15'),_0x2f14('0x16'),_0x2f14('0x17'),_0x2f14('0x18'),_0x2f14('0x19'),'crudPermissions',_0x2f14('0x1a'),'passwordResetAt','alias',_0x2f14('0x1b'),_0x2f14('0x1c'),'phoneBarDnd',_0x2f14('0x1d'),_0x2f14('0x1e'),_0x2f14('0x1f'),_0x2f14('0x20'),_0x2f14('0x21'),'phoneBarRemoteControl','phoneBarRemoteControlPort',_0x2f14('0x22'),_0x2f14('0x23'),'userProfileId','settingsEnabled'];exports[_0x2f14('0x24')]=function(){return this[_0x2f14('0x25')](!![])['use'](function(_0x146516,_0x2edd23,_0x394c77){if(_0x146516[_0x2f14('0x26')]){_0x394c77();}else{return db['ChatInteraction'][_0x2f14('0x27')]({'where':{'id':_0x146516[_0x2f14('0x28')]['id']},'attributes':['id',_0x2f14('0x29'),_0x2f14('0x2a')],'raw':!![]})[_0x2f14('0x2b')](function(_0x12db39){if(_0x12db39&&_0x12db39[_0x2f14('0x29')]){return _0x2edd23['status'](_0x12db39[_0x2f14('0x2a')]===_0x2f14('0x2c')?0x195:0x193)[_0x2f14('0x2d')]({'message':_0x12db39[_0x2f14('0x2a')]==='unmanaged'?_0x2f14('0x2e'):_0x2f14('0x2f')});}else{_0x394c77();}})[_0x2f14('0x30')](function(_0x20ca0d){_0x394c77(_0x20ca0d);});}});};exports[_0x2f14('0x25')]=function isAuthenticated(_0x3d2be5){return compose()[_0x2f14('0x31')](function(_0x54cc37,_0x3bd502,_0x232033){var _0x3f7aac;if(_0x54cc37[_0x2f14('0x32')][_0x2f14('0x33')]){if(_['startsWith'](_0x54cc37[_0x2f14('0x32')][_0x2f14('0x33')],_0x2f14('0x34'))){var _0x2c7144=basicAuth(_0x54cc37);db[_0x2f14('0x35')]['find']({'where':{'name':_0x2c7144[_0x2f14('0x36')]}})[_0x2f14('0x2b')](function(_0xdfb030){if(!_0xdfb030||!_0xdfb030[_0x2f14('0x37')](_0x2c7144['pass'])){return _0x3bd502['status'](0x191)['json']({'message':_0x2f14('0x38')});}_0x54cc37['user']={'id':_0xdfb030['id']};_0x232033();})[_0x2f14('0x30')](function(_0x1c8e72){_0x232033(_0x1c8e72);});}else if(_[_0x2f14('0x39')](_0x54cc37['headers'][_0x2f14('0x33')],'Bearer')){validateJwt(_0x54cc37,_0x3bd502,_0x232033);}else{if(_0x3d2be5){_0x232033();}else{return _0x3bd502[_0x2f14('0x3a')](0x193)['json']({'message':_0x2f14('0x3b')});}}}else if(_0x54cc37[_0x2f14('0x3c')][_0x2f14('0x3d')]){try{var _0x416baa={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2f14('0x3e')]()};verifyJwt(_0x54cc37[_0x2f14('0x3c')][_0x2f14('0x3d')],_0x416baa)[_0x2f14('0x2b')](function(_0x50d7b4){return db[_0x2f14('0x35')][_0x2f14('0x3f')]({'where':{'id':_0x50d7b4[_0x2f14('0x40')]}})[_0x2f14('0x2b')](function(_0x41dab4){_0x3f7aac=_0x41dab4;return db[_0x2f14('0x41')][_0x2f14('0x27')]({'where':{'id':0x1},'attributes':[_0x2f14('0x42'),_0x2f14('0x43')],'raw':!![]});})[_0x2f14('0x2b')](function(_0x5a4af3){if(!_0x3f7aac||!_[_0x2f14('0x44')](_0x3f7aac['apiKeyNonce'],_0x50d7b4[_0x2f14('0x45')])){return _0x3bd502['status'](0x191)[_0x2f14('0x2d')]({'message':_0x2f14('0x46')});}if(_0x3f7aac['disabled']){return _0x3bd502[_0x2f14('0x3a')](0x191)[_0x2f14('0x2d')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3f7aac[_0x2f14('0x47')]){if(_0x5a4af3[_0x2f14('0x43')]>0x0){if(moment(_0x3f7aac[_0x2f14('0x48')])[_0x2f14('0x49')](_0x5a4af3[_0x2f14('0x43')],_0x2f14('0x4a'))>moment()){return _0x3bd502[_0x2f14('0x3a')](0x191)[_0x2f14('0x2d')]({'message':_0x2f14('0x4b')});}}else{return _0x3bd502[_0x2f14('0x3a')](0x191)[_0x2f14('0x2d')]({'message':_0x2f14('0x4b')});}}_0x54cc37['user']={'id':_0x3f7aac['id']};_0x232033();});})[_0x2f14('0x30')](function(){return _0x3bd502[_0x2f14('0x3a')](0x191)[_0x2f14('0x2d')]({'message':_0x2f14('0x4b')});});}catch(_0x24fbcc){_0x232033(_0x24fbcc);}}else if(_0x3d2be5){_0x232033();}else{return _0x3bd502[_0x2f14('0x3a')](0x193)['json']({'message':_0x2f14('0x3b')});}})[_0x2f14('0x31')](function(_0x1951b6,_0x6447a1,_0x3874a2){if(_0x1951b6['user']){db[_0x2f14('0x35')]['find']({'where':{'id':_0x1951b6['user']['id']},'attributes':userAttributes})[_0x2f14('0x2b')](function(_0x5bd526){if(!_0x5bd526){return _0x6447a1[_0x2f14('0x3a')](0x194)[_0x2f14('0x2d')]({'message':_0x2f14('0x4c')});}_0x1951b6['user']=_0x5bd526;_0x3874a2();})[_0x2f14('0x30')](function(_0x165857){_0x3874a2(_0x165857);});}else if(_0x3d2be5){_0x3874a2();}else{return _0x6447a1['status'](0x194)[_0x2f14('0x2d')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x2f14('0x4d')]=function canUpdate(){return compose()[_0x2f14('0x31')](function(_0x4b7d14,_0x3226a6,_0x2526d0){return licenseUtil['getLicense']()[_0x2f14('0x2b')](function(_0x3f7a69){if(_0x3f7a69[_0x2f14('0x4e')]){_0x2526d0();}else{return _0x3226a6['status'](0x193)['json']({'message':'Forbidden'});}})[_0x2f14('0x30')](function(_0x58f15f){_0x2526d0(_0x58f15f);});});};exports[_0x2f14('0x4f')]=function(_0x1d64bc,_0xb3cfc5,_0x159a1b){_0x1d64bc['isMiddleware']=!![];return _0x159a1b();};exports[_0x2f14('0x50')]=function signToken(_0x32e5c1){return signJwt(_0x32e5c1);};exports[_0x2f14('0x51')]=function(_0x56a7b8,_0x1adc31){if(!_0x56a7b8['user']){return _0x1adc31[_0x2f14('0x3a')](0x194)[_0x2f14('0x2d')]({'message':_0x2f14('0x52')});}var _0x4734d6={'payload':{'id':_0x56a7b8[_0x2f14('0x26')]['id'],'role':_0x56a7b8[_0x2f14('0x26')][_0x2f14('0x53')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4734d6)[_0x2f14('0x2b')](function(_0x773a8d){_0x1adc31[_0x2f14('0x54')](_0x2f14('0x55'),_0x773a8d);_0x1adc31[_0x2f14('0x56')](_0x2f14('0x57'));})[_0x2f14('0x30')](function(_0x50e47f){return _0x1adc31[_0x2f14('0x3a')](0x1f4)[_0x2f14('0x58')](_0x50e47f);});};exports[_0x2f14('0x59')]=function(_0x270ff3){if(_[_0x2f14('0x5a')](_0x270ff3[_0x2f14('0x5b')])||_[_0x2f14('0x5a')](_0x270ff3[_0x2f14('0x5c')])){return null;}else{return createJwt(_0x270ff3);}};exports[_0x2f14('0x5d')]=function(_0x23128a){_0x23128a['apiKeyNonce']=generateNonce();_0x23128a[_0x2f14('0x5c')]=generateIssuedAt();return createJwt(_0x23128a);};exports[_0x2f14('0x5e')]=function(_0x239d69,_0x721e89){var _0x3eb557=_0x239d69[_0x2f14('0x3c')][_0x2f14('0x3d')];if(_0x3eb557){var _0x538e46={'nonce':_0x721e89[_0x2f14('0x5b')],'iat':_0x721e89[_0x2f14('0x5c')],'audience':hardwareConf[_0x2f14('0x3e')](),'issuer':hardwareConf[_0x2f14('0x3e')]()};return verifyJwt(_0x3eb557,_0x538e46)['then'](function(){return generateApiKey(_0x721e89);});}else{throw{'message':_0x2f14('0x5f')};}};exports[_0x2f14('0x60')]=function(_0x27121a){var _0x54f049=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x54f049[_0x2f14('0x61')](_0x27121a))throw new db['Sequelize'][(_0x2f14('0x62'))](_0x2f14('0x63'));return;};exports[_0x2f14('0x64')]=function(_0x2eb68c,_0x53ed19,_0x4c92fe){var _0x50e528=encryptor[_0x2f14('0x65')](_0x53ed19)['split'](',');for(var _0x1c0e17=0x0;_0x1c0e17<_0x4c92fe;_0x1c0e17++){if(!_0x50e528[_0x1c0e17])break;if(_0x2eb68c[_0x2f14('0x66')]()===_0x50e528[_0x1c0e17][_0x2f14('0x66')]()){var _0x13b44e=util[_0x2f14('0x67')](_0x2f14('0x68'),_0x4c92fe);if(_0x4c92fe===0x1){_0x13b44e='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x2f14('0x69'))][(_0x2f14('0x62'))](_0x13b44e);}}return;};exports[_0x2f14('0x6a')]=function(_0xd24520,_0x4d9fcc){var _0x420014=_0x4d9fcc?encryptor[_0x2f14('0x65')](_0x4d9fcc)['split'](','):[];if(_0x420014[_0x2f14('0x6b')]===0x5){_0x420014['splice'](-0x1,0x1);}_0x420014[_0x2f14('0x6c')](_0xd24520);return encryptor[_0x2f14('0x6d')](_0x420014['join'](','));};function signJwt(_0x192c87){var _0x1204ac=BPromise[_0x2f14('0x6e')](jwt[_0x2f14('0x6f')],{'context':jwt});var _0x13c309=_0x192c87[_0x2f14('0x70')]||config[_0x2f14('0xd')][_0x2f14('0xe')];return new BPromise(function(_0x525bb2,_0x162efd){_0x1204ac(_0x192c87[_0x2f14('0x71')],_0x13c309,_0x192c87[_0x2f14('0x72')])[_0x2f14('0x2b')](function(_0x5d71ae){_0x525bb2(_0x5d71ae);})[_0x2f14('0x30')](function(_0xc334fb){_0x162efd(_0xc334fb);});});}function verifyJwt(_0x3a0d31,_0x1d80b3,_0x43bfdb){var _0x3ff6c8=BPromise['promisify'](jwt[_0x2f14('0x73')],{'context':jwt});var _0x38d42f=_0x43bfdb||config[_0x2f14('0xd')][_0x2f14('0xe')];return new BPromise(function(_0x14872a,_0x220dbd){_0x3ff6c8(_0x3a0d31,_0x38d42f,_0x1d80b3)[_0x2f14('0x2b')](function(_0x6fc9cd){_0x14872a(_0x6fc9cd);})['catch'](function(_0x237cae){_0x220dbd(_0x237cae);});});}function generateNonce(){return crypto[_0x2f14('0x74')](0x10)[_0x2f14('0x75')](_0x2f14('0x76'));}function generateIssuedAt(){return Math[_0x2f14('0x77')](Date[_0x2f14('0x78')]()/0x3e8)[_0x2f14('0x75')]();}function createJwt(_0x213b56){var _0x492b58={'payload':{'iat':_0x213b56[_0x2f14('0x5c')],'nonce':_0x213b56[_0x2f14('0x5b')]},'options':{'algorithm':_0x2f14('0x79'),'subject':_0x213b56['id'][_0x2f14('0x75')](),'issuer':hardwareConf[_0x2f14('0x3e')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x492b58)[_0x2f14('0x2b')](function(_0x405476){return{'iat':_0x213b56['apiKeyIat'],'nonce':_0x213b56[_0x2f14('0x5b')],'token':_0x405476};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index da00226..f13815a 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 _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 +var _0x326f=['end','final','binary','close','decryptFile','createDecipher','unlink','utf8','base64','crypto','secrets','session','aes-256-ctr','aes192','hasOwnProperty','createReadStream','createWriteStream','algorithm','update','write'];(function(_0x1a7917,_0x5de177){var _0x24e0b9=function(_0x2b766a){while(--_0x2b766a){_0x1a7917['push'](_0x1a7917['shift']());}};_0x24e0b9(++_0x5de177);}(_0x326f,0xd1));var _0xf326=function(_0x5aa018,_0x18fad0){_0x5aa018=_0x5aa018-0x0;var _0x7ab49b=_0x326f[_0x5aa018];return _0x7ab49b;};'use strict';var crypto=require(_0xf326('0x0'));var fs=require('fs');var BPromise=require('bluebird');var config=require('../../config/environment');const stringOptions={'secret':config[_0xf326('0x1')][_0xf326('0x2')],'algorithm':_0xf326('0x3')};const fileOptions={'algorithm':_0xf326('0x4')};function combineOptions(_0x27e8d7){var _0x120a26={};for(var _0x9445c6 in fileOptions){if(fileOptions[_0xf326('0x5')](_0x9445c6)){_0x120a26[_0x9445c6]=fileOptions[_0x9445c6];}}if(_0x27e8d7){for(var _0x1b5a56 in _0x27e8d7){if(_0x27e8d7[_0xf326('0x5')](_0x1b5a56)){_0x120a26[_0x1b5a56]=_0x27e8d7[_0x1b5a56];}}}return _0x120a26;}exports['encryptFile']=function(_0x3c254d,_0x3851eb,_0x165f95,_0x1e7b8a){return new BPromise(function(_0x515bfa,_0x4c206c){_0x1e7b8a=combineOptions(_0x1e7b8a);var _0x592975=new Buffer(_0x165f95);var _0x3bacf2=fs[_0xf326('0x6')](_0x3c254d);var _0x163416=fs[_0xf326('0x7')](_0x3851eb);var _0x1f3a33=crypto['createCipher'](_0x1e7b8a[_0xf326('0x8')],_0x592975);_0x3bacf2['on']('data',function(_0x1cf441){var _0x4aaf3a=new Buffer(_0x1f3a33[_0xf326('0x9')](_0x1cf441),'binary');_0x163416[_0xf326('0xa')](_0x4aaf3a);});_0x3bacf2['on'](_0xf326('0xb'),function(){try{var _0x4b3966=new Buffer(_0x1f3a33[_0xf326('0xc')](_0xf326('0xd')),_0xf326('0xd'));_0x163416[_0xf326('0xa')](_0x4b3966);_0x163416['end']();_0x163416['on'](_0xf326('0xe'),function(){return _0x515bfa(_0x3851eb);});}catch(_0x5204ee){fs['unlink'](_0x3851eb);return _0x4c206c(_0x5204ee);}});});};exports[_0xf326('0xf')]=function(_0x11f6d2,_0x1f2e5a,_0xa63d1a,_0x292f4b){return new BPromise(function(_0x287a2a,_0x34128e){_0x292f4b=combineOptions(_0x292f4b);var _0x2cf2ca=new Buffer(_0xa63d1a);var _0x5a682a=fs[_0xf326('0x6')](_0x11f6d2);var _0x453100=fs[_0xf326('0x7')](_0x1f2e5a);var _0x31ffb9=crypto[_0xf326('0x10')](_0x292f4b[_0xf326('0x8')],_0x2cf2ca);_0x5a682a['on']('data',function(_0x4a5b6c){var _0x56ad41=new Buffer(_0x31ffb9[_0xf326('0x9')](_0x4a5b6c),_0xf326('0xd'));_0x453100['write'](_0x56ad41);});_0x5a682a['on']('end',function(){try{var _0x128c68=new Buffer(_0x31ffb9['final']('binary'),_0xf326('0xd'));_0x453100[_0xf326('0xa')](_0x128c68);_0x453100['end']();_0x453100['on']('close',function(){return _0x287a2a(_0x1f2e5a);});}catch(_0x19b8ba){fs[_0xf326('0x11')](_0x1f2e5a);return _0x34128e(_0x19b8ba);}});});};exports['encryptString']=function(_0x337ed5,_0x1b9039,_0x43c53e){var _0x295752=_0x43c53e||stringOptions[_0xf326('0x8')];var _0x2049ec=_0x1b9039||stringOptions['secret'];var _0x55b9f4=crypto['createCipher'](_0x295752,_0x2049ec);var _0x520d85=_0x55b9f4[_0xf326('0x9')](_0x337ed5,_0xf326('0x12'),_0xf326('0x13'));_0x520d85+=_0x55b9f4[_0xf326('0xc')](_0xf326('0x13'));return _0x520d85;};exports['decryptString']=function(_0x201d28,_0xa3c0b,_0x212d5d){var _0x581531=_0x212d5d||stringOptions[_0xf326('0x8')];var _0x55ad0f=_0xa3c0b||stringOptions['secret'];var _0x6a8e89=crypto[_0xf326('0x10')](_0x581531,_0x55ad0f);var _0x2fa28e=_0x6a8e89['update'](_0x201d28,_0xf326('0x13'),_0xf326('0x12'));_0x2fa28e+=_0x6a8e89['final'](_0xf326('0x12'));return _0x2fa28e;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index f50572c..db0b63b 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 _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 +var _0x0e85=['../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','split','mkdirSync','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','bluebird','../../mysqldb'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0x0e85,0x7c));var _0x50e8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0e85[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0x50e8('0x0'));var path=require(_0x50e8('0x1'));var _=require('lodash');var csv=require(_0x50e8('0x2'));var fs=require('fs');var BPromise=require(_0x50e8('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x50e8('0x4'))['dbH'];var logger=require(_0x50e8('0x5'))(_0x50e8('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x50e8('0x7')][0x2]);var QUERY=process[_0x50e8('0x7')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x3ce904,_0x108edc){var _0x42665e={'status':_0x3ce904};var _0x988da0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x108edc){_0x42665e[_0x50e8('0x8')]=_0x108edc;}return db[_0x50e8('0x9')]['update'](_0x42665e,_0x988da0);}function main(){var _0x11717c=0x1388;var _0x228ed1;logger[_0x50e8('0xa')](util[_0x50e8('0xb')](_0x50e8('0xc'),EXTRACTED_REPORT_ID,_0x50e8('0xd')));return db[_0x50e8('0xe')][_0x50e8('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x50e8('0x10')](function(_0x24d381){if(_0x24d381){_0x228ed1=_0x24d381;_0x11717c=_0x228ed1['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x50e8('0x11')][_0x50e8('0x12')](util[_0x50e8('0xb')](_0x50e8('0x13'),QUERY),{'type':dbH['sequelize'][_0x50e8('0x14')][_0x50e8('0x15')]});})[_0x50e8('0x10')](function(_0x5c3baa){if(!_0x5c3baa[0x0]['num']){return analyticExtractedReport(_0x50e8('0x16'));}var _0xf02b48=[];var _0x40c184=0x0;var _0x291fb7=!![];if(_0x5c3baa&&_0x5c3baa[_0x50e8('0x17')]){var _0x1f0338=_0x5c3baa[0x0]['num']%(_0x40c184+_0x11717c);if(_0x228ed1['split']){for(;_0x291fb7;_0x40c184+=_0x11717c,_0x1f0338=_0x5c3baa[0x0][_0x50e8('0x18')]%(_0x40c184+_0x11717c)){if(_0x1f0338==0x0||_0x1f0338==_0x5c3baa[0x0][_0x50e8('0x18')]){_0x291fb7=![];}_0xf02b48[_0x50e8('0x19')](dbH[_0x50e8('0x11')][_0x50e8('0x12')](util[_0x50e8('0xb')](_0x50e8('0x1a'),QUERY,_0x11717c,_0x40c184),{'type':dbH['sequelize'][_0x50e8('0x14')]['SELECT']}));}}else{_0xf02b48[_0x50e8('0x19')](dbH[_0x50e8('0x11')][_0x50e8('0x12')](QUERY,{'type':dbH[_0x50e8('0x11')][_0x50e8('0x14')]['SELECT']}));}}var _0x2c7c25=path[_0x50e8('0x1b')](PATH);var _0x58110d=path[_0x50e8('0x1c')](PATH,_0x50e8('0x1d'));var _0x5691b2=_0x228ed1[_0x50e8('0x1e')]&&_0xf02b48[_0x50e8('0x17')]>0x1;var _0x4f56b7=[];if(!fs['existsSync'](path['join'](_0x2c7c25,_0x58110d))&&_0x5691b2){fs[_0x50e8('0x1f')](path[_0x50e8('0x20')](_0x2c7c25,_0x58110d));}return BPromise[_0x50e8('0x21')](_0xf02b48,function(_0x371a1f){_0x4f56b7[_0x50e8('0x19')](_0x371a1f);})[_0x50e8('0x10')](function(){for(var _0x53d848=0x0;_0x53d848<_0x4f56b7[_0x50e8('0x17')];_0x53d848+=0x1){var _0x396611;var _0x4b3a09=_0x4f56b7[_0x53d848];if(_0x5691b2){_0x396611=path[_0x50e8('0x20')](_0x2c7c25,_0x58110d,util[_0x50e8('0xb')](_0x50e8('0x22'),_0x58110d,_0x53d848,_0x50e8('0x23')));}else{_0x396611=path['join'](_0x2c7c25,util[_0x50e8('0xb')]('%s.%s',_0x58110d,_0x50e8('0x23')));}fs[_0x50e8('0x24')](_0x396611,csv(_0x4b3a09));}})[_0x50e8('0x10')](function(){if(_0x5691b2){zipdir(path['join'](_0x2c7c25,_0x58110d),{'saveTo':path[_0x50e8('0x20')](_0x2c7c25,util[_0x50e8('0xb')](_0x50e8('0x25'),_0x58110d,_0x50e8('0x26')))},function(_0x1d77d0,_0x18aa31){});rimraf(path[_0x50e8('0x20')](_0x2c7c25,_0x58110d),function(){});}})['then'](function(){logger[_0x50e8('0xa')](util[_0x50e8('0xb')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x50e8('0x27'),_0x5691b2?util[_0x50e8('0xb')](_0x50e8('0x25'),_0x58110d,_0x5691b2?'zip':'csv'):null);});})[_0x50e8('0x28')](function(_0x19e3cc){logger['info'](util[_0x50e8('0xb')](_0x50e8('0x29'),EXTRACTED_REPORT_ID,_0x50e8('0xd')),util[_0x50e8('0x2a')](_0x19e3cc,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 2ab9c7b..fa5383a 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_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 +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(_0x617658,_0xacbbc9){var _0x4ce445=function(_0x593a65){while(--_0x593a65){_0x617658['push'](_0x617658['shift']());}};_0x4ce445(++_0xacbbc9);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 8043278..8229b1c 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 _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 +var _0x1d71=['AnalyticExtractedReport','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','mkdirSync','%s%d.%s','xlsx','%s.%s','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','savename'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0x1d71,0x154));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x11d7('0x0'));var path=require(_0x11d7('0x1'));var _=require(_0x11d7('0x2'));var fs=require('fs');var json2xls=require(_0x11d7('0x3'));var BPromise=require(_0x11d7('0x4'));var zipdir=require(_0x11d7('0x5'));var rimraf=require(_0x11d7('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x11d7('0x7'))['dbH'];var logger=require(_0x11d7('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x11d7('0x9')][0x2]);var QUERY=process[_0x11d7('0x9')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x677a51,_0x286940){var _0x193223={'status':_0x677a51};var _0x5da289={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x286940){_0x193223[_0x11d7('0xa')]=_0x286940;}return db[_0x11d7('0xb')]['update'](_0x193223,_0x5da289);}function main(){var _0x134989=0x1388;var _0x26106e;logger['info'](util[_0x11d7('0xc')](_0x11d7('0xd'),EXTRACTED_REPORT_ID,_0x11d7('0xe')));return db['Setting'][_0x11d7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x11d7('0x10'),_0x11d7('0x11')]})[_0x11d7('0x12')](function(_0x2bde60){if(_0x2bde60){_0x26106e=_0x2bde60;_0x134989=_0x26106e[_0x11d7('0x11')]||0x1388;}})[_0x11d7('0x12')](function(){return dbH[_0x11d7('0x13')][_0x11d7('0x14')](util[_0x11d7('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x11d7('0x13')][_0x11d7('0x15')][_0x11d7('0x16')]});})[_0x11d7('0x12')](function(_0x3d30ca){if(!_0x3d30ca[0x0][_0x11d7('0x17')]){return analyticExtractedReport(_0x11d7('0x18'));}var _0x4e6a57=[];var _0x356d85=0x0;var _0x5cef9a=!![];if(_0x26106e['split']){if(_0x3d30ca&&_0x3d30ca[_0x11d7('0x19')]){var _0xfc12a=_0x3d30ca[0x0][_0x11d7('0x17')]%(_0x356d85+_0x134989);for(;_0x5cef9a;_0x356d85+=_0x134989,_0xfc12a=_0x3d30ca[0x0]['num']%(_0x356d85+_0x134989)){if(_0xfc12a==0x0||_0xfc12a==_0x3d30ca[0x0][_0x11d7('0x17')]){_0x5cef9a=![];}_0x4e6a57[_0x11d7('0x1a')](dbH[_0x11d7('0x13')][_0x11d7('0x14')](util['format'](_0x11d7('0x1b'),QUERY,_0x134989,_0x356d85),{'type':dbH['sequelize']['QueryTypes'][_0x11d7('0x16')]}));}}}else{_0x4e6a57[_0x11d7('0x1a')](dbH['sequelize'][_0x11d7('0x14')](QUERY,{'type':dbH[_0x11d7('0x13')]['QueryTypes'][_0x11d7('0x16')]}));}var _0x2e570f=path[_0x11d7('0x1c')](PATH);var _0x557549=path[_0x11d7('0x1d')](PATH,'.xlsx');var _0x3adde7=_0x26106e[_0x11d7('0x10')]&&_0x4e6a57[_0x11d7('0x19')]>0x1;var _0x17c6bb=[];if(!fs['existsSync'](path[_0x11d7('0x1e')](_0x2e570f,_0x557549))&&_0x3adde7){fs[_0x11d7('0x1f')](path['join'](_0x2e570f,_0x557549));}return BPromise['each'](_0x4e6a57,function(_0x6bb1f7){_0x17c6bb[_0x11d7('0x1a')](_0x6bb1f7);})[_0x11d7('0x12')](function(){for(var _0x2b1322=0x0;_0x2b1322<_0x17c6bb[_0x11d7('0x19')];_0x2b1322+=0x1){var _0x1374f2;var _0xa20403=_0x17c6bb[_0x2b1322];if(_0x3adde7){_0x1374f2=path[_0x11d7('0x1e')](_0x2e570f,_0x557549,util['format'](_0x11d7('0x20'),_0x557549,_0x2b1322,_0x11d7('0x21')));}else{_0x1374f2=path[_0x11d7('0x1e')](_0x2e570f,util[_0x11d7('0xc')](_0x11d7('0x22'),_0x557549,_0x11d7('0x21')));}fs['writeFileSync'](_0x1374f2,json2xls(_0xa20403),'binary');}})[_0x11d7('0x12')](function(){if(_0x3adde7){zipdir(path[_0x11d7('0x1e')](_0x2e570f,_0x557549),{'saveTo':path[_0x11d7('0x1e')](_0x2e570f,util[_0x11d7('0xc')](_0x11d7('0x22'),_0x557549,'zip'))},function(_0x2a3f5a,_0x135cef){});rimraf(path['join'](_0x2e570f,_0x557549),function(){});}})[_0x11d7('0x12')](function(){logger[_0x11d7('0x23')](util[_0x11d7('0xc')](_0x11d7('0x24'),EXTRACTED_REPORT_ID,_0x11d7('0xe')));return analyticExtractedReport('Completed',_0x3adde7?util[_0x11d7('0xc')](_0x11d7('0x22'),_0x557549,_0x3adde7?_0x11d7('0x25'):_0x11d7('0x21')):null);});})[_0x11d7('0x26')](function(_0x4cf588){logger[_0x11d7('0x23')](util[_0x11d7('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x11d7('0xe')),util['inspect'](_0x4cf588,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 91c6377..2e74045 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 _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 +var _0x1690=['bulkCreate','error','rewrite','models','Interval','findAll','then','VoiceExtension','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','hasOwnProperty','priority','extension','extensions','push','type','Set','format','CDR(type)=%s','outbound','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','VoiceExtensionId','context','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','CDR(tag)=','callerID','ExecIf','$[${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=1','splice','GotoIfTime',',${EXTEN},','concat','Hangup','destroy'];(function(_0x106db6,_0xd6decc){var _0x4dc175=function(_0x14c433){while(--_0x14c433){_0x106db6['push'](_0x106db6['shift']());}};_0x4dc175(++_0xd6decc);}(_0x1690,0xc3));var _0x0169=function(_0x420989,_0x2a8e9e){_0x420989=_0x420989-0x0;var _0x3f9377=_0x1690[_0x420989];return _0x3f9377;};'use strict';var _=require('lodash');var util=require('util');function rewrite(_0x512b12,_0x104e8a){var _0xc87221=this;return _0x512b12[_0x0169('0x0')][_0x0169('0x1')][_0x0169('0x2')]({'raw':!![]})[_0x0169('0x3')](function(_0x5b4da3){_0xc87221['intervals']=_0x5b4da3;return _0x512b12[_0x0169('0x0')][_0x0169('0x4')][_0x0169('0x2')]({'where':{'IntervalId':_0x104e8a[_0x0169('0x5')]},'raw':!![]});})[_0x0169('0x3')](function(_0x2e47ba){return _0x512b12[_0x0169('0x0')][_0x0169('0x4')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x0169('0x6')](_0x2e47ba,'exten'))}},'order':[{'raw':_0x0169('0x7')}],'raw':!![]});})[_0x0169('0x3')](function(_0x25783c){var _0x360b97=_['filter'](_0x25783c,{'priority':'1'});var _0x5a37e3=_[_0x0169('0x8')](_0x25783c,{'isApp':0x1});var _0x47e90d=_[_0x0169('0x9')](_0x5a37e3,_0x0169('0xa'));var _0x589598=[_0x0169('0xb'),'playback'];var _0x11a14b=[];var _0x23db65=[];for(var _0x39ea96 in _0x47e90d){if(_0x47e90d[_0x0169('0xc')](_0x39ea96)){_0xc87221[_0x0169('0xd')]=0x2;_0xc87221['extensions']=[];_0xc87221[_0x0169('0xe')]=_['find'](_0x360b97,{'exten':_0x47e90d[_0x39ea96][0x0]['exten']});_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':util[_0x0169('0x13')](_0x0169('0x14'),_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')]),'context':_0x47e90d[_0x39ea96][0x0]['context'],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0]['VoiceExtensionId']});if(_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')]===_0x0169('0x15')){if(_0xc87221[_0x0169('0xe')]){_0xc87221[_0x0169('0xf')]['push']({'type':_0x47e90d[_0x39ea96][0x0]['type'],'app':'Set','appdata':_0x0169('0x16')+(_0xc87221[_0x0169('0xe')][_0x0169('0x17')]?_0x0169('0x18')+_0xc87221[_0x0169('0xe')][_0x0169('0x17')]+'}':'${EXTEN}'),'context':_0x47e90d[_0x39ea96][0x0]['context'],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0]['VoiceExtensionId']});}_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':_0x0169('0x19')+_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')],'context':_0x47e90d[_0x39ea96][0x0]['context'],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});var _0xfce73c=_0xc87221[_0x0169('0xd')]++;_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0xfce73c+0x2)+'):Goto('+(_0xfce73c+0x1)+')','context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xfce73c,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});if(_0xc87221[_0x0169('0xe')]){_0xc87221['extensions'][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':_0xc87221[_0x0169('0xe')][_0x0169('0x17')]?'CDR(prefix)=${EXTEN:0:'+_0xc87221[_0x0169('0xe')][_0x0169('0x17')]+'}':_0x0169('0x1c'),'context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221['priority']++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});}_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':_0x0169('0x1d')+_0x47e90d[_0x39ea96][0x0]['VoiceExtensionId'],'context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});if(_0xc87221[_0x0169('0xe')]&&_0xc87221[_0x0169('0xe')][_0x0169('0xc')](_0x0169('0x1e'))&&_0xc87221[_0x0169('0xe')][_0x0169('0x1e')]!==_0x0169('0x1f')){_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':_0x0169('0x20'),'context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0]['exten'],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});_0xc87221[_0x0169('0xf')]['push']({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xc87221[_0x0169('0xe')][_0x0169('0x1e')]||_0x0169('0x21'),'context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});}}_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0][_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':_0x0169('0x22'),'context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221['priority']++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});_0xc87221['extensions'][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0]['type'],'app':_0x0169('0x12'),'appdata':_0x0169('0x23'),'context':_0x47e90d[_0x39ea96][0x0]['context'],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});_0xc87221['extensions'][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0]['type'],'app':_0x0169('0x12'),'appdata':_0x0169('0x24'),'context':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1b')],'exten':_0x47e90d[_0x39ea96][0x0][_0x0169('0xa')],'priority':_0xc87221[_0x0169('0xd')]++,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});for(var _0xc97eea=0x0,_0x3de188=0x0;_0xc97eea<_0x47e90d[_0x39ea96][_0x0169('0x25')];_0xc97eea+=0x1,_0x3de188=0x0){var _0x370173=_0x47e90d[_0x39ea96][_0xc97eea];if(_0x370173[_0x0169('0x11')]){_0x370173[_0x0169('0x11')]=_0x370173['type'][_0x0169('0x26')]();}var _0x577e6f=[];var _0x25f6eb=[];delete _0x370173['id'];delete _0x370173[_0x0169('0x27')];delete _0x370173[_0x0169('0x28')];var _0x103a72=_0x370173[_0x0169('0x29')]!=='*,*,*,*'?[_0x370173[_0x0169('0x29')]]:_0x370173[_0x0169('0x5')]?_[_0x0169('0x6')](_[_0x0169('0x8')](_0xc87221[_0x0169('0x2a')],{'IntervalId':_0x370173[_0x0169('0x5')]}),'interval'):[];if(_0x370173[_0x0169('0xc')]('tag')){if(_0x370173[_0x0169('0x2b')]&&_0x370173[_0x0169('0x2b')]!=='--'){_0x577e6f[_0x0169('0x10')]({'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':_0x0169('0x2c')+_0x370173[_0x0169('0x2b')],'context':_0x370173[_0x0169('0x1b')],'exten':_0x370173['exten'],'priority':_0x103a72[_0x0169('0x25')]+_0xc87221[_0x0169('0xd')]+_0x3de188++,'VoiceExtensionId':_0x370173[_0x0169('0x1a')]});}}if(_0x370173[_0x0169('0x11')]===_0x0169('0x15')&&_0x370173[_0x0169('0xc')]('callerID')){if(_0x370173[_0x0169('0x2d')]){_0x577e6f[_0x0169('0x10')]({'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x2e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x370173[_0x0169('0x2d')]+')','context':_0x370173[_0x0169('0x1b')],'exten':_0x370173[_0x0169('0xa')],'priority':_0x103a72[_0x0169('0x25')]+_0xc87221[_0x0169('0xd')]+_0x3de188++,'VoiceExtensionId':_0x370173[_0x0169('0x1a')]});}else{_0x577e6f[_0x0169('0x10')]({'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x2e'),'appdata':_0x0169('0x2f'),'context':_0x370173['context'],'exten':_0x370173['exten'],'priority':_0x103a72[_0x0169('0x25')]+_0xc87221[_0x0169('0xd')]+_0x3de188++,'VoiceExtensionId':_0x370173[_0x0169('0x1a')]});}}if(_0x370173[_0x0169('0xc')](_0x0169('0x30'))){if(_0x589598[_0x0169('0x31')](_0x370173[_0x0169('0x32')][_0x0169('0x26')]())>=0x0&&_0x370173[_0x0169('0x33')]!==_0x0169('0x34')){if(_0x370173['answer']){_0x577e6f[_0x0169('0x10')]({'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x2e'),'appdata':_0x0169('0x35'),'context':_0x370173[_0x0169('0x1b')],'exten':_0x370173[_0x0169('0xa')],'priority':_0x103a72[_0x0169('0x25')]+_0xc87221['priority']+_0x3de188++,'VoiceExtensionId':_0x370173[_0x0169('0x1a')]});_0x577e6f['push']({'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x370173[_0x0169('0x1b')],'exten':_0x370173['exten'],'priority':_0x103a72[_0x0169('0x25')]+_0xc87221['priority']+_0x3de188++,'VoiceExtensionId':_0x370173[_0x0169('0x1a')]});}else{_0x577e6f['push']({'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x2e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x370173[_0x0169('0x1b')],'exten':_0x370173[_0x0169('0xa')],'priority':_0x103a72['length']+_0xc87221['priority']+_0x3de188++,'VoiceExtensionId':_0x370173[_0x0169('0x1a')]});_0x577e6f['push']({'type':_0x370173['type'],'app':'Set','appdata':_0x0169('0x36'),'context':_0x370173[_0x0169('0x1b')],'exten':_0x370173[_0x0169('0xa')],'priority':_0x103a72[_0x0169('0x25')]+_0xc87221[_0x0169('0xd')]+_0x3de188++,'VoiceExtensionId':_0x370173['VoiceExtensionId']});}}}for(var _0x540595=0x0;_0x540595<_0x103a72['length'];_0x540595+=0x1){var _0x26f05d=_0xc87221['priority']+_0x103a72[_0x0169('0x25')];var _0x4b3802=_0x540595===_0x103a72[_0x0169('0x25')]-0x1?_0xc87221[_0x0169('0xd')]+_0x577e6f['length']+_0x25f6eb[_0x0169('0x25')]+0x2:_0xc87221[_0x0169('0xd')]+_0x540595+0x1;_0x577e6f[_0x0169('0x37')](_0x540595,0x0,{'type':_0x370173[_0x0169('0x11')],'app':_0x0169('0x38'),'appdata':_0x103a72[_0x540595]+'?'+_0x370173[_0x0169('0x1b')]+_0x0169('0x39')+_0x26f05d+':'+_0x370173[_0x0169('0x1b')]+',${EXTEN},'+_0x4b3802,'exten':_0x370173['exten'],'context':_0x370173['context'],'priority':_0xc87221[_0x0169('0xd')]+_0x540595,'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});}_0x370173[_0x0169('0xd')]=_0x577e6f[_0x0169('0x25')]?_['last'](_0x577e6f)[_0x0169('0xd')]+0x1:_0xc87221[_0x0169('0xd')];_0xc87221[_0x0169('0xd')]=(_0x25f6eb[_0x0169('0x25')]?_['last'](_0x25f6eb)[_0x0169('0xd')]:_0x370173['priority'])+0x1;_0xc87221[_0x0169('0xf')]=_[_0x0169('0x3a')](_0xc87221[_0x0169('0xf')],_0x577e6f,[_0x370173],_0x25f6eb);}_0xc87221[_0x0169('0xf')][_0x0169('0x10')]({'type':_0x47e90d[_0x39ea96][0x0]['type'],'app':_0x0169('0x3b'),'exten':_0x47e90d[_0x39ea96][0x0]['exten'],'context':_0x47e90d[_0x39ea96][0x0]['context'],'priority':_0xc87221[_0x0169('0xd')],'VoiceExtensionId':_0x47e90d[_0x39ea96][0x0][_0x0169('0x1a')]});_0x11a14b[_0x0169('0x10')](_0x47e90d[_0x39ea96][0x0]['VoiceExtensionId']);_0x23db65=_[_0x0169('0x3a')](_0x23db65,_0xc87221[_0x0169('0xf')]);}}return _0x512b12['transaction'](function(_0x415579){return _0x512b12['models'][_0x0169('0x4')][_0x0169('0x3c')]({'where':{'VoiceExtensionId':{'$in':_0x11a14b}},'transaction':_0x415579})[_0x0169('0x3')](function(_0x3a5c63){return _0x512b12[_0x0169('0x0')][_0x0169('0x4')][_0x0169('0x3d')](_['sortBy'](_0x23db65,_0x0169('0xd')),{'transaction':_0x415579});});});})['catch'](function(_0x270a9a){console[_0x0169('0x3e')](_0x270a9a);});}exports[_0x0169('0x3f')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 9455bdf..d454444 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_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 +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x4c22fa,_0x13d77a){var _0x830b2c=function(_0x24eca9){while(--_0x24eca9){_0x4c22fa['push'](_0x4c22fa['shift']());}};_0x830b2c(++_0x13d77a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x325501,_0x5242f6){_0x325501=_0x325501-0x0;var _0x2c1626=_0xcb91[_0x325501];return _0x2c1626;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index dd88af8..4d403a7 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 _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 +var _0xaf42=['SystemRow','appendFileSync','emit','SystemError','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','test','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ListId','createdAt','updatedAt','priority','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.createdAt','fromQuery','ContactId','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','error','message','exit','errors','sequelize','spread','push','catch','main','stringify','send','binding','root','server/files/tmp','keys','header','writeFileSync','parse','data','length','rows','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','UserId','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified'];(function(_0x437d9c,_0x1607ba){var _0x5998ff=function(_0x9496fb){while(--_0x9496fb){_0x437d9c['push'](_0x437d9c['shift']());}};_0x5998ff(++_0x1607ba);}(_0xaf42,0xa4));var _0x2af4=function(_0x43c2bd,_0x2d8c0a){_0x43c2bd=_0x43c2bd-0x0;var _0x2c9417=_0xaf42[_0x43c2bd];return _0x2c9417;};'use strict';var fs=require('fs');var path=require(_0x2af4('0x0'));var _=require(_0x2af4('0x1'));var Papa=require(_0x2af4('0x2'));var util=require('util');var BPromise=require(_0x2af4('0x3'));var moment=require(_0x2af4('0x4'));var squel=require(_0x2af4('0x5'));var Redis=require(_0x2af4('0x6'));var db=require(_0x2af4('0x7'))['db'];var config=require(_0x2af4('0x8'));var logger=require(_0x2af4('0x9'))(_0x2af4('0xa'));config[_0x2af4('0xb')]=_[_0x2af4('0xc')](config[_0x2af4('0xb')],{'host':_0x2af4('0xd'),'port':0x18eb});var socket=require(_0x2af4('0xe'))(new Redis(config[_0x2af4('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x2af4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4f6706){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))*$/[_0x2af4('0x10')](_0x4f6706);}function selectNotIn(_0x425ce5,_0x4a5627,_0x2eb481,_0x189ba1,_0x1e0feb){return squel['select']()[_0x2af4('0x11')](_0x2af4('0x12'))[_0x2af4('0x13')](_0x189ba1)[_0x2af4('0x14')](_0x4a5627,null,_0x4a5627+_0x2af4('0x15')+_0x189ba1+'.'+_0x2eb481)[_0x2af4('0x16')](_0x189ba1+'.'+_0x2eb481+_0x2af4('0x17')+_0x425ce5+'.'+_0x2eb481)[_0x2af4('0x16')](_0x4a5627+_0x2af4('0x18')+_0x1e0feb[_0x2af4('0x14')]()+')');}function insertCmHopper(_0x2b1679,_0x9b12de,_0x21eb11,_0x233d25,_0x3b276b){var _0x2294ed=[_0x2af4('0x19'),_0x2af4('0x1a'),_0x2af4('0x1b'),_0x2af4('0x1c'),_0x9b12de+'.'+_0x233d25,'cm_contacts.createdAt',_0x2af4('0x1d'),'cm_contacts.priority',_0x2af4('0x1e'),'\x22'+_0x3b276b+'\x22'];return squel[_0x2af4('0x1f')]()[_0x2af4('0x20')](_0x2af4('0x21'))['fromQuery']([_0x2af4('0x12'),_0x2af4('0x22'),'ContactId',_0x2af4('0x23'),_0x233d25,_0x2af4('0x24'),_0x2af4('0x25'),_0x2af4('0x26'),'UserId',_0x2af4('0x27')],squel[_0x2af4('0x28')]()[_0x2af4('0x29')](_0x2294ed)[_0x2af4('0x13')](_0x9b12de)[_0x2af4('0x14')](_0x2af4('0x2a'),null,_0x2af4('0x2b')+_0x9b12de+_0x2af4('0x2c'))[_0x2af4('0x14')](_0x21eb11,null,_0x21eb11+'.id\x20=\x20'+_0x9b12de+'.'+_0x233d25)['where'](_0x9b12de+_0x2af4('0x2d'),_0x2b1679)['where'](_0x2af4('0x2e'),NOW)[_0x2af4('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x9b12de,_0x21eb11,_0x233d25,_0x2af4('0x21'),[_0x2af4('0x2f'),_0x2af4('0x30')]))['where'](_0x2af4('0x31'),selectNotIn(_0x9b12de,_0x21eb11,_0x233d25,_0x2af4('0x21'),['\x22always\x22'])))[_0x2af4('0x32')]();}function insertCmHopperBlack(_0x219554,_0x1a3e34,_0x8a8a8a,_0xa6d1c2){var _0x45dd94=[_0x2af4('0x19'),_0x2af4('0x1b'),_0x2af4('0x1c'),_0x1a3e34+'.'+_0xa6d1c2,_0x2af4('0x33'),_0x2af4('0x1d')];return squel['insert']()[_0x2af4('0x20')]('cm_hopper_black')[_0x2af4('0x34')]([_0x2af4('0x12'),_0x2af4('0x35'),_0x2af4('0x23'),_0xa6d1c2,_0x2af4('0x24'),_0x2af4('0x25')],squel['select']()[_0x2af4('0x29')](_0x45dd94)[_0x2af4('0x13')](_0x1a3e34)[_0x2af4('0x14')](_0x2af4('0x2a'),null,'cm_contacts.ListId\x20=\x20'+_0x1a3e34+_0x2af4('0x2c'))[_0x2af4('0x14')](_0x8a8a8a,null,_0x8a8a8a+_0x2af4('0x15')+_0x1a3e34+'.'+_0xa6d1c2)['where'](_0x1a3e34+_0x2af4('0x2d'),_0x219554)['where'](_0x2af4('0x2e'),NOW)[_0x2af4('0x16')](_0x2af4('0x31'),squel['select']()['field']('phone')[_0x2af4('0x13')](_0x2af4('0x36'))[_0x2af4('0x16')](_0x2af4('0x37'),_0x219554)[_0x2af4('0x16')](_0xa6d1c2+_0x2af4('0x38'),_0x1a3e34+'.'+_0xa6d1c2)))['toString']();}function insertCmContact(_0x2654d2,_0x5715d2,_0x101807,_0x5e0697){var _0x1ef203=_[_0x2af4('0x39')](_['keys'](_0x5e0697),[_0x2af4('0x23'),_0x2af4('0x3a'),_0x2af4('0x24'),_0x2af4('0x25')]);return squel[_0x2af4('0x1f')]()['into'](_0x2af4('0x2a'))[_0x2af4('0x34')](_0x1ef203,squel[_0x2af4('0x28')]()[_0x2af4('0x29')](_0x1ef203)[_0x2af4('0x13')](_0x5715d2)['where']('('+_0x101807[_0x2af4('0x14')](',')+_0x2af4('0x3b'),squel[_0x2af4('0x28')]()['fields'](_0x101807)[_0x2af4('0x13')](_0x2af4('0x2a'))[_0x2af4('0x16')](_0x2af4('0x37'),_0x2654d2)[_0x2af4('0x16')](_0x2af4('0x3c')))[_0x2af4('0x16')](_0x2af4('0x3d'),squel[_0x2af4('0x28')]()['field']('MIN(id)',_0x2af4('0x3e'))[_0x2af4('0x13')](_0x5715d2)['group'](_0x101807[_0x2af4('0x14')](','))))[_0x2af4('0x32')]();}function handleStop(){logger[_0x2af4('0x3f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x584d52){logger[_0x2af4('0x40')](_0x584d52[_0x2af4('0x41')]);process[_0x2af4('0x42')](0x1);}function handleError(_0x130af5,_0x502fe4){stats[_0x2af4('0x43')]['push']({'name':_0x502fe4['code'],'message':_0x502fe4['message'],'row':_0x130af5});}function handleQuery(_0x2aa31b){logger['info'](_0x2aa31b);return db[_0x2af4('0x44')]['query'](_0x2aa31b)[_0x2af4('0x45')](function(_0x29e3fe){results[_0x2af4('0x46')](_0x29e3fe);})[_0x2af4('0x47')](function(_0x121bca){logger[_0x2af4('0x40')](_0x121bca['message']);});}function main(_0x37f50e,_0xa2f2e1,_0x1e1bf9,_0x5aa81a){logger['info'](_0x2af4('0x48'),_0x37f50e,JSON[_0x2af4('0x49')](_0xa2f2e1));process[_0x2af4('0x4a')]('start');var _0x1be38e=_0xa2f2e1[_0x2af4('0x4b')];var _0x48b565=_0xa2f2e1['socket_timestamp'];var _0x4e5792=path[_0x2af4('0x14')](config[_0x2af4('0x4c')],_0x2af4('0x4d'),_0x48b565+'.csv');var _0x4b0eb5=_[_0x2af4('0x4e')](_0x1be38e)[_0x2af4('0x14')]();logger['info'](_0x2af4('0x4f'),_0x4b0eb5);fs[_0x2af4('0x50')](_0x4e5792,_0x4b0eb5+'\x0a');Papa[_0x2af4('0x51')](fs['createReadStream'](_0x37f50e),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5ecebe,_0x2ee7c4){try{for(var _0x45b8db=0x0,_0xa29cc8=[];_0x45b8db<_0x5ecebe[_0x2af4('0x52')][_0x2af4('0x53')];_0x45b8db++){stats[_0x2af4('0x54')]+=0x1;if(_0x5ecebe[_0x2af4('0x43')][_0x45b8db]){handleError(_0x5ecebe[_0x2af4('0x52')][_0x45b8db],_0x5ecebe[_0x2af4('0x43')][_0x45b8db]);}else{var _0x159ecf=[];for(var _0x21f612 in _0x1be38e){if(_0x1be38e['hasOwnProperty'](_0x21f612)){if(_0x5ecebe[_0x2af4('0x52')][_0x45b8db][_0x1be38e[_0x21f612]]){var _0x2709f3=_[_0x2af4('0x55')](_0x5ecebe['data'][_0x45b8db][_0x1be38e[_0x21f612]]['replace'](/"/g,'\x27'));switch(_0x21f612){case _0x2af4('0x22'):var _0x4bb0b0=moment(_0x2709f3,_0x2af4('0x56'),!![]);if(_0x4bb0b0[_0x2af4('0x57')]()){_0xa29cc8[_0x2af4('0x46')]('\x22'+_0x2709f3+'\x22');}else{_0x159ecf[_0x2af4('0x46')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x2af4('0x26'):var _0x4c9a74=parseInt(_0x2709f3);_0x2709f3=_[_0x2af4('0x58')](_0x4c9a74)||_0x4c9a74<0x0||_0x4c9a74>0x4?_0x5aa81a?0x3:0x2:_0x4c9a74;_0xa29cc8['push']('\x22'+_0x2709f3+'\x22');break;case _0x2af4('0x59'):var _0x4eef36=parseInt(_0x2709f3);if(_['isNumber'](_0x4eef36)&&_[_0x2af4('0x5a')](_0x1e1bf9,_0x4eef36)){_0xa29cc8[_0x2af4('0x46')]('\x22'+_0x4eef36+'\x22');}else{_0x159ecf[_0x2af4('0x46')](_0x2af4('0x5b'));}break;case _0x2af4('0x5c'):if(isEmail(_0x2709f3)){_0xa29cc8[_0x2af4('0x46')]('\x22'+_0x2709f3+'\x22');}else{_0x159ecf[_0x2af4('0x46')](_0x2af4('0x5d'));}break;case'dateOfBirth':var _0x365d22=moment(_0x2709f3,'YYYY-MM-DD',!![]);if(_0x365d22[_0x2af4('0x57')]()){_0xa29cc8['push']('\x22'+_0x2709f3+'\x22');}else{_0x159ecf[_0x2af4('0x46')](_0x2af4('0x5e'));}break;default:_0xa29cc8['push']('\x22'+_0x2709f3+'\x22');}}else{switch(_0x21f612){case'firstName':case _0x2af4('0x12'):_0x159ecf[_0x2af4('0x46')](_0x21f612+_0x2af4('0x5f'));break;default:_0xa29cc8[_0x2af4('0x46')]('\x22\x22');}}}}if(_0x159ecf['length']){handleError(_0x5ecebe[_0x2af4('0x52')][_0x45b8db],{'code':_0x2af4('0x60'),'message':_0x159ecf[_0x2af4('0x14')]()});}else{fs[_0x2af4('0x61')](_0x4e5792,_0xa29cc8[_0x2af4('0x14')]()+'\x0a');}_0xa29cc8=[];}if(!(stats[_0x2af4('0x54')]%0xc8)){socket[_0x2af4('0x62')]('contact:import:'+_0x48b565,stats);stats[_0x2af4('0x43')]=[];}}if(stopped){logger[_0x2af4('0x3f')]('Abort\x20parser');_0x2ee7c4['abort']();}}catch(_0x3b6b41){handleError(_0x5ecebe[_0x2af4('0x52')][_0x45b8db],{'code':_0x2af4('0x63'),'message':_0x3b6b41['message']});logger[_0x2af4('0x40')]('step',_0x3b6b41[_0x2af4('0x41')]);}},'complete':function(){try{var _0x50f064=[];var _0x2f48b9=_0x2af4('0x2a');if(_0xa2f2e1['duplicates']&&_0xa2f2e1[_0x2af4('0x64')][_0x2af4('0x53')]){_0x2f48b9=_0x2af4('0x65')+_0x48b565;_0x50f064[_0x2af4('0x46')](_0x2af4('0x66')+_0x2f48b9+_0x2af4('0x67'));}var _0x4b37b7=util[_0x2af4('0xf')]('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',_0x4e5792,_0x2f48b9,_0x4b0eb5,_0xa2f2e1[_0x2af4('0x23')],_0xa2f2e1[_0x2af4('0x3a')]||null,NOW,NOW);if(_['isNil'](_0x1be38e['scheduledat'])){_0x4b37b7+=_0x2af4('0x68');}_0x50f064[_0x2af4('0x46')](_0x4b37b7);if(_0xa2f2e1['duplicates']&&_0xa2f2e1['duplicates'][_0x2af4('0x53')]){_0x50f064['push'](insertCmContact(_0xa2f2e1[_0x2af4('0x23')],_0x2f48b9,_0xa2f2e1['duplicates'],_0x1be38e));_0x50f064[_0x2af4('0x46')]('DROP\x20TABLE\x20'+_0x2f48b9+';');}_0x50f064[_0x2af4('0x46')](insertCmHopper(_0xa2f2e1['ListId'],_0x2af4('0x69'),_0x2af4('0x6a'),_0x2af4('0x6b'),_0x5aa81a));_0x50f064[_0x2af4('0x46')](insertCmHopperBlack(_0xa2f2e1['ListId'],_0x2af4('0x6c'),_0x2af4('0x6a'),'VoiceQueueId'));_0x50f064[_0x2af4('0x46')](insertCmHopper(_0xa2f2e1[_0x2af4('0x23')],_0x2af4('0x6d'),_0x2af4('0x6e'),'CampaignId',_0x5aa81a));_0x50f064['push'](insertCmHopperBlack(_0xa2f2e1[_0x2af4('0x23')],_0x2af4('0x6f'),'campaigns',_0x2af4('0x70')));BPromise[_0x2af4('0x71')](_0x50f064,handleQuery)[_0x2af4('0x72')](function(_0x59c7cb){stats[_0x2af4('0x73')]=!![];stats[_0x2af4('0x74')]=_0xa2f2e1[_0x2af4('0x64')]&&_0xa2f2e1[_0x2af4('0x64')][_0x2af4('0x53')]?results[0x2][_0x2af4('0x74')]:results[0x0][_0x2af4('0x74')];socket['emit']('contact:import:'+_0x48b565,stats);fs[_0x2af4('0x75')](_0x37f50e);fs[_0x2af4('0x75')](_0x4e5792);process[_0x2af4('0x42')](0x0);})[_0x2af4('0x47')](function(_0x481104){logger[_0x2af4('0x40')](_0x481104[_0x2af4('0x41')]);process[_0x2af4('0x42')](0x1);});}catch(_0x2a0bbd){logger[_0x2af4('0x40')](_0x2af4('0x76'),_0x2a0bbd[_0x2af4('0x41')]);process['exit'](0x1);}},'error':function(_0x111a22,_0x563601,_0x5d7dcc,_0x2f7810){throw new Error(_0x2f7810);}});}function validate(){if(process['argv']&&process[_0x2af4('0x77')][_0x2af4('0x53')]<0x4){throw new Error(_0x2af4('0x78'));}var _0x5eb33f=path['join'](config[_0x2af4('0x4c')],_0x2af4('0x4d'),process[_0x2af4('0x77')][0x2]);if(!fs[_0x2af4('0x79')](_0x5eb33f)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x50e2bd={};try{_0x50e2bd=JSON[_0x2af4('0x51')](process[_0x2af4('0x77')][0x3]);if(!_0x50e2bd[_0x2af4('0x4b')]){throw new Error(_0x2af4('0x7a'));}if(!_0x50e2bd['binding'][_0x2af4('0x12')]){throw new Error(_0x2af4('0x7b'));}if(!_0x50e2bd[_0x2af4('0x4b')][_0x2af4('0x7c')]){throw new Error(_0x2af4('0x7d'));}var _0x2a82d2=0x0;if(_0x50e2bd[_0x2af4('0x4b')][_0x2af4('0x59')]){_0x2a82d2=0x1;}if(!_0x50e2bd[_0x2af4('0x23')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x33d1f2){throw new Error(_0x2af4('0x7e'));}var _0x23131e=[];try{_0x23131e=_[_0x2af4('0x7f')](JSON[_0x2af4('0x51')](process['argv'][0x4]),'id');}catch(_0x35a33f){logger[_0x2af4('0x3f')]('No\x20agent\x20available');}main(_0x5eb33f,_0x50e2bd,_0x23131e,_0x2a82d2);}validate();process['on'](_0x2af4('0x80'),handleStop);process['on'](_0x2af4('0x81'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 7b563c6..6a27d38 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 _0x8aac=['cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','fromQuery','ContactId','ListId','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','toString','cm_contacts.phone','insert','cm_hopper_black','updatedAt','cm_contacts','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','into','cm_hopper_additional_phones','CmHopperId','createdAt','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','message','errors','query','send','binding','clone','socket_timestamp','root','server/files/tmp','body','findAll','name','header','writeFileSync','createReadStream','rows','data','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','scheduledat',',\x20scheduledAt\x20=\x20NOW()','each','contactTypeId','orderBy','affectedRows','unlink','exit','complete','argv','arguments\x20\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_0x52ae43[_0xb160('0x6a')]===_0x540cc4);if(_['isNil'](_0x1299e8)){if(_0x4a9c90[_0xb160('0x72')](_0x540cc4)){if(_0x43dbb5[_0xb160('0x70')][_0x49ce91][_0x4a9c90[_0x540cc4]]){var _0x39f07d=_[_0xb160('0x73')](_0x43dbb5[_0xb160('0x70')][_0x49ce91][_0x4a9c90[_0x540cc4]]['replace'](/"/g,'\x27'));switch(_0x540cc4){case _0xb160('0x34'):var _0x3062b3=moment(_0x39f07d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3062b3[_0xb160('0x74')]()){_0x42a736[_0xb160('0x1e')]('\x22'+_0x39f07d+'\x22');}else{_0x4d31cb[_0xb160('0x1e')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb160('0x39'):var _0x23fb2e=parseInt(_0x39f07d);_0x39f07d=_[_0xb160('0x75')](_0x23fb2e)||_0x23fb2e<0x0||_0x23fb2e>0x4?_0x510f59?0x3:0x2:_0x23fb2e;_0x42a736[_0xb160('0x1e')]('\x22'+_0x39f07d+'\x22');break;case _0xb160('0x3a'):var _0x585231=parseInt(_0x39f07d);if(_['isNumber'](_0x585231)&&_[_0xb160('0x76')](_0x230887,_0x585231)){_0x42a736[_0xb160('0x1e')]('\x22'+_0x585231+'\x22');}else{_0x4d31cb[_0xb160('0x1e')]('agent\x20not\x20exists');}break;case _0xb160('0x77'):if(isEmail(_0x39f07d)){_0x42a736[_0xb160('0x1e')]('\x22'+_0x39f07d+'\x22');}else{_0x4d31cb[_0xb160('0x1e')](_0xb160('0x78'));}break;case _0xb160('0x79'):var _0x3fbda1=moment(_0x39f07d,_0xb160('0x7a'),!![]);if(_0x3fbda1['isValid']()){_0x42a736['push']('\x22'+_0x39f07d+'\x22');}else{_0x4d31cb[_0xb160('0x1e')](_0xb160('0x7b'));}break;default:_0x42a736[_0xb160('0x1e')]('\x22'+_0x39f07d+'\x22');}}else{switch(_0x540cc4){case _0xb160('0x7c'):case _0xb160('0x14'):_0x4d31cb[_0xb160('0x1e')](_0x540cc4+_0xb160('0x7d'));break;default:_0x42a736[_0xb160('0x1e')]('\x22\x22');}}}}else{var _0x53bb7b='';for(var _0x12b60a=0x0;_0x12b60a<_0x4a9c90[_0x540cc4][_0xb160('0x1b')];_0x12b60a++){var _0x39f07d=_[_0xb160('0x73')](_0x43dbb5[_0xb160('0x70')][_0x49ce91][_0x4a9c90[_0x540cc4][_0x12b60a]][_0xb160('0x7e')](/"/g,'\x27'));if(_0x53bb7b=='')_0x53bb7b=_0x39f07d;else _0x53bb7b+='|'+_0x39f07d;}_0x49e0d8[_0xb160('0x1e')](_0x1299e8['id']+':'+_0x53bb7b);}}if(hasAdditionalPhones){_0x42a736[_0xb160('0x1e')]('\x22'+_0x49e0d8['join'](';')+'\x22');}if(_0x4d31cb['length']){handleError(_0x43dbb5['data'][_0x49ce91],{'code':_0xb160('0x7f'),'message':_0x4d31cb[_0xb160('0x47')]()});}else{fs['appendFileSync'](_0x3bec1a,_0x42a736[_0xb160('0x47')]()+'\x0a');}_0x42a736=[];}if(!(stats[_0xb160('0x6f')]%0xc8)){socket[_0xb160('0x80')]('contact:import:'+_0x4df392,stats);stats[_0xb160('0x5d')]=[];}}if(stopped){logger[_0xb160('0x5c')](_0xb160('0x81'));_0x31b946[_0xb160('0x82')]();}}catch(_0x2905a0){handleError(_0x43dbb5[_0xb160('0x70')][_0x49ce91],{'code':_0xb160('0x83'),'message':_0x2905a0[_0xb160('0x22')]});logger[_0xb160('0x84')](_0xb160('0x85'),_0x2905a0[_0xb160('0x22')]);}},'complete':function(){try{var _0xc2a07=[];var _0x40c384=tempTableName;_0xc2a07[_0xb160('0x1e')](_0xb160('0x86')+_0x40c384+'\x20LIKE\x20cm_contacts;');logger[_0xb160('0x5c')](_0xb160('0x87'),contactItemTypes[_0xb160('0x1b')]);var _0x471100=util[_0xb160('0xe')]('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',_0x3bec1a,_0x40c384,_0xb337b1,_0x376848['ListId'],_0x376848[_0xb160('0x57')]||null,NOW,NOW);if(_[_0xb160('0x1c')](_0x4a9c90[_0xb160('0x34')])){_0x471100+=_0xb160('0x88');}_0xc2a07[_0xb160('0x1e')](_0x471100);BPromise[_0xb160('0x89')](_0xc2a07,handleQuery)[_0xb160('0x20')](function(_0x159fed){BPromise[_0xb160('0x1f')]([handleAdditionalPhones()])[_0xb160('0x20')](function(){_0xc2a07=[];for(var _0x3a9ea4=0x0;_0x3a9ea4\x20\x20');}var _0x37d58a=path['join'](config[_0xb160('0x64')],_0xb160('0x65'),process[_0xb160('0x95')][0x2]);if(!fs[_0xb160('0x96')](_0x37d58a)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x124932={};try{_0x124932=JSON[_0xb160('0x6d')](process[_0xb160('0x95')][0x3]);if(!_0x124932[_0xb160('0x97')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x190574=0x0;if(_0x124932['binding'][_0xb160('0x3a')]){_0x190574=0x1;}if(!_0x124932[_0xb160('0x36')]){throw new Error(_0xb160('0x98'));}}catch(_0x5edb18){throw new Error(_0xb160('0x99'));}var _0x474c2=[];try{_0x474c2=_['map'](JSON[_0xb160('0x6d')](process[_0xb160('0x95')][0x4]),'id');}catch(_0x4094d7){logger[_0xb160('0x5c')](_0xb160('0x9a'));}main(_0x37d58a,_0x124932,_0x474c2,_0x190574);}validate();process['on'](_0xb160('0x9b'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 814e3cd..7194895 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3266=['Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','Date','starttime','Answer\x20Time','answertime','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','queue','variable','outbound','Outbound\x20Call','destcalleridnum','inbound','***\x20Call\x20Info\x20***','keyValue','calleridnum','Call\x20To','destexten','Queue','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***'];(function(_0x44df4f,_0x4d0bb6){var _0x1f1e1c=function(_0xa5e7a0){while(--_0xa5e7a0){_0x44df4f['push'](_0x44df4f['shift']());}};_0x1f1e1c(++_0x4d0bb6);}(_0x3266,0x6a));var _0x6326=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x3266[_0x474bc0];return _0x4b24cf;};'use strict';exports[_0x6326('0x0')]=function(_0x2b328d,_0x3a3ebd){var _0x2bed83=[{'type':_0x6326('0x1'),'content':_0x6326('0x2'),'variableName':null}];switch(_0x2b328d[_0x6326('0x3')]()){case _0x6326('0x4'):switch(_0x3a3ebd[_0x6326('0x3')]()){case'inbound':_0x2bed83[_0x6326('0x5')]({'type':'variable','content':'','variableName':_0x6326('0x6')});_0x2bed83[_0x6326('0x5')]({'type':_0x6326('0x7'),'content':'','variableName':'calleridnum'});break;case _0x6326('0x8'):_0x2bed83['push']({'type':_0x6326('0x1'),'content':_0x6326('0x9'),'variableName':null});_0x2bed83[_0x6326('0x5')]({'type':_0x6326('0x7'),'content':'','variableName':_0x6326('0xa')});break;}}return _0x2bed83;};exports['getDescriptions']=function(_0x1b45a7,_0x464a36){var _0x3590ab=[];switch(_0x1b45a7[_0x6326('0x3')]()){case _0x6326('0x4'):switch(_0x464a36[_0x6326('0x3')]()){case _0x6326('0xb'):_0x3590ab=[{'type':_0x6326('0x1'),'content':_0x6326('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x6326('0xd'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x6326('0xe')},{'type':_0x6326('0xd'),'content':'','key':'Caller\x20Name','keyType':_0x6326('0x7'),'variableName':'calleridname'},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0xf'),'keyType':_0x6326('0x7'),'variableName':_0x6326('0x10')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x11'),'keyType':'variable','variableName':_0x6326('0x6')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x6326('0x7'),'variableName':_0x6326('0x12')},{'type':_0x6326('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6326('0x13'),'keyType':_0x6326('0x7'),'variableName':_0x6326('0x14')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x15'),'keyType':_0x6326('0x7'),'variableName':_0x6326('0xa')},{'type':'string','content':_0x6326('0x16'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x6326('0x17'),'keyType':_0x6326('0x7'),'variableName':_0x6326('0x12')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x18'),'keyType':_0x6326('0x7'),'variableName':_0x6326('0x19')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x1a'),'keyType':_0x6326('0x7'),'variableName':_0x6326('0x1b')},{'type':'keyValue','content':'','key':_0x6326('0x1c'),'keyType':_0x6326('0x7'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':_0x6326('0x7'),'variableName':'talktime'}];break;case _0x6326('0x8'):_0x3590ab=[{'type':_0x6326('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x1d'),'keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0xa')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x1e'),'keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0x1f')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x20'),'keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0x21')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x22'),'keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0x23')},{'type':'string','content':_0x6326('0x16')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x24'),'keyType':'variable','keyContent':'','variableName':_0x6326('0x25')},{'type':'keyValue','content':'','key':'Complete\x20Time','keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0x26')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x27'),'keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0x28')},{'type':_0x6326('0xd'),'content':'','key':_0x6326('0x29'),'keyType':_0x6326('0x7'),'keyContent':'','variableName':_0x6326('0x2a')}];break;}}return _0x3590ab;}; \ No newline at end of file +var _0xb8a0=['Caller\x20Name','calleridname','destexten','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','Date','starttime','answertime','Complete\x20Time','Duration','duration','billableseconds','[xCALLY\x20Ticket]','push','variable','queue','calleridnum','outbound','string','Outbound\x20Call','destcalleridnum','getDescriptions','toLowerCase','voice','inbound','keyValue','Caller\x20Number'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x1ea218,_0x35141b){_0x1ea218=_0x1ea218-0x0;var _0x427dea=_0xb8a0[_0x1ea218];return _0x427dea;};'use strict';exports['getSubjects']=function(_0x598029,_0x33f5c5){var _0x20741a=[{'type':'string','content':_0x0b8a('0x0'),'variableName':null}];switch(_0x598029['toLowerCase']()){case'voice':switch(_0x33f5c5['toLowerCase']()){case'inbound':_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x2'),'content':'','variableName':_0x0b8a('0x3')});_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x2'),'content':'','variableName':_0x0b8a('0x4')});break;case _0x0b8a('0x5'):_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x6'),'content':_0x0b8a('0x7'),'variableName':null});_0x20741a[_0x0b8a('0x1')]({'type':_0x0b8a('0x2'),'content':'','variableName':_0x0b8a('0x8')});break;}}return _0x20741a;};exports[_0x0b8a('0x9')]=function(_0x22d769,_0x39d8b8){var _0x1b48c5=[];switch(_0x22d769[_0x0b8a('0xa')]()){case _0x0b8a('0xb'):switch(_0x39d8b8[_0x0b8a('0xa')]()){case _0x0b8a('0xc'):_0x1b48c5=[{'type':_0x0b8a('0x6'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0xe'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x4')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0xf'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x10')},{'type':_0x0b8a('0xd'),'content':'','key':'Call\x20To','keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x11')},{'type':_0x0b8a('0xd'),'content':'','key':'Queue','keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x3')},{'type':_0x0b8a('0xd'),'content':'','key':'UniqueId','keyType':'variable','variableName':'uniqueid'},{'type':_0x0b8a('0xd'),'content':'','key':'Date','keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x12')},{'type':_0x0b8a('0x6'),'content':_0x0b8a('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x14'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x15')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x16'),'keyType':_0x0b8a('0x2'),'variableName':'destcalleridnum'},{'type':_0x0b8a('0x6'),'content':_0x0b8a('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x0b8a('0x18'),'keyType':_0x0b8a('0x2'),'variableName':_0x0b8a('0x12')},{'type':_0x0b8a('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0x0b8a('0x2'),'variableName':'agentconnectAt'},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x19'),'keyType':'variable','variableName':_0x0b8a('0x1a')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x1b'),'keyType':'variable','variableName':_0x0b8a('0x1c')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x1d'),'keyType':'variable','variableName':_0x0b8a('0x1e')}];break;case'outbound':_0x1b48c5=[{'type':_0x0b8a('0x6'),'content':_0x0b8a('0x1f'),'variableName':null},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x20'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x8')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x21'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x22')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0b8a('0x24')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x25'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x26')},{'type':'string','content':_0x0b8a('0x17')},{'type':_0x0b8a('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x27')},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x28'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':'endtime'},{'type':_0x0b8a('0xd'),'content':'','key':_0x0b8a('0x29'),'keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x2a')},{'type':_0x0b8a('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x0b8a('0x2'),'keyContent':'','variableName':_0x0b8a('0x2b')}];break;}}return _0x1b48c5;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 4d80870..09d2ab0 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5643=['Interaction','findOne','info','catch','error','query','clone','body','omit','html','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','upperFirst'];(function(_0x491faa,_0x4f2907){var _0x414440=function(_0x310864){while(--_0x310864){_0x491faa['push'](_0x491faa['shift']());}};_0x414440(++_0x4f2907);}(_0x5643,0x1a3));var _0x3564=function(_0x180a4b,_0x29eae2){_0x180a4b=_0x180a4b-0x0;var _0x3c6094=_0x5643[_0x180a4b];return _0x3c6094;};'use strict';var _=require(_0x3564('0x0'));var db=require(_0x3564('0x1'))['db'];var loggers={'openchannel':require(_0x3564('0x2'))('openchannel-interactions'),'mail':require(_0x3564('0x2'))(_0x3564('0x3')),'fax':require(_0x3564('0x2'))(_0x3564('0x4')),'sms':require(_0x3564('0x2'))(_0x3564('0x5')),'chat':require(_0x3564('0x2'))('chat-interactions'),'whatsapp':require(_0x3564('0x2'))(_0x3564('0x6'))};function getInteractionId(_0x28b357,_0x19e05d,_0x390afd){if(_0x28b357&&_0x28b357[_['upperFirst'](_0x390afd)+_0x3564('0x7')]){return _0x28b357[_['upperFirst'](_0x390afd)+_0x3564('0x7')];}else if(_0x28b357&&_0x28b357['id']){return _0x28b357['id'];}else if(_0x19e05d&&_0x19e05d['id']){return _0x19e05d['id'];}else{return _0x3564('0x8');}}function log(_0x3fe768,_0x542ced,_0xf73a4b,_0x5709ef,_0x3ae0b6,_0x50e1c7){loggers[_0x3ae0b6[_0x3564('0x9')]()][_0x3fe768](_0x3564('0xa'),_0x50e1c7[_0x3564('0xb')](),_0x542ced?_0x542ced['id']:null,_0x542ced?_0x542ced['name']:null,_0x542ced?_0x542ced[_0x3564('0xc')]:null,getInteractionId(_0xf73a4b,_0x5709ef,_0x3ae0b6),_0xf73a4b?JSON[_0x3564('0xd')](_0xf73a4b):_0x3564('0xe'));}function updateUser(_0x94fb18,_0x37ee06,_0x5d33ff,_0x4a9345,_0xbeec68){db[_[_0x3564('0xf')](_0x4a9345)+_0x3564('0x10')][_0x3564('0x11')]({'where':{'id':getInteractionId(_0x37ee06,_0x5d33ff,_0x4a9345)}})['then'](function(_0x39106d){if(_0x39106d){return _0x39106d['update']({'UserId':_0x94fb18?_0x94fb18['id']:null});}})['then'](function(_0x24bd0d){if(_0x24bd0d){log(_0x3564('0x12'),_0x94fb18,_0x37ee06,_0x5d33ff,_0x4a9345,_0xbeec68);}})[_0x3564('0x13')](function(){log(_0x3564('0x14'),_0x94fb18,_0x37ee06,_0x5d33ff,_0x4a9345,_0xbeec68);});}exports['tracked']=function(_0x44f3cb,_0x518217){return function(_0x5270d4,_0x552f0f,_0x56c0f4){var _0x588027=_0x5270d4['user'];var _0x3c9915={};var _0x4829a7=_0x5270d4[_0x3564('0x15')];if(_0x3c9915){_0x3c9915=_[_0x3564('0x16')](_0x5270d4[_0x3564('0x17')]);_0x3c9915=_[_0x3564('0x18')](_0x3c9915,[_0x3564('0x17'),_0x3564('0x19'),_0x3564('0x1a'),_0x3564('0x1b'),_0x3564('0x1c')]);}updateUser(_0x588027,_0x3c9915,_0x4829a7,_0x44f3cb,_0x518217);_0x56c0f4(null);};}; \ No newline at end of file +var _0x691a=['findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','Interaction'];(function(_0x5d224b,_0x5041e0){var _0xbf854a=function(_0x2ea320){while(--_0x2ea320){_0x5d224b['push'](_0x5d224b['shift']());}};_0xbf854a(++_0x5041e0);}(_0x691a,0x1df));var _0xa691=function(_0x1a4e70,_0x2796b3){_0x1a4e70=_0x1a4e70-0x0;var _0x227b65=_0x691a[_0x1a4e70];return _0x227b65;};'use strict';var _=require(_0xa691('0x0'));var db=require(_0xa691('0x1'))['db'];var loggers={'openchannel':require(_0xa691('0x2'))(_0xa691('0x3')),'mail':require(_0xa691('0x2'))(_0xa691('0x4')),'fax':require(_0xa691('0x2'))(_0xa691('0x5')),'sms':require(_0xa691('0x2'))(_0xa691('0x6')),'chat':require('../../config/logger')(_0xa691('0x7')),'whatsapp':require(_0xa691('0x2'))('whatsapp-interactions')};function getInteractionId(_0x173d1d,_0x5c53a0,_0x450b9d){if(_0x173d1d&&_0x173d1d[_[_0xa691('0x8')](_0x450b9d)+_0xa691('0x9')]){return _0x173d1d[_[_0xa691('0x8')](_0x450b9d)+'InteractionId'];}else if(_0x173d1d&&_0x173d1d['id']){return _0x173d1d['id'];}else if(_0x5c53a0&&_0x5c53a0['id']){return _0x5c53a0['id'];}else{return _0xa691('0xa');}}function log(_0x3152dd,_0x843e99,_0x5058d2,_0x457d80,_0x45556d,_0x306b3d){loggers[_0x45556d['toLowerCase']()][_0x3152dd](_0xa691('0xb'),_0x306b3d['toUpperCase'](),_0x843e99?_0x843e99['id']:null,_0x843e99?_0x843e99[_0xa691('0xc')]:null,_0x843e99?_0x843e99['role']:null,getInteractionId(_0x5058d2,_0x457d80,_0x45556d),_0x5058d2?JSON['stringify'](_0x5058d2):'null');}function updateUser(_0x2d66c9,_0x245ed7,_0x129ad0,_0x3a1743,_0x4b8ce0){db[_[_0xa691('0x8')](_0x3a1743)+_0xa691('0xd')][_0xa691('0xe')]({'where':{'id':getInteractionId(_0x245ed7,_0x129ad0,_0x3a1743)}})[_0xa691('0xf')](function(_0x5035f7){if(_0x5035f7){return _0x5035f7[_0xa691('0x10')]({'UserId':_0x2d66c9?_0x2d66c9['id']:null});}})[_0xa691('0xf')](function(_0x5549b0){if(_0x5549b0){log(_0xa691('0x11'),_0x2d66c9,_0x245ed7,_0x129ad0,_0x3a1743,_0x4b8ce0);}})[_0xa691('0x12')](function(){log(_0xa691('0x13'),_0x2d66c9,_0x245ed7,_0x129ad0,_0x3a1743,_0x4b8ce0);});}exports[_0xa691('0x14')]=function(_0x185fc7,_0x84a7cc){return function(_0x3b3b2d,_0x1def30,_0x25da7a){var _0x42dd21=_0x3b3b2d[_0xa691('0x15')];var _0x532496={};var _0x58cc97=_0x3b3b2d[_0xa691('0x16')];if(_0x532496){_0x532496=_[_0xa691('0x17')](_0x3b3b2d[_0xa691('0x18')]);_0x532496=_[_0xa691('0x19')](_0x532496,[_0xa691('0x18'),_0xa691('0x1a'),'phone',_0xa691('0x1b'),_0xa691('0x1c')]);}updateUser(_0x42dd21,_0x532496,_0x58cc97,_0x185fc7,_0x84a7cc);_0x25da7a(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index d885eba..43d2692 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0xd9b2=['findOne','then','count','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','update','utf8','final','parse','hasOwnProperty','use','License'];(function(_0x54e73c,_0x3dde00){var _0x20a958=function(_0x5905d2){while(--_0x5905d2){_0x54e73c['push'](_0x54e73c['shift']());}};_0x20a958(++_0x3dde00);}(_0xd9b2,0x140));var _0x2d9b=function(_0x4934e3,_0x124098){_0x4934e3=_0x4934e3-0x0;var _0x86a0c3=_0xd9b2[_0x4934e3];return _0x86a0c3;};'use strict';var crypto=require('crypto');var util=require(_0x2d9b('0x0'));var compose=require(_0x2d9b('0x1'));var db=require(_0x2d9b('0x2'))['db'];var config=require(_0x2d9b('0x3'));function getValueFromLicense(_0x1e730f,_0x231dbd){if(_0x1e730f&&_0x231dbd){if(_0x231dbd['data1']&&_0x231dbd[_0x2d9b('0x4')]){var _0x558158=_0x231dbd[_0x2d9b('0x5')];var _0x4d6e88=_0x231dbd['license'];var _0x4e5371=_0x558158[_0x2d9b('0x6')]('-')[0x4];var _0x1ebe5e=_0x558158['split']('-')[0x0];var _0x5caacd=crypto[_0x2d9b('0x7')](_0x2d9b('0x8'),util['format']('%s:%s:%s',_0x4e5371,_0x558158,_0x1ebe5e));var _0x1177e6=_0x5caacd[_0x2d9b('0x9')](_0x4d6e88,'base64',_0x2d9b('0xa'));_0x1177e6+=_0x5caacd[_0x2d9b('0xb')](_0x2d9b('0xa'));var _0x45bc3d=JSON[_0x2d9b('0xc')](_0x1177e6);return _0x45bc3d[_0x2d9b('0xd')](_0x1e730f)?_0x45bc3d[_0x1e730f]:null;}}return null;}function isLimit(_0x17940f,_0x1fe2f2,_0x164f55,_0x208307){var _0x2701ec=_0x1fe2f2;return compose()[_0x2d9b('0xe')](function(_0x255d7c,_0x5750e0,_0x23ea46){return db[_0x2d9b('0xf')][_0x2d9b('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x2d9b('0x11')](function(_0x47ad0f){var _0x1c80a3=getValueFromLicense(_0x17940f,_0x47ad0f);return _0x1c80a3?_0x1c80a3:_0x2701ec;})[_0x2d9b('0x11')](function(_0x104b93){_0x2701ec=_0x104b93;return _0x164f55[_0x2d9b('0x12')](_0x208307);})[_0x2d9b('0x11')](function(_0x3236b2){if(_0x3236b2>=_0x2701ec){return _0x5750e0['status'](0x193)[_0x2d9b('0x13')]({'message':util[_0x2d9b('0x14')](_0x2d9b('0x15'),_0x17940f)});}_0x23ea46();})[_0x2d9b('0x16')](function(_0x1c7a9f){_0x23ea46(_0x1c7a9f);});});}function isUserLimit(){return isLimit(_0x2d9b('0x17'),0x1,db[_0x2d9b('0x18')],{'where':{'$or':[{'role':_0x2d9b('0x19')},{'role':_0x2d9b('0x1a')}]}});}exports[_0x2d9b('0x1b')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index bde9806..182c7a7 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 _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 +var _0x12bb=['<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','conditions','push','buildExpression','$eq','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?'];(function(_0x1dca74,_0x476657){var _0x3cb3bc=function(_0x1cb80c){while(--_0x1cb80c){_0x1dca74['push'](_0x1dca74['shift']());}};_0x3cb3bc(++_0x476657);}(_0x12bb,0x7b));var _0xb12b=function(_0x207de6,_0x3b963a){_0x207de6=_0x207de6-0x0;var _0x293a75=_0x12bb[_0x207de6];return _0x293a75;};'use strict';var _=require(_0xb12b('0x0'));var moment=require(_0xb12b('0x1'));exports[_0xb12b('0x2')]=function(_0x2a2dcd){var _0x58feed={'conditions':[]};_0x58feed[_0xb12b('0x3')]=_[_0xb12b('0x4')](_0x2a2dcd,_0xb12b('0x5'))?'or':_0xb12b('0x6');var _0x3a634f=_0x2a2dcd[_0xb12b('0x7')](_0xb12b('0x8'),'')[_0xb12b('0x7')](_0xb12b('0x5'),'')[_0xb12b('0x9')]('||');for(var _0x44ab7c=0x0;_0x44ab7c<_0x3a634f[_0xb12b('0xa')];_0x44ab7c++){var _0x4499dc=_0x3a634f[_0x44ab7c][_0xb12b('0x9')](':=');var _0x26fea5=_0x4499dc[0x0];var _0x1379ea=_0x4499dc[_0xb12b('0xb')](0x1);_0x1379ea[_0xb12b('0xc')](function(_0x4bfeb9){var _0x3a8e4f=_0x4bfeb9['split']('[')[_0xb12b('0xd')]();var _0x21b30f=_0x4bfeb9[_0xb12b('0xe')](/\[(.*?)\]/g);_0x21b30f['forEach'](function(_0x3ce20c){var _0x2f36c3=_0x3ce20c['split']('[')[_0xb12b('0xf')](function(_0x3b183d){return _0x3b183d['indexOf'](']')>-0x1;})['map'](function(_0x26f7cf){return _0x26f7cf[_0xb12b('0x9')](']')[0x0];})[0x0];_0x58feed[_0xb12b('0x10')][_0xb12b('0x11')]({'field':_0x26fea5,'operator':_0x3a8e4f,'value':_0x2f36c3});});});}return _0x58feed;};exports[_0xb12b('0x12')]=function(_0x46b7d3,_0x580cb4,_0x36e7bd){var _0xa1d914={};if(_0x580cb4==='DATE'){if(_0x36e7bd['operator']===_0xb12b('0x13')){_0x36e7bd[_0xb12b('0x14')]=_0xb12b('0x15');_0x36e7bd[_0xb12b('0x16')]+=','+_0x36e7bd['value'];}else if(_[_0xb12b('0x17')]([_0xb12b('0x18'),_0xb12b('0x19')],_0x36e7bd['operator'])){_0x36e7bd[_0xb12b('0x16')]=moment(_0x36e7bd[_0xb12b('0x16')])[_0xb12b('0x1a')](0x1,'days')[_0xb12b('0x1b')](_0xb12b('0x1c'));}}if(_0x36e7bd[_0xb12b('0x1d')]){_0x580cb4=_0x36e7bd['castTo'];_0xa1d914['text']=_0xb12b('0x1e')+_0x46b7d3+'.'+_0x36e7bd[_0xb12b('0x1f')]+_0xb12b('0x20')+_0x36e7bd['castTo']+')\x20'+parseOperator(_0x36e7bd['operator']);}else{_0xa1d914['text']=_0x46b7d3+'.'+_0x36e7bd['field']+'\x20'+parseOperator(_0x36e7bd[_0xb12b('0x14')]);}if(_[_0xb12b('0x17')]([_0xb12b('0x21'),_0xb12b('0x22')],_0x36e7bd[_0xb12b('0x14')]))_0xa1d914['text']='('+_0xa1d914['text']+'\x20OR\x20'+_0x46b7d3+'.'+_0x36e7bd['field']+_0xb12b('0x23');_0xa1d914[_0xb12b('0x16')]=parseValue(_0x580cb4,_0x36e7bd['operator'],_0x36e7bd['value']);return _0xa1d914;};function parseOperator(_0xa7b533){var _0x458923;switch(_0xa7b533){case _0xb12b('0x24'):_0x458923=_0xb12b('0x25');break;case'$notIn':_0x458923=_0xb12b('0x26');break;case _0xb12b('0x13'):_0x458923=_0xb12b('0x27');break;case'$ne':_0x458923=_0xb12b('0x28');break;case _0xb12b('0x29'):case _0xb12b('0x2a'):case _0xb12b('0x2b'):_0x458923=_0xb12b('0x2c');break;case'$lt':_0x458923=_0xb12b('0x2d');break;case _0xb12b('0x18'):_0x458923='>\x20?';break;case _0xb12b('0x19'):_0x458923=_0xb12b('0x2e');break;case _0xb12b('0x2f'):_0x458923=_0xb12b('0x30');break;case _0xb12b('0x15'):_0x458923=_0xb12b('0x31');break;}return _0x458923;}function parseValue(_0x528f53,_0x3fde2e,_0x1c2f5c){var _0x26082b={'start':undefined,'end':undefined};switch(_0x3fde2e){case _0xb12b('0x24'):case'$notIn':_0x26082b[_0xb12b('0x32')]=_0x1c2f5c[_0xb12b('0x9')](',');break;case _0xb12b('0x29'):_0x26082b[_0xb12b('0x32')]='%'+_0x1c2f5c+'%';break;case _0xb12b('0x2a'):_0x26082b[_0xb12b('0x32')]=_0x1c2f5c+'%';break;case _0xb12b('0x2b'):_0x26082b[_0xb12b('0x32')]='%'+_0x1c2f5c;break;case _0xb12b('0x15'):var _0x48219f=_0x1c2f5c['split'](',');var _0x1c2f5c=_0x48219f[_0xb12b('0xd')]();var _0x154065=_0x48219f[_0xb12b('0x33')]();if(_0x528f53==='DATE'){_0x1c2f5c=moment(_0x1c2f5c)[_0xb12b('0x34')](0x0,!![])['format']();_0x154065=moment(_0x154065)[_0xb12b('0x34')](0x0,!![])['add'](0x17,_0xb12b('0x35'))[_0xb12b('0x1a')](0x3b,_0xb12b('0x36'))['add'](0x3b,_0xb12b('0x37'))['format']();}_0x26082b={'start':_0x1c2f5c,'end':_0x154065};break;default:_0x26082b[_0xb12b('0x32')]=_0x1c2f5c;break;}return _0x26082b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 45a981e..c1b3d9a 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 _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 +var _0x85e2=['subtract','isArray','limit','offset','sort','map','indexOf','cast','col','priority','DESC','unsigned','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','forEach','includes','push','join','lodash','sequelize','moment','fields','split','filters','forOwn','DATE','isPlainObject','parse','$gte','YYYY-MM-DD','format','$lte','utc'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x85e2,0x109));var _0x285e=function(_0x2a0be5,_0x3c208f){_0x2a0be5=_0x2a0be5-0x0;var _0x31928d=_0x85e2[_0x2a0be5];return _0x31928d;};'use strict';var _=require(_0x285e('0x0'));var sequelize=require(_0x285e('0x1'));var moment=require(_0x285e('0x2'));var LIMIT_VALUE=0xfa;exports[_0x285e('0x3')]=function(_0x4feeb9){var _0x2dca4a=null;if(_0x4feeb9){_0x2dca4a=_0x4feeb9[_0x285e('0x4')](',');}return _0x2dca4a;};exports[_0x285e('0x5')]=function(_0x725ad4,_0x263106){var _0x4fdbaa={};if(!_['isEmpty'](_0x725ad4)){_[_0x285e('0x6')](_0x725ad4,function(_0x4e340a,_0x43bdb9){try{if(_0x263106){var _0x423b49=_['find'](_0x263106,{'name':_0x43bdb9})||{};if(_0x423b49['type']===_0x285e('0x7')&&_[_0x285e('0x8')](_0x4e340a)){var _0x398f5e=JSON[_0x285e('0x9')](_0x4e340a);var _0xabffeb={'$gte':moment(moment(_0x398f5e[_0x285e('0xa')])['format'](_0x285e('0xb')))['utc']()[_0x285e('0xc')](),'$lte':moment(moment(_0x398f5e[_0x285e('0xd')])[_0x285e('0xc')](_0x285e('0xb')))[_0x285e('0xe')]()[_0x285e('0xf')](0x1,'s')[_0x285e('0xc')]()};_0x4fdbaa[_0x43bdb9]=_0xabffeb;}else{_0x4fdbaa[_0x43bdb9]=_[_0x285e('0x10')](_0x4e340a)?_0x4e340a:JSON[_0x285e('0x9')](_0x4e340a);}}else{_0x4fdbaa[_0x43bdb9]=_[_0x285e('0x10')](_0x4e340a)?_0x4e340a:JSON[_0x285e('0x9')](_0x4e340a);}}catch(_0xbc9b00){_0x4fdbaa[_0x43bdb9]=_0x4e340a[_0x285e('0x4')](',');}});}return _0x4fdbaa;};exports[_0x285e('0x11')]=function(_0x557956){_0x557956=parseInt(_0x557956,0xa);if(!_0x557956||_0x557956<0x0){_0x557956=LIMIT_VALUE;}return _0x557956;};exports[_0x285e('0x12')]=function(_0x247ca7){_0x247ca7=parseInt(_0x247ca7,0xa);if(!_0x247ca7||_0x247ca7<0x0){_0x247ca7=0x0;}return _0x247ca7;};exports[_0x285e('0x13')]=function(_0x3a7944){var _0x4d6638,_0x372f1d=null;if(_0x3a7944){_0x4d6638=_0x3a7944[_0x285e('0x4')](',');_0x372f1d=_[_0x285e('0x14')](_0x4d6638,function(_0x37af82){if(_0x37af82[_0x285e('0x15')]('-')===0x0){return[_0x37af82==='priority'?sequelize[_0x285e('0x16')](sequelize[_0x285e('0x17')](_0x285e('0x18')),'unsigned'):_0x37af82['substr'](0x1),_0x285e('0x19')];}else{return[_0x37af82===_0x285e('0x18')?sequelize[_0x285e('0x16')](sequelize[_0x285e('0x17')](_0x285e('0x18')),_0x285e('0x1a')):_0x37af82,_0x285e('0x1b')];}});}return _0x372f1d;};exports[_0x285e('0x1c')]=function(_0x59cabb,_0x58264f){if(_['isEmpty'](_0x59cabb)){return _0x59cabb;}if(_[_0x285e('0x10')](_0x59cabb)){for(var _0xcfccae=0x0;_0xcfccae<_0x59cabb[_0x285e('0x1d')];_0xcfccae+=0x1){_0x59cabb[_0xcfccae]=this[_0x285e('0x1c')](_0x59cabb[_0xcfccae],_0x58264f);}return _0x59cabb;}if(!_[_0x285e('0x1e')](_0x59cabb)){return _0x59cabb;}if(_[_0x285e('0x1f')](_0x58264f)){_0x58264f=[_0x58264f];}if(!_['isArray'](_0x58264f)){return _0x59cabb;}for(var _0x3b589e=0x0;_0x3b589e<_0x58264f[_0x285e('0x1d')];_0x3b589e+=0x1){_[_0x285e('0x20')](_0x59cabb,_0x58264f[_0x3b589e]);}for(var _0x3503a3 in _0x59cabb){if(_0x59cabb['hasOwnProperty'](_0x3503a3)){_0x59cabb[_0x3503a3]=this['omit'](_0x59cabb[_0x3503a3],_0x58264f);}}return _0x59cabb;};exports[_0x285e('0x21')]=function(_0x5da145){return _0x5da145[_0x285e('0x22')](RegExp(_0x285e('0x23')))?!![]:![];};exports['isEmail']=function(_0x52ebdc){return _0x52ebdc[_0x285e('0x22')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0xa76fa4){var _0x58c828=[];_0xa76fa4[_0x285e('0x4')](/[ ,]+/)[_0x285e('0x24')](function(_0x2be8de){_0x2be8de=_0x2be8de['replace'](/([^:]")"+/g,'$1');_0x2be8de='+'+_0x2be8de+'*';if(_0x2be8de[_0x285e('0x25')]('@'))_0x2be8de='\x22'+_0x2be8de+'\x22';_0x58c828[_0x285e('0x26')](_0x2be8de);});return _0x58c828[_0x285e('0x27')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 12f4d10..2aa0239 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x0cb9=['public','development','test','set','appPath','join','client','use','json\x20replacer','split','static','views','root','/server/views','ejs','renderFile','view\x20engine','html','urlencoded','json','50mb','initialize','express','serve-favicon','body-parser','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x0cb9,0x17e));var _0x90cb=function(_0xe3b081,_0xa1cb94){_0xe3b081=_0xe3b081-0x0;var _0x466300=_0x0cb9[_0xe3b081];return _0x466300;};'use strict';var express=require(_0x90cb('0x0'));var favicon=require(_0x90cb('0x1'));var bodyParser=require(_0x90cb('0x2'));var methodOverride=require('method-override');var cookieParser=require(_0x90cb('0x3'));var errorHandler=require(_0x90cb('0x4'));var path=require(_0x90cb('0x5'));var passport=require('passport');var cors=require(_0x90cb('0x6'));var moment=require(_0x90cb('0x7'));var config=require(_0x90cb('0x8'));var db=require(_0x90cb('0x9'))['db'];exports[_0x90cb('0xa')]=function(_0x22fff4){var _0x4e3e42=_0x22fff4[_0x90cb('0xb')](_0x90cb('0xc'));if(_0x4e3e42===_0x90cb('0xd')){_0x22fff4['set']('appPath',path['join'](config['root'],_0x90cb('0xe')));}if(_0x4e3e42===_0x90cb('0xf')||_0x4e3e42===_0x90cb('0x10')){_0x22fff4[_0x90cb('0x11')](_0x90cb('0x12'),path[_0x90cb('0x13')](config['root'],_0x90cb('0x14')));_0x22fff4[_0x90cb('0x15')](errorHandler());}_0x22fff4[_0x90cb('0x11')](_0x90cb('0x16'),function(_0x38d17b,_0x35f1ae){if(this[_0x38d17b]instanceof Date){_0x35f1ae=this[_0x38d17b]['toISOString']()[_0x90cb('0x17')]('.')[0x0]+'Z';}return _0x35f1ae;});_0x22fff4['use'](express[_0x90cb('0x18')](_0x22fff4[_0x90cb('0xb')](_0x90cb('0x12'))));_0x22fff4[_0x90cb('0x11')](_0x90cb('0x19'),config[_0x90cb('0x1a')]+_0x90cb('0x1b'));_0x22fff4['engine']('html',require(_0x90cb('0x1c'))[_0x90cb('0x1d')]);_0x22fff4[_0x90cb('0x11')](_0x90cb('0x1e'),_0x90cb('0x1f'));_0x22fff4['use'](bodyParser[_0x90cb('0x20')]({'limit':'50mb','extended':!![]}));_0x22fff4['use'](bodyParser[_0x90cb('0x21')]({'limit':_0x90cb('0x22')}));_0x22fff4['use'](cors());_0x22fff4[_0x90cb('0x15')](methodOverride());_0x22fff4['use'](cookieParser());_0x22fff4[_0x90cb('0x15')](passport[_0x90cb('0x23')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 291fab0..33a4ffe 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 _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 +var _0x3435=['length','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','orderBy','cpus','join','createHash','update','hex','getUuid','platform','win32','utf8','replace','hostname','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces'];(function(_0x1fc899,_0x3c4319){var _0x5a0048=function(_0x2de24b){while(--_0x2de24b){_0x1fc899['push'](_0x1fc899['shift']());}};_0x5a0048(++_0x3c4319);}(_0x3435,0xfa));var _0x5343=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x3435[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x5343('0x0'));var os=require('os');var crypto=require(_0x5343('0x1'));var machine=require(_0x5343('0x2'));var exec=require(_0x5343('0x3'))[_0x5343('0x4')];function getInterfaces(){var _0x2a91fe=[];var _0x597aa9=os[_0x5343('0x5')]();var _0x3ae07e=_['orderBy'](_['keys'](_0x597aa9));for(var _0x1f0046=0x0;_0x1f0046<_0x3ae07e[_0x5343('0x6')];_0x1f0046++){var _0x4d26b5=_0x597aa9[_0x3ae07e[_0x1f0046]]['filter'](function(_0x13641f){return _0x13641f[_0x5343('0x7')]===_0x5343('0x8')&&_0x13641f[_0x5343('0x9')]===![];});_0x2a91fe=_0x2a91fe[_0x5343('0xa')](_0x4d26b5);}return _0x2a91fe;}function getFirstInterface(){var _0x5e1147=_[_0x5343('0xb')](getInterfaces());return{'macAddress':_0x5e1147&&_0x5e1147['mac']?_0x5e1147[_0x5343('0xc')]:_0x5343('0xd'),'ipAddress':_0x5e1147&&_0x5e1147[_0x5343('0xe')]?_0x5e1147[_0x5343('0xe')]:_0x5343('0xf')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x42a94a=_[_0x5343('0x10')](os[_0x5343('0x11')]()['map'](function(_0x2ddeb7){return _0x2ddeb7['model'];}))[_0x5343('0x12')](':');return crypto[_0x5343('0x13')]('md5')[_0x5343('0x14')](_0x42a94a)['digest'](_0x5343('0x15'));}exports[_0x5343('0x16')]=function(){switch(os[_0x5343('0x17')]()){case _0x5343('0x18'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x5343('0x19')})[_0x5343('0x1a')]('\x0d\x0a','');default:var _0x1df724=getFirstInterface();var _0x3f27fb=getCPUhash();var _0x45cade=_0x3f27fb+'|'+os[_0x5343('0x1b')]()+'|'+_0x1df724[_0x5343('0x1c')]+'|'+_0x1df724[_0x5343('0x1d')];var _0x4cf3c2=crypto[_0x5343('0x13')](_0x5343('0x1e'))[_0x5343('0x14')](_0x45cade)['digest'](_0x5343('0x15'));return _0x4cf3c2[_0x5343('0x1f')](0x0,0x8)+'-'+_0x4cf3c2[_0x5343('0x1f')](0x8,0xc)+'-'+_0x4cf3c2[_0x5343('0x1f')](0xc,0x10)+'-'+_0x4cf3c2[_0x5343('0x1f')](0x10,0x14)+'-'+_0x4cf3c2[_0x5343('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 06ec93f..e60fed9 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 _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 +var _0x011e=['YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','getUuid','License','findOrCreate','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','process','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','||FIELD||VALUE||\x0a','User','admin','fullname','|uuid|','|name|','|email|','getFirstInterface','openIssue','Motion\x20License\x20Alert','Alert','email','get','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','data1','info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x237d5d,_0x18c1c8){var _0x211253=function(_0x5de4df){while(--_0x5de4df){_0x237d5d['push'](_0x237d5d['shift']());}};_0x211253(++_0x18c1c8);}(_0x011e,0x187));var _0xe011=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x011e[_0x363ef8];return _0x148822;};'use strict';var util=require(_0xe011('0x0'));var moment=require(_0xe011('0x1'));var rp=require(_0xe011('0x2'));var BPromise=require(_0xe011('0x3'));var pkginfo=require(_0xe011('0x4'))(module,_0xe011('0x5'));var db=require(_0xe011('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xe011('0x7'));var logger=require(_0xe011('0x8'))(_0xe011('0x9'));var jira=require('../../api/jira/jira.controller');const {config}=require(_0xe011('0xa'));var HOST=_0xe011('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x279133){return new BPromise(function(_0x87483b,_0x53717f){var _0x4f4395=util['format'](_0xe011('0xc'),HOST,_0x279133,module[_0xe011('0xd')][_0xe011('0x5')]);if(oldToken){_0x4f4395=util[_0xe011('0xe')](_0xe011('0xf'),HOST,_0x279133,module[_0xe011('0xd')][_0xe011('0x5')],oldToken);}var _0x415f62={'uri':_0x4f4395,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x415f62)[_0xe011('0x10')](function(_0x4552b6){_0x87483b(_0x4552b6);})[_0xe011('0x11')](function(_0x6da5d2){_0x53717f(_0x6da5d2);});});}function sendJiraAlert(_0x18740f,_0x4efdb7,_0x2bc2f1){var _0x54242c=_0xe011('0x12');return db[_0xe011('0x13')]['findOne']({'where':{'role':_0xe011('0x14')},'attributes':[_0xe011('0x15'),'email'],'raw':!![]})[_0xe011('0x10')](function(_0x532335){ADMIN=_0x532335;_0x54242c+='|reason|'+_0x2bc2f1+'|\x0a';_0x54242c+=_0xe011('0x16')+_0x18740f+'|\x0a';_0x54242c+='|machineUuid|'+_0x4efdb7+'|\x0a';_0x54242c+=_0xe011('0x17')+ADMIN[_0xe011('0x15')]+'|\x0a';_0x54242c+=_0xe011('0x18')+ADMIN['email']+'|\x0a';return _0x54242c;})['then'](function(_0x24ee1d){var _0x59aa49=hardware[_0xe011('0x19')]()['ipAddress'];return jira[_0xe011('0x1a')]({'key':'MOTLICENSE','summary':_0xe011('0x1b'),'description':_0x24ee1d,'issuetype':_0xe011('0x1c'),'oldToken':_0x18740f,'newToken':_0x4efdb7,'email':ADMIN[_0xe011('0x1d')],'name':ADMIN[_0xe011('0x15')],'reason':GRAY_PERIOD_REASON,'ip':_0x59aa49});});}function manageLicense(_0x375f9e,_0x221dae){var _0x1903c9=_0x221dae[_0xe011('0x1e')]({'plain':!![]});httpRequest(_0x375f9e)[_0xe011('0x10')](function(_0x192715){if(oldToken){oldToken=undefined;}if(_0x192715['active']){if(!_0x1903c9[_0xe011('0x9')]&&_0x1903c9[_0xe011('0x9')]!=_0x192715[_0xe011('0x9')]||_0x1903c9[_0xe011('0x9')]&&_0x1903c9[_0xe011('0x1f')]){logger['info'](_0xe011('0x20'));}if(_0x1903c9[_0xe011('0x9')]&&!_0x1903c9[_0xe011('0x1f')]&&_0x1903c9[_0xe011('0x9')]!=_0x192715[_0xe011('0x9')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x1903c9[_0xe011('0x9')]&&!_0x1903c9[_0xe011('0x1f')]&&_0x1903c9['license']==_0x192715[_0xe011('0x9')]){return _0x221dae;}return _0x221dae[_0xe011('0x21')]({'data1':_0x375f9e,'data2':null,'license':_0x192715[_0xe011('0x9')]});}else{if(_0x192715['license']||_0x1903c9[_0xe011('0x9')]){if(!_0x1903c9[_0xe011('0x1f')]){if(_0x1903c9[_0xe011('0x22')]==_0x375f9e){GRAY_PERIOD_REASON='Disabled';logger[_0xe011('0x23')](_0xe011('0x24'));}else{GRAY_PERIOD_REASON=_0xe011('0x25');oldToken=_0x1903c9[_0xe011('0x22')];logger[_0xe011('0x23')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x1903c9[_0xe011('0x22')],_0x375f9e);}sendJiraAlert(_0x1903c9[_0xe011('0x22')],_0x192715[_0xe011('0x26')],GRAY_PERIOD_REASON);logger[_0xe011('0x23')](_0xe011('0x27'),GRAY_PERIOD_REASON[_0xe011('0x28')](),moment()[_0xe011('0xe')](_0xe011('0x29')));return _0x221dae[_0xe011('0x21')]({'data2':encryptor[_0xe011('0x2a')](moment()['format'](_0xe011('0x29')))});}else{if(moment()[_0xe011('0x2b')](encryptor[_0xe011('0x2c')](_0x1903c9[_0xe011('0x1f')]),_0xe011('0x2d'))>DAYS){logger[_0xe011('0x23')](_0xe011('0x2e'),moment()[_0xe011('0xe')](_0xe011('0x29')));return _0x221dae[_0xe011('0x21')]({'data1':_0x375f9e,'data2':null,'license':null});}}}else{if(_0x1903c9['data1']!=_0x375f9e){logger[_0xe011('0x23')](_0xe011('0x2f'),_0x1903c9[_0xe011('0x22')],_0x375f9e);return _0x221dae[_0xe011('0x21')]({'data1':_0x375f9e,'data2':null,'license':null});}}}return _0x221dae;})[_0xe011('0x10')](function(_0xb41c37){_0x221dae=_0xb41c37;})[_0xe011('0x11')](function(_0x4e7f83){logger[_0xe011('0x30')](_0x4e7f83[_0xe011('0x31')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xe011('0x32')](),_0x221dae);},TIME);});}function defaultLicense(){var _0x240949=hardware['getUuid']();if(_0x240949){return db[_0xe011('0x33')][_0xe011('0x34')]({'where':{'id':0x1},'defaults':{'data1':_0x240949}})['spread'](function(_0xa62350,_0x3bfa36){logger[_0xe011('0x23')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x240949);manageLicense(_0x240949,_0xa62350);})[_0xe011('0x11')](function(_0x19e35a){logger[_0xe011('0x30')](_0x19e35a[_0xe011('0x31')]);});}}exports[_0xe011('0x35')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index cf7ef10..057d2d7 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 _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 +var _0xf066=['isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','forEach','count','catch','pick','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','getUuid','License','defaults','then','uuid','data1'];(function(_0x4958b6,_0x2e185c){var _0x22b549=function(_0x4339b4){while(--_0x4339b4){_0x4958b6['push'](_0x4958b6['shift']());}};_0x22b549(++_0x2e185c);}(_0xf066,0x1c7));var _0x6f06=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0xf066[_0x65c903];return _0x23e1d7;};'use strict';var util=require(_0x6f06('0x0'));var _=require(_0x6f06('0x1'));var moment=require(_0x6f06('0x2'));var BPromise=require(_0x6f06('0x3'));var hardware=require(_0x6f06('0x4'));var encryptor=require(_0x6f06('0x5'));var db=require(_0x6f06('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f06('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f06('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x6f06('0x8'),'machineUuid':hardware[_0x6f06('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xc88098){return new BPromise(function(_0xc93b71,_0x4b3644){return db[_0x6f06('0xa')]['find'](_[_0x6f06('0xb')](_0xc88098,{'raw':!![],'where':{'id':0x1}}))[_0x6f06('0xc')](function(_0x413350){return checkLicense(_0x413350,null);})[_0x6f06('0xc')](function(_0x2b5807){_0xc93b71(_0x2b5807);return;})['catch'](function(_0x5b685e){_0x4b3644(_0x5b685e);});});}function checkLicense(_0x17bf92,_0x5ea955){if(!_0x17bf92){demoLicense[_0x6f06('0xd')]=_0x17bf92[_0x6f06('0xe')];return demoLicense;}try{var _0x2a9869=_0x5ea955||_0x17bf92['license'];if(_[_0x6f06('0xf')](_0x2a9869)){throw new Error(_0x6f06('0x10'));}var _0x1784ca=_0x17bf92[_0x6f06('0xe')];var _0x11e55a=_0x17bf92[_0x6f06('0x11')];var _0x44591f=_0x1784ca[_0x6f06('0x12')]('-')[0x4];var _0x4f9af7=_0x1784ca[_0x6f06('0x12')]('-')[0x0];var _0x42f31c=encryptor['decryptString'](_0x2a9869,util[_0x6f06('0x13')](_0x6f06('0x14'),_0x44591f,_0x1784ca,_0x4f9af7));var _0x38daf1=JSON[_0x6f06('0x15')](_0x42f31c);_0x38daf1[_0x6f06('0x16')]=![];_0x38daf1['uuid']=_0x1784ca;_0x38daf1[_0x6f06('0x17')]=hardware[_0x6f06('0x9')]();if(_0x11e55a){var _0x5d1419=encryptor[_0x6f06('0x18')](_0x11e55a);_0x38daf1[_0x6f06('0x19')]=_0x5d1419;_0x38daf1[_0x6f06('0x1a')]=moment(_0x5d1419)['add'](0x7,_0x6f06('0x1b'))['format']();_0x38daf1[_0x6f06('0x1c')]=_0x38daf1[_0x6f06('0xd')]!=_0x38daf1['machineUuid']?'changed':_0x6f06('0x1d');}return _0x38daf1;}catch(_0x50ab23){breakingLicense[_0x6f06('0xd')]=_0x17bf92['data1'];breakingLicense[_0x6f06('0x1e')]=_0x50ab23[_0x6f06('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2d84e9,_0x2053ea){getLicense()[_0x6f06('0xc')](function(_0x42b2ba){return db[_0x6f06('0x1f')][_0x6f06('0x20')]({'attributes':[_0x6f06('0x21'),[db[_0x6f06('0x22')]['fn'](_0x6f06('0x23'),db[_0x6f06('0x22')][_0x6f06('0x24')](_0x6f06('0x21'))),'count']],'group':_0x6f06('0x21'),'where':{'role':{'$or':[_0x6f06('0x25'),_0x6f06('0x26'),_0x6f06('0x27')]}},'raw':!![]})[_0x6f06('0xc')](function(_0x3f1cb8){var _0x45f2f3={'user':_0x42b2ba[_0x6f06('0x28')]||0x0,'telephone':_0x42b2ba['telephones']||0x0};_0x3f1cb8[_0x6f06('0x29')](function(_0x5a7dec){var _0xa1c58e=_0x5a7dec[_0x6f06('0x21')]===_0x6f06('0x25')?'user':_0x5a7dec[_0x6f06('0x21')];_0x45f2f3[_0xa1c58e]-=_0x5a7dec[_0x6f06('0x2a')];if(_0x45f2f3[_0xa1c58e]<0x0)_0x45f2f3[_0xa1c58e]=0x0;});_0x2d84e9(_0x45f2f3);return;});})[_0x6f06('0x2b')](function(_0x420b6e){_0x2053ea(_0x420b6e);});});}function checkUserLimits(_0x27f83f){return new BPromise(function(_0x27b1ce,_0x3bd4a0){getLimits()[_0x6f06('0xc')](function(_0x3270c3){var _0x137456=_[_0x6f06('0x2c')](_['countBy'](_0x27f83f,'role'),[_0x6f06('0x25'),_0x6f06('0x26'),'telephone']);var _0x3e917e=(_0x137456[_0x6f06('0x25')]||0x0)+(_0x137456[_0x6f06('0x26')]||0x0);var _0x4cc109=_0x137456[_0x6f06('0x27')]||0x0;if(_0x3e917e>_0x3270c3['user'])return _0x3bd4a0(_0x6f06('0x2d'));if(_0x4cc109>_0x3270c3['telephone'])return _0x3bd4a0('License\x20limit\x20reached\x20for\x20telephones');return _0x27b1ce();})[_0x6f06('0x2b')](function(_0x22275f){_0x3bd4a0(_0x22275f);});});}module[_0x6f06('0x2e')]={'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 564a419..960a68a 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 _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 +var _0x21f5=['app-id','secret','http://localhost:9000'];(function(_0x45ad27,_0x271ab5){var _0x1d6dc6=function(_0x3b6b56){while(--_0x3b6b56){_0x45ad27['push'](_0x45ad27['shift']());}};_0x1d6dc6(++_0x271ab5);}(_0x21f5,0x1e5));var _0x521f=function(_0x82a071,_0x252266){_0x82a071=_0x82a071-0x0;var _0x15dda9=_0x21f5[_0x82a071];return _0x15dda9;};'use strict';module['exports']={'DOMAIN':_0x521f('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x521f('0x1'),'GOOGLE_SECRET':_0x521f('0x2'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ed6cd69..4a4fd77 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x416e=['info','Console','env','debugLevel','moment','path','/var','log','%s-%s.log','message','{{{','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','exports','Logger','transports','%s-%s','error','File'];(function(_0xc13803,_0x13784e){var _0x215a4c=function(_0x232960){while(--_0x232960){_0xc13803['push'](_0xc13803['shift']());}};_0x215a4c(++_0x13784e);}(_0x416e,0x1d2));var _0xe416=function(_0x10f471,_0x3cc9da){_0x10f471=_0x10f471-0x0;var _0x123908=_0x416e[_0x10f471];return _0x123908;};'use strict';var moment=require(_0xe416('0x0'));var winston=require('winston');var util=require('util');var path=require(_0xe416('0x1'));var debugLevel='INFO';function filename(_0x2f7996,_0x3eec1f){return path['join'](_0xe416('0x2'),_0xe416('0x3'),'xcally',util['format'](_0xe416('0x4'),_0x2f7996,_0x3eec1f));}function formatter(_0x2d00c5,_0x199e24){_0x199e24[_0xe416('0x5')]=_0x199e24[_0xe416('0x5')]['replace'](/@@{/g,_0xe416('0x6'))[_0xe416('0x7')](/}@@/g,_0xe416('0x8'))[_0xe416('0x7')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xe416('0x9')](_0xe416('0xa'),moment()[_0xe416('0x9')](_0xe416('0xb')),_0x199e24['level']['toUpperCase'](),_0x2d00c5,_0x199e24[_0xe416('0x5')]);}module[_0xe416('0xc')]=function(_0x3ef24d){return new winston[(_0xe416('0xd'))]({'transports':[new winston[(_0xe416('0xe'))]['File']({'name':util[_0xe416('0x9')](_0xe416('0xf'),_0x3ef24d,_0xe416('0x10')),'filename':filename(_0x3ef24d,_0xe416('0x10')),'level':_0xe416('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1e5a77){return formatter(_0x3ef24d,_0x1e5a77);}}),new winston['transports'][(_0xe416('0x11'))]({'name':util[_0xe416('0x9')](_0xe416('0xf'),_0x3ef24d,'info'),'filename':filename(_0x3ef24d,'info'),'level':_0xe416('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x556f8e){return formatter(_0x3ef24d,_0x556f8e);}}),new winston[(_0xe416('0xe'))][(_0xe416('0x13'))]({'level':process[_0xe416('0x14')][_0xe416('0x15')]||debugLevel,'json':![],'formatter':function(_0xa0ac9c){return formatter(_0x3ef24d,_0xa0ac9c);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 7997625..8cfcd6b 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 _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 +var _0x3cb7=['../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','../../services/express/index.js','ami','join','../../services/ami/index.js','agi','../../services/agi/index.js','../../services/email/index.js','routing'];(function(_0x42f7dd,_0x33f2d8){var _0x26c191=function(_0x554849){while(--_0x554849){_0x42f7dd['push'](_0x42f7dd['shift']());}};_0x26c191(++_0x33f2d8);}(_0x3cb7,0x1a8));var _0x73cb=function(_0x2a56ad,_0x2b94bf){_0x2a56ad=_0x2a56ad-0x0;var _0x425175=_0x3cb7[_0x2a56ad];return _0x425175;};'use strict';var path=require(_0x73cb('0x0'));var os=require('os');var config={'apps':[{'name':_0x73cb('0x1'),'script':path['join'](__dirname,_0x73cb('0x2'))},{'name':_0x73cb('0x3'),'script':path[_0x73cb('0x4')](__dirname,_0x73cb('0x5'))},{'name':_0x73cb('0x6'),'script':path['join'](__dirname,_0x73cb('0x7'))},{'name':'email','script':path[_0x73cb('0x4')](__dirname,_0x73cb('0x8'))},{'name':_0x73cb('0x9'),'script':path[_0x73cb('0x4')](__dirname,_0x73cb('0xa'))},{'name':_0x73cb('0xb'),'script':path['join'](__dirname,_0x73cb('0xc'))}]};module[_0x73cb('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 12691e9..ea6fa66 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 _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 +var _0x39c7=['dump','bluebird','./config','connect','start','then','stop','disconnect','restart','list','describe','delete'];(function(_0xa3d957,_0x5cefc3){var _0x1f2f67=function(_0x53424c){while(--_0x53424c){_0xa3d957['push'](_0xa3d957['shift']());}};_0x1f2f67(++_0x5cefc3);}(_0x39c7,0x85));var _0x739c=function(_0x377ac0,_0x5c6208){_0x377ac0=_0x377ac0-0x0;var _0x230711=_0x39c7[_0x377ac0];return _0x230711;};'use strict';var pm2=require('pm2');var BPromise=require(_0x739c('0x0'));var config=require(_0x739c('0x1'));function connect(){return new BPromise(function(_0x11237b,_0x25fdf5){return pm2[_0x739c('0x2')](function(_0x18d787){if(_0x18d787){return _0x25fdf5(_0x18d787);}return _0x11237b('connected');});});};exports[_0x739c('0x3')]=function(_0xff8215){return connect()[_0x739c('0x4')](function(){return new BPromise(function(_0x5d4525,_0x4c5030){return pm2[_0x739c('0x3')](_0xff8215,function(_0x3c0af1,_0x5df5d3){if(_0x3c0af1){return _0x4c5030(_0x3c0af1);}pm2['disconnect']();return _0x5d4525(_0x5df5d3);});});});};exports[_0x739c('0x5')]=function(_0x3475f2){return connect()['then'](function(){return new BPromise(function(_0x3f3896,_0x277f61){return pm2['stop'](_0x3475f2,function(_0x530e42,_0xd334){if(_0x530e42){return _0x277f61(_0x530e42);}pm2[_0x739c('0x6')]();return _0x3f3896(_0xd334);});});});};exports[_0x739c('0x7')]=function(_0x27b317){return connect()[_0x739c('0x4')](function(){return new BPromise(function(_0x17ceae,_0x33100f){return pm2[_0x739c('0x7')](_0x27b317,function(_0x3bd2c6,_0x46177c){if(_0x3bd2c6){return _0x33100f(_0x3bd2c6);}pm2[_0x739c('0x6')]();return _0x17ceae(_0x46177c);});});});};exports[_0x739c('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x432308,_0xd6cb9c){return pm2[_0x739c('0x8')](function(_0x2d4939,_0x298049){if(_0x2d4939){return _0xd6cb9c(_0x2d4939);}pm2[_0x739c('0x6')]();return _0x432308(_0x298049);});});});};exports[_0x739c('0x9')]=function(_0xe6a26d){return connect()[_0x739c('0x4')](function(){return new BPromise(function(_0x1a97c1,_0x4cc36c){return pm2['describe'](_0xe6a26d,function(_0x362095,_0x23888d){if(_0x362095){return _0x4cc36c(_0x362095);}pm2[_0x739c('0x6')]();return _0x1a97c1(_0x23888d);});});});};exports['delete']=function(_0x1bb4fd){return connect()[_0x739c('0x4')](function(){return new BPromise(function(_0x27141a,_0x25acc6){return pm2[_0x739c('0xa')](_0x1bb4fd,function(_0x5e412f,_0x42c706){if(_0x5e412f){return _0x25acc6(_0x5e412f);}pm2[_0x739c('0x6')]();return _0x27141a(_0x42c706);});});});};exports[_0x739c('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x6554ff,_0x48fc13){return pm2['dump'](function(_0xd5592a){if(_0xd5592a){return _0x48fc13(_0xd5592a);}return _0x6554ff('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index a72f7aa..4e6bd74 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 _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 +var _0x9a7c=['then','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','start','lodash','util','../../config/environment','../../mysqldb','schedule','redis','Setting','find','chatTimeout','ChatInteraction','lastMsgAt','subtract','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2ee8f2,_0x3f7eb0){var _0x555494=function(_0x3c74d7){while(--_0x3c74d7){_0x2ee8f2['push'](_0x2ee8f2['shift']());}};_0x555494(++_0x3f7eb0);}(_0x9a7c,0xa8));var _0xc9a7=function(_0x1436e7,_0x4093e2){_0x1436e7=_0x1436e7-0x0;var _0x5cc697=_0x9a7c[_0x1436e7];return _0x5cc697;};'use strict';var _=require(_0xc9a7('0x0'));var moment=require('moment');var Redis=require('ioredis');var util=require(_0xc9a7('0x1'));var config=require(_0xc9a7('0x2'));var db=require(_0xc9a7('0x3'))['db'];var logger=require('../logger')(_0xc9a7('0x4'));config[_0xc9a7('0x5')]=_['defaults'](config[_0xc9a7('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9a7('0x5')]));function closeInteractions(){var _0x515054=0x0;var _0x51e986=[];return db[_0xc9a7('0x6')][_0xc9a7('0x7')]({'raw':!![],'attributes':['id',_0xc9a7('0x8')],'where':{'id':0x1}})['then'](function(_0x111fbf){_0x515054=_0x111fbf[_0xc9a7('0x8')];if(_0x515054){return db[_0xc9a7('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xc9a7('0xa')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xc9a7('0xb')](_0x111fbf['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x3160bd){if(_0x3160bd&&_0x3160bd['length']){_0x51e986=_[_0xc9a7('0xc')](_0x3160bd||[],'id');logger[_0xc9a7('0xd')](_0xc9a7('0xe'),_0x51e986[_0xc9a7('0xf')]());return db[_0xc9a7('0x9')][_0xc9a7('0x10')]({'closeReason':_0xc9a7('0x11'),'disposition':_0xc9a7('0x12'),'closed':!![],'closedAt':moment()[_0xc9a7('0x13')](_0xc9a7('0x14'))},{'where':{'id':_0x51e986}});}})[_0xc9a7('0x15')](function(){if(_0x51e986&&_0x51e986[_0xc9a7('0x16')]){logger['info'](_0xc9a7('0x17'),_0x51e986[_0xc9a7('0xf')]());for(var _0x47e688=0x0;_0x47e688<_0x51e986[_0xc9a7('0x16')];_0x47e688++){io['emit'](_0xc9a7('0x18'),{'id':_0x51e986[_0x47e688],'closed':!![]});}}})[_0xc9a7('0x19')](function(_0x5bacb7){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x5bacb7?util['inspect'](_0x5bacb7,{'showHidden':![],'depth':null}):'');});}exports[_0xc9a7('0x1a')]=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 15b619e..8600965 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 _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 +var _0x3bfa=['text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','info','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','keys','jobs','toString','keyBy','intersection','difference','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','startAt','endAt','add','start','add\x20cron','exists','stop','stop\x20cron','length','update','run','util','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','user','email','subtractUnit','join','../../files/reports','savename','%s.%s','basename','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify'];(function(_0x5dd383,_0x52de28){var _0x7dc7b3=function(_0x2386a6){while(--_0x2386a6){_0x5dd383['push'](_0x5dd383['shift']());}};_0x7dc7b3(++_0x52de28);}(_0x3bfa,0x141));var _0xa3bf=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x3bfa[_0xdea41a];return _0x15d0d8;};'use strict';var fs=require('fs');var util=require(_0xa3bf('0x0'));var path=require('path');var _=require(_0xa3bf('0x1'));var moment=require(_0xa3bf('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xa3bf('0x3'));var BPromise=require(_0xa3bf('0x4'));var logger=require(_0xa3bf('0x5'))(_0xa3bf('0x6'));var db=require(_0xa3bf('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xa3bf('0x8'));var client=jayson[_0xa3bf('0x9')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2a0260,_0x4890b4){return function(){logger['info'](_0xa3bf('0xa'),_0x2a0260['email']);var _0x22b970=!![];var _0x2694de={'tls':{'rejectUnauthorized':![]}};if(_0x2a0260[_0xa3bf('0xb')][_0xa3bf('0xc')][_0xa3bf('0xd')]){_0x2694de[_0xa3bf('0xd')]=_0x2a0260[_0xa3bf('0xb')][_0xa3bf('0xc')]['service'];}else{_0x2694de[_0xa3bf('0xe')]=_0x2a0260[_0xa3bf('0xb')][_0xa3bf('0xc')][_0xa3bf('0xe')];_0x2694de[_0xa3bf('0xf')]=_0x2a0260[_0xa3bf('0xb')][_0xa3bf('0xc')][_0xa3bf('0xf')];_0x2694de['secure']=_0x2a0260[_0xa3bf('0xb')]['Smtp'][_0xa3bf('0x10')];}if(_0x2a0260['MailAccount'][_0xa3bf('0xc')][_0xa3bf('0x11')]){_0x2694de[_0xa3bf('0x12')]={'user':_0x2a0260[_0xa3bf('0xb')][_0xa3bf('0xc')]['user'],'pass':_0x2a0260[_0xa3bf('0xb')]['Smtp'][_0xa3bf('0x13')]};}var _0x262443={'account':_0x2694de,'message':{'from':util[_0xa3bf('0x14')](_0xa3bf('0x15'),_0x2a0260['MailAccount'][_0xa3bf('0x16')],_0x2a0260[_0xa3bf('0xb')]['email']||_0x2a0260['MailAccount']['Smtp'][_0xa3bf('0x17')]),'to':_0x2a0260[_0xa3bf('0x18')],'cc':_0x2a0260['cc'],'bcc':_0x2a0260['bcc'],'subject':util[_0xa3bf('0x14')]('Report\x20%s\x20last\x20%s\x20%s',_0x4890b4[_0xa3bf('0x16')],_0x2a0260['subtractNumber'],_0x2a0260[_0xa3bf('0x19')])}};var _0x1de452=path[_0xa3bf('0x1a')](__dirname,_0xa3bf('0x1b'));var _0x1fb0ff=_0x4890b4[_0xa3bf('0x1c')];var _0x712c28=util[_0xa3bf('0x14')](_0xa3bf('0x1d'),path[_0xa3bf('0x1e')](_0x4890b4[_0xa3bf('0x1c')],path['extname'](_0x4890b4[_0xa3bf('0x1c')])),_0xa3bf('0x1f'));var _0x4ca2cc=path[_0xa3bf('0x1a')](_0x1de452,_0x1fb0ff);var _0x392ca0=path['join'](_0x1de452,_0x712c28);if(fs[_0xa3bf('0x20')](_0x4ca2cc)){_0x4890b4[_0xa3bf('0x21')]=_0xa3bf('0x22');_0x262443[_0xa3bf('0x23')][_0xa3bf('0x24')]=[{'filename':_0x1fb0ff,'path':_0x4ca2cc}];_0x262443[_0xa3bf('0x23')]['text']=util['format'](_0xa3bf('0x25'),JSON[_0xa3bf('0x26')](_0x4890b4,null,0x2));}else if(fs['existsSync'](_0x392ca0)){_0x4890b4[_0xa3bf('0x21')]=_0xa3bf('0x22');_0x262443['message'][_0xa3bf('0x24')]=[{'filename':_0x712c28,'path':_0x392ca0}];}else{_0x262443[_0xa3bf('0x23')][_0xa3bf('0x27')]=_0xa3bf('0x28');if(!_0x2a0260[_0xa3bf('0x29')]){_0x22b970=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x22b970){return client[_0xa3bf('0x2a')](_0xa3bf('0x2b'),_0x262443)[_0xa3bf('0x2c')](function(_0xe95b96){if(_0xe95b96[_0xa3bf('0x2d')]){return logger[_0xa3bf('0x2d')](_0xa3bf('0x2e'),JSON[_0xa3bf('0x26')](_0xe95b96));}return logger[_0xa3bf('0x2f')]('email\x20sent');})[_0xa3bf('0x30')](function(_0x4e4891){return logger[_0xa3bf('0x2d')]('error\x20mail',JSON[_0xa3bf('0x26')](_0x4e4891));});}};}function handleError(){return function(_0x21d6e8){return logger['error'](JSON['stringify'](_0x21d6e8));};}function handleResult(_0x1b113b){return function(_0x5571a8){logger[_0xa3bf('0x2f')](_0xa3bf('0x31'),JSON[_0xa3bf('0x26')](_0x5571a8));if(_0x1b113b[_0xa3bf('0xb')]&&_0x1b113b[_0xa3bf('0xb')][_0xa3bf('0xc')]&&!_[_0xa3bf('0x32')](_0x1b113b[_0xa3bf('0x18')])){setTimeout(handleSendEmail(_0x1b113b,_0x5571a8),0x3c*0x3e8);}};}function handleJob(_0xb078e2){return function(){try{if(_[_0xa3bf('0x32')](_0xb078e2[_0xa3bf('0x33')])){return logger[_0xa3bf('0x2f')](_0xa3bf('0x34'));}if(_[_0xa3bf('0x32')](_0xb078e2[_0xa3bf('0x19')])){return logger[_0xa3bf('0x2f')](_0xa3bf('0x35'));}var _0x414e59={'startDate':moment()[_0xa3bf('0x36')](_0xb078e2[_0xa3bf('0x33')],_0xb078e2[_0xa3bf('0x19')])[_0xa3bf('0x14')](_0xa3bf('0x37')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0xb078e2[_0xa3bf('0x38')],'name':_0xb078e2[_0xa3bf('0x16')]};if(!_[_0xa3bf('0x32')](_0xb078e2[_0xa3bf('0x39')])){logger[_0xa3bf('0x2f')](_0xa3bf('0x3a'),_0xb078e2['DefaultReportId']);return analyticDefaultReportController[_0xa3bf('0x3b')]({'id':_0xb078e2['DefaultReportId']},_0x414e59)['then'](handleResult(_0xb078e2))['catch'](handleError());}if(!_[_0xa3bf('0x32')](_0xb078e2[_0xa3bf('0x3c')])){logger[_0xa3bf('0x2f')](_0xa3bf('0x3d'),_0xb078e2[_0xa3bf('0x3c')]);return analyticCustomReportController[_0xa3bf('0x3b')]({'id':_0xb078e2['CustomReportId']},_0x414e59)[_0xa3bf('0x2c')](handleResult(_0xb078e2))[_0xa3bf('0x30')](handleError());}}catch(_0x5152c5){logger['error'](JSON[_0xa3bf('0x26')](_0x5152c5));}return logger[_0xa3bf('0x2f')](_0xa3bf('0x3e'));};}function getJobs(_0x12c2ec){var _0x30857f={};if(_0x12c2ec){_0x30857f['id']=_0x12c2ec;}return db[_0xa3bf('0x3f')]['findAll']({'where':_0x30857f,'include':[{'model':db[_0xa3bf('0xb')],'attributes':['id','name','email'],'include':[{'model':db[_0xa3bf('0x40')],'as':_0xa3bf('0xc')}]}]})[_0xa3bf('0x2c')](function(_0x1cc0a6){var _0x237121=_[_0xa3bf('0x41')](manager[_0xa3bf('0x42')]);var _0x562f4e=_['map'](_0x1cc0a6,function(_0x2d98d3){return _0x2d98d3['id'][_0xa3bf('0x43')]();});var _0x547881=_[_0xa3bf('0x44')](_0x1cc0a6,function(_0xeb548e){return _0xeb548e['id']['toString']();});var _0x2a4ef1=_0x12c2ec?_0x562f4e:_['difference'](_0x562f4e,_0x237121);var _0x121409=_[_0xa3bf('0x45')](_0x562f4e,_0x237121);var _0x475fdf=_[_0xa3bf('0x46')](_0x237121,_0x562f4e);var _0x3995cc;var _0xe61f3e;for(_0x3995cc=0x0;_0x3995cc<_0x475fdf['length']&&!_0x12c2ec;_0x3995cc+=0x1){_0xe61f3e=_0x475fdf[_0x3995cc][_0xa3bf('0x43')]();if(manager['exists'](_0xe61f3e)){manager['stop'](_0xe61f3e);manager[_0xa3bf('0x47')](_0xe61f3e);logger[_0xa3bf('0x2f')](_0xa3bf('0x48'),_0xe61f3e);}}logger[_0xa3bf('0x2f')](_0xa3bf('0x49'),JSON['stringify'](_0x2a4ef1));for(_0x3995cc=0x0;_0x3995cc<_0x2a4ef1['length'];_0x3995cc+=0x1){_0xe61f3e=_0x2a4ef1[_0x3995cc][_0xa3bf('0x43')]();logger[_0xa3bf('0x2f')](_0xa3bf('0x4a'),_0xe61f3e);if(_0x12c2ec){logger[_0xa3bf('0x2f')](_0xa3bf('0x4b'),_0x12c2ec);logger['info'](JSON[_0xa3bf('0x26')](_0x547881[_0xe61f3e]));BPromise['resolve']()[_0xa3bf('0x2c')](handleJob(_0x547881[_0xe61f3e]));logger['info'](_0xa3bf('0x4c'),_0x547881[_0xe61f3e][_0xa3bf('0x16')],_0x547881[_0xe61f3e][_0xa3bf('0x4d')]);}else if(_0x547881[_0xe61f3e][_0xa3bf('0x4d')]&&_0x547881[_0xe61f3e][_0xa3bf('0x4e')]&&moment()['isBetween'](_0x547881[_0xe61f3e][_0xa3bf('0x4f')],_0x547881[_0xe61f3e][_0xa3bf('0x50')])){manager[_0xa3bf('0x51')](_0xe61f3e,_0x547881[_0xe61f3e][_0xa3bf('0x4d')],handleJob(_0x547881[_0xe61f3e]));manager[_0xa3bf('0x52')](_0xe61f3e);logger[_0xa3bf('0x2f')](_0xa3bf('0x53'),_0x547881[_0xe61f3e][_0xa3bf('0x16')],_0x547881[_0xe61f3e][_0xa3bf('0x4d')]);}else if(manager[_0xa3bf('0x54')](_0xe61f3e)){manager[_0xa3bf('0x55')](_0xe61f3e);manager[_0xa3bf('0x47')](_0xe61f3e);logger[_0xa3bf('0x2f')](_0xa3bf('0x56'),_0x547881[_0xe61f3e][_0xa3bf('0x16')],_0x547881[_0xe61f3e][_0xa3bf('0x4d')]);}}for(_0x3995cc=0x0,_0xe61f3e;_0x3995cc<_0x121409[_0xa3bf('0x57')]&&!_0x12c2ec;_0x3995cc+=0x1){_0xe61f3e=_0x121409[_0x3995cc][_0xa3bf('0x43')]();if(manager['exists'](_0xe61f3e)){if(_0x547881[_0xe61f3e][_0xa3bf('0x4d')]&&_0x547881[_0xe61f3e][_0xa3bf('0x4e')]&&moment()['isBetween'](_0x547881[_0xe61f3e][_0xa3bf('0x4f')],_0x547881[_0xe61f3e][_0xa3bf('0x50')])){manager[_0xa3bf('0x58')](_0xe61f3e,_0x547881[_0xe61f3e]['cron'],handleJob(_0x547881[_0xe61f3e]));logger[_0xa3bf('0x2f')]('update\x20cron',_0x547881[_0xe61f3e][_0xa3bf('0x16')],_0x547881[_0xe61f3e][_0xa3bf('0x4d')]);}else{manager['stop'](_0xe61f3e);manager[_0xa3bf('0x47')](_0xe61f3e);logger[_0xa3bf('0x2f')](_0xa3bf('0x56'),_0x547881[_0xe61f3e][_0xa3bf('0x16')],_0x547881[_0xe61f3e][_0xa3bf('0x4d')]);}}}})[_0xa3bf('0x30')](function(_0x2d7c24){logger[_0xa3bf('0x2d')](JSON[_0xa3bf('0x26')](_0x2d7c24));});}exports[_0xa3bf('0x59')]=function(_0x561447){return getJobs(_0x561447);};exports['start']=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 af20f9a..586efdf 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 _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 +var _0xdc5e=['Positive','Mixed','name','SequelizeValidationError','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','error','start','lodash','aws-sdk','util','bluebird','../../mysqldb','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Neutral','FAILED','FailureReason','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20configured'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xdc5e,0x1c1));var _0xedc5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdc5e[_0x321bb2];return _0x9c12ed;};var _=require(_0xedc5('0x0'));var AWS=require(_0xedc5('0x1'));var rp=require('request-promise');var util=require(_0xedc5('0x2'));var BPromise=require(_0xedc5('0x3'));var db=require(_0xedc5('0x4'))['db'];var logger=require('../../config/logger')(_0xedc5('0x5'));function getTranscriptionJob(_0x580703,_0x26a6f7,_0x49559b,_0x4650be){return new Promise(function(_0x1b417e,_0x4aee33){var _0x4b876e=new AWS['TranscribeService']({'accessKeyId':_0x26a6f7,'secretAccessKey':_0x580703,'region':_0x49559b});_0x4b876e[_0xedc5('0x6')]({'TranscriptionJobName':_0x4650be},function(_0x2c6bab,_0x11b08c){if(_0x2c6bab){return _0x4aee33(_0x2c6bab);}else{return _0x1b417e(_0x11b08c);}});});}function sentiment(_0x441814,_0x4e65c2,_0x460877,_0x52ce44,_0x335825){return new Promise(function(_0x58b01d,_0x5efc9d){var _0x1fbce5=new AWS[(_0xedc5('0x7'))]({'accessKeyId':_0x4e65c2,'secretAccessKey':_0x441814,'region':_0x460877});_0x1fbce5[_0xedc5('0x8')]({'Text':_0x52ce44,'LanguageCode':_0x335825[_0xedc5('0x9')](0x0,0x2)},function(_0x2bc02e,_0x145ad8){if(_0x2bc02e){return _0x5efc9d(_0x2bc02e);}else{return _0x58b01d(_0x145ad8);}});});}function checkTranscribeJob(_0x44d3c8,_0x5d7151,_0x5c7634){var _0x49d78c;return new BPromise(function(_0x3941a5,_0x20987f){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0xc'),_0x44d3c8['id'],_0x44d3c8[_0xedc5('0xd')]));return getTranscriptionJob(_0x5c7634[_0xedc5('0xe')],_0x5c7634[_0xedc5('0xf')],_0x5d7151[_0xedc5('0x10')],_0x44d3c8[_0xedc5('0xd')])[_0xedc5('0x11')](function(_0x427c82){logger[_0xedc5('0xa')](util[_0xedc5('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x44d3c8['id'],_0x44d3c8['transcribeName'],_0x427c82['TranscriptionJob'][_0xedc5('0x12')]));if(!_0x44d3c8[_0xedc5('0x13')]){switch(_0x427c82[_0xedc5('0x14')][_0xedc5('0x12')]){case _0xedc5('0x15'):var _0x34aeb9={'transcribeStatus':_0x427c82[_0xedc5('0x14')]['TranscriptionJobStatus'],'fileUri':_0x427c82[_0xedc5('0x14')][_0xedc5('0x16')][_0xedc5('0x17')]};logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x18'),_0x44d3c8['id']));return rp({'uri':_0x427c82[_0xedc5('0x14')][_0xedc5('0x16')][_0xedc5('0x17')],'json':!![]})['then'](function(_0x2081c7){logger['info'](util[_0xedc5('0xb')](_0xedc5('0x19'),_0x44d3c8['id']));if(_0x2081c7&&_0x2081c7[_0xedc5('0x1a')]&&_0x2081c7[_0xedc5('0x1a')][_0xedc5('0x1b')]&&_0x2081c7['results'][_0xedc5('0x1b')][_0xedc5('0x1c')]){_0x34aeb9[_0xedc5('0x13')]='';for(var _0x2bfa01=0x0;_0x2bfa01<_0x2081c7[_0xedc5('0x1a')]['transcripts']['length'];_0x2bfa01++){_0x34aeb9[_0xedc5('0x13')]+=_0x2081c7[_0xedc5('0x1a')][_0xedc5('0x1b')][_0x2bfa01][_0xedc5('0x1d')]+'';}}return _0x44d3c8[_0xedc5('0x1e')](_0x34aeb9);})['then'](function(){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x1f'),_0x44d3c8['id']));if(!_0x44d3c8[_0xedc5('0x20')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x23'));}if(!_0x5d7151[_0xedc5('0x24')]||!_0x5d7151['sentimentAccountId']||!_0x5d7151[_0xedc5('0x25')]||!_0x5d7151[_0xedc5('0x26')]||!_0x5d7151[_0xedc5('0x27')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x28'));}if(!_0x34aeb9[_0xedc5('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0x5d7151[_0xedc5('0x29')]===_0x5c7634['id']){return _0x5c7634;}else{return db[_0xedc5('0x2a')][_0xedc5('0x2b')]({'where':{'id':_settings[_0xedc5('0x29')]}});}})[_0xedc5('0x11')](function(_0x2ce4cd){if(!_0x2ce4cd){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x2c'));}if(!_0x2ce4cd['data1']||!_0x2ce4cd['data2']){throw new db[(_0xedc5('0x21'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x49d78c=_0x2ce4cd;logger['info'](util[_0xedc5('0xb')](_0xedc5('0x2d'),_0x44d3c8['id']));return sentiment(_0x49d78c[_0xedc5('0xe')],_0x49d78c[_0xedc5('0xf')],_0x5d7151['sentimentRegion'],_0x34aeb9[_0xedc5('0x13')],_0x5d7151[_0xedc5('0x26')]);})[_0xedc5('0x11')](function(_0x1cf569){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x2e'),_0x44d3c8['id']));return _0x44d3c8[_0xedc5('0x1e')]({'sentiment':_0x1cf569[_0xedc5('0x2f')],'sPositive':_0x1cf569[_0xedc5('0x30')]['Positive'],'sNegative':_0x1cf569[_0xedc5('0x30')][_0xedc5('0x31')],'sMixed':_0x1cf569[_0xedc5('0x30')]['Mixed'],'sNeutral':_0x1cf569[_0xedc5('0x30')][_0xedc5('0x32')]});})[_0xedc5('0x11')](function(){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x1f'),_0x44d3c8['id']));_0x3941a5();});case _0xedc5('0x33'):return _0x44d3c8[_0xedc5('0x1e')]({'transcribeStatus':_0xedc5('0x33'),'failureReason':_0x427c82[_0xedc5('0x14')][_0xedc5('0x34')]})[_0xedc5('0x11')](function(){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x1f'),_0x44d3c8['id']));_0x3941a5();});default:logger['info'](util[_0xedc5('0xb')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x44d3c8['id']));break;}}else{return BPromise['resolve']()['then'](function(){if(!_0x44d3c8[_0xedc5('0x20')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5d7151[_0xedc5('0x24')]||!_0x5d7151[_0xedc5('0x29')]||!_0x5d7151[_0xedc5('0x25')]||!_0x5d7151[_0xedc5('0x26')]||!_0x5d7151[_0xedc5('0x27')]){throw new db[(_0xedc5('0x21'))]['ValidationError'](_0xedc5('0x28'));}if(!_0x44d3c8['fileText']){throw new Error(_0xedc5('0x35'));}if(_0x5d7151[_0xedc5('0x29')]===_0x5c7634['id']){return _0x5c7634;}else{return db['CloudProvider'][_0xedc5('0x2b')]({'where':{'id':_settings[_0xedc5('0x29')]}});}})['then'](function(_0x2e2b6f){if(!_0x2e2b6f){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x2c'));}if(!_0x2e2b6f[_0xedc5('0xe')]||!_0x2e2b6f[_0xedc5('0xf')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x36'));}_0x49d78c=_0x2e2b6f;logger['info'](util[_0xedc5('0xb')](_0xedc5('0x2d'),_0x44d3c8['id']));return sentiment(_0x49d78c[_0xedc5('0xe')],_0x49d78c[_0xedc5('0xf')],_0x5d7151[_0xedc5('0x25')],_0x44d3c8[_0xedc5('0x13')],_0x5d7151[_0xedc5('0x26')]);})[_0xedc5('0x11')](function(_0x119450){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x2e'),_0x44d3c8['id']));return _0x44d3c8[_0xedc5('0x1e')]({'sentiment':_0x119450['Sentiment'],'sPositive':_0x119450[_0xedc5('0x30')][_0xedc5('0x37')],'sNegative':_0x119450[_0xedc5('0x30')]['Negative'],'sMixed':_0x119450['SentimentScore'][_0xedc5('0x38')],'sNeutral':_0x119450[_0xedc5('0x30')][_0xedc5('0x32')],'transcribeStatus':_0xedc5('0x15')});})[_0xedc5('0x11')](function(){logger[_0xedc5('0xa')](util[_0xedc5('0xb')](_0xedc5('0x1f'),_0x44d3c8['id']));_0x3941a5();});}})['catch'](function(_0x27a097){if(_0x27a097){if(!_0x27a097[_0xedc5('0x39')]||_0x27a097[_0xedc5('0x39')]!==_0xedc5('0x3a')){logger['error'](util[_0xedc5('0xb')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x44d3c8['id']),util[_0xedc5('0x3b')](_0x27a097,{'showHidden':![],'depth':null}));}}_0x3941a5();});});}function checkTranscribe(){var _0x2b8ccf;var _0x346bbc;var _0x53f45;return db[_0xedc5('0x3c')]['findAll']({'where':{'transcribeStatus':_0xedc5('0x3d')}})[_0xedc5('0x11')](function(_0xa21683){if(!_0xa21683||!_0xa21683[_0xedc5('0x1c')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x3e'));}_0x2b8ccf=_0xa21683;return db['Setting'][_0xedc5('0x2b')]({'where':{'id':0x1}});})[_0xedc5('0x11')](function(_0x4fca04){if(!_0x4fca04){throw new db['Sequelize'][(_0xedc5('0x22'))](_0xedc5('0x3f'));}_0x346bbc=_0x4fca04;if(!_0x346bbc[_0xedc5('0x5')]||!_0x346bbc[_0xedc5('0x40')]||!_0x346bbc[_0xedc5('0x10')]||!_0x346bbc[_0xedc5('0x26')]||!_0x346bbc[_0xedc5('0x27')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x41'));}return db[_0xedc5('0x2a')][_0xedc5('0x2b')]({'where':{'id':_0x346bbc[_0xedc5('0x40')]}});})[_0xedc5('0x11')](function(_0x4ced15){if(!_0x4ced15){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x2c'));}if(!_0x4ced15['data1']||!_0x4ced15[_0xedc5('0xf')]){throw new db[(_0xedc5('0x21'))][(_0xedc5('0x22'))](_0xedc5('0x36'));}_0x53f45=_0x4ced15;var _0x301118=[];_0x2b8ccf[_0xedc5('0x42')](function(_0x3a6041){_0x301118[_0xedc5('0x43')](checkTranscribeJob(_0x3a6041,_0x346bbc,_0x53f45));});return BPromise[_0xedc5('0x44')](_0x301118);})[_0xedc5('0x45')](function(_0x4133f8){if(_0x4133f8){if(!_0x4133f8[_0xedc5('0x39')]||_0x4133f8['name']!==_0xedc5('0x3a')){logger[_0xedc5('0x46')](util[_0xedc5('0x3b')](_0x4133f8,{'showHidden':![],'depth':null}));}}});}exports[_0xedc5('0x47')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 904cb01..e3fe410 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 _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 +var _0x283f=['[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error'];(function(_0x33008b,_0x1a7d3a){var _0x5d1efb=function(_0x3aed56){while(--_0x3aed56){_0x33008b['push'](_0x33008b['shift']());}};_0x5d1efb(++_0x1a7d3a);}(_0x283f,0x1d4));var _0xf283=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x283f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf283('0x0'));var moment=require(_0xf283('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0xf283('0x2'));var db=require(_0xf283('0x3'))['db'];var logger=require(_0xf283('0x4'))(_0xf283('0x5'));config[_0xf283('0x6')]=_[_0xf283('0x7')](config[_0xf283('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xf283('0x8'))(new Redis(config[_0xf283('0x6')]));function closeInteractions(){var _0x4d31c3=[];return db[_0xf283('0x9')][_0xf283('0xa')]({'raw':!![],'attributes':['id',_0xf283('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf283('0xc')](0x18,_0xf283('0xd'))}}})[_0xf283('0xe')](function(_0x1c13c0){if(_0x1c13c0&&_0x1c13c0[_0xf283('0xf')]){_0x4d31c3=_[_0xf283('0x10')](_0x1c13c0||[],'id');logger[_0xf283('0x11')](_0xf283('0x12'),_0x4d31c3[_0xf283('0x13')]());return db[_0xf283('0x9')][_0xf283('0x14')]({'closeReason':'system','disposition':_0xf283('0x15'),'closed':!![],'closedAt':moment()[_0xf283('0x16')](_0xf283('0x17'))},{'where':{'id':_0x4d31c3}});}})[_0xf283('0xe')](function(){if(_0x4d31c3&&_0x4d31c3[_0xf283('0xf')]){logger['info'](_0xf283('0x18'),_0x4d31c3[_0xf283('0x13')]());for(var _0x483765=0x0;_0x483765<_0x4d31c3[_0xf283('0xf')];_0x483765++){io['emit'](_0xf283('0x19'),{'id':_0x4d31c3[_0x483765],'closed':!![]});}}})[_0xf283('0x1a')](function(_0x2a87b9){logger[_0xf283('0x1b')](_0xf283('0x1c'),_0x2a87b9?util[_0xf283('0x1d')](_0x2a87b9,{'showHidden':![],'depth':null}):'');});}exports[_0xf283('0x1e')]=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 c687b7c..b03f257 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1a73=['Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','hopper2','../mysqldb','Innocenzo'];(function(_0x19500a,_0x317e84){var _0x21f791=function(_0x437e7d){while(--_0x437e7d){_0x19500a['push'](_0x19500a['shift']());}};_0x21f791(++_0x317e84);}(_0x1a73,0x86));var _0x31a7=function(_0x555b1a,_0x24e00a){_0x555b1a=_0x555b1a-0x0;var _0x3e90f9=_0x1a73[_0x555b1a];return _0x3e90f9;};'use strict';var util=require('util');var db=require(_0x31a7('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x31a7('0x1')+i,'lastName':_0x31a7('0x2')+i,'phone':0xf879fb460+i,'email':_0x31a7('0x3')+i+_0x31a7('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x31a7('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x31a7('0x6')](),'updatedAt':Date[_0x31a7('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x31a7('0x5')]({'id':i,'firstName':_0x31a7('0x1')+i,'lastName':_0x31a7('0x2')+i,'phone':0xf879fb460+i,'email':_0x31a7('0x3')+i+_0x31a7('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x31a7('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x31a7('0x6')](),'updatedAt':Date[_0x31a7('0x6')]()});}db[_0x31a7('0x7')][_0x31a7('0x8')]({'where':{}})[_0x31a7('0x9')](function(){return db['CmContact'][_0x31a7('0xa')](contacts);})[_0x31a7('0x9')](function(){console[_0x31a7('0xb')](_0x31a7('0xc'),_0x31a7('0xd'));return db[_0x31a7('0xe')]['destroy']({'where':{}});})[_0x31a7('0x9')](function(){return db[_0x31a7('0xe')][_0x31a7('0xa')](hopper);})[_0x31a7('0x9')](function(){console[_0x31a7('0xb')]('finished\x20populating',_0x31a7('0xf'));return db[_0x31a7('0x7')][_0x31a7('0xa')](contacts2);})['then'](function(){console[_0x31a7('0xb')](_0x31a7('0xc'),'contacts2');return db[_0x31a7('0xe')][_0x31a7('0xa')](hopper2);})[_0x31a7('0x9')](function(){console['log'](_0x31a7('0xc'),_0x31a7('0x10'));})['catch'](function(_0x5ba197){console[_0x31a7('0xb')](_0x5ba197);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index db0ebc6..03dfc01 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x22bb=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','bulkCreate','then','log','add\x20user','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all'];(function(_0x29a986,_0x18d77d){var _0xd4a8a4=function(_0x508a12){while(--_0x508a12){_0x29a986['push'](_0x29a986['shift']());}};_0xd4a8a4(++_0x18d77d);}(_0x22bb,0x90));var _0xb22b=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x22bb[_0x42245d];return _0x4b211a;};'use strict';var util=require('util');var db=require(_0xb22b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xb22b('0x1')](_0xb22b('0x2'),_0xb22b('0x3'),i),'fullname':util['format'](_0xb22b('0x2'),_0xb22b('0x3'),i),'email':util['format'](_0xb22b('0x4'),_0xb22b('0x3'),i),'role':_0xb22b('0x3'),'password':_0xb22b('0x5'),'internal':0xfa0+i,'type':_0xb22b('0x6'),'transport':['udp','ws',_0xb22b('0x7')],'disallow':[_0xb22b('0x8')],'allow':[_0xb22b('0x9')],'defaultuser':util['format'](_0xb22b('0x2'),_0xb22b('0x3'),i),'encryption':_0xb22b('0xa'),'avpf':'yes','force_avp':_0xb22b('0xa'),'icesupport':'yes','dtlsenable':_0xb22b('0xa'),'dtlsverify':'no','dtlscertfile':_0xb22b('0xb'),'dtlsprivatekey':_0xb22b('0xc'),'dtlssetup':'actpass','callerid':util[_0xb22b('0x1')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0xb22b('0x3'),i),0xfa0+i)});}db['User'][_0xb22b('0xd')](users)[_0xb22b('0xe')](function(){console[_0xb22b('0xf')](_0xb22b('0x10'));})['catch'](function(_0x5bbac8){console[_0xb22b('0xf')](_0x5bbac8);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 7ec9987..a1a38db 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x2904=['find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','voice:outbound','OpenchannelQueues','getVoiceQueues','getFaxQueues','getMailQueues','getWhatsappQueues','all','voice','chat','fax','sms','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','user_has_mail_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','setMaxListeners','address','request','connection','remotePort','connectedAt','nsp','CONNECTED','util','../mysqldb','./environment','name','Agents','role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','%s:queue:%s','length','format','query','User'];(function(_0x201520,_0x279262){var _0x2cb0d4=function(_0x298770){while(--_0x298770){_0x201520['push'](_0x201520['shift']());}};_0x2cb0d4(++_0x279262);}(_0x2904,0xf1));var _0x4290=function(_0x5d7fa6,_0x229b3e){_0x5d7fa6=_0x5d7fa6-0x0;var _0x26ae74=_0x2904[_0x5d7fa6];return _0x26ae74;};'use strict';var _=require('lodash');var util=require(_0x4290('0x0'));var BPromise=require('bluebird');var db=require(_0x4290('0x1'))['db'];var config=require(_0x4290('0x2'));var queryQueues={'attributes':['id',_0x4290('0x3')],'include':[{'as':_0x4290('0x4'),'model':db['User'],'attributes':['id',_0x4290('0x3'),_0x4290('0x5')],'raw':!![],'where':{'role':_0x4290('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x4290('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4290('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x4290('0x3')],'where':{'role':_0x4290('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4290('0x3'),_0x4290('0x8')],'where':{'type':_0x4290('0x9')}};function getAssociatedResources(_0x1a7770,_0x4dcb5f,_0x530be2){return db['UserProfileSection'][_0x4290('0xa')]({'where':{'name':_0x1a7770,'userProfileId':_0x4dcb5f},'raw':!![]})[_0x4290('0xb')](function(_0x48a440){if(_0x48a440){if(_0x48a440[_0x4290('0xc')]){switch(_0x1a7770){case _0x4290('0xd'):case _0x4290('0xe'):case _0x4290('0xf'):case _0x4290('0x10'):case _0x4290('0x11'):case'OpenchannelQueues':case _0x4290('0x12'):return db[_0x530be2][_0x4290('0x13')](queryQueues);case _0x4290('0x14'):return db[_0x530be2][_0x4290('0x13')](queryTelephones);case'Trunks':return db[_0x530be2][_0x4290('0x13')](queryTrunks);case _0x4290('0x15'):return db[_0x530be2][_0x4290('0x13')](queryCampaigns);}}else{return db[_0x4290('0x16')][_0x4290('0x13')]({'attributes':[_0x4290('0x17')],'where':{'sectionId':_0x48a440['id']},'raw':!![]})[_0x4290('0xb')](function(_0x40fdcd){if(_0x40fdcd){var _0xec2367={'where':{'id':_[_0x4290('0x18')](_0x40fdcd,_0x4290('0x17'))},'raw':!![]};switch(_0x530be2){case'User':_0xec2367[_0x4290('0x19')]['role']=_0x4290('0x7');break;case _0x4290('0x1a'):_0xec2367[_0x4290('0x19')][_0x4290('0x8')]=_0x4290('0x9');break;}return db[_0x530be2][_0x4290('0x13')](_0xec2367);}else{return[];}});}}else{return[];}})['then'](function(_0x431f0a){return _0x431f0a;});}function joinOrLeaveQueues(_0x1b09fe,_0x7a0c00,_0x365c93,_0x27317a){_0x1b09fe[_0x7a0c00](util['format'](_0x4290('0x1b'),_0x365c93,_0x27317a[_0x4290('0x3')]));if(_0x27317a[_0x4290('0x4')]){for(var _0x4c258c=0x0;_0x4c258c<_0x27317a[_0x4290('0x4')][_0x4290('0x1c')];_0x4c258c+=0x1){_0x1b09fe[_0x7a0c00](util[_0x4290('0x1d')]('user:%s',_0x27317a[_0x4290('0x4')][_0x4c258c][_0x4290('0x3')]));}}}function joinOrLeave(_0x9311f4,_0x962354,_0x2636ff){var _0x9542b4;if(_0x9311f4['handshake'][_0x4290('0x1e')]['id']){db[_0x4290('0x1f')][_0x4290('0x20')]({'attributes':['id',_0x4290('0x3'),_0x4290('0x5'),_0x4290('0x21')],'where':{'id':_0x9311f4[_0x4290('0x22')]['query']['id']},'include':[{'model':db[_0x4290('0x23')],'as':_0x4290('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x4290('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x4290('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x4290('0x27')],'as':_0x4290('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x4290('0x29')],'as':_0x4290('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x4290('0x2b')],'as':_0x4290('0x2c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x20e1ff){if(_0x20e1ff){_0x9542b4=_0x20e1ff;_0x9311f4[_0x962354](util['format']('user:%s',_0x20e1ff[_0x4290('0x3')]));var _0x57e989=[];switch(_0x20e1ff['role']){case'admin':_0x9311f4[_0x962354]('voice:inbound');_0x9311f4[_0x962354]('voice:outbound');if(queryQueues[_0x4290('0x2d')](_0x4290('0x2e'))){delete queryQueues[_0x4290('0x2e')];}_0x57e989[_0x4290('0x2f')](db[_0x4290('0x30')][_0x4290('0x13')](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x31')]['findAll'](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x32')][_0x4290('0x13')](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x33')]['findAll'](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x34')]['findAll'](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x35')][_0x4290('0x13')](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x36')][_0x4290('0x13')](queryQueues));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x1f')]['findAll'](queryTelephones));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x37')][_0x4290('0x13')](queryTrunks));_0x57e989['push'](db[_0x4290('0x1a')][_0x4290('0x13')](queryCampaigns));_0x57e989[_0x4290('0x2f')](db['User']['findAll'](queryAgents));break;case _0x4290('0x38'):_0x9311f4[_0x962354](_0x4290('0x39'));_0x9311f4[_0x962354](_0x4290('0x3a'));_0x57e989[_0x4290('0x2f')](getAssociatedResources(_0x4290('0xd'),_0x20e1ff[_0x4290('0x21')],'VoiceQueue'));_0x57e989[_0x4290('0x2f')](getAssociatedResources(_0x4290('0xe'),_0x20e1ff[_0x4290('0x21')],_0x4290('0x31')));_0x57e989[_0x4290('0x2f')](getAssociatedResources(_0x4290('0xf'),_0x20e1ff[_0x4290('0x21')],_0x4290('0x32')));_0x57e989[_0x4290('0x2f')](getAssociatedResources(_0x4290('0x10'),_0x20e1ff['userProfileId'],'SmsQueue'));_0x57e989[_0x4290('0x2f')](getAssociatedResources(_0x4290('0x11'),_0x20e1ff[_0x4290('0x21')],_0x4290('0x34')));_0x57e989['push'](getAssociatedResources(_0x4290('0x3b'),_0x20e1ff[_0x4290('0x21')],_0x4290('0x35')));_0x57e989['push'](getAssociatedResources('WhatsappQueues',_0x20e1ff[_0x4290('0x21')],_0x4290('0x36')));_0x57e989[_0x4290('0x2f')](getAssociatedResources('Telephones',_0x20e1ff[_0x4290('0x21')],_0x4290('0x1f')));_0x57e989[_0x4290('0x2f')](getAssociatedResources('Trunks',_0x20e1ff[_0x4290('0x21')],_0x4290('0x37')));_0x57e989[_0x4290('0x2f')](getAssociatedResources(_0x4290('0x15'),_0x20e1ff[_0x4290('0x21')],_0x4290('0x1a')));_0x57e989[_0x4290('0x2f')](db[_0x4290('0x1f')][_0x4290('0x13')](queryAgents));break;case'agent':_0x9311f4[_0x962354](_0x4290('0x39'));_0x9311f4[_0x962354](_0x4290('0x3a'));_0x57e989[_0x4290('0x2f')](_0x20e1ff[_0x4290('0x3c')]({'attributes':['id',_0x4290('0x3')]}));_0x57e989['push'](_0x20e1ff['getChatQueues']({'attributes':['id','name']}));_0x57e989[_0x4290('0x2f')](_0x20e1ff[_0x4290('0x3d')]({'attributes':['id',_0x4290('0x3')]}));_0x57e989[_0x4290('0x2f')](_0x20e1ff['getSmsQueues']({'attributes':['id',_0x4290('0x3')]}));_0x57e989[_0x4290('0x2f')](_0x20e1ff[_0x4290('0x3e')]({'attributes':['id',_0x4290('0x3')]}));_0x57e989[_0x4290('0x2f')](_0x20e1ff['getOpenchannelQueues']({'attributes':['id',_0x4290('0x3')]}));_0x57e989[_0x4290('0x2f')](_0x20e1ff[_0x4290('0x3f')]({'attributes':['id',_0x4290('0x3')]}));break;}return BPromise[_0x4290('0x40')](_0x57e989);}})[_0x4290('0xb')](function(_0x2fcc25){if(_0x2fcc25&&_0x2fcc25[_0x4290('0x1c')]){for(var _0x6c1028=0x0;_0x6c1028<_0x2fcc25[_0x4290('0x1c')];_0x6c1028+=0x1){for(var _0xf2a54b=0x0;_0xf2a54b<_0x2fcc25[_0x6c1028][_0x4290('0x1c')];_0xf2a54b+=0x1){switch(_0x6c1028){case 0x0:joinOrLeaveQueues(_0x9311f4,_0x962354,_0x4290('0x41'),_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x1:joinOrLeaveQueues(_0x9311f4,_0x962354,_0x4290('0x42'),_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x2:joinOrLeaveQueues(_0x9311f4,_0x962354,_0x4290('0x43'),_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x3:joinOrLeaveQueues(_0x9311f4,_0x962354,_0x4290('0x44'),_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x4:joinOrLeaveQueues(_0x9311f4,_0x962354,'mail',_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x5:joinOrLeaveQueues(_0x9311f4,_0x962354,'openchannel',_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x6:joinOrLeaveQueues(_0x9311f4,_0x962354,'whatsapp',_0x2fcc25[_0x6c1028][_0xf2a54b]);break;case 0x7:_0x9311f4[_0x962354](util[_0x4290('0x1d')]('telephone:%s',_0x2fcc25[_0x6c1028][_0xf2a54b][_0x4290('0x3')]));break;case 0x8:_0x9311f4[_0x962354](util['format'](_0x4290('0x45'),_0x2fcc25[_0x6c1028][_0xf2a54b]['name']));break;case 0x9:_0x9311f4[_0x962354](util[_0x4290('0x1d')](_0x4290('0x46'),_0x2fcc25[_0x6c1028][_0xf2a54b][_0x4290('0x8')],_0x2fcc25[_0x6c1028][_0xf2a54b][_0x4290('0x3')]));break;case 0xa:_0x9311f4[_0x962354](util['format']('user:%s',_0x2fcc25[_0x6c1028][_0xf2a54b][_0x4290('0x3')]));break;}}}}})['then'](function(){if(_0x962354==='leave'){var _0x191c98=_[_0x4290('0x18')](_0x9542b4[_0x4290('0x24')],'id');return _0x9542b4[_0x4290('0x47')](_0x191c98)[_0x4290('0xb')](function(){for(var _0x5470d8=0x0;_0x5470d8<_0x191c98[_0x4290('0x1c')];_0x5470d8+=0x1){_0x2636ff[_0x4290('0x48')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x191c98[_0x5470d8]),'UserId':Number(_0x9542b4['id'])});}});}})[_0x4290('0xb')](function(){if(_0x962354===_0x4290('0x49')){var _0x697cc6=_['map'](_0x9542b4['MailInteractions'],'id');return _0x9542b4['removeMailInteractions'](_0x697cc6)[_0x4290('0xb')](function(){for(var _0x24ca4d=0x0;_0x24ca4d<_0x697cc6['length'];_0x24ca4d+=0x1){_0x2636ff[_0x4290('0x48')](_0x4290('0x4a'),{'MailInteractionId':Number(_0x697cc6[_0x24ca4d]),'UserId':Number(_0x9542b4['id'])});}});}})[_0x4290('0xb')](function(){if(_0x962354===_0x4290('0x49')){var _0x2426e1=_['map'](_0x9542b4[_0x4290('0x26')],'id');return _0x9542b4['removeFaxInteractions'](_0x2426e1)[_0x4290('0xb')](function(){for(var _0xa726e9=0x0;_0xa726e9<_0x2426e1[_0x4290('0x1c')];_0xa726e9+=0x1){_0x2636ff[_0x4290('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2426e1[_0xa726e9]),'UserId':Number(_0x9542b4['id'])});}});}})[_0x4290('0xb')](function(){if(_0x962354===_0x4290('0x49')){var _0x3afa62=_[_0x4290('0x18')](_0x9542b4[_0x4290('0x28')],'id');return _0x9542b4[_0x4290('0x4b')](_0x3afa62)['then'](function(){for(var _0x4c75a3=0x0;_0x4c75a3<_0x3afa62[_0x4290('0x1c')];_0x4c75a3+=0x1){_0x2636ff[_0x4290('0x48')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x3afa62[_0x4c75a3]),'UserId':Number(_0x9542b4['id'])});}});}})['then'](function(){if(_0x962354==='leave'){var _0x215d58=_[_0x4290('0x18')](_0x9542b4[_0x4290('0x2a')],'id');return _0x9542b4[_0x4290('0x4c')](_0x215d58)[_0x4290('0xb')](function(){for(var _0x193113=0x0;_0x193113<_0x215d58[_0x4290('0x1c')];_0x193113+=0x1){_0x2636ff[_0x4290('0x48')](_0x4290('0x4d'),{'OpenchannelInteractionId':Number(_0x215d58[_0x193113]),'UserId':Number(_0x9542b4['id'])});}});}})[_0x4290('0xb')](function(){if(_0x962354===_0x4290('0x49')){var _0x403f9d=_[_0x4290('0x18')](_0x9542b4['WhatsappInteractions'],'id');return _0x9542b4[_0x4290('0x4e')](_0x403f9d)[_0x4290('0xb')](function(){for(var _0x224ef2=0x0;_0x224ef2<_0x403f9d[_0x4290('0x1c')];_0x224ef2+=0x1){_0x2636ff[_0x4290('0x48')](_0x4290('0x4f'),{'WhatsappInteractionId':Number(_0x403f9d[_0x224ef2]),'UserId':Number(_0x9542b4['id'])});}});}})[_0x4290('0x50')](function(_0x442585){_0x9311f4[_0x4290('0x51')](_0x442585);});}}function onDisconnect(_0x22ff45,_0x26f480){joinOrLeave(_0x22ff45,_0x4290('0x49'),_0x26f480);}function onConnect(_0x5c11be){joinOrLeave(_0x5c11be,'join');}exports[_0x4290('0x52')]=function(_0x27adf2){_0x27adf2['on']('connection',function(_0x2bbaea){_0x2bbaea[_0x4290('0x53')](0x0);_0x2bbaea[_0x4290('0x54')]=_0x2bbaea[_0x4290('0x55')][_0x4290('0x56')]['remoteAddress']+':'+_0x2bbaea[_0x4290('0x55')][_0x4290('0x56')][_0x4290('0x57')];_0x2bbaea[_0x4290('0x58')]=new Date();_0x2bbaea[_0x4290('0x51')]=function(_0x2895de){console[_0x4290('0x51')]('SocketIO\x20'+_0x2bbaea[_0x4290('0x59')][_0x4290('0x3')]+'['+_0x2bbaea[_0x4290('0x54')]+']',_0x2895de);};_0x2bbaea['on']('disconnect',function(){onDisconnect(_0x2bbaea,_0x27adf2);_0x2bbaea[_0x4290('0x51')]('DISCONNECTED');});onConnect(_0x2bbaea);_0x2bbaea['log'](_0x4290('0x5a'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 0e83e1a..3925691 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 _0x31e4=['newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','WhatsappInteraction','Whatsapp','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','Openchannel','OpenchannelMessage','request','EventManager','info','error','code','Trigger,\x20%s','catch','channel','direction','UserId','User','find','then','interface','format','SIP/%s','incomingmessage','opened','changed','get','event','closed','name','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','http','Chat','ChatInteraction','afterCreate'];(function(_0x56421a,_0x48f485){var _0x4ecd47=function(_0x3c404a){while(--_0x3c404a){_0x56421a['push'](_0x56421a['shift']());}};_0x4ecd47(++_0x48f485);}(_0x31e4,0x17f));var _0x431e=function(_0x428018,_0x2e3229){_0x428018=_0x428018-0x0;var _0x49fefa=_0x31e4[_0x428018];return _0x49fefa;};'use strict';var util=require(_0x431e('0x0'));var db=require(_0x431e('0x1'))['db'];var jayson=require(_0x431e('0x2'));var logger=require(_0x431e('0x3'))(_0x431e('0x4'));var client=jayson['client'][_0x431e('0x5')]({'port':0x232a});var triggers=[{'channel':_0x431e('0x6'),'model':_0x431e('0x7'),'event':_0x431e('0x8'),'condition':_0x431e('0x9'),'callback':afterCreate},{'channel':_0x431e('0x6'),'model':_0x431e('0x7'),'event':_0x431e('0xa'),'condition':_0x431e('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0x431e('0xc'),'event':_0x431e('0x8'),'condition':_0x431e('0xd'),'callback':afterCreateMessage},{'channel':_0x431e('0xe'),'model':_0x431e('0xf'),'event':_0x431e('0x8'),'condition':_0x431e('0x9'),'callback':afterCreate},{'channel':_0x431e('0xe'),'model':_0x431e('0xf'),'event':'afterUpdate','condition':_0x431e('0xb'),'callback':afterUpdate},{'channel':_0x431e('0xe'),'model':'SmsMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Whatsapp','model':_0x431e('0x10'),'event':_0x431e('0x8'),'condition':_0x431e('0x9'),'callback':afterCreate},{'channel':_0x431e('0x11'),'model':_0x431e('0x10'),'event':_0x431e('0xa'),'condition':_0x431e('0xb'),'callback':afterUpdate},{'channel':_0x431e('0x11'),'model':_0x431e('0x12'),'event':'afterCreate','condition':_0x431e('0xd'),'callback':afterCreateMessage},{'channel':'Fax','model':_0x431e('0x13'),'event':_0x431e('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x431e('0x14'),'model':_0x431e('0x13'),'event':_0x431e('0xa'),'condition':_0x431e('0xb'),'callback':afterUpdate},{'channel':_0x431e('0x14'),'model':_0x431e('0x15'),'event':_0x431e('0x8'),'condition':_0x431e('0xd'),'callback':afterCreateMessage},{'channel':_0x431e('0x16'),'model':_0x431e('0x17'),'event':_0x431e('0x8'),'condition':_0x431e('0x9'),'callback':afterCreate},{'channel':_0x431e('0x16'),'model':_0x431e('0x17'),'event':_0x431e('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':_0x431e('0x8'),'condition':_0x431e('0xd'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x431e('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x431e('0x18'),'model':'OpenchannelInteraction','event':_0x431e('0xa'),'condition':_0x431e('0xb'),'callback':afterUpdate},{'channel':_0x431e('0x18'),'model':_0x431e('0x19'),'event':_0x431e('0x8'),'condition':_0x431e('0xd'),'callback':afterCreateMessage}];function request(_0x211fe1){return client[_0x431e('0x1a')](_0x431e('0x1b'),_0x211fe1)['then'](function(_0x25a2c8){logger[_0x431e('0x1c')]('Trigger,\x20%s',_0x431e('0x1b'),_0x25a2c8);if(_0x25a2c8[_0x431e('0x1d')]){if(_0x25a2c8['error'][_0x431e('0x1e')]===0x1f4){logger['error'](_0x431e('0x1f'),_0x431e('0x1b'),_0x25a2c8[_0x431e('0x1d')]);}}})[_0x431e('0x20')](function(_0x245e86){logger[_0x431e('0x1d')](_0x431e('0x1f'),_0x431e('0x1b'),_0x245e86);});}function afterCreateMessage(_0x10bbb5,_0x1c7740){return function(_0x77f0c3,_0xb3d877){_0x77f0c3=_0x77f0c3['get']({'plain':!![]});_0x77f0c3[_0x431e('0x21')]=_0x10bbb5;_0x77f0c3['event']=_0x77f0c3[_0x431e('0x22')];if(_0x77f0c3[_0x431e('0x23')]){return db[_0x431e('0x24')][_0x431e('0x25')]({'where':{'id':_0x77f0c3[_0x431e('0x23')]},'attributes':['id','name'],'raw':!![]})[_0x431e('0x26')](function(_0x2bd9b){_0x77f0c3[_0x431e('0x27')]=util[_0x431e('0x28')](_0x431e('0x29'),_0x2bd9b['name']);_0x77f0c3['channel']=_0x10bbb5;return request({'event':_0x431e('0x2a'),'message':_0x77f0c3});})[_0x431e('0x20')](function(_0x12ecb2){console['error'](_0x12ecb2);});}else{return request({'event':'outgoingmessage','message':_0x77f0c3});}};}function afterCreate(_0xeb207a,_0x1f920e){return function(_0x361cba,_0x2a8858){_0x361cba=_0x361cba['get']({'plain':!![]});_0x361cba['channel']=_0xeb207a;_0x361cba['event']=_0x431e('0x2b');return request({'event':_0x1f920e,'message':_0x361cba});};}function afterUpdate(_0xb23923,_0x3c67a6){return function(_0x2e5b69,_0x5cfad6){if(_0x2e5b69[_0x431e('0x2c')]('closed')&&_0x2e5b69['closed']){_0x2e5b69=_0x2e5b69[_0x431e('0x2d')]({'plain':!![]});_0x2e5b69['channel']=_0xb23923;_0x2e5b69[_0x431e('0x2e')]=_0x431e('0x2f');if(_0x2e5b69[_0x431e('0x23')]){return db['User'][_0x431e('0x25')]({'where':{'id':_0x2e5b69[_0x431e('0x23')]},'attributes':['id',_0x431e('0x30')],'raw':!![]})[_0x431e('0x26')](function(_0x69a5a8){_0x2e5b69[_0x431e('0x27')]=util[_0x431e('0x28')](_0x431e('0x29'),_0x69a5a8[_0x431e('0x30')]);return request({'event':_0x3c67a6,'message':_0x2e5b69});})['catch'](function(_0x1f851f){console[_0x431e('0x1d')](_0x1f851f);});}else{return request({'event':_0x3c67a6,'message':_0x2e5b69});}}};}exports[_0x431e('0x31')]=function(){for(var _0x22503d=0x0;_0x22503d=_0xc2464a[_0x42a9('0x13')]){throw Error(_0x42a9('0x14'));}_0x365cb6(_0x5d535a);})[_0x42a9('0x15')](function(_0x4e65f7){_0x368ea6(_0x4e65f7);});});}; \ No newline at end of file +var _0x39b9=['voice','mail','chat','fax','sms','whatsapp','openchannel','isValidChannel','includes','isUndefined','updateAttributes','getLicense','role','agent','then','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb','./license/util'];(function(_0x57ca7a,_0x12f445){var _0x32660e=function(_0x270572){while(--_0x270572){_0x57ca7a['push'](_0x57ca7a['shift']());}};_0x32660e(++_0x12f445);}(_0x39b9,0xc4));var _0x939b=function(_0x3d9b73,_0x332c82){_0x3d9b73=_0x3d9b73-0x0;var _0x1684b0=_0x39b9[_0x3d9b73];return _0x1684b0;};'use strict';var _=require(_0x939b('0x0'));var BPromise=require(_0x939b('0x1'));var db=require(_0x939b('0x2'))['db'];var util=require(_0x939b('0x3'));var channels=[_0x939b('0x4'),_0x939b('0x5'),_0x939b('0x6'),_0x939b('0x7'),_0x939b('0x8'),_0x939b('0x9'),_0x939b('0xa')];exports['getChannels']=function(){return channels;};exports[_0x939b('0xb')]=function(_0x47dd2e){_0x47dd2e=_0x47dd2e['toLowerCase']();return _[_0x939b('0xc')](channels,_0x47dd2e);};exports['clearBlockUser']=function(_0x32ed03,_0x1929e6,_0x4e1796,_0x5a289c){var _0x369139={'loginAttempts':_0x1929e6,'blocked':_0x4e1796};if(!_[_0x939b('0xd')](_0x5a289c)){_0x369139['blockedAt']=_0x5a289c;}return _0x32ed03[_0x939b('0xe')](_0x369139);};exports[_0x939b('0xf')]=function(_0x4709b2){return new BPromise(function(_0x56321e,_0x5ec2e8){var _0x5a7e3a=0x0;if(_0x4709b2[_0x939b('0x10')]!==_0x939b('0x11')){_0x56321e(_0x4709b2);}db['User']['count']({'where':{'role':_0x939b('0x11'),'online':!![],'id':{'$ne':_0x4709b2['id']}}})['then'](function(_0x565736){_0x5a7e3a=_0x565736;return util['getLicense']();})[_0x939b('0x12')](function(_0x3d45e4){if(_0x3d45e4&&_0x3d45e4['agents']&&_0x5a7e3a>=_0x3d45e4['agents']){throw Error(_0x939b('0x13'));}_0x56321e(_0x4709b2);})['catch'](function(_0x1c6ffb){_0x5ec2e8(_0x1c6ffb);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 75025d0..8dc00e5 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xac5b=['json','send','exports','404','status','render'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac5b,0xfe));var _0xbac5=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xac5b[_0x2ae2ad];return _0x26dbd7;};'use strict';module[_0xbac5('0x0')][0x194]=function pageNotFound(_0x117f31,_0x564c1f){var _0x49bf45=_0xbac5('0x1');var _0x124e5f=0x194;var _0x585bba={'status':_0x124e5f};_0x564c1f[_0xbac5('0x2')](_0x585bba[_0xbac5('0x2')]);_0x564c1f[_0xbac5('0x3')](_0x49bf45,{},function(_0x64c5ba,_0x2587c4){if(_0x64c5ba){return _0x564c1f[_0xbac5('0x2')](_0x585bba['status'])[_0xbac5('0x4')](_0x585bba);}_0x564c1f[_0xbac5('0x5')](_0x2587c4);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 5a8076e..d006bbf 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0xddc3=['../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','Notification','../api/notification/notification.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','hasOne','cascade','UserId','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','ChatInteractions','SmsInteraction','MailInteractions','WhatsappInteractions','Notifications','SenderId','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_mail_interactions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueue','MailQueues','ChatQueues','SmsQueues','UserOpenchannelQueue','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','FaxAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','HopperHistories','CmHopperBlack','JscriptySessions','TrunkId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','VoiceMailMessage','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','MailServerOut','Imap','Smtp','Answers','MailMessage','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachment','Attachments','Interaction','restrict','TagId','MailQueueReport','List','Dashboard','Items','Dispositions','FaxAccountId','Interactions','FaxApplication','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','OpenchannelQueueReport','Agent','ChatQueue','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatProactiveAction','CompanyId','OpenchannelInteractions','SmsInteractions','Company','cm_contact_has_tags','OwnerId','CampaignId','OneAll','AutomationAllId','Condition','OneAny','Actions','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','SmsApplications','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','SalesforceConfiguration','AccountId','SalesforceField','Descriptions','FieldId','Description','DescriptionId','Field','VariableId','Subjects','SubjectId','Subject','Configurations','int_desk_configuration_has_tags','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskField','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowField','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','FromId','ToId','SessionId','JscriptyProject','ProjectId','team_has_voice_queues','VoiceQueues','FaxQueues','team_has_whatsapp_queues','WhatsappQueues','HopperBlacks','TrunkBackup','TrunkBackupId','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','ChatTransferReport','FromChatWebsiteId','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','whatsapp_interaction_has_tags','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','defaultsDeep','motion2','xcall','127.0.0.1','mysql','name','utf8','sequelizeHistory','utf8mb4','database','username','password','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatMessage/chatMessage.model','ChatOfflineMessage','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport'];(function(_0xf0fdc6,_0x5b6781){var _0x439404=function(_0x22a141){while(--_0x22a141){_0xf0fdc6['push'](_0xf0fdc6['shift']());}};_0x439404(++_0x5b6781);}(_0xddc3,0x111));var _0x3ddc=function(_0x1013f2,_0x8c0506){_0x1013f2=_0x1013f2-0x0;var _0x1350cf=_0xddc3[_0x1013f2];return _0x1350cf;};'use strict';var path=require(_0x3ddc('0x0'));var config=require(_0x3ddc('0x1'));var Sequelize=require(_0x3ddc('0x2'));var _=require(_0x3ddc('0x3'));var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_[_0x3ddc('0x4')](config['sequelize'],{'database':_0x3ddc('0x5'),'username':_0x3ddc('0x6'),'password':'xC@LL1234','options':{'host':_0x3ddc('0x7'),'port':0xcea,'dialect':_0x3ddc('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x3ddc('0x9')](),'define':{'charset':_0x3ddc('0xa'),'collate':'utf8_general_ci'}}});config[_0x3ddc('0xb')]=_[_0x3ddc('0x4')](config['sequelizeHistory'],{'database':_0x3ddc('0x5'),'username':_0x3ddc('0x6'),'password':'xC@LL1234','options':{'host':_0x3ddc('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x3ddc('0xc')},'logging':![],'timezone':timezone[_0x3ddc('0x9')](),'define':{'charset':_0x3ddc('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3ddc('0x2')][_0x3ddc('0xd')],config['sequelize'][_0x3ddc('0xe')],config[_0x3ddc('0x2')][_0x3ddc('0xf')],config[_0x3ddc('0x2')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x3ddc('0xb')][_0x3ddc('0xd')],config[_0x3ddc('0xb')]['username'],config['sequelizeHistory'][_0x3ddc('0xf')],config['sequelizeHistory']['options'])};db[_0x3ddc('0x10')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x12'));db['VoiceChanSpy']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x13'));db[_0x3ddc('0x14')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/voiceContext/voiceContext.model');db[_0x3ddc('0x15')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x16'));db[_0x3ddc('0x17')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x18'));db[_0x3ddc('0x19')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x1a'));db[_0x3ddc('0x1b')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/voiceRecording/voiceRecording.model');db[_0x3ddc('0x1c')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x1d'));db[_0x3ddc('0x1e')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x1f'));db['VoiceMailMessage']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x20'));db[_0x3ddc('0x21')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x22'));db['VoiceDialReport']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x23'));db[_0x3ddc('0x24')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x25'));db[_0x3ddc('0x26')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x27'));db[_0x3ddc('0x28')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x29'));db[_0x3ddc('0x2a')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x2b'));db[_0x3ddc('0x2c')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x2d'));db['UserVoiceQueueRt']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x2e'));db[_0x3ddc('0x2f')]=db[_0x3ddc('0x2')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0x3ddc('0x30')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x31'));db[_0x3ddc('0x32')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x33'));db[_0x3ddc('0x34')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/userFaxQueue/userFaxQueue.model');db[_0x3ddc('0x35')]=db[_0x3ddc('0x2')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x36'));db[_0x3ddc('0x37')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x38'));db[_0x3ddc('0x39')]=db['sequelize'][_0x3ddc('0x11')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db['sequelize'][_0x3ddc('0x11')]('../api/mailServerOut/mailServerOut.model');db[_0x3ddc('0x3a')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x3b'));db['MailQueue']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x3c'));db[_0x3ddc('0x3d')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x3e'));db[_0x3ddc('0x3f')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x40'));db['MailMessage']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x41'));db[_0x3ddc('0x42')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x43'));db['MailQueueReport']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x44'));db['Dashboard']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x45'));db[_0x3ddc('0x46')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x47'));db['FaxAccount']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x48'));db['FaxApplication']=db['sequelize'][_0x3ddc('0x11')]('../api/faxApplication/faxApplication.model');db[_0x3ddc('0x49')]=db['sequelize']['import'](_0x3ddc('0x4a'));db['FaxMessage']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x4b'));db[_0x3ddc('0x4c')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x4d'));db['FaxQueueReport']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/faxQueueReport/faxQueueReport.model');db[_0x3ddc('0x4e')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x4f'));db[_0x3ddc('0x50')]=db['sequelize']['import'](_0x3ddc('0x51'));db['SmsInteraction']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x52'));db[_0x3ddc('0x53')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x54'));db[_0x3ddc('0x55')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x56'));db['OpenchannelAccount']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x57'));db[_0x3ddc('0x58')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x59'));db[_0x3ddc('0x5a')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x5b'));db[_0x3ddc('0x5c')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x5d'));db[_0x3ddc('0x5e')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x5f'));db[_0x3ddc('0x60')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x61'));db['OpenchannelQueueReport']=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x3ddc('0x62')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x63'));db[_0x3ddc('0x64')]=db['sequelize'][_0x3ddc('0x11')]('../api/chatInteraction/chatInteraction.model');db['ChatMessage']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x65'));db[_0x3ddc('0x66')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/chatQueue/chatQueue.model');db[_0x3ddc('0x67')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x68'));db['ChatProactiveAction']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x69'));db[_0x3ddc('0x6a')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/cmCompany/cmCompany.model');db[_0x3ddc('0x6b')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x6c'));db['CmHopper']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x6d'));db['CmHopperFinal']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x6e'));db['CmHopperHistory']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x6f'));db[_0x3ddc('0x70')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x71'));db[_0x3ddc('0x72')]=db['sequelize'][_0x3ddc('0x11')]('../api/action/action.model');db[_0x3ddc('0x73')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x74'));db[_0x3ddc('0x75')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x76'));db[_0x3ddc('0x77')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x78'));db['Condition']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x79'));db['Interval']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x7a'));db[_0x3ddc('0x7b')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x7c'));db[_0x3ddc('0x7d')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x7e'));db[_0x3ddc('0x7f')]=db['sequelize']['import'](_0x3ddc('0x80'));db[_0x3ddc('0x81')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/schedule/schedule.model');db[_0x3ddc('0x82')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x83'));db[_0x3ddc('0x84')]=db['sequelize']['import'](_0x3ddc('0x85'));db[_0x3ddc('0x86')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/template/template.model');db[_0x3ddc('0x87')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x88'));db[_0x3ddc('0x89')]=db[_0x3ddc('0x2')]['import']('../api/variable/variable.model');db['Integration']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x8a'));db[_0x3ddc('0x8b')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x8c'));db[_0x3ddc('0x8d')]=db['sequelize']['import'](_0x3ddc('0x8e'));db[_0x3ddc('0x8f')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x90'));db[_0x3ddc('0x91')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x92'));db[_0x3ddc('0x93')]=db[_0x3ddc('0x2')]['import']('../api/analyticMetric/analyticMetric.model');db['AnalyticFieldReport']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/analyticFieldReport/analyticFieldReport.model');db['AnalyticTreeReport']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x94'));db[_0x3ddc('0x95')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x96'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x3ddc('0x97'));db['SalesforceField']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x98'));db[_0x3ddc('0x99')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x9a'));db[_0x3ddc('0x9b')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0x9c'));db[_0x3ddc('0x9d')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0x9e'));db[_0x3ddc('0x9f')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xa0'));db[_0x3ddc('0xa1')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x3ddc('0xa2')]=db['sequelize']['import'](_0x3ddc('0xa3'));db[_0x3ddc('0xa4')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xa5'));db[_0x3ddc('0xa6')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xa7'));db[_0x3ddc('0xa8')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xa9'));db[_0x3ddc('0xaa')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x3ddc('0xab')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xac'));db['ZendeskField']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xad'));db['FreshdeskAccount']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xae'));db[_0x3ddc('0xaf')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xb0'));db['FreshdeskField']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xb1'));db[_0x3ddc('0xb2')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x3ddc('0xb3')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xb4'));db[_0x3ddc('0xb5')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xb6'));db[_0x3ddc('0xb7')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xb8'));db['ServicenowField']=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xb9'));db[_0x3ddc('0xba')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xbb'));db[_0x3ddc('0xbc')]=db[_0x3ddc('0x2')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x3ddc('0xbd')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xbe'));db['FreshsalesAccount']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xbf'));db['FreshsalesConfiguration']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xc0'));db['FreshsalesField']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xc1'));db[_0x3ddc('0xc2')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/integration/integration.model');db[_0x3ddc('0xc3')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xc4'));db[_0x3ddc('0xc5')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xc6'));db[_0x3ddc('0xc7')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xc8'));db['JscriptyAnswerReport']=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xc9'));db[_0x3ddc('0xca')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xcb'));db[_0x3ddc('0xcc')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xcd'));db[_0x3ddc('0xce')]=db['sequelize'][_0x3ddc('0x11')]('../api/smsQueueReport/smsQueueReport.model');db[_0x3ddc('0xcf')]=db['sequelize']['import']('../api/squareReport/squareReport.model');db[_0x3ddc('0xd0')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xd1'));db['JscriptyProject']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xd2'));db[_0x3ddc('0xd3')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/setting/setting.model');db[_0x3ddc('0xd4')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xd5'));db['SquareProject']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xd6'));db[_0x3ddc('0xd7')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/squareRecording/squareRecording.model');db[_0x3ddc('0xd8')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xd9'));db[_0x3ddc('0xda')]=db['sequelize'][_0x3ddc('0x11')]('../api/team/team.model');db[_0x3ddc('0xdb')]=db['sequelize'][_0x3ddc('0x11')]('../api/license/license.model');db[_0x3ddc('0xdc')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xdd'));db[_0x3ddc('0xde')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xdf'));db['Attachment']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xe0'));db[_0x3ddc('0xe1')]=db['sequelize']['import'](_0x3ddc('0xe2'));db[_0x3ddc('0xe3')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xe4'));db['ChatTransferReport']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/chatTransferReport/chatTransferReport.model');db[_0x3ddc('0xe5')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xe6'));db[_0x3ddc('0xe7')]=db['sequelize']['import'](_0x3ddc('0xe8'));db[_0x3ddc('0xe9')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xea'));db[_0x3ddc('0xeb')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xec'));db['VoicePrefix']=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/voicePrefix/voicePrefix.model');db[_0x3ddc('0xed')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/userProfile/userProfile.model');db[_0x3ddc('0xee')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xef'));db[_0x3ddc('0xf0')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/userProfileResource/userProfileResource.model');db[_0x3ddc('0xf1')]=db['sequelize'][_0x3ddc('0x11')](_0x3ddc('0xf2'));db[_0x3ddc('0xf3')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xf4'));db['WhatsappAccount']=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xf5'));db[_0x3ddc('0xf6')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xf7'));db[_0x3ddc('0xf8')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xf9'));db[_0x3ddc('0xfa')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0xfb'));db[_0x3ddc('0xfc')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x3ddc('0xfd')]=db[_0x3ddc('0x2')]['import'](_0x3ddc('0xfe'));db[_0x3ddc('0xff')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x100'));db[_0x3ddc('0x101')]=db[_0x3ddc('0x2')][_0x3ddc('0x11')](_0x3ddc('0x102'));db[_0x3ddc('0x10')][_0x3ddc('0x103')](db['VoiceMail'],{'as':_0x3ddc('0x1e'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x105')});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db[_0x3ddc('0x1b')],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0x3ddc('0x106')](db[_0x3ddc('0x107')],{'as':_0x3ddc('0x108'),'foreignKey':_0x3ddc('0x105')});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db[_0x3ddc('0x15')],{'as':_0x3ddc('0x109'),'onDelete':_0x3ddc('0x104'),'hooks':!![]});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db[_0x3ddc('0x10a')],{'as':_0x3ddc('0x10b'),'foreignKey':_0x3ddc('0x105')});db['User'][_0x3ddc('0x106')](db[_0x3ddc('0x10c')],{'as':_0x3ddc('0x10d'),'foreignKey':'UserId'});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x3ddc('0x105')});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':_0x3ddc('0x105')});db['User'][_0x3ddc('0x106')](db[_0x3ddc('0x64')],{'as':_0x3ddc('0x10e'),'foreignKey':_0x3ddc('0x105')});db[_0x3ddc('0x10')]['hasMany'](db[_0x3ddc('0x10f')],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db[_0x3ddc('0x49')],{'as':'FaxInteractions','foreignKey':'UserId'});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db['MailInteraction'],{'as':_0x3ddc('0x110'),'foreignKey':_0x3ddc('0x105')});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db[_0x3ddc('0xf8')],{'as':_0x3ddc('0x111'),'foreignKey':'UserId'});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db[_0x3ddc('0xf1')],{'as':_0x3ddc('0x112'),'foreignKey':_0x3ddc('0x113')});db[_0x3ddc('0x10')][_0x3ddc('0x106')](db['UserNotification'],{'as':_0x3ddc('0x114'),'foreignKey':_0x3ddc('0x113')});db[_0x3ddc('0x10')][_0x3ddc('0x115')](db[_0x3ddc('0xed')],{'as':_0x3ddc('0xed'),'foreignKey':_0x3ddc('0x116')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x67')],{'as':_0x3ddc('0x118'),'through':_0x3ddc('0x119')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db['CmContact'],{'as':_0x3ddc('0x11a'),'through':_0x3ddc('0x11b')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db['CmList'],{'as':_0x3ddc('0x11c'),'through':_0x3ddc('0x11d')});db[_0x3ddc('0x10')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x3f')],{'as':'MailInteractions','through':_0x3ddc('0x11e')});db[_0x3ddc('0x10')]['belongsToMany'](db[_0x3ddc('0x64')],{'as':_0x3ddc('0x10e'),'through':_0x3ddc('0x11f')});db[_0x3ddc('0x10')]['belongsToMany'](db['FaxInteraction'],{'as':_0x3ddc('0x120'),'through':_0x3ddc('0x121')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x3ddc('0x122')});db['User'][_0x3ddc('0x117')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0x3ddc('0x123')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0xf8')],{'as':_0x3ddc('0x111'),'through':_0x3ddc('0x124')});db['User'][_0x3ddc('0x117')](db[_0x3ddc('0x19')],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x125')],{'as':_0x3ddc('0x126'),'through':'UserMailQueue','required':![]});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db['ChatQueue'],{'as':_0x3ddc('0x127'),'through':_0x3ddc('0x30'),'required':![],'hooks':!![]});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db['FaxQueue'],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db['User'][_0x3ddc('0x117')](db[_0x3ddc('0x55')],{'as':_0x3ddc('0x128'),'through':_0x3ddc('0x35'),'required':![]});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x5e')],{'as':'OpenchannelQueues','through':_0x3ddc('0x129'),'required':![]});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0xff')],{'as':'WhatsappQueues','through':_0x3ddc('0x37'),'required':![]});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0xeb')],{'through':_0x3ddc('0x11d')});db['User'][_0x3ddc('0x117')](db[_0x3ddc('0x12a')],{'as':_0x3ddc('0x12b'),'through':_0x3ddc('0x12c'),'required':![]});db[_0x3ddc('0x10')]['belongsToMany'](db[_0x3ddc('0x60')],{'as':_0x3ddc('0x12d'),'through':_0x3ddc('0x12e')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x12f')],{'as':_0x3ddc('0x130'),'through':'user_has_fax_accounts'});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db['MailAccount'],{'as':'MailAccounts','through':_0x3ddc('0x131')});db['User'][_0x3ddc('0x117')](db[_0x3ddc('0x132')],{'as':_0x3ddc('0x133'),'through':_0x3ddc('0x134')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x4e')],{'as':_0x3ddc('0x135'),'through':_0x3ddc('0x136')});db['User'][_0x3ddc('0x117')](db[_0x3ddc('0x137')],{'as':_0x3ddc('0x138'),'through':_0x3ddc('0x139')});db[_0x3ddc('0x10')][_0x3ddc('0x117')](db[_0x3ddc('0x13a')],{'as':_0x3ddc('0x13b'),'through':_0x3ddc('0x13c')});db['VoiceChanSpy'][_0x3ddc('0x106')](db['VoiceExtension'],{'as':_0x3ddc('0x13d'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x13e')});db[_0x3ddc('0x14')]['hasMany'](db[_0x3ddc('0x15')],{'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x15')][_0x3ddc('0x106')](db[_0x3ddc('0x15')],{'as':_0x3ddc('0x13f'),'onDelete':'cascade'});db[_0x3ddc('0x17')][_0x3ddc('0x117')](db[_0x3ddc('0x82')],{'as':_0x3ddc('0x140'),'through':_0x3ddc('0x141')});db[_0x3ddc('0x19')][_0x3ddc('0x106')](db[_0x3ddc('0x107')],{'as':_0x3ddc('0x142'),'foreignKey':_0x3ddc('0x143')});db[_0x3ddc('0x19')][_0x3ddc('0x106')](db[_0x3ddc('0x144')],{'as':_0x3ddc('0x145'),'foreignKey':_0x3ddc('0x143')});db['VoiceQueue'][_0x3ddc('0x106')](db[_0x3ddc('0x10a')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0x3ddc('0x19')]['hasMany'](db[_0x3ddc('0x10c')],{'as':_0x3ddc('0x146'),'foreignKey':'VoiceQueueId'});db[_0x3ddc('0x19')][_0x3ddc('0x106')](db['ReportAgentPreview'],{'as':_0x3ddc('0x70'),'foreignKey':_0x3ddc('0x143')});db[_0x3ddc('0x19')][_0x3ddc('0x106')](db[_0x3ddc('0x147')],{'as':'HopperBlacks','foreignKey':_0x3ddc('0x143')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0x3ddc('0x148'),'foreignKey':_0x3ddc('0x143')});db[_0x3ddc('0x19')][_0x3ddc('0x115')](db['Trunk'],{'as':_0x3ddc('0x2a'),'foreignKey':_0x3ddc('0x149')});db['VoiceQueue'][_0x3ddc('0x115')](db['Trunk'],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x3ddc('0x115')](db[_0x3ddc('0x14a')],{'as':'Interval','foreignKey':_0x3ddc('0x14b')});db[_0x3ddc('0x19')]['belongsTo'](db[_0x3ddc('0x7b')],{'as':_0x3ddc('0x14c'),'foreignKey':_0x3ddc('0x14d')});db[_0x3ddc('0x19')][_0x3ddc('0x117')](db['CmList'],{'as':'Lists','through':_0x3ddc('0x14e')});db[_0x3ddc('0x19')][_0x3ddc('0x117')](db['User'],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x2f')});db[_0x3ddc('0x19')][_0x3ddc('0x117')](db[_0x3ddc('0xda')],{'as':_0x3ddc('0x150'),'through':'team_has_voice_queues'});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db[_0x3ddc('0x1b')][_0x3ddc('0x115')](db['User'],{'as':_0x3ddc('0x10'),'foreignKey':'UserId'});db[_0x3ddc('0x1c')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':'User','foreignKey':_0x3ddc('0x105')});db['VoiceMail'][_0x3ddc('0x106')](db[_0x3ddc('0x151')],{'as':_0x3ddc('0x152'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x153'),'sourceKey':'mailbox'});db[_0x3ddc('0x151')][_0x3ddc('0x115')](db[_0x3ddc('0x1e')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db['VoiceCallReport'][_0x3ddc('0x106')](db[_0x3ddc('0x26')],{'as':_0x3ddc('0x154'),'foreignKey':_0x3ddc('0x155'),'constraints':![]});db[_0x3ddc('0x21')][_0x3ddc('0x106')](db['VoiceAgentReport'],{'as':_0x3ddc('0x156'),'foreignKey':_0x3ddc('0x155'),'constraints':![]});db[_0x3ddc('0x21')][_0x3ddc('0x115')](db['User'],{'as':_0x3ddc('0x10'),'foreignKey':_0x3ddc('0x105')});db['VoiceCallReport'][_0x3ddc('0x115')](db['CmContact'],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x39')]['belongsTo'](db[_0x3ddc('0x3a')],{'as':_0x3ddc('0x3a'),'foreignKey':_0x3ddc('0x159')});db[_0x3ddc('0x15a')]['belongsTo'](db[_0x3ddc('0x3a')],{'as':_0x3ddc('0x3a'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x3ddc('0x103')](db['MailServerIn'],{'as':_0x3ddc('0x15b'),'onDelete':'cascade'});db[_0x3ddc('0x3a')][_0x3ddc('0x103')](db['MailServerOut'],{'as':_0x3ddc('0x15c'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x3a')][_0x3ddc('0x106')](db[_0x3ddc('0x77')],{'as':'Dispositions','foreignKey':_0x3ddc('0x159')});db['MailAccount'][_0x3ddc('0x106')](db['CannedAnswer'],{'as':_0x3ddc('0x15d'),'foreignKey':_0x3ddc('0x159')});db[_0x3ddc('0x3a')][_0x3ddc('0x106')](db[_0x3ddc('0x15e')],{'as':_0x3ddc('0x152'),'foreignKey':_0x3ddc('0x159')});db[_0x3ddc('0x3a')]['hasMany'](db['MailInteraction'],{'as':'Interactions'});db[_0x3ddc('0x3a')]['hasMany'](db[_0x3ddc('0x42')],{'as':_0x3ddc('0x13f')});db['MailAccount'][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':'List','foreignKey':_0x3ddc('0x15f')});db['MailAccount'][_0x3ddc('0x115')](db[_0x3ddc('0x86')],{'as':'Template','foreignKey':_0x3ddc('0x160')});db[_0x3ddc('0x3a')][_0x3ddc('0x115')](db['Pause'],{'as':_0x3ddc('0x14c'),'foreignKey':_0x3ddc('0x14d')});db[_0x3ddc('0x3a')]['belongsToMany'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x131')});db['MailQueue'][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x32')});db[_0x3ddc('0x125')][_0x3ddc('0x117')](db['Team'],{'through':_0x3ddc('0x161'),'as':_0x3ddc('0x150')});db[_0x3ddc('0x3f')][_0x3ddc('0x106')](db['MailMessage'],{'as':'Messages','onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x162')});db['MailInteraction']['belongsTo'](db[_0x3ddc('0x3a')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x159')});db[_0x3ddc('0x3f')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x3f')]['belongsTo'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x164'),'foreignKey':'UserId'});db[_0x3ddc('0x3f')][_0x3ddc('0x117')](db['Tag'],{'through':_0x3ddc('0x165'),'as':_0x3ddc('0x166')});db[_0x3ddc('0x3f')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x165'),'as':_0x3ddc('0x167')});db[_0x3ddc('0x3f')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x168'),'through':'user_has_mail_interactions','foreignKey':_0x3ddc('0x162')});db[_0x3ddc('0x15e')]['hasMany'](db[_0x3ddc('0x169')],{'as':_0x3ddc('0x16a'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x15e')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':'User'});db['MailMessage'][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x157')});db[_0x3ddc('0x15e')]['belongsTo'](db[_0x3ddc('0x3f')],{'as':_0x3ddc('0x16b'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x3ddc('0x115')](db[_0x3ddc('0x3a')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x159')});db[_0x3ddc('0x42')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x42')]['belongsTo'](db[_0x3ddc('0x125')],{'onDelete':'restrict'});db[_0x3ddc('0x42')][_0x3ddc('0x115')](db[_0x3ddc('0x3a')],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x42')][_0x3ddc('0x115')](db[_0x3ddc('0x14a')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x3ddc('0x42')][_0x3ddc('0x115')](db[_0x3ddc('0x84')],{'onDelete':'restrict','foreignKey':_0x3ddc('0x16d')});db[_0x3ddc('0x16e')][_0x3ddc('0x115')](db[_0x3ddc('0x3a')],{});db[_0x3ddc('0x16e')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x16e')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db['MailQueueReport']['belongsTo'](db[_0x3ddc('0x3f')],{});db[_0x3ddc('0x16e')][_0x3ddc('0x115')](db[_0x3ddc('0x15e')],{});db['MailQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{});db['MailQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x125')],{});db[_0x3ddc('0x170')][_0x3ddc('0x106')](db[_0x3ddc('0x46')],{'as':_0x3ddc('0x171'),'onDelete':'cascade'});db[_0x3ddc('0x12f')]['hasMany'](db[_0x3ddc('0x77')],{'as':_0x3ddc('0x172'),'foreignKey':_0x3ddc('0x173')});db[_0x3ddc('0x12f')][_0x3ddc('0x106')](db[_0x3ddc('0x75')],{'as':_0x3ddc('0x15d'),'foreignKey':_0x3ddc('0x173')});db[_0x3ddc('0x12f')][_0x3ddc('0x106')](db[_0x3ddc('0x49')],{'as':_0x3ddc('0x174')});db[_0x3ddc('0x12f')]['hasMany'](db[_0x3ddc('0x175')],{'as':_0x3ddc('0x13f')});db[_0x3ddc('0x12f')][_0x3ddc('0x106')](db[_0x3ddc('0x15')],{'as':_0x3ddc('0x176'),'onDelete':'cascade'});db['FaxAccount'][_0x3ddc('0x106')](db[_0x3ddc('0x177')],{'as':_0x3ddc('0x152')});db['FaxAccount'][_0x3ddc('0x115')](db[_0x3ddc('0x2a')],{'as':'Trunk'});db['FaxAccount'][_0x3ddc('0x115')](db['CmList'],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x12f')]['belongsTo'](db[_0x3ddc('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3ddc('0x14d')});db[_0x3ddc('0x12f')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x178')});db[_0x3ddc('0x175')][_0x3ddc('0x115')](db['User'],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db[_0x3ddc('0x4c')],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x175')][_0x3ddc('0x115')](db['FaxAccount'],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x175')]['belongsTo'](db[_0x3ddc('0x84')],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x16d')});db['FaxInteraction'][_0x3ddc('0x106')](db['FaxMessage'],{'as':_0x3ddc('0x152'),'onDelete':'cascade','foreignKey':_0x3ddc('0x179')});db[_0x3ddc('0x49')]['belongsTo'](db[_0x3ddc('0x12f')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x173')});db[_0x3ddc('0x49')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db['FaxInteraction'][_0x3ddc('0x115')](db['User'],{'as':_0x3ddc('0x164'),'foreignKey':'UserId'});db[_0x3ddc('0x49')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x17a'),'as':_0x3ddc('0x166')});db[_0x3ddc('0x49')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x17a'),'as':_0x3ddc('0x167')});db[_0x3ddc('0x49')]['belongsToMany'](db[_0x3ddc('0x10')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'onDelete':_0x3ddc('0x104'),'as':'User'});db[_0x3ddc('0x177')][_0x3ddc('0x115')](db[_0x3ddc('0x49')],{'as':_0x3ddc('0x16b'),'foreignKey':_0x3ddc('0x179')});db[_0x3ddc('0x177')][_0x3ddc('0x115')](db['CmContact'],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x157')});db[_0x3ddc('0x177')]['belongsTo'](db[_0x3ddc('0x169')],{'as':'Attachment','foreignKey':_0x3ddc('0x17b')});db[_0x3ddc('0x177')][_0x3ddc('0x115')](db[_0x3ddc('0x12f')],{'as':_0x3ddc('0x163'),'foreignKey':'FaxAccountId'});db[_0x3ddc('0x4c')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x34')});db['FaxQueue'][_0x3ddc('0x117')](db[_0x3ddc('0xda')],{'through':_0x3ddc('0x17c'),'as':_0x3ddc('0x150')});db[_0x3ddc('0x17d')]['belongsTo'](db[_0x3ddc('0x12f')],{});db['FaxQueueReport']['belongsTo'](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x17d')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':'ContactId'});db[_0x3ddc('0x17d')][_0x3ddc('0x115')](db[_0x3ddc('0x49')],{});db['FaxQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x177')],{});db[_0x3ddc('0x17d')][_0x3ddc('0x115')](db['User'],{});db[_0x3ddc('0x17d')][_0x3ddc('0x115')](db[_0x3ddc('0x4c')],{});db['SmsAccount']['hasMany'](db[_0x3ddc('0x77')],{'as':_0x3ddc('0x172'),'foreignKey':_0x3ddc('0x17e')});db['SmsAccount'][_0x3ddc('0x106')](db[_0x3ddc('0x75')],{'as':_0x3ddc('0x15d'),'foreignKey':_0x3ddc('0x17e')});db['SmsAccount'][_0x3ddc('0x106')](db['SmsMessage'],{'as':_0x3ddc('0x152'),'foreignKey':_0x3ddc('0x17e')});db[_0x3ddc('0x4e')][_0x3ddc('0x106')](db['SmsInteraction'],{'as':_0x3ddc('0x174')});db[_0x3ddc('0x4e')]['hasMany'](db[_0x3ddc('0x50')],{'as':'Applications'});db[_0x3ddc('0x4e')]['belongsTo'](db[_0x3ddc('0xeb')],{'as':'List','foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x4e')]['belongsTo'](db[_0x3ddc('0x7b')],{'as':_0x3ddc('0x14c'),'foreignKey':_0x3ddc('0x14d')});db[_0x3ddc('0x4e')][_0x3ddc('0x117')](db['User'],{'as':'Agents','through':_0x3ddc('0x136')});db[_0x3ddc('0x50')]['belongsTo'](db['User'],{'onDelete':_0x3ddc('0x16c')});db['SmsApplication'][_0x3ddc('0x115')](db[_0x3ddc('0x55')],{'onDelete':'restrict'});db[_0x3ddc('0x50')][_0x3ddc('0x115')](db['SmsAccount'],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x50')][_0x3ddc('0x115')](db[_0x3ddc('0x14a')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x3ddc('0x50')][_0x3ddc('0x115')](db['Tag'],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x16d')});db['SmsInteraction']['hasMany'](db[_0x3ddc('0x53')],{'as':_0x3ddc('0x152'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0x3ddc('0x10f')][_0x3ddc('0x115')](db[_0x3ddc('0x4e')],{'as':_0x3ddc('0x163'),'foreignKey':'SmsAccountId'});db[_0x3ddc('0x10f')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x10f')][_0x3ddc('0x115')](db['User'],{'as':_0x3ddc('0x164'),'foreignKey':'UserId'});db['SmsInteraction'][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x17f'),'as':_0x3ddc('0x166')});db[_0x3ddc('0x10f')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':'sms_interaction_has_tags','as':_0x3ddc('0x167')});db[_0x3ddc('0x10f')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x168'),'through':'user_has_sms_interactions','foreignKey':_0x3ddc('0x180')});db[_0x3ddc('0x53')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':'User'});db[_0x3ddc('0x53')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'onDelete':_0x3ddc('0x104'),'as':'Contact'});db[_0x3ddc('0x53')]['belongsTo'](db[_0x3ddc('0x10f')],{'onDelete':'cascade','as':_0x3ddc('0x16b'),'foreignKey':'SmsInteractionId'});db[_0x3ddc('0x53')][_0x3ddc('0x115')](db[_0x3ddc('0x4e')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x17e')});db['SmsQueue'][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':'UserSmsQueue','foreignKey':_0x3ddc('0x181')});db[_0x3ddc('0x55')][_0x3ddc('0x117')](db[_0x3ddc('0xda')],{'through':_0x3ddc('0x182'),'as':_0x3ddc('0x150')});db[_0x3ddc('0x132')][_0x3ddc('0x106')](db[_0x3ddc('0x77')],{'as':'Dispositions','foreignKey':_0x3ddc('0x183')});db[_0x3ddc('0x132')][_0x3ddc('0x106')](db['CannedAnswer'],{'as':_0x3ddc('0x15d'),'foreignKey':_0x3ddc('0x183')});db['OpenchannelAccount'][_0x3ddc('0x106')](db[_0x3ddc('0x5a')],{'as':_0x3ddc('0x174'),'foreignKey':_0x3ddc('0x183')});db[_0x3ddc('0x132')]['hasMany'](db['OpenchannelMessage'],{'as':_0x3ddc('0x152'),'foreignKey':_0x3ddc('0x183')});db['OpenchannelAccount'][_0x3ddc('0x106')](db['OpenchannelApplication'],{'as':_0x3ddc('0x13f'),'foreignKey':_0x3ddc('0x183')});db[_0x3ddc('0x132')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':'List','foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x132')][_0x3ddc('0x115')](db[_0x3ddc('0x7b')],{'as':_0x3ddc('0x14c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x3ddc('0x132')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':'user_has_openchannel_accounts'});db[_0x3ddc('0x58')][_0x3ddc('0x115')](db['User'],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x58')][_0x3ddc('0x115')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x3ddc('0x184')});db[_0x3ddc('0x58')][_0x3ddc('0x115')](db[_0x3ddc('0x132')],{'onDelete':'restrict','foreignKey':_0x3ddc('0x183')});db[_0x3ddc('0x58')]['belongsTo'](db[_0x3ddc('0x14a')],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x14b')});db[_0x3ddc('0x58')][_0x3ddc('0x115')](db[_0x3ddc('0x84')],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x16d')});db[_0x3ddc('0x5a')][_0x3ddc('0x106')](db[_0x3ddc('0x5c')],{'as':_0x3ddc('0x152'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x185')});db[_0x3ddc('0x5a')][_0x3ddc('0x115')](db[_0x3ddc('0x132')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x183')});db[_0x3ddc('0x5a')]['belongsTo'](db['CmContact'],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x5a')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x164'),'foreignKey':'UserId'});db[_0x3ddc('0x5a')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x186'),'as':_0x3ddc('0x166')});db[_0x3ddc('0x5a')]['belongsToMany'](db['Tag'],{'through':_0x3ddc('0x186'),'as':_0x3ddc('0x167')});db[_0x3ddc('0x5a')][_0x3ddc('0x117')](db['User'],{'as':'Users','through':_0x3ddc('0x123'),'foreignKey':'OpenchannelInteractionId'});db[_0x3ddc('0x5c')][_0x3ddc('0x115')](db['User'],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x10')});db['OpenchannelMessage'][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x157')});db[_0x3ddc('0x5c')][_0x3ddc('0x115')](db['OpenchannelInteraction'],{'onDelete':_0x3ddc('0x104'),'as':'Interaction','foreignKey':_0x3ddc('0x185')});db[_0x3ddc('0x5c')]['belongsTo'](db[_0x3ddc('0x169')],{'as':_0x3ddc('0x169'),'foreignKey':_0x3ddc('0x17b')});db[_0x3ddc('0x5c')][_0x3ddc('0x115')](db[_0x3ddc('0x132')],{'as':_0x3ddc('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x3ddc('0x5e')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':'UserOpenchannelQueue','foreignKey':'OpenchannelQueueId'});db[_0x3ddc('0x5e')][_0x3ddc('0x117')](db[_0x3ddc('0xda')],{'through':_0x3ddc('0x187'),'as':_0x3ddc('0x150')});db[_0x3ddc('0x60')][_0x3ddc('0x106')](db[_0x3ddc('0x77')],{'as':_0x3ddc('0x172'),'foreignKey':_0x3ddc('0x188')});db[_0x3ddc('0x60')][_0x3ddc('0x106')](db[_0x3ddc('0x75')],{'as':_0x3ddc('0x15d'),'foreignKey':_0x3ddc('0x188')});db[_0x3ddc('0x60')][_0x3ddc('0x106')](db['ChatProactiveAction'],{'as':_0x3ddc('0x189')});db[_0x3ddc('0x60')][_0x3ddc('0x106')](db[_0x3ddc('0x64')],{'as':'Interactions'});db['ChatWebsite'][_0x3ddc('0x106')](db[_0x3ddc('0x62')],{'as':_0x3ddc('0x13f')});db[_0x3ddc('0x60')][_0x3ddc('0x106')](db[_0x3ddc('0x18a')],{'as':_0x3ddc('0x152')});db[_0x3ddc('0x60')][_0x3ddc('0x115')](db['CmList'],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x60')][_0x3ddc('0x115')](db[_0x3ddc('0x14a')],{'as':_0x3ddc('0x14a'),'foreignKey':_0x3ddc('0x14b')});db[_0x3ddc('0x60')]['belongsTo'](db[_0x3ddc('0x7b')],{'as':'mandatoryDispositionPause','foreignKey':_0x3ddc('0x14d')});db[_0x3ddc('0x60')]['belongsToMany'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x12e')});db[_0x3ddc('0x18b')]['belongsTo'](db[_0x3ddc('0x132')],{});db[_0x3ddc('0x18b')][_0x3ddc('0x115')](db['CmList'],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0x18b')][_0x3ddc('0x115')](db['CmContact'],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x18b')]['belongsTo'](db[_0x3ddc('0x5a')],{});db['OpenchannelQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x5c')],{});db[_0x3ddc('0x18b')]['belongsTo'](db[_0x3ddc('0x10')],{});db[_0x3ddc('0x18b')][_0x3ddc('0x115')](db[_0x3ddc('0x5e')],{});db['ChatApplication']['belongsTo'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x18c'),'foreignKey':_0x3ddc('0x105'),'onDelete':_0x3ddc('0x16c')});db['ChatApplication'][_0x3ddc('0x115')](db[_0x3ddc('0x18d')],{'as':_0x3ddc('0x18e'),'foreignKey':_0x3ddc('0x18f'),'onDelete':'restrict'});db[_0x3ddc('0x62')][_0x3ddc('0x115')](db[_0x3ddc('0x60')],{'as':_0x3ddc('0x190'),'foreignKey':_0x3ddc('0x188'),'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x62')]['belongsTo'](db[_0x3ddc('0x84')],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x16d')});db['ChatInteraction']['hasMany'](db[_0x3ddc('0x18a')],{'as':_0x3ddc('0x152'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x191')});db['ChatInteraction'][_0x3ddc('0x115')](db[_0x3ddc('0x60')],{'as':_0x3ddc('0x163'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction']['belongsTo'](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':'ContactId'});db[_0x3ddc('0x64')]['belongsTo'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x164'),'foreignKey':'UserId'});db[_0x3ddc('0x64')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x192'),'as':_0x3ddc('0x166')});db['ChatInteraction']['belongsToMany'](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x192'),'as':_0x3ddc('0x167')});db[_0x3ddc('0x64')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x168'),'through':_0x3ddc('0x11f'),'foreignKey':_0x3ddc('0x191')});db[_0x3ddc('0x18a')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x10')});db['ChatMessage'][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x18a')]['belongsTo'](db[_0x3ddc('0x64')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x16b'),'foreignKey':_0x3ddc('0x191')});db[_0x3ddc('0x18a')]['belongsTo'](db['Attachment'],{'as':_0x3ddc('0x169'),'foreignKey':_0x3ddc('0x17b')});db['ChatMessage'][_0x3ddc('0x115')](db['ChatWebsite'],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x188')});db[_0x3ddc('0x66')][_0x3ddc('0x115')](db['CmContact'],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x66')][_0x3ddc('0x115')](db[_0x3ddc('0x60')],{'as':_0x3ddc('0x163'),'foreignKey':'ChatWebsiteId'});db[_0x3ddc('0x18d')][_0x3ddc('0x117')](db['User'],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x30'),'hooks':!![]});db[_0x3ddc('0x18d')]['belongsToMany'](db[_0x3ddc('0xda')],{'through':_0x3ddc('0x193'),'as':_0x3ddc('0x150')});db[_0x3ddc('0x67')][_0x3ddc('0x106')](db[_0x3ddc('0xc7')],{'as':_0x3ddc('0x152'),'foreignKey':'ChatGroupId','onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x67')]['belongsToMany'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x142'),'through':_0x3ddc('0x119')});db[_0x3ddc('0x194')][_0x3ddc('0x115')](db[_0x3ddc('0x60')],{'as':_0x3ddc('0x190'),'foreignKey':'ChatWebsiteId'});db[_0x3ddc('0x6a')][_0x3ddc('0x106')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x11a'),'foreignKey':_0x3ddc('0x195')});db['CmContact'][_0x3ddc('0x106')](db[_0x3ddc('0x144')],{'as':'Hoppers','foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db[_0x3ddc('0x10a')],{'as':_0x3ddc('0x10b'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db[_0x3ddc('0x10c')],{'as':_0x3ddc('0x146'),'foreignKey':_0x3ddc('0x158')});db['CmContact'][_0x3ddc('0x106')](db[_0x3ddc('0x70')],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db[_0x3ddc('0xcc')],{'as':_0x3ddc('0x148'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db[_0x3ddc('0x5a')],{'as':_0x3ddc('0x196'),'foreignKey':'ContactId','onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db[_0x3ddc('0x64')],{'as':_0x3ddc('0x10e'),'foreignKey':_0x3ddc('0x158'),'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db['SmsInteraction'],{'as':_0x3ddc('0x197'),'foreignKey':_0x3ddc('0x158'),'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x6b')][_0x3ddc('0x106')](db[_0x3ddc('0x49')],{'as':'FaxInteractions','foreignKey':_0x3ddc('0x158'),'onDelete':'restrict'});db['CmContact'][_0x3ddc('0x106')](db['MailInteraction'],{'as':_0x3ddc('0x110'),'foreignKey':_0x3ddc('0x158'),'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x6b')][_0x3ddc('0x115')](db[_0x3ddc('0x6a')],{'as':_0x3ddc('0x198'),'foreignKey':_0x3ddc('0x195')});db[_0x3ddc('0x6b')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':'List','foreignKey':_0x3ddc('0x15f'),'onDelete':_0x3ddc('0x104')});db['CmContact'][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x168'),'through':'cm_user_has_contacts'});db[_0x3ddc('0x6b')][_0x3ddc('0x117')](db['Tag'],{'as':_0x3ddc('0x166'),'through':'cm_contact_has_tags'});db['CmContact'][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x199'),'as':_0x3ddc('0x167')});db[_0x3ddc('0x144')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x144')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x144')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x18c'),'foreignKey':_0x3ddc('0x105')});db[_0x3ddc('0x144')][_0x3ddc('0x115')](db[_0x3ddc('0x19')],{'as':_0x3ddc('0x18e'),'foreignKey':_0x3ddc('0x143'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x144')][_0x3ddc('0x115')](db[_0x3ddc('0xdc')],{'as':_0x3ddc('0xdc'),'foreignKey':'CampaignId','onDelete':'cascade'});db['CmHopper'][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':'Owner','foreignKey':_0x3ddc('0x19a')});db[_0x3ddc('0x147')]['belongsTo'](db['CmContact'],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x147')]['belongsTo'](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f'),'onDelete':'cascade'});db[_0x3ddc('0x147')][_0x3ddc('0x115')](db[_0x3ddc('0x19')],{'as':_0x3ddc('0x18e'),'foreignKey':_0x3ddc('0x143'),'onDelete':_0x3ddc('0x104')});db['CmHopperBlack'][_0x3ddc('0x115')](db[_0x3ddc('0xdc')],{'as':_0x3ddc('0xdc'),'foreignKey':_0x3ddc('0x19b'),'onDelete':'cascade'});db['Automation'][_0x3ddc('0x106')](db['Condition'],{'as':{'plural':'All','singular':_0x3ddc('0x19c')},'foreignKey':_0x3ddc('0x19d'),'onDelete':'cascade','hooks':!![]});db[_0x3ddc('0x73')][_0x3ddc('0x106')](db[_0x3ddc('0x19e')],{'as':{'plural':'Any','singular':_0x3ddc('0x19f')},'foreignKey':'AutomationAnyId','onDelete':_0x3ddc('0x104'),'hooks':!![]});db['Automation'][_0x3ddc('0x106')](db[_0x3ddc('0x72')],{'as':_0x3ddc('0x1a0'),'foreignKey':_0x3ddc('0x1a1'),'onDelete':_0x3ddc('0x104'),'hooks':!![]});db[_0x3ddc('0x77')][_0x3ddc('0x106')](db[_0x3ddc('0x77')],{'as':_0x3ddc('0x172'),'foreignKey':_0x3ddc('0x1a2'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x14a')]['hasMany'](db['Interval'],{'as':_0x3ddc('0x1a3'),'foreignKey':_0x3ddc('0x14b'),'onDelete':_0x3ddc('0x104'),'hooks':!![],'required':![]});db[_0x3ddc('0x14a')]['hasMany'](db['VoiceExtension'],{'as':_0x3ddc('0x109'),'foreignKey':_0x3ddc('0x14b'),'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0x14a')][_0x3ddc('0x106')](db[_0x3ddc('0x42')],{'as':_0x3ddc('0x1a4'),'foreignKey':_0x3ddc('0x14b')});db[_0x3ddc('0x14a')]['hasMany'](db[_0x3ddc('0x62')],{'as':_0x3ddc('0x1a5'),'foreignKey':'IntervalId'});db['Interval']['hasMany'](db[_0x3ddc('0x175')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0x3ddc('0x14a')][_0x3ddc('0x106')](db[_0x3ddc('0x50')],{'as':_0x3ddc('0x1a6'),'foreignKey':'IntervalId'});db[_0x3ddc('0x81')][_0x3ddc('0x115')](db['MailAccount'],{});db[_0x3ddc('0x81')][_0x3ddc('0x115')](db[_0x3ddc('0x8f')],{'foreignKey':'DefaultReportId'});db[_0x3ddc('0x81')][_0x3ddc('0x115')](db['AnalyticCustomReport'],{'foreignKey':_0x3ddc('0x1a7')});db[_0x3ddc('0x82')][_0x3ddc('0x117')](db['VoiceMusicOnHold'],{'as':_0x3ddc('0x1a8'),'through':_0x3ddc('0x141'),'onDelete':'restrict'});db[_0x3ddc('0x84')]['belongsToMany'](db['CmContact'],{'through':_0x3ddc('0x199')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x3ddc('0x84')][_0x3ddc('0x117')](db['MailInteraction'],{'through':_0x3ddc('0x165')});db['Tag']['belongsToMany'](db[_0x3ddc('0x10f')],{'through':'sms_interaction_has_tags'});db['Tag'][_0x3ddc('0x117')](db[_0x3ddc('0x49')],{'through':_0x3ddc('0x17a')});db[_0x3ddc('0x84')][_0x3ddc('0x117')](db[_0x3ddc('0x5a')],{'through':_0x3ddc('0x186')});db['Tag'][_0x3ddc('0x117')](db[_0x3ddc('0xf8')],{'through':'whatsapp_interaction_has_tags'});db['Trigger'][_0x3ddc('0x106')](db['Condition'],{'as':{'plural':_0x3ddc('0x1a9'),'singular':_0x3ddc('0x1aa')},'foreignKey':_0x3ddc('0x1ab'),'onDelete':_0x3ddc('0x104'),'hooks':!![]});db['Trigger'][_0x3ddc('0x106')](db[_0x3ddc('0x19e')],{'as':{'plural':_0x3ddc('0x1ac'),'singular':_0x3ddc('0x1ad')},'foreignKey':_0x3ddc('0x1ae'),'onDelete':'cascade','hooks':!![]});db[_0x3ddc('0x87')]['hasMany'](db[_0x3ddc('0x72')],{'as':_0x3ddc('0x1a0'),'foreignKey':_0x3ddc('0x1af'),'onDelete':_0x3ddc('0x104'),'hooks':!![]});db[_0x3ddc('0x8d')][_0x3ddc('0x106')](db[_0x3ddc('0x1b0')],{'as':'Fields','onDelete':_0x3ddc('0x104'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport']['hasMany'](db[_0x3ddc('0x1b0')],{'as':_0x3ddc('0x1b1'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b2')});db['AnalyticMetric'][_0x3ddc('0x106')](db[_0x3ddc('0x1b0')],{'as':_0x3ddc('0x1b1'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b3')});db[_0x3ddc('0x1b0')][_0x3ddc('0x115')](db['AnalyticMetric'],{'foreignKey':_0x3ddc('0x1b3')});db[_0x3ddc('0x95')][_0x3ddc('0x106')](db[_0x3ddc('0x1b4')],{'as':'Configurations','onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db['SalesforceConfiguration'][_0x3ddc('0x106')](db[_0x3ddc('0x1b6')],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x3ddc('0x1b4')][_0x3ddc('0x106')](db[_0x3ddc('0x1b6')],{'as':_0x3ddc('0x1b7'),'onDelete':_0x3ddc('0x104'),'foreignKey':'DescriptionId'});db[_0x3ddc('0x1b4')]['hasMany'](db[_0x3ddc('0x1b6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1b4')][_0x3ddc('0x115')](db[_0x3ddc('0x95')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0x1b6')][_0x3ddc('0x106')](db[_0x3ddc('0x1b6')],{'as':'Subject','foreignKey':'SubjectId'});db['SalesforceField'][_0x3ddc('0x106')](db['SalesforceField'],{'as':_0x3ddc('0x1b9'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0x1b6')]['hasMany'](db[_0x3ddc('0x1b6')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1b6')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0x99')][_0x3ddc('0x106')](db[_0x3ddc('0x9b')],{'as':'Configurations','onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db['SugarcrmConfiguration'][_0x3ddc('0x106')](db[_0x3ddc('0x9d')],{'as':_0x3ddc('0x1bd'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0x9b')]['hasMany'](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x3ddc('0x104'),'foreignKey':'DescriptionId'});db[_0x3ddc('0x9b')][_0x3ddc('0x106')](db['SugarcrmField'],{'as':_0x3ddc('0x1b1'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x9b')][_0x3ddc('0x115')](db[_0x3ddc('0x99')],{'as':_0x3ddc('0x163'),'foreignKey':'AccountId'});db[_0x3ddc('0x9d')][_0x3ddc('0x106')](db['SugarcrmField'],{'as':_0x3ddc('0x1bf'),'foreignKey':'SubjectId'});db[_0x3ddc('0x9d')][_0x3ddc('0x106')](db['SugarcrmField'],{'as':_0x3ddc('0x1b9'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0x9d')][_0x3ddc('0x106')](db['SugarcrmField'],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x9d')]['belongsTo'](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0x9f')]['hasMany'](db['DeskConfiguration'],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xa1')][_0x3ddc('0x106')](db[_0x3ddc('0xa2')],{'as':_0x3ddc('0x1bd'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xa1')][_0x3ddc('0x106')](db[_0x3ddc('0xa2')],{'as':'Descriptions','onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xa1')]['hasMany'](db[_0x3ddc('0xa2')],{'as':_0x3ddc('0x1b1'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0xa1')][_0x3ddc('0x115')](db['DeskAccount'],{'as':'Account','foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xa1')][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x1c1')});db[_0x3ddc('0xa2')][_0x3ddc('0x106')](db[_0x3ddc('0xa2')],{'as':_0x3ddc('0x1bf'),'foreignKey':_0x3ddc('0x1be')});db['DeskField'][_0x3ddc('0x106')](db[_0x3ddc('0xa2')],{'as':_0x3ddc('0x1b9'),'foreignKey':'DescriptionId'});db[_0x3ddc('0xa2')][_0x3ddc('0x106')](db[_0x3ddc('0xa2')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0xa2')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0xa4')][_0x3ddc('0x106')](db[_0x3ddc('0xa6')],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':'AccountId'});db['ZohoConfiguration'][_0x3ddc('0x106')](db[_0x3ddc('0xa8')],{'as':'Subjects','onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1be')});db['ZohoConfiguration'][_0x3ddc('0x106')](db[_0x3ddc('0xa8')],{'as':_0x3ddc('0x1b7'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xa6')][_0x3ddc('0x106')](db['ZohoField'],{'as':_0x3ddc('0x1b1'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0xa6')][_0x3ddc('0x115')](db[_0x3ddc('0xa4')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db['ZohoField'][_0x3ddc('0x106')](db[_0x3ddc('0xa8')],{'as':_0x3ddc('0x1bf'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xa8')][_0x3ddc('0x106')](db[_0x3ddc('0xa8')],{'as':_0x3ddc('0x1b9'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xa8')][_0x3ddc('0x106')](db[_0x3ddc('0xa8')],{'as':'Field','foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0xa8')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db['ZendeskAccount'][_0x3ddc('0x106')](db[_0x3ddc('0xab')],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xab')][_0x3ddc('0x106')](db[_0x3ddc('0x1c2')],{'as':_0x3ddc('0x1bd'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xab')]['hasMany'](db['ZendeskField'],{'as':_0x3ddc('0x1b7'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xab')][_0x3ddc('0x106')](db[_0x3ddc('0x1c2')],{'as':'Fields','foreignKey':'FieldId'});db[_0x3ddc('0xab')]['belongsTo'](db[_0x3ddc('0xaa')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xab')][_0x3ddc('0x117')](db['Tag'],{'through':_0x3ddc('0x1c3')});db['ZendeskField'][_0x3ddc('0x106')](db[_0x3ddc('0x1c2')],{'as':_0x3ddc('0x1bf'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0x1c2')][_0x3ddc('0x106')](db[_0x3ddc('0x1c2')],{'as':'Description','foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0x1c2')][_0x3ddc('0x106')](db[_0x3ddc('0x1c2')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1c2')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0x1c4')][_0x3ddc('0x106')](db[_0x3ddc('0xaf')],{'as':_0x3ddc('0x1c0'),'onDelete':'cascade','foreignKey':_0x3ddc('0x1b5')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':_0x3ddc('0x1bd'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xaf')]['hasMany'](db[_0x3ddc('0x1c5')],{'as':_0x3ddc('0x1b7'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xaf')][_0x3ddc('0x106')](db[_0x3ddc('0x1c5')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x3ddc('0x1b8')});db['FreshdeskConfiguration'][_0x3ddc('0x115')](db[_0x3ddc('0x1c4')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db['FreshdeskConfiguration']['belongsToMany'](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x1c6')});db['FreshdeskField']['hasMany'](db[_0x3ddc('0x1c5')],{'as':_0x3ddc('0x1bf'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x3ddc('0x106')](db['FreshdeskField'],{'as':_0x3ddc('0x1b9'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0x1c5')][_0x3ddc('0x106')](db[_0x3ddc('0x1c5')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1c5')][_0x3ddc('0x115')](db['Variable'],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db['VtigerAccount']['hasMany'](db['VtigerConfiguration'],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':'AccountId'});db[_0x3ddc('0x1c7')]['hasMany'](db[_0x3ddc('0xb3')],{'as':_0x3ddc('0x1bd'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0x1c7')][_0x3ddc('0x106')](db[_0x3ddc('0xb3')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x3ddc('0x1c7')]['hasMany'](db[_0x3ddc('0xb3')],{'as':'Fields','foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1c7')][_0x3ddc('0x115')](db[_0x3ddc('0xb2')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xb3')][_0x3ddc('0x106')](db[_0x3ddc('0xb3')],{'as':'Subject','foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xb3')][_0x3ddc('0x106')](db[_0x3ddc('0xb3')],{'as':_0x3ddc('0x1b9'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xb3')][_0x3ddc('0x106')](db[_0x3ddc('0xb3')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0xb3')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':'VariableId'});db[_0x3ddc('0xb5')][_0x3ddc('0x106')](db['ServicenowConfiguration'],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db['ServicenowConfiguration']['hasMany'](db['ServicenowField'],{'as':_0x3ddc('0x1bd'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xb7')][_0x3ddc('0x106')](db[_0x3ddc('0x1c8')],{'as':_0x3ddc('0x1b7'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xb7')]['hasMany'](db['ServicenowField'],{'as':_0x3ddc('0x1b1'),'foreignKey':_0x3ddc('0x1b8')});db['ServicenowConfiguration']['belongsTo'](db[_0x3ddc('0xb5')],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0x1c8')][_0x3ddc('0x106')](db[_0x3ddc('0x1c8')],{'as':_0x3ddc('0x1bf'),'foreignKey':_0x3ddc('0x1be')});db['ServicenowField'][_0x3ddc('0x106')](db[_0x3ddc('0x1c8')],{'as':'Description','foreignKey':'DescriptionId'});db['ServicenowField'][_0x3ddc('0x106')](db[_0x3ddc('0x1c8')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1c8')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0xba')][_0x3ddc('0x106')](db[_0x3ddc('0xbc')],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xbc')]['hasMany'](db[_0x3ddc('0xbd')],{'as':'Subjects','onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xbc')][_0x3ddc('0x106')](db[_0x3ddc('0xbd')],{'as':_0x3ddc('0x1b7'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0xbc')][_0x3ddc('0x106')](db[_0x3ddc('0xbd')],{'as':_0x3ddc('0x1b1'),'onDelete':'cascade','foreignKey':'FieldId'});db[_0x3ddc('0xbc')][_0x3ddc('0x115')](db['Dynamics365Account'],{'as':_0x3ddc('0x163'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0xbd')][_0x3ddc('0x106')](db[_0x3ddc('0xbd')],{'as':'Subject','foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0xbd')][_0x3ddc('0x106')](db[_0x3ddc('0xbd')],{'as':_0x3ddc('0x1b9'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0x3ddc('0x106')](db[_0x3ddc('0xbd')],{'as':'Field','foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0xbd')][_0x3ddc('0x115')](db[_0x3ddc('0x89')],{'as':'Variable','foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0x1c9')][_0x3ddc('0x106')](db[_0x3ddc('0x1ca')],{'as':_0x3ddc('0x1c0'),'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0x1ca')]['hasMany'](db[_0x3ddc('0x1cb')],{'as':_0x3ddc('0x1bd'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0x1ca')]['hasMany'](db['FreshsalesField'],{'as':_0x3ddc('0x1b7'),'foreignKey':_0x3ddc('0x1ba')});db[_0x3ddc('0x1ca')][_0x3ddc('0x106')](db[_0x3ddc('0x1cb')],{'as':_0x3ddc('0x1b1'),'foreignKey':'FieldId'});db[_0x3ddc('0x1ca')][_0x3ddc('0x115')](db[_0x3ddc('0x1c9')],{'as':'Account','foreignKey':_0x3ddc('0x1b5')});db[_0x3ddc('0x1cb')][_0x3ddc('0x106')](db[_0x3ddc('0x1cb')],{'as':_0x3ddc('0x1bf'),'foreignKey':_0x3ddc('0x1be')});db[_0x3ddc('0x1cb')][_0x3ddc('0x106')](db[_0x3ddc('0x1cb')],{'as':_0x3ddc('0x1b9'),'foreignKey':_0x3ddc('0x1ba')});db['FreshsalesField'][_0x3ddc('0x106')](db[_0x3ddc('0x1cb')],{'as':_0x3ddc('0x1bb'),'foreignKey':_0x3ddc('0x1b8')});db[_0x3ddc('0x1cb')][_0x3ddc('0x115')](db['Variable'],{'as':_0x3ddc('0x89'),'foreignKey':_0x3ddc('0x1bc')});db[_0x3ddc('0xc5')][_0x3ddc('0x115')](db[_0x3ddc('0x60')],{});db[_0x3ddc('0xc5')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0xc5')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0xc5')][_0x3ddc('0x115')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x18a')],{});db[_0x3ddc('0xc5')][_0x3ddc('0x115')](db['User'],{});db[_0x3ddc('0xc5')][_0x3ddc('0x115')](db[_0x3ddc('0x18d')],{});db[_0x3ddc('0xc7')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1cc')});db[_0x3ddc('0xc7')]['belongsTo'](db[_0x3ddc('0x10')],{'onDelete':_0x3ddc('0x104'),'foreignKey':_0x3ddc('0x1cd')});db['JscriptySessionReport']['hasMany'](db[_0x3ddc('0xca')],{'foreignKey':_0x3ddc('0x1ce'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0xcc')][_0x3ddc('0x106')](db['JscriptyAnswerReport'],{'foreignKey':_0x3ddc('0x1ce'),'onDelete':_0x3ddc('0x104')});db['SmsQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x4e')],{});db[_0x3ddc('0xce')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0xce')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0xce')][_0x3ddc('0x115')](db['SmsInteraction'],{});db[_0x3ddc('0xce')][_0x3ddc('0x115')](db[_0x3ddc('0x53')],{});db[_0x3ddc('0xce')][_0x3ddc('0x115')](db['User'],{});db[_0x3ddc('0xce')][_0x3ddc('0x115')](db[_0x3ddc('0x55')],{});db[_0x3ddc('0x1cf')][_0x3ddc('0x106')](db[_0x3ddc('0xcc')],{'foreignKey':'ProjectId'});db[_0x3ddc('0x1cf')]['hasMany'](db[_0x3ddc('0xca')],{'foreignKey':_0x3ddc('0x1d0')});db[_0x3ddc('0x1cf')][_0x3ddc('0x106')](db['JscriptyAnswerReport'],{'foreignKey':_0x3ddc('0x1d0')});db[_0x3ddc('0x13a')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':'Users','through':_0x3ddc('0x13c')});db[_0x3ddc('0xda')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_teams'});db[_0x3ddc('0xda')]['belongsToMany'](db[_0x3ddc('0x19')],{'through':_0x3ddc('0x1d1'),'as':_0x3ddc('0x1d2')});db['Team']['belongsToMany'](db[_0x3ddc('0x125')],{'through':'team_has_mail_queues','as':_0x3ddc('0x126')});db[_0x3ddc('0xda')]['belongsToMany'](db[_0x3ddc('0x18d')],{'through':'team_has_chat_queues','as':_0x3ddc('0x127')});db[_0x3ddc('0xda')][_0x3ddc('0x117')](db[_0x3ddc('0x4c')],{'through':'team_has_fax_queues','as':_0x3ddc('0x1d3')});db[_0x3ddc('0xda')][_0x3ddc('0x117')](db['SmsQueue'],{'through':_0x3ddc('0x182'),'as':_0x3ddc('0x128')});db[_0x3ddc('0xda')][_0x3ddc('0x117')](db['OpenchannelQueue'],{'through':_0x3ddc('0x187'),'as':'OpenchannelQueues'});db[_0x3ddc('0xda')][_0x3ddc('0x117')](db[_0x3ddc('0xff')],{'through':_0x3ddc('0x1d4'),'as':_0x3ddc('0x1d5')});db[_0x3ddc('0xdc')][_0x3ddc('0x106')](db['CmHopper'],{'as':_0x3ddc('0x145'),'foreignKey':_0x3ddc('0x19b')});db[_0x3ddc('0xdc')]['hasMany'](db['CmHopperFinal'],{'as':_0x3ddc('0x10b'),'foreignKey':_0x3ddc('0x19b')});db[_0x3ddc('0xdc')][_0x3ddc('0x106')](db['CmHopperHistory'],{'as':_0x3ddc('0x146'),'foreignKey':_0x3ddc('0x19b')});db[_0x3ddc('0xdc')]['hasMany'](db[_0x3ddc('0x147')],{'as':_0x3ddc('0x1d6'),'foreignKey':'CampaignId'});db[_0x3ddc('0xdc')]['belongsTo'](db[_0x3ddc('0x2a')],{'as':'Trunk','foreignKey':_0x3ddc('0x149')});db[_0x3ddc('0xdc')][_0x3ddc('0x115')](db[_0x3ddc('0x2a')],{'as':_0x3ddc('0x1d7'),'foreignKey':_0x3ddc('0x1d8')});db[_0x3ddc('0xdc')][_0x3ddc('0x115')](db['Interval'],{'as':_0x3ddc('0x14a'),'foreignKey':'IntervalId'});db[_0x3ddc('0xdc')]['belongsTo'](db['SquareProject'],{'as':_0x3ddc('0x13a'),'foreignKey':_0x3ddc('0x1d9')});db[_0x3ddc('0xdc')]['belongsToMany'](db[_0x3ddc('0xeb')],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x3ddc('0xdc')]['belongsToMany'](db[_0x3ddc('0xeb')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0x3ddc('0xe3')]['belongsTo'](db[_0x3ddc('0x15e')],{});db[_0x3ddc('0xe3')][_0x3ddc('0x115')](db[_0x3ddc('0x3f')],{});db['MailTransferReport'][_0x3ddc('0x115')](db[_0x3ddc('0x3a')],{'foreignKey':_0x3ddc('0x1da'),'as':_0x3ddc('0x1db')});db[_0x3ddc('0xe3')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1dc'),'as':_0x3ddc('0x1dd')});db['MailTransferReport']['belongsTo'](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1de'),'as':_0x3ddc('0x1df')});db[_0x3ddc('0xe3')]['belongsTo'](db[_0x3ddc('0x125')],{'foreignKey':_0x3ddc('0x1e0'),'as':_0x3ddc('0x1e1')});db[_0x3ddc('0xe3')][_0x3ddc('0x115')](db[_0x3ddc('0x3a')],{'foreignKey':'ToMailAccountId','as':_0x3ddc('0x1e2')});db[_0x3ddc('0x1e3')]['belongsTo'](db[_0x3ddc('0x18a')],{});db[_0x3ddc('0x1e3')]['belongsTo'](db['ChatInteraction'],{});db[_0x3ddc('0x1e3')][_0x3ddc('0x115')](db[_0x3ddc('0x60')],{'foreignKey':_0x3ddc('0x1e4'),'as':_0x3ddc('0x1db')});db[_0x3ddc('0x1e3')][_0x3ddc('0x115')](db['User'],{'foreignKey':_0x3ddc('0x1dc'),'as':'FromAgent'});db[_0x3ddc('0x1e3')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1de'),'as':_0x3ddc('0x1df')});db['ChatTransferReport']['belongsTo'](db[_0x3ddc('0x18d')],{'foreignKey':'ToChatQueueId','as':_0x3ddc('0x1e1')});db[_0x3ddc('0x1e3')]['belongsTo'](db['ChatWebsite'],{'foreignKey':'ToChatWebsiteId','as':_0x3ddc('0x1e2')});db['FaxTransferReport'][_0x3ddc('0x115')](db[_0x3ddc('0x177')],{});db[_0x3ddc('0xe5')]['belongsTo'](db[_0x3ddc('0x49')],{});db[_0x3ddc('0xe5')]['belongsTo'](db[_0x3ddc('0x12f')],{'foreignKey':_0x3ddc('0x1e5'),'as':_0x3ddc('0x1db')});db[_0x3ddc('0xe5')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1dc'),'as':'FromAgent'});db[_0x3ddc('0xe5')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1de'),'as':_0x3ddc('0x1df')});db[_0x3ddc('0xe5')][_0x3ddc('0x115')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0x3ddc('0x1e1')});db['FaxTransferReport'][_0x3ddc('0x115')](db[_0x3ddc('0x12f')],{'foreignKey':_0x3ddc('0x1e6'),'as':_0x3ddc('0x1e2')});db[_0x3ddc('0xe7')][_0x3ddc('0x115')](db['OpenchannelMessage'],{});db[_0x3ddc('0xe7')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0x3ddc('0xe7')]['belongsTo'](db[_0x3ddc('0x132')],{'foreignKey':_0x3ddc('0x1e7'),'as':_0x3ddc('0x1db')});db[_0x3ddc('0xe7')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1dc'),'as':'FromAgent'});db[_0x3ddc('0xe7')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1de'),'as':_0x3ddc('0x1df')});db[_0x3ddc('0xe7')][_0x3ddc('0x115')](db[_0x3ddc('0x5e')],{'foreignKey':_0x3ddc('0x1e8'),'as':'ToQueue'});db[_0x3ddc('0xe7')][_0x3ddc('0x115')](db[_0x3ddc('0x132')],{'foreignKey':_0x3ddc('0x1e9'),'as':_0x3ddc('0x1e2')});db['SmsTransferReport'][_0x3ddc('0x115')](db[_0x3ddc('0x53')],{});db[_0x3ddc('0xe9')]['belongsTo'](db[_0x3ddc('0x10f')],{});db[_0x3ddc('0xe9')][_0x3ddc('0x115')](db[_0x3ddc('0x4e')],{'foreignKey':'FromSmsAccountId','as':_0x3ddc('0x1db')});db['SmsTransferReport'][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1dc'),'as':_0x3ddc('0x1dd')});db[_0x3ddc('0xe9')][_0x3ddc('0x115')](db['User'],{'foreignKey':'ToUserId','as':_0x3ddc('0x1df')});db[_0x3ddc('0xe9')][_0x3ddc('0x115')](db['SmsQueue'],{'foreignKey':_0x3ddc('0x1ea'),'as':'ToQueue'});db[_0x3ddc('0xe9')]['belongsTo'](db[_0x3ddc('0x4e')],{'foreignKey':_0x3ddc('0x1eb'),'as':_0x3ddc('0x1e2')});db[_0x3ddc('0xeb')][_0x3ddc('0x106')](db[_0x3ddc('0x77')],{'as':_0x3ddc('0x172'),'foreignKey':_0x3ddc('0x15f')});db['CmList'][_0x3ddc('0x106')](db[_0x3ddc('0x1ec')],{'as':_0x3ddc('0x1ed'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0xeb')][_0x3ddc('0x106')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x11a'),'onDelete':'cascade','foreignKey':'ListId'});db[_0x3ddc('0xeb')][_0x3ddc('0x106')](db[_0x3ddc('0x10a')],{'as':_0x3ddc('0x10b'),'foreignKey':'ListId'});db['CmList'][_0x3ddc('0x106')](db[_0x3ddc('0x10c')],{'as':_0x3ddc('0x10d'),'foreignKey':_0x3ddc('0x15f')});db['CmList']['hasMany'](db[_0x3ddc('0x70')],{'as':_0x3ddc('0x70'),'foreignKey':_0x3ddc('0x15f')});db[_0x3ddc('0xeb')][_0x3ddc('0x117')](db[_0x3ddc('0x19')],{'as':_0x3ddc('0x1ee'),'through':_0x3ddc('0x14e')});db[_0x3ddc('0xeb')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':'Agents','through':_0x3ddc('0x11d')});db[_0x3ddc('0x12a')][_0x3ddc('0x106')](db['VoiceExtension'],{'as':_0x3ddc('0x109'),'onDelete':_0x3ddc('0x104')});db[_0x3ddc('0x12a')]['belongsToMany'](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x12c')});db[_0x3ddc('0xed')][_0x3ddc('0x106')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x168'),'foreignKey':_0x3ddc('0x116')});db['UserProfile'][_0x3ddc('0x106')](db[_0x3ddc('0xee')],{'as':_0x3ddc('0x1ef'),'foreignKey':_0x3ddc('0x116'),'onDelete':_0x3ddc('0x104')});db['UserProfileSection'][_0x3ddc('0x106')](db[_0x3ddc('0xf0')],{'as':_0x3ddc('0x1f0'),'foreignKey':_0x3ddc('0x1f1'),'onDelete':'cascade'});db[_0x3ddc('0x137')]['hasMany'](db[_0x3ddc('0x77')],{'as':_0x3ddc('0x172'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0x3ddc('0x106')](db[_0x3ddc('0x75')],{'as':'Answers','foreignKey':_0x3ddc('0x1f2')});db[_0x3ddc('0x137')][_0x3ddc('0x106')](db[_0x3ddc('0xfa')],{'as':_0x3ddc('0x152'),'foreignKey':_0x3ddc('0x1f2')});db[_0x3ddc('0x137')][_0x3ddc('0x106')](db[_0x3ddc('0xf8')],{'as':_0x3ddc('0x174')});db[_0x3ddc('0x137')][_0x3ddc('0x106')](db[_0x3ddc('0xf6')],{'as':'Applications'});db['WhatsappAccount'][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':'ListId'});db[_0x3ddc('0x137')][_0x3ddc('0x115')](db[_0x3ddc('0x7b')],{'as':_0x3ddc('0x14c'),'foreignKey':_0x3ddc('0x14d')});db[_0x3ddc('0x137')][_0x3ddc('0x117')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x139')});db[_0x3ddc('0xf6')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'onDelete':_0x3ddc('0x16c')});db['WhatsappApplication']['belongsTo'](db['WhatsappQueue'],{'onDelete':_0x3ddc('0x16c')});db[_0x3ddc('0xf6')][_0x3ddc('0x115')](db[_0x3ddc('0x137')],{'onDelete':'restrict'});db[_0x3ddc('0xf6')][_0x3ddc('0x115')](db['Interval'],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x14b')});db['WhatsappApplication'][_0x3ddc('0x115')](db[_0x3ddc('0x84')],{'onDelete':_0x3ddc('0x16c'),'foreignKey':_0x3ddc('0x16d')});db[_0x3ddc('0xf8')][_0x3ddc('0x106')](db[_0x3ddc('0xfa')],{'as':_0x3ddc('0x152'),'onDelete':_0x3ddc('0x104'),'foreignKey':'WhatsappInteractionId'});db[_0x3ddc('0xf8')][_0x3ddc('0x115')](db[_0x3ddc('0x137')],{'as':'Account','foreignKey':_0x3ddc('0x1f2')});db[_0x3ddc('0xf8')]['belongsTo'](db['CmContact'],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0xf8')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x164'),'foreignKey':_0x3ddc('0x105')});db['WhatsappInteraction'][_0x3ddc('0x117')](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x1f3'),'as':_0x3ddc('0x166')});db[_0x3ddc('0xf8')]['belongsToMany'](db[_0x3ddc('0x84')],{'through':_0x3ddc('0x1f3'),'as':_0x3ddc('0x167')});db[_0x3ddc('0xf8')][_0x3ddc('0x117')](db['User'],{'as':'Users','through':_0x3ddc('0x124'),'foreignKey':'WhatsappInteractionId'});db[_0x3ddc('0xfa')][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{'as':_0x3ddc('0x10')});db[_0x3ddc('0xfa')][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x157')});db[_0x3ddc('0xfa')][_0x3ddc('0x115')](db[_0x3ddc('0xf8')],{'onDelete':_0x3ddc('0x104'),'as':_0x3ddc('0x16b'),'foreignKey':'WhatsappInteractionId'});db[_0x3ddc('0xfa')][_0x3ddc('0x115')](db[_0x3ddc('0x137')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x3ddc('0xfc')]['belongsTo'](db['WhatsappAccount'],{});db[_0x3ddc('0xfc')][_0x3ddc('0x115')](db[_0x3ddc('0xeb')],{'as':_0x3ddc('0x16f'),'foreignKey':'ListId'});db['WhatsappQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x6b')],{'as':_0x3ddc('0x157'),'foreignKey':_0x3ddc('0x158')});db[_0x3ddc('0xfc')][_0x3ddc('0x115')](db[_0x3ddc('0xf8')],{});db['WhatsappQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0xff')],{});db[_0x3ddc('0xfc')]['belongsTo'](db[_0x3ddc('0xfa')],{});db['WhatsappQueueReport'][_0x3ddc('0x115')](db[_0x3ddc('0x10')],{});db[_0x3ddc('0xfd')][_0x3ddc('0x115')](db[_0x3ddc('0xfa')],{});db[_0x3ddc('0xfd')][_0x3ddc('0x115')](db['WhatsappInteraction'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x3ddc('0x137')],{'foreignKey':_0x3ddc('0x1f4'),'as':_0x3ddc('0x1db')});db[_0x3ddc('0xfd')][_0x3ddc('0x115')](db[_0x3ddc('0x137')],{'foreignKey':_0x3ddc('0x1f5'),'as':_0x3ddc('0x1e2')});db[_0x3ddc('0xfd')]['belongsTo'](db[_0x3ddc('0xff')],{'foreignKey':_0x3ddc('0x1f6'),'as':_0x3ddc('0x1e1')});db[_0x3ddc('0xfd')][_0x3ddc('0x115')](db['User'],{'foreignKey':_0x3ddc('0x1dc'),'as':_0x3ddc('0x1dd')});db[_0x3ddc('0xfd')]['belongsTo'](db[_0x3ddc('0x10')],{'foreignKey':_0x3ddc('0x1de'),'as':_0x3ddc('0x1df')});db[_0x3ddc('0xff')][_0x3ddc('0x117')](db['User'],{'as':_0x3ddc('0x14f'),'through':_0x3ddc('0x37'),'foreignKey':_0x3ddc('0x1f7')});db['WhatsappQueue'][_0x3ddc('0x117')](db[_0x3ddc('0xda')],{'through':_0x3ddc('0x1d4'),'as':_0x3ddc('0x150')});module[_0x3ddc('0x1f8')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 9f7fad8..dcaee6c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x8cfd=['./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/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/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./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/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','./api/notification','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','/api/system','./api/system','./api/pm2','/api/webbar','/apidoc','static','join','root','/www','/demo','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','/index.html','apiKey','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','code','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerSecret','calleridnum','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','dsn','secret','oldPassword','isPlainObject','isArray','replace','lodash','path','express','express-winston','util','./errors','./config/logger','api','auth','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x288325,_0x26e4ff){_0x288325=_0x288325-0x0;var _0x3b9fd7=_0x8cfd[_0x288325];return _0x3b9fd7;};'use strict';var _=require(_0xd8cf('0x0'));var path=require(_0xd8cf('0x1'));var express=require(_0xd8cf('0x2'));var ewinston=require(_0xd8cf('0x3'));var util=require(_0xd8cf('0x4'));var errors=require(_0xd8cf('0x5'));var config=require('./config/environment');var logger=require(_0xd8cf('0x6'))(_0xd8cf('0x7'));var authLogger=require(_0xd8cf('0x6'))(_0xd8cf('0x8'));exports[_0xd8cf('0x9')]=function(_0x318a72){_0x318a72[_0xd8cf('0xa')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5cfd20,_0x3fe2d2){var _0xa5b446=_0xd8cf('0xb');if(!_[_0xd8cf('0xc')](_0x5cfd20[_0xd8cf('0xd')])){_0xa5b446+=_0xd8cf('0xe');var _0x526b59=_0x5cfd20[_0xd8cf('0xd')];maskSensitiveData(_0x526b59);}return util[_0xd8cf('0xf')](_0xa5b446,_0x5cfd20[_0xd8cf('0x10')],_0x5cfd20[_0xd8cf('0x11')][_0xd8cf('0x12')]?_0x5cfd20[_0xd8cf('0x11')][_0xd8cf('0x12')]:_0x5cfd20[_0xd8cf('0x13')][_0xd8cf('0x14')]||_0x5cfd20['ip'],_0x5cfd20[_0xd8cf('0x15')],_0x3fe2d2[_0xd8cf('0x16')],_0x3fe2d2[_0xd8cf('0x17')],_0x5cfd20['user']?_0x5cfd20[_0xd8cf('0x18')]['id']:null,_0x5cfd20['user']?_0x5cfd20[_0xd8cf('0x18')][_0xd8cf('0x19')]:null,_0x5cfd20['user']?_0x5cfd20[_0xd8cf('0x18')][_0xd8cf('0x1a')]:null,_0x526b59?util[_0xd8cf('0x1b')](_0x526b59,![],null):'');}}));_0x318a72['use'](ewinston[_0xd8cf('0x1c')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5b9fb4,_0xc39a9a){var _0x24c78c=_0xd8cf('0x1d');if(_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x1e')]&&_0x5b9fb4['body'][_0xd8cf('0x1f')]){_0x24c78c=_0xd8cf('0x20');}return util[_0xd8cf('0xf')](_0x24c78c,_0x5b9fb4[_0xd8cf('0x10')],_0x5b9fb4[_0xd8cf('0x11')][_0xd8cf('0x12')]?_0x5b9fb4[_0xd8cf('0x11')][_0xd8cf('0x12')]:_0x5b9fb4[_0xd8cf('0x13')][_0xd8cf('0x14')]||_0x5b9fb4['ip'],_0x5b9fb4[_0xd8cf('0x15')],_0xc39a9a[_0xd8cf('0x16')],_0xc39a9a[_0xd8cf('0x17')],_0x5b9fb4[_0xd8cf('0x18')]?_0x5b9fb4['user']['id']:null,_0x5b9fb4[_0xd8cf('0x18')]?_0x5b9fb4[_0xd8cf('0x18')][_0xd8cf('0x19')]:null,_0x5b9fb4[_0xd8cf('0x18')]?_0x5b9fb4[_0xd8cf('0x18')]['role']:null,_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4['body']['device']?_0x5b9fb4['body'][_0xd8cf('0x1e')]:'other',_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x1f')]?_0x5b9fb4[_0xd8cf('0xd')]['agent_id']:'',_0x5b9fb4[_0xd8cf('0xd')]&&_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x21')]?_0x5b9fb4[_0xd8cf('0xd')][_0xd8cf('0x21')]:'');},'ignoreRoute':function(_0x45a5b6){var _0x533808=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x533808[_0xd8cf('0x22')](_0x45a5b6[_0xd8cf('0x15')]);}}));_0x318a72['use'](_0xd8cf('0x23'),require(_0xd8cf('0x24')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x25'),require(_0xd8cf('0x26')));_0x318a72['use'](_0xd8cf('0x27'),require(_0xd8cf('0x28')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x29'),require(_0xd8cf('0x2a')));_0x318a72['use'](_0xd8cf('0x2b'),require(_0xd8cf('0x2c')));_0x318a72['use'](_0xd8cf('0x2d'),require(_0xd8cf('0x2e')));_0x318a72['use'](_0xd8cf('0x2f'),require(_0xd8cf('0x30')));_0x318a72[_0xd8cf('0xa')]('/api/screen/recordings',require(_0xd8cf('0x31')));_0x318a72['use'](_0xd8cf('0x32'),require(_0xd8cf('0x33')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x34'),require(_0xd8cf('0x35')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x36'),require(_0xd8cf('0x37')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x38'),require(_0xd8cf('0x39')));_0x318a72['use'](_0xd8cf('0x3a'),require(_0xd8cf('0x3b')));_0x318a72['use'](_0xd8cf('0x3c'),require(_0xd8cf('0x3d')));_0x318a72['use'](_0xd8cf('0x3e'),require(_0xd8cf('0x3f')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x40'),require(_0xd8cf('0x41')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x42'),require(_0xd8cf('0x43')));_0x318a72['use'](_0xd8cf('0x44'),require(_0xd8cf('0x45')));_0x318a72[_0xd8cf('0xa')]('/api/mail/accounts',require(_0xd8cf('0x46')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x47'),require(_0xd8cf('0x48')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x49'),require(_0xd8cf('0x4a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x4b'),require(_0xd8cf('0x4c')));_0x318a72[_0xd8cf('0xa')]('/api/mail/messages',require('./api/mailMessage'));_0x318a72['use'](_0xd8cf('0x4d'),require('./api/mailApplication'));_0x318a72['use']('/api/mail/reports/queue',require(_0xd8cf('0x4e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x4f'),require(_0xd8cf('0x50')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x51'),require('./api/dashboardItem'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x52'),require(_0xd8cf('0x53')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x54'),require(_0xd8cf('0x55')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x56'),require('./api/faxInteraction'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x57'),require(_0xd8cf('0x58')));_0x318a72['use'](_0xd8cf('0x59'),require('./api/faxQueue'));_0x318a72[_0xd8cf('0xa')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x318a72['use']('/api/sms/accounts',require(_0xd8cf('0x5a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x5b'),require('./api/smsApplication'));_0x318a72['use'](_0xd8cf('0x5c'),require(_0xd8cf('0x5d')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x5e'),require('./api/smsMessage'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x5f'),require(_0xd8cf('0x60')));_0x318a72['use'](_0xd8cf('0x61'),require(_0xd8cf('0x62')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x63'),require(_0xd8cf('0x64')));_0x318a72[_0xd8cf('0xa')]('/api/openchannel/interactions',require(_0xd8cf('0x65')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x66'),require(_0xd8cf('0x67')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x68'),require('./api/openchannelQueue'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x69'),require(_0xd8cf('0x6a')));_0x318a72['use'](_0xd8cf('0x6b'),require(_0xd8cf('0x6c')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x6d'),require(_0xd8cf('0x6e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x6f'),require(_0xd8cf('0x70')));_0x318a72['use'](_0xd8cf('0x71'),require(_0xd8cf('0x72')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x73'),require(_0xd8cf('0x74')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x75'),require(_0xd8cf('0x76')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x77'),require(_0xd8cf('0x78')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x79'),require(_0xd8cf('0x7a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x7b'),require(_0xd8cf('0x7c')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x7d'),require(_0xd8cf('0x7e')));_0x318a72['use'](_0xd8cf('0x7f'),require(_0xd8cf('0x80')));_0x318a72[_0xd8cf('0xa')]('/api/cm/hopper_black',require(_0xd8cf('0x81')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x82'),require(_0xd8cf('0x83')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x84'),require('./api/cmHopperHistory'));_0x318a72['use'](_0xd8cf('0x85'),require('./api/cmCustomField'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x86'),require(_0xd8cf('0x87')));_0x318a72['use'](_0xd8cf('0x88'),require(_0xd8cf('0x89')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x8a'),require(_0xd8cf('0x8b')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x8c'),require('./api/disposition'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x8d'),require(_0xd8cf('0x8e')));_0x318a72['use'](_0xd8cf('0x8f'),require(_0xd8cf('0x90')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x91'),require(_0xd8cf('0x92')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x93'),require('./api/cdr'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x94'),require(_0xd8cf('0x95')));_0x318a72['use'](_0xd8cf('0x96'),require('./api/schedule'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x97'),require('./api/sound'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x98'),require(_0xd8cf('0x99')));_0x318a72['use'](_0xd8cf('0x9a'),require('./api/template'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x9b'),require(_0xd8cf('0x9c')));_0x318a72['use'](_0xd8cf('0x9d'),require(_0xd8cf('0x9e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x9f'),require(_0xd8cf('0xa0')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa1'),require(_0xd8cf('0xa2')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa3'),require(_0xd8cf('0xa4')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa5'),require(_0xd8cf('0xa6')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa7'),require('./api/analyticExtractedReport'));_0x318a72[_0xd8cf('0xa')]('/api/analytics/metrics',require(_0xd8cf('0xa8')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xa9'),require(_0xd8cf('0xaa')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xab'),require(_0xd8cf('0xac')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xad'),require(_0xd8cf('0xae')));_0x318a72['use'](_0xd8cf('0xaf'),require(_0xd8cf('0xb0')));_0x318a72['use']('/api/integrations/salesforce/fields',require(_0xd8cf('0xb1')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb2'),require(_0xd8cf('0xb3')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb4'),require(_0xd8cf('0xb5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb6'),require(_0xd8cf('0xb7')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/desk/accounts',require('./api/intDeskAccount'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xb8'),require(_0xd8cf('0xb9')));_0x318a72['use'](_0xd8cf('0xba'),require('./api/intDeskField'));_0x318a72['use'](_0xd8cf('0xbb'),require('./api/intZohoAccount'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xbc'),require(_0xd8cf('0xbd')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/zoho/fields',require(_0xd8cf('0xbe')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xbf'),require(_0xd8cf('0xc0')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc1'),require(_0xd8cf('0xc2')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc3'),require('./api/intZendeskField'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc4'),require(_0xd8cf('0xc5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc6'),require('./api/intFreshdeskConfiguration'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xc7'),require(_0xd8cf('0xc8')));_0x318a72['use'](_0xd8cf('0xc9'),require('./api/intVtigerAccount'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xca'),require(_0xd8cf('0xcb')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xcc'),require(_0xd8cf('0xcd')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/servicenow/accounts',require(_0xd8cf('0xce')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xcf'),require(_0xd8cf('0xd0')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xd1'),require(_0xd8cf('0xd2')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/dynamics365/accounts',require(_0xd8cf('0xd3')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/dynamics365/configurations',require(_0xd8cf('0xd4')));_0x318a72['use']('/api/integrations/dynamics365/fields',require(_0xd8cf('0xd5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xd6'),require(_0xd8cf('0xd7')));_0x318a72[_0xd8cf('0xa')]('/api/integrations/freshsales/configurations',require(_0xd8cf('0xd8')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xd9'),require(_0xd8cf('0xda')));_0x318a72['use'](_0xd8cf('0xdb'),require(_0xd8cf('0xdc')));_0x318a72[_0xd8cf('0xa')]('/api/chat/reports/queue',require(_0xd8cf('0xdd')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xde'),require(_0xd8cf('0xdf')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe0'),require(_0xd8cf('0xe1')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe2'),require(_0xd8cf('0xe3')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe4'),require(_0xd8cf('0xe5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe6'),require(_0xd8cf('0xe7')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xe8'),require(_0xd8cf('0xe9')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xea'),require(_0xd8cf('0xeb')));_0x318a72['use'](_0xd8cf('0xec'),require('./api/jscriptyProject'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xed'),require(_0xd8cf('0xee')));_0x318a72['use'](_0xd8cf('0xef'),require(_0xd8cf('0xf0')));_0x318a72[_0xd8cf('0xa')]('/api/square/projects',require(_0xd8cf('0xf1')));_0x318a72['use'](_0xd8cf('0xf2'),require(_0xd8cf('0xf3')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xf4'),require(_0xd8cf('0xf5')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xf6'),require(_0xd8cf('0xf7')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xf8'),require(_0xd8cf('0xf9')));_0x318a72[_0xd8cf('0xa')]('/api/campaigns',require(_0xd8cf('0xfa')));_0x318a72[_0xd8cf('0xa')]('/api/migrations',require(_0xd8cf('0xfb')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0xfc'),require(_0xd8cf('0xfd')));_0x318a72[_0xd8cf('0xa')]('/api/plugins',require(_0xd8cf('0xfe')));_0x318a72['use']('/api/mail/reports/transfer',require(_0xd8cf('0xff')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x100'),require(_0xd8cf('0x101')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x102'),require('./api/faxTransferReport'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x103'),require(_0xd8cf('0x104')));_0x318a72[_0xd8cf('0xa')]('/api/sms/reports/transfer',require(_0xd8cf('0x105')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x106'),require(_0xd8cf('0x107')));_0x318a72[_0xd8cf('0xa')]('/api/voice/prefixes',require(_0xd8cf('0x108')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x109'),require(_0xd8cf('0x10a')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x10b'),require(_0xd8cf('0x10c')));_0x318a72[_0xd8cf('0xa')]('/api/userProfile/resources',require(_0xd8cf('0x10d')));_0x318a72[_0xd8cf('0xa')]('/api/notifications',require(_0xd8cf('0x10e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x10f'),require(_0xd8cf('0x110')));_0x318a72['use'](_0xd8cf('0x111'),require(_0xd8cf('0x112')));_0x318a72['use'](_0xd8cf('0x113'),require('./api/whatsappApplication'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x114'),require(_0xd8cf('0x115')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x116'),require(_0xd8cf('0x117')));_0x318a72[_0xd8cf('0xa')]('/api/whatsapp/reports/queue',require(_0xd8cf('0x118')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x119'),require('./api/whatsappTransferReport'));_0x318a72['use'](_0xd8cf('0x11a'),require('./api/whatsappQueue'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x11b'),require(_0xd8cf('0x11c')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x11d'),require(_0xd8cf('0x11e')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x11f'),require(_0xd8cf('0x120')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x121'),require('./api/jira'));_0x318a72['use'](_0xd8cf('0x122'),require(_0xd8cf('0x123')));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x124'),require('./api/version'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x125'),require(_0xd8cf('0x126')));_0x318a72['use']('/api/pm2',require(_0xd8cf('0x127')));_0x318a72['use'](_0xd8cf('0x128'),require('./api/webbar'));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x129'),express[_0xd8cf('0x12a')](path[_0xd8cf('0x12b')](config[_0xd8cf('0x12c')],_0xd8cf('0x129'))));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x12d'),express[_0xd8cf('0x12a')](path[_0xd8cf('0x12b')](config[_0xd8cf('0x12c')],_0xd8cf('0x12d'))));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x12e'),express[_0xd8cf('0x12a')](path[_0xd8cf('0x12b')](config['root'],_0xd8cf('0x12e'))));_0x318a72[_0xd8cf('0xa')]('/snippet',express['static'](path[_0xd8cf('0x12b')](config['root'],_0xd8cf('0x12f'),_0xd8cf('0x130'))));_0x318a72[_0xd8cf('0xa')](_0xd8cf('0x131'),express[_0xd8cf('0x12a')](path['join'](config[_0xd8cf('0x12c')],_0xd8cf('0x132'))));_0x318a72[_0xd8cf('0x133')](_0xd8cf('0x134'))[_0xd8cf('0x135')](errors[0x194]);_0x318a72[_0xd8cf('0x133')]('/*')[_0xd8cf('0x135')](function(_0x243ea0,_0x868121){_0x868121[_0xd8cf('0x136')](path['resolve'](_0x318a72[_0xd8cf('0x135')]('appPath')+_0xd8cf('0x137')));});};var sensitiveFields=['username','password','newPassword',_0xd8cf('0x138'),_0xd8cf('0x139'),_0xd8cf('0x13a'),'street',_0xd8cf('0x13b'),_0xd8cf('0x13c'),_0xd8cf('0x13d'),_0xd8cf('0x13e'),_0xd8cf('0x13f'),_0xd8cf('0x140'),'securityToken',_0xd8cf('0x141'),'accessKey',_0xd8cf('0x142'),'token',_0xd8cf('0x143'),_0xd8cf('0x144'),_0xd8cf('0x145'),_0xd8cf('0x146'),'consumerKey',_0xd8cf('0x147'),'membername','calleridname',_0xd8cf('0x148'),'exten',_0xd8cf('0x149'),_0xd8cf('0x14a'),_0xd8cf('0x14b'),_0xd8cf('0x14c'),_0xd8cf('0x14d'),_0xd8cf('0x14e'),'user',_0xd8cf('0x14f'),'accountSid','localstationid',_0xd8cf('0x150'),_0xd8cf('0x151'),'registry',_0xd8cf('0x152')];function maskSensitiveData(_0x214e15){var _0x18d8c9=/(?!^)[\s\S](?!$)/g;if(!_[_0xd8cf('0x153')](_0x214e15))return;for(var _0x379824 in _0x214e15){if(_[_0xd8cf('0x154')](_0x214e15[_0x379824])){for(var _0x39654b=0x0;_0x39654b<_0x214e15[_0x379824]['length'];_0x39654b++){maskSensitiveData(_0x214e15[_0x379824][_0x39654b]);}}else if(_[_0xd8cf('0x153')](_0x214e15[_0x379824])){maskSensitiveData(_0x214e15[_0x379824]);}else if(_['isString'](_0x214e15[_0x379824])){_0x214e15[_0x379824]=_0x214e15[_0x379824][_0xd8cf('0x155')](/{{{/g,'@@{')['replace'](/}}}/g,'}@@')[_0xd8cf('0x155')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x379824)){_0x214e15[_0x379824]=_0x214e15[_0x379824][_0xd8cf('0x155')](_0x18d8c9,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 303f0cb..ad16459 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -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 +var _0x1b80=['../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x176897,_0x163aa6){var _0xd82795=function(_0x2acc66){while(--_0x2acc66){_0x176897['push'](_0x176897['shift']());}};_0xd82795(++_0x163aa6);}(_0x1b80,0x68));var _0x01b8=function(_0x408e37,_0x1bfdd9){_0x408e37=_0x408e37-0x0;var _0x5edea5=_0x1b80[_0x408e37];return _0x5edea5;};'use strict';var jayson=require(_0x01b8('0x0'));var BPromise=require(_0x01b8('0x1'));var _=require(_0x01b8('0x2'));var config=require(_0x01b8('0x3'));exports[_0x01b8('0x4')]=function(){return new BPromise(function(_0x441454,_0x18f480){var _0x2878ff={};_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x6')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/voiceExtension/voiceExtension.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x7')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x8')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x9')));_0x2878ff=_['merge'](_0x2878ff,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0xa')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/memberReport/memberReport.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/trunk/trunk.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0xb')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0xc')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0xd')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0xe')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0xf')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x10')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x11')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x12')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x13')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x14')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x15')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x16')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x17')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x2878ff=_['merge'](_0x2878ff,require('../api/smsAccount/smsAccount.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x18')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x19')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x1a')));_0x2878ff=_['merge'](_0x2878ff,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x1b')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x1c')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x1d')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x1e')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x1f')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/chatMessage/chatMessage.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x20')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x21')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x22')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x23')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x24')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x25')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x26')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x27')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/pause/pause.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x28')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x29')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x2a')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x2b')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x2c')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x2d')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x2e')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x2f')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x30')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x31')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x32')));_0x2878ff=_['merge'](_0x2878ff,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x33')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x34')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/squareReport/squareReport.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x35')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x36')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x37')));_0x2878ff=_['merge'](_0x2878ff,require('../api/squareRecording/squareRecording.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x38')));_0x2878ff=_['merge'](_0x2878ff,require('../api/campaign/campaign.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x39')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x3a')));_0x2878ff=_['merge'](_0x2878ff,require(_0x01b8('0x3b')));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x3c')));_0x2878ff=_['merge'](_0x2878ff,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x2878ff=_[_0x01b8('0x5')](_0x2878ff,require(_0x01b8('0x3d')));var _0x410fd7=jayson[_0x01b8('0x3e')](_0x2878ff)[_0x01b8('0x3f')]();var _0x5212d1=config[_0x01b8('0x40')][_0x01b8('0x41')]||config[_0x01b8('0x41')]+0x1;var _0x228afc=config[_0x01b8('0x40')]['ip']||_0x01b8('0x42');_0x410fd7['on'](_0x01b8('0x43'),function(_0x47fffc){return _0x18f480(_0x47fffc);});_0x410fd7[_0x01b8('0x4')](_0x5212d1,_0x228afc,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x228afc,_0x5212d1);require(_0x01b8('0x44'))[_0x01b8('0x45')]();return _0x441454(_0x01b8('0x46')+_0x228afc+':'+_0x5212d1);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b633c6d..9bc9f62 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 _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 +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedd9,0xfc));var _0x9edd=function(_0x486eea,_0x2f72ef){_0x486eea=_0x486eea-0x0;var _0x58b148=_0xedd9[_0x486eea];return _0x58b148;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 635ba37..1a6a6f0 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 _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 +var _0x8e63=['format','apply','message','Undefined\x20error.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','push'];(function(_0x57169a,_0x5a28b9){var _0x5e0b21=function(_0x397031){while(--_0x397031){_0x57169a['push'](_0x57169a['shift']());}};_0x5e0b21(++_0x5a28b9);}(_0x8e63,0x7c));var _0x38e6=function(_0x597fde,_0x3032a3){_0x597fde=_0x597fde-0x0;var _0x333294=_0x8e63[_0x597fde];return _0x333294;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x38e6('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x38e6('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x38e6('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x38e6('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x38e6('0x4'),'E_AGI_COMMAND_EMPTY':_0x38e6('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x38e6('0x6'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x3048c0){var _0x3048c0=_0x3048c0||null,_0x9dd996=_0x9dd996||[],_0x315953=0x1,_0x51b586='';if(!error[_0x3048c0]){_0x3048c0='E_AGI_UNDEFINED';}_0x9dd996[_0x38e6('0x7')](error[_0x3048c0]);while(arguments[_0x315953]){_0x9dd996[_0x38e6('0x7')](arguments[_0x315953]);_0x315953++;}_0x51b586=util[_0x38e6('0x8')][_0x38e6('0x9')](util,_0x9dd996);this[_0x38e6('0xa')]=_0x51b586;this['name']=_0x3048c0;}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 649a5b2..107ac4d 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 _0x5ba3=['agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','agi','menu','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','push','numberOfEdges','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available','length','condition','split'];(function(_0x3f22de,_0x5ddeca){var _0x3dc028=function(_0x629266){while(--_0x629266){_0x3f22de['push'](_0x3f22de['shift']());}};_0x3dc028(++_0x5ddeca);}(_0x5ba3,0x140));var _0x35ba=function(_0x135fd1,_0x174e80){_0x135fd1=_0x135fd1-0x0;var _0x32d16d=_0x5ba3[_0x135fd1];return _0x32d16d;};'use strict';var _=require(_0x35ba('0x0'));var logger=require('../../../config/logger')(_0x35ba('0x1'));var verticesWithRetry=[_0x35ba('0x2'),'getdigits',_0x35ba('0x3')];var Graph=function(){this[_0x35ba('0x4')]={};this[_0x35ba('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x35ba('0x6')][_0x35ba('0x7')]=function(_0x4e389a){this['vertices'][_0x4e389a['id']]=_0x4e389a;this['edges'][_0x4e389a['id']]=[];};Graph[_0x35ba('0x6')][_0x35ba('0x8')]=function(_0x380ffb,_0x4c55f3,_0x22bed8){this['edges'][_0x380ffb][_0x35ba('0x9')]({'target':_0x4c55f3,'condition':_0x22bed8});this[_0x35ba('0xa')]+=0x1;};Graph[_0x35ba('0x6')][_0x35ba('0xb')]=function(){return _['size'](this[_0x35ba('0x4')]);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph[_0x35ba('0x6')][_0x35ba('0xc')]=function(_0x250b24){return this[_0x35ba('0x4')][_0x250b24];};Graph[_0x35ba('0x6')][_0x35ba('0xd')]=function(_0x23c253,_0x453489){if(!this['vertices'][_0x23c253]){return logger[_0x35ba('0xe')](_0x35ba('0xf'));}var _0x3ad4cc=_0x453489(this[_0x35ba('0x4')][_0x23c253]);if(!_0x3ad4cc){return logger['info'](_0x35ba('0x10'));}if(this['edges'][_0x23c253]['length']===0x0){return logger[_0x35ba('0xe')](_0x35ba('0x11'));}for(var _0x573aea=0x0,_0x165531=[],_0x2b6b71=![];_0x573aea\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 +var _0xf0ba=['mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','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','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','util','moment','../../config/logger','agi','./rpc','./graph','defaults','127.0.0.1','nextTick','error','stack','log','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','target','value','getSquareProject','then','catch','createSquareReport','agi_','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','production','start','debug','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var parser=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));var syncho=require(_0xaf0b('0x2'));var util=require(_0xaf0b('0x3'));var moment=require(_0xaf0b('0x4'));var config=require('../../config/environment');var logger=require(_0xaf0b('0x5'))(_0xaf0b('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0xaf0b('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0xaf0b('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xaf0b('0x9')](config[_0xaf0b('0x6')],{'ip':_0xaf0b('0xa'),'port':0x11dd});function connectionHandler(_0x3439d5){process[_0xaf0b('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3439d5);agiHandler(_0x3439d5);}catch(_0x5b7f0c){logger[_0xaf0b('0xc')](_0x5b7f0c[_0xaf0b('0xd')]);}});});}function listeningHandler(){console[_0xaf0b('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xaf0b('0x6')]['port']);logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x11'),config['agi']['ip'],config[_0xaf0b('0x6')][_0xaf0b('0x12')]));}function errorHandler(_0x166394){if(_0x166394&&_0x166394[_0xaf0b('0x13')]&&_0x166394[_0xaf0b('0x14')]){logger[_0xaf0b('0xc')](util['format'](_0xaf0b('0x15'),_0x166394[_0xaf0b('0x13')],_0x166394[_0xaf0b('0x14')]));}else{logger[_0xaf0b('0xc')](util['format'](_0xaf0b('0x16'),_0x166394[_0xaf0b('0xd')]));}}function closeHandler(){logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x17'),this[_0xaf0b('0x18')],this[_0xaf0b('0x19')],this[_0xaf0b('0x1a')],this['dnid'],this[_0xaf0b('0x1b')]));try{createSquareReport(this);}catch(_0x535612){logger[_0xaf0b('0xc')](_0x535612[_0xaf0b('0xd')]);}}function timeoutHandler(){logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x1c'),this[_0xaf0b('0x18')],this[_0xaf0b('0x19')],this[_0xaf0b('0x1a')],this[_0xaf0b('0x1d')],this[_0xaf0b('0x1b')]));}function hangupHandler(){logger['info'](util[_0xaf0b('0x10')](_0xaf0b('0x1e'),this[_0xaf0b('0x18')],this['calleridname'],this[_0xaf0b('0x1a')],this[_0xaf0b('0x1d')],this['uniqueid']));this[_0xaf0b('0x1f')]=!![];}function getRoot(_0x47130e){return parser[_0xaf0b('0x20')](_0x47130e,{'object':!![]})[_0xaf0b('0x21')][_0xaf0b('0x22')];}function addVertex(_0x4fe7dc,_0x5f1f70,_0x4541c5){_0x5f1f70[_0xaf0b('0x23')]=_0x4541c5;if(_0x5f1f70[_0xaf0b('0x24')](_0xaf0b('0x25'))){_0x5f1f70[_0xaf0b('0x26')]=parseInt(_0x5f1f70[_0xaf0b('0x25')],0xa);}_0x4fe7dc[_0xaf0b('0x27')](_[_0xaf0b('0x28')](_0x5f1f70,'mxCell'));}function initGraph(_0x1ffa30,_0x21e0e6){var _0x3a4820=new Graph();for(var _0x51cb2f in _0x1ffa30){if(_0x1ffa30[_0xaf0b('0x24')](_0x51cb2f)){if(_[_0xaf0b('0x29')](_0x1ffa30[_0x51cb2f])){for(var _0x54c3be=0x0;_0x54c3be<_0x1ffa30[_0x51cb2f]['length'];_0x54c3be+=0x1){addVertex(_0x3a4820,_0x1ffa30[_0x51cb2f][_0x54c3be],_0x51cb2f);}}else{addVertex(_0x3a4820,_0x1ffa30[_0x51cb2f],_0x51cb2f);}}}for(var _0x4bae53=0x0;_0x4bae53<_0x21e0e6[_0xaf0b('0x2a')];_0x4bae53+=0x1){if(_0x21e0e6[_0x4bae53][_0xaf0b('0x2b')]&&_0x21e0e6[_0x4bae53][_0xaf0b('0x2c')]){_0x3a4820['addEdge'](_0x21e0e6[_0x4bae53][_0xaf0b('0x2b')],_0x21e0e6[_0x4bae53][_0xaf0b('0x2c')],_0x21e0e6[_0x4bae53][_0xaf0b('0x2d')]);}}return _0x3a4820;}function getSquareProject(_0x3fb9ce,_0x2f0b81){rpc[_0xaf0b('0x2e')](_0x3fb9ce)[_0xaf0b('0x2f')](function(_0x5c720b){_0x2f0b81(null,_0x5c720b);})[_0xaf0b('0x30')](function(_0x40f45d){_0x2f0b81(null,_0x40f45d);});}function createSquareReport(_0x4beee6,_0x26af15){rpc[_0xaf0b('0x31')](_0x4beee6)[_0xaf0b('0x2f')](function(_0x3fbfab){if(_0x26af15){_0x26af15(null,_0x3fbfab);}})[_0xaf0b('0x30')](function(_0x28d0a3){if(_0x26af15){_0x26af15(null,_0x28d0a3);}});}function setChannelVariables(_0x3d6112){for(var _0x4031d4 in _0x3d6112){if(_0x3d6112[_0xaf0b('0x24')](_0x4031d4)){if(_0x4031d4['indexOf'](_0xaf0b('0x32'))===0x0){_0x3d6112[_0x4031d4['substring'](0x4)]=_0x3d6112[_0x4031d4];delete _0x3d6112[_0x4031d4];}}}}function getLogFromObject(_0x49b691){return util['inspect'](_0x49b691,{'showHidden':![],'depth':null});}function agiHandler(_0x1d6771){var _0x3b0f51,_0x270195,_0x472301,_0x18da8d,_0x460e37;logger['debug'](_0xaf0b('0x33'),JSON[_0xaf0b('0x34')](_0x1d6771,null,0x2));logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x35'),_0x1d6771[_0xaf0b('0x18')],_0x1d6771[_0xaf0b('0x19')],_0x1d6771[_0xaf0b('0x1a')],_0x1d6771[_0xaf0b('0x1d')],_0x1d6771[_0xaf0b('0x1b')]));_0x1d6771['on']('error',errorHandler);_0x1d6771['on'](_0xaf0b('0x36'),closeHandler);_0x1d6771['on']('timeout',timeoutHandler);_0x1d6771[_0xaf0b('0x1f')]=![];_0x1d6771['on']('hangup',hangupHandler);var _0x1f429d=getSquareProject['sync'](null,_0x1d6771[_0xaf0b('0x18')]);if(_0x1f429d){if(_0x1f429d[_0xaf0b('0x37')]){_0x3b0f51=getRoot(_0x1f429d[_0xaf0b('0x37')]);if(_0x3b0f51&&_0x3b0f51[_0xaf0b('0x38')]){logger[_0xaf0b('0x39')](_0xaf0b('0x22'),JSON[_0xaf0b('0x34')](_0x3b0f51,null,0x2));_0x1d6771['joinAt']=moment()[_0xaf0b('0x10')](_0xaf0b('0x3a'));_0x270195=initGraph(_[_0xaf0b('0x28')](_0x3b0f51,_0xaf0b('0x3b')),_0x3b0f51['mxCell']);_0x472301=new Vertices(_0x1d6771,rpc,mailRpc);logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x3c'),_0x1d6771[_0xaf0b('0x18')],_0x1d6771[_0xaf0b('0x19')],_0x1d6771['callerid'],_0x1d6771[_0xaf0b('0x1d')],_0x1d6771[_0xaf0b('0x1b')]));_0x270195[_0xaf0b('0x3d')](_0x3b0f51[_0xaf0b('0x38')]['id'],function(_0x185d64){try{_0x185d64=_0x472301[_0xaf0b('0x3e')](_0x185d64);logger[_0xaf0b('0x39')]('vertex',JSON[_0xaf0b('0x34')](_0x185d64,null,0x2));if(_0x185d64['agicommand']===_0xaf0b('0x3f')){logger[_0xaf0b('0xf')](_0xaf0b('0x40'));_0x1d6771[_0xaf0b('0x41')]=_0x185d64[_0xaf0b('0x41')]||_0x1d6771[_0xaf0b('0x41')];_0x1d6771[_0xaf0b('0x42')]=_0x185d64[_0xaf0b('0x42')];_0x1d6771[_0xaf0b('0x43')]=_0x185d64['priority']?_0x185d64[_0xaf0b('0x43')]-0x1:0x1;return null;}else if(_0x185d64&&_0x472301[_0x185d64[_0xaf0b('0x23')]]){_0x460e37=_0x472301[_0x185d64[_0xaf0b('0x23')]](_0x185d64);logger[_0xaf0b('0xf')](_0xaf0b('0x44'),JSON['stringify'](_0x460e37,null,0x2));if(_0x460e37&&_0x460e37[_0xaf0b('0x45')]===AGI_CODE_SUCCESS&&_0x460e37['result']!==AGI_RESULT_ERROR&&!_0x1d6771[_0xaf0b('0x1f')]){logger[_0xaf0b('0x39')](_0xaf0b('0x44'),getLogFromObject(_0x460e37));return _[_0xaf0b('0x46')](_0x460e37[_0xaf0b('0x47')])?null:_0x460e37[_0xaf0b('0x47')][_0xaf0b('0x48')]();}else{logger[_0xaf0b('0xc')](_0xaf0b('0x44'),getLogFromObject(_0x460e37));return null;}}else{logger['error'](_0xaf0b('0x49'));return null;}}catch(_0x3fa620){logger['error'](_0x3fa620[_0xaf0b('0xd')]);return null;}});if(_0x3b0f51[_0xaf0b('0x4a')]){logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x4b'),_0x1d6771[_0xaf0b('0x18')],_0x1d6771[_0xaf0b('0x19')],_0x1d6771[_0xaf0b('0x1a')],_0x1d6771[_0xaf0b('0x1d')],_0x1d6771[_0xaf0b('0x1b')]));_0x270195[_0xaf0b('0x3d')](_0x3b0f51['finally']['id'],function(_0x1ecb67){try{_0x1ecb67=_0x472301[_0xaf0b('0x3e')](_0x1ecb67);logger[_0xaf0b('0x39')](_0xaf0b('0x4c'),JSON[_0xaf0b('0x34')](_0x1ecb67,null,0x2));if(_0x1ecb67&&_0x472301[_0x1ecb67[_0xaf0b('0x23')]]){_0x460e37=_0x472301[_0x1ecb67[_0xaf0b('0x23')]](_0x1ecb67);if(_0x460e37){logger[_0xaf0b('0x39')](_0xaf0b('0x44'),getLogFromObject(_0x460e37));return _['isUndefined'](_0x460e37[_0xaf0b('0x47')])?null:_0x460e37['result'][_0xaf0b('0x48')]();}else{logger[_0xaf0b('0xc')](_0xaf0b('0x44'),getLogFromObject(_0x460e37));return null;}}else{logger[_0xaf0b('0xc')](_0xaf0b('0x49'));return null;}}catch(_0x2d865f){logger['error'](_0x2d865f[_0xaf0b('0xd')]);return null;}});}logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x4d'),_0x1d6771[_0xaf0b('0x18')],_0x1d6771[_0xaf0b('0x19')],_0x1d6771['callerid'],_0x1d6771[_0xaf0b('0x1d')],_0x1d6771[_0xaf0b('0x1b')]));logger[_0xaf0b('0xf')](util[_0xaf0b('0x10')](_0xaf0b('0x4e'),_0x1d6771[_0xaf0b('0x41')],_0x1d6771[_0xaf0b('0x42')],parseInt(_0x1d6771['priority'],0xa)+0x1));_0x1d6771[_0xaf0b('0x4f')](_0x1d6771[_0xaf0b('0x41')],_0x1d6771[_0xaf0b('0x42')],parseInt(_0x1d6771['priority'],0xa)+0x1);_0x1d6771[_0xaf0b('0x36')]();}}else{logger['error'](util[_0xaf0b('0x10')](_0xaf0b('0x50'),_0x1d6771[_0xaf0b('0x18')]));_0x1d6771[_0xaf0b('0x4f')](_0x1d6771['context'],_0x1d6771[_0xaf0b('0x42')],parseInt(_0x1d6771[_0xaf0b('0x43')],0xa)+0x1);_0x1d6771[_0xaf0b('0x36')]();}}else{logger[_0xaf0b('0xc')](util[_0xaf0b('0x10')](_0xaf0b('0x51'),_0x1d6771[_0xaf0b('0x18')]));_0x1d6771[_0xaf0b('0x4f')](_0x1d6771[_0xaf0b('0x41')],_0x1d6771['extension'],parseInt(_0x1d6771[_0xaf0b('0x43')],0xa)+0x1);_0x1d6771['close']();}}function main(){var _0x23ecfb;return utilLicense[_0xaf0b('0x52')]()['then'](function(_0x5e6d85){if(_0x5e6d85){if(_0x5e6d85[_0xaf0b('0x53')]){if(_0x5e6d85[_0xaf0b('0x54')]&&_0x5e6d85['callysquare']>0x0){logger[_0xaf0b('0xf')](util['format'](_0xaf0b('0x55'),_0x5e6d85[_0xaf0b('0x54')]));_0x23ecfb=_0x5e6d85[_0xaf0b('0x54')];}else{logger['info'](_0xaf0b('0x56'));}}else{logger[_0xaf0b('0xf')](_0xaf0b('0x57'));_0x23ecfb=-0x1;}}})[_0xaf0b('0x30')](function(_0x29ea6b){logger['error'](_0xaf0b('0x58'),_0x29ea6b[_0xaf0b('0xd')]);})['finally'](function(){var _0x31b0b7=require(_0xaf0b('0x59'))(config[_0xaf0b('0x6')][_0xaf0b('0x12')],config[_0xaf0b('0x6')]['ip'],_0x23ecfb);_0x31b0b7['on'](_0xaf0b('0xc'),errorHandler);_0x31b0b7['on'](_0xaf0b('0x5a'),listeningHandler);_0x31b0b7['on'](_0xaf0b('0x5b'),connectionHandler);_0x31b0b7['on'](_0xaf0b('0x36'),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 d503828..50b4944 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(_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 +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x16d04f,_0x3bdf27){var _0x218f46=function(_0xee0f9b){while(--_0xee0f9b){_0x16d04f['push'](_0x16d04f['shift']());}};_0x218f46(++_0x3bdf27);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 ad08019..b185128 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(_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 +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x48168a,_0xf9dfe5){var _0x346d98=function(_0x22e41f){while(--_0x22e41f){_0x48168a['push'](_0x48168a['shift']());}};_0x346d98(++_0xf9dfe5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1637b4,_0x5cd1ce){_0x1637b4=_0x1637b4-0x0;var _0x3f8d0a=_0x5f2f[_0x1637b4];return _0x3f8d0a;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 50b9f63..c045483 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 _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 +var _0x15ec=['createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','then','CreateCmContact','getPauseById','ShowPause','agentLogin','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','http','request','error','message','result','catch','ShowSquareProject','ShowMailAccount','MailServerOut','name','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage'];(function(_0x20bffa,_0x32e064){var _0x4858d4=function(_0x5a2904){while(--_0x5a2904){_0x20bffa['push'](_0x20bffa['shift']());}};_0x4858d4(++_0x32e064);}(_0x15ec,0x16c));var _0xc15e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x15ec[_0x8de54f];return _0x14cba4;};'use strict';var BPromise=require('bluebird');var moment=require(_0xc15e('0x0'));var _=require(_0xc15e('0x1'));var util=require(_0xc15e('0x2'));var jayson=require(_0xc15e('0x3'));var client=jayson[_0xc15e('0x4')][_0xc15e('0x5')]({'port':0x2329});function request(_0xe38d8a,_0x3cb61c){return new BPromise(function(_0x3fb08d,_0x46d425){return client[_0xc15e('0x6')](_0xe38d8a,_0x3cb61c)['then'](function(_0x46f5d3){if(_0x46f5d3['error']){return _0x46d425(_0x46f5d3[_0xc15e('0x7')][_0xc15e('0x8')]);}else{return _0x3fb08d(_0x46f5d3[_0xc15e('0x9')]);}})[_0xc15e('0xa')](function(_0x218d79){return _0x46d425(_0x218d79);});});}exports['getSquareProject']=function(_0x2b74b3){return request(_0xc15e('0xb'),{'options':{'raw':![],'where':{'name':_0x2b74b3},'attributes':['production']}});};exports['getMailAccountById']=function(_0x3e0f93){return request(_0xc15e('0xc'),{'options':{'raw':![],'where':{'id':_0x3e0f93},'include':[{'model':_0xc15e('0xd'),'as':'Smtp'}],'attributes':['id',_0xc15e('0xe'),_0xc15e('0xf')]}});};exports[_0xc15e('0x10')]=function(_0x5107ff){return request(_0xc15e('0xb'),{'options':{'where':{'id':_0x5107ff},'attributes':[_0xc15e('0xe')]}});};exports[_0xc15e('0x11')]=function(_0x318bff){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x318bff},'attributes':['name']}});};exports[_0xc15e('0x12')]=function(_0x4e7b9d){return request(_0xc15e('0x13'),{'options':{'where':{'id':_0x4e7b9d},'attributes':[_0xc15e('0xe')]}});};exports[_0xc15e('0x14')]=function(_0x4b98dd){return request(_0xc15e('0x15'),{'options':{'where':{'id':_0x4b98dd},'attributes':[_0xc15e('0x16')]}});};exports[_0xc15e('0x17')]=function(_0x3401bf){return request(_0xc15e('0x18'),{'options':{'where':{'id':_0x3401bf},'attributes':['name']}});};exports[_0xc15e('0x19')]=function(_0x323865){return request(_0xc15e('0x1a'),{'options':{'where':{'id':_0x323865},'attributes':['name']}});};exports[_0xc15e('0x1b')]=function(_0x31a4c9){return request('ShowSound',{'options':{'where':{'id':_0x31a4c9},'attributes':[_0xc15e('0x1c')]}});};exports[_0xc15e('0x1d')]=function(_0x47c981){return request(_0xc15e('0x1e'),{'options':{'raw':![],'where':{'id':_0x47c981},'include':[{'model':_0xc15e('0x1f'),'as':'Intervals'}]}});};exports[_0xc15e('0x20')]=function(_0x76c281){return request(_0xc15e('0x21'),{'options':{'where':{'id':_0x76c281},'attributes':['id',_0xc15e('0xe')]}});};exports['createSmsMessage']=function(_0xe83efa){return request(_0xc15e('0x22'),{'body':_0xe83efa});};exports[_0xc15e('0x23')]=function(_0xa2527){return request(_0xc15e('0x24'),{'body':_0xa2527});};exports[_0xc15e('0x25')]=function(_0x44be0a){return request('CreateSquareReport',{'body':_[_0xc15e('0x26')](_0x44be0a,{'project_name':_0x44be0a['arg_1'],'prev_project_name':_0x44be0a['arg_2']||'','is_subproject':_0x44be0a[_0xc15e('0x27')]?!![]:![],'leaveAt':moment()['format'](_0xc15e('0x28'))})});};exports[_0xc15e('0x29')]=function(_0x1dfe3a){return request(_0xc15e('0x2a'),{'body':_0x1dfe3a});};exports[_0xc15e('0x2b')]=function(_0xde6fc3){return request(_0xc15e('0x2c'),{'body':_0xde6fc3});};exports[_0xc15e('0x2d')]=function(_0x205dd2){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x205dd2[_0xc15e('0x2e')],'ListId':_0x205dd2['ListId']}}})[_0xc15e('0x2f')](function(_0x152454){if(_0x152454){return _0x152454;}return request(_0xc15e('0x30'),{'body':_0x205dd2});});};exports[_0xc15e('0x31')]=function(_0x2e8ca7){return request(_0xc15e('0x32'),{'options':{'where':{'id':_0x2e8ca7},'attributes':[_0xc15e('0xe')]}});};exports[_0xc15e('0x33')]=function(_0x5cf3f0,_0x387eb7){return request('LoginUser',{'body':{'interface':_0x387eb7},'options':{'where':_0x5cf3f0}});};exports['agentPause']=function(_0xdecae1,_0x1db0fb,_0x47f0f7){return request(_0xc15e('0x34'),{'body':{'type':_0x1db0fb,'uniqueid':_0x47f0f7},'options':{'where':_0xdecae1}});};exports[_0xc15e('0x35')]=function(_0xb240aa){return request(_0xc15e('0x36'),{'body':{},'options':{'where':_0xb240aa}});};exports[_0xc15e('0x37')]=function(_0x4e7f63){return request(_0xc15e('0x38'),{'body':{},'options':{'where':_0x4e7f63}});}; \ 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 2e9e965..676aa26 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 _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 +var _0x2d17=['./polly','./lex'];(function(_0x5aa2f3,_0x5e2a7c){var _0x326c8e=function(_0x2751a7){while(--_0x2751a7){_0x5aa2f3['push'](_0x5aa2f3['shift']());}};_0x326c8e(++_0x5e2a7c);}(_0x2d17,0x17e));var _0x72d1=function(_0x53a1b7,_0x947a65){_0x53a1b7=_0x53a1b7-0x0;var _0x3d958f=_0x2d17[_0x53a1b7];return _0x3d958f;};var polly=require(_0x72d1('0x0'));var lex=require(_0x72d1('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 ad1fb3f..c6a57a4 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 _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 +var _0xfaa4=['./lib/api','exports'];(function(_0x4238a0,_0x24f3f2){var _0x127646=function(_0x4f1db2){while(--_0x4f1db2){_0x4238a0['push'](_0x4238a0['shift']());}};_0x127646(++_0x24f3f2);}(_0xfaa4,0x1a8));var _0x4faa=function(_0x3587f2,_0x2f14ce){_0x3587f2=_0x3587f2-0x0;var _0x301313=_0xfaa4[_0x3587f2];return _0x301313;};'use strict';var lex=require(_0x4faa('0x0'));module[_0x4faa('0x1')]=function(_0x28b375,_0x39ba1a,_0x122c51,_0x1f79b7,_0x5141d1,_0x1d9494){return lex(_0x28b375,_0x39ba1a,_0x122c51,_0x1f79b7,_0x5141d1,_0x1d9494);}; \ 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 e605abb..f605932 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 _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 +var _0xeac4=['slot_','exports','$LATEST','bluebird','aws-sdk','postText','slots'];(function(_0x39277f,_0x460842){var _0xfcf21e=function(_0x38cb66){while(--_0x38cb66){_0x39277f['push'](_0x39277f['shift']());}};_0xfcf21e(++_0x460842);}(_0xeac4,0x192));var _0x4eac=function(_0x5b474c,_0x53a6e5){_0x5b474c=_0x5b474c-0x0;var _0x6f3112=_0xeac4[_0x5b474c];return _0x6f3112;};'use strict';var BPromise=require(_0x4eac('0x0'));var AWS=require(_0x4eac('0x1'));function lexResult(_0x2d3845,_0xcd8764){return new BPromise(function(_0x1666e7,_0x243732){_0x2d3845[_0x4eac('0x2')](_0xcd8764,function(_0x23d5b9,_0x3dc8ce){if(_0x23d5b9){_0x243732(_0x23d5b9);}if(_0x3dc8ce[_0x4eac('0x3')]){for(const _0x18b9ba in _0x3dc8ce[_0x4eac('0x3')]){if(_0x3dc8ce[_0x4eac('0x3')]['hasOwnProperty'](_0x18b9ba)){var _0x58141c=_0x3dc8ce['slots'][_0x18b9ba];_0x3dc8ce[_0x4eac('0x4')+_0x18b9ba]=_0x58141c;}}}_0x1666e7(_0x3dc8ce);});});}module[_0x4eac('0x5')]=function(_0x4f6916,_0x5b33e9,_0x1ef10a,_0x141aa6,_0x5d826c,_0xf972cf){var _0x54ce85=new AWS['LexRuntime']({'accessKeyId':_0x5b33e9,'secretAccessKey':_0x1ef10a,'region':_0x141aa6});var _0x4ee38d={'botAlias':_0x4eac('0x6'),'botName':_0xf972cf,'inputText':_0x5d826c,'userId':_0x4f6916};return lexResult(_0x54ce85,_0x4ee38d);}; \ 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 2a83881..614e6e1 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 _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 +var _0x79b5=['exports','./lib/api'];(function(_0xba8f93,_0x2ee7c2){var _0x12eb7f=function(_0x38381e){while(--_0x38381e){_0xba8f93['push'](_0xba8f93['shift']());}};_0x12eb7f(++_0x2ee7c2);}(_0x79b5,0x177));var _0x579b=function(_0x27d942,_0x2a5a46){_0x27d942=_0x27d942-0x0;var _0x43970e=_0x79b5[_0x27d942];return _0x43970e;};'use strict';var polly=require(_0x579b('0x0'));module[_0x579b('0x1')]=function(_0x130ea3,_0x2ad44d,_0x3682e5,_0x29a41a,_0x4f2601,_0x104875,_0x229d83){return polly(_0x130ea3,_0x2ad44d,_0x3682e5,_0x29a41a,_0x4f2601,_0x104875,_0x229d83);}; \ 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 d26c618..6763534 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 _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 +var _0xe5e5=['text','bluebird','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x56e063,_0x453233){var _0x766fcf=function(_0x59415a){while(--_0x59415a){_0x56e063['push'](_0x56e063['shift']());}};_0x766fcf(++_0x453233);}(_0xe5e5,0xeb));var _0x5e5e=function(_0x213d2a,_0x1cec1c){_0x213d2a=_0x213d2a-0x0;var _0x12d0d3=_0xe5e5[_0x213d2a];return _0x12d0d3;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x5e5e('0x0'));var rs=require('randomstring');var AWS=require(_0x5e5e('0x1'));function pollyResult(_0x4b927e,_0x9df811,_0x4cc16e){return new BPromise(function(_0x42a78c,_0x2b962d){_0x4b927e[_0x5e5e('0x2')](_0x9df811,function(_0x1a68d2,_0x3d95e1){if(_0x1a68d2){_0x2b962d(_0x1a68d2);}else if(_0x3d95e1){if(_0x3d95e1[_0x5e5e('0x3')]instanceof Buffer){fs['writeFile'](_0x4cc16e,_0x3d95e1['AudioStream'],function(_0x2bb413){if(_0x2bb413){_0x2b962d(_0x2bb413);}else{_0x42a78c();}});}else{_0x2b962d(new Error(_0x5e5e('0x4')));}}else{_0x2b962d(new Error(_0x5e5e('0x5')));}});});}module[_0x5e5e('0x6')]=function(_0x2bcca9,_0x42c493,_0x1a3083,_0x416430,_0xc86013,_0x2f9533,_0x2795ff){var _0x4e1730=new AWS[(_0x5e5e('0x7'))]({'accessKeyId':_0x2bcca9,'secretAccessKey':_0x42c493,'region':_0x1a3083});var _0x580374={'Text':_0xc86013,'TextType':_0x2f9533||_0x5e5e('0x8'),'OutputFormat':'mp3','VoiceId':_0x416430};return pollyResult(_0x4e1730,_0x580374,_0x2795ff);}; \ 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 fe09e03..1b4cd36 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 _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 +var _0xcc24=['./lib/api','exports'];(function(_0x317168,_0x2bffec){var _0x37120a=function(_0x5bf6ca){while(--_0x5bf6ca){_0x317168['push'](_0x317168['shift']());}};_0x37120a(++_0x2bffec);}(_0xcc24,0x7a));var _0x4cc2=function(_0x503ec3,_0x17812e){_0x503ec3=_0x503ec3-0x0;var _0x1faac1=_0xcc24[_0x503ec3];return _0x1faac1;};'use strict';var asr=require(_0x4cc2('0x0'));module[_0x4cc2('0x1')]=function(_0x2adc19,_0x556789,_0x500b50,_0x1719ff){return asr(_0x2adc19,_0x556789,_0x500b50);}; \ 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 c80a3d0..5b98660 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 _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 +var _0x0cec=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x5d5da1,_0x5607e8){var _0x4ad74b=function(_0x32bd6c){while(--_0x32bd6c){_0x5d5da1['push'](_0x5d5da1['shift']());}};_0x4ad74b(++_0x5607e8);}(_0x0cec,0x94));var _0xc0ce=function(_0x44dcb4,_0xcdd0c6){_0x44dcb4=_0x44dcb4-0x0;var _0x465432=_0x0cec[_0x44dcb4];return _0x465432;};'use strict';var url=require(_0xc0ce('0x0'));var BPromise=require(_0xc0ce('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xc0ce('0x2')]=function(_0x578820,_0x48f3ee,_0x21e4fd){return new BPromise(function(_0x33cead,_0x32b487){var _0x5cf47f;if(typeof _0x578820!==_0xc0ce('0x3')||_0x578820[_0xc0ce('0x4')]===0x0){return _0x32b487(_0xc0ce('0x5'));}if(typeof _0x48f3ee!==_0xc0ce('0x3')||_0x48f3ee[_0xc0ce('0x4')]===0x0){return _0x32b487('key\x20should\x20be\x20a\x20string');}if(typeof _0x21e4fd!=='undefined'&&(typeof _0x21e4fd!==_0xc0ce('0x3')||_0x21e4fd['length']===0x0)){return _0x32b487('lang\x20should\x20be\x20a\x20string');}try{_0x5cf47f=fs[_0xc0ce('0x6')](_0x578820)[_0xc0ce('0x7')](_0xc0ce('0x8'));}catch(_0x1f8c4c){return _0x32b487(_0x1f8c4c);}return _0x33cead({'method':_0xc0ce('0x9'),'uri':host+_0xc0ce('0xa')+_0x48f3ee,'body':{'config':{'encoding':_0xc0ce('0xb'),'sampleRateHertz':_0xc0ce('0xc'),'languageCode':_0x21e4fd},'audio':{'content':_0x5cf47f}},'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 3f9f8b4..3ba611b 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 _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 +var _0x1728=['./asr','exports'];(function(_0x5acb6d,_0x533fcd){var _0x4901f0=function(_0x4394e6){while(--_0x4394e6){_0x5acb6d['push'](_0x5acb6d['shift']());}};_0x4901f0(++_0x533fcd);}(_0x1728,0x19a));var _0x8172=function(_0x136ac9,_0x1a9ba1){_0x136ac9=_0x136ac9-0x0;var _0x419fd7=_0x1728[_0x136ac9];return _0x419fd7;};var asr=require(_0x8172('0x0'));module[_0x8172('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 fb9caa5..277bcfb 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 _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 +var _0x7b1a=['statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','download\x20error','pipe','end','WHAT_EVER','transcode','wav','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','unlink','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','MP3','text:synthesize','then','tmp','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','data','.mp3','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','boolValue','intent','name','isFallback','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x7b1a,0x100));var _0xa7b1=function(_0x772017,_0x3baebf){_0x772017=_0x772017-0x0;var _0x59b84a=_0x7b1a[_0x772017];return _0x59b84a;};'use strict';var apiai=require(_0xa7b1('0x0'));var BPromise=require(_0xa7b1('0x1'));var dialogflow=require(_0xa7b1('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xa7b1('0x3'));var md5=require(_0xa7b1('0x4'));var path=require(_0xa7b1('0x5'));var querystring=require(_0xa7b1('0x6'));var rp=require(_0xa7b1('0x7'));var rs=require(_0xa7b1('0x8'));var sox=require('sox');var tts=require('google-tts-api');var urlParse=require('url')[_0xa7b1('0x9')];var util=require(_0xa7b1('0xa'));var aws=require(_0xa7b1('0xb'));var google=require(_0xa7b1('0xc'));var sestek=require(_0xa7b1('0xd'));var tilde=require('./tilde');var logger=require(_0xa7b1('0xe'))(_0xa7b1('0xf'));var ISPEECH_API=_0xa7b1('0x10');function downloadFile(_0x32a92a,_0x227114){return new BPromise(function(_0x492806,_0x4b6e7e){var _0x4da263=urlParse(_0x32a92a);var _0x27dcb2=_0x4da263[_0xa7b1('0x11')]===_0xa7b1('0x12')?https:http;var _0x2c7142={'host':_0x4da263[_0xa7b1('0x13')],'path':_0x4da263['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x27dcb2[_0xa7b1('0x14')](_0x2c7142,function(_0x55813c){if(_0x55813c['statusCode']!==0xc8){logger[_0xa7b1('0x15')](_0xa7b1('0x16')+_0x32a92a+_0xa7b1('0x17')+_0x55813c[_0xa7b1('0x18')]+'\x20('+_0x55813c[_0xa7b1('0x19')]+')');_0x4b6e7e(new Error(_0xa7b1('0x16')+_0x32a92a+_0xa7b1('0x17')+_0x55813c['statusCode']+'\x20('+_0x55813c[_0xa7b1('0x19')]+')'));return;}var _0x27ea53=fs[_0xa7b1('0x1a')](_0x227114);_0x27ea53['on'](_0xa7b1('0x1b'),function(){logger[_0xa7b1('0x1c')](_0xa7b1('0x1d'));_0x27ea53['close'](_0x492806);});_0x27ea53['on']('error',function(_0x577ae1){fs['unlink'](_0x227114);logger[_0xa7b1('0x15')](_0xa7b1('0x1e'),_0x577ae1);_0x4b6e7e(_0x577ae1);});_0x55813c[_0xa7b1('0x1f')](_0x27ea53);})['on']('error',function(_0x2de9d0){logger['error'](_0x2de9d0);_0x4b6e7e(_0x2de9d0);})[_0xa7b1('0x20')]();});}function uploadFile(_0x11c6e6){return new BPromise(function(_0x50c59c,_0x2c7d0e){var _0x146730=urlParse(_0x11c6e6);var _0x20f01=_0x146730[_0xa7b1('0x11')]==='https:'?https:http;var _0x425293={'host':_0x146730[_0xa7b1('0x13')],'path':_0x146730[_0xa7b1('0x5')],'headers':{'user-agent':_0xa7b1('0x21')}};_0x20f01[_0xa7b1('0x14')](_0x425293,function(_0x485923){if(_0x485923[_0xa7b1('0x18')]!==0xc8){_0x2c7d0e(new Error(_0xa7b1('0x16')+_0x11c6e6+_0xa7b1('0x17')+_0x485923[_0xa7b1('0x18')]+'\x20('+_0x485923['statusMessage']+')'));return;}var _0x979609='';_0x485923['on']('data',function(_0x544f2a){_0x979609+=_0x544f2a;});_0x485923['on'](_0xa7b1('0x20'),function(){_0x50c59c(_0x979609);});})['on'](_0xa7b1('0x15'),function(_0x5b8755){_0x2c7d0e(_0x5b8755);})[_0xa7b1('0x20')]();});}function convertFile(_0x473e9d,_0x8bf09b){return new BPromise(function(_0x2f478f,_0x1f93b6){var _0x51fb9e=sox[_0xa7b1('0x22')](_0x473e9d,_0x8bf09b,{'sampleRate':0x1f40,'format':_0xa7b1('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x51fb9e['on'](_0xa7b1('0x15'),function(_0x92e984){logger[_0xa7b1('0x15')]('error\x20convert',_0x92e984);_0x1f93b6(_0x92e984);});_0x51fb9e['on'](_0xa7b1('0x20'),function(){logger[_0xa7b1('0x1c')](_0xa7b1('0x24'));_0x2f478f();});_0x51fb9e[_0xa7b1('0x25')]();});}function base64Decode(_0x9e999d,_0x22d833){var _0x2c26c0=path[_0xa7b1('0x26')](__dirname,'tmp',rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x28'));fs[_0xa7b1('0x29')](_0x2c26c0,_0x9e999d,'base64');return convertFile(_0x2c26c0,_0x22d833)['then'](function(){try{fs[_0xa7b1('0x2a')](_0x2c26c0);fs['chmodSync'](_0x22d833,_0xa7b1('0x2b'));}catch(_0x330d1a){logger[_0xa7b1('0x15')](_0x330d1a);}return _0x22d833[_0xa7b1('0x2c')]('.')[0x0];});}function base64Encode(_0x42e08f){var _0x85597c=fs[_0xa7b1('0x2d')](_0x42e08f);return new Buffer(_0x85597c)[_0xa7b1('0x2e')](_0xa7b1('0x2f'));}exports[_0xa7b1('0x30')]=function(_0x46e41f,_0x4a771a,_0x533425,_0x497120,_0x114f62,_0x1cb02f){var _0x5652c4,_0x498629;var _0x332ca6=_0xa7b1('0x31');var _0x2414be=_0xa7b1('0x32')+_0x46e41f;var _0x2179dd={};if(_0x4a771a===_0xa7b1('0x33')){_0x2179dd['input']={'ssml':_0x533425};}else{_0x2179dd[_0xa7b1('0x34')]={'text':_0x533425};};_0x2179dd[_0xa7b1('0x35')]={'languageCode':_0x497120,'ssmlGender':_0x114f62};_0x2179dd['audioConfig']={'audioEncoding':_0xa7b1('0x36'),'sampleRateHertz':0x1f40};var _0x4f2ceb={'url':_0x332ca6+_0xa7b1('0x37')+_0x2414be,'method':'POST','json':!![],'body':_0x2179dd};return rp(_0x4f2ceb)[_0xa7b1('0x38')](function(_0x2bcc3d){return new BPromise(function(_0x4234bc,_0x4198ef){_0x5652c4=path[_0xa7b1('0x26')](__dirname,_0xa7b1('0x39'),rs[_0xa7b1('0x27')](0x4)+'.mp3');var _0x2bbb46=Buffer[_0xa7b1('0x3a')](_0x2bcc3d[_0xa7b1('0x3b')],_0xa7b1('0x2f'));return fs[_0xa7b1('0x3c')](_0x5652c4,_0x2bbb46,function(_0x1472b0){_0x4198ef(_0x1472b0);},function(_0x3f5d28){fs[_0xa7b1('0x3d')](_0x5652c4,_0xa7b1('0x2b'));_0x4234bc(_0x3f5d28);});});})[_0xa7b1('0x38')](function(_0x2ee334){_0x498629=path[_0xa7b1('0x26')](__dirname,_0xa7b1('0x39'),rs[_0xa7b1('0x27')](0x4)+'.wav');return convertFile(_0x5652c4,_0x498629);})[_0xa7b1('0x38')](function(){try{fs[_0xa7b1('0x2a')](_0x5652c4);fs['chmodSync'](_0x498629,_0xa7b1('0x2b'));}catch(_0x1e9d90){logger[_0xa7b1('0x15')](_0x1e9d90);}logger['info'](_0xa7b1('0x3e'),_0x498629[_0xa7b1('0x2c')]('.')[0x0]);return _0x498629[_0xa7b1('0x2c')]('.')[0x0];});};exports[_0xa7b1('0x3f')]=function(_0x5648c8,_0x171ec6){var _0x4e3aeb=_0xa7b1('0x40');var _0x520d18,_0x5f4c3b;var _0x9e9ef4;var _0x2621b3={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x4e3aeb,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0xa7b1('0x41')]([[[_0xa7b1('0x42'),JSON['stringify']([_0x5648c8,_0x171ec6||'en',![],_0xa7b1('0x43')]),null,'generic']]]))};return rp(_0x2621b3)[_0xa7b1('0x38')](function(_0x4b12d7){try{_0x9e9ef4=eval(_0x4b12d7[_0xa7b1('0x44')](0x5))[0x0][0x2];}catch(_0x582831){throw new Error(_0xa7b1('0x45')+_0x4b12d7['data']);}if(!_0x9e9ef4){if(_0x5648c8[_0xa7b1('0x46')]>0xc8){throw new Error(_0xa7b1('0x47'));}else{throw new Error(_0xa7b1('0x48')+_0x171ec6+_0xa7b1('0x49'));}}try{_0x9e9ef4=eval(_0x9e9ef4)[0x0];}catch(_0x155065){throw new Error(_0xa7b1('0x45')+res[_0xa7b1('0x4a')]);}const _0xfc5d91=_0x9e9ef4;_0x520d18=path[_0xa7b1('0x26')](__dirname,_0xa7b1('0x39'),rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x4b'));fs[_0xa7b1('0x29')](_0x520d18,_0x9e9ef4,{'encoding':_0xa7b1('0x2f')});_0x5f4c3b=path[_0xa7b1('0x26')](__dirname,_0xa7b1('0x39'),rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x28'));return convertFile(_0x520d18,_0x5f4c3b);})[_0xa7b1('0x38')](function(){try{fs['unlink'](_0x520d18);fs[_0xa7b1('0x3d')](_0x5f4c3b,_0xa7b1('0x2b'));}catch(_0x48323a){logger['error'](_0x48323a);}logger[_0xa7b1('0x1c')](_0xa7b1('0x4c'),_0x5f4c3b['split']('.')[0x0]);return _0x5f4c3b['split']('.')[0x0];});};exports[_0xa7b1('0x4d')]=function(_0x2c2308,_0x211311,_0x11a57f){return google[_0xa7b1('0x4e')](_0x2c2308,_0x211311,_0x11a57f)[_0xa7b1('0x38')](function(_0x3d4f3e){logger[_0xa7b1('0x1c')](_0x3d4f3e[_0xa7b1('0x4f')]);return rp(_0x3d4f3e);})[_0xa7b1('0x38')](function(_0x40133b){var _0x43d356='';var _0x9c79fc=0x0;try{fs[_0xa7b1('0x2a')](_0x2c2308);}catch(_0x4e6e38){logger[_0xa7b1('0x15')](_0x4e6e38);}if(_0x40133b&&_0x40133b[_0xa7b1('0x50')]){_0x43d356=_0x40133b[_0xa7b1('0x50')][_0xa7b1('0x51')](function(_0x458554){return _0x458554&&_0x458554[_0xa7b1('0x52')][0x0]&&_0x458554['alternatives'][0x0]['transcript']?_0x458554[_0xa7b1('0x52')][0x0][_0xa7b1('0x53')]:'';})['join']('\x0a');_0x9c79fc=_0x40133b[_0xa7b1('0x50')][_0xa7b1('0x51')](function(_0x4fd253){return _0x4fd253&&_0x4fd253[_0xa7b1('0x52')][0x0]&&_0x4fd253[_0xa7b1('0x52')][0x0][_0xa7b1('0x54')]?_0x4fd253[_0xa7b1('0x52')][0x0][_0xa7b1('0x54')]:0x0;})[_0xa7b1('0x55')]('\x0a');}logger[_0xa7b1('0x1c')](_0xa7b1('0x56'),_0x43d356);logger[_0xa7b1('0x1c')](_0xa7b1('0x57'),_0x9c79fc);return{'transcript':_0x43d356,'confidence':_0x9c79fc};})[_0xa7b1('0x58')](function(_0x361b0f){logger[_0xa7b1('0x15')](_0xa7b1('0x59'),_0x361b0f[_0xa7b1('0x18')],_0x361b0f['name'],_0x361b0f[_0xa7b1('0x5a')]);});};exports[_0xa7b1('0x5b')]=function(_0x16f81a,_0x1222c8,_0xcea1db,_0x2e4977){var _0x1964d8=apiai(_0x1222c8,{'language':_0x2e4977||'en'});return _0x1964d8[_0xa7b1('0x5c')](_0xcea1db,{'sessionId':md5(_0x16f81a)})[_0xa7b1('0x38')](function(_0x4da085){logger[_0xa7b1('0x1c')](JSON[_0xa7b1('0x41')](_0x4da085));return{'source':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x5e')],'resolvedQuery':_0x4da085[_0xa7b1('0x5d')]['resolvedQuery'],'action':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x5f')],'actionIncomplete':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x60')],'speech':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x61')][_0xa7b1('0x62')],'score':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x63')],'statusCode':_0x4da085[_0xa7b1('0x64')][_0xa7b1('0x65')],'endConversation':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x66')][_0xa7b1('0x67')]||![],'isFallbackIntent':_0x4da085[_0xa7b1('0x5d')][_0xa7b1('0x66')][_0xa7b1('0x68')]};});};exports[_0xa7b1('0x69')]=function(_0x5f57cb,_0x518521,_0x437cdb,_0x478a42,_0x2d50c5,_0x1782e1){var _0x32dac8=_0x478a42[_0xa7b1('0x6a')](/\\n/g,'\x0a');var _0x497e69={'credentials':{'private_key':_0x32dac8,'client_email':_0x437cdb}};var _0x3daed4=new dialogflow['SessionsClient'](_0x497e69);var _0xa6468c=_0x3daed4[_0xa7b1('0x6b')](_0x518521,md5(_0x5f57cb));var _0x25b4ce={'session':_0xa6468c,'queryInput':{'text':{'text':_0x2d50c5,'languageCode':_0x1782e1}}};return _0x3daed4[_0xa7b1('0x6c')](_0x25b4ce)[_0xa7b1('0x38')](function(_0x2b7a68){if(_0x2b7a68&&_0x2b7a68[_0xa7b1('0x46')]){logger[_0xa7b1('0x1c')](_0xa7b1('0x6d'),JSON[_0xa7b1('0x41')](_0x2b7a68));var _0x29cedc=_0x2b7a68[0x0];if(_0x29cedc){var _0x3e5b6d={'action':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x5f')],'allRequiredParamsPresent':_0x29cedc['queryResult'][_0xa7b1('0x6f')],'endConversation':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x70')]&&_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x70')]['fields']?_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x70')]['fields']['end_conversation'][_0xa7b1('0x71')]:![],'fulfillmentText':_0x29cedc[_0xa7b1('0x6e')]['fulfillmentText'],'intentName':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x72')][_0xa7b1('0x73')],'intentDisplayName':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x72')]['displayName'],'isFallbackIntent':_0x29cedc[_0xa7b1('0x6e')]['intent'][_0xa7b1('0x74')],'languageCode':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x75')],'queryText':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x76')],'responseId':_0x29cedc[_0xa7b1('0x77')],'score':_0x29cedc['queryResult']['intentDetectionConfidence'],'speech':_0x29cedc[_0xa7b1('0x6e')][_0xa7b1('0x78')],'providerResponse':JSON[_0xa7b1('0x41')](_0x2b7a68)};return _0x3e5b6d;}}});};exports[_0xa7b1('0x79')]=function(_0x3dc69a,_0xf40051,_0x2988af,_0x3418ef){return tilde['asr'](_0x3dc69a,_0xf40051,_0x2988af,_0x3418ef)['then'](function(_0x18935f){try{fs['unlink'](_0x3dc69a);}catch(_0xbebf9e){logger['error'](_0xbebf9e);}logger[_0xa7b1('0x1c')](_0xa7b1('0x7a'),_0x18935f[_0xa7b1('0x53')]);logger[_0xa7b1('0x1c')](_0xa7b1('0x7b'),_0x18935f[_0xa7b1('0x54')]);return _0x18935f;});};exports[_0xa7b1('0x7c')]=function(_0x4a989a,_0x2a6957,_0x196b8e,_0x32b01d,_0xcef4b7,_0x40cd9d){var _0x4cfe0b=path[_0xa7b1('0x26')](__dirname,'tmp',rs['generate'](0x4)+_0xa7b1('0x4b'));var _0x18946f;return aws[_0xa7b1('0x7d')](_0x4a989a,_0x2a6957,_0x196b8e,_0x32b01d,_0xcef4b7,_0x40cd9d,_0x4cfe0b)[_0xa7b1('0x38')](function(){_0x18946f=path['resolve'](__dirname,'tmp',rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x28'));return convertFile(_0x4cfe0b,_0x18946f);})['then'](function(){try{fs[_0xa7b1('0x2a')](_0x4cfe0b);fs[_0xa7b1('0x3d')](_0x18946f,_0xa7b1('0x2b'));}catch(_0x1e88b6){logger[_0xa7b1('0x15')](_0x1e88b6);}return _0x18946f[_0xa7b1('0x2c')]('.')[0x0];});};exports['awsLex']=function(_0x1f4348,_0x5daf52,_0x43b35c,_0x102d53,_0x5c873a,_0x3b7f46){return aws[_0xa7b1('0x7e')](_0x1f4348,_0x5daf52,_0x43b35c,_0x102d53,_0x5c873a,_0x3b7f46)['then'](function(_0x2f39f5){logger[_0xa7b1('0x1c')](JSON[_0xa7b1('0x41')](_0x2f39f5));return _0x2f39f5;});};exports[_0xa7b1('0x7f')]=function(_0x43a897,_0xd66030,_0x24dfa9,_0x41fe81){var _0x562a47=util[_0xa7b1('0x80')](_0xa7b1('0x81'),ISPEECH_API,_0x43a897,encodeURIComponent(_0xd66030),_0x24dfa9,_0x41fe81);var _0x1a043a=path['resolve'](__dirname,'tmp',rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x4b'));var _0x1a6f5c;return downloadFile(_0x562a47,_0x1a043a)[_0xa7b1('0x38')](function(){_0x1a6f5c=path[_0xa7b1('0x26')](__dirname,'tmp',rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x28'));return convertFile(_0x1a043a,_0x1a6f5c);})[_0xa7b1('0x38')](function(){try{fs['unlink'](_0x1a043a);fs[_0xa7b1('0x3d')](_0x1a6f5c,'777');}catch(_0x51e55d){logger['error'](_0x51e55d);}return _0x1a6f5c['split']('.')[0x0];});};exports['ispeechASR']=function(_0x30b2b5,_0x296e14,_0x2a2248,_0x8db449){var _0x2eab4c=util[_0xa7b1('0x80')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x296e14,_0x2a2248,base64Encode(_0x30b2b5),_0x8db449?util['format'](_0xa7b1('0x82'),encodeURIComponent(_0x8db449)):_0xa7b1('0x83'));return uploadFile(_0x2eab4c)[_0xa7b1('0x38')](function(_0xf40290){return querystring[_0xa7b1('0x9')](_0xf40290);});};exports[_0xa7b1('0x84')]=function(_0x4fb85e,_0x74d44){return sestek[_0xa7b1('0x85')](_0x4fb85e,_0x74d44)['then'](function(_0x4125b8){logger[_0xa7b1('0x1c')](JSON[_0xa7b1('0x41')](_0x4125b8));var _0x5787af={'speech':_0x4125b8[_0xa7b1('0x86')],'action':_0x4125b8[_0xa7b1('0x87')]?_0x4125b8[_0xa7b1('0x87')][_0xa7b1('0x88')]:undefined,'actiondata':_0x4125b8[_0xa7b1('0x87')]?_0x4125b8[_0xa7b1('0x87')][_0xa7b1('0x89')]:undefined};if(_0x4125b8['channelData']&&_0x4125b8['channelData'][_0xa7b1('0x8a')]){return base64Decode(_0x4125b8['channelData'][_0xa7b1('0x8a')]['Data'],path[_0xa7b1('0x26')](__dirname,'tmp',rs[_0xa7b1('0x27')](0x4)+_0xa7b1('0x28')))[_0xa7b1('0x38')](function(_0x2b353c){_0x5787af[_0xa7b1('0x8b')]=_0x2b353c;return _0x5787af;});}return _0x5787af;});};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 21c5c08..2a1ee7f 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 _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 +var _0x4366=['exports'];(function(_0x2252fa,_0x100404){var _0x7464d9=function(_0x4fa3cd){while(--_0x4fa3cd){_0x2252fa['push'](_0x2252fa['shift']());}};_0x7464d9(++_0x100404);}(_0x4366,0xa4));var _0x6436=function(_0x1444ef,_0x112063){_0x1444ef=_0x1444ef-0x0;var _0x3748de=_0x4366[_0x1444ef];return _0x3748de;};var nda=require('./nda');module[_0x6436('0x0')]={'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 54a7590..e04f9b2 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 _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 +var _0x980c=['ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','uniqueid','callerid','calleridname','dnid','Bearer\x20','access_token','project','body','channelData','ProjectName'];(function(_0xdd1f52,_0x227e9e){var _0x368782=function(_0x480309){while(--_0x480309){_0xdd1f52['push'](_0xdd1f52['shift']());}};_0x368782(++_0x227e9e);}(_0x980c,0x6f));var _0xc980=function(_0x4f0383,_0xd26c22){_0x4f0383=_0x4f0383-0x0;var _0x4ed644=_0x980c[_0x4f0383];return _0x4ed644;};'use strict';var rp=require('request-promise');var url=require(_0xc980('0x0'));var logger=require(_0xc980('0x1'))(_0xc980('0x2'));module[_0xc980('0x3')]=function(_0x1ce461,_0x430fc0){var _0x5217c4={'method':_0xc980('0x4'),'uri':url[_0xc980('0x5')](_0x430fc0[_0xc980('0x6')],_0xc980('0x7')),'form':{'grant_type':_0xc980('0x8'),'username':_0x430fc0[_0xc980('0x9')],'password':_0x430fc0[_0xc980('0x8')]},'json':!![]};return rp(_0x5217c4)[_0xc980('0xa')](function(_0x2b9c03){var _0x26fc22={'method':_0xc980('0x4'),'uri':url['resolve'](_0x430fc0[_0xc980('0xb')],_0xc980('0xc')),'body':{'type':_0x430fc0[_0xc980('0xd')]||_0xc980('0xe'),'channelId':'Nda','conversation':{'id':_0x1ce461[_0xc980('0xf')]},'from':{'id':_0x1ce461[_0xc980('0x10')],'name':_0x1ce461[_0xc980('0x11')]},'recipient':{'id':_0x1ce461[_0xc980('0x12')],'name':_0x1ce461['extension']},'text':_0x430fc0['text'],'channelData':{}},'headers':{'Authorization':_0xc980('0x13')+_0x2b9c03[_0xc980('0x14')]},'json':!![]};if(_0x430fc0[_0xc980('0x15')]){_0x26fc22[_0xc980('0x16')][_0xc980('0x17')][_0xc980('0x18')]=_0x430fc0[_0xc980('0x15')];}if(_0x430fc0[_0xc980('0x19')]=='1'){_0x26fc22['body'][_0xc980('0x17')][_0xc980('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc980('0x1b')};}if(_0x430fc0[_0xc980('0x1c')]){_0x26fc22[_0xc980('0x16')][_0xc980('0x17')][_0xc980('0x1d')]=_0x430fc0[_0xc980('0x1c')];if(_0x430fc0['custom_action_data']){_0x26fc22[_0xc980('0x16')]['channelData'][_0xc980('0x1e')]=_0x430fc0[_0xc980('0x1f')];}}logger[_0xc980('0x20')](JSON[_0xc980('0x21')](_0x26fc22));return rp(_0x26fc22);});}; \ 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 304e89f..2a96743 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 _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 +var _0x3656=['./lib/api','exports'];(function(_0x248c1c,_0x4f7732){var _0x1a7999=function(_0x4075af){while(--_0x4075af){_0x248c1c['push'](_0x248c1c['shift']());}};_0x1a7999(++_0x4f7732);}(_0x3656,0x1da));var _0x6365=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x3656[_0x4e676e];return _0x336a3c;};'use strict';var asr=require(_0x6365('0x0'));module[_0x6365('0x1')]=function(_0x1de939,_0x4eb64f,_0xcd59fd,_0x2a1d4e){return asr(_0x1de939,_0x4eb64f,_0xcd59fd,_0x2a1d4e);}; \ 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 d4f3f2c..ef21e85 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 _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 +var _0xee4a=['Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','moment','crypto','../../../../../../config/logger','exports','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','update','digest','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','send','close','EOS','error','parse','status','result','final','transcript','hypotheses','terminate'];(function(_0x32cdf7,_0x3e9c6e){var _0x4c32e2=function(_0x1971e5){while(--_0x1971e5){_0x32cdf7['push'](_0x32cdf7['shift']());}};_0x4c32e2(++_0x3e9c6e);}(_0xee4a,0x9e));var _0xaee4=function(_0x5086ad,_0x17622c){_0x5086ad=_0x5086ad-0x0;var _0x4f23e4=_0xee4a[_0x5086ad];return _0x4f23e4;};'use strict';var BPromise=require(_0xaee4('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xaee4('0x1'));var crypto=require(_0xaee4('0x2'));var logger=require(_0xaee4('0x3'))('agi');module[_0xaee4('0x4')]=function(_0x53d222,_0x12b88f,_0x5a4a26,_0x150f41){return new BPromise(function(_0x50838b,_0x23f47b){logger['info'](_0xaee4('0x5'),_0x150f41||_0xaee4('0x6'));var _0x37ed64=new WebSocket(_0x150f41||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x274758='';var _0x6de436='0';var _0x565bad='1';var _0x117da5=_0xaee4('0x7');function _0x2152ed(_0x3c75a7){var _0x5d8a69=crypto['createHash']('sha1');_0x5d8a69[_0xaee4('0x8')](_0x3c75a7);return _0x5d8a69[_0xaee4('0x9')](_0xaee4('0xa'));}function _0x2e719e(){try{logger[_0xaee4('0xb')](_0xaee4('0xc'));var _0x19fab2=moment()[_0xaee4('0xd')]();var _0x516223=_0x2152ed(_0x19fab2+_0x12b88f+_0x5a4a26);_0x37ed64['send'](JSON[_0xaee4('0xe')]({'appID':_0x12b88f,'timestamp':_0x19fab2,'appKey':_0x516223}));var _0x47b2ed=fs['createReadStream'](_0x53d222);_0x47b2ed['on'](_0xaee4('0xf'),function(_0x24ba30){_0x37ed64[_0xaee4('0x10')](_0x24ba30);});_0x47b2ed['on'](_0xaee4('0x11'),function(){_0x37ed64[_0xaee4('0x10')](_0xaee4('0x12'));});}catch(_0x225f34){logger[_0xaee4('0x13')]('Tilde\x20ASR\x20send\x20error',JSON[_0xaee4('0xe')](_0x225f34));_0x37ed64['terminate']();}}function _0x552297(_0x7cda50){try{if(_0x7cda50){var _0x632c0f=JSON[_0xaee4('0x14')](_0x7cda50);switch(_0x632c0f[_0xaee4('0x15')]){case 0x0:if(_0x632c0f[_0xaee4('0x16')]){if(_0x632c0f['result'][_0xaee4('0x17')]){logger[_0xaee4('0xb')]('Tilde\x20ASR\x20hypoteses',JSON[_0xaee4('0xe')](_0x632c0f[_0xaee4('0x16')]['hypotheses']));_0x274758=_0x632c0f[_0xaee4('0x16')]['hypotheses'][0x0][_0xaee4('0x18')];_0x6de436=_0x632c0f[_0xaee4('0x16')][_0xaee4('0x19')][0x0]['likelihood'];_0x565bad='0';_0x117da5='Success.';_0x37ed64[_0xaee4('0x1a')]();}}break;case 0x1:logger['info'](_0xaee4('0x7'));_0x565bad='1';_0x117da5=_0xaee4('0x7');break;case 0x2:logger['info'](_0xaee4('0x1b'));_0x565bad='2';_0x117da5=_0xaee4('0x1b');break;case 0x9:logger[_0xaee4('0xb')](_0xaee4('0x1c'));_0x565bad='9';_0x117da5=_0xaee4('0x1c');break;case 0xa:logger[_0xaee4('0xb')](_0xaee4('0x1d'));_0x565bad='10';_0x117da5=_0xaee4('0x1d');break;case 0xb:logger[_0xaee4('0xb')](_0xaee4('0x1e'));_0x565bad='11';_0x117da5=_0xaee4('0x1e');}}}catch(_0x3ff17c){logger[_0xaee4('0x13')](_0xaee4('0x1f'),JSON[_0xaee4('0xe')](_0x3ff17c));_0x37ed64['terminate']();}}function _0x24805f(){logger[_0xaee4('0xb')](_0xaee4('0x20'));_0x50838b({'transcript':_0x274758,'confidence':_0x6de436,'status':_0x565bad,'status_message':_0x117da5});}function _0x48a5d9(_0x3bfb39){logger[_0xaee4('0x13')](_0xaee4('0x21'));if(!_[_0xaee4('0x22')](_0x3bfb39)){logger[_0xaee4('0x13')](_[_0xaee4('0x23')](_0x3bfb39)?JSON['stringify'](_0x3bfb39):_0x3bfb39);}}_0x37ed64['on']('open',_0x2e719e);_0x37ed64['on'](_0xaee4('0x24'),_0x552297);_0x37ed64['on'](_0xaee4('0x11'),_0x24805f);_0x37ed64['on'](_0xaee4('0x13'),_0x48a5d9);});}; \ 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 10cb4be..8418c25 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x02d4=['exports'];(function(_0x1dff2a,_0xb42472){var _0x4151d5=function(_0x4c3f15){while(--_0x4c3f15){_0x1dff2a['push'](_0x1dff2a['shift']());}};_0x4151d5(++_0xb42472);}(_0x02d4,0x194));var _0x402d=function(_0x1d33dd,_0xa2ef3c){_0x1d33dd=_0x1d33dd-0x0;var _0x3d8b90=_0x02d4[_0x1d33dd];return _0x3d8b90;};var asr=require('./asr');module[_0x402d('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 51ed29d..f93a3d6 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 _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 +var _0xa25a=['./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','emit','connection','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','inherits','util','net','events','EventEmitter','./error'];(function(_0x3d2012,_0x3d02b9){var _0x53d542=function(_0x8f2be8){while(--_0x8f2be8){_0x3d2012['push'](_0x3d2012['shift']());}};_0x53d542(++_0x3d02b9);}(_0xa25a,0x160));var _0xaa25=function(_0x595245,_0x99ede){_0x595245=_0x595245-0x0;var _0x338930=_0xa25a[_0x595245];return _0x338930;};'use strict';var util=require(_0xaa25('0x0'));var net=require(_0xaa25('0x1'));var EventEmitter=require(_0xaa25('0x2'))[_0xaa25('0x3')];var AGIError=require(_0xaa25('0x4'));var AGIChannel=require(_0xaa25('0x5'));var AGIServer=function(_0x1bce14,_0x756085,_0x1aa8a8){var _0x5da771=this,_0x1bce14=_0x1bce14||0x11dd,_0x756085=_0x756085||_0xaa25('0x6'),_0x866fa1=null,_0x51ce9a=0x0;EventEmitter[_0xaa25('0x7')](_0x5da771);function _0x4fdf6a(){if(!_0x1bce14){_0x5da771['emit'](_0xaa25('0x8'),new AGIError(_0xaa25('0x9')));return![];}_0x866fa1=net['createServer']();_0x866fa1[_0xaa25('0xa')](_0x1bce14,_0x756085);_0x866fa1['on']('listening',function(){_0x5da771[_0xaa25('0xb')]('listening');});_0x866fa1['on'](_0xaa25('0xc'),function(_0x1ba428){_0x866fa1['getConnections'](function(_0x1f5b4a,_0x29df0d){if(_0x1f5b4a){_0x5da771['emit'](_0xaa25('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1f5b4a));}else if(_0x1aa8a8&&_0x1aa8a8<0x0){_0x5da771['emit'](_0xaa25('0x8'),new AGIError(_0xaa25('0xd')));_0x1ba428['destroy']();}else if(_0x1aa8a8&&_0x1aa8a8>0x0&&_0x1aa8a8<_0x29df0d){_0x51ce9a+=0x1;_0x5da771[_0xaa25('0xb')]('error',new AGIError(_0xaa25('0xe'),_0x51ce9a));_0x1ba428['destroy']();}else{var _0x75a438=new AGIChannel(_0x1ba428);_0x75a438['on'](_0xaa25('0xf'),function(){_0x5da771[_0xaa25('0xb')](_0xaa25('0xc'),_0x75a438);});}});});_0x866fa1['on'](_0xaa25('0x8'),function(_0x5880f8){_0x5da771[_0xaa25('0xb')](_0xaa25('0x8'),new AGIError(_0xaa25('0x10'),_0x5880f8[_0xaa25('0x11')]));});_0x866fa1['on'](_0xaa25('0x12'),function(){_0x5da771[_0xaa25('0xb')](_0xaa25('0x12'),new AGIError(_0xaa25('0x13')));});}process['nextTick'](function(){_0x4fdf6a();});};util[_0xaa25('0x14')](AGIServer,EventEmitter);module['exports']=function(_0xdeebb0,_0x537b33,_0x49a04d){return new AGIServer(_0xdeebb0,_0x537b33,_0x49a04d);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 9499066..4eb08c3 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 _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 +var _0x55b6=['getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','getSoundPath','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','extension','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','restAPI','method','timeout','number','POST','PUT','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','uri','render','url','stringify','parse','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_bot_name','googleASR','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isArray','saveRestApiResult','%s.%s','length','setVariable','replaceAllVariables','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','sync','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','query:\x20%s','variable_id','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','mindigit','hiddendigitsnum','generate','first','getsecretdigits','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','aws\x20Polly\x20%s\x20file\x20created','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','wav','tildeASR','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','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','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%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','%s_STATUS_MESSAGE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','set','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','util','lodash','odbc','randomstring','moment','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','save_name'];(function(_0x3eec66,_0x43ce18){var _0xea05a2=function(_0x316948){while(--_0x316948){_0x3eec66['push'](_0x3eec66['shift']());}};_0xea05a2(++_0x43ce18);}(_0x55b6,0x1a0));var _0x655b=function(_0x3a94bf,_0x13788f){_0x3a94bf=_0x3a94bf-0x0;var _0x3f6504=_0x55b6[_0x3a94bf];return _0x3f6504;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x655b('0x0'));var _=require(_0x655b('0x1'));var sh=require('shelljs');var odbc=require(_0x655b('0x2'))();var rs=require(_0x655b('0x3'));var moment=require(_0x655b('0x4'));var Mustache=require('mustache');var rp=require(_0x655b('0x5'));var logger=require(_0x655b('0x6'))('agi');var config=require(_0x655b('0x7'));var scripts=require('./scripts');var FILES_PATH=_0x655b('0x8');var recursiveMapAttributes=[_0x655b('0x9'),_0x655b('0xa')];var verticesWithRetry=[_0x655b('0xb'),_0x655b('0xc'),'getsecretdigits'];var AGIVertices=function(_0x5b8a4a,_0x170680,_0x4651ff){this[_0x655b('0xd')]=_0x5b8a4a;this[_0x655b('0xe')]=_0x170680;this[_0x655b('0xf')]=_0x4651ff;};AGIVertices[_0x655b('0x10')][_0x655b('0x11')]=function(_0x457512,_0x363bce){this['rpc']['getVariableById'](_0x457512)[_0x655b('0x12')](function(_0x175ce2){_0x363bce(null,_0x175ce2?_0x175ce2[_0x655b('0x13')]:![]);})[_0x655b('0x14')](function(_0x1edf53){_0x363bce(_0x1edf53);});};AGIVertices[_0x655b('0x10')][_0x655b('0x15')]=function(_0x2c12b,_0x5704f0){this['rpc']['getVoiceQueueById'](_0x2c12b)[_0x655b('0x12')](function(_0x135cf1){_0x5704f0(null,_0x135cf1?_0x135cf1[_0x655b('0x13')]:![]);})[_0x655b('0x14')](function(_0x285300){_0x5704f0(_0x285300);});};AGIVertices[_0x655b('0x10')][_0x655b('0x16')]=function(_0x50c96d,_0x1492d7){this[_0x655b('0xe')][_0x655b('0x17')](_0x50c96d)[_0x655b('0x12')](function(_0x118c2c){_0x1492d7(null,_0x118c2c?_0x118c2c[_0x655b('0x13')]:![]);})['catch'](function(_0x49ece3){_0x1492d7(_0x49ece3);});};AGIVertices[_0x655b('0x10')]['getSquareOdbc']=function(_0x308390,_0x18fdf0){this['rpc']['getSquareOdbcById'](_0x308390)['then'](function(_0x32a361){_0x18fdf0(null,_0x32a361?_0x32a361[_0x655b('0x18')]:![]);})[_0x655b('0x14')](function(_0x4878fd){_0x18fdf0(_0x4878fd);});};AGIVertices[_0x655b('0x10')][_0x655b('0x19')]=function(_0x4c590a,_0x32888c){this[_0x655b('0xe')][_0x655b('0x1a')](_0x4c590a)[_0x655b('0x12')](function(_0x1757af){_0x32888c(null,_0x1757af?_0x1757af[_0x655b('0x13')]:![]);})[_0x655b('0x14')](function(_0x289655){_0x32888c(_0x289655);});};AGIVertices['prototype'][_0x655b('0x1b')]=function(_0x7a7304,_0x43af46){this[_0x655b('0xe')][_0x655b('0x1c')](_0x7a7304)[_0x655b('0x12')](function(_0x3c8402){_0x43af46(null,_0x3c8402?_0x3c8402[_0x655b('0x13')]:![]);})[_0x655b('0x14')](function(_0x4d8954){_0x43af46(_0x4d8954);});};AGIVertices[_0x655b('0x10')][_0x655b('0x1d')]=function(_0x548a3f,_0x1089d6){var _0x3eb230=this;this['rpc']['getSoundById'](_0x548a3f)[_0x655b('0x12')](function(_0xbe790c){_0x1089d6(null,_0xbe790c?_0x3eb230['getSoundPath'](_0xbe790c[_0x655b('0x1e')]):![]);})[_0x655b('0x14')](function(_0xf264a2){_0x1089d6(_0xf264a2);});};AGIVertices[_0x655b('0x10')][_0x655b('0x1f')]=function(_0x15e4ff,_0x482bf9){this[_0x655b('0xe')]['getMailAccountById'](_0x15e4ff)[_0x655b('0x12')](function(_0x157308){_0x482bf9(null,_0x157308?_0x157308:![]);})['catch'](function(_0xa7fcc7){_0x482bf9(_0xa7fcc7);});};AGIVertices[_0x655b('0x10')][_0x655b('0x20')]=function(_0x4d8262,_0x59bc9c,_0x49daaf){this['mailRpc']['sendMailMessage'](_0x4d8262,_0x59bc9c)[_0x655b('0x12')](function(){_0x49daaf(null);})[_0x655b('0x14')](function(_0x1e4b9b){_0x49daaf(_0x1e4b9b);});};AGIVertices['prototype'][_0x655b('0x21')]=function(_0x606e23,_0x9e1e95){this[_0x655b('0xe')][_0x655b('0x22')](_0x606e23)[_0x655b('0x12')](function(_0x5d42ef){if(_0x5d42ef){if(_0x5d42ef['IntervalId']){_0x9e1e95(null,[_0x5d42ef[_0x655b('0x23')]]);}else{_0x9e1e95(null,_[_0x655b('0x24')](_0x5d42ef['Intervals'],_0x655b('0x23')));}}else{_0x9e1e95(null,![]);}})[_0x655b('0x14')](function(_0x53f4aa){_0x9e1e95(_0x53f4aa);});};AGIVertices[_0x655b('0x10')][_0x655b('0x25')]=function(_0x5e1887){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x5e1887);};AGIVertices[_0x655b('0x10')][_0x655b('0x26')]=function(_0x3282c1,_0x407e7f,_0x1fdd82){odbc[_0x655b('0x27')](_0x3282c1,function(_0x3dd7a2){if(_0x3dd7a2){logger[_0x655b('0x28')](_0x655b('0x29'),_0x3dd7a2);_0x1fdd82(_0x3dd7a2);}else{logger['info'](_0x655b('0x2a'));odbc[_0x655b('0x2b')](_0x407e7f,function(_0x30f7d0,_0x472c5d){if(_0x30f7d0){logger[_0x655b('0x2c')](_0x655b('0x2d'),_0x407e7f);_0x1fdd82(_0x30f7d0);}else{logger[_0x655b('0x2c')]('Query\x20executed\x20correctly\x20%s',_0x407e7f);odbc['close'](function(_0x36037c){if(_0x36037c){logger[_0x655b('0x28')](_0x655b('0x2e'),_0x36037c);}_0x1fdd82(null,_0x472c5d);});}});}});};AGIVertices[_0x655b('0x10')]['getSmsAccount']=function(_0x11c869,_0x481614){this['rpc'][_0x655b('0x2f')](_0x11c869)[_0x655b('0x12')](function(_0x189b9a){_0x481614(null,_0x189b9a?_0x189b9a:![]);})[_0x655b('0x14')](function(_0x263672){_0x481614(_0x263672);});};AGIVertices[_0x655b('0x10')][_0x655b('0x30')]=function(_0xcb3b65,_0x547986){this[_0x655b('0xe')][_0x655b('0x30')](_0xcb3b65)[_0x655b('0x12')](function(_0x3d150a){_0x547986(null,_0x3d150a);})['catch'](function(_0x13b7e7){_0x547986(_0x13b7e7);});};AGIVertices[_0x655b('0x10')][_0x655b('0x31')]=function(_0x421279,_0x1e1b8c,_0x2887a8){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0x655b('0x32')],'node':_0x421279[_0x655b('0x33')],'application':_0x421279[_0x655b('0x34')],'data':_0x1e1b8c||null,'project_name':this[_0x655b('0xd')]['arg_1'],'callerid':this[_0x655b('0xd')][_0x655b('0x35')]})[_0x655b('0x12')](function(_0x19d3ff){if(_0x2887a8){_0x2887a8(null,_0x19d3ff);}})['catch'](function(_0x299ce7){if(_0x2887a8){_0x2887a8(_0x299ce7);}});};AGIVertices['prototype'][_0x655b('0x36')]=function(_0x4487b5,_0x462d41,_0x22b2eb,_0x356e3a){this[_0x655b('0xe')][_0x655b('0x36')]({'uniqueid':this[_0x655b('0xd')]['uniqueid'],'callerid':this['channel']['callerid'],'calleridname':this[_0x655b('0xd')][_0x655b('0x37')],'context':this[_0x655b('0xd')][_0x655b('0x38')],'extension':this[_0x655b('0xd')][_0x655b('0x39')],'priority':this[_0x655b('0xd')]['priority'],'accountcode':this['channel'][_0x655b('0x3a')],'dnid':this[_0x655b('0xd')][_0x655b('0x3b')],'projectName':this[_0x655b('0xd')][_0x655b('0x3c')],'saveName':_0x462d41,'filename':_0x4487b5[_0x655b('0x3d')]||_0x462d41,'savePath':_0x22b2eb})[_0x655b('0x12')](function(_0x2853ab){_0x356e3a(null,_0x2853ab);})['catch'](function(_0x1916c8){_0x356e3a(_0x1916c8);});};AGIVertices[_0x655b('0x10')][_0x655b('0x3e')]=function(_0x1fd901,_0x5e862e,_0x398b23,_0x4d663a,_0x41b2a6){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x655b('0x32')],'body':_0x1fd901,'direction':_0x5e862e,'providerName':_0x398b23,'providerResponse':_0x4d663a})[_0x655b('0x12')](function(_0x4a9e22){if(_0x41b2a6){_0x41b2a6(null,_0x4a9e22);}})[_0x655b('0x14')](function(_0x2b4116){if(_0x41b2a6){_0x41b2a6(_0x2b4116);}});};AGIVertices[_0x655b('0x10')][_0x655b('0x3f')]=function(_0x162ec8,_0x4d57da){this[_0x655b('0xe')]['createCmContact']({'firstName':_[_0x655b('0x40')](_0x162ec8[_0x655b('0x13')])||_[_0x655b('0x41')](_0x162ec8[_0x655b('0x13')])?'callback_'+Math[_0x655b('0x42')]():_0x162ec8[_0x655b('0x13')],'lastName':_[_0x655b('0x40')](_0x162ec8[_0x655b('0x43')])||_[_0x655b('0x41')](_0x162ec8[_0x655b('0x43')])?null:_0x162ec8[_0x655b('0x43')],'phone':_0x162ec8[_0x655b('0x44')],'ListId':_0x162ec8[_0x655b('0x45')],'scheduledat':_0x162ec8[_0x655b('0x46')],'callbackUniqueid':this[_0x655b('0xd')][_0x655b('0x32')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x162ec8['scheduledAt']['toString'](),'priority':_0x162ec8[_0x655b('0x47')]})[_0x655b('0x12')](function(_0x5f3ce7){_0x4d57da(null,_0x5f3ce7);})['catch'](function(_0x5a9627){_0x4d57da(_0x5a9627);});};AGIVertices[_0x655b('0x10')]['getPause']=function(_0x556b2c,_0x2a274f){this['rpc'][_0x655b('0x48')](_0x556b2c)[_0x655b('0x12')](function(_0x459d51){_0x2a274f(null,_0x459d51?_0x459d51[_0x655b('0x13')]:![]);})[_0x655b('0x14')](function(_0x352e56){_0x2a274f(_0x352e56);});};AGIVertices[_0x655b('0x10')][_0x655b('0x49')]=function(_0x30d089,_0x1dd8bd,_0x176b71){var _0x1531de={'role':_0x655b('0x4a')};_0x1531de[_0x30d089]=this[_0x655b('0xd')][_0x655b('0x35')];this[_0x655b('0xe')]['agentPause'](_0x1531de,_0x1dd8bd,this[_0x655b('0xd')][_0x655b('0x32')])[_0x655b('0x12')](function(_0x2d68e1){_0x176b71(null,_[_0x655b('0x41')](_0x2d68e1)?![]:!![]);})[_0x655b('0x14')](function(_0xa90381){logger[_0x655b('0x28')](_0xa90381);_0x176b71(null,![]);});};AGIVertices[_0x655b('0x10')][_0x655b('0x4b')]=function(_0x462c5c,_0x121292){var _0x82561e={'role':_0x655b('0x4a')};_0x82561e[_0x462c5c]=this[_0x655b('0xd')][_0x655b('0x35')];this['rpc']['agentUnpause'](_0x82561e)[_0x655b('0x12')](function(_0x5c44f6){_0x121292(null,_[_0x655b('0x41')](_0x5c44f6)?![]:!![]);})[_0x655b('0x14')](function(_0x2b3056){logger[_0x655b('0x28')](_0x2b3056);_0x121292(null,![]);});};AGIVertices[_0x655b('0x10')]['agentLogout']=function(_0x42b2e0,_0xe500a8){var _0xfdee8b={'role':_0x655b('0x4a')};_0xfdee8b[_0x42b2e0]=this[_0x655b('0xd')][_0x655b('0x35')];this[_0x655b('0xe')][_0x655b('0x4c')](_0xfdee8b)[_0x655b('0x12')](function(_0x4a503b){_0xe500a8(null,_[_0x655b('0x41')](_0x4a503b)?![]:!![]);})[_0x655b('0x14')](function(_0x51d326){logger['error'](_0x51d326);_0xe500a8(null,![]);});};AGIVertices['prototype'][_0x655b('0x4d')]=function(_0x2ece94,_0x54abeb){var _0x15ed57={'role':'agent'};_0x15ed57[_0x2ece94]=this[_0x655b('0xd')][_0x655b('0x35')];var _0x50be23=_0x2ece94!=_0x655b('0x4e')?util[_0x655b('0x4f')](_0x655b('0x50'),_0x655b('0x51'),this[_0x655b('0xd')][_0x655b('0x35')]):undefined;this['rpc'][_0x655b('0x4d')](_0x15ed57,_0x50be23)[_0x655b('0x12')](function(_0x31d681){_0x54abeb(null,_[_0x655b('0x41')](_0x31d681)?![]:!![]);})[_0x655b('0x14')](function(_0x597af2){logger['error'](_0x597af2);_0x54abeb(null,![]);});};AGIVertices[_0x655b('0x10')]['shellCommand']=function(_0x2c3add,_0x2e2bc0){sh[_0x655b('0x52')](_[_0x655b('0x53')](_0x2c3add),function(_0x68cc5a,_0x4b533b){var _0x4494cf=_0x4b533b[_0x655b('0x54')](/(\r\n|\n|\r)/gm,'');_0x2e2bc0(null,_0x4494cf);});};AGIVertices[_0x655b('0x10')][_0x655b('0x55')]=function(_0x328f10,_0x59693b){scripts['googleCloudTTS'](_0x328f10[_0x655b('0x56')],_0x328f10[_0x655b('0x57')]||'text',_0x328f10[_0x655b('0x58')],_0x328f10[_0x655b('0x59')]||'en-US',_0x328f10[_0x655b('0x5a')]||_0x655b('0x5b'),_0x328f10[_0x655b('0x5c')]||'MP3')[_0x655b('0x12')](function(_0x11a824){_0x59693b(null,_0x11a824);})[_0x655b('0x14')](function(_0x3df88c){_0x59693b(_0x3df88c);});};AGIVertices['prototype'][_0x655b('0x5d')]=function(_0x6e744a,_0x1a89e7){scripts[_0x655b('0x5d')](_0x6e744a[_0x655b('0x58')],_0x6e744a[_0x655b('0x5e')]||'en',0x1)['then'](function(_0x12cc6e){_0x1a89e7(null,_0x12cc6e);})[_0x655b('0x14')](function(_0x2005d0){_0x1a89e7(_0x2005d0);});};AGIVertices[_0x655b('0x10')][_0x655b('0x5f')]=function(_0x95fe0c,_0x12fcb0){var _0x2ed58d={'uri':_0x95fe0c['url'],'method':_0x95fe0c[_0x655b('0x60')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x95fe0c[_0x655b('0x61')])===_0x655b('0x62')&&parseInt(_0x95fe0c[_0x655b('0x61')])>=0x1?parseInt(_0x95fe0c[_0x655b('0x61')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x655b('0x63'),_0x655b('0x64')],_0x2ed58d[_0x655b('0x60')][_0x655b('0x65')]())){try{_0x2ed58d[_0x655b('0x66')]=_0x95fe0c['rawBody']?JSON['parse'](_0x95fe0c['rawBody']):{};}catch(_0x5edcae){logger[_0x655b('0x28')](_0x655b('0x67'),_0x5edcae);}}try{_0x2ed58d[_0x655b('0x68')]=_0x95fe0c[_0x655b('0x9')]?JSON['parse'](_0x95fe0c[_0x655b('0x9')]):{};}catch(_0x4cef96){logger[_0x655b('0x28')](_0x655b('0x69'),_0x4cef96);}if(_0x95fe0c['computedVariables']){try{var _0x1d38a=require(_0x95fe0c[_0x655b('0x6a')])['sync'](this,_0x2ed58d);_0x2ed58d[_0x655b('0x6b')]=Mustache[_0x655b('0x6c')](_0x95fe0c[_0x655b('0x6d')],_0x1d38a,{},['$$','$$']);if(_0x2ed58d[_0x655b('0x68')]){_0x2ed58d[_0x655b('0x68')]=JSON['parse'](Mustache[_0x655b('0x6c')](JSON[_0x655b('0x6e')](_0x2ed58d[_0x655b('0x68')]),_0x1d38a,{},['$$','$$']));}if(_0x2ed58d[_0x655b('0x66')]){_0x2ed58d['body']=JSON[_0x655b('0x6f')](Mustache[_0x655b('0x6c')](JSON[_0x655b('0x6e')](_0x2ed58d[_0x655b('0x66')]),_0x1d38a,{},['$$','$$']));}}catch(_0x38d2ba){logger[_0x655b('0x28')](_0x655b('0x70'),_0x38d2ba);}}rp(_0x2ed58d)['then'](function(_0x22e221){var _0x5c3b2f={'statusCode':_0x22e221[_0x655b('0x71')]||0xc8,'statusMessage':_0x22e221[_0x655b('0x72')]||'OK','headers':_0x22e221[_0x655b('0x68')]||{},'body':_0x22e221[_0x655b('0x66')]||{}};_0x12fcb0(null,_0x5c3b2f);})[_0x655b('0x14')](function(_0x1f0fe3){var _0x55f146={'statusCode':_0x1f0fe3[_0x655b('0x71')]||0x1f4,'statusMessage':_0x1f0fe3['message']||_0x655b('0x73'),'headers':_0x1f0fe3['options'][_0x655b('0x68')]||{},'body':_0x1f0fe3[_0x655b('0x74')][_0x655b('0x66')]||{}};_0x12fcb0(null,_0x55f146);});};AGIVertices['prototype'][_0x655b('0x75')]=function(_0x223f3c,_0x586059){scripts[_0x655b('0x75')](this[_0x655b('0xd')][_0x655b('0x32')],_0x223f3c[_0x655b('0x76')],_0x223f3c[_0x655b('0x58')],_0x223f3c['dialogflow_language']||'en')[_0x655b('0x12')](function(_0x49ee51){_0x586059(null,_0x49ee51);})[_0x655b('0x14')](function(_0x3c8cd9){_0x586059(_0x3c8cd9);});};AGIVertices['prototype'][_0x655b('0x77')]=function(_0x17ef7b,_0x967d34){scripts[_0x655b('0x77')](this[_0x655b('0xd')]['uniqueid'],_0x17ef7b[_0x655b('0x78')],_0x17ef7b[_0x655b('0x79')],_0x17ef7b[_0x655b('0x7a')],_0x17ef7b[_0x655b('0x58')],_0x17ef7b['dialogflowV2_language']||'en')['then'](function(_0x4025d0){_0x967d34(null,_0x4025d0);})[_0x655b('0x14')](function(_0x4ebec3){_0x967d34(_0x4ebec3);});};AGIVertices[_0x655b('0x10')][_0x655b('0x7b')]=function(_0xe6cd6f,_0x3e3e73){scripts['sestekNDA'](this[_0x655b('0xd')],_0xe6cd6f)['then'](function(_0x5aa7af){_0x3e3e73(null,_0x5aa7af);})[_0x655b('0x14')](function(_0x4d670d){_0x3e3e73(_0x4d670d);});};AGIVertices[_0x655b('0x10')][_0x655b('0x7c')]=function(_0xba5963,_0x1bc18e){scripts[_0x655b('0x7c')](_0xba5963[_0x655b('0x76')],_0xba5963[_0x655b('0x58')],_0xba5963[_0x655b('0x7d')]||_0x655b('0x7e'),_0xba5963[_0x655b('0x7f')])[_0x655b('0x12')](function(_0x2e1b2d){_0x1bc18e(null,_0x2e1b2d);})[_0x655b('0x14')](function(_0x471e35){_0x1bc18e(_0x471e35);});};AGIVertices[_0x655b('0x10')][_0x655b('0x80')]=function(_0x15ff86,_0x10def3,_0x599ffb){scripts[_0x655b('0x80')](_0x10def3,_0x15ff86[_0x655b('0x76')],_0x15ff86[_0x655b('0x81')]||_0x655b('0x7e'),this[_0x655b('0x82')](_0x15ff86['model'])?_0x15ff86[_0x655b('0x83')]:undefined)['then'](function(_0x1ccf4){_0x599ffb(null,_0x1ccf4);})[_0x655b('0x14')](function(_0x47e886){_0x599ffb(_0x47e886);});};AGIVertices[_0x655b('0x10')][_0x655b('0x84')]=function(_0x4d73cf,_0x4ec987){scripts[_0x655b('0x84')](_0x4d73cf[_0x655b('0x85')],_0x4d73cf[_0x655b('0x86')],_0x4d73cf[_0x655b('0x87')],_0x4d73cf[_0x655b('0x88')]||_0x655b('0x89'),_0x4d73cf['text'],_0x4d73cf['aws_text_type']||'text')[_0x655b('0x12')](function(_0x3c587b){_0x4ec987(null,_0x3c587b);})[_0x655b('0x14')](function(_0x4db0fb){_0x4ec987(_0x4db0fb);});};AGIVertices['prototype'][_0x655b('0x8a')]=function(_0x49edb2,_0x38c2a8){scripts[_0x655b('0x8a')](this[_0x655b('0xd')]['uniqueid'],_0x49edb2['aws_access_key_id'],_0x49edb2[_0x655b('0x86')],_0x49edb2['aws_lex_region'],_0x49edb2[_0x655b('0x58')],_0x49edb2[_0x655b('0x8b')])[_0x655b('0x12')](function(_0x1ce33f){_0x38c2a8(null,_0x1ce33f);})[_0x655b('0x14')](function(_0x309907){_0x38c2a8(_0x309907);});};AGIVertices[_0x655b('0x10')][_0x655b('0x8c')]=function(_0x4fa93f,_0x23a638,_0x13ba84){scripts[_0x655b('0x8c')](_0x23a638,_0x4fa93f[_0x655b('0x76')],_0x4fa93f['google_asr_language']||_0x655b('0x7e'))[_0x655b('0x12')](function(_0x10d1f1){_0x13ba84(null,_0x10d1f1);})[_0x655b('0x14')](function(_0x503a64){_0x13ba84(_0x503a64);});};AGIVertices['prototype']['tildeASR']=function(_0x4bb3ca,_0xa47878,_0x415eac){scripts['tildeASR'](_0xa47878,_0x4bb3ca['appid'],_0x4bb3ca[_0x655b('0x8d')],_0x4bb3ca[_0x655b('0x6b')])[_0x655b('0x12')](function(_0x1ad12f){_0x415eac(null,_0x1ad12f);})['catch'](function(_0x2f497a){_0x415eac(_0x2f497a);});};AGIVertices[_0x655b('0x10')][_0x655b('0x8e')]=function(_0x54fe6d){var _0x3ec1d5=_[_0x655b('0x8f')](verticesWithRetry,_0x54fe6d[_0x655b('0x34')])?_0x54fe6d:_[_0x655b('0x90')](_0x54fe6d);for(var _0x372675 in _0x3ec1d5){if(_0x3ec1d5[_0x655b('0x91')](_0x372675)){if(_0x3ec1d5[_0x372675]&&_[_0x655b('0x92')](_0x3ec1d5[_0x372675])){if(_[_0x655b('0x8f')](recursiveMapAttributes,_0x372675)){_0x3ec1d5[_0x372675]=this[_0x655b('0x93')](_0x3ec1d5[_0x372675]);}else{_0x3ec1d5[_0x372675]=this['replaceAllVariables'](_0x3ec1d5[_0x372675]);}}}}return _0x3ec1d5;};AGIVertices[_0x655b('0x10')][_0x655b('0x94')]=function(_0x2526f4){for(var _0x413cd7 in _0x2526f4){if(_0x2526f4['hasOwnProperty'](_0x413cd7)){if(_['isPlainObject'](_0x2526f4[_0x413cd7])){this[_0x655b('0x94')](_0x2526f4[_0x413cd7]);}else if(_[_0x655b('0x95')](_0x2526f4[_0x413cd7])){for(var _0x158993=0x0;_0x158993<_0x2526f4[_0x413cd7]['length'];_0x158993++){this['recursiveNodeIndex'](_0x2526f4[_0x413cd7][_0x158993]);}}else if(_[_0x655b('0x92')](_0x2526f4[_0x413cd7])){_0x2526f4[_0x413cd7]=this['replaceAllVariables'](_0x2526f4[_0x413cd7]);}}}};AGIVertices[_0x655b('0x10')][_0x655b('0x96')]=function(_0x1f3b6b,_0xb673ea){for(var _0x176221 in _0x1f3b6b){if(_0x1f3b6b['hasOwnProperty'](_0x176221)){if(_['isPlainObject'](_0x1f3b6b[_0x176221])){if(!_[_0x655b('0x40')](_0x1f3b6b[_0x176221])){this[_0x655b('0x96')](_0x1f3b6b[_0x176221],util[_0x655b('0x4f')](_0x655b('0x97'),_0xb673ea,_0x176221));}}else if(_[_0x655b('0x95')](_0x1f3b6b[_0x176221])){for(var _0x52cf0f=0x0;_0x52cf0f<_0x1f3b6b[_0x176221][_0x655b('0x98')];_0x52cf0f++){this[_0x655b('0x96')](_0x1f3b6b[_0x176221][_0x52cf0f],util[_0x655b('0x4f')]('%s.%s',_0xb673ea,_0x176221+'['+_0x52cf0f+']'));}}else{if(!_[_0x655b('0x41')](_0x1f3b6b[_0x176221])){this[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0x97'),_0xb673ea,_0x176221),_0x1f3b6b[_0x176221]);}}}}};AGIVertices[_0x655b('0x10')][_0x655b('0x93')]=function(_0x17f928){try{var _0x3d21a0=JSON['parse'](_0x17f928);this[_0x655b('0x94')](_0x3d21a0);return JSON['stringify'](_0x3d21a0);}catch(_0x3751c3){return this[_0x655b('0x9a')](_0x17f928);}};AGIVertices['prototype'][_0x655b('0x9a')]=function(_0x41d7cd){var _0x4daa65=_0x41d7cd[_0x655b('0x9b')]('{');for(var _0x4bd4c4=0x1;_0x4bd4c4<_0x4daa65[_0x655b('0x98')];_0x4bd4c4+=0x1){var _0x536242=_0x4daa65[_0x4bd4c4]['split']('}');if(_0x536242[_0x655b('0x98')]>0x1){_0x41d7cd=_0x41d7cd['replaceAll']('{'+_0x536242[0x0]+'}',this[_0x655b('0xd')][_0x655b('0x11')](_0x536242[0x0])[_0x655b('0x9c')]||_0x536242[0x0]);}}if(_0x4daa65[_0x655b('0x98')]===0x1){return _0x41d7cd[_0x655b('0x9d')]();}return this['replaceAllVariables'](_0x41d7cd);};AGIVertices['prototype'][_0x655b('0x9e')]=function(_0x578f19,_0x159b35){var _0xe6a7b6=this['channel'][_0x655b('0x11')](_0x578f19);if(_0xe6a7b6[_0x655b('0x9f')]===-0x1){return _0xe6a7b6;}logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xa0'),_0x159b35,_0xe6a7b6[_0x655b('0x9c')]));return this['channel'][_0x655b('0x99')](_0x159b35,_0xe6a7b6[_0x655b('0x9c')]);};AGIVertices[_0x655b('0x10')][_0x655b('0x82')]=function(_0x416499){return _0x416499&&_0x416499!=='0'&&_0x416499!=='-1'&&_0x416499!=='';};AGIVertices[_0x655b('0x10')][_0x655b('0xa1')]=function(_0x32113b){this[_0x655b('0x31')]['sync'](this,_0x32113b,'-');_0x32113b[_0x655b('0xa2')]=_0x32113b[_0x655b('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x655b('0xa3')]=function(_0x4ea803){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x4ea803[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x4ea803[_0x655b('0x58')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}var _0x54cf4b='\x22'+_0x4ea803[_0x655b('0x58')]+'\x22';if(this['isConfigured'](_0x4ea803[_0x655b('0x74')])){_0x54cf4b+=','+_0x4ea803[_0x655b('0x74')];}var _0x1bd85a=this[_0x655b('0xd')][_0x655b('0x52')](_0x655b('0xa6'),_0x54cf4b);if(_0x1bd85a[_0x655b('0x9f')]===-0x1){return _0x1bd85a;}return this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')](_0x655b('0xa7'),_0x54cf4b));};AGIVertices['prototype'][_0x655b('0xa8')]=function(_0x54a8e4){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xa9'),_0x54a8e4['label']));if(!this[_0x655b('0x82')](_0x54a8e4['grammar'])){return this[_0x655b('0xd')]['noop']('no\x20grammar\x20configured');}var _0x594372=_0x54a8e4[_0x655b('0xaa')];if(this[_0x655b('0x82')](_0x54a8e4[_0x655b('0x74')])){_0x594372+=','+_0x54a8e4[_0x655b('0x74')];}var _0x22fdef=this[_0x655b('0xd')][_0x655b('0x52')](_0x655b('0xab'),_0x594372);if(_0x22fdef[_0x655b('0x9f')]===-0x1){return _0x22fdef;}var _0xe3a863=this[_0x655b('0x9e')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0xe3a863[_0x655b('0x9f')]===-0x1){return _0xe3a863;}var _0x43e6b5=this[_0x655b('0x9e')](_0x655b('0xac'),'MRCP_RECOG_TRANSCRIPT');if(_0x43e6b5[_0x655b('0x9f')]===-0x1){return _0x43e6b5;}var _0x54e91f=this[_0x655b('0x9e')](_0x655b('0xad'),_0x655b('0xae'));if(_0x54e91f['result']===-0x1){return _0x54e91f;}return this['channel']['noop'](util['format'](_0x655b('0xaf'),_0x594372));};AGIVertices[_0x655b('0x10')][_0x655b('0xb0')]=function(_0x3ee490){logger['info'](util[_0x655b('0x4f')](_0x655b('0xb1'),_0x3ee490['label']));return this[_0x655b('0xd')]['agi']([_0x3ee490[_0x655b('0xb2')],_0x3ee490['args']]);};AGIVertices['prototype'][_0x655b('0xb3')]=function(_0x55c8da){logger[_0x655b('0x2c')](util['format'](_0x655b('0xb4'),_0x55c8da[_0x655b('0x33')]));if(this['isConfigured'](_0x55c8da[_0x655b('0x61')])){logger[_0x655b('0x2c')](util['format'](_0x655b('0xb5'),_0x55c8da[_0x655b('0x61')]));var _0x26b769=this['channel'][_0x655b('0xb6')](_0x55c8da[_0x655b('0x61')]);if(_0x26b769[_0x655b('0x9f')]===-0x1){return _0x26b769;}}return this[_0x655b('0xd')][_0x655b('0xb3')]();};AGIVertices['prototype'][_0x655b('0xb7')]=function(_0xd9e7f1){logger['info'](util[_0x655b('0x4f')](_0x655b('0xb8'),_0xd9e7f1['label']));if(!this[_0x655b('0x82')](_0xd9e7f1[_0x655b('0x45')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0xd9e7f1,_0x655b('0xb9'));}_0xd9e7f1[_0x655b('0x46')]=moment();if(this[_0x655b('0x82')](_0xd9e7f1[_0x655b('0xba')])){_0xd9e7f1[_0x655b('0x46')]=moment()[_0x655b('0xbb')](_0xd9e7f1[_0x655b('0xba')],_0x655b('0xbc'));}if(!this[_0x655b('0x82')](_0xd9e7f1[_0x655b('0x47')])){_0xd9e7f1[_0x655b('0x47')]=0x2;}this['createCmContact'][_0x655b('0xbd')](this,_0xd9e7f1);return this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0xd9e7f1[_0x655b('0x44')],_0xd9e7f1[_0x655b('0x45')],_0xd9e7f1[_0x655b('0x46')]));};AGIVertices[_0x655b('0x10')]['custom_app']=function(_0x4fa99d){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xbe'),_0x4fa99d['label']));var _0x1976ba=this[_0x655b('0xd')][_0x655b('0x52')](_0x4fa99d['application'],_0x4fa99d[_0x655b('0x74')]);if(_0x1976ba[_0x655b('0x9f')]===-0x1){return _0x1976ba;}return this[_0x655b('0xd')][_0x655b('0xa4')](util['format'](_0x655b('0xbf'),_0x4fa99d['application'],_0x4fa99d[_0x655b('0x74')]));};AGIVertices[_0x655b('0x10')]['lumenvoxtts']=function(_0x33dbde){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xc0'),_0x33dbde[_0x655b('0x33')]));if(!this['isConfigured'](_0x33dbde[_0x655b('0x58')])){return this['channel'][_0x655b('0xa4')]('no\x20text\x20configured');}var _0xc0311c='\x22'+_0x33dbde[_0x655b('0x58')]+'\x22';if(this[_0x655b('0x82')](_0x33dbde[_0x655b('0x74')])){_0xc0311c+=','+_0x33dbde[_0x655b('0x74')];}var _0x51f4c6=this[_0x655b('0xd')]['exec'](_0x655b('0xa6'),_0xc0311c);if(_0x51f4c6[_0x655b('0x9f')]===-0x1){return _0x51f4c6;}return this[_0x655b('0xd')]['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0xc0311c));};AGIVertices[_0x655b('0x10')]['sestektts']=function(_0x3ece7e){logger['info'](util[_0x655b('0x4f')](_0x655b('0xc1'),_0x3ece7e[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x3ece7e['text'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}var _0x143869='\x22'+_0x3ece7e[_0x655b('0x58')]+'\x22';if(this[_0x655b('0x82')](_0x3ece7e[_0x655b('0x74')])){_0x143869+=','+_0x3ece7e[_0x655b('0x74')];}var _0x2077b4=this[_0x655b('0xd')][_0x655b('0x52')](_0x655b('0xa6'),_0x143869);if(_0x2077b4['result']===-0x1){return _0x2077b4;}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xa7'),_0x143869));};AGIVertices[_0x655b('0x10')]['lumenvoxasr']=function(_0x54ef6a){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xc2'),_0x54ef6a[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x54ef6a['grammar'])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20grammar\x20configured');}var _0x1c02b3=_0x54ef6a[_0x655b('0xaa')];if(this['isConfigured'](_0x54ef6a['options'])){_0x1c02b3+=','+_0x54ef6a[_0x655b('0x74')];}var _0x5d16e2=this['channel'][_0x655b('0x52')](_0x655b('0xab'),_0x1c02b3);if(_0x5d16e2[_0x655b('0x9f')]===-0x1){return _0x5d16e2;}var _0x852bcc=this['getAndSetVariable'](_0x655b('0xc3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x852bcc[_0x655b('0x9f')]===-0x1){return _0x852bcc;}var _0x343b03=this[_0x655b('0x9e')](_0x655b('0xac'),_0x655b('0xc4'));if(_0x343b03[_0x655b('0x9f')]===-0x1){return _0x343b03;}var _0x3d68e3=this[_0x655b('0x9e')]('RECOG_INSTANCE()',_0x655b('0xc5'));if(_0x3d68e3[_0x655b('0x9f')]===-0x1){return _0x3d68e3;}return this['channel']['noop'](util[_0x655b('0x4f')](_0x655b('0xaf'),_0x1c02b3));};AGIVertices[_0x655b('0x10')]['sestekasr']=function(_0x111793){logger['info'](util[_0x655b('0x4f')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x111793['label']));if(!this[_0x655b('0x82')](_0x111793['grammar'])){return this['channel'][_0x655b('0xa4')](_0x655b('0xc6'));}var _0x526208=_0x111793['grammar'];if(this['isConfigured'](_0x111793[_0x655b('0x74')])){_0x526208+=','+_0x111793[_0x655b('0x74')];}var _0x292231=this['channel']['exec'](_0x655b('0xab'),_0x526208);if(_0x292231[_0x655b('0x9f')]===-0x1){return _0x292231;}var _0x20b718=this['getAndSetVariable'](_0x655b('0xc3'),_0x655b('0xc7'));if(_0x20b718[_0x655b('0x9f')]===-0x1){return _0x20b718;}var _0x20c53a=this['getAndSetVariable']('RECOG_INPUT()',_0x655b('0xc8'));if(_0x20c53a['result']===-0x1){return _0x20c53a;}var _0xacc151=this[_0x655b('0x9e')](_0x655b('0xad'),'SESTEK_ASR_INSTANCE');if(_0xacc151[_0x655b('0x9f')]===-0x1){return _0xacc151;}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xaf'),_0x526208));};AGIVertices['prototype'][_0x655b('0xc9')]=function(_0x34c890){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xca'),_0x34c890['label']));if(!this[_0x655b('0x82')](_0x34c890[_0x655b('0xcb')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x34c890,'no\x20database\x20selected');}var _0x3f50ad=this['getSquareOdbc'][_0x655b('0xbd')](this,_0x34c890['odbc_id']);if(!_0x3f50ad){return this[_0x655b('0xd')][_0x655b('0x28')](_0x34c890,'no\x20odbc\x20database\x20found');}if(!this[_0x655b('0x82')](_0x34c890['query'])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x34c890,'no\x20query\x20configured');}var _0x46b17d=_0x34c890[_0x655b('0x2b')][_0x655b('0x54')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x655b('0xa4')](util['format'](_0x655b('0xcc'),_0x46b17d));var _0x27ef10=this[_0x655b('0x26')]['sync'](this,_0x3f50ad,_0x46b17d);this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x34c890,_0x46b17d);if(!this[_0x655b('0x82')](_0x34c890['variable_id'])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x1aa64f=this[_0x655b('0x11')][_0x655b('0xbd')](this,_0x34c890[_0x655b('0xcd')]);if(!_0x1aa64f){return this[_0x655b('0xd')][_0x655b('0x28')](_0x34c890,_0x655b('0xce'));}var _0x8fcd8c=this;_0x27ef10['forEach'](function(_0x467c92,_0x202711){Object[_0x655b('0xcf')](_0x467c92)['forEach'](function(_0xd26bad){_0x8fcd8c[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0xd0'),_0x1aa64f,_0x202711,_0xd26bad),_0x467c92[_0xd26bad]);});});this[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0xd1'),_0x1aa64f),_0x27ef10['length']);return this[_0x655b('0xd')]['noop'](util['format'](_0x655b('0xd2'),_0x1aa64f));};AGIVertices[_0x655b('0x10')][_0x655b('0xd3')]=function(_0x2e0695){logger['debug'](util[_0x655b('0x4f')](_0x655b('0xd4'),_0x2e0695[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x2e0695[_0x655b('0xd5')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x2e0695,'no\x20user\x20selected');}var _0x16ea8e=this[_0x655b('0x19')]['sync'](this,_0x2e0695[_0x655b('0xd5')]);if(!_0x16ea8e){return this[_0x655b('0xd')][_0x655b('0x28')](_0x2e0695,'no\x20user\x20found');}var _0x3a0d43=this[_0x655b('0xd')][_0x655b('0x52')](_0x655b('0xd6'),[util['format'](_0x655b('0xd7'),_0x16ea8e),_0x2e0695[_0x655b('0x61')],_0x2e0695[_0x655b('0xd8')],_0x2e0695[_0x655b('0x6d')]]);if(_0x3a0d43[_0x655b('0x9f')]===-0x1){return _0x3a0d43;}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xd9'),'DIAL'));};AGIVertices[_0x655b('0x10')][_0x655b('0xda')]=function(_0x11d179){logger[_0x655b('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x11d179[_0x655b('0x33')]));if(!this['isConfigured'](_0x11d179['key'])){return this[_0x655b('0xd')]['noop'](_0x655b('0xdb'));}if(!this[_0x655b('0x82')](_0x11d179[_0x655b('0x58')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}this[_0x655b('0xd')][_0x655b('0xdc')]=!![];this[_0x655b('0x31')](_0x11d179);this[_0x655b('0x3e')](_0x11d179[_0x655b('0x58')],'in','','');this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xdd'),_0x11d179[_0x655b('0x58')]));var _0x4bd739=this[_0x655b('0x75')][_0x655b('0xbd')](this,_0x11d179);if(_0x4bd739){for(var _0x3bf1ca in _0x4bd739){if(_0x4bd739[_0x655b('0x91')](_0x3bf1ca)){this[_0x655b('0xd')]['setVariable'](util[_0x655b('0x4f')](_0x655b('0xde'),_0x3bf1ca[_0x655b('0x65')]()),_0x4bd739[_0x3bf1ca]);}}this[_0x655b('0x3e')](_0x4bd739[_0x655b('0xdf')],_0x655b('0xe0'),_0x655b('0xda'),'');return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xe1'),_0x4bd739[_0x655b('0xdf')]));}return this[_0x655b('0xd')][_0x655b('0x28')](_0x11d179,_0x655b('0xe2'));};AGIVertices['prototype'][_0x655b('0xe3')]=function(_0x60cd16){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0xe4'),_0x60cd16['label']));if(!this[_0x655b('0x82')](_0x60cd16[_0x655b('0x78')])){return this['channel'][_0x655b('0xa4')]('no\x20project_id\x20configured');}if(!this[_0x655b('0x82')](_0x60cd16[_0x655b('0x79')])){return this[_0x655b('0xd')]['noop'](_0x655b('0xe5'));}if(!this[_0x655b('0x82')](_0x60cd16['private_key'])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x60cd16['dialogflowV2_language'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xe6'));}if(!this[_0x655b('0x82')](_0x60cd16[_0x655b('0x58')])){return this[_0x655b('0xd')]['noop'](_0x655b('0xa5'));}this[_0x655b('0xd')]['bot']=!![];this[_0x655b('0x31')](_0x60cd16);this[_0x655b('0x3e')](_0x60cd16['text'],'in','','');this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xe7'),_0x60cd16['text']));var _0x4fa1e=this[_0x655b('0x77')][_0x655b('0xbd')](this,_0x60cd16);if(_0x4fa1e){for(var _0x1cf996 in _0x4fa1e){if(_0x4fa1e[_0x655b('0x91')](_0x1cf996)){if(_0x1cf996!==_0x655b('0xe8')){this[_0x655b('0xd')][_0x655b('0x99')](util['format']('DIALOGFLOW_%s',_0x1cf996['toUpperCase']()),_0x4fa1e[_0x1cf996]);}}}this[_0x655b('0x3e')](_0x4fa1e[_0x655b('0xdf')],_0x655b('0xe0'),_0x655b('0xe3'),_0x4fa1e[_0x655b('0xe8')]);return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xe9'),_0x4fa1e[_0x655b('0xdf')]));}return this[_0x655b('0xd')]['error'](_0x60cd16,_0x655b('0xea'));};AGIVertices['prototype']['sesteknda']=function(_0x21a2e4){logger[_0x655b('0x2c')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x21a2e4[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x21a2e4['ndauth_url'])){return this[_0x655b('0xd')]['noop'](_0x655b('0xeb'));}if(!this[_0x655b('0x82')](_0x21a2e4[_0x655b('0xec')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xed'));}if(!this[_0x655b('0x82')](_0x21a2e4[_0x655b('0xee')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xef'));}if(!this[_0x655b('0x82')](_0x21a2e4[_0x655b('0xf0')])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20text\x20configured');}this[_0x655b('0xd')][_0x655b('0xdc')]=!![];this[_0x655b('0x31')](_0x21a2e4);this[_0x655b('0x3e')](_0x21a2e4[_0x655b('0x58')],'in','','');this['channel'][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xf1'),_0x21a2e4[_0x655b('0x58')]));var _0x1742a9=this[_0x655b('0x7b')]['sync'](this,_0x21a2e4);if(_0x1742a9){for(var _0x1eae72 in _0x1742a9){if(_0x1742a9[_0x655b('0x91')](_0x1eae72)){this[_0x655b('0xd')][_0x655b('0x99')](util['format'](_0x655b('0xf2'),_0x1eae72['toUpperCase']()),_0x1742a9[_0x1eae72]);}}this[_0x655b('0x3e')](_0x1742a9[_0x655b('0xdf')],_0x655b('0xe0'),'sesteknda','');if(_0x1742a9[_0x655b('0xf3')]){this[_0x655b('0xd')][_0x655b('0xa4')](util['format'](_0x655b('0xf4'),_0x1742a9[_0x655b('0xf3')]));var _0x40b20c=this[_0x655b('0xd')][_0x655b('0xf5')](_0x1742a9[_0x655b('0xf3')]);try{fs[_0x655b('0xf6')](_0x1742a9[_0x655b('0xf3')]+_0x655b('0xf7'));}catch(_0x1d6c25){logger[_0x655b('0x28')](_0x1d6c25);}return _0x40b20c;}else{return this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')](_0x655b('0xf8'),_0x1742a9[_0x655b('0xdf')]));}}return this['channel']['error'](_0x21a2e4,_0x655b('0xf9'));};AGIVertices[_0x655b('0x10')][_0x655b('0xfa')]=function(_0x4b9fd7){logger[_0x655b('0x2c')](util['format'](_0x655b('0xfb'),_0x4b9fd7[_0x655b('0x33')]));return this['channel'][_0x655b('0xa4')](_0x655b('0xfa'));};AGIVertices[_0x655b('0x10')][_0x655b('0xfc')]=function(_0xd09a17){logger[_0x655b('0x2c')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xd09a17[_0x655b('0x33')]));var _0x40e3d5='';if(_0xd09a17[_0x655b('0xfd')]){if(!this[_0x655b('0x82')](_0xd09a17[_0x655b('0xfd')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0xd09a17,_0x655b('0xfe'));}else{var _0x4dce14=parseInt(_0xd09a17[_0x655b('0xfd')],0xa);if(isNaN(_0x4dce14)){_0x40e3d5=_0xd09a17['trunk_id'];}else{_0x40e3d5=this[_0x655b('0x1b')][_0x655b('0xbd')](this,_0xd09a17['trunk_id']);if(!_0x40e3d5){return this[_0x655b('0xd')]['error'](_0xd09a17,_0x655b('0xff'));}}}}else if(_0xd09a17[_0x655b('0x100')]){_0x40e3d5=_0xd09a17[_0x655b('0x100')];}else{return this[_0x655b('0xd')][_0x655b('0x28')](_0xd09a17,_0x655b('0xfe'));}var _0x26455a=this[_0x655b('0xd')][_0x655b('0x52')]('DIAL',[util['format'](_0x655b('0x101'),_0x40e3d5,_0xd09a17[_0x655b('0x44')]),_0xd09a17[_0x655b('0x61')],_0xd09a17[_0x655b('0xd8')],_0xd09a17['url']]);if(_0x26455a[_0x655b('0x9f')]===-0x1){return _0x26455a;}return this['channel'][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xd9'),_0x655b('0xd6')));};AGIVertices['prototype'][_0x655b('0x102')]=function(_0x1c99ac){logger['info'](util[_0x655b('0x4f')](_0x655b('0x103'),_0x1c99ac['label']));return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x102'));};AGIVertices['prototype']['getdigits']=function(_0x3b4987){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x104'),_0x3b4987[_0x655b('0x33')]));if(_0x3b4987[_0x655b('0xa2')]===0x0){return this['maxRetry'](_0x3b4987);}_0x3b4987[_0x655b('0xa2')]-=0x1;if(!this[_0x655b('0x82')](_0x3b4987[_0x655b('0x105')])){return this['channel'][_0x655b('0x28')](_0x3b4987,_0x655b('0x106'));}var _0x3e7ef7=this['getSound'][_0x655b('0xbd')](this,_0x3b4987[_0x655b('0x105')]);if(!_0x3e7ef7){return this[_0x655b('0xd')][_0x655b('0x28')](_0x3b4987,_0x655b('0x107'));}if(!this[_0x655b('0x82')](_0x3b4987[_0x655b('0xcd')])){return this['channel'][_0x655b('0x28')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x167b07=this['channel']['getData'](_0x3e7ef7,_0x3b4987[_0x655b('0x108')],_0x3b4987[_0x655b('0x109')]);var _0x129a08=_0x167b07[_0x655b('0x9f')]?_0x167b07['result'][_0x655b('0x9d')]():'';logger[_0x655b('0x2c')]('test',JSON[_0x655b('0x6e')](_0x167b07));if(_0x167b07[_0x655b('0x9f')]===-0x1){this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x3b4987,_0x129a08);return _0x167b07;}else if(_0x167b07[_0x655b('0x9c')]===_0x655b('0x61')){_0x167b07['result']=_0x129a08['length']>=parseInt(_0x3b4987[_0x655b('0x10a')])?'x':'i';}else{_0x167b07[_0x655b('0x9f')]=_0x129a08['length']>=parseInt(_0x3b4987[_0x655b('0x10a')])&&_0x129a08['length']<=parseInt(_0x3b4987['maxdigit'])?'x':'i';}var _0x4d6a57=this[_0x655b('0x11')][_0x655b('0xbd')](this,_0x3b4987[_0x655b('0xcd')]);if(!_0x4d6a57){return this[_0x655b('0xd')]['error'](_0x3b4987,_0x655b('0xce'));}this[_0x655b('0xd')][_0x655b('0x99')](_0x4d6a57,_0x129a08);if(this['isConfigured'](_0x3b4987[_0x655b('0x10b')])){var _0x1b91ea=parseInt(_0x3b4987[_0x655b('0x10b')],0xa);var _0xa974d9=rs[_0x655b('0x10c')]({'charset':'*','length':_0x1b91ea});var _0x4d4262=_0x129a08['length'];if(_0x4d4262>0x0){if(_0x4d4262>_0x1b91ea){this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x3b4987,_0x3b4987['hiddendigitspos']===_0x655b('0x10d')?_0xa974d9+_0x129a08['substr'](_0x1b91ea):_0x129a08['substr'](0x0,_0x4d4262-_0x1b91ea)+_0xa974d9);}else{this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x3b4987,rs['generate']({'charset':'*','length':_0x4d4262}));}}else{this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x3b4987,'');}}else{this[_0x655b('0x31')]['sync'](this,_0x3b4987,_0x129a08);}return _0x167b07;};AGIVertices[_0x655b('0x10')][_0x655b('0x10e')]=function(_0xcb2b70){logger['info'](util[_0x655b('0x4f')](_0x655b('0x10f'),_0xcb2b70['label']));return this[_0x655b('0xc')](_0xcb2b70);};AGIVertices[_0x655b('0x10')][_0x655b('0x110')]=function(_0x3a2226){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x111'),_0x3a2226[_0x655b('0x33')]));this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x3a2226,_0x3a2226[_0x655b('0x112')]);return this['channel']['noop'](util[_0x655b('0x4f')](_0x655b('0x113'),_0x3a2226['goalname']));};AGIVertices[_0x655b('0x10')][_0x655b('0x114')]=function(_0x46a783){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x115'),_0x46a783['label']));if(!this['isConfigured'](_0x46a783[_0x655b('0x85')])||!this[_0x655b('0x82')](_0x46a783[_0x655b('0x86')])){return this[_0x655b('0xd')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x655b('0x82')](_0x46a783['text'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')]('Trying\x20aws\x20Polly\x20%s',_0x46a783[_0x655b('0x58')]));var _0x89376=this[_0x655b('0x84')][_0x655b('0xbd')](this,_0x46a783);if(_0x89376){this[_0x655b('0xd')]['noop'](util['format'](_0x655b('0x116'),_0x89376));var _0x29775f=this['channel']['streamFile'](_0x89376);try{fs['unlink'](_0x89376+_0x655b('0xf7'));}catch(_0x46bfaf){logger['error'](_0x46bfaf);}return _0x29775f;}return this[_0x655b('0xd')]['error'](_0x46a783,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x655b('0x10')]['awslex']=function(_0x47122c){logger['info'](util[_0x655b('0x4f')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x47122c[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x47122c[_0x655b('0x85')])||!this['isConfigured'](_0x47122c[_0x655b('0x86')])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x655b('0x82')](_0x47122c[_0x655b('0x8b')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x117'));}if(!this[_0x655b('0x82')](_0x47122c['text'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}this['channel']['bot']=!![];this[_0x655b('0x31')](_0x47122c);this[_0x655b('0x3e')](_0x47122c['text'],'in','','');this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')]('Trying\x20Amazon\x20Lex:\x20%s',_0x47122c[_0x655b('0x58')]));var _0x538a82=this[_0x655b('0x8a')][_0x655b('0xbd')](this,_0x47122c);if(_0x538a82){for(var _0x12717c in _0x538a82){if(_0x538a82['hasOwnProperty'](_0x12717c)&&_[_0x655b('0x92')](_0x538a82[_0x12717c])){this[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0x118'),_0x12717c[_0x655b('0x65')]()),_0x538a82[_0x12717c]);}}if(_[_0x655b('0x41')](_0x538a82[_0x655b('0x119')])){return this[_0x655b('0xd')][_0x655b('0xa4')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x655b('0x3e')](_0x538a82['message'],_0x655b('0xe0'),'amazonlex','');return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x11a'),_0x538a82[_0x655b('0x119')]));}}return this['channel'][_0x655b('0x28')](_0x47122c,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x655b('0x10')][_0x655b('0x11b')]=function(_0x5f4e94){logger[_0x655b('0x2c')](util['format'](_0x655b('0x11c'),_0x5f4e94[_0x655b('0x33')],_0x5f4e94['timeout']));if(!this[_0x655b('0x82')](_0x5f4e94[_0x655b('0x76')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xdb'));}var _0x25fe31='wav';var _0x20dc30=util[_0x655b('0x4f')](_0x655b('0x11d'),FILES_PATH,rs[_0x655b('0x10c')](0x4));var _0x4afc73=util[_0x655b('0x4f')](_0x655b('0x97'),_0x20dc30,_0x25fe31);var _0x3e7402=!![];if(_0x5f4e94[_0x655b('0x11e')]===_0x655b('0x11f')){_0x3e7402=![];}var _0x2fcd7=this[_0x655b('0xd')][_0x655b('0x120')](_0x20dc30,_0x25fe31,_0x5f4e94['intKey'],_0x5f4e94[_0x655b('0x61')],undefined,_0x3e7402);if(_0x2fcd7['result']!==-0x1){this[_0x655b('0xd')][_0x655b('0xa4')](util['format'](_0x655b('0x121'),_0x4afc73));var _0x9ff5ce=this[_0x655b('0x8c')]['sync'](this,_0x5f4e94,_0x4afc73);if(_0x9ff5ce){for(var _0x3c33a7 in _0x9ff5ce){if(_0x9ff5ce[_0x655b('0x91')](_0x3c33a7)){this[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0x122'),_0x3c33a7[_0x655b('0x65')]()),_0x9ff5ce[_0x3c33a7]);}}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x123'),JSON[_0x655b('0x6e')](_0x9ff5ce)));}}return _0x2fcd7;};AGIVertices[_0x655b('0x10')][_0x655b('0x124')]=function(_0x5b16d8){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x5b16d8[_0x655b('0x33')]));if(!this['isConfigured'](_0x5b16d8[_0x655b('0x125')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x126'));}if(!this[_0x655b('0x82')](_0x5b16d8[_0x655b('0x8d')])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20appsecret\x20configured');}var _0x5e0c66=_0x655b('0x127');var _0x186798=util[_0x655b('0x4f')](_0x655b('0x11d'),FILES_PATH,rs['generate'](0x4));var _0x30de8f=util[_0x655b('0x4f')](_0x655b('0x97'),_0x186798,_0x5e0c66);var _0x8069c2=!![];if(_0x5b16d8[_0x655b('0x11e')]==='NOBEEP'){_0x8069c2=![];}var _0x5262ae=this['channel'][_0x655b('0x120')](_0x186798,_0x5e0c66,_0x5b16d8['intKey'],_0x5b16d8[_0x655b('0x61')],undefined,_0x8069c2);if(_0x5262ae[_0x655b('0x9f')]!==-0x1){this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')]('tilde\x20%s\x20file\x20created',_0x30de8f));var _0x405d49=this[_0x655b('0x128')][_0x655b('0xbd')](this,_0x5b16d8,_0x30de8f);if(_0x405d49){for(var _0x2c0d46 in _0x405d49){if(_0x405d49['hasOwnProperty'](_0x2c0d46)){this[_0x655b('0xd')]['setVariable'](util[_0x655b('0x4f')](_0x655b('0x129'),_0x2c0d46[_0x655b('0x65')]()),_0x405d49[_0x2c0d46]);}}return this[_0x655b('0xd')][_0x655b('0xa4')](util['format'](_0x655b('0x12a'),JSON[_0x655b('0x6e')](_0x405d49)));}}return _0x5262ae;};AGIVertices[_0x655b('0x10')][_0x655b('0x12b')]=function(_0x5e2049){logger['info'](util[_0x655b('0x4f')](_0x655b('0x12c'),_0x5e2049[_0x655b('0x33')]));return this[_0x655b('0xd')][_0x655b('0x12d')](_0x5e2049[_0x655b('0x38')],_0x5e2049[_0x655b('0x39')],_0x5e2049[_0x655b('0x12e')]);};AGIVertices['prototype'][_0x655b('0x12f')]=function(_0x1a2081){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x130'),_0x1a2081['label']));if(!this[_0x655b('0x82')](_0x1a2081[_0x655b('0x131')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x1a2081,_0x655b('0x132'));}try{var _0xb0d54f=eval(_0x1a2081[_0x655b('0x131')])?'true':_0x655b('0x133');this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x134'),_0x1a2081[_0x655b('0x131')],_0xb0d54f));return{'code':0xc8,'result':_0xb0d54f};}catch(_0x23e4a3){return{'code':0xc8,'result':_0x655b('0x133')};}};AGIVertices[_0x655b('0x10')][_0x655b('0x135')]=function(_0xf80a2d){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x136'),_0xf80a2d['label']));if(!this[_0x655b('0x82')](_0xf80a2d[_0x655b('0x137')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0xf80a2d,'no\x20interval\x20configured');}var _0x2225af=this[_0x655b('0x21')][_0x655b('0xbd')](this,_0xf80a2d['interval_id']);if(!_0x2225af){return this['channel'][_0x655b('0x28')](_0xf80a2d,'no\x20intervals\x20found');}for(var _0x3c315f=0x0;_0x3c315f<_0x2225af[_0x655b('0x98')];_0x3c315f+=0x1){var _0xc3d8e0=this[_0x655b('0xd')]['getVariable'](util[_0x655b('0x4f')]('IFTIME(%s?true:false)',_0x2225af[_0x3c315f]));if(_0xc3d8e0['result']===-0x1){return _0xc3d8e0;}logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x138'),_0x2225af[_0x3c315f],_0xc3d8e0['extra']));if(_0xc3d8e0[_0x655b('0x9c')]===_0x655b('0x139')){logger[_0x655b('0x2c')](util['format'](_0x655b('0x138'),_0x2225af[_0x3c315f],'true'));this['channel']['noop'](util[_0x655b('0x4f')](_0x655b('0x138'),_0x2225af[_0x3c315f],_0x655b('0x139')));return{'code':0xc8,'result':_0x655b('0x139')};}else{logger[_0x655b('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x2225af[_0x3c315f],'false'));this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')]('IFTIME\x20%s\x20%s',_0x2225af[_0x3c315f],_0x655b('0x133')));}}return{'code':0xc8,'result':_0x655b('0x133')};};AGIVertices[_0x655b('0x10')][_0x655b('0x13a')]=function(_0x1991ba){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x13b'),_0x1991ba['label']));return this[_0x655b('0xd')][_0x655b('0x13a')]();};AGIVertices[_0x655b('0x10')][_0x655b('0x13c')]=function(_0x3a40ca){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x13d'),_0x3a40ca['label']));if(!this[_0x655b('0x82')](_0x3a40ca['key'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xdb'));}var _0x47c87f='wav';var _0x803ca1=util['format'](_0x655b('0x11d'),FILES_PATH,rs['generate'](0x4));var _0x4d54e6=util[_0x655b('0x4f')](_0x655b('0x97'),_0x803ca1,_0x47c87f);var _0x3869b3=!![];if(_0x3a40ca[_0x655b('0x11e')]===_0x655b('0x11f')){_0x3869b3=![];}var _0x563036=this['channel'][_0x655b('0x120')](_0x803ca1,_0x47c87f,_0x3a40ca[_0x655b('0x13e')],_0x3a40ca[_0x655b('0x61')],undefined,_0x3869b3);if(_0x563036[_0x655b('0x9f')]!==-0x1){this[_0x655b('0xd')]['noop'](util['format'](_0x655b('0x13f'),_0x4d54e6));var _0x19ff63=this[_0x655b('0x80')][_0x655b('0xbd')](this,_0x3a40ca,_0x4d54e6);if(_0x19ff63){for(var _0x1db4e5 in _0x19ff63){if(_0x19ff63[_0x655b('0x91')](_0x1db4e5)){this[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0x140'),_0x1db4e5[_0x655b('0x65')]()),_0x19ff63[_0x1db4e5]);}}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x141'),JSON['stringify'](_0x19ff63)));}}return _0x563036;};AGIVertices[_0x655b('0x10')]['ispeechtts']=function(_0x58e6dd){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x58e6dd[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x58e6dd[_0x655b('0x76')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xdb'));}if(!this['isConfigured'](_0x58e6dd[_0x655b('0x58')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}this['channel'][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x142'),_0x58e6dd['text']));var _0x35c37f=this['ispeechTTS'][_0x655b('0xbd')](this,_0x58e6dd);if(_0x35c37f){this[_0x655b('0xd')][_0x655b('0xa4')](util['format']('ispeech\x20%s\x20file\x20created',_0x35c37f));var _0x3aa214=this[_0x655b('0xd')]['streamFile'](_0x35c37f,_0x58e6dd[_0x655b('0x13e')]);try{fs['unlink'](_0x35c37f+_0x655b('0xf7'));}catch(_0x5b5ec2){logger[_0x655b('0x28')](_0x5b5ec2);}return _0x3aa214;}return this[_0x655b('0xd')]['error'](_0x58e6dd,_0x655b('0x143'));};AGIVertices[_0x655b('0x10')][_0x655b('0x144')]=function(_0x5e9c75){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x145'),_0x5e9c75[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x5e9c75[_0x655b('0x146')])){return this['channel'][_0x655b('0x28')](_0x5e9c75,_0x655b('0x147'));}logger['info'](util[_0x655b('0x4f')](_0x655b('0x148'),this[_0x655b('0xd')][_0x655b('0x35')],_0x5e9c75[_0x655b('0x146')]));var _0x1459bf=this[_0x655b('0x4d')]['sync'](this,_0x5e9c75[_0x655b('0x146')]);if(_0x1459bf){logger['info'](util[_0x655b('0x4f')](_0x655b('0x149'),this['channel']['callerid'],_0x5e9c75[_0x655b('0x146')]));this['channel'][_0x655b('0xa4')](util['format'](_0x655b('0x149'),this['channel'][_0x655b('0x35')],_0x5e9c75[_0x655b('0x146')]));return{'code':0xc8,'result':_0x655b('0x14a')};}else{logger[_0x655b('0x2c')](util['format'](_0x655b('0x14b'),this['channel'][_0x655b('0x35')],_0x5e9c75['findBy']));this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x14b'),this[_0x655b('0xd')]['callerid'],_0x5e9c75['findBy']));return{'code':0xc8,'result':_0x655b('0x14c')};}};AGIVertices['prototype']['logout']=function(_0x193e77){logger[_0x655b('0x2c')](util['format']('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x193e77[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x193e77[_0x655b('0x146')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x193e77,_0x655b('0x147'));}logger['info'](util[_0x655b('0x4f')](_0x655b('0x148'),this[_0x655b('0xd')]['callerid'],_0x193e77[_0x655b('0x146')]));var _0x2e647a=this[_0x655b('0x4c')][_0x655b('0xbd')](this,_0x193e77[_0x655b('0x146')]);if(_0x2e647a){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x655b('0x35')],_0x193e77[_0x655b('0x146')]));this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')](_0x655b('0x149'),this[_0x655b('0xd')][_0x655b('0x35')],_0x193e77['findBy']));return{'code':0xc8,'result':_0x655b('0x14a')};}else{logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x655b('0xd')][_0x655b('0x35')],_0x193e77['findBy']));this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')](_0x655b('0x14b'),this[_0x655b('0xd')]['callerid'],_0x193e77[_0x655b('0x146')]));return{'code':0xc8,'result':_0x655b('0x14c')};}};AGIVertices['prototype'][_0x655b('0x14d')]=function(_0x4a0593){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x14e'),_0x4a0593['label']));if(!this[_0x655b('0x82')](_0x4a0593['operation'])){return this['channel'][_0x655b('0x28')](_0x4a0593,_0x655b('0x14f'));}this[_0x655b('0xd')][_0x655b('0xa4')](util['format'](_0x655b('0x150'),_0x4a0593[_0x655b('0x151')]));var _0x43fe20=eval(_0x4a0593[_0x655b('0x151')]);if(!this[_0x655b('0x82')](_0x4a0593[_0x655b('0xcd')])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x152'));}var _0x1cd203=this[_0x655b('0x11')][_0x655b('0xbd')](this,_0x4a0593['variable_id']);if(!_0x1cd203){return this[_0x655b('0xd')][_0x655b('0x28')](_0x4a0593,_0x655b('0xce'));}if(_[_0x655b('0x95')](_0x43fe20)){var _0x23f7e6=this;_0x43fe20[_0x655b('0x153')](function(_0x4537fa,_0x49259b){_0x23f7e6[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0x154'),_0x1cd203,_0x49259b),_0x4537fa);});return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x155'),_0x1cd203));}else{return this[_0x655b('0xd')]['setVariable'](_0x1cd203,_0x43fe20);}};AGIVertices[_0x655b('0x10')]['menu']=function(_0x4bb011){logger[_0x655b('0x2c')](util['format'](_0x655b('0x156'),_0x4bb011['label']));if(_0x4bb011[_0x655b('0xa2')]===0x0){return this[_0x655b('0xa1')](_0x4bb011);}_0x4bb011[_0x655b('0xa2')]-=0x1;if(!this[_0x655b('0x82')](_0x4bb011['file_id'])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x4bb011,'no\x20file\x20audio\x20selected');}var _0x22a022=this['getSound'][_0x655b('0xbd')](this,_0x4bb011['file_id']);if(!_0x22a022){return this['channel']['error'](_0x4bb011,_0x655b('0x107'));}var _0x21ff63=this[_0x655b('0xd')]['getData'](_0x22a022,_0x4bb011[_0x655b('0x108')],_0x4bb011['digit']);var _0x1b81d5=_0x21ff63[_0x655b('0x9f')];if(_0x21ff63[_0x655b('0x9f')]===-0x1){this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x4bb011,'-1');return _0x21ff63;}else if(_0x21ff63[_0x655b('0x9c')]===_0x655b('0x61')){_0x21ff63[_0x655b('0x9f')]=_0x21ff63[_0x655b('0x9f')][_0x655b('0x98')]>0x0?_0x21ff63['result']:'t';}else if(_['isEmpty'](_0x21ff63[_0x655b('0x9f')])){_0x21ff63[_0x655b('0x9f')]='#';_0x1b81d5='#';}if(!this[_0x655b('0x82')](_0x4bb011[_0x655b('0xcd')])){this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x152'));}else{var _0x2e5136=this[_0x655b('0x11')][_0x655b('0xbd')](this,_0x4bb011[_0x655b('0xcd')]);if(!_0x2e5136){return this['channel'][_0x655b('0x28')](_0x4bb011,_0x655b('0xce'));}this['channel'][_0x655b('0x99')](_0x2e5136,_0x1b81d5);}this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x4bb011,_0x1b81d5);return _0x21ff63;};AGIVertices['prototype']['noop']=function(_0x31d073){logger[_0x655b('0x2c')](util['format'](_0x655b('0x157'),_0x31d073[_0x655b('0x33')]));return this[_0x655b('0xd')][_0x655b('0xa4')](_0x31d073['output']||_0x31d073[_0x655b('0x33')]);};AGIVertices[_0x655b('0x10')][_0x655b('0x158')]=function(_0x2f5004){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2f5004[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x2f5004[_0x655b('0x146')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x2f5004,_0x655b('0x147'));}logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x655b('0xd')]['callerid'],_0x2f5004[_0x655b('0x146')]));var _0x3d109e=this['getPause'][_0x655b('0xbd')](this,_0x2f5004[_0x655b('0x159')]);var _0x2a8ee2=this['agentPause'][_0x655b('0xbd')](this,_0x2f5004[_0x655b('0x146')],_0x3d109e);if(_0x2a8ee2){logger[_0x655b('0x2c')](util['format'](_0x655b('0x149'),this[_0x655b('0xd')][_0x655b('0x35')],_0x2f5004['findBy']));this['channel']['noop'](util[_0x655b('0x4f')](_0x655b('0x149'),this[_0x655b('0xd')][_0x655b('0x35')],_0x2f5004[_0x655b('0x146')]));return{'code':0xc8,'result':_0x655b('0x14a')};}else{logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x14b'),this[_0x655b('0xd')][_0x655b('0x35')],_0x2f5004[_0x655b('0x146')]));this['channel']['noop'](util[_0x655b('0x4f')](_0x655b('0x149'),this[_0x655b('0xd')]['callerid'],_0x2f5004[_0x655b('0x146')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x655b('0x15a')]=function(_0x3e40cc){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3e40cc[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x3e40cc[_0x655b('0x105')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x3e40cc,_0x655b('0x106'));}var _0x2a60fe=this['getSound'][_0x655b('0xbd')](this,_0x3e40cc[_0x655b('0x105')]);if(!_0x2a60fe){return this[_0x655b('0xd')][_0x655b('0x28')](_0x3e40cc,'no\x20file\x20audio\x20found');}var _0x5bd155=this[_0x655b('0xd')][_0x655b('0x52')]('PLAYBACK',[_0x2a60fe,_0x3e40cc['opts']]);if(_0x5bd155['result']===-0x1){return _0x5bd155;}return this[_0x655b('0xd')]['noop'](util['format'](_0x655b('0xbf'),_0x655b('0x15b'),_0x2a60fe));};AGIVertices[_0x655b('0x10')][_0x655b('0x15c')]=function(_0x3a592f){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x15d'),_0x3a592f[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x3a592f[_0x655b('0x15e')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x3a592f,_0x655b('0x15f'));}var _0x395934='';var _0x1dd27b=parseInt(_0x3a592f[_0x655b('0x15e')],0xa);if(isNaN(_0x1dd27b)){_0x395934=_0x3a592f[_0x655b('0x15e')];}else{_0x395934=this[_0x655b('0x15')]['sync'](this,_0x3a592f['queue_id']);if(!_0x395934){return this['channel']['error'](_0x3a592f,_0x655b('0x160'));}}var _0x18c1c8='';if(this[_0x655b('0x82')](_0x3a592f[_0x655b('0x105')])){var _0x5967b3=this[_0x655b('0x1d')][_0x655b('0xbd')](this,_0x3a592f['file_id']);if(_0x5967b3){_0x18c1c8=_0x5967b3;}}this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x3a592f,_0x395934);if(_0x3a592f[_0x655b('0xd8')][_0x655b('0x161')]('x')<0x0){_0x3a592f[_0x655b('0xd8')]+='x';}if(_0x3a592f[_0x655b('0xd8')]['indexOf']('X')<0x0){_0x3a592f['opts']+='X';}this['channel'][_0x655b('0x99')](_0x655b('0x162'),_0x395934?_0x395934['toLowerCase']():'');var _0x14ef3f=this[_0x655b('0xd')][_0x655b('0x52')](_0x655b('0x163'),[_0x395934,_0x3a592f[_0x655b('0xd8')],_0x3a592f['url'],_0x18c1c8,_0x3a592f['timeout'],_0x3a592f[_0x655b('0xb0')],_0x3a592f[_0x655b('0x164')],_0x3a592f[_0x655b('0x165')],'',_0x3a592f[_0x655b('0x166')]]);if(_0x14ef3f[_0x655b('0x9f')]===-0x1){return _0x14ef3f;}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xbf'),_0x655b('0x163'),_0x395934));};AGIVertices[_0x655b('0x10')]['record']=function(_0x39dd07){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x167'),_0x39dd07['label']));var _0x3e5bc1=_0x39dd07[_0x655b('0x168')]||_0x655b('0x127');var _0x25e0f4=util[_0x655b('0x4f')](_0x655b('0x169'),this[_0x655b('0xd')][_0x655b('0x32')],rs[_0x655b('0x10c')](0x5));var _0x36b2a8=util['format'](_0x655b('0x16a'),FILES_PATH,_0x25e0f4,_0x3e5bc1);var _0x4acb73=util[_0x655b('0x4f')](_0x655b('0x11d'),FILES_PATH,_0x25e0f4);this[_0x655b('0x36')][_0x655b('0xbd')](this,_0x39dd07,_0x25e0f4,_0x36b2a8);this['channel']['setVariable'](_0x655b('0x16b'),_0x25e0f4);logger['info'](_0x655b('0x16c'),_0x4acb73,_0x3e5bc1,_0x39dd07['escape_digits'],_0x39dd07[_0x655b('0x61')]);return this[_0x655b('0xd')][_0x655b('0x120')](_0x4acb73,_0x3e5bc1,_0x39dd07[_0x655b('0x16d')],_0x39dd07[_0x655b('0x61')],undefined,!![]);};AGIVertices[_0x655b('0x10')][_0x655b('0x16e')]=function(_0x56d67d){logger[_0x655b('0x2c')](util['format'](_0x655b('0x16f'),_0x56d67d['label']));if(!this[_0x655b('0x82')](_0x56d67d['url'])){return this['channel'][_0x655b('0xa4')](_0x655b('0x170'));}var _0x1ea2fc=this[_0x655b('0x5f')][_0x655b('0xbd')](this,_0x56d67d);logger[_0x655b('0x2c')](util['format']('Response:',util[_0x655b('0x171')](_0x1ea2fc,{'showHidden':![],'depth':null})));if(!this[_0x655b('0x82')](_0x56d67d[_0x655b('0xcd')])){return this[_0x655b('0xd')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x286d46=this[_0x655b('0x11')]['sync'](this,_0x56d67d[_0x655b('0xcd')]);if(!_0x286d46){return this[_0x655b('0xd')]['error'](_0x56d67d,_0x655b('0xce'));}this[_0x655b('0xd')]['setVariable'](util[_0x655b('0x4f')](_0x655b('0x172'),_0x286d46),_0x1ea2fc[_0x655b('0x71')]?_0x1ea2fc[_0x655b('0x71')]:_0x655b('0x173'));this[_0x655b('0xd')][_0x655b('0x99')](util[_0x655b('0x4f')](_0x655b('0x174'),_0x286d46),_0x1ea2fc[_0x655b('0x72')]?_0x1ea2fc[_0x655b('0x72')]:'OK');if(_0x1ea2fc[_0x655b('0x66')]){try{this['saveRestApiResult'](_0x1ea2fc['body'],_0x286d46);}catch(_0x2ed25f){logger[_0x655b('0x28')](util[_0x655b('0x4f')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x286d46));}}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xd2'),_0x286d46));};AGIVertices[_0x655b('0x10')][_0x655b('0x175')]=function(_0x37dff2){logger[_0x655b('0x2c')](util['format'](_0x655b('0x176'),_0x37dff2[_0x655b('0x33')]));return this[_0x655b('0xd')][_0x655b('0x177')](_0x37dff2[_0x655b('0x178')]['replace'](/\s+/g,''),_0x37dff2[_0x655b('0x16d')]);};AGIVertices[_0x655b('0x10')][_0x655b('0x179')]=function(_0x2c8466){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2c8466[_0x655b('0x33')]));return this[_0x655b('0xd')]['sayNumber'](_0x2c8466[_0x655b('0x62')][_0x655b('0x54')](/\s+/g,''),_0x2c8466[_0x655b('0x16d')]);};AGIVertices['prototype']['sayphonetic']=function(_0x2f0bcd){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x2f0bcd[_0x655b('0x33')]));return this['channel'][_0x655b('0x17a')](_0x2f0bcd[_0x655b('0x58')],_0x2f0bcd['escape_digits']);};AGIVertices['prototype'][_0x655b('0x17b')]=function(_0x18e8b6){logger['info'](util[_0x655b('0x4f')](_0x655b('0x17c'),_0x18e8b6['label']));if(!this[_0x655b('0x82')](_0x18e8b6[_0x655b('0x17d')])){return this['channel'][_0x655b('0xa4')]('no\x20mail\x20account\x20configured');}var _0x3b37fe=this[_0x655b('0x1f')][_0x655b('0xbd')](this,_0x18e8b6[_0x655b('0x17d')]);if(!_0x3b37fe||!_0x3b37fe[_0x655b('0x17e')]){return this[_0x655b('0xd')]['error'](_0x18e8b6,_0x655b('0x17f'));}var _0x3b09bd={'from':util[_0x655b('0x4f')](_0x655b('0x180'),_0x3b37fe[_0x655b('0x13')],_0x3b37fe[_0x655b('0x181')]||_0x3b37fe[_0x655b('0x17e')]['user']),'to':_0x18e8b6['to']||'','cc':_0x18e8b6['cc']||'','bcc':_0x18e8b6[_0x655b('0x182')]||'','subject':_0x18e8b6[_0x655b('0x183')],'html':_0x18e8b6['text'],'text':_0x18e8b6[_0x655b('0x58')]};var _0x1655fd={'tls':{'rejectUnauthorized':![]}};if(_0x3b37fe[_0x655b('0x17e')][_0x655b('0x184')]){_0x1655fd[_0x655b('0x184')]=_0x3b37fe[_0x655b('0x17e')]['service'];}else{_0x1655fd['host']=_0x3b37fe[_0x655b('0x17e')][_0x655b('0x185')];_0x1655fd[_0x655b('0x186')]=_0x3b37fe[_0x655b('0x17e')][_0x655b('0x186')];_0x1655fd[_0x655b('0x187')]=_0x3b37fe[_0x655b('0x17e')]['secure'];}if(_0x3b37fe[_0x655b('0x17e')][_0x655b('0x188')]){_0x1655fd[_0x655b('0x189')]={'user':_0x3b37fe[_0x655b('0x17e')][_0x655b('0x18a')],'pass':_0x3b37fe['Smtp'][_0x655b('0x18b')]};}if(this[_0x655b('0x82')](_0x18e8b6[_0x655b('0x18c')])){}logger[_0x655b('0x18d')](_0x655b('0x18e'),JSON[_0x655b('0x6e')](_0x3b09bd));this[_0x655b('0x31')]['sync'](this,_0x18e8b6,_0x18e8b6[_0x655b('0x17d')]);this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x18f'),_0x3b37fe['name']));this[_0x655b('0x20')][_0x655b('0xbd')](this,_0x1655fd,_0x3b09bd);return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x190'));};AGIVertices[_0x655b('0x10')][_0x655b('0x191')]=function(_0x7123f8){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x7123f8[_0x655b('0x33')]));return this['channel'][_0x655b('0xa4')](_0x655b('0x192'));};AGIVertices[_0x655b('0x10')][_0x655b('0x193')]=function(_0x4f70a3){logger['info'](util[_0x655b('0x4f')](_0x655b('0x194'),_0x4f70a3[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x4f70a3[_0x655b('0x195')])){return this[_0x655b('0xd')]['noop'](_0x655b('0x196'));}var _0x2c0624=this[_0x655b('0x197')][_0x655b('0xbd')](this,_0x4f70a3[_0x655b('0x195')]);if(!_0x2c0624){return this[_0x655b('0xd')][_0x655b('0x28')](_0x4f70a3,_0x655b('0x198'));}var _0x1f74dd={'body':_0x4f70a3[_0x655b('0x199')],'phone':_0x4f70a3['to']||'','SmsAccountId':_0x2c0624['id']};logger[_0x655b('0x18d')](_0x655b('0x19a'),JSON[_0x655b('0x6e')](_0x1f74dd));this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x4f70a3,_0x4f70a3[_0x655b('0x195')]);this[_0x655b('0xd')][_0x655b('0xa4')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x2c0624[_0x655b('0x13')]));this[_0x655b('0x30')]['sync'](this,_0x1f74dd);return this['channel'][_0x655b('0xa4')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x655b('0x19b')]=function(_0x498b1c){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x498b1c[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x498b1c[_0x655b('0xcd')])){return this[_0x655b('0xd')][_0x655b('0x28')](_0x498b1c,'no\x20variable\x20selected');}var _0x777dee=this[_0x655b('0x11')]['sync'](this,_0x498b1c[_0x655b('0xcd')]);if(!_0x777dee){return this[_0x655b('0xd')][_0x655b('0x28')](_0x498b1c,_0x655b('0xce'));}return this[_0x655b('0xd')]['setVariable'](_0x777dee,_0x498b1c[_0x655b('0x19c')]);};AGIVertices['prototype']['start']=function(_0x1590dc){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x19d'),_0x1590dc[_0x655b('0x33')]));this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x19e'));if(_0x1590dc[_0x655b('0xb3')]===_0x655b('0x19f')){this[_0x655b('0xd')][_0x655b('0xa4')]('Answer');return this[_0x655b('0xd')][_0x655b('0xb3')]();}return this[_0x655b('0xd')]['noop'](_0x655b('0x1a0'));};AGIVertices['prototype']['subproject']=function(_0x3228bd){logger['info'](util[_0x655b('0x4f')](_0x655b('0x1a1'),_0x3228bd[_0x655b('0x33')]));if(!this['isConfigured'](_0x3228bd['project_id'])){return this['channel'][_0x655b('0x28')](_0x3228bd,'no\x20subproject\x20selected');}var _0x1050b8=this[_0x655b('0x16')][_0x655b('0xbd')](this,_0x3228bd[_0x655b('0x1a2')]);if(!this['isConfigured'](_0x1050b8)){return this[_0x655b('0xd')][_0x655b('0x28')](_0x3228bd,util[_0x655b('0x4f')](_0x655b('0x1a3'),_0x3228bd[_0x655b('0x1a2')]));}if(_0x1050b8===this['channel'][_0x655b('0x3c')]){return this[_0x655b('0xd')][_0x655b('0x28')](_0x3228bd,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this['createSquareDetailsReport'][_0x655b('0xbd')](this,_0x3228bd,_0x1050b8);var _0x2b6da2=this['channel'][_0x655b('0x52')](_0x655b('0x1a4'),util[_0x655b('0x4f')](_0x655b('0x1a5'),config[_0x655b('0xb0')][_0x655b('0x185')]||_0x655b('0x1a6'),_0x1050b8,this[_0x655b('0xd')][_0x655b('0x3c')]));if(_0x2b6da2[_0x655b('0x9f')]===-0x1){return _0x2b6da2;}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0xbf'),_0x655b('0x1a4'),_0x1050b8));};AGIVertices[_0x655b('0x10')][_0x655b('0x1a7')]=function(_0x201aca){logger['info'](util[_0x655b('0x4f')](_0x655b('0x1a8'),_0x201aca[_0x655b('0x33')]));var _0x359fb5=this[_0x655b('0x1a9')][_0x655b('0xbd')](this,_0x201aca[_0x655b('0xb2')]);this[_0x655b('0x31')][_0x655b('0xbd')](this,_0x201aca,_0x201aca[_0x655b('0xb2')]);if(this[_0x655b('0x82')](_0x201aca['variable_id'])){var _0x4fd7b3=this[_0x655b('0x11')]['sync'](this,_0x201aca[_0x655b('0xcd')]);if(_0x4fd7b3){this[_0x655b('0xd')]['setVariable'](_0x4fd7b3,_0x359fb5);return this['channel'][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x1aa'),_0x201aca[_0x655b('0xb2')],_0x4fd7b3));}}return this['channel']['noop'](util[_0x655b('0x4f')](_0x655b('0x1ab'),_0x201aca[_0x655b('0xb2')]));};AGIVertices['prototype'][_0x655b('0x1ac')]=function(_0x464bce){logger[_0x655b('0x2c')](util['format'](_0x655b('0x1ad'),_0x464bce[_0x655b('0x33')]));_0x464bce[_0x655b('0x58')]=_0x464bce['text'][_0x655b('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x655b('0x82')](_0x464bce['apiKey'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0x1ae'));}if(!this[_0x655b('0x82')](_0x464bce[_0x655b('0x58')])){return this[_0x655b('0xd')][_0x655b('0xa4')]('no\x20text\x20configured');}this[_0x655b('0xd')]['noop'](util[_0x655b('0x4f')](_0x655b('0x1af'),_0x464bce[_0x655b('0x58')]));var _0x345f89=this[_0x655b('0x55')]['sync'](this,_0x464bce);if(_0x345f89){this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')](_0x655b('0x1b0'),_0x345f89));var _0x53bba5=this[_0x655b('0xd')]['streamFile'](_0x345f89);try{fs[_0x655b('0xf6')](_0x345f89+_0x655b('0xf7'));}catch(_0x2245b6){logger[_0x655b('0x28')](_0x2245b6);}return _0x53bba5;}return this[_0x655b('0xd')][_0x655b('0x28')](_0x464bce,_0x655b('0x1b1'));};AGIVertices[_0x655b('0x10')][_0x655b('0x1b2')]=function(_0x1e93f8){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x1b3'),_0x1e93f8[_0x655b('0x33')]));_0x1e93f8[_0x655b('0x58')]=_0x1e93f8[_0x655b('0x58')][_0x655b('0x54')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x1e93f8['text'])){return this[_0x655b('0xd')][_0x655b('0xa4')](_0x655b('0xa5'));}this[_0x655b('0xd')][_0x655b('0xa4')](util['format'](_0x655b('0x1b4'),_0x1e93f8[_0x655b('0x58')]));var _0x38db20=this[_0x655b('0x5d')][_0x655b('0xbd')](this,_0x1e93f8);if(_0x38db20){this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')]('Google\x20TTS\x20%s\x20file\x20created',_0x38db20));var _0x1366ec=this[_0x655b('0xd')][_0x655b('0xf5')](_0x38db20);try{fs[_0x655b('0xf6')](_0x38db20+'.wav');}catch(_0x40392c){logger['error'](_0x40392c);}return _0x1366ec;}return this[_0x655b('0xd')][_0x655b('0x28')](_0x1e93f8,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x655b('0x1b5')]=function(_0xb48952){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x1b6'),_0xb48952['label']));if(!this[_0x655b('0x82')](_0xb48952[_0x655b('0x146')])){return this['channel'][_0x655b('0x28')](_0xb48952,_0x655b('0x147'));}logger[_0x655b('0x2c')](util['format'](_0x655b('0x148'),this[_0x655b('0xd')]['callerid'],_0xb48952[_0x655b('0x146')]));var _0xa1ddad=this['agentUnpause'][_0x655b('0xbd')](this,_0xb48952[_0x655b('0x146')]);if(_0xa1ddad){logger[_0x655b('0x2c')](util[_0x655b('0x4f')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x655b('0x35')],_0xb48952[_0x655b('0x146')]));this[_0x655b('0xd')]['noop'](util['format'](_0x655b('0x149'),this[_0x655b('0xd')]['callerid'],_0xb48952['findBy']));return{'code':0xc8,'result':_0x655b('0x14a')};}else{logger['info'](util['format'](_0x655b('0x14b'),this[_0x655b('0xd')]['callerid'],_0xb48952[_0x655b('0x146')]));this[_0x655b('0xd')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x655b('0xd')][_0x655b('0x35')],_0xb48952[_0x655b('0x146')]));return{'code':0xc8,'result':_0x655b('0x14c')};}};AGIVertices[_0x655b('0x10')][_0x655b('0x1b7')]=function(_0x174cf0){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x1b8'),_0x174cf0['label']));var _0x1da4c8=this[_0x655b('0xd')][_0x655b('0x52')](_0x655b('0x1b9'),[_0x174cf0[_0x655b('0x1ba')],_0x174cf0[_0x655b('0x74')]]);if(_0x1da4c8[_0x655b('0x9f')]===-0x1){return _0x1da4c8;}return this[_0x655b('0xd')][_0x655b('0xa4')](util[_0x655b('0x4f')]('Executed\x20command\x20%s\x20%s',_0x655b('0x1b9'),_0x174cf0['mailbox']));};AGIVertices[_0x655b('0x10')][_0x655b('0x1bb')]=function(_0x23685f){logger[_0x655b('0x2c')](util[_0x655b('0x4f')](_0x655b('0x1bc'),_0x23685f[_0x655b('0x33')]));if(!this[_0x655b('0x82')](_0x23685f[_0x655b('0xcd')])){return this[_0x655b('0xd')]['error'](_0x23685f,_0x655b('0x1bd'));}var _0x5f4030=this[_0x655b('0x11')][_0x655b('0xbd')](this,_0x23685f['variable_id']);if(!_0x5f4030){return this[_0x655b('0xd')]['error'](_0x23685f,_0x655b('0xce'));}var _0x1edf3d=this['channel'][_0x655b('0x11')](_0x5f4030);return{'code':0xc8,'result':_0x1edf3d[_0x655b('0x9c')]?_0x1edf3d['extra']:'-'};};String[_0x655b('0x10')][_0x655b('0x1be')]=function(_0x32afc0,_0x394a09){return this[_0x655b('0x9b')](_0x32afc0)['join'](_0x394a09);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 54fadfd..e87a777 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 _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 +var _0x84ab=['attended','destlinkedid','savePause','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','[%s][HANGUP:UNIQUEID]','isUndefined','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]'];(function(_0x1d6c69,_0xa8f013){var _0x99abce=function(_0x1acb01){while(--_0x1acb01){_0x1d6c69['push'](_0x1d6c69['shift']());}};_0x99abce(++_0xa8f013);}(_0x84ab,0x12f));var _0xb84a=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x84ab[_0x29db36];return _0x234e87;};'use strict';var util=require(_0xb84a('0x0'));var _=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var ami=require(_0xb84a('0x3'));var logger=require(_0xb84a('0x4'))('acw');var RpcUser=require(_0xb84a('0x5'));var RpcVoiceAgentReport=require(_0xb84a('0x6'));function Acw(_0x47b8e3){this[_0xb84a('0x7')]=_0x47b8e3[_0xb84a('0x7')];this[_0xb84a('0x8')]=_0x47b8e3['agents'];this['timers']=_0x47b8e3['timers'];this[_0xb84a('0x9')]={};ami['on']('agentconnect',this[_0xb84a('0xa')][_0xb84a('0xb')](this));ami['on']('hanguprequest',this[_0xb84a('0xc')]['bind'](this));ami['on'](_0xb84a('0xd'),this[_0xb84a('0xe')][_0xb84a('0xb')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer']['bind'](this));ami['on'](_0xb84a('0xf'),this[_0xb84a('0x10')][_0xb84a('0xb')](this));ami['on'](_0xb84a('0x11'),this[_0xb84a('0x12')]['bind'](this));ami['on'](_0xb84a('0x13'),this[_0xb84a('0x14')][_0xb84a('0xb')](this));}function getDiff(_0x3c161c){var _0x44b26b=moment()[_0xb84a('0x15')](0x0);var _0x12ccab=moment(_0x3c161c)[_0xb84a('0x15')](0x0);return _0x44b26b[_0xb84a('0x16')](_0x12ccab,_0xb84a('0x17'));}Acw[_0xb84a('0x18')][_0xb84a('0x19')]=function(_0x5716bd){try{var _0x11dd4d=this;var _0x4a691d=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1a')];var _0x1c7378=this[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x1b')];var _0x34d82f=this[_0xb84a('0x7')][_0x1c7378];var _0x3f7437=![];var _0x11d5a0=_0xb84a('0x1c');if(_0x34d82f[_0xb84a('0x1d')]){if(_0x34d82f[_0xb84a('0x1e')]['name']){_0x3f7437=!![];_0x11d5a0=_0x34d82f[_0xb84a('0x1e')][_0xb84a('0x1f')];}}ami['Action']({'action':_0xb84a('0x20'),'interface':_0x4a691d,'paused':!![],'reason':_0x11d5a0})[_0xb84a('0x21')](function(_0x42c788){if(_0x11dd4d[_0xb84a('0x8')][_0x4a691d]){return RpcUser['getAgent'](_0x11dd4d['agents'][_0x4a691d]['id'])[_0xb84a('0x21')](function(_0x19097d){if(_0x19097d&&!_0x19097d[_0xb84a('0x22')]){logger[_0xb84a('0x23')](_0xb84a('0x24'),_0x5716bd,_0x4a691d,_0x1c7378);var _0x3b8fb2=_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x25')]&&_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]?_0x11dd4d[_0xb84a('0x9')][_0x5716bd][_0xb84a('0x26')]:_0x5716bd;return RpcUser[_0xb84a('0x27')](_0x11dd4d[_0xb84a('0x8')][_0x4a691d],_0x11d5a0,_0x3b8fb2)[_0xb84a('0x21')](function(_0x3258a9){if(!_0x3f7437){_0x11dd4d[_0xb84a('0x28')][_0x4a691d]={};logger[_0xb84a('0x23')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d[_0xb84a('0x7')][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=setTimeout(_0x11dd4d[_0xb84a('0x2c')][_0xb84a('0xb')](_0x11dd4d,_0x4a691d),_0x11dd4d[_0xb84a('0x7')][_0x1c7378]['acwTimeout']*0x3e8);_0x11dd4d['timers'][_0x4a691d][_0xb84a('0x2d')]=moment()[_0xb84a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss');_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2f')]=_0x5716bd;_0x11dd4d['timers'][_0x4a691d]['queue']=_0x1c7378;_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x30')]=function(){var _0x49ba3d=getDiff(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2d')]);clearTimeout(_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]);_0x11dd4d[_0xb84a('0x28')][_0x4a691d][_0xb84a('0x2b')]=![];RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x49ba3d},_0x11dd4d[_0xb84a('0x28')][_0x4a691d]['uniqueid'],_0x4a691d)[_0xb84a('0x21')](function(_0x5b794f){logger['info'](_0xb84a('0x32'),_0x5716bd,_0x49ba3d,_0x5b794f);})[_0xb84a('0x33')](function(_0x47a5b6){logger['error'](_0xb84a('0x34'),_0x5716bd,_0x47a5b6);});delete _0x11dd4d[_0xb84a('0x28')][_0x4a691d];};}});}else{logger[_0xb84a('0x23')](_0xb84a('0x35'),_0x5716bd,_0x4a691d,_0x1c7378);}});}})[_0xb84a('0x33')](function(_0x1d7ef1){logger[_0xb84a('0x36')](_0xb84a('0x29'),_0x5716bd,_0x11dd4d['voiceQueues'][_0x1c7378][_0xb84a('0x2a')],_0x4a691d,_0x1c7378);})[_0xb84a('0x37')](function(){delete _0x11dd4d[_0xb84a('0x9')][_0x5716bd];});}catch(_0xf894a6){logger[_0xb84a('0x36')](_0xb84a('0x38'),_0xf894a6[_0xb84a('0x39')]);}};Acw['prototype'][_0xb84a('0x2c')]=function(_0x56d783){try{var _0x1a3115=this;if(_0x1a3115[_0xb84a('0x28')][_0x56d783]){_0x1a3115[_0xb84a('0x28')][_0x56d783]['timer']=![];var _0x4af084=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x2f')];var _0x4a3737=_0x1a3115[_0xb84a('0x28')][_0x56d783][_0xb84a('0x1b')];var _0x4cb5d4=_0x1a3115[_0xb84a('0x7')][_0x4a3737][_0xb84a('0x2a')];logger['info'](_0xb84a('0x3a'),_0x56d783);RpcUser[_0xb84a('0x3b')](this[_0xb84a('0x8')][_0x56d783]);RpcVoiceAgentReport[_0xb84a('0x31')]({'acwtime':_0x4cb5d4,'agentacw':!![]},_0x4af084,_0x56d783)['then'](function(_0x57a1a8){logger['info'](_0xb84a('0x32'),_0x4af084,_0x4cb5d4,_0x57a1a8);})[_0xb84a('0x33')](function(_0x43a071){logger[_0xb84a('0x36')]('[%s][UPDATE][ERRORS:%s]',_0x4af084,_0x43a071);});}else{logger[_0xb84a('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x56d783);if(_0x1a3115[_0xb84a('0x28')]){logger['info']('[ACW][TIMERS]',JSON['stringify'](_0x1a3115[_0xb84a('0x28')]));}}}catch(_0x22791f){logger[_0xb84a('0x36')](_0xb84a('0x3c'),_0x22791f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0xa')]=function(_0x3908c3){try{if(this[_0xb84a('0x7')][_0x3908c3['queue']]&&(this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this['voiceQueues'][_0x3908c3[_0xb84a('0x1b')]][_0xb84a('0x1d')])){if(this[_0xb84a('0x8')][_0x3908c3[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x3908c3[_0xb84a('0x2f')]]={'queue':_0x3908c3[_0xb84a('0x1b')],'interface':_0x3908c3[_0xb84a('0x1a')],'destlinkedid':_0x3908c3[_0xb84a('0x26')]};}}}catch(_0xcd1e3b){logger[_0xb84a('0x36')](_0xb84a('0x3e'),_0xcd1e3b[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x14')]=function(_0x4ad7d0){try{if(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]]&&(this[_0xb84a('0x7')][_0x4ad7d0[_0xb84a('0x1b')]][_0xb84a('0x3d')]||this[_0xb84a('0x7')][_0x4ad7d0['queue']][_0xb84a('0x1d')])){if(this['agents'][_0x4ad7d0[_0xb84a('0x1a')]]){this[_0xb84a('0x9')][_0x4ad7d0[_0xb84a('0x2f')]]={'queue':_0x4ad7d0[_0xb84a('0x1b')],'interface':_0x4ad7d0['interface']};}}}catch(_0x21ef72){logger[_0xb84a('0x36')](_0xb84a('0x3f'),_0x21ef72['message']);}};Acw['prototype'][_0xb84a('0xc')]=function(_0x10b0cc){try{if(this[_0xb84a('0x9')][_0x10b0cc['uniqueid']]&&_['isUndefined'](this['channels'][_0x10b0cc[_0xb84a('0x2f')]][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x40'),_0x10b0cc[_0xb84a('0x2f')]);this['startAcw'](_0x10b0cc['uniqueid']);}else if(this['channels'][_0x10b0cc['linkedid']]&&_[_0xb84a('0x41')](this[_0xb84a('0x9')][_0x10b0cc['linkedid']][_0xb84a('0x25')])){logger[_0xb84a('0x23')](_0xb84a('0x42'),_0x10b0cc[_0xb84a('0x43')]);this[_0xb84a('0x19')](_0x10b0cc[_0xb84a('0x43')]);}}catch(_0x5a07d2){logger['error'](_0xb84a('0x44'),_0x5a07d2['message']);}};Acw[_0xb84a('0x18')]['syncHangup']=function(_0x575908){try{if(this['channels'][_0x575908[_0xb84a('0x2f')]]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x2f')]][_0xb84a('0x25')]){logger[_0xb84a('0x23')](_0xb84a('0x45'),_0x575908[_0xb84a('0x2f')]);this[_0xb84a('0x19')](_0x575908['uniqueid']);}else if(this['channels'][_0x575908['linkedid']]&&this[_0xb84a('0x9')][_0x575908[_0xb84a('0x43')]]['attended']){logger[_0xb84a('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x575908['linkedid']);this['startAcw'](_0x575908[_0xb84a('0x43')]);}}catch(_0x172076){logger[_0xb84a('0x36')]('[ACW][syncHangup]\x20%s',_0x172076[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x10')]=function(_0x505994){try{if(!_[_0xb84a('0x46')](this['channels'][_0x505994['transfereeuniqueid']])){this[_0xb84a('0x19')](_0x505994['transfereeuniqueid']);if(this[_0xb84a('0x9')][_0x505994['secondtransfereruniqueid']]){this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994['transfertargetuniqueid']]=this['channels'][_0x505994['secondtransfereruniqueid']];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x47')]];}}else if(!_['isNil'](this['channels'][_0x505994[_0xb84a('0x48')]])){this[_0xb84a('0x19')](_0x505994[_0xb84a('0x48')]);if(this['channels'][_0x505994[_0xb84a('0x49')]]){this[_0xb84a('0x9')][_0x505994['origtransfereruniqueid']][_0xb84a('0x25')]=!![];this[_0xb84a('0x9')][_0x505994[_0xb84a('0x4a')]]=this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];delete this[_0xb84a('0x9')][_0x505994[_0xb84a('0x49')]];}}}catch(_0x47c27f){logger[_0xb84a('0x36')](_0xb84a('0x4b'),_0x47c27f['message']);}};Acw[_0xb84a('0x18')][_0xb84a('0x12')]=function(_0x34ac0f){try{if(this[_0xb84a('0x9')][_0x34ac0f[_0xb84a('0x4c')]]){logger[_0xb84a('0x23')](_0xb84a('0x4d'),JSON[_0xb84a('0x4e')](_0x34ac0f[_0xb84a('0x4c')]));this['startAcw'](_0x34ac0f[_0xb84a('0x4c')]);}else if(this['channels'][_0x34ac0f['transfererlinkedid']]){logger[_0xb84a('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb84a('0x4e')](_0x34ac0f['transfererlinkedid']));this[_0xb84a('0x19')](_0x34ac0f[_0xb84a('0x4f')]);}}catch(_0x4c7d56){logger[_0xb84a('0x36')](_0xb84a('0x50'),_0x4c7d56[_0xb84a('0x39')]);}};Acw[_0xb84a('0x18')][_0xb84a('0x51')]=function(_0x192c9a){try{if(this[_0xb84a('0x7')][_0x192c9a['queue']]&&this[_0xb84a('0x7')][_0x192c9a['queue']]['autopause']===_0xb84a('0x52')){if(this[_0xb84a('0x8')][_0x192c9a[_0xb84a('0x1a')]]){logger[_0xb84a('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x192c9a['uniqueid'],_0x192c9a[_0xb84a('0x1a')],_0x192c9a[_0xb84a('0x1b')]);return RpcUser[_0xb84a('0x27')](this[_0xb84a('0x8')][_0x192c9a['interface']],_0xb84a('0x53'),_0x192c9a['uniqueid']);}}}catch(_0x1eec1f){logger['error'](_0xb84a('0x54'),_0x1eec1f['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index d436cdb..d9c55c9 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 _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 +var _0x5cf4=['keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password'];(function(_0xb358eb,_0x1c49c8){var _0x486599=function(_0x4c5c32){while(--_0x4c5c32){_0xb358eb['push'](_0xb358eb['shift']());}};_0x486599(++_0x1c49c8);}(_0x5cf4,0xf0));var _0x45cf=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x5cf4[_0x622035];return _0x326cf2;};'use strict';var Manager=require(_0x45cf('0x0'));var BPromise=require(_0x45cf('0x1'));var moment=require(_0x45cf('0x2'));var util=require(_0x45cf('0x3'));var _=require(_0x45cf('0x4'));var logger=require(_0x45cf('0x5'))(_0x45cf('0x6'));var config=require(_0x45cf('0x7'));var ami=new Manager(config[_0x45cf('0x8')][_0x45cf('0x9')],config[_0x45cf('0x8')]['ip'],config[_0x45cf('0x8')][_0x45cf('0xa')],config['asterisk'][_0x45cf('0xb')],!![]);ami[_0x45cf('0xc')]();ami[_0x45cf('0xd')]=BPromise[_0x45cf('0xe')](ami[_0x45cf('0xf')]);function error(_0x284577){logger['error'](util[_0x45cf('0x10')](_0x45cf('0x11'),config['asterisk'][_0x45cf('0xa')],config[_0x45cf('0x8')]['ip'],config[_0x45cf('0x8')][_0x45cf('0x9')],util[_0x45cf('0x12')](_0x284577,![],null)));}function close(){logger[_0x45cf('0x13')](util[_0x45cf('0x10')](_0x45cf('0x14'),config[_0x45cf('0x8')]['username'],config[_0x45cf('0x8')]['ip'],config[_0x45cf('0x8')][_0x45cf('0x9')]));}ami[_0x45cf('0x15')]=function(){return function(){return ami[_0x45cf('0xd')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x45cf('0xd')]({'action':_0x45cf('0x16')});};};ami[_0x45cf('0x17')]=function(){return function(){return ami[_0x45cf('0xd')]({'action':_0x45cf('0x18')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x45cf('0xd')]({'action':'queuesummary'});};};ami[_0x45cf('0x19')]=function(){return function(){return ami[_0x45cf('0xd')]({'action':_0x45cf('0x1a')});};};function connect(_0x2b9617){logger[_0x45cf('0x1b')](util[_0x45cf('0x10')](_0x45cf('0x1c'),config['asterisk'][_0x45cf('0xa')],config[_0x45cf('0x8')]['ip'],config[_0x45cf('0x8')][_0x45cf('0x9')]));ami[_0x45cf('0x1d')](_0x45cf('0x13'),error);ami[_0x45cf('0x1d')](_0x45cf('0x1e'),close);}ami['on']('connect',connect);ami['on'](_0x45cf('0x1f'),function(_0x502dcf){logger[_0x45cf('0x1b')](util[_0x45cf('0x10')](_0x45cf('0x20'),config[_0x45cf('0x8')]['username'],config['asterisk']['ip'],config['asterisk'][_0x45cf('0x9')],util[_0x45cf('0x12')](_0x502dcf,![],null)));});ami['on'](_0x45cf('0x21'),function(_0x18e7db){logger[_0x45cf('0x1b')](util[_0x45cf('0x10')](_0x45cf('0x22'),config[_0x45cf('0x8')][_0x45cf('0xa')],config[_0x45cf('0x8')]['ip'],config['asterisk'][_0x45cf('0x9')]));return BPromise[_0x45cf('0x23')]()[_0x45cf('0x24')](ami[_0x45cf('0x15')]())[_0x45cf('0x24')](ami[_0x45cf('0x25')]())[_0x45cf('0x24')](ami[_0x45cf('0x17')]())['then'](ami[_0x45cf('0x26')]())[_0x45cf('0x24')](ami[_0x45cf('0x19')]())[_0x45cf('0x27')](function(_0x129b49){console[_0x45cf('0x28')](_0x129b49);});});ami['once'](_0x45cf('0x13'),error);ami[_0x45cf('0x1d')](_0x45cf('0x1e'),close);module[_0x45cf('0x29')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index cdedbbc..532b525 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 _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 +var _0x87f4=['bluebird','ami','client','http','Request','request','then','debug','memberReport','error','message','result','rpc','exports'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x87f4,0x1dc));var _0x487f=function(_0x37d3f3,_0xca010f){_0x37d3f3=_0x37d3f3-0x0;var _0x185c9c=_0x87f4[_0x37d3f3];return _0x185c9c;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x487f('0x0'));var logger=require('../../config/logger')(_0x487f('0x1'));var client=jayson[_0x487f('0x2')][_0x487f('0x3')]({'port':0x2329});client[_0x487f('0x4')]=function(_0x402cee,_0x113648){return new BPromise(function(_0x4b2302,_0x1968da){return client[_0x487f('0x5')](_0x402cee,_0x113648)[_0x487f('0x6')](function(_0x128f73){logger[_0x487f('0x7')]('rpc',_0x487f('0x8'),_0x402cee,_0x113648,_0x128f73);if(_0x128f73[_0x487f('0x9')]){logger[_0x487f('0x9')]('rpc',_0x487f('0x8'),_0x402cee,_0x128f73[_0x487f('0x9')][_0x487f('0xa')],_0x113648);return _0x1968da(_0x128f73[_0x487f('0x9')][_0x487f('0xa')]);}else{return _0x4b2302(_0x128f73[_0x487f('0xb')]);}})['catch'](function(_0x1b1d1e){logger['error'](_0x487f('0xc'),_0x487f('0x8'),_0x402cee,_0x1b1d1e,_0x113648);return _0x1968da(_0x1b1d1e);});});};module[_0x487f('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index f6337ec..5b06357 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 _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 +var _0x8dd6=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','dialQueueTimeout'];(function(_0x47d1ae,_0x41e056){var _0x47328a=function(_0x35adb5){while(--_0x35adb5){_0x47d1ae['push'](_0x47d1ae['shift']());}};_0x47328a(++_0x41e056);}(_0x8dd6,0xcd));var _0x68dd=function(_0x22254e,_0x152070){_0x22254e=_0x22254e-0x0;var _0xd1292e=_0x8dd6[_0x22254e];return _0xd1292e;};'use strict';var util=require(_0x68dd('0x0'));var _=require('lodash');var moment=require(_0x68dd('0x1'));function checkNameSurname(_0x16b61a,_0x3e1de9,_0x2753e6){var _0x14dc5b='';if(!_[_0x68dd('0x2')](_0x3e1de9)&&_0x68dd('0x3')===typeof _0x3e1de9){_0x14dc5b+=_0x3e1de9;}if(!_[_0x68dd('0x2')](_0x2753e6)&&'string'===typeof _0x2753e6){_0x14dc5b+='\x20'+_0x2753e6;}if(_0x14dc5b!==''){return _0x14dc5b;}return _0x16b61a;}function Action(_0x3d5169,_0x54afaa,_0x5320c6){this[_0x68dd('0x4')]=_0x3d5169;this[_0x68dd('0x5')]=_0x5320c6||undefined;this[_0x68dd('0x6')]=checkNameSurname(_0x54afaa[_0x68dd('0x7')][_0x68dd('0x8')],_0x54afaa[_0x68dd('0x7')][_0x68dd('0x9')],_0x54afaa[_0x68dd('0x7')][_0x68dd('0xa')]);this[_0x68dd('0xb')]=_0x54afaa['Contact'][_0x68dd('0x8')];this[_0x68dd('0xc')]=_0x3d5169[_0x68dd('0x6')];this['active']=_0x54afaa[_0x68dd('0xd')]||![];this['type']=_0x3d5169['type'];this['dialQueueTimeout']=_0x3d5169[_0x68dd('0xe')]||0x3;this[_0x68dd('0xf')]=_0x54afaa[_0x68dd('0xf')];this[_0x68dd('0x10')]=_0x54afaa[_0x68dd('0x10')];this['countcongestionretry']=_0x54afaa[_0x68dd('0x11')];this[_0x68dd('0x12')]=_0x54afaa[_0x68dd('0x12')];this[_0x68dd('0x13')]=_0x54afaa[_0x68dd('0x13')];this[_0x68dd('0x14')]=_0x54afaa[_0x68dd('0x14')];this[_0x68dd('0x15')]=_0x54afaa['countabandonedretry'];this['countmachineretry']=_0x54afaa[_0x68dd('0x16')];this[_0x68dd('0x17')]=_0x54afaa['countagentrejectretry'];this[_0x68dd('0x18')]=_0x54afaa[_0x68dd('0x18')];this[_0x68dd('0x19')]=_0x54afaa[_0x68dd('0x19')];this[_0x68dd('0x1a')]=_0x54afaa[_0x68dd('0x1a')];this[_0x68dd('0x1b')]=_0x54afaa[_0x68dd('0x1b')];this['CampaignId']=_0x54afaa[_0x68dd('0x1c')];this[_0x68dd('0x1d')]=_0x54afaa['id'];this[_0x68dd('0x1e')]=_0x54afaa[_0x68dd('0x7')][_0x68dd('0x9')]||'';this['starttime']=moment()[_0x68dd('0x1f')](_0x68dd('0x20'));this[_0x68dd('0x21')]=_0x54afaa[_0x68dd('0x21')];this[_0x68dd('0x22')]=_0x54afaa[_0x68dd('0x22')];this['callbackat']=_0x54afaa[_0x68dd('0x23')];this['recallme']=_0x54afaa['recallme'];this[_0x68dd('0x24')]='';this[_0x68dd('0x25')]='';}Action[_0x68dd('0x26')][_0x68dd('0x27')]=function(){return util['format'](_0x68dd('0x28'),this[_0x68dd('0x6')],this[_0x68dd('0x4')]['dialCutDigit']>0x0?this[_0x68dd('0xb')]['substring'](this[_0x68dd('0x4')][_0x68dd('0x29')]):this[_0x68dd('0xb')]);};Action[_0x68dd('0x26')][_0x68dd('0x2a')]=function(){return this['queue'];};module[_0x68dd('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index bad590c..2cc771d 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 _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 +var _0x98fd=['diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x5a19e5,_0x34588f){var _0x59313d=function(_0x3c39bf){while(--_0x3c39bf){_0x5a19e5['push'](_0x5a19e5['shift']());}};_0x59313d(++_0x34588f);}(_0x98fd,0x182));var _0xd98f=function(_0x5cb97e,_0x132a39){_0x5cb97e=_0x5cb97e-0x0;var _0x1714b4=_0x98fd[_0x5cb97e];return _0x1714b4;};'use strict';var util=require(_0xd98f('0x0'));var _=require(_0xd98f('0x1'));var moment=require(_0xd98f('0x2'));function getSeconds(_0x3a28f5,_0x5df389){var _0x38fda7=moment(_0x3a28f5)[_0xd98f('0x3')](0x0);var _0x32a9d1=moment(_0x5df389)[_0xd98f('0x3')](0x0);return _0x38fda7[_0xd98f('0x4')](_0x32a9d1,_0xd98f('0x5'));}function AdditionalPhone(_0xf4585b){this[_0xd98f('0x6')]=_0xf4585b['uniqueid'];this[_0xd98f('0x7')]=_0xf4585b[_0xd98f('0x7')]||undefined;this[_0xd98f('0x8')]=_0xf4585b[_0xd98f('0x8')];this['campaigntype']=_0xf4585b[_0xd98f('0x8')]===_0xd98f('0x9')?_0xd98f('0xa'):_0xf4585b[_0xd98f('0x8')];this[_0xd98f('0xb')]=_0xf4585b[_0xd98f('0xb')];this[_0xd98f('0xc')]=_0xf4585b[_0xd98f('0xc')];this[_0xd98f('0xd')]=_0xf4585b[_0xd98f('0xd')];this[_0xd98f('0xe')]=_0xf4585b[_0xd98f('0xb')]+_0xf4585b['countcongestionretry']+_0xf4585b['countnoanswerretry']+_0xf4585b[_0xd98f('0xf')]+_0xf4585b[_0xd98f('0x10')]+_0xf4585b[_0xd98f('0x11')]+_0xf4585b[_0xd98f('0x12')]+_0xf4585b[_0xd98f('0x13')];this['countnosuchnumberretry']=_0xf4585b['countnosuchnumberretry'];this[_0xd98f('0x10')]=_0xf4585b['countdropretry'];this[_0xd98f('0x11')]=_0xf4585b[_0xd98f('0x11')];this[_0xd98f('0x12')]=_0xf4585b[_0xd98f('0x12')];this[_0xd98f('0x13')]=_0xf4585b[_0xd98f('0x13')];this[_0xd98f('0xa')]=_0xf4585b['queue'];this[_0xd98f('0x14')]=_0xf4585b['name'];this[_0xd98f('0x15')]=_0xf4585b['number'];this[_0xd98f('0x16')]=_0xf4585b[_0xd98f('0x16')];this[_0xd98f('0x17')]=_0xf4585b[_0xd98f('0x17')];this[_0xd98f('0x18')]=_0xf4585b[_0xd98f('0x17')];this[_0xd98f('0x19')]=getSeconds(_0xf4585b['responsetime'],_0xf4585b['starttime']);this[_0xd98f('0x1a')]=0x0;this[_0xd98f('0x1b')]=0x0;this[_0xd98f('0x1c')]=_0xf4585b[_0xd98f('0x1c')];this['callbackuniqueid']=_0xf4585b['callbackuniqueid'];this[_0xd98f('0x1d')]=_0xf4585b['callbackat'];this[_0xd98f('0x1e')]=_0xf4585b[_0xd98f('0x1e')];this[_0xd98f('0x1f')]=_0xf4585b[_0xd98f('0x1f')];this[_0xd98f('0x20')]=_0xf4585b[_0xd98f('0x20')];this['UserId']=_0xf4585b[_0xd98f('0x21')];this[_0xd98f('0x22')]=_0xf4585b[_0xd98f('0x22')];this['CampaignId']=_0xf4585b[_0xd98f('0x23')];this[_0xd98f('0x24')]=_0xf4585b['originatecalleridnum']||'';this[_0xd98f('0x25')]=_0xf4585b[_0xd98f('0x25')]||'';}module[_0xd98f('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index fa3faf4..d0f8ad0 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 _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 +var _0x1575=['campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type'];(function(_0x5efb4a,_0x39b1ec){var _0x5f31a2=function(_0x2375a7){while(--_0x2375a7){_0x5efb4a['push'](_0x5efb4a['shift']());}};_0x5f31a2(++_0x39b1ec);}(_0x1575,0xd7));var _0x5157=function(_0x45d174,_0x47c6bb){_0x45d174=_0x45d174-0x0;var _0x3a0128=_0x1575[_0x45d174];return _0x3a0128;};'use strict';var util=require('util');var _=require(_0x5157('0x0'));var moment=require(_0x5157('0x1'));function getSeconds(_0x1a21c4,_0x45f810){var _0x4418dc=moment(_0x1a21c4)[_0x5157('0x2')](0x0);var _0x577c4b=moment(_0x45f810)[_0x5157('0x2')](0x0);return _0x4418dc[_0x5157('0x3')](_0x577c4b,_0x5157('0x4'));}function AgentComplete(_0x3f8cd7,_0x966b42){this[_0x5157('0x5')]=0x4;this[_0x5157('0x6')]=_0x5157('0x7');this[_0x5157('0x8')]=_0x3f8cd7[_0x5157('0x8')];this[_0x5157('0x9')]=_0x3f8cd7[_0x5157('0x9')];this[_0x5157('0xa')]=_0x3f8cd7[_0x5157('0x9')]==='outbound'?_0x5157('0xb'):_0x3f8cd7['type'];this['countbusyretry']=_0x3f8cd7[_0x5157('0xc')];this[_0x5157('0xd')]=_0x3f8cd7[_0x5157('0xd')];this[_0x5157('0xe')]=_0x3f8cd7[_0x5157('0xe')];this[_0x5157('0xf')]=_0x3f8cd7['countbusyretry']+_0x3f8cd7['countcongestionretry']+_0x3f8cd7[_0x5157('0xe')]+_0x3f8cd7['countnosuchnumberretry']+_0x3f8cd7[_0x5157('0x10')]+_0x3f8cd7[_0x5157('0x11')]+_0x3f8cd7[_0x5157('0x12')]+_0x3f8cd7['countagentrejectretry'];this[_0x5157('0x13')]=_0x3f8cd7['countnosuchnumberretry'];this[_0x5157('0x10')]=_0x3f8cd7['countdropretry'];this[_0x5157('0x11')]=_0x3f8cd7['countabandonedretry'];this[_0x5157('0x12')]=_0x3f8cd7[_0x5157('0x12')];this['countagentrejectretry']=_0x3f8cd7[_0x5157('0x14')];this[_0x5157('0x15')]=_0x966b42['uniqueid'];this['calleridname']=_0x3f8cd7[_0x5157('0x16')];this[_0x5157('0x17')]=_0x3f8cd7[_0x5157('0x18')];this[_0x5157('0x19')]=_0x3f8cd7[_0x5157('0x19')];this['responsetime']=_0x3f8cd7[_0x5157('0x1a')];this[_0x5157('0x1b')]=_0x3f8cd7[_0x5157('0x1b')];this['endtime']=moment()[_0x5157('0x1c')](_0x5157('0x1d'));this[_0x5157('0x1e')]=getSeconds(_0x3f8cd7[_0x5157('0x1a')],_0x3f8cd7['starttime']);this[_0x5157('0x1f')]=getSeconds(_0x3f8cd7['answertime'],_0x3f8cd7[_0x5157('0x1a')]);this['talktime']=getSeconds(this[_0x5157('0x20')],_0x3f8cd7['answertime']);this[_0x5157('0xb')]=_0x966b42['queue'];this[_0x5157('0x21')]=_0x966b42[_0x5157('0x21')];this[_0x5157('0x22')]=_0x966b42[_0x5157('0x22')];this[_0x5157('0x23')]=_0x3f8cd7[_0x5157('0x23')];this[_0x5157('0x24')]=_0x3f8cd7['callbackuniqueid'];this[_0x5157('0x25')]=_0x3f8cd7[_0x5157('0x25')];this['recallme']=_0x3f8cd7[_0x5157('0x26')];this['ContactId']=_0x3f8cd7[_0x5157('0x27')];this['ListId']=_0x3f8cd7['ListId'];this[_0x5157('0x28')]=_0x3f8cd7[_0x5157('0x28')];this[_0x5157('0x29')]=_0x3f8cd7[_0x5157('0x29')];this[_0x5157('0x2a')]=_0x3f8cd7[_0x5157('0x2a')];this[_0x5157('0x2b')]=_0x3f8cd7[_0x5157('0x2b')]||'';this[_0x5157('0x2c')]=_0x3f8cd7[_0x5157('0x2c')]||'';}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 47bf149..1900fd8 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 _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 +var _0x70cb=['originatecalleridname','exports','util','moment','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x3e751a,_0x4804ae){var _0x1d5aa1=function(_0x51ec5a){while(--_0x51ec5a){_0x3e751a['push'](_0x3e751a['shift']());}};_0x1d5aa1(++_0x4804ae);}(_0x70cb,0x174));var _0xb70c=function(_0x2d6ebf,_0x19a5b1){_0x2d6ebf=_0x2d6ebf-0x0;var _0x4983d1=_0x70cb[_0x2d6ebf];return _0x4983d1;};'use strict';var util=require(_0xb70c('0x0'));var _=require('lodash');var moment=require(_0xb70c('0x1'));function getSeconds(_0x56f992,_0x2ac3f1){var _0x12b116=moment(_0x56f992)['milliseconds'](0x0);var _0x403625=moment(_0x2ac3f1)['milliseconds'](0x0);return _0x12b116['diff'](_0x403625,_0xb70c('0x2'));}function Final(_0x4f1c63){this[_0xb70c('0x3')]=_0x4f1c63[_0xb70c('0x3')];this[_0xb70c('0x4')]=_0x4f1c63[_0xb70c('0x4')];this[_0xb70c('0x5')]=_0x4f1c63[_0xb70c('0x5')];this[_0xb70c('0x6')]=_0x4f1c63['type']===_0xb70c('0x7')?'queue':_0x4f1c63[_0xb70c('0x5')];this[_0xb70c('0x8')]=_0x4f1c63[_0xb70c('0x8')];this['countcongestionretry']=_0x4f1c63['countcongestionretry'];this[_0xb70c('0x9')]=_0x4f1c63['countnoanswerretry'];this[_0xb70c('0xa')]=_0x4f1c63[_0xb70c('0x8')]+_0x4f1c63[_0xb70c('0xb')]+_0x4f1c63['countnoanswerretry']+_0x4f1c63[_0xb70c('0xc')]+_0x4f1c63[_0xb70c('0xd')]+_0x4f1c63['countabandonedretry']+_0x4f1c63[_0xb70c('0xe')]+_0x4f1c63[_0xb70c('0xf')];this['countnosuchnumberretry']=_0x4f1c63[_0xb70c('0xc')];this[_0xb70c('0xd')]=_0x4f1c63[_0xb70c('0xd')];this[_0xb70c('0x10')]=_0x4f1c63[_0xb70c('0x10')];this[_0xb70c('0xe')]=_0x4f1c63[_0xb70c('0xe')];this[_0xb70c('0xf')]=_0x4f1c63[_0xb70c('0xf')];this['queue']=_0x4f1c63[_0xb70c('0x11')];this[_0xb70c('0x12')]=_0x4f1c63[_0xb70c('0x12')];this[_0xb70c('0x13')]=_0x4f1c63['calleridnum'];this[_0xb70c('0x14')]=_0x4f1c63[_0xb70c('0x14')];this[_0xb70c('0x15')]=_0x4f1c63[_0xb70c('0x15')];this[_0xb70c('0x16')]=_0x4f1c63['responsetime'];this[_0xb70c('0x17')]=_0x4f1c63[_0xb70c('0x17')]||0x0;this[_0xb70c('0x18')]=_0x4f1c63['holdtime']||0x0;this[_0xb70c('0x19')]=_0x4f1c63[_0xb70c('0x19')]||0x0;this[_0xb70c('0x1a')]=_0x4f1c63[_0xb70c('0x1a')];this[_0xb70c('0x1b')]=_0x4f1c63[_0xb70c('0x1b')];this[_0xb70c('0x1c')]=_0x4f1c63[_0xb70c('0x1c')];this['recallme']=_0x4f1c63[_0xb70c('0x1d')];this[_0xb70c('0x1e')]=_0x4f1c63[_0xb70c('0x1e')];this[_0xb70c('0x1f')]=_0x4f1c63[_0xb70c('0x1f')];this['UserId']=_0x4f1c63['UserId'];this[_0xb70c('0x20')]=_0x4f1c63[_0xb70c('0x20')];this[_0xb70c('0x21')]=_0x4f1c63['CampaignId'];this[_0xb70c('0x22')]=_0x4f1c63[_0xb70c('0x22')]||'';this[_0xb70c('0x23')]=_0x4f1c63[_0xb70c('0x23')]||'';}module[_0xb70c('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 6bb75e6..0a7c545 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 _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 +var _0xbe98=['ListId','UserId','VoiceQueueId','CampaignId','exports','moment','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x34b87f,_0x28aef2){var _0x449805=function(_0x3735b7){while(--_0x3735b7){_0x34b87f['push'](_0x34b87f['shift']());}};_0x449805(++_0x28aef2);}(_0xbe98,0x1f3));var _0x8be9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbe98[_0x14add3];return _0x4a174f;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x8be9('0x0'));function getSeconds(_0x2275b0,_0x1fa7b0){var _0x4100c9=moment(_0x2275b0)['milliseconds'](0x0);var _0x59be7b=moment(_0x1fa7b0)['milliseconds'](0x0);return _0x4100c9['diff'](_0x59be7b,'seconds');}function Hangup(_0x218f0e,_0x582325){this['state']=0x4;this[_0x8be9('0x1')]=_0x8be9('0x2');this[_0x8be9('0x3')]=_0x218f0e[_0x8be9('0x3')];this[_0x8be9('0x4')]=_0x218f0e[_0x8be9('0x4')];this['campaigntype']=_0x218f0e['type']===_0x8be9('0x5')?_0x8be9('0x6'):_0x218f0e[_0x8be9('0x4')];this[_0x8be9('0x7')]=_0x218f0e[_0x8be9('0x7')];this['countcongestionretry']=_0x218f0e[_0x8be9('0x8')];this['countnoanswerretry']=_0x218f0e[_0x8be9('0x9')];this['countglobal']=_0x218f0e['countbusyretry']+_0x218f0e[_0x8be9('0x8')]+_0x218f0e[_0x8be9('0x9')]+_0x218f0e[_0x8be9('0xa')]+_0x218f0e[_0x8be9('0xb')]+_0x218f0e[_0x8be9('0xc')]+_0x218f0e[_0x8be9('0xd')]+_0x218f0e['countagentrejectretry'];this['countnosuchnumberretry']=_0x218f0e[_0x8be9('0xa')];this[_0x8be9('0xb')]=_0x218f0e[_0x8be9('0xb')];this[_0x8be9('0xc')]=_0x218f0e[_0x8be9('0xc')];this[_0x8be9('0xd')]=_0x218f0e[_0x8be9('0xd')];this[_0x8be9('0xe')]=_0x218f0e[_0x8be9('0xe')];this['uniqueid']=_0x582325[_0x8be9('0xf')];this['calleridname']=_0x218f0e[_0x8be9('0x10')];this[_0x8be9('0x11')]=_0x218f0e[_0x8be9('0x12')];this[_0x8be9('0x13')]=_0x218f0e[_0x8be9('0x13')];this['responsetime']=_0x218f0e['responsetime'];this[_0x8be9('0x14')]=moment()[_0x8be9('0x15')](_0x8be9('0x16'));this['ringtime']=getSeconds(_0x218f0e['responsetime'],_0x218f0e[_0x8be9('0x13')]);this[_0x8be9('0x17')]=0x0;this[_0x8be9('0x18')]=getSeconds(this['endtime'],_0x218f0e['responsetime']);this['queue']=_0x218f0e[_0x8be9('0x6')];this[_0x8be9('0x19')]='IVR';this[_0x8be9('0x1a')]=_0x582325[_0x8be9('0x1b')];this[_0x8be9('0x1c')]=_0x218f0e[_0x8be9('0x1c')];this[_0x8be9('0x1d')]=_0x218f0e[_0x8be9('0x1d')];this[_0x8be9('0x1e')]=_0x218f0e[_0x8be9('0x1e')];this[_0x8be9('0x1f')]=_0x218f0e[_0x8be9('0x1f')];this[_0x8be9('0x20')]=_0x218f0e['ContactId'];this[_0x8be9('0x21')]=_0x218f0e[_0x8be9('0x21')];this[_0x8be9('0x22')]=_0x218f0e[_0x8be9('0x22')];this[_0x8be9('0x23')]=_0x218f0e[_0x8be9('0x23')];this[_0x8be9('0x24')]=_0x218f0e[_0x8be9('0x24')];}module[_0x8be9('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index b6abe69..2f81a52 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 _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 +var _0xa249=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','starttime','responsetime','endtime','holdtime'];(function(_0x52f93e,_0x30f95b){var _0x5bd4ce=function(_0x551e9c){while(--_0x551e9c){_0x52f93e['push'](_0x52f93e['shift']());}};_0x5bd4ce(++_0x30f95b);}(_0xa249,0x109));var _0x9a24=function(_0x2a67a8,_0x174b74){_0x2a67a8=_0x2a67a8-0x0;var _0x31462b=_0xa249[_0x2a67a8];return _0x31462b;};'use strict';var util=require('util');var _=require(_0x9a24('0x0'));var moment=require(_0x9a24('0x1'));function getSeconds(_0x2427f3,_0x5083ff){var _0x20744a=moment(_0x2427f3)[_0x9a24('0x2')](0x0);var _0x4be3ed=moment(_0x5083ff)['milliseconds'](0x0);return _0x20744a['diff'](_0x4be3ed,'seconds');}function History(_0x39f2c0){this[_0x9a24('0x3')]=_0x39f2c0[_0x9a24('0x3')];this[_0x9a24('0x4')]=_0x39f2c0[_0x9a24('0x4')]||undefined;this['type']=_0x39f2c0[_0x9a24('0x5')];this['campaigntype']=_0x39f2c0[_0x9a24('0x5')]===_0x9a24('0x6')?_0x9a24('0x7'):_0x39f2c0[_0x9a24('0x5')];this[_0x9a24('0x8')]=_0x39f2c0[_0x9a24('0x8')];this[_0x9a24('0x9')]=_0x39f2c0[_0x9a24('0x9')];this[_0x9a24('0xa')]=_0x39f2c0[_0x9a24('0xa')];this[_0x9a24('0xb')]=_0x39f2c0['countbusyretry']+_0x39f2c0['countcongestionretry']+_0x39f2c0['countnoanswerretry']+_0x39f2c0[_0x9a24('0xc')]+_0x39f2c0[_0x9a24('0xd')]+_0x39f2c0[_0x9a24('0xe')]+_0x39f2c0[_0x9a24('0xf')]+_0x39f2c0[_0x9a24('0x10')];this['countnosuchnumberretry']=_0x39f2c0[_0x9a24('0xc')];this[_0x9a24('0xd')]=_0x39f2c0[_0x9a24('0xd')];this[_0x9a24('0xe')]=_0x39f2c0[_0x9a24('0xe')];this[_0x9a24('0xf')]=_0x39f2c0[_0x9a24('0xf')];this[_0x9a24('0x10')]=_0x39f2c0[_0x9a24('0x10')];this[_0x9a24('0x7')]=_0x39f2c0['queue'];this[_0x9a24('0x11')]=_0x39f2c0[_0x9a24('0x12')];this['calleridnum']=_0x39f2c0['number'];this[_0x9a24('0x13')]=_0x39f2c0[_0x9a24('0x13')];this[_0x9a24('0x14')]=_0x39f2c0[_0x9a24('0x14')];this[_0x9a24('0x15')]=_0x39f2c0[_0x9a24('0x14')];this['ringtime']=getSeconds(_0x39f2c0[_0x9a24('0x14')],_0x39f2c0[_0x9a24('0x13')]);this[_0x9a24('0x16')]=0x0;this[_0x9a24('0x17')]=0x0;this[_0x9a24('0x18')]=_0x39f2c0[_0x9a24('0x18')];this[_0x9a24('0x19')]=_0x39f2c0[_0x9a24('0x19')];this['callbackat']=_0x39f2c0[_0x9a24('0x1a')];this[_0x9a24('0x1b')]=_0x39f2c0[_0x9a24('0x1b')];this[_0x9a24('0x1c')]=_0x39f2c0['ContactId'];this[_0x9a24('0x1d')]=_0x39f2c0[_0x9a24('0x1d')];this[_0x9a24('0x1e')]=_0x39f2c0[_0x9a24('0x1e')];this['VoiceQueueId']=_0x39f2c0[_0x9a24('0x1f')];this['CampaignId']=_0x39f2c0[_0x9a24('0x20')];this[_0x9a24('0x21')]=_0x39f2c0[_0x9a24('0x21')]||'';this['originatecalleridname']=_0x39f2c0[_0x9a24('0x22')]||'';}module[_0x9a24('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5b8cd98..e57b0fb 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 _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 +var _0xf8e6=['busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','dialGlobalMaxRetry','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','dialPredictiveInterval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','UserId','[booked][checkContactBlack]','queueStatusComplete:\x20','[booked][checkContactBlack][else]','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','Agent','voicePause','outboundReCallsDay','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','temp','maxNumberOriginate','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','ACTIVE','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Amax\x20=\x20','m\x20=\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','predictive','predictiveCalls','syncQueueSummary','../ami','defaults','localhost','socket.io-emitter','redis','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./hangup','env','rrmemory','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','actions','contactsId','uniqueId','startPredictive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','name','\x20INTERVAL_IS_NULL','Intervals','[ifTime][Action]','Error','stringify','milliseconds','emit','outbound','strategy','answered','available','pTalking','sumDuration','total','type','abandoned','waiting','loggedInDb','dialActive','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','callerid','format','voice_queue:save','ivr','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','stack','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','clearZombieChannels','sequence','isNil','status','channel','catch','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','active','trunks','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','dialAMDActive','value','outboundAnswerCallsDay','state','HangupInAMD','AMD','[syncHangupInAMD]','membername','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','stateGlobal','reason19\x20machine....','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','HANGUP','[syncHangupInAMDIvr][createHistory]','MACHINE','Machine','countagentrejectretry','dialMachineMaxRetry','[rescheduleContact][Machine]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','droptime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','queueCallerAbandonCreateState','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','syncNewExten','actionid','roundrobin','locked','paused','stateinterface','queueBooked','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','idHopper','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','push','Action','command','interval','indexOf','true','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','[syncQueueSummary]','dialTimezone','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','dialer','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','reason','NoSuchNumber','custom:agentnosuchnumber','buildObj','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy'];(function(_0x353abb,_0x194c80){var _0x43c9c5=function(_0x456b74){while(--_0x456b74){_0x353abb['push'](_0x353abb['shift']());}};_0x43c9c5(++_0x194c80);}(_0xf8e6,0x68));var _0x6f8e=function(_0x55e990,_0x258e49){_0x55e990=_0x55e990-0x0;var _0x537700=_0xf8e6[_0x55e990];return _0x537700;};'use strict';var util=require(_0x6f8e('0x0'));var _=require(_0x6f8e('0x1'));var BPromise=require(_0x6f8e('0x2'));var uuid=require(_0x6f8e('0x3'));var moment=require(_0x6f8e('0x4'));var rr=require('rr');var md5=require(_0x6f8e('0x5'));var Redis=require(_0x6f8e('0x6'));var ut=require(_0x6f8e('0x7'));var config=require('../../../config/environment/');var logger=require(_0x6f8e('0x8'))('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x6f8e('0x8'))(_0x6f8e('0x9'));var loggerPredictiveCalls=require(_0x6f8e('0x8'))(_0x6f8e('0xa'));var loggerSyncQueueSummary=require(_0x6f8e('0x8'))(_0x6f8e('0xb'));var ami=require(_0x6f8e('0xc'));config['redis']=_[_0x6f8e('0xd')](config['redis'],{'host':_0x6f8e('0xe'),'port':0x18eb});var io=require(_0x6f8e('0xf'))(new Redis(config[_0x6f8e('0x10')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x6f8e('0x11'));var cmHopperBlack=require(_0x6f8e('0x12'));var voiceQueueRt=require(_0x6f8e('0x13'));var Action=require('./action');var History=require(_0x6f8e('0x14'));var Final=require(_0x6f8e('0x15'));var AgentComplete=require(_0x6f8e('0x16'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require(_0x6f8e('0x17'));var ipAgi=process[_0x6f8e('0x18')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0x6f8e('0x19'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x6f8e('0x1a')][_0x6f8e('0x1b')]=function(_0x136d70){this[_0x6f8e('0x1c')]=this['tail']?this[_0x6f8e('0x1c')][_0x6f8e('0x1d')](_0x136d70):_0x136d70();};function Dialer(_0xf23d83,_0x3ee00a){this['sequence']=new Sequence();this[_0x6f8e('0x1e')]=_0x3ee00a;this[_0x6f8e('0x1f')]=_0xf23d83[_0x6f8e('0x1f')];this[_0x6f8e('0x20')]=_0xf23d83[_0x6f8e('0x20')];this[_0x6f8e('0x21')]=_0xf23d83[_0x6f8e('0x21')];this['trunks']=_0xf23d83['trunks'];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x6f8e('0x22')]={};this[_0x6f8e('0x23')]={};this[_0x6f8e('0x24')]={};this['optionPredictive']={};this[_0x6f8e('0x25')]={};this['startProgressive']={};this[_0x6f8e('0x26')]={};this['queueBooked']={};this[_0x6f8e('0x27')]={};ami['on'](_0x6f8e('0x28'),this[_0x6f8e('0x29')][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x2b'),this[_0x6f8e('0x2c')][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x2d'),this['syncOriginateResponse'][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x2e'),this['syncAgentComplete'][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x2f'),this['syncQueueSummary'][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x30'),this[_0x6f8e('0x31')]['bind'](this));ami['on'](_0x6f8e('0x32'),this['syncNewExten']['bind'](this));ami['on'](_0x6f8e('0x33'),this['syncVarSet'][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x34'),this[_0x6f8e('0x35')][_0x6f8e('0x2a')](this));ami['on'](_0x6f8e('0x36'),this[_0x6f8e('0x37')][_0x6f8e('0x2a')](this));this[_0x6f8e('0x38')]();this[_0x6f8e('0x39')]();}function isNotNull(_0x38c877){return _0x38c877!==null&&!_[_0x6f8e('0x3a')](_0x38c877);}function checkIsLoggedIn(_0x5792b9,_0x4fd374){return function(){if(_0x4fd374<=0x0){_0x5792b9[_0x6f8e('0x3b')]=_0x6f8e('0x3c');throw _0x5792b9['name']+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x432d2b){return _0x432d2b;}function checkIsActive(_0x22b5b9,_0x166e6a){return function(){if(!isActive(_0x166e6a)){_0x22b5b9[_0x6f8e('0x3b')]=_0x6f8e('0x3d');throw _0x22b5b9['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x437783){return function(){if(!isNotNull(_0x437783[_0x6f8e('0x3e')])){_0x437783['message']=_0x6f8e('0x3f');throw _0x437783[_0x6f8e('0x40')]+_0x6f8e('0x41');}if(!isNotNull(_0x437783[_0x6f8e('0x3e')][_0x6f8e('0x42')])){_0x437783[_0x6f8e('0x3b')]='INTERVAL_IS_NULL';throw _0x437783['name']+_0x6f8e('0x41');}if(!isNotNull(_['isEmpty'](_0x437783[_0x6f8e('0x3e')]['Intervals']))){_0x437783[_0x6f8e('0x3b')]=_0x6f8e('0x3f');throw _0x437783[_0x6f8e('0x40')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x11ecc5,_0x1e00d8,_0x5665cc){return{'action':_0x11ecc5,'response':_0x1e00d8,'message':_0x5665cc,'stack':_0x5665cc};}function myreject(_0x1791bc){return function(_0xb6f8ad){return _0x1791bc(msgResponse(_0x6f8e('0x43'),_0x6f8e('0x44'),JSON[_0x6f8e('0x45')](_0xb6f8ad)));};}function getSeconds(_0x49fc05,_0x186699){var _0x44022e=moment(_0x49fc05)[_0x6f8e('0x46')](0x0);var _0x59bfe8=moment(_0x186699)['milliseconds'](0x0);return _0x44022e['diff'](_0x59bfe8,'seconds');}function emit(_0x184cd8,_0x4a34d0,_0x1e8ed4){io['to'](_0x184cd8)[_0x6f8e('0x47')](_0x4a34d0,_0x1e8ed4);}function emitVoiceQueueSummary(_0x33bf6a){if(_0x33bf6a['type']===_0x6f8e('0x48')){var _0x5b98b7={'id':_0x33bf6a['id'],'name':_0x33bf6a[_0x6f8e('0x40')],'strategy':_0x33bf6a[_0x6f8e('0x49')],'answered':_0x33bf6a[_0x6f8e('0x4a')],'available':_0x33bf6a[_0x6f8e('0x4b')],'loggedIn':_0x33bf6a['loggedIn'],'pTalking':_0x33bf6a[_0x6f8e('0x4c')],'sumBillable':_0x33bf6a['sumBillable'],'sumDuration':_0x33bf6a[_0x6f8e('0x4d')],'sumHoldTime':_0x33bf6a['sumHoldTime']||0x0,'talking':_0x33bf6a['talking'],'total':_0x33bf6a[_0x6f8e('0x4e')],'type':_0x33bf6a[_0x6f8e('0x4f')],'unmanaged':_0x33bf6a['unmanaged'],'abandoned':_0x33bf6a[_0x6f8e('0x50')],'waiting':_0x33bf6a[_0x6f8e('0x51')],'loggedInDb':_0x33bf6a[_0x6f8e('0x52')],'dialActive':_0x33bf6a[_0x6f8e('0x53')],'dialMethod':_0x33bf6a['dialMethod'],'dialOriginateCallerIdName':_0x33bf6a['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x33bf6a['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x33bf6a[_0x6f8e('0x54')],'dialPrefix':_0x33bf6a[_0x6f8e('0x55')],'outboundAnswerAgiCallsDay':_0x33bf6a[_0x6f8e('0x56')],'outboundAnswerCallsDay':_0x33bf6a['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x33bf6a['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x33bf6a[_0x6f8e('0x57')],'outboundCongestionCallsDay':_0x33bf6a['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x33bf6a['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x33bf6a[_0x6f8e('0x58')],'outboundDropCallsDayTimeout':_0x33bf6a[_0x6f8e('0x59')],'outboundNoAnswerCallsDay':_0x33bf6a[_0x6f8e('0x5a')],'outboundNoSuchCallsDay':_0x33bf6a[_0x6f8e('0x5b')],'outboundOriginateFailureCallsDay':_0x33bf6a[_0x6f8e('0x5c')],'outboundReCallsDay':_0x33bf6a['outboundReCallsDay'],'outboundRejectCallsDay':_0x33bf6a[_0x6f8e('0x5d')],'outboundUnknownCallsDay':_0x33bf6a['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x33bf6a[_0x6f8e('0x5e')],'predictiveIntervalAvgHoldtime':_0x33bf6a[_0x6f8e('0x5f')],'predictiveIntervalAvgTalktime':_0x33bf6a['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x33bf6a[_0x6f8e('0x60')],'predictiveIntervalDroppedCallsTimeout':_0x33bf6a['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x33bf6a[_0x6f8e('0x61')],'predictiveIntervalErlangCallsDroppedCalls':_0x33bf6a['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x33bf6a[_0x6f8e('0x62')],'predictiveIntervalMultiplicativeFactor':_0x33bf6a[_0x6f8e('0x63')],'predictiveIntervalPauses':_0x33bf6a['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x33bf6a[_0x6f8e('0x64')],'predictiveIntervalTotalCalls':_0x33bf6a[_0x6f8e('0x65')],'message':_0x33bf6a['message'],'originated':_0x33bf6a['originated'],'erlangCalls':_0x33bf6a[_0x6f8e('0x66')],'erlangCallToSecond':_0x33bf6a[_0x6f8e('0x67')],'erlangAbandonmentRate':_0x33bf6a[_0x6f8e('0x68')],'erlangBusyFactor':_0x33bf6a[_0x6f8e('0x69')],'startPredictive':_0x33bf6a['startPredictive'],'startProgressive':_0x33bf6a[_0x6f8e('0x6a')]};if(_0x33bf6a['Trunk']){_0x5b98b7['Trunk']={'id':_0x33bf6a[_0x6f8e('0x6b')]['id'],'name':_0x33bf6a[_0x6f8e('0x6b')]['name'],'active':_0x33bf6a[_0x6f8e('0x6b')]['active'],'callerid':_0x33bf6a[_0x6f8e('0x6b')][_0x6f8e('0x6c')]};}if(_0x33bf6a[_0x6f8e('0x3e')]){_0x5b98b7['Interval']={'id':_0x33bf6a['Interval']['id'],'name':_0x33bf6a[_0x6f8e('0x3e')][_0x6f8e('0x40')]};}var _0x186827=md5(JSON[_0x6f8e('0x45')](_0x5b98b7));if(_0x33bf6a['md5']!==_0x186827){_0x33bf6a[_0x6f8e('0x5')]=_0x186827;emit(util[_0x6f8e('0x6d')]('voice:queue:%s',_0x5b98b7[_0x6f8e('0x40')]),_0x6f8e('0x6e'),_0x5b98b7);}}}function emitCampaignSummary(_0x33edf5){if(_0x33edf5[_0x6f8e('0x4f')]===_0x6f8e('0x6f')){emit(util['format']('campaign:ivr:%s',_0x33edf5[_0x6f8e('0x40')]),'campaign:save',_0x33edf5);}}function checkGetDataPredictive(_0x522639){if(isNotNull(_0x522639)&&!_[_0x6f8e('0x70')](_0x522639)){loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x72'));loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x73'),_0x522639['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0x6f8e('0x74'),_0x522639[_0x6f8e('0x5e')]);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x75'),_0x522639[_0x6f8e('0x76')]);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x77'),_0x522639[_0x6f8e('0x60')]);loggerPredictive[_0x6f8e('0x71')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x522639[_0x6f8e('0x5f')]);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x78'),_0x522639[_0x6f8e('0x79')]);loggerPredictive['info'](_0x6f8e('0x7a'));if(_0x522639['predictiveIntervalTotalCalls']>0x0){if(!_[_0x6f8e('0x3a')](_0x522639[_0x6f8e('0x79')])&&_0x522639[_0x6f8e('0x79')]>0x0){return!![];}loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7b'));if(!_[_0x6f8e('0x3a')](_0x522639['predictiveIntervalAvgHoldtime'])&&_0x522639['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x6f8e('0x71')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7c'));}}else{loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7d'));}return![];}function mergeDataErlangB(_0x1be322){return function(_0x2c18bb){loggerPredictive[_0x6f8e('0x71')]('---------\x20ErlangB\x20---------');loggerPredictive[_0x6f8e('0x71')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c18bb[_0x6f8e('0x66')]);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7e'),_0x2c18bb[_0x6f8e('0x67')]);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7f'),_0x2c18bb[_0x6f8e('0x68')]);loggerPredictive[_0x6f8e('0x71')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2c18bb['erlangBusyFactor']);loggerPredictive['info'](_0x6f8e('0x7f'),_0x2c18bb[_0x6f8e('0x68')]);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7a'));_[_0x6f8e('0x80')](_0x1be322,_0x2c18bb);};}function getDiff(_0x5922bb){var _0x3c251b=moment()[_0x6f8e('0x46')](0x0);var _0x35951d=moment(_0x5922bb)['milliseconds'](0x0);return _0x3c251b['diff'](_0x35951d,_0x6f8e('0x81'));}function ifInterval(_0x2deb55,_0x4c0ebd){if(_[_0x6f8e('0x3a')](_0x4c0ebd)){return![];}return getDiff(_0x4c0ebd)<_0x2deb55*0x3c;}function freeVariablesPredictive(_0x117d2f){if(isNotNull(_0x117d2f)){if(!_[_0x6f8e('0x3a')](_0x117d2f[_0x6f8e('0x6a')])){_0x117d2f[_0x6f8e('0x6a')]=undefined;loggerPredictive[_0x6f8e('0x71')](_0x117d2f[_0x6f8e('0x40')],_0x6f8e('0x82'));}if(!_[_0x6f8e('0x3a')](_0x117d2f['startPredictive'])){_0x117d2f['startPredictive']=undefined;loggerPredictive[_0x6f8e('0x71')](_0x117d2f[_0x6f8e('0x40')],_0x6f8e('0x83'));}if(!_[_0x6f8e('0x3a')](_0x117d2f[_0x6f8e('0x84')])){clearInterval(_0x117d2f[_0x6f8e('0x84')]);_0x117d2f[_0x6f8e('0x84')]=undefined;loggerPredictive['info'](_0x117d2f[_0x6f8e('0x40')],_0x6f8e('0x85'));}}}function erlangb(_0x16530,_0x37408b){if(_0x37408b===0x0){return 0x0;}var _0x2a7e28=0x1;for(var _0x10a244=0x1;_0x10a244<=_0x37408b;_0x10a244+=0x1){_0x2a7e28=0x1+_0x2a7e28*_0x10a244/_0x16530;}return 0x1/_0x2a7e28;}function isVoiceQueueOutbound(_0x21dea4){return _0x21dea4==='outbound';}function isNotPreview(_0x342816){return _0x342816!==_0x6f8e('0x1e');}function isCampaignIvr(_0x115ac2){return _0x115ac2===_0x6f8e('0x6f');}function getCallerId(_0x460bab,_0x545586,_0x4ef985){if(!_[_0x6f8e('0x3a')](_0x4ef985)&&typeof _0x4ef985===_0x6f8e('0x86')&&!_[_0x6f8e('0x70')](_0x4ef985)){if(!_[_0x6f8e('0x3a')](_0x545586)&&typeof _0x545586===_0x6f8e('0x86')&&!_[_0x6f8e('0x70')](_0x545586)){return util[_0x6f8e('0x6d')]('\x22%s\x22\x20<%s>',_0x545586,_0x4ef985);}return util[_0x6f8e('0x6d')](_0x6f8e('0x87'),_0x4ef985,_0x4ef985);}if(!_[_0x6f8e('0x3a')](_0x460bab)&&typeof _0x460bab==='string'&&!_[_0x6f8e('0x70')](_0x460bab)){return _0x460bab;}return _0x6f8e('0x88');}function loggerCatchQueueSummary(_0x4aa938,_0x108d9b){return function(_0x296e6d){freeVariablesPredictive(_0x108d9b);emitVoiceQueueSummary(_0x108d9b);emitCampaignSummary(_0x108d9b);loggerSyncQueueSummary['error'](_0x4aa938,util[_0x6f8e('0x89')](_0x296e6d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x49ac1a,_0x365198){return function(_0x17e0c7){loggerPredictive[_0x6f8e('0x8a')](_0x365198[_0x6f8e('0x40')],_0x49ac1a);loggerPredictive['error'](_0x17e0c7[_0x6f8e('0x8b')]);freeVariablesPredictive(_0x365198);};}function loggerCatch(_0x1a0615){return function(_0x8fc98e){logger['error'](_0x1a0615,util[_0x6f8e('0x89')](_0x8fc98e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x23faa1){return _0x23faa1&&!_[_0x6f8e('0x3a')](_0x23faa1)&&_0x23faa1['length']>0x0;}function decremetOriginate(_0xe79d64){if(!_[_0x6f8e('0x3a')](_0xe79d64)&&_0xe79d64!==null){if(typeof _0xe79d64[_0x6f8e('0x8c')]!==_0x6f8e('0x8d')){if(_0xe79d64[_0x6f8e('0x8c')]>0x0){_0xe79d64[_0x6f8e('0x8c')]-=0x1;}else{logger[_0x6f8e('0x8a')](_0x6f8e('0x8e'));}}}else{logger[_0x6f8e('0x8a')](_0x6f8e('0x8f'));}}function checkContactLowerLimitOriginate(_0x146e35,_0x44ebf6,_0xf0978){if(_0x44ebf6>_0xf0978){for(var _0x1c3148=0x0;_0x1c3148<_0x44ebf6-_0xf0978;_0x1c3148+=0x1){decremetOriginate(_0x146e35);}}}function loggerGetContactDialer(_0xa461a3,_0x26610f,_0x334477){return function(_0x46c3a6){checkContactLowerLimitOriginate(_0x26610f,_0x334477,0x0);logger[_0x6f8e('0x8a')](_0xa461a3,util[_0x6f8e('0x89')](_0x46c3a6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xf2bd9e){return function(_0x2652f7){if(isNotNull(_0x2652f7)&&isNotNull(_0x2652f7[0x0])){if(_0x2652f7[0x0][_0x6f8e('0x90')]>0x0){_0xf2bd9e[_0x6f8e('0x3b')]=_0x6f8e('0x91');logger[_0x6f8e('0x71')](_0x6f8e('0x92')+_0xf2bd9e[_0x6f8e('0x40')],_0x2652f7[0x0][_0x6f8e('0x90')],_0x6f8e('0x93'));}else{_0xf2bd9e[_0x6f8e('0x3b')]=_0x6f8e('0x94');logger[_0x6f8e('0x71')](_0x6f8e('0x95')+_0xf2bd9e[_0x6f8e('0x40')]);}}};}function notSendMessagesQueue(_0x4a188c){if(_0x4a188c[_0x6f8e('0x96')]){freeVariablesPredictive(_0x4a188c);if(_0x4a188c[_0x6f8e('0x8c')]===0x0&&_0x4a188c[_0x6f8e('0x97')]===0x0&&_0x4a188c[_0x6f8e('0x51')]===0x0&&(_0x4a188c[_0x6f8e('0x4c')]||0x0)===0x0){_0x4a188c['sendMessageOneNotActive']=![];_0x4a188c[_0x6f8e('0x4b')]=0x0;_0x4a188c[_0x6f8e('0x3b')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x6f8e('0x8a')](_0x6f8e('0x98'),_0x4a188c[_0x6f8e('0x40')],_0x6f8e('0x99'));}else{_0x4a188c['message']=_0x6f8e('0x9a');loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4a188c['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x4a188c);}}function notSendMessagesCampaign(_0x5ee787){if(_0x5ee787[_0x6f8e('0x96')]){if(_0x5ee787['originated']===0x0){_0x5ee787[_0x6f8e('0x96')]=![];_0x5ee787[_0x6f8e('0x3b')]=_0x6f8e('0x3d');loggerSyncQueueSummary[_0x6f8e('0x8a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5ee787[_0x6f8e('0x40')],_0x6f8e('0x99'));}else{_0x5ee787['message']=_0x6f8e('0x9a');loggerSyncQueueSummary['error'](_0x6f8e('0x9b'),_0x5ee787['name'],'is\x20disactive');}emitCampaignSummary(_0x5ee787);}}function createObjHistory(_0xcfdb77,_0x51e603,_0xdcde1,_0x55fa1d,_0x5350e4){_0xcfdb77['message']=_0xdcde1;var _0x1ee04f=new Action(_0xcfdb77,_0x51e603);var _0x21c2ec=new History(_0x1ee04f);_0x21c2ec['state']=_0x55fa1d;_0x21c2ec[_0x6f8e('0x9c')]=_0x5350e4;_0x21c2ec[_0x6f8e('0x9d')]=_0x1ee04f['starttime'];return _0x21c2ec;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x5baa67=this;setInterval(function(){_0x5baa67[_0x6f8e('0x9e')](_0x5baa67[_0x6f8e('0x24')],'[uniqueid]');_0x5baa67[_0x6f8e('0x9e')](_0x5baa67[_0x6f8e('0x22')],'[actions]');},0x32c8);};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x9e')]=function(_0x2b28db,_0xf2960b){var _0x52e443=this;for(var _0x481210 in _0x2b28db){if(typeof _0x2b28db[_0x481210]!=='undefined'){this[_0x6f8e('0x9f')]['enqueue'](function(){if(!_[_0x6f8e('0xa0')](_0x2b28db[_0x481210])){return ami['Action']({'action':_0x6f8e('0xa1'),'channel':_0x2b28db[_0x481210][_0x6f8e('0xa2')]})[_0x6f8e('0xa3')](function(_0x2a10a6){if(_0x2a10a6[_0x6f8e('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2b28db[_0x481210]&&_0x2b28db[_0x481210][_0x6f8e('0x4f')]!=='ivr'){_0x52e443['updateOriginated'](_0x52e443[_0x6f8e('0x1f')][_0x2b28db[_0x481210][_0x6f8e('0xa4')]]);logger[_0x6f8e('0x8a')]('[Dialer][checkChannel]',_0xf2960b,_0x481210,_0x2b28db[_0x481210][_0x6f8e('0xa4')]);delete _0x2b28db[_0x481210];}if(_0x2b28db[_0x481210]&&_0x2b28db[_0x481210]['type']===_0x6f8e('0x6f')){_0x52e443[_0x6f8e('0xa5')](_0x52e443[_0x6f8e('0x20')][_0x2b28db[_0x481210][_0x6f8e('0xa4')]]);logger[_0x6f8e('0x8a')](_0x6f8e('0xa6'),_0xf2960b,_0x481210,_0x2b28db[_0x481210][_0x6f8e('0xa4')]);delete _0x2b28db[_0x481210];}},0x2328);}});}});}}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xa7')]=function(_0x35a2ec){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](cmHopper[_0x6f8e('0xa7')](_0x35a2ec))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xaa')));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xab')]=function(_0x49f600){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](cmHopperBlack[_0x6f8e('0xab')](_0x49f600))['catch'](loggerCatch(_0x6f8e('0xac')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x1d75a8){return BPromise[_0x6f8e('0xa8')]()['then'](cmHopperBlack[_0x6f8e('0xad')](_0x1d75a8))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xae')));};Dialer['prototype'][_0x6f8e('0xaf')]=function(_0x3ce94e){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](cmHopperHistory[_0x6f8e('0xb0')](_0x3ce94e))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xb1')));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xb2')]=function(_0x2f4deb){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](cmHopper['rescheduleContact'](_0x2f4deb))['catch'](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0x6f8e('0xb3')]=function(_0x3735a3,_0x31c6ac,_0x37e477){return BPromise[_0x6f8e('0xa8')]()['then'](cmHopper[_0x6f8e('0xb3')](_0x3735a3,_0x31c6ac,_0x37e477))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xb4')));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xb5')]=function(_0x5efd6c,_0x5cd50e,_0x21c43e,_0x3097ec){return BPromise[_0x6f8e('0xa8')]()['then'](cmHopper['getContactDialer'](_0x5efd6c,_0x5cd50e,_0x21c43e,_0x3097ec))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xb6')));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xb7')]=function(_0x454e7d,_0x5c9dd0,_0x24ac32){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](cmHopper['getContactDialerIvr'](_0x454e7d,_0x5c9dd0,_0x24ac32))['catch'](loggerCatch(_0x6f8e('0xb6')));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xb8')]=function(_0x2bfd45){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](voiceQueueRt[_0x6f8e('0xb8')](_0x2bfd45))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xb9')));};Dialer['prototype'][_0x6f8e('0xba')]=function(_0x31c9ba){return BPromise[_0x6f8e('0xa8')]()[_0x6f8e('0xa9')](cmHopper[_0x6f8e('0xba')](_0x31c9ba))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xbb')));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xbc')]=function(_0x25148e){return BPromise[_0x6f8e('0xa8')]()['then'](cmHopperHistory[_0x6f8e('0xbc')](_0x25148e))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xbd')));};Dialer[_0x6f8e('0x1a')]['updateOriginated']=function(_0x17af7b){if(!_[_0x6f8e('0x3a')](_0x17af7b)&&_0x17af7b!==null){if(typeof _0x17af7b['originated']!==_0x6f8e('0x8d')){if(_0x17af7b[_0x6f8e('0x8c')]>0x0){_0x17af7b[_0x6f8e('0x8c')]-=0x1;}else{logger[_0x6f8e('0x8a')](_0x6f8e('0xbe'));}}}else{logger[_0x6f8e('0x8a')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x6f8e('0x1a')]['loggerHandler']=function(_0x5589df,_0x577a7c){var _0x39de66=this;return function(_0x5c3382){_0x39de66[_0x6f8e('0xa5')](_0x577a7c);logger[_0x6f8e('0x8a')](_0x5589df,util[_0x6f8e('0x89')](_0x5c3382,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x6f8e('0xbf')]=function(_0x310868,_0xcd9d45,_0x1a9e1c){var _0x1031a4={'state':0x19,'statedesc':_0x6f8e('0xc0')};this['updateOriginated'](_0xcd9d45);this[_0x6f8e('0xc1')](_['merge'](_0x1031a4,_[_0x6f8e('0xc2')](_0x1a9e1c,[_0x6f8e('0xc3'),_0x6f8e('0xc4'),'UserId',_0x6f8e('0xc5'),_0x6f8e('0xc6')])),_0x6f8e('0xc7'),'[emptyContact]');logger[_0x6f8e('0x8a')](_0x310868);};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xc8')]=function(_0x5b5fc2){return _0x5b5fc2===_0x6f8e('0xc9');};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xca')]=function(_0x484d7a){return!_[_0x6f8e('0x3a')](_0x484d7a)&&_0x484d7a&&!_[_0x6f8e('0x3a')](_0x484d7a['name'])&&!_[_0x6f8e('0x3a')](_0x484d7a[_0x6f8e('0xcb')])&&_0x484d7a[_0x6f8e('0xcb')]&&(this[_0x6f8e('0xcc')][util['format'](_0x6f8e('0xcd'),_0x484d7a['name'])][_0x6f8e('0xa1')]===_0x6f8e('0xce')||this[_0x6f8e('0xcc')][util[_0x6f8e('0x6d')]('SIP/%s',_0x484d7a[_0x6f8e('0x40')])][_0x6f8e('0xa1')]===_0x6f8e('0xcf'));};Dialer[_0x6f8e('0x1a')]['saveInDb']=function(_0x5c0043,_0x45d425,_0x4f84a3){this[_0x6f8e('0xbc')](_0x5c0043)[_0x6f8e('0xa3')](loggerCatch(_0x45d425));this[_0x6f8e('0xba')](_0x5c0043)[_0x6f8e('0xa3')](loggerCatch(_0x4f84a3));};Dialer['prototype'][_0x6f8e('0xd0')]=function(_0x133dda){var _0x1755cf=this[_0x6f8e('0x24')][_0x133dda[_0x6f8e('0xd1')]];var _0x12ed0e;if(!_[_0x6f8e('0xa0')](_0x133dda)&&!_['isNil'](_0x133dda[_0x6f8e('0xd2')])&&!_[_0x6f8e('0xa0')](_0x133dda[_0x6f8e('0xd2')][_0x6f8e('0xd3')])&&_0x133dda[_0x6f8e('0xd4')]==='xcally-motion-dialer'&&_0x1755cf){if(_0x1755cf[_0x6f8e('0x4f')]!=='ivr'&&this['voiceQueues'][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0xd5')]&&_0x133dda[_0x6f8e('0xd6')]==='HANGUP'){delete this[_0x6f8e('0x24')][_0x133dda[_0x6f8e('0xd1')]];this['updateOriginated'](this['voiceQueues'][_0x1755cf[_0x6f8e('0xa4')]]);this[_0x6f8e('0x1f')][_0x1755cf['queue']][_0x6f8e('0xd7')]+=0x1;this[_0x6f8e('0x1f')][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0x56')]+=0x1;_0x12ed0e=new Hangup(_0x1755cf,_0x133dda);_0x12ed0e[_0x6f8e('0xd8')]=0x12;_0x12ed0e[_0x6f8e('0x9c')]=_0x6f8e('0xd9');_0x12ed0e['membername']=_0x6f8e('0xda');this[_0x6f8e('0xc1')](_0x12ed0e,'[syncHangupInAMD][createHistory]',_0x6f8e('0xdb'));}if(_0x1755cf[_0x6f8e('0x4f')]!==_0x6f8e('0x6f')&&this[_0x6f8e('0x1f')][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0xd5')]&&_0x133dda['value']==='MACHINE'){var _0x4eb435=this;return new BPromise(function(_0x13cc3b,_0x24e0f7){delete _0x4eb435[_0x6f8e('0x24')][_0x133dda[_0x6f8e('0xd1')]];_0x4eb435['updateOriginated'](_0x4eb435['voiceQueues'][_0x1755cf[_0x6f8e('0xa4')]]);_0x4eb435[_0x6f8e('0x1f')][_0x1755cf[_0x6f8e('0xa4')]]['outboundAnswerCallsDay']+=0x1;_0x4eb435[_0x6f8e('0x1f')][_0x1755cf[_0x6f8e('0xa4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1cf7e1=_0x4eb435[_0x6f8e('0x1f')][_0x1755cf['queue']];var _0x59a1de=new Hangup(_0x1755cf,_0x133dda);_0x59a1de[_0x6f8e('0xd8')]=0x13;_0x59a1de[_0x6f8e('0x9c')]='Machine';_0x59a1de[_0x6f8e('0xdc')]='AMD';_0x59a1de[_0x6f8e('0xdd')]+=0x1;_0x59a1de[_0x6f8e('0xde')]+=0x1;_0x59a1de[_0x6f8e('0xdf')]=!![];_0x4eb435[_0x6f8e('0xbc')](_0x59a1de)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xe0')));if(_0x59a1de[_0x6f8e('0xe1')]+_0x59a1de[_0x6f8e('0xe2')]+_0x59a1de[_0x6f8e('0xe3')]+_0x59a1de[_0x6f8e('0xe4')]+_0x59a1de[_0x6f8e('0xe5')]+_0x59a1de[_0x6f8e('0xe6')]+_0x59a1de[_0x6f8e('0xdd')]+_0x59a1de['countagentrejectretry']>=_0x1cf7e1['dialGlobalMaxRetry']){_0x4eb435[_0x6f8e('0xe7')](_0x59a1de,_0x13cc3b,_0x24e0f7,_0x6f8e('0xe8'));}else{if(_0x59a1de[_0x6f8e('0xdd')]>=_0x1cf7e1['dialMachineMaxRetry']){_0x4eb435[_0x6f8e('0xe9')](_0x59a1de,_0x13cc3b,_0x24e0f7,_0x6f8e('0xea'));}else{_0x4eb435[_0x6f8e('0xb2')]({'active':![],'countmachineretry':_0x59a1de[_0x6f8e('0xdd')],'scheduledat':moment()[_0x6f8e('0xeb')](_0x1cf7e1[_0x6f8e('0xec')],_0x6f8e('0xed'))[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x59a1de['ContactId'],'ListId':_0x59a1de[_0x6f8e('0xc4')],'VoiceQueueId':_0x59a1de[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x59a1de[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch('[rescheduleContact][Machine]'));_0x13cc3b({'reschedule':0x1});}}});}if(_0x1755cf[_0x6f8e('0x4f')]===_0x6f8e('0x6f')&&this[_0x6f8e('0x20')][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0xd5')]&&_0x133dda[_0x6f8e('0xd6')]===_0x6f8e('0xef')){delete this[_0x6f8e('0x24')][_0x133dda[_0x6f8e('0xd1')]];this[_0x6f8e('0xa5')](this['campaigns'][_0x1755cf[_0x6f8e('0xa4')]]);_0x12ed0e=new Hangup(_0x1755cf,_0x133dda);_0x12ed0e[_0x6f8e('0xd8')]=0x12;_0x12ed0e[_0x6f8e('0x9c')]=_0x6f8e('0xd9');_0x12ed0e[_0x6f8e('0xdc')]=_0x6f8e('0xda');this['saveInDb'](_0x12ed0e,_0x6f8e('0xf0'),'[syncHangupInAMDIvr]');}if(_0x1755cf['type']===_0x6f8e('0x6f')&&this[_0x6f8e('0x20')][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0xd5')]&&_0x133dda['value']===_0x6f8e('0xf1')){var _0x4eb435=this;return new BPromise(function(_0x5809ae,_0x2e42c9){delete _0x4eb435[_0x6f8e('0x24')][_0x133dda[_0x6f8e('0xd1')]];_0x4eb435[_0x6f8e('0xa5')](_0x4eb435[_0x6f8e('0x20')][_0x1755cf[_0x6f8e('0xa4')]]);_0x4eb435[_0x6f8e('0x20')][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0xd7')]+=0x1;_0x4eb435['campaigns'][_0x1755cf[_0x6f8e('0xa4')]][_0x6f8e('0x56')]+=0x1;var _0x4fc466=_0x4eb435[_0x6f8e('0x20')][_0x1755cf['queue']];var _0x1f4f91=new Hangup(_0x1755cf,_0x133dda);_0x1f4f91[_0x6f8e('0xd8')]=0x13;_0x1f4f91[_0x6f8e('0x9c')]=_0x6f8e('0xf2');_0x1f4f91['membername']='AMD';_0x1f4f91[_0x6f8e('0xdd')]+=0x1;_0x1f4f91['countglobal']+=0x1;_0x1f4f91['amd']=!![];_0x4eb435[_0x6f8e('0xbc')](_0x1f4f91)['catch'](loggerCatch(_0x6f8e('0xe0')));if(_0x1f4f91['countbusyretry']+_0x1f4f91[_0x6f8e('0xe2')]+_0x1f4f91['countnoanswerretry']+_0x1f4f91[_0x6f8e('0xe4')]+_0x1f4f91[_0x6f8e('0xe5')]+_0x1f4f91[_0x6f8e('0xe6')]+_0x1f4f91['countmachineretry']+_0x1f4f91[_0x6f8e('0xf3')]>=_0x4fc466['dialGlobalMaxRetry']){_0x4eb435[_0x6f8e('0xe7')](_0x1f4f91,_0x5809ae,_0x2e42c9,_0x6f8e('0xe8'));}else{if(_0x1f4f91[_0x6f8e('0xdd')]>=_0x4fc466[_0x6f8e('0xf4')]){_0x4eb435[_0x6f8e('0xe9')](_0x1f4f91,_0x5809ae,_0x2e42c9,_0x6f8e('0xea'));}else{_0x4eb435[_0x6f8e('0xb2')]({'active':![],'countmachineretry':_0x1f4f91[_0x6f8e('0xdd')],'scheduledat':moment()[_0x6f8e('0xeb')](_0x4fc466['dialMachineRetryFrequency'],'minutes')[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x1f4f91[_0x6f8e('0xc3')],'ListId':_0x1f4f91['ListId'],'VoiceQueueId':_0x1f4f91[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x1f4f91['CampaignId']||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xf5')));_0x5809ae({'reschedule':0x1});}}});}}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x31')]=function(_0x526cb5){var _0x1cf85c=this[_0x6f8e('0x24')][_0x526cb5['uniqueid']];var _0x25e160=this;var _0x29c1b2;if(_0x1cf85c&&_0x1cf85c[_0x6f8e('0x4f')]==='ivr'){delete this[_0x6f8e('0x24')][_0x526cb5[_0x6f8e('0xd1')]];this[_0x6f8e('0xa5')](this[_0x6f8e('0x20')][_0x1cf85c[_0x6f8e('0xa4')]]);this[_0x6f8e('0x20')][_0x1cf85c[_0x6f8e('0xa4')]]['ivrAnswerCallsDay']+=0x1;_0x29c1b2=new Hangup(_0x1cf85c,_0x526cb5);this[_0x6f8e('0xbc')](_0x29c1b2)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xf6')));this[_0x6f8e('0xba')](_0x29c1b2)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xf7')));}if(_0x1cf85c&&_0x1cf85c['type']!==_0x6f8e('0x6f')&&isNotNull(this[_0x6f8e('0x1f')][_0x1cf85c['queue']][_0x6f8e('0xf8')])){delete this[_0x6f8e('0x24')][_0x526cb5['uniqueid']];this[_0x6f8e('0xa5')](this[_0x6f8e('0x1f')][_0x1cf85c['queue']]);this['voiceQueues'][_0x1cf85c[_0x6f8e('0xa4')]][_0x6f8e('0xd7')]+=0x1;this['voiceQueues'][_0x1cf85c[_0x6f8e('0xa4')]][_0x6f8e('0x56')]+=0x1;_0x29c1b2=new Hangup(_0x1cf85c,_0x526cb5);_0x29c1b2[_0x6f8e('0xd8')]=0x10;_0x29c1b2['statedesc']=_0x6f8e('0xf9');_0x29c1b2[_0x6f8e('0xdc')]=_0x6f8e('0xfa');this[_0x6f8e('0xbc')](_0x29c1b2)[_0x6f8e('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6f8e('0xba')](_0x29c1b2)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xf7')));}if(_0x1cf85c&&_0x1cf85c['type']!==_0x6f8e('0x6f')&&!isNotNull(this[_0x6f8e('0x1f')][_0x1cf85c[_0x6f8e('0xa4')]][_0x6f8e('0xf8')])){delete this[_0x6f8e('0x24')][_0x526cb5[_0x6f8e('0xd1')]];this[_0x6f8e('0xa5')](this['voiceQueues'][_0x1cf85c['queue']]);this[_0x6f8e('0x1f')][_0x1cf85c[_0x6f8e('0xa4')]][_0x6f8e('0xfb')]+=0x1;_0x29c1b2=new Hangup(_0x1cf85c,_0x526cb5);_0x29c1b2[_0x6f8e('0xd8')]=0xc;_0x29c1b2[_0x6f8e('0x9c')]=_0x526cb5[_0x6f8e('0xfc')];_0x29c1b2[_0x6f8e('0xdc')]=_0x6f8e('0xfd');this['createHistory'](_0x29c1b2)[_0x6f8e('0xa3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x6f8e('0xba')](_0x29c1b2)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xf7')));}};Dialer[_0x6f8e('0x1a')]['syncAgentComplete']=function(_0x45fdb0){var _0xfe074d=this[_0x6f8e('0x24')][_0x45fdb0['uniqueid']];var _0xbef66c=this;if(this['voiceQueues'][_0x45fdb0[_0x6f8e('0xa4')]]){if(_0xfe074d&&_0xfe074d['type']!==_0x6f8e('0x6f')){delete this[_0x6f8e('0x24')][_0x45fdb0['uniqueid']];this[_0x6f8e('0x1f')][_0x45fdb0['queue']][_0x6f8e('0xd7')]+=0x1;var _0x1694ff=new AgentComplete(_0xfe074d,_0x45fdb0);if(_0x45fdb0['reason']===_0x6f8e('0xfe')){_0x1694ff[_0x6f8e('0xff')]=this[_0x6f8e('0x1f')][_0x45fdb0['queue']][_0x6f8e('0x100')]&&this[_0x6f8e('0x1f')][_0x45fdb0[_0x6f8e('0xa4')]]['dialAgiAfterHangupAgent']?moment()[_0x6f8e('0x6d')](_0x6f8e('0xee')):undefined;}this['createHistory'](_0x1694ff)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x101')));this[_0x6f8e('0xba')](_0x1694ff)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x102')));}}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x29')]=function(_0x504748){if(this['voiceQueues'][_0x504748[_0x6f8e('0xa4')]]){if(this[_0x6f8e('0x24')][_0x504748[_0x6f8e('0xd1')]]&&this[_0x6f8e('0x24')][_0x504748[_0x6f8e('0xd1')]][_0x6f8e('0x4f')]!==_0x6f8e('0x6f')){this[_0x6f8e('0xa5')](this[_0x6f8e('0x1f')][_0x504748[_0x6f8e('0xa4')]]);this[_0x6f8e('0x24')][_0x504748[_0x6f8e('0xd1')]][_0x6f8e('0x103')]=moment()[_0x6f8e('0x6d')](_0x6f8e('0xee'));}}};Dialer[_0x6f8e('0x1a')]['queueCallerAbandonCreateState']=function(_0xb39a99){this[_0x6f8e('0xbc')](_0xb39a99)['catch'](loggerCatch(_0x6f8e('0x101')));this['moveContactManagedDialer'](_0xb39a99)[_0x6f8e('0xa3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x2c')]=function(_0x4d6be6){var _0x27a782=this[_0x6f8e('0x24')][_0x4d6be6[_0x6f8e('0xd1')]];var _0x455ab2=this;if(this['voiceQueues'][_0x4d6be6['queue']]){if(_0x27a782&&_0x27a782[_0x6f8e('0x4f')]!==_0x6f8e('0x6f')){delete this[_0x6f8e('0x24')][_0x4d6be6[_0x6f8e('0xd1')]];this[_0x6f8e('0xa5')](this[_0x6f8e('0x1f')][_0x4d6be6[_0x6f8e('0xa4')]]);_0x27a782['droptime']=moment()[_0x6f8e('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37f928=new QueueCallerAbandon(_0x27a782,_0x4d6be6);if(getSeconds(_0x27a782[_0x6f8e('0x104')],_0x27a782['responsetime'])>=_0x27a782[_0x6f8e('0x105')]){this[_0x6f8e('0x1f')][_0x4d6be6['queue']][_0x6f8e('0x76')]+=0x1;this[_0x6f8e('0x1f')][_0x4d6be6[_0x6f8e('0xa4')]][_0x6f8e('0x59')]+=0x1;this['voiceQueues'][_0x4d6be6[_0x6f8e('0xa4')]][_0x6f8e('0x106')]+=0x1;_0x37f928[_0x6f8e('0xd8')]=0xa;_0x37f928[_0x6f8e('0x9c')]='Drop';_0x37f928[_0x6f8e('0x107')]=_0x6f8e('0x108');_0x37f928['agiafterat']=this[_0x6f8e('0x1f')][_0x4d6be6['queue']][_0x6f8e('0x100')]?moment()[_0x6f8e('0x6d')](_0x6f8e('0xee')):undefined;_0x37f928[_0x6f8e('0xe5')]+=0x1;_0x37f928[_0x6f8e('0xde')]+=0x1;if(_0x37f928[_0x6f8e('0xe5')]>=this[_0x6f8e('0x1f')][_0x4d6be6[_0x6f8e('0xa4')]]['dialDropMaxRetry']){this[_0x6f8e('0x109')](_0x37f928);}else{this[_0x6f8e('0xb2')]({'active':![],'countdropretry':_0x37f928[_0x6f8e('0xe5')],'scheduledat':moment()[_0x6f8e('0xeb')](this[_0x6f8e('0x1f')][_0x4d6be6[_0x6f8e('0xa4')]][_0x6f8e('0x10a')],_0x6f8e('0xed'))[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x27a782[_0x6f8e('0xc3')],'ListId':_0x27a782[_0x6f8e('0xc4')],'VoiceQueueId':_0x27a782['VoiceQueueId']||undefined,'CampaignId':_0x27a782['CampaignId']||undefined})['catch'](loggerCatch(_0x6f8e('0x10b')));var _0x2712dd=new History(_0x37f928);_0x2712dd[_0x6f8e('0xd8')]=0xa;_0x2712dd[_0x6f8e('0x9c')]=_0x6f8e('0x10c');_0x2712dd[_0x6f8e('0x10d')]=moment()[_0x6f8e('0x6d')](_0x6f8e('0xee'));_0x2712dd[_0x6f8e('0x9d')]=_0x2712dd['starttime'];_0x2712dd[_0x6f8e('0x10e')]=_0x37f928[_0x6f8e('0x10e')];_0x2712dd[_0x6f8e('0x10f')]=_0x37f928[_0x6f8e('0x10f')];this['createHistory'](_0x2712dd)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x110')));}}else{this[_0x6f8e('0x1f')][_0x4d6be6[_0x6f8e('0xa4')]][_0x6f8e('0x60')]+=0x1;this['voiceQueues'][_0x4d6be6['queue']][_0x6f8e('0x58')]+=0x1;_0x37f928[_0x6f8e('0xd8')]=0xb;_0x37f928[_0x6f8e('0x9c')]=_0x6f8e('0x111');_0x37f928['dropreason']=_0x6f8e('0x112');_0x37f928[_0x6f8e('0xe6')]+=0x1;_0x37f928[_0x6f8e('0xde')]+=0x1;if(_0x37f928[_0x6f8e('0xe6')]>=this[_0x6f8e('0x1f')][_0x4d6be6['queue']][_0x6f8e('0x113')]){this[_0x6f8e('0x109')](_0x37f928);}else{this[_0x6f8e('0xb2')]({'active':![],'countabandonedretry':_0x37f928[_0x6f8e('0xe6')],'scheduledat':moment()[_0x6f8e('0xeb')](this['voiceQueues'][_0x4d6be6[_0x6f8e('0xa4')]]['dialAbandonedRetryFrequency'],_0x6f8e('0xed'))[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x27a782['ContactId'],'ListId':_0x27a782['ListId'],'VoiceQueueId':_0x27a782[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x27a782[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x114')));var _0x2712dd=new History(_0x37f928);_0x2712dd[_0x6f8e('0xd8')]=0xb;_0x2712dd[_0x6f8e('0x9c')]=_0x6f8e('0x111');_0x2712dd[_0x6f8e('0x10d')]=moment()[_0x6f8e('0x6d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2712dd[_0x6f8e('0x9d')]=_0x2712dd[_0x6f8e('0x10d')];_0x2712dd[_0x6f8e('0x10e')]=_0x37f928[_0x6f8e('0x10e')];_0x2712dd[_0x6f8e('0x10f')]=_0x37f928[_0x6f8e('0x10f')];this[_0x6f8e('0xbc')](_0x2712dd)[_0x6f8e('0xa3')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x115')]=function(_0x579ea7){if(this['actions'][_0x579ea7[_0x6f8e('0xd1')]]){this[_0x6f8e('0x22')][_0x579ea7['uniqueid']][_0x6f8e('0xa2')]=_0x579ea7[_0x6f8e('0xa2')];}if(this[_0x6f8e('0x24')][_0x579ea7[_0x6f8e('0xd1')]]){this[_0x6f8e('0x24')][_0x579ea7[_0x6f8e('0xd1')]]['channel']=_0x579ea7[_0x6f8e('0xa2')];}};Dialer[_0x6f8e('0x1a')]['syncQueueMember']=function(_0x3f0291){if(strategy[this[_0x6f8e('0x1f')][this[_0x6f8e('0x22')][_0x3f0291[_0x6f8e('0x116')]][_0x6f8e('0xa4')]][_0x6f8e('0x49')]]===_0x6f8e('0x117')){if(this[_0x6f8e('0x22')][_0x3f0291[_0x6f8e('0x116')]]&&_[_0x6f8e('0xa0')](this[_0x6f8e('0x22')][_0x3f0291[_0x6f8e('0x116')]][_0x6f8e('0x118')])&&_0x3f0291[_0x6f8e('0xa1')]==='1'&&_0x3f0291[_0x6f8e('0x119')]==='0'){if(this[_0x6f8e('0x21')][_0x3f0291[_0x6f8e('0x11a')]]){if(!this['agents'][_0x3f0291['stateinterface']][_0x6f8e('0x118')]){this[_0x6f8e('0x21')][_0x3f0291[_0x6f8e('0x11a')]][_0x6f8e('0x118')]=!![];this['actions'][_0x3f0291[_0x6f8e('0x116')]]['locked']=!![];this[_0x6f8e('0x22')][_0x3f0291['actionid']][_0x6f8e('0x11a')]=_0x3f0291[_0x6f8e('0x11a')];}}}}else if((strategy[this[_0x6f8e('0x1f')][this['actions'][_0x3f0291[_0x6f8e('0x116')]][_0x6f8e('0xa4')]]['strategy']]||_0x6f8e('0x19'))==='rrmemory'){if(this['actions'][_0x3f0291[_0x6f8e('0x116')]]){if(this['agents'][_0x3f0291[_0x6f8e('0x11a')]]){this[_0x6f8e('0x22')][_0x3f0291[_0x6f8e('0x116')]][_0x6f8e('0x11a')]=_0x3f0291[_0x6f8e('0x11a')];if(_[_0x6f8e('0xa0')](this['queueBooked'][this[_0x6f8e('0x22')][_0x3f0291[_0x6f8e('0x116')]][_0x6f8e('0xa4')]])){this[_0x6f8e('0x11b')][this['actions'][_0x3f0291['actionid']]['queue']]=[];}this[_0x6f8e('0x11b')][this[_0x6f8e('0x22')][_0x3f0291['actionid']][_0x6f8e('0xa4')]]['push'](_[_0x6f8e('0x80')](_[_0x6f8e('0xc2')](this[_0x6f8e('0x22')][_0x3f0291[_0x6f8e('0x116')]],['idHopper',_0x6f8e('0x11a')]),{'status':_0x3f0291[_0x6f8e('0xa1')],'paused':_0x3f0291['paused']}));}}}};function unlockQueueStatus(_0x2fd55a,_0x1f9c26){setTimeout(function(){if(_['isUndefined'](_0x2fd55a['queueStatusComplete'])){loggerBooked[_0x6f8e('0x8a')](_0x6f8e('0x11c'),_0x1f9c26);}_0x2fd55a[_0x6f8e('0x11d')]=!![];loggerBooked[_0x6f8e('0x71')](_0x6f8e('0x11e'),_0x1f9c26,JSON[_0x6f8e('0x45')](_[_0x6f8e('0xc2')](_0x2fd55a,[_0x6f8e('0x40'),_0x6f8e('0x11d')])));},0x1f3);}Dialer[_0x6f8e('0x1a')][_0x6f8e('0x37')]=function(_0x342b9d){var _0x68780a=this;var _0x100844=_0x68780a[_0x6f8e('0x1f')][_0x68780a[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]];if(strategy[this[_0x6f8e('0x1f')][this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]]['queue']][_0x6f8e('0x49')]]===_0x6f8e('0x117')){if(this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]]&&this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0x11a')]){this['preview'][_0x6f8e('0x11f')](this['actions'][_0x342b9d[_0x6f8e('0x116')]]['idHopper'],this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0x11a')])['catch'](function(_0x229ea4){logger['error'](_0x6f8e('0x120'),util[_0x6f8e('0x89')](_0x229ea4,{'showHidden':![],'depth':null}));})[_0x6f8e('0x1d')](function(){_0x68780a[_0x6f8e('0xa5')](_0x68780a['voiceQueues'][_0x68780a[_0x6f8e('0x22')][_0x342b9d['actionid']][_0x6f8e('0xa4')]]);_0x68780a[_0x6f8e('0x21')][_0x68780a['actions'][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0x11a')]][_0x6f8e('0x118')]=![];delete _0x68780a[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]];unlockQueueStatus(_0x100844);});}else{this[_0x6f8e('0xa5')](this[_0x6f8e('0x1f')][this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]]);this[_0x6f8e('0xb2')]({'active':![],'ContactId':this['actions'][_0x342b9d[_0x6f8e('0x116')]]['ContactId'],'ListId':this[_0x6f8e('0x22')][_0x342b9d['actionid']][_0x6f8e('0xc4')],'VoiceQueueId':this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x6f8e('0x22')][_0x342b9d['actionid']][_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x121')));delete this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]];unlockQueueStatus(_0x100844);}}else if((strategy[this[_0x6f8e('0x1f')][this['actions'][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]][_0x6f8e('0x49')]]||'rrmemory')===_0x6f8e('0x19')){var _0x3bdfa0;if(this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]]&&!_['isEmpty'](this[_0x6f8e('0x11b')][this['actions'][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]])){if(this['queueBookedRR'][_0x68780a[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]]){this[_0x6f8e('0x27')][_0x68780a[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]]=this[_0x6f8e('0x27')][this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]]['queue']]?this[_0x6f8e('0x27')][this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]]['queue']]:this[_0x6f8e('0x11b')][this['actions'][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]]?this[_0x6f8e('0x11b')][this['actions'][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]][_0x6f8e('0x122')]||0x0:0x0;}this[_0x6f8e('0x11b')][this['actions'][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]][_0x6f8e('0x122')]=this['queueBookedRR'][this[_0x6f8e('0x22')][_0x342b9d[_0x6f8e('0x116')]][_0x6f8e('0xa4')]];for(var _0x4a6df0=0x0;_0x4a6df0=0x0;})[_0x6f8e('0xa3')](myreject(_0x333977)));}}else{_0x4ac639[_0x6f8e('0x136')](ami['Action']({'action':'command','command':util[_0x6f8e('0x6d')]('iftime\x20%s,%s',_0x1a42b3,!_[_0x6f8e('0x3a')](config[_0x6f8e('0x134')][_0x419cd8])?_0x419cd8:'')})[_0x6f8e('0xa9')](function(_0x434392){return _0x434392[_0x6f8e('0x13c')][_0x6f8e('0x13a')](_0x6f8e('0x13b'))>=0x0;})[_0x6f8e('0xa3')](myreject(_0x333977)));}BPromise[_0x6f8e('0x13d')](_0x4ac639)[_0x6f8e('0xa9')](function(_0x2816d5){var _0x3fc244=_[_0x6f8e('0x13e')](_0x2816d5);if(_0x3fc244){return _0x223834(_0x3fc244);}else{_0x6fecc4[_0x6f8e('0x3b')]=_0x5a3a15?_0x6f8e('0x13f'):_0x6f8e('0x140');return _0x333977(msgResponse(_0x6f8e('0x141'),'Failure',_0x6f8e('0x142')+_0x5a3a15+'\x20'+_0x5bdfaa+_0x6f8e('0x143')+util[_0x6f8e('0x89')](_0x1a42b3,{'showHidden':![],'depth':null})+_0x6f8e('0x144')+_0x419cd8));}})[_0x6f8e('0xa3')](function(_0x397a6c){return _0x333977(msgResponse(_0x6f8e('0x12e'),_0x6f8e('0x130'),JSON[_0x6f8e('0x45')](_0x397a6c)));});});};Dialer['prototype'][_0x6f8e('0x145')]=function(_0x4fae13){var _0xb19ff3=this;return function(){switch(_0x4fae13[_0x6f8e('0x146')]){case _0x6f8e('0x147'):freeVariablesPredictive(_0x4fae13);_0xb19ff3[_0x6f8e('0x148')](_0x4fae13,0x1);break;case _0x6f8e('0x149'):freeVariablesPredictive(_0x4fae13);_0xb19ff3['handlePower'](_0x4fae13,_0x4fae13[_0x6f8e('0x14a')]);break;case _0x6f8e('0x9'):_0xb19ff3[_0x6f8e('0x9')](_0x4fae13);break;case _0x6f8e('0x14b'):freeVariablesPredictive(_0x4fae13);_0xb19ff3[_0x6f8e('0x148')](_0x4fae13,0x1);break;default:freeVariablesPredictive(_0x4fae13);logger[_0x6f8e('0x8a')](_0x6f8e('0x14c'),_0x4fae13[_0x6f8e('0x40')],'method\x20not\x20recognized');}};};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x14d')]=function(_0x41e552){var _0x420e9a=this;return function(){_0x420e9a[_0x6f8e('0x14e')](_0x41e552);};};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xb')]=function(_0xb5ef3){var _0x477223=this;if(isNotPreview(_0xb5ef3[_0x6f8e('0x146')])){if(isVoiceQueueOutbound(_0xb5ef3[_0x6f8e('0x4f')])&&isActive(_0xb5ef3[_0x6f8e('0x53')])){_0xb5ef3['sendMessageOneNotActive']=!![];BPromise[_0x6f8e('0xa8')]()['then'](checkIsLoggedIn(_0xb5ef3,_0xb5ef3[_0x6f8e('0x14f')]))[_0x6f8e('0xa9')](checkIsActive(_0xb5ef3,_0xb5ef3[_0x6f8e('0x53')]))[_0x6f8e('0xa9')](checkInterval(_0xb5ef3))['then'](_0x477223[_0x6f8e('0x150')](_0xb5ef3))[_0x6f8e('0xa9')](_0x477223['checkIfTime'](_0xb5ef3[_0x6f8e('0x151')],_0xb5ef3['dialTimezone'],_0xb5ef3['name'],_0xb5ef3))[_0x6f8e('0xa9')](_0x477223[_0x6f8e('0x12f')](_0xb5ef3['Interval'],_0xb5ef3['dialTimezone'],_0xb5ef3[_0x6f8e('0x40')],_0xb5ef3))['then'](_0x477223[_0x6f8e('0x145')](_0xb5ef3))[_0x6f8e('0xa3')](loggerCatchQueueSummary(_0x6f8e('0x152'),_0xb5ef3));}else{notSendMessagesQueue(_0xb5ef3);}}else{freeVariablesPredictive(_0xb5ef3);}};Dialer[_0x6f8e('0x1a')]['syncCampaigns']=function(){var _0x5aa467=this;var _0xecc04f;for(var _0x4edc0c in this[_0x6f8e('0x20')]){if(typeof this[_0x6f8e('0x20')][_0x4edc0c]!=='undefined'){_0xecc04f=this[_0x6f8e('0x20')][_0x4edc0c];if(isCampaignIvr(_0xecc04f['type'])&&isActive(_0xecc04f[_0x6f8e('0xcb')])){_0xecc04f[_0x6f8e('0x96')]=!![];BPromise['resolve']()[_0x6f8e('0xa9')](checkIsActive(_0xecc04f,_0xecc04f['active']))[_0x6f8e('0xa9')](checkInterval(_0xecc04f))[_0x6f8e('0xa9')](_0x5aa467[_0x6f8e('0x150')](_0xecc04f))['then'](_0x5aa467[_0x6f8e('0x12d')](_0xecc04f['dialGlobalInterval'],_0xecc04f[_0x6f8e('0x153')],_0xecc04f[_0x6f8e('0x40')],_0xecc04f))[_0x6f8e('0xa9')](_0x5aa467['checkIfTimeIntervals'](_0xecc04f[_0x6f8e('0x3e')],_0xecc04f[_0x6f8e('0x153')],_0xecc04f[_0x6f8e('0x40')],_0xecc04f))[_0x6f8e('0xa9')](_0x5aa467[_0x6f8e('0x14d')](_0xecc04f))[_0x6f8e('0xa3')](loggerCatchQueueSummary(_0x6f8e('0x154'),_0xecc04f));}else{notSendMessagesCampaign(_0xecc04f);}}}};function getCallerIdRandom(_0x3fa1e7,_0x5eeccb){var _0x427556;var _0xf9f7b9;var _0x2dc686;if(_0x5eeccb<=0x0){_0x5eeccb=0x1;}_0x427556=new RegExp(_0x6f8e('0x155')+_0x5eeccb+'}$');_0xf9f7b9=Math['pow'](0xa,_0x5eeccb-0x1);_0x2dc686=Math[_0x6f8e('0x156')](0xa,_0x5eeccb)-0x1;return util[_0x6f8e('0x6d')]('%s',_[_0x6f8e('0x157')](_0x3fa1e7,_0x427556,_[_0x6f8e('0x158')](_0xf9f7b9,_0x2dc686)));}function extractCalleridName(_0x3f17f8){var _0x4a8201=_0x3f17f8['match'](/"(.*?)"/);return _0x4a8201?_0x4a8201[0x1]:_0x3f17f8;}function extractCalleridNumber(_0x5e96ab){var _0x23ccf8=_0x5e96ab[_0x6f8e('0x159')](/<(.*?)>/);return _0x23ccf8?_0x23ccf8[0x1]:_0x5e96ab;}Dialer[_0x6f8e('0x1a')][_0x6f8e('0x15a')]=function(_0x19d6e7,_0x54fd2c){var _0x225d1b=this;var _0x55bd8f=uuid['v4']();this[_0x6f8e('0x22')][_0x55bd8f]=new Action(_0x19d6e7,_0x54fd2c,_0x55bd8f);return new BPromise(function(_0x2b78d0,_0x2d4d97){if(_[_0x6f8e('0x3a')](_0x19d6e7)&&typeof _0x19d6e7!==_0x6f8e('0x15b')){return _0x2d4d97(msgResponse(_0x6f8e('0x15c'),'Failure',_0x6f8e('0x15d')));}if(_[_0x6f8e('0x3a')](_0x54fd2c['Contact'][_0x6f8e('0x15e')])||_0x54fd2c['Contact']['phone']===null){return _0x2d4d97(msgResponse('originate',_0x6f8e('0x130'),'contact\x20is\x20undefine'));}var _0x2bcd6a={'XMD-CALLERID':_0x225d1b['actions'][_0x55bd8f][_0x6f8e('0x15f')](),'XMD-AGI':_0x19d6e7[_0x6f8e('0xf8')]?util['format'](_0x6f8e('0x160'),ipAgi,_0x19d6e7['dialQueueProject']):_0x6f8e('0x161'),'XMD-AGIAFTER':_0x19d6e7['dialQueueProject2']?util[_0x6f8e('0x6d')](_0x6f8e('0x160'),ipAgi,_0x19d6e7[_0x6f8e('0x100')]):_0x6f8e('0x161'),'XMD-QUEUE':_0x19d6e7[_0x6f8e('0x4f')]===_0x6f8e('0x48')?util[_0x6f8e('0x6d')](_0x6f8e('0x162'),_0x19d6e7['name'],_0x19d6e7['dialQueueOptions']||'',_0x19d6e7[_0x6f8e('0x163')]?'c':'',_0x19d6e7[_0x6f8e('0x105')]||0x3):_0x6f8e('0x161'),'XMD-CONTACTID':_0x54fd2c[_0x6f8e('0xc3')],'XMD-CDRTYPE':_0x6f8e('0x164'),'CALLERID(all)':_0x225d1b['actions'][_0x55bd8f][_0x6f8e('0x15f')](),'XMD-AMD':_0x19d6e7[_0x6f8e('0xd5')]?'ACTIVE':_0x6f8e('0x161'),'XMD-DESTINATION':_0x6f8e('0x165')};if(_0x19d6e7[_0x6f8e('0xd5')]){_0x2bcd6a[_0x6f8e('0x166')]=_0x19d6e7[_0x6f8e('0x167')]||0x9c4;_0x2bcd6a[_0x6f8e('0x168')]=_0x19d6e7[_0x6f8e('0x169')]||0x5dc;_0x2bcd6a[_0x6f8e('0x16a')]=_0x19d6e7[_0x6f8e('0x16b')]||0x320;_0x2bcd6a[_0x6f8e('0x16c')]=_0x19d6e7['dialAMDTotalAnalysisTime']||0x1388;_0x2bcd6a['XMD-AMDMINWORDLENGTH']=_0x19d6e7['dialAMDMinWordLength']||0x64;_0x2bcd6a[_0x6f8e('0x16d')]=_0x19d6e7[_0x6f8e('0x16e')]||0x32;_0x2bcd6a[_0x6f8e('0x16f')]=_0x19d6e7[_0x6f8e('0x170')]||0x3;_0x2bcd6a[_0x6f8e('0x171')]=_0x19d6e7['dialAMDSilenceThreshold']||0x100;_0x2bcd6a[_0x6f8e('0x172')]=_0x19d6e7[_0x6f8e('0x173')]||0x1388;}if(_0x19d6e7['type']==='outbound'){_0x2bcd6a[_0x6f8e('0x174')]=_0x54fd2c[_0x6f8e('0xc5')];}else{_0x2bcd6a[_0x6f8e('0x175')]=_0x54fd2c['CampaignId'];}for(var _0x539190 in _0x54fd2c[_0x6f8e('0x176')]){if(typeof _0x54fd2c['Contact'][_0x539190]!==_0x6f8e('0x8d')){if(isNotNull(_0x54fd2c[_0x6f8e('0x176')][_0x539190])&&_0x539190!=='id'&&_0x539190!==_0x6f8e('0x177')&&_0x539190!==_0x6f8e('0x178')&&_0x539190!=='updatedAt'){_0x2bcd6a[util['format'](_0x6f8e('0x179'),_0x6f8e('0x17a'),_[_0x6f8e('0x17b')](_0x539190))]=_0x54fd2c['Contact'][_0x539190];}}}var _0x569dfa=_0x225d1b['isTrunkReachable'](_0x19d6e7[_0x6f8e('0x6b')])?getCallerId(_0x19d6e7[_0x6f8e('0x6b')][_0x6f8e('0x6c')],_0x19d6e7['dialOriginateCallerIdName'],_0x19d6e7[_0x6f8e('0x17c')]>0x0?getCallerIdRandom(_0x19d6e7['dialOriginateCallerIdNumber'],_0x19d6e7[_0x6f8e('0x17c')]):_0x19d6e7[_0x6f8e('0x17d')]):getCallerId(_[_0x6f8e('0xa0')](_0x19d6e7[_0x6f8e('0x12b')])?_0x19d6e7[_0x6f8e('0x6b')][_0x6f8e('0x6c')]:_0x19d6e7[_0x6f8e('0x12b')]['callerid'],_0x19d6e7[_0x6f8e('0x17e')],_0x19d6e7[_0x6f8e('0x17c')]>0x0?getCallerIdRandom(_0x19d6e7['dialOriginateCallerIdNumber'],_0x19d6e7['dialRandomLastDigitCallerIdNumber']):_0x19d6e7[_0x6f8e('0x17d')]);if(_0x569dfa){_0x2bcd6a[_0x6f8e('0x17f')]=_0x225d1b[_0x6f8e('0x22')][_0x55bd8f][_0x6f8e('0x180')]=extractCalleridName(_0x569dfa);_0x2bcd6a[_0x6f8e('0x181')]=_0x225d1b[_0x6f8e('0x22')][_0x55bd8f][_0x6f8e('0x182')]=extractCalleridNumber(_0x569dfa);}return ami[_0x6f8e('0x137')]({'actionid':_0x55bd8f,'action':'originate','channel':_0x225d1b[_0x6f8e('0xca')](_0x19d6e7[_0x6f8e('0x6b')])?util['format'](_0x6f8e('0x183'),_0x19d6e7[_0x6f8e('0x6b')][_0x6f8e('0x40')],isNotNull(_0x19d6e7['dialPrefix'])?_0x19d6e7[_0x6f8e('0x55')][_0x6f8e('0x184')]()||'':'',_0x19d6e7['dialCutDigit']>0x0?_0x54fd2c[_0x6f8e('0x176')]['phone'][_0x6f8e('0x185')](_0x19d6e7['dialCutDigit']):_0x54fd2c[_0x6f8e('0x176')][_0x6f8e('0x15e')]):util['format'](_0x6f8e('0x183'),_[_0x6f8e('0xa0')](_0x19d6e7[_0x6f8e('0x12b')])?_0x19d6e7[_0x6f8e('0x6b')]['name']:_0x19d6e7[_0x6f8e('0x12b')][_0x6f8e('0x40')],isNotNull(_0x19d6e7[_0x6f8e('0x55')])?_0x19d6e7[_0x6f8e('0x55')][_0x6f8e('0x184')]()||'':'',_0x19d6e7['dialCutDigit']>0x0?_0x54fd2c[_0x6f8e('0x176')][_0x6f8e('0x15e')][_0x6f8e('0x185')](_0x19d6e7[_0x6f8e('0x186')]):_0x54fd2c[_0x6f8e('0x176')][_0x6f8e('0x15e')]),'callerid':_0x569dfa,'Exten':_0x6f8e('0x165'),'Context':_0x6f8e('0x187'),'Priority':'1','variable':_0x2bcd6a,'timeout':(_0x19d6e7[_0x6f8e('0x54')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55bd8f})[_0x6f8e('0xa9')](function(_0x8bc373){return _0x2b78d0(_0x8bc373);})[_0x6f8e('0xa3')](function(_0x5eae60){_0x19d6e7['outboundOriginateFailureCallsDay']+=0x1;var _0xf7f18d=new History(_0x225d1b[_0x6f8e('0x22')][_0x55bd8f]);logger['error'](util[_0x6f8e('0x6d')](_0x6f8e('0x188'),JSON['stringify'](_0x5eae60)));_0xf7f18d[_0x6f8e('0xd8')]=0xe;_0xf7f18d[_0x6f8e('0x9c')]=_0x6f8e('0x189');_0xf7f18d[_0x6f8e('0x10d')]=moment()[_0x6f8e('0x6d')](_0x6f8e('0xee'));_0xf7f18d[_0x6f8e('0x9d')]=_0xf7f18d[_0x6f8e('0x10d')];_0x225d1b[_0x6f8e('0xbc')](_0xf7f18d)['catch'](loggerCatch(_0x6f8e('0x18a')));_0x225d1b[_0x6f8e('0xba')](_0xf7f18d)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x18a')))[_0x6f8e('0x1d')](function(){delete _0x225d1b[_0x6f8e('0x22')][_0x55bd8f];return _0x2d4d97(msgResponse('originate',_0x6f8e('0x44'),'originate\x20action\x20Error'));});});});};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x18b')]=function(_0x2f5eef){var _0xdcb0b6=this[_0x6f8e('0x22')][_0x2f5eef[_0x6f8e('0x116')]];if(_0xdcb0b6){delete this[_0x6f8e('0x22')][_0x2f5eef[_0x6f8e('0x116')]];_0xdcb0b6['responsetime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x50b50a=_0xdcb0b6[_0x6f8e('0x4f')]===_0x6f8e('0x6f')?this[_0x6f8e('0x20')][_0xdcb0b6[_0x6f8e('0xa4')]]:this['voiceQueues'][_0xdcb0b6[_0x6f8e('0x18c')]()];if(!this[_0x6f8e('0xc8')](_0x2f5eef[_0x6f8e('0x18d')])){this[_0x6f8e('0xa5')](_0x50b50a);return this[_0x6f8e('0x18e')](_0xdcb0b6,_0x50b50a,_0x2f5eef)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x18f')));}this[_0x6f8e('0x24')][_0x2f5eef[_0x6f8e('0xd1')]]=_0xdcb0b6;}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x190')]=function(_0x501dac,_0x594a19,_0x1382a1){var _0x16f515=new History(_0x594a19);if(_0x16f515['countbusyretry']+_0x16f515['countcongestionretry']+_0x16f515[_0x6f8e('0xe3')]+_0x16f515[_0x6f8e('0xe4')]+_0x16f515[_0x6f8e('0xe5')]+_0x16f515[_0x6f8e('0xe6')]+_0x16f515[_0x6f8e('0xdd')]+_0x16f515[_0x6f8e('0xf3')]>=_0x1382a1['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x501dac){case 0x3:if(_0x16f515['countnoanswerretry']>=_0x1382a1[_0x6f8e('0x191')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x16f515[_0x6f8e('0xe3')]+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1[_0x6f8e('0x192')],_0x6f8e('0xed'))['format'](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515['ListId'],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x16f515[_0x6f8e('0xe1')]>=_0x1382a1[_0x6f8e('0x193')]-0x1){return!![];}this[_0x6f8e('0xb2')]({'active':![],'countbusyretry':_0x16f515[_0x6f8e('0xe1')]+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1[_0x6f8e('0x194')],_0x6f8e('0xed'))[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515[_0x6f8e('0xc4')],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x16f515[_0x6f8e('0xe2')]>=_0x1382a1[_0x6f8e('0x195')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x16f515[_0x6f8e('0xe2')]+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1[_0x6f8e('0x196')],_0x6f8e('0xed'))['format'](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515[_0x6f8e('0xc4')],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515[_0x6f8e('0xc6')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x16f515[_0x6f8e('0xe4')]>=_0x1382a1[_0x6f8e('0x197')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x16f515[_0x6f8e('0xe4')]+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1['dialNoSuchNumberRetryFrequency'],_0x6f8e('0xed'))['format'](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515['ListId'],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515['CampaignId']||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x198')));}break;case 0xa:if(_0x16f515[_0x6f8e('0xe5')]>=_0x1382a1[_0x6f8e('0x199')]-0x1){return!![];}this[_0x6f8e('0xb2')]({'active':![],'countdropretry':_0x16f515[_0x6f8e('0xe5')]+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1['dialDropRetryFrequency'],_0x6f8e('0xed'))[_0x6f8e('0x6d')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x16f515['ContactId'],'ListId':_0x16f515[_0x6f8e('0xc4')],'VoiceQueueId':_0x16f515['VoiceQueueId']||undefined,'CampaignId':_0x16f515['CampaignId']||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x10b')));break;case 0xb:if(_0x16f515[_0x6f8e('0xe6')]>=_0x1382a1[_0x6f8e('0x113')]-0x1){return!![];}this[_0x6f8e('0xb2')]({'active':![],'countabandonedretry':_0x16f515['countabandonedretry']+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1[_0x6f8e('0x19a')],_0x6f8e('0xed'))[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515[_0x6f8e('0xc4')],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x114')));break;case 0x13:if(_0x16f515[_0x6f8e('0xdd')]>=_0x1382a1['dialMachineMaxRetry']-0x1){return!![];}this[_0x6f8e('0xb2')]({'active':![],'countmachineretry':_0x16f515['countmachineretry']+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1[_0x6f8e('0xec')],'minutes')[_0x6f8e('0x6d')](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515['ListId'],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xf5')));break;case 0x14:if(_0x16f515[_0x6f8e('0xf3')]>=_0x1382a1[_0x6f8e('0x19b')]-0x1){return!![];}this[_0x6f8e('0xb2')]({'active':![],'countagentrejectretry':_0x16f515[_0x6f8e('0xf3')]+=0x1,'scheduledat':moment()[_0x6f8e('0xeb')](_0x1382a1['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x6f8e('0xee')),'ContactId':_0x16f515[_0x6f8e('0xc3')],'ListId':_0x16f515[_0x6f8e('0xc4')],'VoiceQueueId':_0x16f515[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x16f515[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x18e')]=function(_0x312080,_0x106ca7,_0x48858f){var _0x501a20=this;var _0x13b892=new History(_0x312080);return new BPromise(function(_0x320bdf,_0x4ce273){if(_['isUndefined'](_0x106ca7)&&typeof _0x106ca7!==_0x6f8e('0x15b')){return _0x4ce273(msgResponse(_0x6f8e('0x19c'),_0x6f8e('0x130'),_0x6f8e('0x19d')));}if(_['isUndefined'](_0x48858f)&&typeof _0x48858f!==_0x6f8e('0x15b')){return _0x4ce273(msgResponse(_0x6f8e('0x19c'),_0x6f8e('0x130'),'evt\x20is\x20undefine'));}switch(_0x48858f[_0x6f8e('0x19e')]){case'0':_0x106ca7['outboundNoSuchCallsDay']+=0x1;_0x13b892['state']=0x0;_0x13b892['statedesc']=_0x6f8e('0x19f');_0x13b892['countnosuchnumberretry']+=0x1;_0x13b892[_0x6f8e('0xde')]+=0x1;ami[_0x6f8e('0x47')](_0x6f8e('0x1a0'),ut[_0x6f8e('0x1a1')](_0x312080,'nosuchnumber'));_0x501a20[_0x6f8e('0xbc')](_0x13b892)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xe0')));if(_0x501a20[_0x6f8e('0x190')](0x0,_0x312080,_0x106ca7)){if(_0x13b892['countnosuchnumberretry']>=_0x106ca7['dialNoSuchNumberMaxRetry']){_0x501a20['createStateFinal'](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1a2'));}else{_0x501a20['stateGlobal'](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1a2'));}}break;case'3':_0x106ca7[_0x6f8e('0x5a')]+=0x1;_0x13b892[_0x6f8e('0xd8')]=0x3;_0x13b892[_0x6f8e('0x9c')]=_0x6f8e('0x1a3');_0x13b892['countnoanswerretry']+=0x1;_0x13b892[_0x6f8e('0xde')]+=0x1;ami[_0x6f8e('0x47')]('custom:agentnoanswer',ut[_0x6f8e('0x1a1')](_0x312080,'noanswer'));_0x501a20['createHistory'](_0x13b892)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x1a4')));if(_0x501a20[_0x6f8e('0x190')](0x3,_0x312080,_0x106ca7)){if(_0x13b892[_0x6f8e('0xe3')]>=_0x106ca7['dialNoAnswerMaxRetry']){_0x501a20[_0x6f8e('0xe9')](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1a5'));}else{_0x501a20[_0x6f8e('0xe7')](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1a5'));}}break;case'5':_0x106ca7[_0x6f8e('0x57')]+=0x1;_0x13b892[_0x6f8e('0xd8')]=0x5;_0x13b892[_0x6f8e('0x9c')]=_0x6f8e('0x1a6');_0x13b892[_0x6f8e('0xe1')]+=0x1;_0x13b892[_0x6f8e('0xde')]+=0x1;ami[_0x6f8e('0x47')](_0x6f8e('0x1a7'),ut['buildObj'](_0x312080,_0x6f8e('0x1a8')));_0x501a20[_0x6f8e('0xbc')](_0x13b892)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x1a9')));if(_0x501a20[_0x6f8e('0x190')](0x5,_0x312080,_0x106ca7)){if(_0x13b892[_0x6f8e('0xe1')]>=_0x106ca7['dialBusyMaxRetry']){_0x501a20[_0x6f8e('0xe9')](_0x13b892,_0x320bdf,_0x4ce273,'reason\x205\x20busy');}else{_0x501a20[_0x6f8e('0xe7')](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1aa'));}}break;case'8':_0x106ca7['outboundCongestionCallsDay']+=0x1;_0x13b892[_0x6f8e('0xd8')]=0x8;_0x13b892[_0x6f8e('0x9c')]=_0x6f8e('0x1ab');_0x13b892[_0x6f8e('0xe2')]+=0x1;_0x13b892[_0x6f8e('0xde')]+=0x1;ami[_0x6f8e('0x47')](_0x6f8e('0x1ac'),ut[_0x6f8e('0x1a1')](_0x312080,_0x6f8e('0x1ad')));_0x501a20[_0x6f8e('0xbc')](_0x13b892)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x1ae')));if(_0x501a20['checkRetriveMax'](0x8,_0x312080,_0x106ca7)){if(_0x13b892['countcongestionretry']>=_0x106ca7[_0x6f8e('0x195')]){_0x501a20[_0x6f8e('0xe9')](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1af'));}else{_0x501a20[_0x6f8e('0xe7')](_0x13b892,_0x320bdf,_0x4ce273,'reason\x208\x20congestion');}}break;case'11':_0x106ca7[_0x6f8e('0x1b0')]+=0x1;_0x13b892[_0x6f8e('0xd8')]=0xb;_0x13b892[_0x6f8e('0x9c')]='Abandoned';_0x13b892['countabandonedretry']+=0x1;_0x13b892['countglobal']+=0x1;_0x501a20[_0x6f8e('0xbc')](_0x13b892)[_0x6f8e('0xa3')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x501a20[_0x6f8e('0x190')](0xb,_0x312080,_0x106ca7)){if(_0x13b892[_0x6f8e('0xe6')]>=_0x106ca7[_0x6f8e('0x113')]){_0x501a20['createStateFinal'](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1b1'));}else{_0x501a20[_0x6f8e('0xe7')](_0x13b892,_0x320bdf,_0x4ce273,_0x6f8e('0x1b1'));}}break;case'20':_0x106ca7[_0x6f8e('0x5d')]+=0x1;_0x13b892[_0x6f8e('0xd8')]=0x14;_0x13b892[_0x6f8e('0x9c')]=_0x6f8e('0x1b2');_0x13b892['countagentrejectretry']+=0x1;_0x13b892[_0x6f8e('0xde')]+=0x1;ami[_0x6f8e('0x47')]('custom:agentreject',ut[_0x6f8e('0x1a1')](_0x312080,'agentreject'));_0x501a20[_0x6f8e('0xbc')](_0x13b892)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x1b3')));if(_0x501a20['checkRetriveMax'](0x14,_0x312080,_0x106ca7)){if(_0x13b892['countagentrejectretry']>=_0x106ca7[_0x6f8e('0x19b')]){_0x501a20[_0x6f8e('0xe9')](_0x13b892,_0x320bdf,_0x4ce273,'reason\x2020\x20agentreject');}else{_0x501a20[_0x6f8e('0xe7')](_0x13b892,_0x320bdf,_0x4ce273,'reason\x2020\x20agentreject');}}break;default:_0x106ca7[_0x6f8e('0xfb')]+=0x1;_0x13b892['state']=0xc;_0x13b892['statedesc']=_0x48858f[_0x6f8e('0x19e')];_0x501a20['createHistory'](_0x13b892)[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x1b4')));if(_0x501a20[_0x6f8e('0x190')](_0x48858f['reason'],_0x312080,_0x106ca7)){if(_0x13b892[_0x6f8e('0xe1')]+_0x13b892[_0x6f8e('0xe2')]+_0x13b892['countnoanswerretry']+_0x13b892[_0x6f8e('0xe4')]+_0x13b892[_0x6f8e('0xe5')]+_0x13b892['countabandonedretry']+_0x13b892[_0x6f8e('0xdd')]+_0x13b892['countagentrejectretry']>=_0x106ca7[_0x6f8e('0x1b5')]){_0x501a20[_0x6f8e('0xe7')](_0x13b892,_0x320bdf,_0x4ce273,_0x48858f[_0x6f8e('0x19e')]);}else{_0x501a20[_0x6f8e('0xe9')](_0x13b892,_0x320bdf,_0x4ce273,_0x48858f[_0x6f8e('0x19e')]);}}}});};Dialer[_0x6f8e('0x1a')][_0x6f8e('0xe7')]=function(_0x2ef2dd,_0x1e7c29,_0x4ac13e,_0x4c28a9){var _0xafdcb1=new Final(_0x2ef2dd);_0xafdcb1[_0x6f8e('0xd8')]=0xf;_0xafdcb1[_0x6f8e('0x9c')]='Global';this['createStateFinal'](_0xafdcb1,_0x1e7c29,_0x4ac13e,_0x4c28a9);};Dialer['prototype'][_0x6f8e('0xe9')]=function(_0x1f96a0,_0x613f2e,_0x2c2586,_0x41a8ee){this['moveContactManagedDialer'](_0x1f96a0)['then'](function(){return _0x613f2e(msgResponse(_0x6f8e('0x19c'),_0x6f8e('0xc9'),_0x41a8ee));})['catch'](function(){return _0x2c2586(msgResponse(_0x6f8e('0x1b6'),_0x6f8e('0x130'),_0x6f8e('0x1b7')));});};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x9')]=function(_0x167cd9){var _0x45c070=_0x167cd9[_0x6f8e('0x1b8')]/0x64;var _0xc2e901=_0x167cd9[_0x6f8e('0x59')]/(_0x167cd9[_0x6f8e('0x59')]+_0x167cd9['outboundAnswerCallsDay']);var _0x292ef5=Math[_0x6f8e('0x1b9')](_0x167cd9[_0x6f8e('0x64')]*(_0x167cd9[_0x6f8e('0x1ba')]/0x64));var _0x43b967=Math[_0x6f8e('0x1b9')](_0x167cd9[_0x6f8e('0x64')]*(_0x167cd9['predictiveIntervalMinThreshold']/0x64));var _0x5ec44c=_0x167cd9['available']+_0x167cd9['talking'];var _0x2929d4=Math['floor'](_0x167cd9[_0x6f8e('0x66')]*_0x167cd9['erlangAbandonmentRate']*_0x167cd9[_0x6f8e('0x62')]*_0x167cd9[_0x6f8e('0x63')]);if(_[_0x6f8e('0x3a')](_0x167cd9[_0x6f8e('0x6a')])){if(!_[_0x6f8e('0x3a')](_0x167cd9[_0x6f8e('0x25')])){_0x167cd9[_0x6f8e('0x25')]=undefined;loggerPredictive[_0x6f8e('0x8a')](_0x6f8e('0x1bb'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x6f8e('0x3a')](_0x167cd9[_0x6f8e('0x84')])){loggerPredictive['error'](_0x6f8e('0x1bb'),_0x6f8e('0x1bc'));clearInterval(_0x167cd9[_0x6f8e('0x84')]);_0x167cd9['handlePredictive']=undefined;}_0x167cd9[_0x6f8e('0x6a')]=moment()['format'](_0x6f8e('0xee'));loggerPredictive[_0x6f8e('0x71')](_0x167cd9['name'],_0x6f8e('0x1bd'),_0x167cd9['startProgressive']);this['handlePower'](_0x167cd9,0x1);}else if(ifInterval(_0x167cd9['dialPredictiveInterval'],_0x167cd9[_0x6f8e('0x6a')])){this[_0x6f8e('0x148')](_0x167cd9,0x1);loggerPredictiveCalls[_0x6f8e('0x71')](_0x6f8e('0x1be'),_0x167cd9[_0x6f8e('0x6a')],_0x167cd9[_0x6f8e('0x40')]);_0x167cd9[_0x6f8e('0x66')]=0x0;_0x167cd9[_0x6f8e('0x106')]=0x0;}else if(_0x45c070<_0xc2e901&&_0x167cd9['dialPredictiveOptimization']===_0x6f8e('0x1bf')){freeVariablesPredictive(_0x167cd9);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x1c0'),_0x6f8e('0x1c1'),_0xc2e901,_0x6f8e('0x6a'),_0x167cd9[_0x6f8e('0x40')]);}else if(_0x2929d4<_0x167cd9['predictiveIntervalErlangCallsDroppedCalls']&&_0x167cd9['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x167cd9);loggerPredictive[_0x6f8e('0x71')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x2929d4,_0x6f8e('0x1c2'),_0x167cd9['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x167cd9['name']);}else if(!ifInterval(_0x167cd9['dialPredictiveInterval'],_0x167cd9[_0x6f8e('0x6a')])&&_[_0x6f8e('0x3a')](_0x167cd9[_0x6f8e('0x25')])&&!_[_0x6f8e('0x3a')](_0x167cd9[_0x6f8e('0x6a')])){_0x167cd9[_0x6f8e('0x25')]=moment()[_0x6f8e('0x6d')](_0x6f8e('0xee'));loggerPredictive[_0x6f8e('0x71')](_0x167cd9['name'],_0x6f8e('0x1c3'),_0x167cd9['startPredictive']);this[_0x6f8e('0xaf')](_0x167cd9[_0x6f8e('0x1c4')])[_0x6f8e('0xa9')](this[_0x6f8e('0x1c5')](_0x167cd9))[_0x6f8e('0xa9')](mergeDataErlangB(_0x167cd9))[_0x6f8e('0xa9')](this[_0x6f8e('0x1c6')](_0x167cd9))[_0x6f8e('0xa3')](loggerCatchPredictive(_0x6f8e('0x1c7'),_0x167cd9));}else if(!ifInterval(_0x167cd9['dialPredictiveInterval'],_0x167cd9[_0x6f8e('0x25')])){_0x167cd9['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x167cd9['startPredictive']=moment()[_0x6f8e('0x6d')](_0x6f8e('0xee'));loggerPredictive[_0x6f8e('0x71')](_0x167cd9['name'],_0x6f8e('0x1c8'),_0x167cd9['startPredictive']);clearInterval(_0x167cd9['handlePredictive']);_0x167cd9[_0x6f8e('0x84')]=undefined;this[_0x6f8e('0xaf')](_0x167cd9['dialPredictiveInterval'])['then'](this[_0x6f8e('0x1c5')](_0x167cd9))[_0x6f8e('0xa9')](mergeDataErlangB(_0x167cd9))[_0x6f8e('0xa9')](this[_0x6f8e('0x1c6')](_0x167cd9))[_0x6f8e('0xa3')](loggerCatchPredictive(_0x6f8e('0x1c9'),_0x167cd9));}else if(_0x167cd9[_0x6f8e('0x64')]&&_0x5ec44c<_0x167cd9['predictiveIntervalAvailable']-_0x43b967){freeVariablesPredictive(_0x167cd9);loggerPredictive[_0x6f8e('0x71')](_0x167cd9['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x5ec44c,_0x6f8e('0x1ca'),_0x167cd9[_0x6f8e('0x64')],'-',_0x43b967,'=',_0x167cd9[_0x6f8e('0x64')]-_0x43b967,')');}else if(_0x167cd9['predictiveIntervalAvailable']&&_0x5ec44c>_0x167cd9['predictiveIntervalAvailable']+_0x292ef5){freeVariablesPredictive(_0x167cd9);loggerPredictive[_0x6f8e('0x71')](_0x167cd9[_0x6f8e('0x40')],_0x6f8e('0x1cb'),_0x5ec44c,')\x20are\x20more\x20than\x20threshold\x20(',_0x167cd9[_0x6f8e('0x64')],'+',_0x292ef5,'=',_0x167cd9[_0x6f8e('0x64')]+_0x292ef5,')');}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x1c5')]=function(_0x17d284){var _0x4c8482=this;return function(_0x519dc5){return new BPromise(function(_0x5a0515,_0x47e3ef){_[_0x6f8e('0x80')](_0x17d284,_0x519dc5[0x0]);if(checkGetDataPredictive(_0x519dc5[0x0])){var _0x527ae7=_0x17d284['predictiveIntervalAvailable']=_0x17d284[_0x6f8e('0x97')]+_0x17d284[_0x6f8e('0x4b')];var _0x5955ea=_0x17d284['dialPredictiveInterval']*0x3c;var _0x4b8d91=_0x519dc5[0x0][_0x6f8e('0x79')]+_0x519dc5[0x0]['predictiveIntervalAvgHoldtime'];var _0x11b907=(_0x519dc5[0x0][_0x6f8e('0x5e')]+_0x519dc5[0x0][_0x6f8e('0x76')]+_0x519dc5[0x0][_0x6f8e('0x60')])/_0x519dc5[0x0]['predictiveIntervalTotalCalls'];_0x17d284['predictiveIntervalHitRate']=_0x11b907>0x0?_0x11b907:0x1;switch(_0x17d284[_0x6f8e('0x1cc')]){case'dropRate':var _0x14739e=_0x17d284[_0x6f8e('0x1b8')]/0x64;return _0x4c8482[_0x6f8e('0x1cd')](_0x527ae7,_0x5955ea,_0x4b8d91,_0x11b907,_0x14739e)[_0x6f8e('0xa9')](function(_0x1d737a){return _0x5a0515(_0x1d737a);});case _0x6f8e('0x1ce'):var _0x243f6c=_0x17d284[_0x6f8e('0x1b8')]/0x64;return _0x4c8482[_0x6f8e('0x1cf')](_0x527ae7,_0x5955ea,_0x4b8d91,_0x11b907,_0x243f6c)[_0x6f8e('0xa9')](function(_0x185380){return _0x5a0515(_0x185380);});default:return _0x47e3ef(msgResponse(_0x6f8e('0x1d0'),'Failure','Unknown\x20Predictive'));}}else{return _0x47e3ef(msgResponse(_0x6f8e('0x1d0'),_0x6f8e('0x130'),_0x6f8e('0x1d1')));}});};};Dialer['prototype'][_0x6f8e('0x1d2')]=function(_0x22be87){var _0x130fbd=this;return function(_0x186870){return new BPromise(function(_0x1cd023,_0x3a53fd){_[_0x6f8e('0x80')](_0x22be87,_0x186870[0x0]);if(checkGetDataPredictive(_0x186870[0x0])){loggerPredictive[_0x6f8e('0x71')](JSON['stringify'](_0x186870[0x0]));if(_0x22be87[_0x6f8e('0x1cc')]===_0x6f8e('0x1bf')){return _0x130fbd['getVoiceQueueRtPauses'](_0x22be87['id'])[_0x6f8e('0xa9')](function(_0x1f864e){var _0x454991=_0x22be87[_0x6f8e('0x14f')]-_0x1f864e[0x0][_0x6f8e('0x1d3')];var _0x5a268f=_0x22be87['dialPredictiveInterval']*0x3c;var _0x5a40a7=_0x186870[0x0][_0x6f8e('0x79')]+_0x186870[0x0][_0x6f8e('0x5f')];var _0x4fb523=(_0x186870[0x0][_0x6f8e('0x5e')]+_0x186870[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x186870[0x0][_0x6f8e('0x60')])/_0x186870[0x0]['predictiveIntervalTotalCalls'];var _0x40b3fa=_0x22be87[_0x6f8e('0x1b8')]/0x64;_0x22be87[_0x6f8e('0x1d4')]=_0x1f864e[0x0][_0x6f8e('0x1d3')]||0x0;_0x22be87[_0x6f8e('0x62')]=_0x4fb523>0x0?_0x4fb523:0x1;return _0x130fbd[_0x6f8e('0x1cd')](_0x454991,_0x5a268f,_0x5a40a7,_0x4fb523,_0x40b3fa);})[_0x6f8e('0xa9')](function(_0x40de9e){return _0x1cd023(_0x40de9e);})[_0x6f8e('0xa3')](function(_0x78b932){return _0x3a53fd(msgResponse(_0x6f8e('0x1d5'),_0x6f8e('0x130'),JSON[_0x6f8e('0x45')](_0x78b932)));});}if(_0x22be87[_0x6f8e('0x1cc')]==='agentBusyFactor'){return _0x130fbd[_0x6f8e('0xb8')](_0x22be87['id'])[_0x6f8e('0xa9')](function(_0x5d91af){var _0x4ff5ea=_0x22be87['loggedIn']-_0x5d91af[0x0][_0x6f8e('0x1d3')];var _0x27f7ec=_0x22be87['dialPredictiveInterval']*0x3c;var _0x2eea02=_0x186870[0x0][_0x6f8e('0x79')]+_0x186870[0x0][_0x6f8e('0x5f')];var _0x3b2d85=(_0x186870[0x0][_0x6f8e('0x5e')]+_0x186870[0x0][_0x6f8e('0x76')]+_0x186870[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x186870[0x0]['predictiveIntervalTotalCalls'];var _0x4c7318=_0x22be87[_0x6f8e('0x1b8')]/0x64;_0x22be87[_0x6f8e('0x1d4')]=_0x5d91af[0x0][_0x6f8e('0x1d3')]||0x0;_0x22be87[_0x6f8e('0x62')]=_0x3b2d85>0x0?_0x3b2d85:0x1;return _0x130fbd[_0x6f8e('0x1cf')](_0x4ff5ea,_0x27f7ec,_0x2eea02,_0x3b2d85,_0x4c7318);})[_0x6f8e('0xa9')](function(_0x1a277a){return _0x1cd023(_0x1a277a);})['catch'](function(_0x33ac3d){return _0x3a53fd(msgResponse(_0x6f8e('0x1d5'),_0x6f8e('0x130'),JSON[_0x6f8e('0x45')](_0x33ac3d)));});}}else{return _0x3a53fd(msgResponse(_0x6f8e('0x1d0'),_0x6f8e('0x130'),_0x6f8e('0x1d1')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x5959ed){var _0x79a6eb=this;return function(){var _0x3de988=0x0;var _0x1dc03b=Math['floor'](_0x5959ed[_0x6f8e('0x67')]*0x3e8);if(_0x1dc03b>0x0){_0x1dc03b=_0x1dc03b<0x64?0x64:_0x1dc03b;loggerPredictive['info'](_0x5959ed['name'],_0x6f8e('0x1d6'),_0x1dc03b,'milliseconds');_0x5959ed[_0x6f8e('0x84')]=setInterval(function(){_0x79a6eb['handlePredictive'](_0x5959ed);loggerPredictiveCalls[_0x6f8e('0x71')]('[handlePredictive]',_0x3de988+=0x1);},_0x1dc03b);}else{loggerPredictive['info'](_0x5959ed['name'],_0x6f8e('0x1d7'));}};};Dialer[_0x6f8e('0x1a')]['checkContactBlack']=function(_0x1c31d2,_0x33922d){var _0x354d64=this;return function(_0x53ad38){if(_[_0x6f8e('0x70')](_0x53ad38)){if(_['isNil'](_0x33922d[_0x6f8e('0x1d8')])||!_0x33922d['recallme']){if(_0x1c31d2[_0x6f8e('0x146')]===_0x6f8e('0x14b')){_0x1c31d2['queueStatusComplete']=_[_0x6f8e('0x3a')](_0x1c31d2[_0x6f8e('0x11d')])?!![]:_0x1c31d2['queueStatusComplete'];var _0x5b772e=uuid['v4']();_0x354d64[_0x6f8e('0x22')][_0x5b772e]=new Action(_0x1c31d2,_0x33922d,_0x5b772e);loggerBooked['info'](_0x6f8e('0x1d9'),_0x5b772e,_0x6f8e('0x1da'),JSON[_0x6f8e('0x45')](_0x1c31d2['queueStatusComplete']),'Queue:\x20',_0x1c31d2[_0x6f8e('0x40')]);if(_0x1c31d2['queueStatusComplete']){_0x1c31d2[_0x6f8e('0x11d')]=![];_0x354d64['queueBooked'][_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xa4')]]=[];ami[_0x6f8e('0x137')]({'actionid':_0x5b772e,'action':'queuestatus','queue':_0x1c31d2[_0x6f8e('0x40')]})[_0x6f8e('0xa3')](function(){_0x354d64[_0x6f8e('0xa5')](_0x1c31d2);_0x354d64[_0x6f8e('0xb2')]({'active':![],'ContactId':_0x354d64['actions'][_0x5b772e][_0x6f8e('0xc3')],'ListId':_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xc4')],'VoiceQueueId':_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xc5')]||undefined,'CampaignId':_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x354d64[_0x6f8e('0x22')][_0x5b772e];});}else{loggerBooked[_0x6f8e('0x71')](_0x6f8e('0x1db'),JSON[_0x6f8e('0x45')](_0x1c31d2[_0x6f8e('0x11d')]),_0x6f8e('0x1dc'),_0x1c31d2[_0x6f8e('0x40')]);_0x354d64[_0x6f8e('0xa5')](_0x1c31d2);_0x354d64[_0x6f8e('0xb2')]({'active':![],'ContactId':_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xc3')],'ListId':_0x354d64['actions'][_0x5b772e][_0x6f8e('0xc4')],'VoiceQueueId':_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xc5')]||undefined,'CampaignId':_0x354d64[_0x6f8e('0x22')][_0x5b772e][_0x6f8e('0xc6')]||undefined})['catch'](loggerCatch(_0x6f8e('0x1dd')));delete _0x354d64['actions'][_0x5b772e];}}else{return _0x354d64[_0x6f8e('0x15a')](_0x1c31d2,_0x33922d);}}else{if(getDiff(_0x33922d[_0x6f8e('0x1de')])<_0x1c31d2['dialRecallMeTimeout']*0x3c){if(_0x33922d['Agent']&&!_0x33922d[_0x6f8e('0x1df')][_0x6f8e('0x1e0')]){_0x354d64[_0x6f8e('0x1e')]['run'](_0x33922d['id'])[_0x6f8e('0x1d')](function(){_0x354d64[_0x6f8e('0xa5')](_0x1c31d2);});}else{_0x354d64['unlockContact']({'active':![]},_0x33922d['id'],0x1)[_0x6f8e('0x1d')](function(){_0x354d64['updateOriginated'](_0x1c31d2);});}}else{_0x1c31d2[_0x6f8e('0x1e1')]+=0x1;_0x354d64[_0x6f8e('0xa5')](_0x1c31d2);if(_0x1c31d2[_0x6f8e('0x1e2')]){_0x354d64[_0x6f8e('0xb2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x33922d[_0x6f8e('0xc3')],'ListId':_0x33922d[_0x6f8e('0xc4')],'VoiceQueueId':_0x33922d[_0x6f8e('0xc5')]||undefined,'CampaignId':_0x33922d[_0x6f8e('0xc6')]||undefined})[_0x6f8e('0xa3')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x354d64[_0x6f8e('0xbc')](createObjHistory(_0x1c31d2,_0x33922d,_0x6f8e('0x1e3'),0x17,_0x6f8e('0x1e4')))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0x1e5')));}else{_0x354d64[_0x6f8e('0xc1')](createObjHistory(_0x1c31d2,_0x33922d,_0x6f8e('0x1e6'),0x16,_0x6f8e('0x1e7')),_0x6f8e('0x1e8'),'[Originate][HistoryRecallClose]');}}}}else{_0x1c31d2[_0x6f8e('0x1e9')]+=0x1;_0x354d64['saveInDb'](createObjHistory(_0x1c31d2,_0x33922d,_0x6f8e('0x1ea'),0xd,_0x6f8e('0x1eb')),_0x6f8e('0x1ec'),_0x6f8e('0x1ed'));throw'inBlackList';}};};Dialer['prototype'][_0x6f8e('0x14e')]=function(_0x5c13ff){var _0x31a6e9=this;var _0x547c84=_0x5c13ff['limitCalls']-_0x5c13ff[_0x6f8e('0x8c')]-_0x5c13ff[_0x6f8e('0x1ee')];emitCampaignSummary(_0x5c13ff);if(_0x547c84>0x0){if(_0x547c84>this[_0x6f8e('0x1ef')]){_0x547c84=this[_0x6f8e('0x1ef')];}_0x5c13ff['temp']+=_0x547c84;this['getContactDialerIvr'](_0x5c13ff['id'],_0x547c84,_0x5c13ff[_0x6f8e('0x1f0')])['then'](function(_0x4d36d1){_0x5c13ff[_0x6f8e('0x1ee')]-=_0x547c84;_0x5c13ff[_0x6f8e('0x1ee')]=_0x5c13ff[_0x6f8e('0x1ee')]>0x0?_0x5c13ff[_0x6f8e('0x1ee')]:0x0;if(!checkContactEmpty(_0x4d36d1)){_0x5c13ff[_0x6f8e('0x3b')]=_0x6f8e('0x94');logger['info'](_0x6f8e('0x1f1')+_0x5c13ff['name']);}else{_0x5c13ff[_0x6f8e('0x8c')]+=_0x4d36d1[_0x6f8e('0x123')];_0x5c13ff['message']=_0x6f8e('0x1f2');for(var _0x2564fb=0x0;_0x2564fb<_0x4d36d1[_0x6f8e('0x123')];_0x2564fb+=0x1){_0x5c13ff['ivrTotalCallsDays']+=0x1;if(_[_0x6f8e('0xa0')](_0x4d36d1[_0x2564fb])||_[_0x6f8e('0xa0')](_0x4d36d1[_0x2564fb][_0x6f8e('0x176')])||_[_0x6f8e('0xa0')](_0x4d36d1[_0x2564fb]['Contact'][_0x6f8e('0x15e')])){_0x31a6e9[_0x6f8e('0xbf')](_0x6f8e('0x1f3'),_0x5c13ff,_0x4d36d1[_0x2564fb]);}else{_0x31a6e9[_0x6f8e('0xad')](_[_0x6f8e('0xc2')](_0x4d36d1[_0x2564fb],[_0x6f8e('0xc6'),_0x6f8e('0x1f4')]))[_0x6f8e('0xa9')](_0x31a6e9[_0x6f8e('0x1f5')](_0x5c13ff,_0x4d36d1[_0x2564fb]))[_0x6f8e('0xa3')](_0x31a6e9['loggerHandler'](_0x6f8e('0x1f6'),_0x5c13ff));}}}})[_0x6f8e('0xa3')](loggerGetContactDialer(_0x6f8e('0x1f7'),_0x5c13ff,_0x547c84));}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x148')]=function(_0x2b47c0,_0x250078){var _0xf3794d=this;var _0x54b09a=[];var _0x565f8f=_0x250078>=0x1?_0x250078:0x1;if(_0x2b47c0[_0x6f8e('0x146')]==='booked'){_0x565f8f=0x1;}var _0xa9f542=Math[_0x6f8e('0x1f8')](_0x2b47c0[_0x6f8e('0x4b')]*_0x565f8f)-_0x2b47c0[_0x6f8e('0x8c')]-_0x2b47c0[_0x6f8e('0x1ee')];emitVoiceQueueSummary(_0x2b47c0);if(_0x2b47c0[_0x6f8e('0x1f9')]>0x0){var _0x2b6e2b=_0x2b47c0['dialLimitQueue']-_0x2b47c0['originated']-_0x2b47c0[_0x6f8e('0x97')]-_0x2b47c0['temp']-_0x2b47c0[_0x6f8e('0x4c')];if(_0xa9f542>_0x2b6e2b){_0xa9f542=_0x2b6e2b;}}if(_0xa9f542>0x0){if(_0x2b47c0[_0x6f8e('0x146')]===_0x6f8e('0x14b')){_0xa9f542=0x1;}if(_0xa9f542>this[_0x6f8e('0x1ef')]){_0xa9f542=this[_0x6f8e('0x1ef')];}_0x2b47c0[_0x6f8e('0x1ee')]+=_0xa9f542;for(var _0x595030 in this['agents']){if(typeof this['agents'][_0x595030]!==_0x6f8e('0x8d')){if(this['agents'][_0x595030][_0x6f8e('0xd8')]==='not_inuse'&&this['agents'][_0x595030][_0x6f8e('0xa1')]===_0x6f8e('0xce')){_0x54b09a['push'](this[_0x6f8e('0x21')][_0x595030]['id']);}}}this[_0x6f8e('0xb5')](_0x2b47c0['id'],_0x54b09a,_0xa9f542,_0x2b47c0[_0x6f8e('0x1f0')])[_0x6f8e('0xa9')](function(_0x2e0a17){_0x2b47c0[_0x6f8e('0x1ee')]-=_0xa9f542;_0x2b47c0[_0x6f8e('0x1ee')]=_0x2b47c0[_0x6f8e('0x1ee')]>0x0?_0x2b47c0[_0x6f8e('0x1ee')]:0x0;if(!checkContactEmpty(_0x2e0a17)){_0xf3794d[_0x6f8e('0xa7')](_0x2b47c0)[_0x6f8e('0xa9')](sendMessageReschedule(_0x2b47c0))[_0x6f8e('0xa3')](loggerCatch(_0x6f8e('0xaa')));}else{_0x2b47c0[_0x6f8e('0x8c')]+=_0x2e0a17[_0x6f8e('0x123')];_0x2b47c0[_0x6f8e('0x3b')]=_0x2b47c0[_0x6f8e('0x146')]===_0x6f8e('0x14b')?_0x6f8e('0x1fa'):'RUNNING';for(var _0x554133=0x0;_0x554133<_0x2e0a17[_0x6f8e('0x123')];_0x554133+=0x1){if(_[_0x6f8e('0xa0')](_0x2e0a17[_0x554133])||_[_0x6f8e('0xa0')](_0x2e0a17[_0x554133][_0x6f8e('0x176')])||_[_0x6f8e('0xa0')](_0x2e0a17[_0x554133][_0x6f8e('0x176')][_0x6f8e('0x15e')])){_0xf3794d[_0x6f8e('0xbf')]('[actionOriginate]\x20',_0x2b47c0,_0x2e0a17[_0x554133]);}else{_0xf3794d[_0x6f8e('0xab')](_['pick'](_0x2e0a17[_0x554133],['VoiceQueueId',_0x6f8e('0x1f4')]))[_0x6f8e('0xa9')](_0xf3794d[_0x6f8e('0x1f5')](_0x2b47c0,_0x2e0a17[_0x554133]))[_0x6f8e('0xa3')](_0xf3794d[_0x6f8e('0x1fb')](_0x6f8e('0x1f3'),_0x2b47c0));}}}})[_0x6f8e('0xa3')](loggerGetContactDialer(_0x6f8e('0x1fc'),_0x2b47c0,_0xa9f542));}};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x84')]=function(_0x153200){if(_0x153200[_0x6f8e('0x1f9')]>0x0){var _0x21eab6=_0x153200[_0x6f8e('0x1f9')]-_0x153200[_0x6f8e('0x8c')]-_0x153200[_0x6f8e('0x97')];if(_0x21eab6>0x0){this[_0x6f8e('0x1fd')](_0x153200);}else{loggerPredictiveCalls['info'](_0x6f8e('0x1fe'));}}else{this[_0x6f8e('0x1fd')](_0x153200);}};Dialer['prototype'][_0x6f8e('0x1fd')]=function(_0x1678b6){var _0x11402c=this;var _0x23d572=[];_0x1678b6[_0x6f8e('0x8c')]+=0x1;for(var _0x45ce52 in this[_0x6f8e('0x21')]){if(typeof this[_0x6f8e('0x21')][_0x45ce52]!==_0x6f8e('0x8d')){if(this[_0x6f8e('0x21')][_0x45ce52][_0x6f8e('0xd8')]===_0x6f8e('0x1ff')&&this['agents'][_0x45ce52][_0x6f8e('0xa1')]==='reachable'){_0x23d572[_0x6f8e('0x136')](this[_0x6f8e('0x21')][_0x45ce52]['id']);}}}this[_0x6f8e('0xb5')](_0x1678b6['id'],_0x23d572,0x1,_0x1678b6[_0x6f8e('0x1f0')])[_0x6f8e('0xa9')](function(_0x601b28){if(!checkContactEmpty(_0x601b28)){checkContactLowerLimitOriginate(_0x1678b6,0x1,0x0);_0x11402c['countReScheduled'](_0x1678b6)[_0x6f8e('0xa9')](sendMessageReschedule(_0x1678b6))[_0x6f8e('0xa3')](loggerCatch('[countReScheduled]\x20'));}else{_0x1678b6['message']=_0x6f8e('0x1f2');if(_[_0x6f8e('0xa0')](_0x601b28[0x0])||_[_0x6f8e('0xa0')](_0x601b28[0x0][_0x6f8e('0x176')])||_['isNil'](_0x601b28[0x0]['Contact'][_0x6f8e('0x15e')])){_0x11402c[_0x6f8e('0xbf')]('[actionOriginate]\x20',_0x1678b6,_0x601b28[0x0]);}else{_0x11402c[_0x6f8e('0xab')](_[_0x6f8e('0xc2')](_0x601b28[0x0],['VoiceQueueId',_0x6f8e('0x1f4')]))[_0x6f8e('0xa9')](_0x11402c[_0x6f8e('0x1f5')](_0x1678b6,_0x601b28[0x0]))[_0x6f8e('0xa3')](_0x11402c['loggerHandler'](_0x6f8e('0x200'),_0x1678b6));}}})['catch'](loggerGetContactDialer(_0x6f8e('0x201'),_0x1678b6,0x1));emitVoiceQueueSummary(_0x1678b6);};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x1cd')]=function(_0x444414,_0x2bd52c,_0x913713,_0x56fbc4,_0x149eae,_0x2ad987){loggerPredictive['info'](_0x6f8e('0x202'));loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x203'),_0x444414);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x204'),_0x2bd52c);loggerPredictive['info'](_0x6f8e('0x205'),_0x913713);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x206'),_0x56fbc4);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x207'),_0x149eae);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x7a'));return new BPromise(function(_0x15f41e,_0x53168e){if(_0x444414<=0x0||isNaN(_0x444414)){return _0x53168e(msgResponse('[abandonmentRate]',_0x6f8e('0x44'),'m\x20=\x20'+_0x444414));}if(_0x913713<=0x0||isNaN(_0x913713)){return _0x53168e(msgResponse(_0x6f8e('0x208'),'Error',_0x6f8e('0x209')+_0x913713));}if(_0x56fbc4<=0x0||isNaN(_0x56fbc4)){return _0x53168e(msgResponse('[abandonmentRate]',_0x6f8e('0x44'),'p\x20=\x20'+_0x56fbc4));}if(_0x2bd52c<=0x0||isNaN(_0x2bd52c)){return _0x53168e(msgResponse(_0x6f8e('0x208'),'Error','interval\x20=\x20'+_0x2bd52c));}if(_0x149eae<=0x0||isNaN(_0x149eae)){return _0x53168e(msgResponse(_0x6f8e('0x208'),_0x6f8e('0x44'),_0x6f8e('0x20a')+_0x149eae));}_0x2ad987=_0x2ad987||0x0;var _0x3edbe4=0x1/_0x913713;var _0x4523f6=0x0;var _0x58c26c=0x0;var _0x52b020=0x0;var _0x2d487a=0x0;for(var _0x5272d9=0x0;_0x52b020<_0x149eae;_0x5272d9+=0x1){_0x58c26c=_0x5272d9/_0x2bd52c;_0x4523f6=(_0x56fbc4*_0x58c26c+_0x2ad987)/_0x3edbe4;_0x52b020=erlangb(_0x4523f6,_0x444414);_0x2d487a=_0x4523f6/_0x444414*(0x1-erlangb(_0x4523f6,_0x444414));}return _0x15f41e({'erlangCalls':_0x5272d9,'erlangCallToSecond':_0x2bd52c/_0x5272d9,'erlangAbandonmentRate':_0x52b020,'erlangBusyFactor':_0x2d487a});});};Dialer[_0x6f8e('0x1a')][_0x6f8e('0x1cf')]=function(_0x58b3e1,_0x4b09cb,_0x1cec4c,_0x2a4633,_0x536d0a,_0x4c32ac){loggerPredictive[_0x6f8e('0x71')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x203'),_0x58b3e1);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x204'),_0x4b09cb);loggerPredictive[_0x6f8e('0x71')]('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',_0x1cec4c);loggerPredictive[_0x6f8e('0x71')](_0x6f8e('0x206'),_0x2a4633);loggerPredictive[_0x6f8e('0x71')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x536d0a);loggerPredictive['info'](_0x6f8e('0x7a'));return new BPromise(function(_0x57decd,_0x115a1e){if(_0x58b3e1<=0x0||isNaN(_0x58b3e1)){return _0x115a1e(msgResponse('[busyFactor]',_0x6f8e('0x44'),_0x6f8e('0x20b')+_0x58b3e1));}if(_0x1cec4c<=0x0||isNaN(_0x1cec4c)){return _0x115a1e(msgResponse(_0x6f8e('0x20c'),_0x6f8e('0x44'),'Ts\x20=\x20'+_0x1cec4c));}if(_0x2a4633<=0x0||isNaN(_0x2a4633)){return _0x115a1e(msgResponse(_0x6f8e('0x20c'),_0x6f8e('0x44'),_0x6f8e('0x20d')+_0x2a4633));}if(_0x4b09cb<=0x0||isNaN(_0x4b09cb)){return _0x115a1e(msgResponse(_0x6f8e('0x20c'),_0x6f8e('0x44'),_0x6f8e('0x20e')+_0x4b09cb));}if(_0x536d0a<=0x0||isNaN(_0x536d0a)){return _0x115a1e(msgResponse(_0x6f8e('0x20c'),_0x6f8e('0x44'),_0x6f8e('0x20f')+_0x536d0a));}_0x4c32ac=_0x4c32ac||0x0;var _0x36e074=0x1/_0x1cec4c;var _0x4f7822=0x0;var _0x40205b=0x0;var _0xb849de=0x0;var _0x2a905f=0x0;for(var _0x3b1524=0x0;_0x2a905f<_0x536d0a;_0x3b1524+=0x1){_0x40205b=_0x3b1524/_0x4b09cb;_0x4f7822=(_0x2a4633*_0x40205b+_0x4c32ac)/_0x36e074;_0xb849de=erlangb(_0x4f7822,_0x58b3e1);_0x2a905f=_0x4f7822/_0x58b3e1*(0x1-erlangb(_0x4f7822,_0x58b3e1));}return _0x57decd({'erlangCalls':_0x3b1524,'erlangCallToSecond':_0x4b09cb/_0x3b1524,'erlangAbandonmentRate':_0xb849de,'erlangBusyFactor':_0x2a905f});});};module['exports']=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 196c0f4..bc2dbbd 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 _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 +var _0xa6db=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','moment','milliseconds','diff','seconds','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback'];(function(_0x56277a,_0x3deaca){var _0x22e764=function(_0x548d53){while(--_0x548d53){_0x56277a['push'](_0x56277a['shift']());}};_0x22e764(++_0x3deaca);}(_0xa6db,0x15f));var _0xba6d=function(_0x5d3e8e,_0x87f38a){_0x5d3e8e=_0x5d3e8e-0x0;var _0x3b9c6c=_0xa6db[_0x5d3e8e];return _0x3b9c6c;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xba6d('0x0'));function getSeconds(_0x3d6271,_0x4924d6){var _0x298431=moment(_0x3d6271)['milliseconds'](0x0);var _0x1e668e=moment(_0x4924d6)[_0xba6d('0x1')](0x0);return _0x298431[_0xba6d('0x2')](_0x1e668e,_0xba6d('0x3'));}function QueueCallerAbandon(_0x28ecf4,_0x55222d){this['scheduledat']=_0x28ecf4['scheduledat'];this[_0xba6d('0x4')]=_0x28ecf4[_0xba6d('0x4')];this[_0xba6d('0x5')]=_0x28ecf4[_0xba6d('0x4')]==='outbound'?_0xba6d('0x6'):_0x28ecf4[_0xba6d('0x4')];this[_0xba6d('0x7')]=_0x28ecf4[_0xba6d('0x7')];this[_0xba6d('0x8')]=_0x28ecf4[_0xba6d('0x8')];this[_0xba6d('0x9')]=_0x28ecf4[_0xba6d('0x9')];this[_0xba6d('0xa')]=_0x28ecf4[_0xba6d('0x7')]+_0x28ecf4[_0xba6d('0x8')]+_0x28ecf4[_0xba6d('0x9')]+_0x28ecf4[_0xba6d('0xb')]+_0x28ecf4[_0xba6d('0xc')]+_0x28ecf4['countabandonedretry']+_0x28ecf4[_0xba6d('0xd')]+_0x28ecf4['countagentrejectretry'];this[_0xba6d('0xb')]=_0x28ecf4[_0xba6d('0xb')];this[_0xba6d('0xc')]=_0x28ecf4[_0xba6d('0xc')];this['countabandonedretry']=_0x28ecf4['countabandonedretry'];this['countmachineretry']=_0x28ecf4['countmachineretry'];this[_0xba6d('0xe')]=_0x28ecf4[_0xba6d('0xe')];this['uniqueid']=_0x55222d['uniqueid'];this[_0xba6d('0xf')]=_0x28ecf4['name'];this[_0xba6d('0x10')]=_0x28ecf4[_0xba6d('0x11')];this[_0xba6d('0x12')]=_0x28ecf4['starttime'];this[_0xba6d('0x13')]=_0x28ecf4[_0xba6d('0x13')];this[_0xba6d('0x14')]=_0x28ecf4[_0xba6d('0x14')];this[_0xba6d('0x15')]=this['droptime'];this[_0xba6d('0x16')]=getSeconds(_0x28ecf4['responsetime'],_0x28ecf4[_0xba6d('0x12')]);this[_0xba6d('0x17')]=getSeconds(this['droptime'],_0x28ecf4[_0xba6d('0x13')]);this[_0xba6d('0x18')]=0x0;this[_0xba6d('0x6')]=_0x55222d[_0xba6d('0x6')];this[_0xba6d('0x19')]=_0x55222d[_0xba6d('0x1a')];this[_0xba6d('0x1b')]=_0x55222d[_0xba6d('0x1b')];this['callback']=_0x28ecf4[_0xba6d('0x1c')];this[_0xba6d('0x1d')]=_0x28ecf4[_0xba6d('0x1d')];this[_0xba6d('0x1e')]=_0x28ecf4[_0xba6d('0x1e')];this[_0xba6d('0x1f')]=_0x28ecf4[_0xba6d('0x1f')];this[_0xba6d('0x20')]=_0x28ecf4[_0xba6d('0x20')];this[_0xba6d('0x21')]=_0x28ecf4[_0xba6d('0x21')];this['UserId']=_0x28ecf4[_0xba6d('0x22')];this[_0xba6d('0x23')]=_0x28ecf4[_0xba6d('0x23')];this['CampaignId']=_0x28ecf4['CampaignId'];this['originatecalleridnum']=_0x28ecf4[_0xba6d('0x24')]||'';this[_0xba6d('0x25')]=_0x28ecf4[_0xba6d('0x25')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 9ca5fe0..cea9b18 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 _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 +var _0xc95a=['moment','uniqueid','%s/%s/%s','tech','name','fax','localstationid','headerinfo','path','AttachmentId','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc95a,0x79));var _0xac95=function(_0x944efb,_0x1345ed){_0x944efb=_0x944efb-0x0;var _0x495d78=_0xc95a[_0x944efb];return _0x495d78;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xac95('0x0'));function Action(_0x27a832,_0x4baf6d,_0x263647){this[_0xac95('0x1')]=_0x27a832||undefined;this['channel']=util['format'](_0xac95('0x2'),_0x4baf6d[_0xac95('0x3')],_0x4baf6d['Trunk'][_0xac95('0x4')],_0x263647[_0xac95('0x5')]);this['localstationid']=_0x4baf6d[_0xac95('0x6')];this[_0xac95('0x7')]=_0x4baf6d[_0xac95('0x7')];this[_0xac95('0x8')]=_0x263647[_0xac95('0x8')];this[_0xac95('0x9')]=_0x263647[_0xac95('0x9')];}module[_0xac95('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 9622cfd..13c1b6e 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 _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 +var _0x8a76=['Trunk','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','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./util/util','./action','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','bind','newexten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','syncOriginateResponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','prototype','variable','channelstate','channelstatedesc','value','status','filename','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','checkTrunk'];(function(_0x158417,_0x4f400d){var _0x440087=function(_0x359270){while(--_0x359270){_0x158417['push'](_0x158417['shift']());}};_0x440087(++_0x4f400d);}(_0x8a76,0xf7));var _0x68a7=function(_0x204914,_0x5ca75c){_0x204914=_0x204914-0x0;var _0x185425=_0x8a76[_0x204914];return _0x185425;};'use strict';var util=require('util');var _=require(_0x68a7('0x0'));var BPromise=require('bluebird');var uuid=require(_0x68a7('0x1'));var moment=require(_0x68a7('0x2'));var path=require(_0x68a7('0x3'));var tiff2pdf=require(_0x68a7('0x4'));var gs=require(_0x68a7('0x5'));var logger=require('../../../config/logger')(_0x68a7('0x6'));var ami=require(_0x68a7('0x7'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require(_0x68a7('0x8'));var Action=require(_0x68a7('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x68a7('0xa'));var faxMessage=require(_0x68a7('0xb'));function Fax(_0x1ec0c0){this[_0x68a7('0xc')]={};this['faxAccounts']=_0x1ec0c0[_0x68a7('0xd')];this['trunks']=_0x1ec0c0[_0x68a7('0xe')];this[_0x68a7('0xf')]={};ami['on'](_0x68a7('0x10'),this[_0x68a7('0x11')]['bind'](this));ami['on'](_0x68a7('0x12'),this[_0x68a7('0x13')]['bind'](this));ami['on'](_0x68a7('0x14'),this['syncNewState'][_0x68a7('0x15')](this));ami['on'](_0x68a7('0x16'),this['syncNewExten'][_0x68a7('0x15')](this));ami['on']('faxstatus',this[_0x68a7('0x17')][_0x68a7('0x15')](this));ami['on']('receivefax',this[_0x68a7('0x18')]['bind'](this));ami['on'](_0x68a7('0x19'),this[_0x68a7('0x1a')][_0x68a7('0x15')](this));ami['on']('originateresponse',this[_0x68a7('0x1b')]['bind'](this));}Fax['prototype'][_0x68a7('0x11')]=function(_0x2ac3f7){if(_0x2ac3f7[_0x68a7('0x1c')]===_0x68a7('0x1d')){for(var _0x1c9e09 in this['faxAccounts']){if(this[_0x68a7('0xd')][_0x68a7('0x1e')](_0x1c9e09)){if(_0x2ac3f7[_0x68a7('0x1f')]===this[_0x68a7('0xd')][_0x1c9e09][_0x68a7('0x20')]){this[_0x68a7('0xc')][_0x2ac3f7[_0x68a7('0x21')]]={};this['channels'][_0x2ac3f7[_0x68a7('0x21')]][_0x68a7('0x22')]=_0x2ac3f7[_0x68a7('0x22')];this[_0x68a7('0xc')][_0x2ac3f7[_0x68a7('0x21')]]['id']=this[_0x68a7('0xd')][_0x1c9e09]['id'];this['channels'][_0x2ac3f7['uniqueid']][_0x68a7('0x23')]=this[_0x68a7('0xd')][_0x1c9e09][_0x68a7('0x23')];logger['info'](_0x2ac3f7[_0x68a7('0x21')],_0x68a7('0x24'));}}}}if(this[_0x68a7('0xf')][_0x2ac3f7[_0x68a7('0x21')]]){this[_0x68a7('0xc')][_0x2ac3f7['uniqueid']]={};this['channels'][_0x2ac3f7[_0x68a7('0x21')]][_0x68a7('0x22')]=_0x2ac3f7[_0x68a7('0x22')];logger[_0x68a7('0x25')](_0x2ac3f7[_0x68a7('0x21')],_0x68a7('0x24'));}};Fax[_0x68a7('0x26')][_0x68a7('0x13')]=function(_0x467431){if(this[_0x68a7('0xc')][_0x467431['uniqueid']]){for(var _0x2b69e8 in _0x467431[_0x68a7('0x27')]){if(_0x467431[_0x68a7('0x27')][_0x68a7('0x1e')](_0x2b69e8)){this[_0x68a7('0xc')][_0x467431[_0x68a7('0x21')]][_0x2b69e8]=_0x467431['value'];}}}};Fax['prototype']['syncNewState']=function(_0x20af0c){if(this[_0x68a7('0xc')][_0x20af0c[_0x68a7('0x21')]]){this[_0x68a7('0xc')][_0x20af0c['uniqueid']][_0x68a7('0x28')]=_0x20af0c[_0x68a7('0x28')];this[_0x68a7('0xc')][_0x20af0c[_0x68a7('0x21')]][_0x68a7('0x29')]=_0x20af0c['channelstatedesc'];}};Fax[_0x68a7('0x26')]['syncNewExten']=function(_0x325fb7){if(this[_0x68a7('0xc')][_0x325fb7['uniqueid']]){for(var _0x2b4ca0 in _0x325fb7[_0x68a7('0x27')]){if(_0x325fb7['variable'][_0x68a7('0x1e')](_0x2b4ca0)){this[_0x68a7('0xc')][_0x325fb7['uniqueid']][_0x2b4ca0]=_0x325fb7[_0x68a7('0x2a')];}}}};Fax[_0x68a7('0x26')][_0x68a7('0x17')]=function(_0xe84518){if(this['channels'][_0xe84518[_0x68a7('0x21')]]){this['channels'][_0xe84518['uniqueid']]['operation']=_0xe84518['operation'];this['channels'][_0xe84518[_0x68a7('0x21')]][_0x68a7('0x2b')]=_0xe84518[_0x68a7('0x2b')];this[_0x68a7('0xc')][_0xe84518[_0x68a7('0x21')]]['localstationid']=_0xe84518['localstationid'];this[_0x68a7('0xc')][_0xe84518[_0x68a7('0x21')]]['filename']=_0xe84518[_0x68a7('0x2c')];logger[_0x68a7('0x25')](_0xe84518[_0x68a7('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0x68a7('0x26')][_0x68a7('0x18')]=function(_0x78bdc0){var _0x1a02bf=this;if(this['channels'][_0x78bdc0[_0x68a7('0x21')]]){var _0x118705=this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]]['id'];this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]][_0x68a7('0x2d')]=_0x78bdc0[_0x68a7('0x2d')];this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]]['pagestransferred']=_0x78bdc0[_0x68a7('0x2e')];this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]]['localstationid']=_0x78bdc0[_0x68a7('0x20')];this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]][_0x68a7('0x2f')]=_0x78bdc0[_0x68a7('0x2f')];this[_0x68a7('0xc')][_0x78bdc0['uniqueid']][_0x68a7('0x30')]=_0x78bdc0['transferrate'];this['channels'][_0x78bdc0[_0x68a7('0x21')]][_0x68a7('0x2c')]=_0x78bdc0[_0x68a7('0x2c')];this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]]['calleridnum']=_0x78bdc0['calleridnum'];if(this[_0x68a7('0xc')][_0x78bdc0[_0x68a7('0x21')]][_0x68a7('0x2e')]>0x0){tiff2pdf(_0x78bdc0[_0x68a7('0x2c')],_0x68a7('0x31'),function(_0x5d8860){logger[_0x68a7('0x25')](_0x78bdc0[_0x68a7('0x21')],_0x68a7('0x32'),_0x5d8860[_0x68a7('0x33')]);attachment[_0x68a7('0x34')]({'name':path[_0x68a7('0x35')](_0x78bdc0[_0x68a7('0x2c')])[_0x68a7('0x23')],'basename':path[_0x68a7('0x35')](_0x78bdc0[_0x68a7('0x2c')])['name']+_0x68a7('0x36'),'type':_0x68a7('0x37')})['then'](function(_0x4a2b75){faxAccount[_0x68a7('0x38')](_0x118705,{'from':_0x78bdc0['calleridnum'],'mapKey':'fax','body':path[_0x68a7('0x35')](_0x78bdc0[_0x68a7('0x2c')])[_0x68a7('0x23')]+'.pdf','AttachmentId':_0x4a2b75['id']})[_0x68a7('0x39')](function(_0x361576){logger[_0x68a7('0x3a')](_0x78bdc0['uniqueid'],_0x68a7('0x3b'),JSON[_0x68a7('0x3c')](_0x361576));});})['catch'](function(_0x3de00c){logger[_0x68a7('0x3a')](_0x78bdc0[_0x68a7('0x21')],_0x68a7('0x3d'),JSON[_0x68a7('0x3c')](_0x3de00c));});});}logger[_0x68a7('0x25')](_0x78bdc0[_0x68a7('0x21')],_0x68a7('0x3d'));}};Fax['prototype'][_0x68a7('0x1b')]=function(_0x530a2d){if(this[_0x68a7('0xf')][_0x530a2d['uniqueid']]){_['merge'](this[_0x68a7('0xc')][_0x530a2d[_0x68a7('0x21')]],_[_0x68a7('0x3e')](_0x530a2d,['response',_0x68a7('0x3f')]));}};function updateStatus(_0x47764e){if(_0x47764e[_0x68a7('0x40')]){faxMessage[_0x68a7('0x41')](_0x47764e[_0x68a7('0x40')],{'failMessage':_0x68a7('0x42')})[_0x68a7('0x43')](function(_0x4d2df5){ut[_0x68a7('0x44')](_0x68a7('0x45'),_0x4d2df5);})['catch'](function(_0xf6361a){ut[_0x68a7('0x44')](_0x68a7('0x46'),_0xf6361a);});}else{ut[_0x68a7('0x44')](_0x68a7('0x47'));}}Fax[_0x68a7('0x26')]['updateStatus']=function(_0x15dcad,_0xd83b43,_0x1bfe45){var _0x475de7=this;var _0x9c7027={};if(_0xd83b43){_0x9c7027={'read':_0xd83b43};}else{_0x9c7027={'failMessage':_0x1bfe45};}if(this[_0x68a7('0xf')][_0x15dcad][_0x68a7('0x40')]){faxMessage[_0x68a7('0x41')](this[_0x68a7('0xf')][_0x15dcad]['AttachmentId'],_0x9c7027)['then'](function(_0x331e7b){ut[_0x68a7('0x44')](_0x68a7('0x48'),_0x331e7b);})[_0x68a7('0x39')](function(_0x441936){ut[_0x68a7('0x44')](_0x68a7('0x49'),_0x441936);})[_0x68a7('0x4a')](function(){delete _0x475de7[_0x68a7('0xc')][_0x15dcad];delete _0x475de7[_0x68a7('0xf')][_0x15dcad];});}else{ut[_0x68a7('0x44')](_0x68a7('0x4b'));delete this[_0x68a7('0xc')][_0x15dcad];delete this[_0x68a7('0xf')][_0x15dcad];}};Fax['prototype'][_0x68a7('0x1a')]=function(_0x47d7f2){var _0x584aa1=this;if(this[_0x68a7('0xc')][_0x47d7f2[_0x68a7('0x21')]]){if(this['actions'][_0x47d7f2[_0x68a7('0x21')]]){this['channels'][_0x47d7f2['uniqueid']]['id']=this[_0x68a7('0xf')][_0x47d7f2[_0x68a7('0x21')]]['id'];this['channels'][_0x47d7f2[_0x68a7('0x21')]]['name']=this[_0x68a7('0xf')][_0x47d7f2[_0x68a7('0x21')]][_0x68a7('0x23')];}logger[_0x68a7('0x25')](_0x47d7f2[_0x68a7('0x21')],this[_0x68a7('0xf')][_0x47d7f2['uniqueid']]?_0x68a7('0x4c'):_0x68a7('0x4d'),JSON[_0x68a7('0x3c')](this[_0x68a7('0xc')][_0x47d7f2[_0x68a7('0x21')]]));if(this[_0x68a7('0xf')][_0x47d7f2['uniqueid']]){if(this[_0x68a7('0xc')][_0x47d7f2[_0x68a7('0x21')]][_0x68a7('0x4e')]>0x0&&this[_0x68a7('0xc')][_0x47d7f2[_0x68a7('0x21')]][_0x68a7('0x4f')]===_0x68a7('0x50')){this[_0x68a7('0x51')](_0x47d7f2['uniqueid'],!![]);}else{this[_0x68a7('0x51')](_0x47d7f2['uniqueid'],![],this[_0x68a7('0xc')][_0x47d7f2[_0x68a7('0x21')]][_0x68a7('0x52')]?_0x68a7('0x53')+this['channels'][_0x47d7f2['uniqueid']][_0x68a7('0x52')]:_0x68a7('0x54'));}}}};Fax[_0x68a7('0x26')]['send']=function(_0x16a388){var _0x3beca0=this;return new BPromise(function(_0xe87355,_0x54f2cf){_0x3beca0[_0x68a7('0x55')](_0x16a388,_0x3beca0[_0x68a7('0xd')][_0x16a388[_0x68a7('0x56')]])[_0x68a7('0x43')](function(_0x49dfbb){ut[_0x68a7('0x44')]('[Fax][execOriginate][success]',_0x49dfbb);_0xe87355(ut['message'](_0x68a7('0x57')));})[_0x68a7('0x39')](function(_0x1210d2){ut['logger']('[Fax][execOriginate][failure]',_0x1210d2);updateStatus(_0x16a388);_0x54f2cf(ut[_0x68a7('0x33')]('Fax\x20failed'));});});};Fax[_0x68a7('0x26')]['checkAfterSend']=function(_0x80ace3){var _0x1bbc25=this;return new BPromise(function(_0x34279b,_0x2de75d){var _0x321c12=_0x1bbc25[_0x68a7('0x58')](_0x1bbc25[_0x68a7('0xd')][_0x80ace3['FaxAccountId']][_0x68a7('0x59')],_0x80ace3);if(_0x321c12['isValid']){_0x34279b(ut['message'](_0x68a7('0x5a')));}else{_0x2de75d(ut['message'](_0x321c12[_0x68a7('0x33')]));}});};function originate(_0x3d2342,_0x5c1c5a,_0x4c5c4d){return new BPromise(function(_0x1e7a2b,_0xb3b784){if(_0x4c5c4d){var _0x4116e5=util[_0x68a7('0x5b')](_0x68a7('0x5c'),path[_0x68a7('0x35')](_0x3d2342['path'])[_0x68a7('0x23')],_0x3d2342['path']);gs[_0x68a7('0x5d')](_0x4116e5)[_0x68a7('0x43')](function(){_0x3d2342[_0x68a7('0x3')]=util['format']('%s/%s.tif',path['parse'](_0x3d2342[_0x68a7('0x3')])[_0x68a7('0x5e')],path[_0x68a7('0x35')](_0x3d2342[_0x68a7('0x3')])[_0x68a7('0x23')]);_0x5c1c5a[_0x68a7('0x5f')]=_0x3d2342[_0x68a7('0x3')];ut[_0x68a7('0x44')](_0x68a7('0x60'),'');ami['Action'](ut[_0x68a7('0x61')](_0x3d2342,_0x5c1c5a))[_0x68a7('0x43')](function(_0x161582){_0x1e7a2b(_0x161582);})[_0x68a7('0x39')](function(_0x47ef0b){_0xb3b784(_0x47ef0b);});})[_0x68a7('0x39')](function(_0x514160){_0xb3b784(_0x514160);});}else{ami[_0x68a7('0x62')](ut[_0x68a7('0x61')](_0x3d2342,_0x5c1c5a))[_0x68a7('0x43')](function(_0x3a8080){_0x1e7a2b(_0x3a8080);})[_0x68a7('0x39')](function(_0x5429f8){_0xb3b784(_0x5429f8);});}});}Fax[_0x68a7('0x26')][_0x68a7('0x55')]=function(_0x4c23a1,_0x53f07b){var _0x1745b6=this;return new BPromise(function(_0x542338,_0x5e13e8){var _0x244730=uuid['v4']();var _0xefc0b4=ut[_0x68a7('0x63')](_0x4c23a1,_0x53f07b);_0x1745b6[_0x68a7('0xf')][_0x244730]=new Action(_0x244730,_0x53f07b,_0x4c23a1);var _0x8fcf59=_0x1745b6['actions'][_0x244730];if(path[_0x68a7('0x35')](_0x4c23a1[_0x68a7('0x3')])[_0x68a7('0x64')]===_0x68a7('0x36')){originate(_0x8fcf59,_0xefc0b4,!![])[_0x68a7('0x43')](function(_0x1979ac){_0x542338(_0x1979ac);})[_0x68a7('0x39')](function(_0x19752e){_0x5e13e8(_0x19752e);});}else{originate(_0x8fcf59,_0xefc0b4,![])[_0x68a7('0x43')](function(_0x2689c0){_0x542338(_0x2689c0);})[_0x68a7('0x39')](function(_0xf35331){_0x5e13e8(_0xf35331);});}});};Fax[_0x68a7('0x26')][_0x68a7('0x65')]=function(_0x1b1fbf){return!_[_0x68a7('0x66')](_0x1b1fbf)&&!_[_0x68a7('0x66')](_0x1b1fbf[_0x68a7('0x23')])&&!_[_0x68a7('0x66')](_0x1b1fbf['active'])&&_0x1b1fbf['active']&&!_['isNil'](this[_0x68a7('0xe')][util['format'](_0x68a7('0x67'),_0x1b1fbf[_0x68a7('0x23')])])&&!_[_0x68a7('0x66')](this[_0x68a7('0xe')][util[_0x68a7('0x5b')](_0x68a7('0x67'),_0x1b1fbf[_0x68a7('0x23')])][_0x68a7('0x2b')])&&(this[_0x68a7('0xe')][util[_0x68a7('0x5b')](_0x68a7('0x67'),_0x1b1fbf['name'])][_0x68a7('0x2b')]===_0x68a7('0x68')||this[_0x68a7('0xe')][util[_0x68a7('0x5b')]('SIP/%s',_0x1b1fbf[_0x68a7('0x23')])][_0x68a7('0x2b')]==='unmonitored');};Fax[_0x68a7('0x26')]['checkTrunk']=function(_0x4aafa3,_0x1d1a97){if(!this[_0x68a7('0x65')](_0x4aafa3)){ut[_0x68a7('0x44')](_0x68a7('0x69'),_[_0x68a7('0x66')](_0x4aafa3)?'':_0x4aafa3['name']+_0x68a7('0x6a'));return{'isValid':![],'message':_0x68a7('0x6b')};}if(_[_0x68a7('0x66')](_0x1d1a97[_0x68a7('0x6')])){ut['logger'](_0x68a7('0x6c'),JSON[_0x68a7('0x3c')](_0x1d1a97));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x1d1a97[_0x68a7('0x3')])){ut[_0x68a7('0x44')](_0x68a7('0x6d'),JSON[_0x68a7('0x3c')](_0x1d1a97));return{'isValid':![],'message':_0x68a7('0x6e')};}return{'isValid':!![],'message':_0x68a7('0x6f')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index d77556a..1661b59 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 _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 +var _0x6fbb=['resolve','[Notify]\x20','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6fbb,0x1bb));var _0xb6fb=function(_0x420866,_0x6334ad){_0x420866=_0x420866-0x0;var _0x1b5087=_0x6fbb[_0x420866];return _0x1b5087;};'use strict';var util=require('util');var BPromise=require(_0xb6fb('0x0'));var logger=require(_0xb6fb('0x1'))('preview');var _=require(_0xb6fb('0x2'));var faxAccount=require(_0xb6fb('0x3'));function loggerCatch(_0x292f02){return function(_0x52d51e){logger[_0xb6fb('0x4')](_0x292f02,util[_0xb6fb('0x5')](_0x52d51e,{'showHidden':![],'depth':null}));};}exports[_0xb6fb('0x6')]=function(_0x45af32,_0x4f3670){return BPromise[_0xb6fb('0x7')]()['then'](faxAccount[_0xb6fb('0x6')](_0x45af32,_0x4f3670))['catch'](loggerCatch(_0xb6fb('0x8')));}; \ 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 0c26c50..607c1da 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 _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 +var _0x456d=['exec','execute','info','Exec\x20gs','util','../../../../config/logger','fax','bluebird','child_process'];(function(_0x3d2b83,_0x4a6a02){var _0x172728=function(_0x332866){while(--_0x332866){_0x3d2b83['push'](_0x3d2b83['shift']());}};_0x172728(++_0x4a6a02);}(_0x456d,0xdc));var _0xd456=function(_0x348c81,_0x57636a){_0x348c81=_0x348c81-0x0;var _0x554bfd=_0x456d[_0x348c81];return _0x554bfd;};'use strict';var util=require(_0xd456('0x0'));var logger=require(_0xd456('0x1'))(_0xd456('0x2'));var BPromise=require(_0xd456('0x3'));var exec=require(_0xd456('0x4'))[_0xd456('0x5')];exports[_0xd456('0x6')]=function(_0x599f06){return new BPromise(function(_0x621634,_0x4ef488){exec(_0x599f06,function(_0x2e9999,_0x46cbf2,_0x905496){logger[_0xd456('0x7')](_0xd456('0x8'),_0x46cbf2);if(_0x2e9999){logger[_0xd456('0x7')](_0xd456('0x8'),'\x20Error\x20:',util['inspect'](_0x2e9999,{'showHidden':![],'depth':null}),_0x46cbf2,_0x905496);_0x4ef488(_0x2e9999);}_0x621634(_0x46cbf2);});});}; \ 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 6e85ab5..7dad2a2 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 _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 +var _0x4c6d=['from-sip','format','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction','channel'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x2e1458,_0x2a8dc6){_0x2e1458=_0x2e1458-0x0;var _0x46f3b8=_0x4c6d[_0x2e1458];return _0x46f3b8;};'use strict';var util=require(_0xd4c6('0x0'));var _=require(_0xd4c6('0x1'));var moment=require(_0xd4c6('0x2'));var logger=require(_0xd4c6('0x3'))(_0xd4c6('0x4'));exports['message']=function(_0x209f99){return{'message':_0x209f99};};exports[_0xd4c6('0x5')]=function(_0x306766,_0x4b2d75){logger[_0xd4c6('0x6')](_0x306766,util[_0xd4c6('0x7')](_0x4b2d75,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x182671,_0x316314){var _0x4329e3={'XMF-ECM':_0x316314['ecm'],'XMF-HEADERINFO':_0x316314[_0xd4c6('0x8')],'XMF-MINRATE':_0x316314[_0xd4c6('0x9')],'XMF-MAXRATE':_0x316314[_0xd4c6('0xa')],'XMF-MODEM':util['format'](_0xd4c6('0xb'),_0x316314[_0xd4c6('0xc')]),'XMF-GATEWAY':_0x316314[_0xd4c6('0xd')],'XMF-FAXDETECT':_0x316314['faxdetect'],'XMF-T38TIMEOUT':_0x316314[_0xd4c6('0xe')],'XMF-LOCALSTATIONID':_0x316314[_0xd4c6('0xf')],'XMF-PATH':_0x182671[_0xd4c6('0x10')]};return _0x4329e3;};exports[_0xd4c6('0x11')]=function(_0x2fc307,_0x2e580e){return{'actionid':_0x2fc307['uniqueid'],'action':'originate','channel':_0x2fc307[_0xd4c6('0x12')],'Exten':'xcally-motion-fax','Context':_0xd4c6('0x13'),'Priority':'1','callerid':util[_0xd4c6('0x14')](_0xd4c6('0x15'),_0x2fc307[_0xd4c6('0x8')]?_0x2fc307[_0xd4c6('0x8')]:'',_0x2fc307[_0xd4c6('0xf')]),'variable':_0x2e580e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2fc307[_0xd4c6('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index e593e43..7b58af0 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 _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 +var _0x7094=['getSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./realtime','./report','./acw','./trigger','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x274bff,_0x8bf274){var _0x3c53eb=function(_0x886cd6){while(--_0x886cd6){_0x274bff['push'](_0x274bff['shift']());}};_0x3c53eb(++_0x8bf274);}(_0x7094,0xe9));var _0x4709=function(_0x26f665,_0x806d24){_0x26f665=_0x26f665-0x0;var _0x2d7a33=_0x7094[_0x26f665];return _0x2d7a33;};'use strict';var BPromise=require(_0x4709('0x0'));var util=require(_0x4709('0x1'));var moment=require(_0x4709('0x2'));var server=require('./server');var Realtime=require(_0x4709('0x3'));var Report=require(_0x4709('0x4'));var Acw=require(_0x4709('0x5'));var Trigger=require(_0x4709('0x6'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x4709('0x7'));var voiceQueue=require(_0x4709('0x8'));var voiceQueueReport=require(_0x4709('0x9'));var voiceCallReport=require(_0x4709('0xa'));var trunk=require(_0x4709('0xb'));var trigger=require(_0x4709('0xc'));var template=require('./rpc/template');var cmHopperHistory=require(_0x4709('0xd'));var campaign=require(_0x4709('0xe'));var voiceExtension=require(_0x4709('0xf'));var faxAccount=require(_0x4709('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x4709('0x11'));var sugarcrm=require(_0x4709('0x12'));var freshdesk=require(_0x4709('0x13'));var desk=require(_0x4709('0x14'));var zoho=require(_0x4709('0x15'));var vtiger=require(_0x4709('0x16'));var freshsales=require(_0x4709('0x17'));var servicenow=require(_0x4709('0x18'));var dynamics365=require(_0x4709('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4709('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4709('0x1a')](_0x4709('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x4709('0x1c')]()[_0x4709('0x1d')](user[_0x4709('0x1e')]())[_0x4709('0x1d')](realtime[_0x4709('0x1f')]())[_0x4709('0x1d')](user[_0x4709('0x20')]())['then'](realtime[_0x4709('0x21')]())['then'](trunk['getTrunks']())[_0x4709('0x1d')](realtime['initTrunks']())[_0x4709('0x1d')](voiceQueue[_0x4709('0x22')]())[_0x4709('0x1d')](realtime[_0x4709('0x23')]())[_0x4709('0x1d')](trigger['getTriggers']())['then'](realtime[_0x4709('0x24')]())['then'](template[_0x4709('0x25')]())['then'](realtime[_0x4709('0x26')]())[_0x4709('0x1d')](zendesk[_0x4709('0x27')]())['then'](realtime[_0x4709('0x28')]())[_0x4709('0x1d')](salesforce[_0x4709('0x29')]())[_0x4709('0x1d')](realtime[_0x4709('0x2a')]())[_0x4709('0x1d')](sugarcrm[_0x4709('0x2b')]())[_0x4709('0x1d')](realtime['initSugarcrmAccounts']())[_0x4709('0x1d')](freshdesk[_0x4709('0x2c')]())[_0x4709('0x1d')](realtime['initFreshdeskAccounts']())[_0x4709('0x1d')](desk[_0x4709('0x2d')]())[_0x4709('0x1d')](realtime[_0x4709('0x2e')]())[_0x4709('0x1d')](zoho[_0x4709('0x2f')]())[_0x4709('0x1d')](realtime[_0x4709('0x30')]())[_0x4709('0x1d')](vtiger[_0x4709('0x31')]())['then'](realtime[_0x4709('0x32')]())['then'](freshsales[_0x4709('0x33')]())[_0x4709('0x1d')](realtime[_0x4709('0x34')]())['then'](servicenow[_0x4709('0x35')]())[_0x4709('0x1d')](realtime[_0x4709('0x36')]())[_0x4709('0x1d')](dynamics365[_0x4709('0x37')]())[_0x4709('0x1d')](realtime[_0x4709('0x38')]())[_0x4709('0x1d')](campaign['getCampaigns']())[_0x4709('0x1d')](realtime['initCampaigns']())[_0x4709('0x1d')](voiceExtension[_0x4709('0x39')]())[_0x4709('0x1d')](realtime[_0x4709('0x3a')]())[_0x4709('0x1d')](faxAccount[_0x4709('0x3b')]())[_0x4709('0x1d')](realtime['initFaxAccounts']())[_0x4709('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0x4709('0x1c')]()[_0x4709('0x1d')](voiceQueueReport[_0x4709('0x3c')]())['then'](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4709('0x1d')](realtime[_0x4709('0x3d')]())[_0x4709('0x1d')](cmHopperHistory['getCampaignHopperHistory']())[_0x4709('0x1d')](realtime[_0x4709('0x3e')]())[_0x4709('0x1d')](voiceCallReport[_0x4709('0x3f')]())[_0x4709('0x1d')](realtime[_0x4709('0x40')]())[_0x4709('0x1d')](function(_0x28b4e5){})[_0x4709('0x41')](function(_0x10c35c){console[_0x4709('0x42')](_0x10c35c);});}function main(){return server[_0x4709('0x43')](realtime,preview,fax)['then'](function(_0x1eca93){return initRealtime();})['then'](function(){return initParams();})['then'](function(){report[_0x4709('0x44')]();setInterval(initRealtime,0x1388);})[_0x4709('0x41')](function(_0x3f3128){console[_0x4709('0x42')](_0x3f3128);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 79c2d42..cf1b80f 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 _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 +var _0x8f91=['defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','format','stringify','user:%s','user:save','exports','lodash','util','moment','md5','ioredis','redis'];(function(_0x33a778,_0x284f22){var _0x1f97ce=function(_0x3cd524){while(--_0x3cd524){_0x33a778['push'](_0x33a778['shift']());}};_0x1f97ce(++_0x284f22);}(_0x8f91,0xc2));var _0x18f9=function(_0x145748,_0x4a8443){_0x145748=_0x145748-0x0;var _0x357bf3=_0x8f91[_0x145748];return _0x357bf3;};'use strict';var _=require(_0x18f9('0x0'));var util=require(_0x18f9('0x1'));var moment=require(_0x18f9('0x2'));var md5=require(_0x18f9('0x3'));var Redis=require(_0x18f9('0x4'));var config=require('../../../config/environment');config[_0x18f9('0x5')]=_[_0x18f9('0x6')](config[_0x18f9('0x5')],{'host':_0x18f9('0x7'),'port':0x18eb});var io=require(_0x18f9('0x8'))(new Redis(config['redis']));function Agent(_0x30c5c8){this['id']=_0x30c5c8['id']||0x0;this['name']=_0x30c5c8[_0x18f9('0x9')]||'';this[_0x18f9('0xa')]=_0x30c5c8[_0x18f9('0xa')]||'';this[_0x18f9('0xb')]=_0x30c5c8[_0x18f9('0xb')]||'';this[_0x18f9('0xc')]=_0x30c5c8[_0x18f9('0xc')]||'';this[_0x18f9('0xd')]=_0x18f9('0xe');this[_0x18f9('0xf')]=0x0;this[_0x18f9('0x10')]=_0x18f9('0xe');this[_0x18f9('0x11')]='';this[_0x18f9('0x12')]='';this[_0x18f9('0x13')]='';this[_0x18f9('0x14')]='';this[_0x18f9('0x15')]=_0x30c5c8['online']||![];this[_0x18f9('0x16')]='unknown';this[_0x18f9('0x17')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x18f9('0x18')]='';this[_0x18f9('0x19')]=![];this[_0x18f9('0x1a')]=![];this['md5']='';}Agent[_0x18f9('0x1b')][_0x18f9('0x1c')]=function(_0x2a076c){var _0x455423;if(_0x2a076c&&_0x2a076c[_0x18f9('0xd')]){_0x455423=_0x2a076c[_0x18f9('0xd')][_0x18f9('0x1d')]();switch(_0x455423){case _0x18f9('0x1e'):_0x455423=_0x18f9('0x1f');break;case _0x18f9('0x20'):_0x455423=_0x18f9('0x21');break;}}if(_0x455423&&this[_0x18f9('0x16')]!==_0x455423||_0x2a076c[_0x18f9('0x22')]){this[_0x18f9('0x17')]=_['toNumber'](moment()[_0x18f9('0x23')]('x'));}if(_0x455423){this[_0x18f9('0x16')]=_0x455423;}var _0x349678={'id':this['id'],'name':this[_0x18f9('0x9')],'email':this[_0x18f9('0xa')],'accountcode':this[_0x18f9('0xb')],'fullname':this[_0x18f9('0xc')],'state':this[_0x18f9('0xd')],'stateTime':this[_0x18f9('0xf')],'status':this[_0x18f9('0x10')],'address':this['address'],'online':this[_0x18f9('0x15')],'voiceStatus':this[_0x18f9('0x16')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x18f9('0x18')],'interface':this[_0x18f9('0x14')],'onhold':this[_0x18f9('0x19')]};var _0xde06c6=md5(JSON[_0x18f9('0x24')](_0x349678));if(this[_0x18f9('0x3')]!==_0xde06c6){this[_0x18f9('0x3')]=_0xde06c6;io['to'](util[_0x18f9('0x23')](_0x18f9('0x25'),_0x349678['name']))['emit'](_0x18f9('0x26'),_0x349678);}};module[_0x18f9('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 79436e6..73b4c87 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 _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 +var _0xba58=['Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','temp','ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk'];(function(_0x18ec0d,_0x1dff28){var _0x1de836=function(_0x446487){while(--_0x446487){_0x18ec0d['push'](_0x18ec0d['shift']());}};_0x1de836(++_0x1dff28);}(_0xba58,0x166));var _0x8ba5=function(_0x2f4505,_0x310402){_0x2f4505=_0x2f4505-0x0;var _0x1b48ab=_0xba58[_0x2f4505];return _0x1b48ab;};'use strict';function Campaign(_0x171c83){this['id']=_0x171c83['id']||0x0;this['name']=_0x171c83['name']||'';this[_0x8ba5('0x0')]=_0x171c83[_0x8ba5('0x0')]||'campaign';this['originated']=0x0;this[_0x8ba5('0x1')]=0x0;this[_0x8ba5('0x2')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x8ba5('0x3')]='';this['sendMessageOneNotActive']=!![];this[_0x8ba5('0x4')]=_0x171c83[_0x8ba5('0x4')];this['limitCalls']=_0x171c83[_0x8ba5('0x5')];this['dialTimezone']=_0x171c83[_0x8ba5('0x6')]||null;this[_0x8ba5('0x7')]=_0x171c83[_0x8ba5('0x7')]?_0x171c83[_0x8ba5('0x7')]:null;this['dialOriginateCallerIdName']=_0x171c83[_0x8ba5('0x8')];this[_0x8ba5('0x9')]=_0x171c83['dialOriginateCallerIdNumber'];this[_0x8ba5('0xa')]=_0x171c83[_0x8ba5('0xa')]||0x1e;this[_0x8ba5('0xb')]=_0x171c83[_0x8ba5('0xb')];this[_0x8ba5('0xc')]=_0x171c83[_0x8ba5('0xc')];this['dialBusyMaxRetry']=_0x171c83['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x171c83[_0x8ba5('0xd')];this[_0x8ba5('0xe')]=_0x171c83[_0x8ba5('0xe')];this['dialNoAnswerRetryFrequency']=_0x171c83[_0x8ba5('0xf')];this['dialGlobalMaxRetry']=_0x171c83[_0x8ba5('0x10')];this[_0x8ba5('0x11')]=_0x171c83[_0x8ba5('0x11')]||0x3;this[_0x8ba5('0x12')]=_0x171c83['dialNoSuchNumberRetryFrequency']||0x96;this[_0x8ba5('0x13')]=_0x171c83['dialDropMaxRetry']||0x3;this[_0x8ba5('0x14')]=_0x171c83[_0x8ba5('0x14')]||0x96;this[_0x8ba5('0x15')]=_0x171c83['dialAbandonedMaxRetry']||0x3;this[_0x8ba5('0x16')]=_0x171c83[_0x8ba5('0x16')]||0x96;this[_0x8ba5('0x17')]=_0x171c83[_0x8ba5('0x17')]||0x3;this[_0x8ba5('0x18')]=_0x171c83[_0x8ba5('0x18')]||0x96;this[_0x8ba5('0x19')]=_0x171c83['dialAgentRejectMaxRetry']||0x3;this[_0x8ba5('0x1a')]=_0x171c83[_0x8ba5('0x1a')]||0x96;this[_0x8ba5('0x1b')]=_0x171c83[_0x8ba5('0x1b')]||_0x8ba5('0x1c');this[_0x8ba5('0x1d')]=_0x171c83[_0x8ba5('0x1d')]||undefined;this[_0x8ba5('0x1e')]=_0x171c83[_0x8ba5('0x1e')]||undefined;this['dialCutDigit']=_0x171c83[_0x8ba5('0x1f')]||undefined;this['TrunkBackup']=_0x171c83[_0x8ba5('0x20')]?_0x171c83['TrunkBackup']:undefined;this[_0x8ba5('0x21')]=_0x171c83[_0x8ba5('0x21')]?_0x171c83[_0x8ba5('0x21')]:undefined;this['Interval']=_0x171c83[_0x8ba5('0x22')]?_0x171c83['Interval']:undefined;this[_0x8ba5('0x23')]=_0x171c83['SquareProject']?_0x171c83[_0x8ba5('0x23')]:undefined;this[_0x8ba5('0x24')]=_0x171c83[_0x8ba5('0x23')]?_0x171c83[_0x8ba5('0x23')][_0x8ba5('0x25')]:undefined;this[_0x8ba5('0x26')]=_0x171c83['dialAMDActive']||![];this[_0x8ba5('0x27')]=_0x171c83[_0x8ba5('0x27')];this[_0x8ba5('0x28')]=_0x171c83[_0x8ba5('0x28')];this[_0x8ba5('0x29')]=_0x171c83[_0x8ba5('0x29')];this[_0x8ba5('0x2a')]=_0x171c83[_0x8ba5('0x2a')];this['dialAMDMinWordLength']=_0x171c83[_0x8ba5('0x2b')];this[_0x8ba5('0x2c')]=_0x171c83[_0x8ba5('0x2c')];this[_0x8ba5('0x2d')]=_0x171c83[_0x8ba5('0x2d')];this[_0x8ba5('0x2e')]=_0x171c83[_0x8ba5('0x2e')];this[_0x8ba5('0x2f')]=_0x171c83['dialAMDMaximumWordLength'];}module[_0x8ba5('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 544fc96..db7dc51 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 _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 +var _0x686c=['calleridnum','connectedlinename','linkedid','exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','mohtime','exports','starttime','destinationchannel'];(function(_0x4005a4,_0xf6092){var _0x2b5bba=function(_0x49c706){while(--_0x49c706){_0x4005a4['push'](_0x4005a4['shift']());}};_0x2b5bba(++_0xf6092);}(_0x686c,0x1de));var _0xc686=function(_0x279679,_0x19605a){_0x279679=_0x279679-0x0;var _0x4e4b87=_0x686c[_0x279679];return _0x4e4b87;};'use strict';function Channel(){this[_0xc686('0x0')]=null;this['channel']='';this[_0xc686('0x1')]='';this[_0xc686('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xc686('0x3')]=undefined;this['accountcode']=0x0;this['context']='';this['uniqueid']=0x0;this[_0xc686('0x4')]=0x0;this[_0xc686('0x5')]=0x0;this[_0xc686('0x6')]=![];this[_0xc686('0x7')]=null;this[_0xc686('0x8')]=null;this[_0xc686('0x9')]=![];this[_0xc686('0xa')]=![];this[_0xc686('0xb')]='';this[_0xc686('0xc')]='';this[_0xc686('0xd')]=0x0;this['billableseconds']=0x0;this[_0xc686('0xe')]=0x0;this[_0xc686('0xf')]=null;this[_0xc686('0x10')]=null;this[_0xc686('0x11')]=null;this['monitor']=![];this[_0xc686('0x12')]=null;this[_0xc686('0x13')]=null;this[_0xc686('0x14')]=[];this[_0xc686('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc686('0x16')]=0x0;}module[_0xc686('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index eacab00..5dd763f 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 _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 +var _0x34aa=['tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token'];(function(_0x4c5822,_0x571770){var _0x129c44=function(_0x47626d){while(--_0x47626d){_0x4c5822['push'](_0x4c5822['shift']());}};_0x129c44(++_0x571770);}(_0x34aa,0x171));var _0xa34a=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x34aa[_0x1559a5];return _0x17a783;};'use strict';function DeskAccount(_0x44376a){this['id']=_0x44376a['id']||0x0;this['name']=_0x44376a[_0xa34a('0x0')]||'';this[_0xa34a('0x1')]=_0x44376a[_0xa34a('0x1')]||'';this[_0xa34a('0x2')]=_0x44376a['remoteUri']||'';this[_0xa34a('0x3')]=_0x44376a[_0xa34a('0x3')]||'';this[_0xa34a('0x4')]=_0x44376a[_0xa34a('0x4')]||'';this[_0xa34a('0x5')]=_0x44376a[_0xa34a('0x5')]||'';this[_0xa34a('0x6')]=_0x44376a[_0xa34a('0x6')]||'';this[_0xa34a('0x7')]=_0x44376a[_0xa34a('0x7')]||'';this[_0xa34a('0x8')]=_0x44376a['tokenSecret']||'';this[_0xa34a('0x9')]=_0x44376a[_0xa34a('0x9')]||'';this[_0xa34a('0xa')]=_0x44376a[_0xa34a('0xa')]||'';this[_0xa34a('0xb')]=_0x44376a['Configurations']||{};}module[_0xa34a('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index f87baf2..69591bd 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 _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 +var _0xce4a=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name','username'];(function(_0x29227f,_0x1e3c3d){var _0x437093=function(_0x2267ef){while(--_0x2267ef){_0x29227f['push'](_0x29227f['shift']());}};_0x437093(++_0x1e3c3d);}(_0xce4a,0x1e8));var _0xace4=function(_0x4e4f96,_0x522c99){_0x4e4f96=_0x4e4f96-0x0;var _0x48625a=_0xce4a[_0x4e4f96];return _0x48625a;};'use strict';function Dynamics365Account(_0x1e9f3){this['id']=_0x1e9f3['id']||0x0;this[_0xace4('0x0')]=_0x1e9f3[_0xace4('0x0')]||'';this[_0xace4('0x1')]=_0x1e9f3['username']||'';this[_0xace4('0x2')]=_0x1e9f3[_0xace4('0x2')]||'';this['remoteUri']=_0x1e9f3[_0xace4('0x3')]||'';this[_0xace4('0x4')]=_0x1e9f3[_0xace4('0x4')]||'';this[_0xace4('0x5')]=_0x1e9f3[_0xace4('0x5')]||'';this[_0xace4('0x6')]=_0x1e9f3[_0xace4('0x6')]||{};this[_0xace4('0x7')]=_0x1e9f3[_0xace4('0x7')]||'';this['Configurations']=_0x1e9f3[_0xace4('0x8')]||{};}module[_0xace4('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 a9e018f..e2fdd48 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 _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 +var _0x5abb=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo'];(function(_0x4290af,_0x153342){var _0x2b1284=function(_0x4bb9b7){while(--_0x4bb9b7){_0x4290af['push'](_0x4290af['shift']());}};_0x2b1284(++_0x153342);}(_0x5abb,0xec));var _0xb5ab=function(_0x3802f0,_0x254568){_0x3802f0=_0x3802f0-0x0;var _0x61a467=_0x5abb[_0x3802f0];return _0x61a467;};'use strict';function FaxAccount(_0x514051){this['id']=_0x514051['id']||0x0;this[_0xb5ab('0x0')]=_0x514051[_0xb5ab('0x0')]||'';this[_0xb5ab('0x1')]=_0x514051[_0xb5ab('0x1')];this[_0xb5ab('0x2')]=_0x514051['ecm'];this[_0xb5ab('0x3')]=_0x514051[_0xb5ab('0x3')];this[_0xb5ab('0x4')]=_0x514051[_0xb5ab('0x4')];this[_0xb5ab('0x5')]=_0x514051[_0xb5ab('0x5')]||0x960;this[_0xb5ab('0x6')]=_0x514051[_0xb5ab('0x6')]||0x3840;this[_0xb5ab('0x7')]=_0x514051[_0xb5ab('0x7')]||'v17,v27,v29';this[_0xb5ab('0x8')]=_0x514051[_0xb5ab('0x8')]||'no';this[_0xb5ab('0x9')]=_0x514051[_0xb5ab('0x9')]||'no';this['t38timeout']=_0x514051[_0xb5ab('0xa')]||0x1388;this['tech']=_0x514051['tech']||_0xb5ab('0xb');this[_0xb5ab('0xc')]=_0x514051[_0xb5ab('0xc')]?_0x514051['Trunk']:undefined;this[_0xb5ab('0xd')]=_0x514051['ListId'];this['key']=_0x514051['key'];}module[_0xb5ab('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 54143f6..1a64e74 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 _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 +var _0x22ae=['Configurations','exports','name','username','apiKey','remoteUri','serverUrl'];(function(_0x5191bb,_0xdb3ce1){var _0x64e315=function(_0x16397f){while(--_0x16397f){_0x5191bb['push'](_0x5191bb['shift']());}};_0x64e315(++_0xdb3ce1);}(_0x22ae,0x1d7));var _0xe22a=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x22ae[_0x30a31e];return _0x170879;};'use strict';function FreshdeskAccount(_0x2a27e5){this['id']=_0x2a27e5['id']||0x0;this['name']=_0x2a27e5[_0xe22a('0x0')]||'';this[_0xe22a('0x1')]=_0x2a27e5[_0xe22a('0x1')]||'';this[_0xe22a('0x2')]=_0x2a27e5['token']||'';this[_0xe22a('0x3')]=_0x2a27e5['remoteUri']||'';this[_0xe22a('0x4')]=_0x2a27e5['serverUrl']||'';this[_0xe22a('0x5')]=_0x2a27e5[_0xe22a('0x5')]||{};}module[_0xe22a('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 39a67ed..25eb140 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 _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 +var _0x3114=['username','token','remoteUri','serverUrl','Configurations','name'];(function(_0x4e76fc,_0x49e444){var _0x2a8617=function(_0x5e19ce){while(--_0x5e19ce){_0x4e76fc['push'](_0x4e76fc['shift']());}};_0x2a8617(++_0x49e444);}(_0x3114,0xdd));var _0x4311=function(_0x5d2e99,_0x329a0b){_0x5d2e99=_0x5d2e99-0x0;var _0x1991c8=_0x3114[_0x5d2e99];return _0x1991c8;};'use strict';function FreshsalesAccount(_0x2e81ae){this['id']=_0x2e81ae['id']||0x0;this[_0x4311('0x0')]=_0x2e81ae[_0x4311('0x0')]||'';this['username']=_0x2e81ae[_0x4311('0x1')]||'';this['apiKey']=_0x2e81ae[_0x4311('0x2')]||'';this['remoteUri']=_0x2e81ae[_0x4311('0x3')]||'';this[_0x4311('0x4')]=_0x2e81ae[_0x4311('0x4')]||'';this['Configurations']=_0x2e81ae[_0x4311('0x5')]||{};}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 4c7da16..dfb6fb7 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 _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 +var _0x7391=['context','exten','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','connectedlinenum','accountcode'];(function(_0xb1cf84,_0x813740){var _0x4bad2e=function(_0x53e6f2){while(--_0x53e6f2){_0xb1cf84['push'](_0xb1cf84['shift']());}};_0x4bad2e(++_0x813740);}(_0x7391,0x8b));var _0x1739=function(_0x408de5,_0x24fa7b){_0x408de5=_0x408de5-0x0;var _0x2015a1=_0x7391[_0x408de5];return _0x2015a1;};'use strict';function QueueReport(){this[_0x1739('0x0')]=_0x1739('0x1');this['uniqueid']='';this[_0x1739('0x2')]='';this[_0x1739('0x3')]='';this[_0x1739('0x4')]='';this[_0x1739('0x5')]=null;this[_0x1739('0x6')]=null;this[_0x1739('0x7')]=0x1;this[_0x1739('0x8')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0x1739('0x9')]=![];this[_0x1739('0xa')]=null;this[_0x1739('0xb')]=![];this[_0x1739('0xc')]=null;this['originalposition']=0x1;this['channel']='';this[_0x1739('0xd')]='';this['connectedlinename']='';this[_0x1739('0xe')]='';this[_0x1739('0xf')]='';this[_0x1739('0x10')]='';this['priority']='';this['holdtime']=0x0;this[_0x1739('0x11')]=![];this[_0x1739('0x12')]='';this[_0x1739('0x13')]=0x0;this[_0x1739('0x14')]={};}module[_0x1739('0x15')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 34780ae..dbfa8b0 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 _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 +var _0x9e82=['integrationTab','serverUrl','Configurations','name','password','clientId','clientSecret','securityToken','type'];(function(_0xcb9735,_0x2665da){var _0x30988c=function(_0x5d8bdc){while(--_0x5d8bdc){_0xcb9735['push'](_0xcb9735['shift']());}};_0x30988c(++_0x2665da);}(_0x9e82,0x12c));var _0x29e8=function(_0x47baf7,_0x35db34){_0x47baf7=_0x47baf7-0x0;var _0x125bf6=_0x9e82[_0x47baf7];return _0x125bf6;};'use strict';function SalesforceAccount(_0x2843b4){this['id']=_0x2843b4['id']||0x0;this[_0x29e8('0x0')]=_0x2843b4[_0x29e8('0x0')]||'';this['username']=_0x2843b4['username']||'';this['remoteUri']=_0x2843b4['remoteUri']||'';this[_0x29e8('0x1')]=_0x2843b4['password']||'';this[_0x29e8('0x2')]=_0x2843b4['clientId']||'';this[_0x29e8('0x3')]=_0x2843b4[_0x29e8('0x3')]||'';this[_0x29e8('0x4')]=_0x2843b4['securityToken']||'';this[_0x29e8('0x5')]=_0x2843b4[_0x29e8('0x5')]||_0x29e8('0x6');this[_0x29e8('0x7')]=_0x2843b4[_0x29e8('0x7')]||'';this[_0x29e8('0x8')]=_0x2843b4[_0x29e8('0x8')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index d0b3fcc..d52976e 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 _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 +var _0x8542=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x8542,0x1e4));var _0x2854=function(_0x23240c,_0x4ae408){_0x23240c=_0x23240c-0x0;var _0x4f1d11=_0x8542[_0x23240c];return _0x4f1d11;};'use strict';function ServicenowAccount(_0x2ff200){this['id']=_0x2ff200['id']||0x0;this['name']=_0x2ff200[_0x2854('0x0')]||'';this[_0x2854('0x1')]=_0x2ff200[_0x2854('0x1')]||'';this[_0x2854('0x2')]=_0x2ff200[_0x2854('0x2')]||'';this[_0x2854('0x3')]=_0x2ff200[_0x2854('0x3')]||'';this[_0x2854('0x4')]=_0x2ff200[_0x2854('0x4')]||'';this[_0x2854('0x5')]=_0x2ff200[_0x2854('0x5')]||{};}module[_0x2854('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 bfef553..026597e 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 _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 +var _0xd9bf=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x91b05e,_0x5e0aca){var _0x1b3348=function(_0x33ae99){while(--_0x33ae99){_0x91b05e['push'](_0x91b05e['shift']());}};_0x1b3348(++_0x5e0aca);}(_0xd9bf,0x141));var _0xfd9b=function(_0x32a9c8,_0x379490){_0x32a9c8=_0x32a9c8-0x0;var _0x2888f7=_0xd9bf[_0x32a9c8];return _0x2888f7;};'use strict';function SugarcrmAccount(_0x16994c){this['id']=_0x16994c['id']||0x0;this[_0xfd9b('0x0')]=_0x16994c[_0xfd9b('0x0')]||'';this[_0xfd9b('0x1')]=_0x16994c[_0xfd9b('0x1')]||'';this[_0xfd9b('0x2')]=_0x16994c[_0xfd9b('0x2')]||'';this[_0xfd9b('0x3')]=_0x16994c[_0xfd9b('0x3')]||'';this[_0xfd9b('0x4')]=_0x16994c['serverUrl']||'';this[_0xfd9b('0x5')]=_0x16994c[_0xfd9b('0x5')]||{};}module[_0xfd9b('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index 854931b..6e1d9fa 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 _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 +var _0x953b=['stateTime','exports','name','accountcode','unknown'];(function(_0x5c467e,_0x5c74d9){var _0x491f22=function(_0x508188){while(--_0x508188){_0x5c467e['push'](_0x5c467e['shift']());}};_0x491f22(++_0x5c74d9);}(_0x953b,0x1e7));var _0xb953=function(_0x38698e,_0x4b3ac1){_0x38698e=_0x38698e-0x0;var _0x5046a3=_0x953b[_0x38698e];return _0x5046a3;};'use strict';function Telephone(_0x1efa22){this['id']=_0x1efa22['id']||0x0;this['name']=_0x1efa22[_0xb953('0x0')]||'';this[_0xb953('0x1')]=_0x1efa22[_0xb953('0x1')]||'';this['state']=_0xb953('0x2');this[_0xb953('0x3')]=0x0;this['status']=_0xb953('0x2');this['address']='';}module[_0xb953('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7bf3fb6..1afe9c4 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 _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 +var _0xa2f5=['html','exports','name'];(function(_0x1de5fb,_0x2b0139){var _0x2bde59=function(_0x4263f7){while(--_0x4263f7){_0x1de5fb['push'](_0x1de5fb['shift']());}};_0x2bde59(++_0x2b0139);}(_0xa2f5,0x197));var _0x5a2f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa2f5[_0x397e5f];return _0x5302b8;};'use strict';function template(_0x373078){this['id']=_0x373078['id']||0x0;this[_0x5a2f('0x0')]=_0x373078['name']||'';this[_0x5a2f('0x1')]=_0x373078[_0x5a2f('0x1')]||'';}module[_0x5a2f('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 4d61a9b..ea561c2 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 _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 +var _0x3e74=['Actions','name','channel','status','AllConditions','AnyConditions'];(function(_0x243c95,_0x4f321f){var _0x48a764=function(_0x176e1b){while(--_0x176e1b){_0x243c95['push'](_0x243c95['shift']());}};_0x48a764(++_0x4f321f);}(_0x3e74,0x175));var _0x43e7=function(_0x47e0ed,_0x1443fa){_0x47e0ed=_0x47e0ed-0x0;var _0x11726d=_0x3e74[_0x47e0ed];return _0x11726d;};'use strict';function Trigger(_0x284ef8){this['id']=_0x284ef8['id']||0x0;this['name']=_0x284ef8[_0x43e7('0x0')]||'';this[_0x43e7('0x1')]=_0x284ef8[_0x43e7('0x1')]||'voice';this['status']=_0x284ef8[_0x43e7('0x2')]||![];this['AllConditions']=_0x284ef8[_0x43e7('0x3')]||[];this[_0x43e7('0x4')]=_0x284ef8[_0x43e7('0x4')]||[];this[_0x43e7('0x5')]=_0x284ef8[_0x43e7('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 952a20c..05a29a7 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 _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 +var _0x0f22=['exports','active','name','state','stateTime','unknown','registry','indexOf','split','host','port','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x0f22,0xab));var _0x20f2=function(_0x47396d,_0x4d5b16){_0x47396d=_0x47396d-0x0;var _0x35b29b=_0x0f22[_0x47396d];return _0x35b29b;};'use strict';function Trunk(_0xce9a95){this['id']=_0xce9a95['id']||0x0;this[_0x20f2('0x0')]=_0xce9a95[_0x20f2('0x0')]||![];this[_0x20f2('0x1')]=_0xce9a95['name']||'';this[_0x20f2('0x2')]='unknown';this[_0x20f2('0x3')]=0x0;this['status']=_0x20f2('0x4');this[_0x20f2('0x5')]=_0xce9a95['registry']&&_0xce9a95['registry'][_0x20f2('0x6')](':')?_0xce9a95['registry'][_0x20f2('0x7')](':')[0x0]:'';this[_0x20f2('0x8')]='';this[_0x20f2('0x9')]='';this[_0x20f2('0xa')]='';this[_0x20f2('0xb')]='';this[_0x20f2('0xc')]='';this[_0x20f2('0xd')]='unknown';this[_0x20f2('0xe')]='';this[_0x20f2('0xf')]='';}module[_0x20f2('0x10')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index f5906ca..b8166e8 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 _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 +var _0xa8b9=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x1e90de,_0x28f696){var _0x349f69=function(_0x119f59){while(--_0x119f59){_0x1e90de['push'](_0x1e90de['shift']());}};_0x349f69(++_0x28f696);}(_0xa8b9,0x83));var _0x9a8b=function(_0x34fc81,_0x197693){_0x34fc81=_0x34fc81-0x0;var _0x1d0442=_0xa8b9[_0x34fc81];return _0x1d0442;};'use strict';function voiceExtension(_0x52c615){this['id']=_0x52c615['id']||0x0;this[_0x9a8b('0x0')]=_0x52c615[_0x9a8b('0x0')]||'';this['recordingFormat']=_0x52c615[_0x9a8b('0x1')]||_0x9a8b('0x2');this['mandatoryDisposition']=_0x52c615[_0x9a8b('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 68d8131..9a0f43b 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 _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 +var _0x2874=['acw','acwTimeout','autopause','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','answered','sumDuration','sumBillable','abandoned','loggedIn','available'];(function(_0x538991,_0x1de972){var _0x544685=function(_0x4297d2){while(--_0x4297d2){_0x538991['push'](_0x538991['shift']());}};_0x544685(++_0x1de972);}(_0x2874,0x13b));var _0x4287=function(_0x1ad901,_0x852d9e){_0x1ad901=_0x1ad901-0x0;var _0x3c0249=_0x2874[_0x1ad901];return _0x3c0249;};'use strict';var statusDesc=[_0x4287('0x0'),'not_inuse',_0x4287('0x1'),_0x4287('0x2'),_0x4287('0x3'),'unavailable','ringing','ringinuse',_0x4287('0x4')];var monitorFormat={'wav':'wav','wav49':_0x4287('0x5'),'gsm':_0x4287('0x6')};var strategy={'rrmemory':_0x4287('0x7'),'roundrobin':_0x4287('0x8')};function VoiceQueue(_0x51a59e){this['id']=_0x51a59e['id']||0x0;this[_0x4287('0x9')]=_0x51a59e['name']||'';this[_0x4287('0xa')]=_0x51a59e[_0x4287('0xa')]||'';this['type']=_0x51a59e[_0x4287('0xb')]||_0x4287('0xc');this[_0x4287('0xd')]=0x0;this[_0x4287('0xe')]=0x0;this['total']=0x0;this[_0x4287('0xf')]=0x0;this[_0x4287('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x4287('0x11')]=0x0;this['unmanaged']=0x0;this[_0x4287('0x12')]=0x0;this[_0x4287('0x13')]=0x0;this[_0x4287('0x14')]=0x0;this[_0x4287('0x15')]=_0x51a59e['acw']||![];this['acwTimeout']=_0x51a59e[_0x4287('0x16')]||0xa;this[_0x4287('0x17')]=_0x51a59e[_0x4287('0x17')]||'no';this['sendMessageOneNotActive']=!![];this[_0x4287('0x18')]='';this[_0x4287('0x19')]=0x0;this[_0x4287('0x1a')]=0x0;this[_0x4287('0x1b')]=_0x51a59e[_0x4287('0x1b')]||null;this['dialGlobalInterval']=_0x51a59e['dialGlobalInterval']?_0x51a59e[_0x4287('0x1c')]:null;this['dialActive']=_0x51a59e[_0x4287('0x1d')];this[_0x4287('0x1e')]=_0x51a59e['dialMethod']||_0x4287('0x1f');this[_0x4287('0x20')]=_0x51a59e[_0x4287('0x20')]||0x0;this[_0x4287('0x21')]=_0x51a59e['dialLimitQueue']||0x0;this[_0x4287('0x22')]=_0x51a59e[_0x4287('0x22')]||0x1;this[_0x4287('0x23')]=_0x51a59e[_0x4287('0x23')]||_0x4287('0x24');this[_0x4287('0x25')]=_0x51a59e['dialPredictiveOptimizationPercentage']||0.03;this[_0x4287('0x26')]=_0x51a59e[_0x4287('0x26')]||0x258;this[_0x4287('0x27')]=_0x51a59e[_0x4287('0x27')]||_0x4287('0x28');this['dialOriginateCallerIdNumber']=_0x51a59e[_0x4287('0x29')]||'anonymous';this[_0x4287('0x2a')]=_0x51a59e['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x51a59e['dialQueueOptions']||_0x4287('0x2b');this['dialQueueTimeout']=_0x51a59e[_0x4287('0x2c')]||0x3;this[_0x4287('0x2d')]=_0x51a59e[_0x4287('0x2d')]||undefined;this[_0x4287('0x2e')]=_0x51a59e[_0x4287('0x2e')]||0x3;this[_0x4287('0x2f')]=_0x51a59e[_0x4287('0x2f')]||0x96;this[_0x4287('0x30')]=_0x51a59e['dialBusyMaxRetry']||0x3;this[_0x4287('0x31')]=_0x51a59e[_0x4287('0x31')]||0x96;this[_0x4287('0x32')]=_0x51a59e['dialNoAnswerMaxRetry']||0x3;this[_0x4287('0x33')]=_0x51a59e[_0x4287('0x33')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x51a59e[_0x4287('0x34')]||0x3;this[_0x4287('0x35')]=_0x51a59e[_0x4287('0x35')]||0x96;this['dialDropMaxRetry']=_0x51a59e[_0x4287('0x36')]||0x3;this[_0x4287('0x37')]=_0x51a59e[_0x4287('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x51a59e[_0x4287('0x38')]||0x3;this[_0x4287('0x39')]=_0x51a59e['dialAbandonedRetryFrequency']||0x96;this[_0x4287('0x3a')]=_0x51a59e[_0x4287('0x3a')]||0x3;this['dialMachineRetryFrequency']=_0x51a59e['dialMachineRetryFrequency']||0x96;this[_0x4287('0x3b')]=_0x51a59e[_0x4287('0x3b')]||0x3;this[_0x4287('0x3c')]=_0x51a59e[_0x4287('0x3c')]||0x96;this[_0x4287('0x3d')]=_0x51a59e[_0x4287('0x3d')]||0x4;this[_0x4287('0x3e')]=_0x51a59e[_0x4287('0x3e')]?_0x51a59e[_0x4287('0x3e')]:undefined;this[_0x4287('0x3f')]=_0x51a59e[_0x4287('0x3f')]?_0x51a59e[_0x4287('0x3f')]:undefined;this[_0x4287('0x40')]=_0x51a59e[_0x4287('0x40')]||undefined;this['Interval']=_0x51a59e[_0x4287('0x41')]?_0x51a59e[_0x4287('0x41')]:undefined;this[_0x4287('0x42')]=_0x51a59e[_0x4287('0x42')]||'DESC';this[_0x4287('0x43')]=_0x51a59e[_0x4287('0x43')]||undefined;this[_0x4287('0x44')]=_0x51a59e[_0x4287('0x44')]||undefined;this[_0x4287('0x45')]=strategy[_0x51a59e[_0x4287('0x45')]]||_0x4287('0x7');this[_0x4287('0x46')]=!![];this[_0x4287('0x47')]=_0x51a59e['dialAMDActive']||![];this[_0x4287('0x48')]=_0x51a59e[_0x4287('0x48')];this[_0x4287('0x49')]=_0x51a59e[_0x4287('0x49')];this[_0x4287('0x4a')]=_0x51a59e[_0x4287('0x4a')];this[_0x4287('0x4b')]=_0x51a59e[_0x4287('0x4b')];this[_0x4287('0x4c')]=_0x51a59e[_0x4287('0x4c')];this[_0x4287('0x4d')]=_0x51a59e[_0x4287('0x4d')];this['dialAMDMaximumNumberOfWords']=_0x51a59e[_0x4287('0x4e')];this[_0x4287('0x4f')]=_0x51a59e['dialAMDSilenceThreshold'];this[_0x4287('0x50')]=_0x51a59e[_0x4287('0x50')];this['outboundRejectCallsDay']=0x0;this[_0x4287('0x51')]=0x0;this['timeout']=_0x51a59e[_0x4287('0x52')];this['outboundAnswerCallsDay']=0x0;this[_0x4287('0x53')]=0x0;this[_0x4287('0x54')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x4287('0x55')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x4287('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x4287('0x57')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x4287('0x58')]=0x0;this['outboundReCallsDay']=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this['handlePredictive']=undefined;this[_0x4287('0x59')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x4287('0x5a')]=0x0;this[_0x4287('0x5b')]=0x0;this[_0x4287('0x5c')]=0x0;this[_0x4287('0x5d')]=0x0;this[_0x4287('0x5e')]=0x0;this[_0x4287('0x5f')]=0x0;this[_0x4287('0x60')]=0x0;this[_0x4287('0x61')]=_0x51a59e[_0x4287('0x62')]||0x14;this[_0x4287('0x63')]=_0x51a59e['dialPredictiveIntervalMaxThreshold']||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x4287('0x64')]=0x0;this[_0x4287('0x65')]=0x1;this[_0x4287('0x66')]=0x0;this[_0x4287('0x67')]=0x0;this[_0x4287('0x68')]=0x0;this[_0x4287('0x69')]=0x0;this[_0x4287('0x6a')]=_0x51a59e['dialRecallMeTimeout']||0x1e;this['dialRecallInQueue']=_0x51a59e['dialRecallInQueue']||![];this[_0x4287('0x6b')]=_0x51a59e[_0x4287('0x6b')]||undefined;this[_0x4287('0x6c')]=_0x51a59e['dialAgiAfterHangupClient']||![];this[_0x4287('0x6d')]=_0x51a59e[_0x4287('0x6d')]||![];this[_0x4287('0xa')]=monitorFormat[_0x51a59e[_0x4287('0xa')]]?monitorFormat[_0x51a59e[_0x4287('0xa')]]:undefined;this[_0x4287('0x6e')]=_0x51a59e[_0x4287('0x6e')]||![];this[_0x4287('0x6f')]=_0x51a59e[_0x4287('0x6f')]?_0x51a59e[_0x4287('0x6f')]: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 d2523f6..3ec9ba8 100644 --- a/server/services/ami/model/vtigerAccount.js +++ b/server/services/ami/model/vtigerAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe038=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_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 +var _0x40a4=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x40a4,0x88));var _0x440a=function(_0x297306,_0x1ba507){_0x297306=_0x297306-0x0;var _0x3dfdc9=_0x40a4[_0x297306];return _0x3dfdc9;};'use strict';function VtigerAccount(_0x1da7ba){this['id']=_0x1da7ba['id']||0x0;this['name']=_0x1da7ba[_0x440a('0x0')]||'';this['username']=_0x1da7ba[_0x440a('0x1')]||'';this[_0x440a('0x2')]=_0x1da7ba[_0x440a('0x2')]||'';this[_0x440a('0x3')]=_0x1da7ba[_0x440a('0x3')]||'';this[_0x440a('0x4')]=_0x1da7ba['serverUrl']||'';this[_0x440a('0x5')]=_0x1da7ba[_0x440a('0x5')]||{};}module[_0x440a('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index e0e2657..b0d20a5 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_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 +var _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x0b0e,0x187));var _0xe0b0=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0x0b0e[_0x207a02];return _0xd995c3;};'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 8ba64fc..144e650 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 _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 +var _0x8580=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x289c3e,_0x3614b5){var _0x25a4b3=function(_0x1ea94b){while(--_0x1ea94b){_0x289c3e['push'](_0x289c3e['shift']());}};_0x25a4b3(++_0x3614b5);}(_0x8580,0x1c7));var _0x0858=function(_0x544d02,_0x467528){_0x544d02=_0x544d02-0x0;var _0x9bd6a8=_0x8580[_0x544d02];return _0x9bd6a8;};'use strict';function ZohoAccount(_0x492375){this['id']=_0x492375['id']||0x0;this[_0x0858('0x0')]=_0x492375['name']||'';this[_0x0858('0x1')]=_0x492375['description']||'';this['host']=_0x492375[_0x0858('0x2')]||'';this[_0x0858('0x3')]=_0x492375['zone']||'';this[_0x0858('0x4')]=_0x492375[_0x0858('0x4')]||'';this['clientSecret']=_0x492375[_0x0858('0x5')]||'';this[_0x0858('0x6')]=_0x492375[_0x0858('0x6')]||'';this[_0x0858('0x7')]=_0x492375['code']||'';this[_0x0858('0x8')]=_0x492375[_0x0858('0x8')]||'';this[_0x0858('0x9')]=_0x492375['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 9888aac..a9512da 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 _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 +var _0x0a8a=['\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller'];(function(_0xd30ef2,_0x532490){var _0x37d728=function(_0x5142f4){while(--_0x5142f4){_0xd30ef2['push'](_0xd30ef2['shift']());}};_0x37d728(++_0x532490);}(_0x0a8a,0xee));var _0xa0a8=function(_0x24f862,_0x4b645a){_0x24f862=_0x24f862-0x0;var _0x198aa4=_0x0a8a[_0x24f862];return _0x198aa4;};'use strict';var util=require(_0xa0a8('0x0'));var _=require(_0xa0a8('0x1'));var moment=require(_0xa0a8('0x2'));function checkNameSurname(_0x471315,_0x2ae556,_0x4b1195){var _0x4c82c2='';if(!_[_0xa0a8('0x3')](_0x2ae556)&&_0xa0a8('0x4')===typeof _0x2ae556){_0x4c82c2+=_0x2ae556;}if(!_['isNil'](_0x4b1195)&&_0xa0a8('0x4')===typeof _0x4b1195){_0x4c82c2+='\x20'+_0x4b1195;}if(_0x4c82c2!==''){return _0x4c82c2;}return _0x471315;}function Action(_0x80893d,_0x368357,_0x78b5b5,_0x32d4ae,_0x2a8e95){this[_0xa0a8('0x5')]=_0x78b5b5||undefined;this[_0xa0a8('0x6')]=_0x80893d['id'];this[_0xa0a8('0x7')]=_0x368357[_0xa0a8('0x8')];this[_0xa0a8('0x9')]=_0x368357[_0xa0a8('0x9')];this[_0xa0a8('0xa')]=_0xa0a8('0x7');this['dialAnswer']=![];this[_0xa0a8('0xb')]=_['isNil'](_0x80893d[_0xa0a8('0xc')])?undefined:_0x80893d['Agent'][_0xa0a8('0x8')];this[_0xa0a8('0xd')]=this[_0xa0a8('0xb')]?util[_0xa0a8('0xe')]('SIP/%s',this[_0xa0a8('0xb')]):_0x32d4ae||undefined;this[_0xa0a8('0xf')]=checkNameSurname(_0x80893d[_0xa0a8('0x10')][_0xa0a8('0x11')],_0x80893d[_0xa0a8('0x10')][_0xa0a8('0x12')],_0x80893d['Contact'][_0xa0a8('0x13')]);this['active']=_0x80893d[_0xa0a8('0x14')]||![];this[_0xa0a8('0x15')]=_0x80893d['Contact'][_0xa0a8('0x11')];this[_0xa0a8('0x16')]=_0x80893d[_0xa0a8('0x16')];this[_0xa0a8('0x17')]=_0x80893d[_0xa0a8('0x17')]||0x0;this[_0xa0a8('0x18')]=_0x80893d[_0xa0a8('0x18')]||0x0;this['countnoanswerretry']=_0x80893d[_0xa0a8('0x19')]||0x0;this[_0xa0a8('0x1a')]=(_0x80893d['countbusyretry']||0x0)+(_0x80893d[_0xa0a8('0x18')]||0x0)+(_0x80893d['countnoanswerretry']||0x0)+(_0x80893d[_0xa0a8('0x1b')]||0x0)+(_0x80893d[_0xa0a8('0x1c')]||0x0)+(_0x80893d[_0xa0a8('0x1d')]||0x0)+(_0x80893d['countmachineretry']||0x0)+(_0x80893d['countagentrejectretry']||0x0);this[_0xa0a8('0x1b')]=_0x80893d['countnosuchnumberretry']||0x0;this[_0xa0a8('0x1c')]=_0x80893d[_0xa0a8('0x1c')]||0x0;this[_0xa0a8('0x1d')]=_0x80893d[_0xa0a8('0x1d')]||0x0;this[_0xa0a8('0x1e')]=_0x80893d[_0xa0a8('0x1e')]||0x0;this[_0xa0a8('0x1f')]=_0x80893d[_0xa0a8('0x1f')]||0x0;this[_0xa0a8('0x20')]=_0x80893d[_0xa0a8('0x20')];this[_0xa0a8('0x21')]=_0x80893d[_0xa0a8('0x21')];this[_0xa0a8('0x22')]=_0x80893d[_0xa0a8('0x22')];this[_0xa0a8('0x23')]=_0x80893d['recallme'];this[_0xa0a8('0x24')]=_0x80893d[_0xa0a8('0x24')];this['ListId']=_0x80893d[_0xa0a8('0x25')];this['UserId']=_[_0xa0a8('0x3')](_0x80893d['Agent'])?_0x80893d[_0xa0a8('0x26')]:_0x80893d[_0xa0a8('0xc')]['id'];this['VoiceQueueId']=_0x80893d[_0xa0a8('0x27')];this[_0xa0a8('0x28')]='';this[_0xa0a8('0x29')]='';}Action[_0xa0a8('0x2a')][_0xa0a8('0x2b')]=function(){return util[_0xa0a8('0xe')](_0xa0a8('0x2c'),this['calleridname'],this[_0xa0a8('0x2d')]);};module[_0xa0a8('0x2e')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index e4c5766..8409b9e 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['type','outbound','strategy','answered','loggedIn','pTalking','sumDuration','sumHoldTime','talking','unmanaged','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','voice:queue:%s','name','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice_queue_channel:remove','sendMessageOneNotActive','available','paused','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','setMessage','recallMe','clearZombieChannel','actions','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','agentReadyId','then','length','getDiff','scheduledat','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','emit','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','isNil','phone','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','active','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','originated:\x20','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','actionid','logLookAgent','responsetime','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','[syncHangup][talking][cause]','cause','dialQueueProject','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','util','lodash','bluebird','uuid','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangupRequest','syncDialEnd','newexten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns'];(function(_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 +var _0x9c44=['Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','execCall','SIP/%s/%s%s','dialCutDigit','substring','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridNumber','merge','toLowerVariables','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','isFailure','unlockContact','disableContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','channelstate','destuniqueid','addVariable','variables','syncVarSet','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','type','strategy','loggedIn','pTalking','sumBillable','sumDuration','total','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','sendMessageOneNotActive','originated','available','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','prototype','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','preview','setMessage','recallMe','clearZombieChannel','sequence','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','status','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[action]','size','getContactRecallMe','agentReadyId','then','getDiff','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','logCustomer','createCustomerHistory','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','rescheduleContact','scheduledAt','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','NOANSWER','countnoanswerretry','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','unlockAgent','AgentReject','custom:agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','Global','countabandonedetry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','checkIsBlackList','pick','Contact.phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact'];(function(_0x68b33,_0x4616cb){var _0x1bd699=function(_0x3ff28e){while(--_0x3ff28e){_0x68b33['push'](_0x68b33['shift']());}};_0x1bd699(++_0x4616cb);}(_0x9c44,0x178));var _0x49c4=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x9c44[_0x5f1391];return _0x50ebe3;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x49c4('0x0'));var uuid=require(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var md5=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x49c4('0x6'))('actionPreview');var ami=require(_0x49c4('0x7'));var rpcDb=require(_0x49c4('0x8'));var Action=require(_0x49c4('0x9'));var ut=require(_0x49c4('0xa'));config[_0x49c4('0xb')]=_['defaults'](config[_0x49c4('0xb')],{'host':_0x49c4('0xc'),'port':0x18eb});var io=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xb')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x451ea6){this[_0x49c4('0xe')]=this['tail']?this[_0x49c4('0xe')][_0x49c4('0xf')](_0x451ea6):_0x451ea6();};function Preview(_0x4adb3c){this['sequence']=new Sequence();this[_0x49c4('0x10')]=_0x4adb3c[_0x49c4('0x11')];this['trunks']=_0x4adb3c[_0x49c4('0x12')];this[_0x49c4('0x13')]={};this['agents']=_0x4adb3c[_0x49c4('0x14')];this[_0x49c4('0x15')]=0x0;ami['on'](_0x49c4('0x16'),this[_0x49c4('0x17')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x19'),this[_0x49c4('0x1a')][_0x49c4('0x18')](this));ami['on']('hanguprequest',this[_0x49c4('0x1b')][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1c'),this[_0x49c4('0x1d')][_0x49c4('0x18')](this));ami['on']('newexten',this[_0x49c4('0x1e')][_0x49c4('0x18')](this));ami['on']('varset',this['syncVarSet'][_0x49c4('0x18')](this));ami['on'](_0x49c4('0x1f'),this[_0x49c4('0x20')]['bind'](this));ami['on'](_0x49c4('0x21'),this['syncBlindTransfer'][_0x49c4('0x18')](this));this[_0x49c4('0x22')](this[_0x49c4('0x10')]);}function emit(_0x291526,_0x382040,_0x41078c){io['to'](_0x291526)[_0x49c4('0x23')](_0x382040,_0x41078c);}function emitCampaignPreview(_0x46e475){if(_0x46e475[_0x49c4('0x24')]==='outbound'){var _0x527126={'id':_0x46e475['id'],'name':_0x46e475['name'],'strategy':_0x46e475[_0x49c4('0x25')],'answered':_0x46e475['answered'],'available':_0x46e475['available'],'loggedIn':_0x46e475[_0x49c4('0x26')],'pTalking':_0x46e475[_0x49c4('0x27')],'sumBillable':_0x46e475[_0x49c4('0x28')],'sumDuration':_0x46e475[_0x49c4('0x29')],'sumHoldTime':_0x46e475['sumHoldTime']||0x0,'talking':_0x46e475['talking'],'total':_0x46e475[_0x49c4('0x2a')],'type':_0x46e475[_0x49c4('0x24')],'unmanaged':_0x46e475['unmanaged'],'abandoned':_0x46e475[_0x49c4('0x2b')],'waiting':_0x46e475[_0x49c4('0x2c')],'loggedInDb':_0x46e475[_0x49c4('0x2d')],'dialActive':_0x46e475[_0x49c4('0x2e')],'dialMethod':_0x46e475['dialMethod'],'dialOriginateCallerIdName':_0x46e475['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x46e475[_0x49c4('0x2f')],'dialOriginateTimeout':_0x46e475['dialOriginateTimeout'],'dialPrefix':_0x46e475[_0x49c4('0x30')],'outboundAnswerAgiCallsDay':_0x46e475[_0x49c4('0x31')],'outboundAnswerCallsDay':_0x46e475[_0x49c4('0x32')],'outboundBlacklistCallsDay':_0x46e475[_0x49c4('0x33')],'outboundBusyCallsDay':_0x46e475['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x46e475[_0x49c4('0x34')],'outboundDropCallsDayACS':_0x46e475[_0x49c4('0x35')],'outboundDropCallsDayCallersExit':_0x46e475[_0x49c4('0x36')],'outboundDropCallsDayTimeout':_0x46e475[_0x49c4('0x37')],'outboundNoAnswerCallsDay':_0x46e475[_0x49c4('0x38')],'outboundNoSuchCallsDay':_0x46e475[_0x49c4('0x39')],'outboundOriginateFailureCallsDay':_0x46e475[_0x49c4('0x3a')],'outboundReCallsDay':_0x46e475[_0x49c4('0x3b')],'outboundRejectCallsDay':_0x46e475[_0x49c4('0x3c')],'outboundUnknownCallsDay':_0x46e475[_0x49c4('0x3d')],'outboundAbandonedCallsDay':_0x46e475[_0x49c4('0x3e')],'predictiveIntervalAnsweredCalls':_0x46e475['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x46e475['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x46e475['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x46e475[_0x49c4('0x3f')],'predictiveIntervalDroppedCallsTimeout':_0x46e475[_0x49c4('0x40')],'predictiveIntervalErlangCalls':_0x46e475[_0x49c4('0x41')],'predictiveIntervalErlangCallsDroppedCalls':_0x46e475[_0x49c4('0x42')],'predictiveIntervalHitRate':_0x46e475[_0x49c4('0x43')],'predictiveIntervalMultiplicativeFactor':_0x46e475['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x46e475[_0x49c4('0x44')],'predictiveIntervalAvailable':_0x46e475[_0x49c4('0x45')],'predictiveIntervalTotalCalls':_0x46e475[_0x49c4('0x46')],'message':_0x46e475[_0x49c4('0x47')],'originated':_0x46e475['originated'],'erlangCalls':_0x46e475['erlangCalls'],'erlangCallToSecond':_0x46e475[_0x49c4('0x48')],'erlangAbandonmentRate':_0x46e475[_0x49c4('0x49')],'erlangBusyFactor':_0x46e475[_0x49c4('0x4a')],'startPredictive':_0x46e475[_0x49c4('0x4b')],'startProgressive':_0x46e475[_0x49c4('0x4c')]};if(_0x46e475['Trunk']){_0x527126[_0x49c4('0x4d')]={'id':_0x46e475[_0x49c4('0x4d')]['id'],'name':_0x46e475[_0x49c4('0x4d')]['name'],'active':_0x46e475['Trunk'][_0x49c4('0x4e')],'callerid':_0x46e475[_0x49c4('0x4d')][_0x49c4('0x4f')]};}if(_0x46e475[_0x49c4('0x50')]){_0x527126[_0x49c4('0x50')]={'id':_0x46e475[_0x49c4('0x50')]['id'],'name':_0x46e475[_0x49c4('0x50')][_0x49c4('0x51')]};}var _0x3209cd=md5(JSON['stringify'](_0x527126));if(_0x46e475[_0x49c4('0x3')]!==_0x3209cd){_0x46e475['md5']=_0x3209cd;emit(util[_0x49c4('0x52')](_0x49c4('0x53'),_0x527126[_0x49c4('0x51')]),_0x49c4('0x54'),_0x527126);}}}function emitVoiceQueueChannelRemove(_0x4ed4f8){logger[_0x49c4('0x55')](_0x49c4('0x56'),JSON[_0x49c4('0x57')](_0x4ed4f8));emit(util['format'](_0x49c4('0x53'),_0x4ed4f8[_0x49c4('0x51')]),_0x49c4('0x58'),_0x4ed4f8);}function notSendMessagesQueue(_0x5e5366){if(_0x5e5366[_0x49c4('0x59')]){if(_0x5e5366[_0x49c4('0x5a')]===0x0&&_0x5e5366[_0x49c4('0x27')]===0x0){_0x5e5366[_0x49c4('0x59')]=![];_0x5e5366[_0x49c4('0x5b')]=0x0;_0x5e5366[_0x49c4('0x5c')]=0x0;_0x5e5366[_0x49c4('0x47')]='NOT_ACTIVE';ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x5f'));}else{_0x5e5366[_0x49c4('0x47')]=_0x49c4('0x60');ut[_0x49c4('0x5d')](_0x49c4('0x5e'),_0x5e5366[_0x49c4('0x51')]+_0x49c4('0x61'));}emitCampaignPreview(_0x5e5366);}}Preview[_0x49c4('0x62')][_0x49c4('0x22')]=function(){var _0x326142=this;setInterval(function(){_0x326142['syncCampaigns']();},0x7cf);};Preview[_0x49c4('0x62')]['syncCampaigns']=function(){var _0x104efb=this[_0x49c4('0x10')];this[_0x49c4('0x15')]+=0x1;for(var _0x1480da in _0x104efb){if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&(_0x104efb[_0x1480da][_0x49c4('0x64')]==='preview'||_0x104efb[_0x1480da]['dialMethod']===_0x49c4('0x65'))&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(this[_0x49c4('0x15')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x49c4('0x67')]();}}if(_0x104efb[_0x49c4('0x63')](_0x1480da)&&_0x104efb[_0x1480da][_0x49c4('0x64')]===_0x49c4('0x68')&&_0x104efb[_0x1480da][_0x49c4('0x24')]===_0x49c4('0x66')){if(_0x104efb[_0x1480da][_0x49c4('0x2e')]){this[_0x49c4('0x69')](_0x104efb[_0x1480da]);this[_0x49c4('0x6a')](_0x104efb[_0x1480da]);}else{notSendMessagesQueue(_0x104efb[_0x1480da]);}}}};Preview['prototype'][_0x49c4('0x6b')]=function(_0x4d27d0){var _0x33696e=this;this[_0x49c4('0x6c')][_0x49c4('0x6d')](function(){if(!_[_0x49c4('0x6e')](_0x33696e[_0x49c4('0x13')][_0x4d27d0])){loggerAction['info'](_0x49c4('0x6f'),_0x4d27d0,_0x49c4('0x70'),_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')],_0x49c4('0x72'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e['actions'][_0x4d27d0][_0x49c4('0x71')]]['originated']),_0x49c4('0x73'),JSON[_0x49c4('0x57')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]][_0x49c4('0x27')]),JSON[_0x49c4('0x57')](_0x33696e['actions'][_0x4d27d0][_0x49c4('0x74')]),JSON[_0x49c4('0x57')](_['pick'](_0x33696e[_0x49c4('0x13')][_0x4d27d0],[_0x49c4('0x75'),_0x49c4('0x76'),_0x49c4('0x77'),'ListId'])));return ami['Action']({'action':_0x49c4('0x78'),'channel':_0x33696e['actions'][_0x4d27d0][_0x49c4('0x79')]})[_0x49c4('0x7a')](function(_0x3811b2){if(_0x3811b2[_0x49c4('0x47')]===_0x49c4('0x7b')){setTimeout(function(){if(_0x33696e[_0x49c4('0x13')][_0x4d27d0]){ut[_0x49c4('0x7c')](_0x33696e['campaignsPreview'][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));if(_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x74')]===!![]){ut[_0x49c4('0x7e')](_0x33696e[_0x49c4('0x10')][_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]],_0x49c4('0x7d'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0][_0x49c4('0x71')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x4d27d0,_0x33696e[_0x49c4('0x13')][_0x4d27d0]['queue']);delete _0x33696e['actions'][_0x4d27d0];}},0x2328);}});}});};Preview[_0x49c4('0x62')][_0x49c4('0x67')]=function(){var _0x4a0a93=this;loggerAction[_0x49c4('0x55')](_0x49c4('0x7f'),_[_0x49c4('0x80')](this[_0x49c4('0x13')]));for(var _0x50798e in this[_0x49c4('0x13')]){if(_0x4a0a93[_0x49c4('0x13')][_0x49c4('0x63')](_0x50798e)){_0x4a0a93[_0x49c4('0x6b')](_0x50798e);}}};Preview[_0x49c4('0x62')][_0x49c4('0x6a')]=function(_0x5d24f3){var _0x5c7ddd=this;rpcDb[_0x49c4('0x81')](_0x5d24f3['id'],ut[_0x49c4('0x82')](this[_0x49c4('0x14')]))[_0x49c4('0x83')](function(_0x23288e){if(!_[_0x49c4('0x6e')](_0x23288e)){for(var _0xc2033f=0x0;_0xc2033f<_0x23288e['length'];_0xc2033f+=0x1){if(ut[_0x49c4('0x84')](_0x23288e[_0xc2033f][_0x49c4('0x85')])<_0x5d24f3['dialRecallMeTimeout']*0x3c){if(_0x23288e[_0xc2033f][_0x49c4('0x86')]&&!_0x23288e[_0xc2033f]['Agent'][_0x49c4('0x87')]){_0x5c7ddd[_0x49c4('0x88')](_0x23288e[_0xc2033f]['id'])[_0x49c4('0x83')](ut[_0x49c4('0x89')](_0x49c4('0x8a')))[_0x49c4('0x7a')](ut[_0x49c4('0x89')](_0x49c4('0x8a')));}else{rpcDb['disableContact'](_0x23288e[_0xc2033f]['id']);}}else{var _0x3894e0=new Action(_0x23288e[_0xc2033f],_0x5d24f3);_0x3894e0[_0x49c4('0x8b')]=moment()['format'](_0x49c4('0x8c'));_0x5d24f3[_0x49c4('0x3b')]+=0x1;ut['logCustomer'](_0x3894e0,0x17,_0x49c4('0x8d'));if(_0x5d24f3[_0x49c4('0x8e')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x23288e[_0xc2033f]));rpcDb['createCustomerHistory'](_0x3894e0,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x49c4('0x8f')](_0x3894e0,0x16,'RecallFailedTimeout');rpcDb[_0x49c4('0x90')](_0x3894e0,_0x49c4('0x91'));rpcDb['createCustomerFinal'](_0x3894e0,_0x49c4('0x91'));}}}}})[_0x49c4('0x7a')](ut['logger2'](_0x49c4('0x92')));};Preview[_0x49c4('0x62')][_0x49c4('0x69')]=function(_0x35f46f){_0x35f46f['sendMessageOneNotActive']=!![];if(ut[_0x49c4('0x93')](_0x35f46f[_0x49c4('0x26')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x94');}else if(!ut['isActive'](_0x35f46f[_0x49c4('0x2e')])){_0x35f46f['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x35f46f['Trunk'])){if(!this[_0x49c4('0x95')](_0x35f46f[_0x49c4('0x96')])){_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x97');}else{_0x35f46f['message']='ACTIVE';}}else{_0x35f46f[_0x49c4('0x47')]=_0x49c4('0x98');}emitCampaignPreview(_0x35f46f);};Preview[_0x49c4('0x62')][_0x49c4('0x99')]=function(_0x102c15,_0x404f98,_0x3ba0d6){var _0x3b949d=this;var _0x4d49e0=this[_0x49c4('0x13')][_0x404f98];var _0x55e2ba=this[_0x49c4('0x10')][_0x4d49e0[_0x49c4('0x71')]];var _0x1a5d4c;if(_0x55e2ba){switch(_0x3ba0d6){case'1':_0x55e2ba[_0x49c4('0x39')]+=0x1;_0x4d49e0[_0x49c4('0x9a')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x0,_0x49c4('0x9d'));ami[_0x49c4('0x23')](_0x49c4('0x9e'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xa0')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xa1'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xa4'));}else{if(_0x4d49e0[_0x49c4('0x9a')]>=_0x55e2ba['dialNoSuchNumberMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xa4'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countnosuchnumberretry',_0x55e2ba['dialNoSuchNumberRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case _0x49c4('0xaa'):var _0x118fc4=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));_0x4d49e0[_0x49c4('0xab')]=_0x118fc4;_0x4d49e0[_0x49c4('0xac')]=_0x118fc4;_0x4d49e0['dialAnswer']=!![];_0x55e2ba[_0x49c4('0x27')]+=0x1;logger[_0x49c4('0x55')](_0x49c4('0xad'),_0x4d49e0['uniqueid'],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba[_0x49c4('0x27')]);ami[_0x49c4('0x23')](_0x49c4('0xaf'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb0'),this['campaignsPreview'][_0x4d49e0[_0x49c4('0x71')]]));if(_0x55e2ba[_0x49c4('0xb1')]){ami[_0x49c4('0x23')](_0x49c4('0xb2'),ut[_0x49c4('0xb3')](_0x4d49e0));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x49c4('0x9f')](_0x4d49e0,'complete',this[_0x49c4('0x10')][_0x4d49e0['queue']]));emitVoiceQueueChannelRemove(ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xb4')));_0x55e2ba[_0x49c4('0x32')]+=0x1;_0x55e2ba[_0x49c4('0x2a')]+=0x1;_0x55e2ba['answered']+=0x1;ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xb5'));_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xb7'));rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xb8'));rpcDb['crateCustomerReportQueue'](_0x4d49e0);_0x55e2ba[_0x49c4('0x29')]+=_0x4d49e0[_0x49c4('0xb9')];_0x55e2ba['sumBillable']+=_0x4d49e0[_0x49c4('0xb9')];logger['info'](_0x49c4('0xba'),_0x4d49e0[_0x49c4('0xbb')],_0x49c4('0xae'),_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x73'),_0x55e2ba['pTalking']);delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];break;case'BUSY':_0x55e2ba[_0x49c4('0xbc')]+=0x1;_0x4d49e0[_0x49c4('0xbd')]+=0x1;_0x4d49e0['countglobal']=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x5,'Busy');ami[_0x49c4('0x23')](_0x49c4('0xbe'),ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xbf')));rpcDb['createCustomerHistory'](_0x4d49e0,_0x49c4('0xc0'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb['createCustomerFinal'](_0x1a5d4c,_0x49c4('0xc1'));}else{if(_0x4d49e0['countbusyretry']>=_0x55e2ba['dialBusyMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xc0'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,'countbusyretry',_0x55e2ba['dialBusyRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc2'):_0x55e2ba[_0x49c4('0x38')]+=0x1;_0x4d49e0[_0x49c4('0xc3')]+=0x1;_0x4d49e0['countglobal']=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x3,'NoAnswer');ami[_0x49c4('0x23')]('custom:agentnoanswer',ut[_0x49c4('0x9f')](_0x4d49e0,_0x49c4('0xc4')));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xc5'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xc6'));}else{if(_0x4d49e0[_0x49c4('0xc3')]>=_0x55e2ba[_0x49c4('0xc7')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc3'),_0x55e2ba['dialNoAnswerRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case _0x49c4('0xc8'):_0x55e2ba[_0x49c4('0x34')]+=0x1;_0x4d49e0[_0x49c4('0xc9')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x8,_0x49c4('0xca'));ami[_0x49c4('0x23')](_0x49c4('0xcb'),ut['buildObj'](_0x4d49e0,'congestion'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xcc'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xcd'));}else{if(_0x4d49e0[_0x49c4('0xc9')]>=_0x55e2ba[_0x49c4('0xce')]){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xcc'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xc9'),_0x55e2ba[_0x49c4('0xcf')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0['activeContact']);}}break;case'CANCEL':_0x55e2ba[_0x49c4('0x3c')]+=0x1;_0x4d49e0['countagentrejectretry']+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut['totalGlobal'](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0x14,_0x49c4('0xd1'));ami[_0x49c4('0x23')](_0x49c4('0xd2'),ut['buildObj'](_0x4d49e0,'agentreject'));rpcDb[_0x49c4('0x90')](_0x4d49e0,_0x49c4('0xd3'));if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba['dialGlobalMaxRetry']){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0x14,_0x49c4('0xd1'));rpcDb['createCustomerFinal'](_0x1a5d4c,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x4d49e0[_0x49c4('0xd4')]>=_0x55e2ba['dialAgentRejectMaxRetry']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xd5'));}else{rpcDb['rescheduleContact'](ut[_0x49c4('0xa7')](_0x4d49e0,_0x49c4('0xd4'),_0x55e2ba['dialAgentRejectRetryFrequency']),_0x4d49e0['unlockAgent'],_0x4d49e0[_0x49c4('0xa8')]);}}break;case'ABANDONED':_0x55e2ba[_0x49c4('0x3e')]+=0x1;_0x4d49e0[_0x49c4('0xd6')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xb,_0x49c4('0xd7'));rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut[_0x49c4('0xa3')](_0x4d49e0,0xf,_0x49c4('0xd8'));rpcDb[_0x49c4('0xa5')](_0x1a5d4c,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x4d49e0[_0x49c4('0xd9')]>=_0x55e2ba['dialAbandonedMaxRety']){rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xda'));}else{rpcDb[_0x49c4('0xa6')](ut[_0x49c4('0xa7')](_0x4d49e0,'countabandonedretry',_0x55e2ba[_0x49c4('0xdb')]),_0x4d49e0[_0x49c4('0xd0')],_0x4d49e0[_0x49c4('0xa8')]);}}break;default:if(_0x4d49e0[_0x49c4('0x74')]){ut[_0x49c4('0x7e')](_0x55e2ba,_0x49c4('0xdc'));ut['loggerError'](_0x49c4('0xdd')+_0x55e2ba['name'],_0x102c15);}_0x55e2ba[_0x49c4('0x3d')]+=0x1;_0x4d49e0[_0x49c4('0x9b')]=ut[_0x49c4('0x9c')](_0x4d49e0);ut[_0x49c4('0x8f')](_0x4d49e0,0xc,_0x102c15['cause-txt']||_0x102c15[_0x49c4('0xde')]);rpcDb[_0x49c4('0x90')](_0x4d49e0,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x49c4('0x9c')](_0x4d49e0)>=_0x55e2ba[_0x49c4('0xa2')]){_0x1a5d4c=ut['cloneAction'](_0x4d49e0,0xf,'Global');rpcDb[_0x49c4('0xa5')](_0x1a5d4c,_0x49c4('0xdf'));}else{rpcDb[_0x49c4('0xa5')](_0x4d49e0,_0x49c4('0xdf'));}delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];}if(!(_0x4d49e0[_0x49c4('0x74')]&&_0x3ba0d6==='16')){ut[_0x49c4('0x7c')](_0x55e2ba,_0x49c4('0xe0'));logger[_0x49c4('0x55')](_0x49c4('0xe1'),_0x4d49e0['uniqueid'],'\x20Queue',_0x55e2ba[_0x49c4('0x51')],_0x49c4('0x72'),_0x55e2ba[_0x49c4('0x5a')]);}if(_0x3ba0d6!=='ANSWER'){delete this[_0x49c4('0x13')][_0x102c15[_0x49c4('0xa9')]];delete this['actions'][_0x102c15[_0x49c4('0xe2')]];}}};Preview['prototype'][_0x49c4('0xe3')]=function(_0x308b45,_0x2adf4f,_0x941b9d){if(_['isUndefined'](_0x2adf4f)&&_0x49c4('0xe4')!==typeof _0x2adf4f){return;}if(_[_0x49c4('0xe5')](_0x941b9d)&&_0x49c4('0xe4')!==typeof _0x941b9d){return;}switch(_0x941b9d[_0x49c4('0xe6')]){case'0':ut[_0x49c4('0xe7')](_0x308b45,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x308b45,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x49c4('0xe7')](_0x308b45,0x3,_0x49c4('0xe8'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xea'));break;case'5':ut[_0x49c4('0xe7')](_0x308b45,0x5,'Busy');rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xeb'));break;case'8':ut[_0x49c4('0xe7')](_0x308b45,0x8,_0x49c4('0xca'));rpcDb['createAgentHistory'](_0x308b45,_0x49c4('0xec'));break;case'22':ut[_0x49c4('0xe7')](_0x308b45,0x16,_0x49c4('0xed'));rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xee'));break;default:ut['logAgent'](_0x308b45,0xc,_0x941b9d[_0x49c4('0xe6')]);rpcDb[_0x49c4('0xe9')](_0x308b45,_0x49c4('0xec'));}ut['updateOriginated'](_0x2adf4f,_0x49c4('0xef'));logger[_0x49c4('0x55')](_0x49c4('0xf0'),_0x308b45['uniqueid'],_0x49c4('0xae'),_0x2adf4f['name'],'originated:\x20',_0x2adf4f[_0x49c4('0x5a')]);delete this[_0x49c4('0x13')][_0x308b45['uniqueid']];};Preview[_0x49c4('0x62')][_0x49c4('0xf1')]=function(_0xf0bb4f,_0x1ffc9a,_0x10f5fc,_0x3a7559,_0x148619){var _0x219133=this;return new BPromise(function(_0x59dbef,_0x56ed92){if(_[_0x49c4('0x6e')](_0x1ffc9a)||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0xf2')])||_['isNil'](_0x1ffc9a['Contact'][_0x49c4('0xf3')])||_[_0x49c4('0x6e')](_0x1ffc9a[_0x49c4('0x77')])){_0x56ed92(ut[_0x49c4('0x47')](_0x49c4('0xf4'),_0x3a7559,_0x148619));return;}var _0x14f2fc=uuid['v4']();var _0xbabd3b=_0x219133[_0x49c4('0x10')][_0x1ffc9a[_0x49c4('0x70')][_0x49c4('0x51')]];var _0xa42e74=_0x10f5fc?_0x219133[_0x49c4('0x14')][_0x10f5fc]['id']:undefined;_0x219133[_0x49c4('0x13')][_0x14f2fc]=new Action(_0x1ffc9a,_0xbabd3b,_0x14f2fc,_0x10f5fc,_0xa42e74);var _0xbfb25b=_0x219133['actions'][_0x14f2fc];_0xbfb25b[_0x49c4('0xd0')]=_0x3a7559;_0xbfb25b[_0x49c4('0xa8')]=_0x148619;_0xbfb25b[_0x49c4('0xf5')]=_0x10f5fc;if(_[_0x49c4('0xf6')](_0xf0bb4f)){_0x219133['execCall'](_0xbfb25b,_0xbabd3b,_0x1ffc9a,_0x10f5fc)['then'](function(_0xb4a33d){logger['info'](_0x49c4('0xf7'),_0x49c4('0xf8')+_0xbfb25b[_0x49c4('0x71')]+_0x49c4('0xf9')+_0xbfb25b[_0x49c4('0xfa')],JSON[_0x49c4('0x57')](_0xb4a33d));ami[_0x49c4('0x23')](_0x49c4('0xfb'),ut[_0x49c4('0x9f')](_0xbfb25b,_0x49c4('0xfc'),_0x219133[_0x49c4('0x10')][_0xbfb25b[_0x49c4('0x71')]]));_0x59dbef(ut['message'](_0x49c4('0xfd')));})[_0x49c4('0x7a')](function(_0x405c63){ut['logger'](_0x49c4('0xfe'),_0x405c63);_0x56ed92(ut['message'](_0x49c4('0xff'),_0x3a7559,_0x148619));});}else{_0xbabd3b[_0x49c4('0x33')]+=0x1;ut[_0x49c4('0x100')](_0xbfb25b);rpcDb[_0x49c4('0x101')](_0xbfb25b,'[Blacklist][error]');delete _0x219133[_0x49c4('0x13')][_0x14f2fc];_0x56ed92(ut['message']('Contact\x20in\x20black\x20List',_0x3a7559,_0x148619));}});};Preview[_0x49c4('0x62')][_0x49c4('0x95')]=function(_0x1c38a5){return!_['isNil'](_0x1c38a5)&&!_['isNil'](_0x1c38a5[_0x49c4('0x51')])&&!_[_0x49c4('0x6e')](_0x1c38a5[_0x49c4('0x4e')])&&_0x1c38a5[_0x49c4('0x4e')]&&!_[_0x49c4('0x6e')](this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5[_0x49c4('0x51')])])&&!_['isNil'](this[_0x49c4('0x12')][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5['name'])][_0x49c4('0x78')])&&(this['trunks'][util[_0x49c4('0x52')]('SIP/%s',_0x1c38a5[_0x49c4('0x51')])]['status']===_0x49c4('0x103')||this[_0x49c4('0x12')][util[_0x49c4('0x52')](_0x49c4('0x102'),_0x1c38a5['name'])]['status']===_0x49c4('0x104'));};Preview[_0x49c4('0x62')][_0x49c4('0x88')]=function(_0x5737b4,_0x367d3d){var _0x1814c4=this;return new BPromise(function(_0x5ae29d,_0x5f2411){_0x1814c4[_0x49c4('0x105')](_0x5737b4,_0x367d3d)[_0x49c4('0x83')](function(_0xa0698d){_0x5ae29d(_['pick'](_0xa0698d,[_0x49c4('0x47')]));})[_0x49c4('0x7a')](function(_0x278225){if(_0x278225[_0x49c4('0x106')]){rpcDb['unlockContact'](_0x5737b4);}if(_0x278225[_0x49c4('0x4e')]){rpcDb['disableContact'](_0x5737b4);}_0x5f2411(_['pick'](_0x278225,[_0x49c4('0x47')]));});});};Preview[_0x49c4('0x62')][_0x49c4('0x105')]=function(_0x24ff20,_0x5adb90){var _0x32b6e4=this;return new BPromise(function(_0x947dd8,_0xa6f48){var _0x37dd25,_0x52a022;rpcDb[_0x49c4('0x107')](_0x24ff20)['then'](function(_0x54db51){if(!_[_0x49c4('0x6e')](_0x54db51[0x0])){_0x52a022=_0x54db51[0x0][_0x49c4('0x108')]?![]:!![];_0x37dd25=_0x54db51[0x0][_0x49c4('0x108')]?!![]:![];_0x37dd25=_0x5adb90?!![]:_0x37dd25;}var _0x56a631=_0x32b6e4[_0x49c4('0x109')](_0x54db51);if(_0x56a631['isValid']){rpcDb[_0x49c4('0x10a')](_[_0x49c4('0x10b')](_0x54db51[0x0],[_0x49c4('0x77'),_0x49c4('0x10c')]))[_0x49c4('0x83')](function(_0x2a5743){_0x32b6e4[_0x49c4('0xf1')](_0x2a5743,_0x54db51[0x0],_0x5adb90,_0x52a022,_0x37dd25)['then'](function(_0x3808e6){_0x947dd8(_0x3808e6);})[_0x49c4('0x7a')](function(_0x2f3c7e){_0xa6f48(_0x2f3c7e);});})[_0x49c4('0x7a')](function(_0x4f30d4){ut['logger']('[Preview][checkIsBlackList]',_0x4f30d4);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),_0x52a022,_0x37dd25));});}else{_0xa6f48(ut[_0x49c4('0x47')](_0x56a631[_0x49c4('0x47')],_0x52a022,_0x37dd25));}})[_0x49c4('0x7a')](function(_0x40c7ab){ut[_0x49c4('0x5d')]('[Preview][getContactPreview]',_0x40c7ab);_0xa6f48(ut[_0x49c4('0x47')](_0x49c4('0x10d'),![],!![]));});});};Preview['prototype']['validateContact']=function(_0x4dbb25){if(_[_0x49c4('0x6e')](_0x4dbb25)||_[_0x49c4('0xf6')](_0x4dbb25)||!_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')])&&_[_0x49c4('0x6e')](_0x4dbb25[0x0][_0x49c4('0x86')][_0x49c4('0x51')])){ut['logger'](_0x49c4('0x10e'),_0x4dbb25);return{'isValid':![],'message':_0x49c4('0x10f')};}var _0x2f8042=this[_0x49c4('0x10')][_0x4dbb25[0x0]['Queue'][_0x49c4('0x51')]];_0x2f8042[_0x49c4('0x47')]=_0x49c4('0x98');if(_[_0x49c4('0x6e')](_0x2f8042)){ut[_0x49c4('0x5d')]('[Preview][validateContact][Empty\x20Campaign]',_0x2f8042);return{'isValid':![],'message':_0x49c4('0x110')};}if(!this['isTrunkReachable'](_0x2f8042['Trunk'])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x113'));if(!this['isTrunkReachable'](_0x2f8042[_0x49c4('0x96')])){ut[_0x49c4('0x5d')](_0x49c4('0x111'),_0x2f8042['name']+_0x49c4('0x114'));return{'isValid':![],'message':_0x49c4('0x115')};}}if(!ut['isActive'](_0x2f8042[_0x49c4('0x2e')])){ut[_0x49c4('0x5d')](_0x49c4('0x116'),_0x2f8042[_0x49c4('0x51')]+_0x49c4('0x117'));return{'isValid':![],'message':_0x49c4('0x112')+_0x2f8042[_0x49c4('0x51')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x49c4('0x118')};};Preview[_0x49c4('0x62')][_0x49c4('0x119')]=function(_0xc7501c,_0x3d9fa7,_0x49c583,_0x34ce60){var _0x39dc83=this;return new BPromise(function(_0x28b1d0,_0x3f62a2){var _0xa2c8cf=_0xc7501c['uniqueid'];var _0x2582e3=_0x39dc83[_0x49c4('0x95')](_0x3d9fa7[_0x49c4('0x4d')])?util[_0x49c4('0x52')](_0x49c4('0x11a'),_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x30')])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')][_0x49c4('0x11c')](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact']['phone']):util[_0x49c4('0x52')](_0x49c4('0x11a'),_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x51')]:_0x3d9fa7['TrunkBackup'][_0x49c4('0x51')],_[_0x49c4('0x6e')](_0x3d9fa7['dialPrefix'])?'':_0x3d9fa7[_0x49c4('0x30')]['trim']()||'',_0x3d9fa7[_0x49c4('0x11b')]>0x0?_0x49c583[_0x49c4('0xf2')][_0x49c4('0xf3')]['substring'](_0x3d9fa7[_0x49c4('0x11b')]):_0x49c583['Contact'][_0x49c4('0xf3')]);var _0x5025ee=_0x39dc83['isTrunkReachable'](_0x3d9fa7[_0x49c4('0x4d')])?ut[_0x49c4('0x11d')](_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')],_0x3d9fa7[_0x49c4('0x11e')],_0x3d9fa7[_0x49c4('0x11f')]>0x0?ut['getCallerIdRandom'](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]):ut[_0x49c4('0x11d')](_[_0x49c4('0x6e')](_0x3d9fa7[_0x49c4('0x96')])?_0x3d9fa7[_0x49c4('0x4d')][_0x49c4('0x4f')]:_0x3d9fa7['TrunkBackup']['callerid'],_0x3d9fa7['dialOriginateCallerIdName'],_0x3d9fa7['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x49c4('0x120')](_0x3d9fa7['dialOriginateCallerIdNumber'],_0x3d9fa7[_0x49c4('0x11f')]):_0x3d9fa7[_0x49c4('0x2f')]);if(_0x5025ee){_0xc7501c[_0x49c4('0x121')]=ut['extractCalleridName'](_0x5025ee);_0xc7501c['originatecalleridnum']=ut[_0x49c4('0x122')](_0x5025ee);}var _0x50088b=ut['addVariables'](_0x3d9fa7,_0x49c583,_0x2582e3,_0x5025ee,_0xa2c8cf,_0xc7501c);_[_0x49c4('0x123')](_0xc7501c,ut[_0x49c4('0x124')](_0x50088b));_0xc7501c[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));ami[_0x49c4('0x125')](ut['variablesAction'](_0xc7501c,_0x3d9fa7,_0x50088b,_0xc7501c[_0x49c4('0xa8')],_0x34ce60))[_0x49c4('0x83')](function(_0x234848){_0x3d9fa7['originated']+=0x1;logger[_0x49c4('0x55')](_0x49c4('0x126'),_0xa2c8cf,_0x49c4('0xae'),_0x3d9fa7[_0x49c4('0x51')],_0x49c4('0x72'),_0x3d9fa7[_0x49c4('0x5a')]);_0x28b1d0(_0x234848);})[_0x49c4('0x7a')](function(_0x414410){ut['logAgent'](_0xc7501c,0xe,_0x49c4('0x127'));rpcDb[_0x49c4('0xe9')](_0xc7501c,_0x49c4('0x128'));_0x3f62a2(_0x414410);});});};Preview[_0x49c4('0x62')][_0x49c4('0x1e')]=function(_0x471ec6){if(this['actions'][_0x471ec6[_0x49c4('0xa9')]]){this[_0x49c4('0x13')][_0x471ec6[_0x49c4('0xa9')]][_0x49c4('0x79')]=_0x471ec6[_0x49c4('0x79')];}};Preview[_0x49c4('0x62')][_0x49c4('0x17')]=function(_0x1642fd){var _0x4806ac=this;var _0xc641bc=this[_0x49c4('0x13')][_0x1642fd[_0x49c4('0x129')]];if(_0xc641bc){if(_0xc641bc[_0x49c4('0xf5')]&&this[_0x49c4('0x14')][_0xc641bc['lookAgent']]){ut['logLookAgent'](_0xc641bc,this[_0x49c4('0x14')][_0xc641bc[_0x49c4('0xf5')]]['name'],this['agents'][_0xc641bc[_0x49c4('0xf5')]]['id']);}var _0x57062c=_[_0x49c4('0x12a')](_0xc641bc);_0x57062c[_0x49c4('0xab')]=moment()[_0x49c4('0x52')](_0x49c4('0x8c'));var _0x2a24bf=_0x4806ac[_0x49c4('0x10')][_0xc641bc[_0x49c4('0x71')]];if(ut[_0x49c4('0x12b')](_0x1642fd['response'])){if(_0xc641bc[_0x49c4('0xd0')]){rpcDb[_0x49c4('0x12c')](_0xc641bc[_0x49c4('0xfa')]);}if(_0xc641bc[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0xc641bc['idContact']);}ami[_0x49c4('0x23')](_0x49c4('0x12e'),ut['buildObj'](_0xc641bc,_0x49c4('0x12f'),this[_0x49c4('0x10')][_0xc641bc['queue']]));this[_0x49c4('0xe3')](_0x57062c,_0x2a24bf,_0x1642fd);}else{_0xc641bc[_0x49c4('0x8b')]=moment()[_0x49c4('0x52')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x49c4('0xe7')](_0x57062c,0x4,_0x49c4('0xb6'));rpcDb[_0x49c4('0xe9')](_0x57062c,_0x49c4('0x130'));}}};Preview['prototype'][_0x49c4('0x1a')]=function(_0x5786a4){var _0x3508b7=this;var _0x20f67e=this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]];var _0x5a28cc;if(_0x20f67e){_0x5a28cc=this[_0x49c4('0x10')][_0x20f67e[_0x49c4('0x71')]];logger[_0x49c4('0x55')](_0x49c4('0x131'),_0x5786a4[_0x49c4('0xa9')],_0x49c4('0xae'),_0x5a28cc['name'],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);}if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]&&_0x5786a4[_0x49c4('0xa9')]!==_0x5786a4[_0x49c4('0xbb')]){if(_0x5786a4[_0x49c4('0x132')]==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this['actions'][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger['info'](_0x49c4('0x133'),_0x5786a4['linkedid'],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc['name'],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}}else if(_0x20f67e&&_['isNil'](_0x20f67e[_0x49c4('0x134')])&&_0x5a28cc['dialQueueProject']&&_0x5786a4[_0x49c4('0xa9')]===_0x5786a4[_0x49c4('0xbb')]&&_[_0x49c4('0x6e')](_0x5786a4['reason'])&&_0x5786a4[_0x49c4('0x132')]==='16'&&_0x5786a4[_0x49c4('0x135')]==='6'&&_[_0x49c4('0xe5')](_0x20f67e['transfer'])){if(_0x20f67e['unlockAgent']){rpcDb[_0x49c4('0x12c')](_0x20f67e[_0x49c4('0xfa')]);}if(_0x20f67e[_0x49c4('0xa8')]){rpcDb[_0x49c4('0x12d')](_0x20f67e[_0x49c4('0xfa')]);}_0x5786a4[_0x49c4('0xe6')]='22';this['callProgressDetectingAgent'](_0x20f67e,_0x5a28cc,_0x5786a4);}else if(_0x20f67e&&_0x20f67e['transfer']){if(_0x5786a4['cause']==='16'&&this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]][_0x49c4('0x74')]){logger[_0x49c4('0x55')]('[syncHangup][talking][transfer]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],_0x49c4('0x73'),_0x5a28cc[_0x49c4('0x27')]);this[_0x49c4('0x99')](_0x5786a4,_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')]);}else if(this[_0x49c4('0x13')][_0x5786a4[_0x49c4('0xa9')]]['dialAnswer']){logger[_0x49c4('0x55')]('[syncHangup][talking][cause]',_0x5786a4[_0x49c4('0xa9')],_0x5786a4[_0x49c4('0x132')],_0x49c4('0xae'),_0x5a28cc[_0x49c4('0x51')],'pTalking:\x20',_0x5a28cc[_0x49c4('0x27')]);this['callProgressDetectingCustomer'](_0x5786a4,_0x5786a4['linkedid'],_0x5786a4['cause']);}}};Preview[_0x49c4('0x62')][_0x49c4('0x1d')]=function(_0x3f2b3a){if(this['actions'][_0x3f2b3a[_0x49c4('0xe2')]]&&_0x3f2b3a['destlinkedid']!==_0x3f2b3a[_0x49c4('0x136')]){this[_0x49c4('0x99')](_0x3f2b3a,_0x3f2b3a[_0x49c4('0xe2')],_0x3f2b3a['dialstatus']);}};Preview[_0x49c4('0x62')][_0x49c4('0x1b')]=function(_0x2028e5){if(this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]]&&_0x2028e5['linkedid']!==_0x2028e5[_0x49c4('0xbb')]&&!this[_0x49c4('0x13')][_0x2028e5[_0x49c4('0xa9')]][_0x49c4('0x74')]){if(_0x2028e5['cause']==='1'){this['callProgressDetectingCustomer'](_0x2028e5,_0x2028e5[_0x49c4('0xa9')],_0x2028e5[_0x49c4('0x132')]);}}};Preview['prototype'][_0x49c4('0x137')]=function(_0x2fd09b,_0x10a39c,_0x2e1a4e){if(this['actions'][_0x2fd09b]){if(_[_0x49c4('0x6e')](this[_0x49c4('0x13')][_0x2fd09b]['variables'])){this['actions'][_0x2fd09b][_0x49c4('0x138')]={};}this[_0x49c4('0x13')][_0x2fd09b][_0x49c4('0x138')][_0x10a39c]=_0x2e1a4e;}};Preview[_0x49c4('0x62')][_0x49c4('0x139')]=function(_0x5ee9f1){try{if(!_[_0x49c4('0x6e')](_0x5ee9f1)){if(ut['filterKey'](_[_0x49c4('0x13a')](_0x5ee9f1[_0x49c4('0x13b')])[0x0])){this[_0x49c4('0x137')](_0x5ee9f1[_0x49c4('0xbb')],_['keys'](_0x5ee9f1['variable'])[0x0],_0x5ee9f1['value']);}}}catch(_0x3ed327){logger[_0x49c4('0x13c')](_0x49c4('0x13d'),util[_0x49c4('0x13e')](_0x3ed327,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x7f9737){if(_0x7f9737){if(this['actions'][_0x7f9737[_0x49c4('0x13f')]]){this[_0x49c4('0x13')][_0x7f9737['transfertargetlinkedid']][_0x49c4('0x140')]=!![];}}};Preview[_0x49c4('0x62')][_0x49c4('0x141')]=function(_0x5529f6){if(_0x5529f6){if(this[_0x49c4('0x13')][_0x5529f6[_0x49c4('0x142')]]){this[_0x49c4('0x13')][_0x5529f6['transfererlinkedid']][_0x49c4('0x140')]=!![];}}};module[_0x49c4('0x143')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 19c88bb..01f2aa4 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 _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 +var _0x3c6c=['assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','createHistory','catch','resolve','then','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime'];(function(_0x42779c,_0x4f12cf){var _0x101538=function(_0x19813a){while(--_0x19813a){_0x42779c['push'](_0x42779c['shift']());}};_0x101538(++_0x4f12cf);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x39db70,_0x2cb5cf){_0x39db70=_0x39db70-0x0;var _0x209c11=_0x3c6c[_0x39db70];return _0x209c11;};'use strict';var util=require(_0xc3c6('0x0'));var BPromise=require('bluebird');var logger=require(_0xc3c6('0x1'))(_0xc3c6('0x2'));var _=require(_0xc3c6('0x3'));var cmHopper=require(_0xc3c6('0x4'));var cmHopperFinal=require(_0xc3c6('0x5'));var cmHopperHistory=require(_0xc3c6('0x6'));var cmHopperBlack=require(_0xc3c6('0x7'));var voiceQueueRt=require(_0xc3c6('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xc3c6('0x9'));function loggerCatch(_0x4a2ca1){return function(_0xe7731e){logger['error'](_0x4a2ca1,util['inspect'](_0xe7731e,{'showHidden':![],'depth':null}));};}function create(_0x4aed87){return BPromise['resolve']()['then'](cmHopperHistory[_0xc3c6('0xa')](_0x4aed87))[_0xc3c6('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x168fdc){return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](agentReportPreview[_0xc3c6('0xa')](_0x168fdc))['catch'](loggerCatch(_0xc3c6('0xe')));}function moveContact(_0x3ba85a){return BPromise[_0xc3c6('0xc')]()['then'](cmHopper['moveContactManagedDialer'](_0x3ba85a,!![]))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0xf')));}exports[_0xc3c6('0x10')]=function(_0x648a0){return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](cmHopperBlack[_0xc3c6('0x10')](_0x648a0))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x11')));};exports[_0xc3c6('0x12')]=function(_0x5e42b8){return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](cmHopper[_0xc3c6('0x12')](_0x5e42b8))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x13')));};exports[_0xc3c6('0xa')]=function(_0x181b3b,_0x33920c){create(_0x181b3b)[_0xc3c6('0xb')](loggerCatch(_0x33920c));moveContact(_0x181b3b)[_0xc3c6('0xb')](loggerCatch(_0x33920c));};exports[_0xc3c6('0x14')]=function(_0x26c9b0,_0x11df9a){createAgent(_0x26c9b0)[_0xc3c6('0xb')](loggerCatch(_0x11df9a));};exports[_0xc3c6('0x15')]=function(_0x50a39c,_0x23cd62){create(_0x50a39c)[_0xc3c6('0xb')](loggerCatch(_0x23cd62));};exports[_0xc3c6('0x16')]=function(_0x248bfe,_0x3893c4){moveContact(_0x248bfe)[_0xc3c6('0xb')](loggerCatch(_0x3893c4));};exports[_0xc3c6('0x17')]=function(_0x3490a2,_0x22d170,_0x22aa76){if(_0x22d170){_0x3490a2[_0xc3c6('0x18')]=null;}if(_0x22aa76){_0x3490a2[_0xc3c6('0x19')]=![];}return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](cmHopper[_0xc3c6('0x17')](_0x3490a2))[_0xc3c6('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xc3c6('0x1a')]=function(_0x40893b){return BPromise[_0xc3c6('0xc')]()['then'](cmHopper[_0xc3c6('0x1a')](_0x40893b))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x1b')));};exports[_0xc3c6('0x1c')]=function(_0x2bc9bf){return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](cmHopper['unlockContact']({'UserId':null},_0x2bc9bf,0x1))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x1d')));};exports['disableContact']=function(_0x24c417){return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](cmHopper[_0xc3c6('0x1c')]({'active':![]},_0x24c417,0x1))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x1e')));};exports[_0xc3c6('0x1f')]=function(_0x2e4094){var _0x1f1d36={};_0x1f1d36['type']=_0x2e4094[_0xc3c6('0x20')];_0x1f1d36[_0xc3c6('0x21')]=_0x2e4094[_0xc3c6('0x21')];_0x1f1d36[_0xc3c6('0x22')]=_0x2e4094['calleridnum'];_0x1f1d36[_0xc3c6('0x23')]=_0x2e4094[_0xc3c6('0x23')];_0x1f1d36[_0xc3c6('0x24')]=_0x2e4094[_0xc3c6('0x24')];_0x1f1d36[_0xc3c6('0x25')]=_0x2e4094[_0xc3c6('0x26')];_0x1f1d36['queuecallerleaveAt']=_0x2e4094[_0xc3c6('0x26')];_0x1f1d36[_0xc3c6('0x27')]=0x1;_0x1f1d36[_0xc3c6('0x28')]=_0x2e4094[_0xc3c6('0x29')];_0x1f1d36[_0xc3c6('0x2a')]=_0x2e4094['membername'];_0x1f1d36[_0xc3c6('0x2b')]=_0xc3c6('0x2c');_0x1f1d36[_0xc3c6('0x2d')]=_0xc3c6('0x2e');_0x1f1d36[_0xc3c6('0x2f')]=0x0;_0x1f1d36[_0xc3c6('0x30')]=0x1;_0x1f1d36[_0xc3c6('0x31')]=_0x2e4094['membername'];_0x1f1d36[_0xc3c6('0x32')]='COMPLETED';return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](voiceQueueReport[_0xc3c6('0x33')](_0x1f1d36))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x34')));};exports[_0xc3c6('0x35')]=function(_0x4ba1ae,_0x36562e){return BPromise[_0xc3c6('0xc')]()['then'](cmHopper[_0xc3c6('0x35')](_0x4ba1ae,_0x36562e))[_0xc3c6('0xb')](loggerCatch(_0xc3c6('0x36')));};exports[_0xc3c6('0x37')]=function(_0x4140df){return BPromise[_0xc3c6('0xc')]()[_0xc3c6('0xd')](cmHopper['rescheduleContact'](_0x4140df,!![],!![]))['catch'](loggerCatch(_0xc3c6('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 1517d00..3ca3984 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 _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 +var _0x49fb=['ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','membername','UserId','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','countcongestionretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','isNil','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','buildAcw','queue','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','seconds','createBody','CampaignId','filterKey','idContact','type','dialAnswer','countbusyretry','countnoanswerretry','countglobal','callback','callbackuniqueid','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','diff','loggerCatch','error','inspect','info','loggerError','logger2','message','isUndefined','string','format','\x22%s\x22\x20<%s>','isEmpty','\x22\x22\x20<>','addVariables','name','calleridname','calleridnum'];(function(_0x54b943,_0x1c9e16){var _0x2c1052=function(_0x31d3b8){while(--_0x31d3b8){_0x54b943['push'](_0x54b943['shift']());}};_0x2c1052(++_0x1c9e16);}(_0x49fb,0x76));var _0xb49f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x49fb[_0x4b369d];return _0x571a98;};'use strict';var util=require('util');var _=require(_0xb49f('0x0'));var moment=require(_0xb49f('0x1'));var logger=require(_0xb49f('0x2'))(_0xb49f('0x3'));var ipAgi=process['env'][_0xb49f('0x4')]||_0xb49f('0x5');function getSeconds(_0x225b90,_0x369664){var _0x4040a7=moment(_0x225b90)['milliseconds'](0x0);var _0x1ff70a=moment(_0x369664)['milliseconds'](0x0);return _0x4040a7[_0xb49f('0x6')](_0x1ff70a,'seconds');}exports[_0xb49f('0x7')]=function(_0xa5e40){return function(_0x35db0d){logger[_0xb49f('0x8')](_0xa5e40,util[_0xb49f('0x9')](_0x35db0d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x80093a,_0x515840){logger[_0xb49f('0xa')](_0x80093a,util[_0xb49f('0x9')](_0x515840,{'showHidden':![],'depth':null}));};exports[_0xb49f('0xb')]=function(_0x17b222,_0x3a725d){logger[_0xb49f('0x8')](_0x17b222,util[_0xb49f('0x9')](_0x3a725d,{'showHidden':![],'depth':null}));};exports[_0xb49f('0xc')]=function(_0x31cab9){return function(_0x182f65){logger[_0xb49f('0xa')](_0x31cab9,util[_0xb49f('0x9')](_0x182f65,{'showHidden':![],'depth':null}));};};exports[_0xb49f('0xd')]=function(_0x31bcc8,_0x193fbb,_0x4a01cb){return{'message':_0x31bcc8,'unlock':_0x193fbb,'active':_0x4a01cb};};exports['getCallerId']=function(_0x4fd7d3,_0x5ad6ab,_0x15cda7){if(!_[_0xb49f('0xe')](_0x15cda7)&&'string'===typeof _0x15cda7&&!_['isEmpty'](_0x15cda7)){if(!_[_0xb49f('0xe')](_0x5ad6ab)&&_0xb49f('0xf')===typeof _0x5ad6ab&&!_['isEmpty'](_0x5ad6ab)){return util[_0xb49f('0x10')](_0xb49f('0x11'),_0x5ad6ab,_0x15cda7);}return util[_0xb49f('0x10')]('\x22%s\x22\x20<%s>',_0x15cda7,_0x15cda7);}if(!_[_0xb49f('0xe')](_0x4fd7d3)&&_0xb49f('0xf')===typeof _0x4fd7d3&&!_[_0xb49f('0x12')](_0x4fd7d3)){return _0x4fd7d3;}return _0xb49f('0x13');};exports['isActive']=function(_0x49b0a9){if(_['isNil'](_0x49b0a9)){return![];}return _0x49b0a9;};exports[_0xb49f('0x14')]=function(_0x98fc78,_0x3b2ea0,_0x9d2581,_0x3a109c,_0x4ec401,_0xfaeb62){var _0x338d7f={'XMD-QUEUE':_0x3b2ea0['Queue']?_0x3b2ea0['Queue'][_0xb49f('0x15')]:'','XMD-CALLERID':_0x3a109c,'XMD-CALLERID-PREVIEW':_0xfaeb62?util[_0xb49f('0x10')](_0xb49f('0x11'),_0xfaeb62[_0xb49f('0x16')],_0xfaeb62[_0xb49f('0x17')]):_0x3a109c,'XMD-DIALID':_0x4ec401,'XMD-CONTACTID':_0x3b2ea0[_0xb49f('0x18')],'XMD-CDRTYPE':_0xb49f('0x19'),'CALLERID(all)':_0x3a109c,'XMD-VOICEQUEUEID':_0x3b2ea0[_0xb49f('0x1a')],'XMD-DIALCHANNEL':_0x9d2581,'XMD-DIALTIMEOUT':_0x98fc78[_0xb49f('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0xb49f('0x10')](_0xb49f('0x1c'),_0x98fc78[_0xb49f('0x1d')]?'g':'',_[_0xb49f('0x12')](_0x98fc78[_0xb49f('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x98fc78['dialPreviewUrl']||'','XMD-AGI':_0x98fc78['dialQueueProject']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x98fc78[_0xb49f('0x1f')]):_0xb49f('0x20'),'XMD-AGIAFTER':_0x98fc78[_0xb49f('0x1d')]?util[_0xb49f('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x98fc78[_0xb49f('0x1d')]):_0xb49f('0x20'),'XMD-ORIGINATECALLERIDNUM':_0xfaeb62?_0xfaeb62[_0xb49f('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0xfaeb62?_0xfaeb62[_0xb49f('0x22')]:'','XMD-DESTINATION':_0xb49f('0x23')};if(!_[_0xb49f('0x12')](_0x98fc78[_0xb49f('0x1e')])){_0x338d7f[util['format']('%s',_0xb49f('0x24'))]=_0x98fc78[_0xb49f('0x1e')];_0x338d7f[util[_0xb49f('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4ec401;}if(_0x3b2ea0&&_0x3b2ea0[_0xb49f('0x25')]){for(var _0x109089 in _0x3b2ea0[_0xb49f('0x25')]){if(_0x3b2ea0[_0xb49f('0x25')][_0xb49f('0x26')](_0x109089)){if(!_['isNil'](_0x3b2ea0[_0xb49f('0x25')][_0x109089])&&_0x109089!=='id'&&_0x109089!==_0xb49f('0x27')&&_0x109089!==_0xb49f('0x28')&&_0x109089!==_0xb49f('0x29')){_0x338d7f[util['format'](_0xb49f('0x2a'),'XMD-',_[_0xb49f('0x2b')](_0x109089))]=_0x3b2ea0[_0xb49f('0x25')][_0x109089];}}}}return _0x338d7f;};exports[_0xb49f('0x2c')]=function(_0x5311b3){var _0xb243f2={};for(var _0x225033 in _0x5311b3){if(_0x5311b3[_0xb49f('0x26')](_0x225033)){_0xb243f2[util['format']('%s',_[_0xb49f('0x2d')](_0x225033))]=_0x5311b3[_0x225033];}}return{'variables':_0xb243f2};};exports[_0xb49f('0x2e')]=function(_0x139c2f,_0x3c56c3){if(!_['isNil'](_0x139c2f)){if(_0x139c2f[_0xb49f('0x26')](_0xb49f('0x2f'))){if(_0x139c2f['originated']>0x0){_0x139c2f[_0xb49f('0x2f')]-=0x1;}else{logger[_0xb49f('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x3c56c3);}}}else{logger[_0xb49f('0x8')](_0xb49f('0x30'),_0x3c56c3);}};exports[_0xb49f('0x31')]=function(_0x3d8fb9){var _0x27e135=moment()[_0xb49f('0x10')](_0xb49f('0x32'));_0x3d8fb9[_0xb49f('0x33')]=0xd;_0x3d8fb9[_0xb49f('0x34')]=_0xb49f('0x35');_0x3d8fb9[_0xb49f('0x36')]=_0x27e135;_0x3d8fb9[_0xb49f('0x37')]=_0x27e135;_0x3d8fb9[_0xb49f('0x38')]=_0x27e135;};exports[_0xb49f('0x39')]=function(_0x1d3e69,_0x43fafb,_0x575402){var _0x53d290=moment()[_0xb49f('0x10')](_0xb49f('0x32'));_0x1d3e69['state']=_0x43fafb;_0x1d3e69['statedesc']=_0x575402;_0x1d3e69[_0xb49f('0x37')]=_0x53d290;_0x1d3e69[_0xb49f('0x3a')]=getSeconds(_0x1d3e69['responsetime'],_0x1d3e69[_0xb49f('0x36')]);};exports[_0xb49f('0x3b')]=function(_0x5b8eef,_0x59e660,_0x301500){_0x5b8eef[_0xb49f('0x3c')]=_0x59e660;_0x5b8eef[_0xb49f('0x3d')]=_0x301500;};exports[_0xb49f('0x3e')]=function(_0x2a5f4b,_0x3fc170,_0x23ab65){var _0xecb91c=moment()['format'](_0xb49f('0x32'));_0x2a5f4b['state']=_0x3fc170;_0x2a5f4b[_0xb49f('0x34')]=_0x23ab65;_0x2a5f4b['responsetime']=_0x2a5f4b[_0xb49f('0x37')]?_0x2a5f4b['responsetime']:_0xecb91c;_0x2a5f4b[_0xb49f('0x38')]=_0x2a5f4b['endtime']?_0x2a5f4b[_0xb49f('0x38')]:_0xecb91c;_0x2a5f4b[_0xb49f('0x3a')]=getSeconds(_0x2a5f4b[_0xb49f('0x37')]||0x0,_0x2a5f4b['starttime']||0x0);_0x2a5f4b['talktime']=_0x2a5f4b[_0xb49f('0x3f')]?getSeconds(_0x2a5f4b[_0xb49f('0x38')],_0x2a5f4b['answertime']):0x0;};exports[_0xb49f('0x40')]=function(_0x4aa220){return _0x4aa220===_0xb49f('0x41');};exports[_0xb49f('0x42')]=function(_0x534740,_0xb5e9a8,_0x1446ae,_0x3e9818,_0x29a425){var _0x2fc091=_0x3e9818?_0xb49f('0x43'):_0x534740[_0xb49f('0x16')];_0x2fc091=_0x29a425?'BOOKED':_0x2fc091;return{'actionid':_0x534740[_0xb49f('0x44')],'action':_0xb49f('0x45'),'channel':_0x534740[_0xb49f('0x46')],'callerid':util[_0xb49f('0x10')](_0xb49f('0x11'),_0x2fc091,_0x534740[_0xb49f('0x17')]),'Exten':'xcally-motion-preview','Context':_0xb49f('0x47'),'Priority':'1','variable':_0x1446ae,'timeout':(_0xb5e9a8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x534740[_0xb49f('0x44')]};};exports['totalGlobal']=function(_0x35db5d){return _0x35db5d['countbusyretry']+_0x35db5d[_0xb49f('0x48')]+_0x35db5d['countnoanswerretry']+_0x35db5d['countagentrejectretry']+_0x35db5d[_0xb49f('0x49')];};exports[_0xb49f('0x4a')]=function(_0x5802b4){var _0x74e7a8=_[_0xb49f('0x4b')](_0x5802b4);_0x74e7a8['state']=0xf;_0x74e7a8['statedesc']=_0xb49f('0x4c');return _0x74e7a8;};exports[_0xb49f('0x4d')]=function(_0x17a021,_0x90d08,_0x3ea5db){var _0x3bb73c={};_0x3bb73c[_0x90d08]=_0x17a021[_0x90d08];_0x3bb73c[_0xb49f('0x4e')]=![];_0x3bb73c[_0xb49f('0x4f')]=moment()[_0xb49f('0x50')](_0x3ea5db,_0xb49f('0x51'))[_0xb49f('0x10')](_0xb49f('0x32'));_0x3bb73c[_0xb49f('0x18')]=_0x17a021[_0xb49f('0x18')];_0x3bb73c[_0xb49f('0x52')]=_0x17a021[_0xb49f('0x52')];_0x3bb73c[_0xb49f('0x1a')]=_0x17a021[_0xb49f('0x1a')]||undefined;return _0x3bb73c;};exports[_0xb49f('0x53')]=function(_0x397509,_0x56acab){if(!_[_0xb49f('0x54')](_0x397509)){if(_0x397509['pTalking']>0x0){_0x397509[_0xb49f('0x55')]-=0x1;}else{logger['error'](_0x56acab,_0xb49f('0x56'));}}else{logger[_0xb49f('0x8')](_0x56acab,_0xb49f('0x57'));}};exports[_0xb49f('0x58')]=function(_0x508a1f){if(_0x508a1f<=0x0){return!![];}return![];};exports[_0xb49f('0x59')]=function(_0xfe19ca,_0x551a2b,_0x5afd91){_0xfe19ca[_0xb49f('0x5a')]=_0x551a2b;_0xfe19ca[_0xb49f('0x15')]=_0xfe19ca['queue'];_0xfe19ca['interface']=_0xfe19ca[_0xb49f('0x46')];if(_0x5afd91){_0xfe19ca['mandatoryDisposition']=_0x5afd91['mandatoryDisposition'];}return _0xfe19ca;};exports[_0xb49f('0x5b')]=function(_0x13d0d4){var _0xf0749f={};_0xf0749f[_0xb49f('0x5c')]=_0x13d0d4[_0xb49f('0x5c')];_0xf0749f[_0xb49f('0x5d')]=_0x13d0d4[_0xb49f('0x46')];_0xf0749f[_0xb49f('0x44')]=_0x13d0d4['uniqueid'];return _0xf0749f;};exports[_0xb49f('0x5e')]=function(_0x2bc066){var _0x2eeba3=[];for(var _0x17d1cb in _0x2bc066){if(_0x2bc066['hasOwnProperty'](_0x17d1cb)){if(!_[_0xb49f('0x54')](_0x2bc066[_0x17d1cb])&&_0x2bc066[_0x17d1cb][_0xb49f('0x33')]===_0xb49f('0x5f')&&_0x2bc066[_0x17d1cb][_0xb49f('0x60')]===_0xb49f('0x61')){_0x2eeba3[_0xb49f('0x62')](_0x2bc066[_0x17d1cb]['id']);}}}return _0x2eeba3;};exports[_0xb49f('0x63')]=function(_0x10766b){var _0x2fc1e9=moment()[_0xb49f('0x64')](0x0);var _0x2f77e3=moment(_0x10766b)[_0xb49f('0x64')](0x0);return _0x2fc1e9[_0xb49f('0x6')](_0x2f77e3,_0xb49f('0x65'));};exports[_0xb49f('0x66')]=function(_0x29cf07){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x29cf07['ContactId'],'ListId':_0x29cf07['ListId'],'VoiceQueueId':_0x29cf07[_0xb49f('0x1a')]||undefined,'CampaignId':_0x29cf07[_0xb49f('0x67')]||undefined};};exports[_0xb49f('0x68')]=function(_0x12f7dc){if(_0x12f7dc===_0xb49f('0x44')||_0x12f7dc===_0xb49f('0x69')||_0x12f7dc===_0xb49f('0x5c')||_0x12f7dc===_0xb49f('0x6a')||_0x12f7dc==='campaigntype'||_0x12f7dc===_0xb49f('0x6b')||_0x12f7dc==='membername'||_0x12f7dc===_0xb49f('0x46')||_0x12f7dc===_0xb49f('0x16')||_0x12f7dc===_0xb49f('0x4e')||_0x12f7dc==='calleridnum'||_0x12f7dc==='scheduledat'||_0x12f7dc===_0xb49f('0x6c')||_0x12f7dc===_0xb49f('0x48')||_0x12f7dc===_0xb49f('0x6d')||_0x12f7dc===_0xb49f('0x6e')||_0x12f7dc===_0xb49f('0x6f')||_0x12f7dc===_0xb49f('0x70')||_0x12f7dc==='callbackat'||_0x12f7dc===_0xb49f('0x71')||_0x12f7dc===_0xb49f('0x18')||_0x12f7dc==='ListId'||_0x12f7dc===_0xb49f('0x3d')||_0x12f7dc==='VoiceQueueId'||_0x12f7dc==='sipcallid'||_0x12f7dc===_0xb49f('0x72')||_0x12f7dc===_0xb49f('0x73')||_0x12f7dc===_0xb49f('0x74')||_0x12f7dc===_0xb49f('0x75')||_0x12f7dc===_0xb49f('0x76')||_0x12f7dc==='xmd-dialtimeout'||_0x12f7dc===_0xb49f('0x77')||_0x12f7dc===_0xb49f('0x78')||_0x12f7dc==='xmd-dialchannel'||_0x12f7dc===_0xb49f('0x79')||_0x12f7dc===_0xb49f('0x7a')||_0x12f7dc===_0xb49f('0x7b')||_0x12f7dc===_0xb49f('0x7c')||_0x12f7dc===_0xb49f('0x7d')||_0x12f7dc==='rtpaudioqos'||_0x12f7dc==='rtpaudioqosbridged'||_0x12f7dc===_0xb49f('0x7e')||_0x12f7dc==='rtpaudioqosjitterbridged'||_0x12f7dc===_0xb49f('0x7f')||_0x12f7dc==='rtpaudioqoslossbridged'||_0x12f7dc===_0xb49f('0x80')||_0x12f7dc===_0xb49f('0x81')||_0x12f7dc==='rtpaudioqos'||_0x12f7dc==='rtpaudioqosbridged'||_0x12f7dc==='rtpaudioqosjitter'||_0x12f7dc===_0xb49f('0x82')||_0x12f7dc==='rtpaudioqosloss'||_0x12f7dc===_0xb49f('0x83')||_0x12f7dc==='rtpaudioqosrtt'||_0x12f7dc===_0xb49f('0x81')||_0x12f7dc===_0xb49f('0x84')||_0x12f7dc===_0xb49f('0x85')||_0x12f7dc==='state'||_0x12f7dc==='statedesc'){return![];}return!![];};exports[_0xb49f('0x86')]=function(_0x13a7d3,_0x27df56){var _0x4ad557,_0x182d0e,_0x5c73af;if(_0x27df56<=0x0){_0x27df56=0x1;}_0x4ad557=new RegExp(_0xb49f('0x87')+_0x27df56+'}$');_0x182d0e=Math[_0xb49f('0x88')](0xa,_0x27df56-0x1);_0x5c73af=Math[_0xb49f('0x88')](0xa,_0x27df56)-0x1;return util[_0xb49f('0x10')]('%s',_[_0xb49f('0x89')](_0x13a7d3,_0x4ad557,_[_0xb49f('0x8a')](_0x182d0e,_0x5c73af)));};exports[_0xb49f('0x8b')]=function(_0xb53077){var _0x4cd776=_0xb53077[_0xb49f('0x8c')](/"(.*?)"/);return _0x4cd776?_0x4cd776[0x1]:_0xb53077;};exports[_0xb49f('0x8d')]=function(_0x2f3eae){var _0x4a7a22=_0x2f3eae['match'](/<(.*?)>/);return _0x4a7a22?_0x4a7a22[0x1]:_0x2f3eae;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 799bba9..92dc20b 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(_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 +var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x1fb4e1,_0x3d4ce6){var _0x22d1b0=function(_0x553822){while(--_0x553822){_0x1fb4e1['push'](_0x1fb4e1['shift']());}};_0x22d1b0(++_0x3d4ce6);}(_0xb10b,0x12a));var _0xbb10=function(_0x10909f,_0x2efbe2){_0x10909f=_0x10909f-0x0;var _0x3762d1=_0xb10b[_0x10909f];return _0x3762d1;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index aca9fbd..e97f5d1 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 _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 +var _0x1069=['isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','isNil','isUndefined','length','initTrunks','trunks','initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','zohoAccounts','deskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','queuecallerexit','unmanaged','sumHoldTime','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','disposition','ANSWERED','billableseconds','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','util','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','SIP/%s','name','interface','format','hasOwnProperty','total','answered','sumDuration','sumBillable'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1069,0x1ea));var _0x9106=function(_0x3cd3ad,_0x359fe8){_0x3cd3ad=_0x3cd3ad-0x0;var _0x275a31=_0x1069[_0x3cd3ad];return _0x275a31;};'use strict';var BPromise=require('bluebird');var util=require(_0x9106('0x0'));var _=require(_0x9106('0x1'));var moment=require(_0x9106('0x2'));var Agent=require(_0x9106('0x3'));var Telephone=require(_0x9106('0x4'));var Trunk=require(_0x9106('0x5'));var VoiceQueue=require(_0x9106('0x6'));var Trigger=require(_0x9106('0x7'));var Template=require(_0x9106('0x8'));var Campaign=require(_0x9106('0x9'));var VoiceExtension=require(_0x9106('0xa'));var ZendeskAccount=require(_0x9106('0xb'));var SalesforceAccount=require(_0x9106('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x9106('0xd'));var ZohoAccount=require(_0x9106('0xe'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x9106('0xf'));var ServicenowAccount=require(_0x9106('0x10'));var Dynamics365Account=require(_0x9106('0x11'));var FreshsalesAccount=require(_0x9106('0x12'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x9106('0x13')]={};this[_0x9106('0x14')]={};this['trunks']={};this[_0x9106('0x15')]={};this['triggers']={};this[_0x9106('0x16')]={};this[_0x9106('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9106('0x18')]={};this[_0x9106('0x19')]={};this[_0x9106('0x1a')]={};this[_0x9106('0x1b')]={};this['timers']={};this[_0x9106('0x1c')]={};this[_0x9106('0x1d')]={};this[_0x9106('0x1e')]={};this[_0x9106('0x1f')]={};this['zohoAccounts']={};this['deskAccounts']={};this[_0x9106('0x20')]={};this[_0x9106('0x21')]={};this['dynamics365Accounts']={};this[_0x9106('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x19a922,_0x8e8def,_0x36a306){var _0x398641=_['mapKeys'](_0x19a922,function(_0x42bdc,_0x490d1c){return _0x42bdc[_0x36a306];});for(var _0x515c95 in _0x8e8def){if(_0x8e8def['hasOwnProperty'](_0x515c95)){if(!_0x398641[_0x515c95]){delete _0x8e8def[_0x515c95];}}}}function freeIsNotKeySip(_0x3a657f,_0x35ea76){var _0x2528b4=_[_0x9106('0x23')](_0x3a657f,function(_0x46497d,_0x59e897){return util['format'](_0x9106('0x24'),_0x46497d[_0x9106('0x25')]);});for(var _0x285c2e in _0x35ea76){if(_0x35ea76['hasOwnProperty'](_0x285c2e)){if(!_0x2528b4[_0x285c2e]){delete _0x35ea76[_0x285c2e];}}}}function freeIsNotKeyAgent(_0xf59ceb,_0x525d83){var _0x476f97=_[_0x9106('0x23')](_0xf59ceb,function(_0x3adcac,_0x74835c){var _0x39b392=_['isNil'](_0x3adcac[_0x9106('0x26')])?util[_0x9106('0x27')]('SIP/%s',_0x3adcac['name']):_0x3adcac[_0x9106('0x26')];return _0x39b392;});for(var _0x10b671 in _0x525d83){if(_0x525d83[_0x9106('0x28')](_0x10b671)){if(!_0x476f97[_0x10b671]){delete _0x525d83[_0x10b671];}}}}function clearVoiceCallReports(_0x256306){_0x256306[_0x9106('0x29')]=0x0;_0x256306[_0x9106('0x2a')]=0x0;_0x256306['sumHoldTime']=0x0;_0x256306[_0x9106('0x2b')]=0x0;_0x256306[_0x9106('0x2c')]=0x0;}function clearCampaigns(_0x4c44ea){if(!_[_0x9106('0x2d')](_0x4c44ea)){for(var _0x3dc4fd in _0x4c44ea){if(_0x4c44ea['hasOwnProperty'](_0x3dc4fd)){_0x4c44ea[_0x3dc4fd][_0x9106('0x2e')]=0x0;_0x4c44ea[_0x3dc4fd][_0x9106('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x22b661){if(!_[_0x9106('0x2d')](_0x22b661)){for(var _0x137a25 in _0x22b661){if(_0x22b661['hasOwnProperty'](_0x137a25)){_0x22b661[_0x137a25][_0x9106('0x29')]=0x0;_0x22b661[_0x137a25]['answered']=0x0;_0x22b661[_0x137a25]['unmanaged']=0x0;_0x22b661[_0x137a25][_0x9106('0x30')]=0x0;_0x22b661[_0x137a25]['sumHoldTime']=0x0;_0x22b661[_0x137a25]['sumDuration']=0x0;_0x22b661[_0x137a25][_0x9106('0x2c')]=0x0;_0x22b661[_0x137a25]['outboundAnswerAgiCallsDay']=0x0;_0x22b661[_0x137a25][_0x9106('0x31')]=0x0;_0x22b661[_0x137a25][_0x9106('0x32')]=0x0;_0x22b661[_0x137a25][_0x9106('0x33')]=0x0;_0x22b661[_0x137a25][_0x9106('0x34')]=0x0;_0x22b661[_0x137a25][_0x9106('0x35')]=0x0;_0x22b661[_0x137a25][_0x9106('0x36')]=0x0;_0x22b661[_0x137a25]['outboundDropCallsDayCallersExit']=0x0;_0x22b661[_0x137a25][_0x9106('0x37')]=0x0;_0x22b661[_0x137a25][_0x9106('0x38')]=0x0;_0x22b661[_0x137a25][_0x9106('0x39')]=0x0;_0x22b661[_0x137a25]['outboundReCallsDay']=0x0;_0x22b661[_0x137a25][_0x9106('0x3a')]=0x0;_0x22b661[_0x137a25][_0x9106('0x3b')]=0x0;_0x22b661[_0x137a25][_0x9106('0x3c')]=!![];}}}}Realtime[_0x9106('0x3d')][_0x9106('0x3e')]=function(_0x1bcfd0,_0x485b6f){for(var _0x3720e0 in _0x485b6f){if(_0x1bcfd0[_0x9106('0x28')](_0x3720e0)){_0x1bcfd0[_0x3720e0]=_0x485b6f[_0x3720e0];}}};Realtime[_0x9106('0x3d')]['initAgents']=function(){var _0x13242f=this;return function(_0x2dd560){if(_0x2dd560){freeIsNotKeyAgent(_0x2dd560,_0x13242f['agents']);for(var _0x14c2c5=0x0,_0x131eb3={},_0x4d28f9={};_0x14c2c5<_0x2dd560['length'];_0x14c2c5+=0x1){_0x131eb3=_0x2dd560[_0x14c2c5];var _0x3991ec=_[_0x9106('0x3f')](_0x131eb3[_0x9106('0x26')])?util[_0x9106('0x27')](_0x9106('0x24'),_0x131eb3[_0x9106('0x25')]):_0x131eb3[_0x9106('0x26')];if(_[_0x9106('0x40')](_0x13242f[_0x9106('0x13')][_0x3991ec])){_0x13242f[_0x9106('0x13')][_0x3991ec]=new Agent(_0x131eb3);}else{_0x13242f['mergeFromDatabase'](_0x13242f[_0x9106('0x13')][_0x3991ec],_0x131eb3);}}}return _0x13242f[_0x9106('0x13')];};};Realtime[_0x9106('0x3d')]['initTelephones']=function(){var _0x200bc8=this;return function(_0x4e6c9e){if(_0x4e6c9e){freeIsNotKeySip(_0x4e6c9e,_0x200bc8[_0x9106('0x14')]);for(var _0x5952e3=0x0,_0xf4fbac={},_0x2e14f5={};_0x5952e3<_0x4e6c9e[_0x9106('0x41')];_0x5952e3+=0x1){_0xf4fbac=_0x4e6c9e[_0x5952e3];if(_[_0x9106('0x40')](_0x200bc8[_0x9106('0x14')][util[_0x9106('0x27')](_0x9106('0x24'),_0xf4fbac[_0x9106('0x25')])])){_0x200bc8[_0x9106('0x14')][util[_0x9106('0x27')](_0x9106('0x24'),_0xf4fbac[_0x9106('0x25')])]=new Telephone(_0xf4fbac);}else{_0x200bc8[_0x9106('0x3e')](_0x200bc8['telephones'][util['format'](_0x9106('0x24'),_0xf4fbac['name'])],_0xf4fbac);}}}return _0x200bc8['telephones'];};};Realtime['prototype'][_0x9106('0x42')]=function(){var _0x2d5465=this;return function(_0x4099dd){if(_0x4099dd){freeIsNotKeySip(_0x4099dd,_0x2d5465[_0x9106('0x43')]);for(var _0x1e3eed=0x0,_0x5f4cca={},_0x4c53b3={};_0x1e3eed<_0x4099dd[_0x9106('0x41')];_0x1e3eed+=0x1){_0x5f4cca=_0x4099dd[_0x1e3eed];if(_['isUndefined'](_0x2d5465[_0x9106('0x43')][util[_0x9106('0x27')](_0x9106('0x24'),_0x5f4cca[_0x9106('0x25')])])){_0x2d5465[_0x9106('0x43')][util['format'](_0x9106('0x24'),_0x5f4cca[_0x9106('0x25')])]=new Trunk(_0x5f4cca);}else{_0x2d5465[_0x9106('0x3e')](_0x2d5465[_0x9106('0x43')][util[_0x9106('0x27')](_0x9106('0x24'),_0x5f4cca[_0x9106('0x25')])],_0x5f4cca);}}}return _0x2d5465[_0x9106('0x43')];};};Realtime[_0x9106('0x3d')]['initVoiceQueues']=function(){var _0x3cca0b=this;return function(_0x4bfc78){if(_0x4bfc78){freeIsNotKey(_0x4bfc78,_0x3cca0b['voiceQueues'],_0x9106('0x25'));for(var _0x389405=0x0,_0x4c9214={},_0x1e2478={};_0x389405<_0x4bfc78['length'];_0x389405+=0x1){_0x4c9214=_0x4bfc78[_0x389405];if(_['isUndefined'](_0x3cca0b[_0x9106('0x15')][_0x4c9214[_0x9106('0x25')]])){_0x3cca0b[_0x9106('0x15')][_0x4c9214[_0x9106('0x25')]]=new VoiceQueue(_0x4c9214);}else{_0x3cca0b[_0x9106('0x3e')](_0x3cca0b[_0x9106('0x15')][_0x4c9214[_0x9106('0x25')]],_0x4c9214);}}}return _0x3cca0b['voiceQueues'];};};Realtime[_0x9106('0x3d')][_0x9106('0x44')]=function(){var _0x5ef38a=this;return function(_0x214543){if(_0x214543){freeIsNotKey(_0x214543,_0x5ef38a[_0x9106('0x45')],'id');for(var _0x1e07c1=0x0,_0x1e9605={},_0x37390a={};_0x1e07c1<_0x214543['length'];_0x1e07c1+=0x1){_0x1e9605=_0x214543[_0x1e07c1];if(_[_0x9106('0x40')](_0x5ef38a[_0x9106('0x45')][_0x1e9605['id']])){_0x5ef38a['triggers'][_0x1e9605['id']]=new Trigger(_0x1e9605);}else{_0x5ef38a[_0x9106('0x3e')](_0x5ef38a[_0x9106('0x45')][_0x1e9605['id']],_0x1e9605);}}}return _0x5ef38a[_0x9106('0x45')];};};Realtime[_0x9106('0x3d')][_0x9106('0x46')]=function(){var _0x164219=this;return function(_0x4596d4){if(_0x4596d4){freeIsNotKey(_0x4596d4,_0x164219[_0x9106('0x17')],'id');for(var _0x1735c5=0x0,_0x3cd517={},_0x36636d={};_0x1735c5<_0x4596d4[_0x9106('0x41')];_0x1735c5+=0x1){_0x3cd517=_0x4596d4[_0x1735c5];if(_[_0x9106('0x40')](_0x164219[_0x9106('0x17')][_0x3cd517['id']])){_0x164219[_0x9106('0x17')][_0x3cd517['id']]=new Template(_0x3cd517);}else{_0x164219[_0x9106('0x3e')](_0x164219[_0x9106('0x17')][_0x3cd517['id']],_0x3cd517);}}}return _0x164219[_0x9106('0x17')];};};Realtime[_0x9106('0x3d')][_0x9106('0x47')]=function(){var _0x502f54=this;return function(_0x543096){if(_0x543096){freeIsNotKey(_0x543096,_0x502f54[_0x9106('0x1c')],'id');for(var _0x3701e0=0x0,_0x217556={},_0x4e44e3={};_0x3701e0<_0x543096[_0x9106('0x41')];_0x3701e0+=0x1){_0x217556=_0x543096[_0x3701e0];if(_[_0x9106('0x40')](_0x502f54['zendeskAccounts'][_0x217556['id']])){_0x502f54[_0x9106('0x1c')][_0x217556['id']]=new ZendeskAccount(_0x217556);}else{_0x502f54['mergeFromDatabase'](_0x502f54[_0x9106('0x1c')][_0x217556['id']],_0x217556);}}}return _0x502f54[_0x9106('0x1c')];};};Realtime[_0x9106('0x3d')][_0x9106('0x48')]=function(){var _0x117f19=this;return function(_0x587d0d){if(_0x587d0d){freeIsNotKey(_0x587d0d,_0x117f19[_0x9106('0x1d')],'id');for(var _0x25d220=0x0,_0x4de04c={},_0x3ea057={};_0x25d220<_0x587d0d['length'];_0x25d220+=0x1){_0x4de04c=_0x587d0d[_0x25d220];if(_[_0x9106('0x40')](_0x117f19[_0x9106('0x1d')][_0x4de04c['id']])){_0x117f19['salesforceAccounts'][_0x4de04c['id']]=new SalesforceAccount(_0x4de04c);}else{_0x117f19[_0x9106('0x3e')](_0x117f19[_0x9106('0x1d')][_0x4de04c['id']],_0x4de04c);}}}return _0x117f19[_0x9106('0x1d')];};};Realtime[_0x9106('0x3d')][_0x9106('0x49')]=function(){var _0x1f27bf=this;return function(_0xab9a6e){if(_0xab9a6e){freeIsNotKey(_0xab9a6e,_0x1f27bf['freshdeskAccounts'],'id');for(var _0x14ee43=0x0,_0x10cba7={},_0x5ce2c1={};_0x14ee43<_0xab9a6e[_0x9106('0x41')];_0x14ee43+=0x1){_0x10cba7=_0xab9a6e[_0x14ee43];if(_['isUndefined'](_0x1f27bf[_0x9106('0x1f')][_0x10cba7['id']])){_0x1f27bf['freshdeskAccounts'][_0x10cba7['id']]=new FreshdeskAccount(_0x10cba7);}else{_0x1f27bf[_0x9106('0x3e')](_0x1f27bf['freshdeskAccounts'][_0x10cba7['id']],_0x10cba7);}}}return _0x1f27bf[_0x9106('0x1f')];};};Realtime[_0x9106('0x3d')]['initZohoAccounts']=function(){var _0x1de1cd=this;return function(_0x32e17b){if(_0x32e17b){freeIsNotKey(_0x32e17b,_0x1de1cd[_0x9106('0x4a')],'id');for(var _0x5ce7e0=0x0,_0x169187={},_0x721568={};_0x5ce7e0<_0x32e17b[_0x9106('0x41')];_0x5ce7e0+=0x1){_0x169187=_0x32e17b[_0x5ce7e0];if(_[_0x9106('0x40')](_0x1de1cd[_0x9106('0x4a')][_0x169187['id']])){_0x1de1cd[_0x9106('0x4a')][_0x169187['id']]=new ZohoAccount(_0x169187);}else{_0x1de1cd[_0x9106('0x3e')](_0x1de1cd['zohoAccounts'][_0x169187['id']],_0x169187);}}}return _0x1de1cd['zohoAccounts'];};};Realtime[_0x9106('0x3d')]['initDeskAccounts']=function(){var _0x15862c=this;return function(_0xe31256){if(_0xe31256){freeIsNotKey(_0xe31256,_0x15862c[_0x9106('0x4b')],'id');for(var _0x331fd1=0x0,_0x24221b={},_0x47453d={};_0x331fd1<_0xe31256[_0x9106('0x41')];_0x331fd1+=0x1){_0x24221b=_0xe31256[_0x331fd1];if(_[_0x9106('0x40')](_0x15862c['deskAccounts'][_0x24221b['id']])){_0x15862c['deskAccounts'][_0x24221b['id']]=new DeskAccount(_0x24221b);}else{_0x15862c['mergeFromDatabase'](_0x15862c['deskAccounts'][_0x24221b['id']],_0x24221b);}}}return _0x15862c[_0x9106('0x4b')];};};Realtime[_0x9106('0x3d')]['initSugarcrmAccounts']=function(){var _0x1ea653=this;return function(_0x54448e){if(_0x54448e){freeIsNotKey(_0x54448e,_0x1ea653[_0x9106('0x1e')],'id');for(var _0x1ac666=0x0,_0x1650b5={},_0x5db7fb={};_0x1ac666<_0x54448e[_0x9106('0x41')];_0x1ac666+=0x1){_0x1650b5=_0x54448e[_0x1ac666];if(_['isUndefined'](_0x1ea653['sugarcrmAccounts'][_0x1650b5['id']])){_0x1ea653['sugarcrmAccounts'][_0x1650b5['id']]=new SugarcrmAccount(_0x1650b5);}else{_0x1ea653['mergeFromDatabase'](_0x1ea653[_0x9106('0x1e')][_0x1650b5['id']],_0x1650b5);}}}return _0x1ea653[_0x9106('0x1e')];};};Realtime['prototype'][_0x9106('0x4c')]=function(){var _0x3fb2b4=this;return function(_0x53d0b5){if(_0x53d0b5){freeIsNotKey(_0x53d0b5,_0x3fb2b4[_0x9106('0x20')],'id');for(var _0x454910=0x0,_0x7aae1f={},_0x39eea9={};_0x454910<_0x53d0b5[_0x9106('0x41')];_0x454910+=0x1){_0x7aae1f=_0x53d0b5[_0x454910];if(_[_0x9106('0x40')](_0x3fb2b4['vtigerAccounts'][_0x7aae1f['id']])){_0x3fb2b4[_0x9106('0x20')][_0x7aae1f['id']]=new VtigerAccount(_0x7aae1f);}else{_0x3fb2b4['mergeFromDatabase'](_0x3fb2b4[_0x9106('0x20')][_0x7aae1f['id']],_0x7aae1f);}}}return _0x3fb2b4['vtigerAccounts'];};};Realtime['prototype'][_0x9106('0x4d')]=function(){var _0x3c9be6=this;return function(_0x5001f9){if(_0x5001f9){freeIsNotKey(_0x5001f9,_0x3c9be6[_0x9106('0x21')],'id');for(var _0x383b7d=0x0,_0x4e027d={},_0x5c4ad3={};_0x383b7d<_0x5001f9['length'];_0x383b7d+=0x1){_0x4e027d=_0x5001f9[_0x383b7d];if(_[_0x9106('0x40')](_0x3c9be6[_0x9106('0x21')][_0x4e027d['id']])){_0x3c9be6[_0x9106('0x21')][_0x4e027d['id']]=new ServicenowAccount(_0x4e027d);}else{_0x3c9be6[_0x9106('0x3e')](_0x3c9be6['servicenowAccounts'][_0x4e027d['id']],_0x4e027d);}}}return _0x3c9be6['servicenowAccounts'];};};Realtime[_0x9106('0x3d')][_0x9106('0x4e')]=function(){var _0x3a10d3=this;return function(_0x17f481){if(_0x17f481){freeIsNotKey(_0x17f481,_0x3a10d3[_0x9106('0x4f')],'id');for(var _0x196233=0x0,_0x2f7a43={},_0x15ee94={};_0x196233<_0x17f481['length'];_0x196233+=0x1){_0x2f7a43=_0x17f481[_0x196233];if(_[_0x9106('0x40')](_0x3a10d3[_0x9106('0x4f')][_0x2f7a43['id']])){_0x3a10d3[_0x9106('0x4f')][_0x2f7a43['id']]=new Dynamics365Account(_0x2f7a43);}else{_0x3a10d3['mergeFromDatabase'](_0x3a10d3['dynamics365Accounts'][_0x2f7a43['id']],_0x2f7a43);}}}return _0x3a10d3[_0x9106('0x4f')];};};Realtime[_0x9106('0x3d')][_0x9106('0x50')]=function(){var _0x291052=this;return function(_0x2aba8b){if(_0x2aba8b){freeIsNotKey(_0x2aba8b,_0x291052[_0x9106('0x22')],'id');for(var _0x34be8e=0x0,_0x57b839={},_0x36cd19={};_0x34be8e<_0x2aba8b['length'];_0x34be8e+=0x1){_0x57b839=_0x2aba8b[_0x34be8e];if(_[_0x9106('0x40')](_0x291052[_0x9106('0x22')][_0x57b839['id']])){_0x291052[_0x9106('0x22')][_0x57b839['id']]=new FreshsalesAccount(_0x57b839);}else{_0x291052[_0x9106('0x3e')](_0x291052['freshsalesAccounts'][_0x57b839['id']],_0x57b839);}}}return _0x291052[_0x9106('0x22')];};};Realtime[_0x9106('0x3d')][_0x9106('0x51')]=function(){var _0x3df2f2=this;return function(_0x6e92ff){for(var _0x1bbc57=0x0;_0x1bbc57<_0x6e92ff[_0x9106('0x41')];_0x1bbc57+=0x1){_[_0x9106('0x52')](_0x3df2f2['voiceQueues'][_0x6e92ff[_0x1bbc57][_0x9106('0x25')]],_0x6e92ff[_0x1bbc57]);}return _0x3df2f2[_0x9106('0x15')];};};Realtime[_0x9106('0x3d')][_0x9106('0x53')]=function(){var _0x1b7e78=this;return function(_0x5302d0){clearVoiceQueues(_0x1b7e78[_0x9106('0x15')]);if(_0x5302d0){_0x5302d0=_['groupBy'](_0x5302d0,'uniqueid');for(var _0x15aad5 in _0x5302d0){if(_0x5302d0[_0x9106('0x28')](_0x15aad5)){var _0x33abeb={};for(var _0xe3828c=0x0;_0xe3828c<_0x5302d0[_0x15aad5]['length'];_0xe3828c+=0x1){var _0x936df0=_0x5302d0[_0x15aad5][_0xe3828c]['queue'];if(_0x1b7e78[_0x9106('0x15')][_0x936df0]){if(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x54')]){_0x1b7e78[_0x9106('0x15')][_0x936df0][_0x9106('0x55')]+=0x1;}if(_0x5302d0[_0x15aad5][_0xe3828c]['queuecallerabandon']){_0x1b7e78['voiceQueues'][_0x936df0][_0x9106('0x30')]+=0x1;}_0x1b7e78['voiceQueues'][_0x936df0][_0x9106('0x56')]+=moment(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x57')])[_0x9106('0x58')](moment(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x59')]),_0x9106('0x5a'))||0x0;if(_0xe3828c===_0x5302d0[_0x15aad5][_0x9106('0x41')]-0x1){_0x1b7e78[_0x9106('0x15')][_0x936df0][_0x9106('0x2b')]+=moment(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x5b')]||_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x5c')]||_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x5d')])['diff'](moment(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x59')]),_0x9106('0x5a'))||0x0;_0x1b7e78[_0x9106('0x15')][_0x936df0][_0x9106('0x29')]+=0x1;if(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x5e')]){_0x1b7e78[_0x9106('0x15')][_0x936df0]['answered']+=0x1;_0x1b7e78['voiceQueues'][_0x936df0][_0x9106('0x2c')]+=moment(_0x5302d0[_0x15aad5][_0xe3828c]['queuecallercompleteAt'])['diff'](moment(_0x5302d0[_0x15aad5][_0xe3828c][_0x9106('0x57')]),_0x9106('0x5a'))||0x0;}}else{_0x1b7e78['voiceQueues'][_0x936df0][_0x9106('0x2b')]+=_0x1b7e78[_0x9106('0x15')][_0x936df0]['sumHoldTime']||0x0;}}}}}}return _0x1b7e78[_0x9106('0x15')];};};Realtime[_0x9106('0x3d')][_0x9106('0x5f')]=function(){var _0x49d48e=this;return function(_0x3c9dad){clearVoiceCallReports(_0x49d48e['outbound']);if(_0x3c9dad){for(var _0x4ddac5=0x0;_0x4ddac5<_0x3c9dad[_0x9106('0x41')];_0x4ddac5+=0x1){_0x49d48e[_0x9106('0x60')][_0x9106('0x29')]+=0x1;_0x49d48e[_0x9106('0x60')]['sumDuration']+=_0x3c9dad[_0x4ddac5]['duration'];if(_0x3c9dad[_0x4ddac5][_0x9106('0x61')]===_0x9106('0x62')){_0x49d48e[_0x9106('0x60')][_0x9106('0x2a')]+=0x1;_0x49d48e[_0x9106('0x60')][_0x9106('0x56')]+=_0x3c9dad[_0x4ddac5]['duration']-_0x3c9dad[_0x4ddac5][_0x9106('0x63')]||0x0;_0x49d48e['outbound'][_0x9106('0x2c')]+=_0x3c9dad[_0x4ddac5]['billableseconds'];}}}return _0x49d48e[_0x9106('0x60')];};};Realtime[_0x9106('0x3d')]['initCampaigns']=function(){var _0x40607c=this;return function(_0x19a73f){if(_0x19a73f){freeIsNotKey(_0x19a73f,_0x40607c[_0x9106('0x16')],_0x9106('0x25'));for(var _0x47d8b0=0x0,_0x22eca5={};_0x47d8b0<_0x19a73f[_0x9106('0x41')];_0x47d8b0+=0x1){_0x22eca5=_0x19a73f[_0x47d8b0];if(_[_0x9106('0x40')](_0x40607c['campaigns'][_0x22eca5[_0x9106('0x25')]])){_0x40607c[_0x9106('0x16')][_0x22eca5[_0x9106('0x25')]]=new Campaign(_0x22eca5);}else{_0x40607c['mergeFromDatabase'](_0x40607c[_0x9106('0x16')][_0x22eca5[_0x9106('0x25')]],_0x22eca5);_0x40607c[_0x9106('0x16')][_0x22eca5[_0x9106('0x25')]][_0x9106('0x64')]=_0x22eca5[_0x9106('0x65')]?_0x22eca5[_0x9106('0x65')][_0x9106('0x25')]:undefined;}}}return _0x40607c[_0x9106('0x16')];};};Realtime[_0x9106('0x3d')][_0x9106('0x66')]=function(){var _0x1a01b3=this;return function(_0x40563c){if(_0x40563c){freeIsNotKey(_0x40563c,_0x1a01b3[_0x9106('0x18')],'id');for(var _0x2d2e42=0x0,_0x46c4ee={};_0x2d2e42<_0x40563c['length'];_0x2d2e42+=0x1){_0x46c4ee=_0x40563c[_0x2d2e42];if(_[_0x9106('0x40')](_0x1a01b3[_0x9106('0x18')][_0x46c4ee['id']])){_0x1a01b3[_0x9106('0x18')][_0x46c4ee['id']]=new VoiceExtension(_0x46c4ee);}else{_0x1a01b3['mergeFromDatabase'](_0x1a01b3[_0x9106('0x18')][_0x46c4ee['id']],_0x46c4ee);}}}return _0x1a01b3[_0x9106('0x18')];};};Realtime[_0x9106('0x3d')][_0x9106('0x67')]=function(){var _0x981d6c=this;return function(_0x58dd5e){clearCampaigns(_0x981d6c[_0x9106('0x16')]);for(var _0x403966=0x0;_0x403966<_0x58dd5e[_0x9106('0x41')];_0x403966+=0x1){_[_0x9106('0x52')](_0x981d6c[_0x9106('0x16')][_0x58dd5e[_0x403966]['name']],_0x58dd5e[_0x403966]);}return _0x981d6c[_0x9106('0x16')];};};Realtime[_0x9106('0x3d')][_0x9106('0x68')]=function(){var _0x2fb16a=this;return function(_0x349926){if(_0x349926){freeIsNotKey(_0x349926,_0x2fb16a['faxAccounts'],'id');for(var _0xc5bb11=0x0,_0x1ce941={},_0x2c96f1={};_0xc5bb11<_0x349926[_0x9106('0x41')];_0xc5bb11+=0x1){_0x1ce941=_0x349926[_0xc5bb11];if(_['isUndefined'](_0x2fb16a[_0x9106('0x69')][_0x1ce941['id']])){_0x2fb16a['faxAccounts'][_0x1ce941['id']]=new FaxAccount(_0x1ce941);}else{_0x2fb16a['mergeFromDatabase'](_0x2fb16a[_0x9106('0x69')][_0x1ce941['id']],_0x1ce941);}}}return _0x2fb16a[_0x9106('0x69')];};};module[_0x9106('0x6a')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d57a7c8..93704b6 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 _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 +var _0xd0a3=['accountcode','name','isNil','interface','format','SIP/%s','findAgent','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','dialer','lastapplication','queue','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','linkedid','transfers','transfereelinkedid','uniqueid','create','monitor','length','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find'];(function(_0x55e923,_0x4dac23){var _0x3eca4c=function(_0x23caaa){while(--_0x23caaa){_0x55e923['push'](_0x55e923['shift']());}};_0x3eca4c(++_0x4dac23);}(_0xd0a3,0x18a));var _0x3d0a=function(_0x22e974,_0x3460d8){_0x22e974=_0x22e974-0x0;var _0x503174=_0xd0a3[_0x22e974];return _0x503174;};'use strict';var _=require(_0x3d0a('0x0'));var moment=require(_0x3d0a('0x1'));var util=require(_0x3d0a('0x2'));var config=require('../../../config/environment');var ami=require(_0x3d0a('0x3'));var RpcVoiceAgentReport=require(_0x3d0a('0x4'));var RpcVoiceCallReport=require(_0x3d0a('0x5'));var RpcVoiceDialReport=require(_0x3d0a('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x3d0a('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x3d0a('0x8'));var VoiceCallReport=require(_0x3d0a('0x9'));var VoiceAgentReport=require(_0x3d0a('0xa'));var VoiceDialReport=require(_0x3d0a('0xb'));var UserReport=require(_0x3d0a('0xc'));function Report(_0x474cfb){this[_0x3d0a('0xd')]=_0x474cfb;this[_0x3d0a('0xe')]=_0x474cfb[_0x3d0a('0xe')];this['telephones']=_0x474cfb[_0x3d0a('0xf')];}Report[_0x3d0a('0x10')][_0x3d0a('0x11')]=function(_0x308ba1){var _0x59f5bd=new VoiceQueueReport(this['realtime']);var _0x3cd47a=new VoiceAgentReport(this[_0x3d0a('0xd')]);var _0x38e10f=new VoiceDialReport(this['realtime']);var _0x36fbf8=new VoiceCallReport(this['realtime']);var _0x8df4c4=new UserReport(this[_0x3d0a('0xd')]);if(config[_0x3d0a('0x12')]&&config[_0x3d0a('0x12')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0x3d0a('0x13')][_0x3d0a('0x14')](this));ami['on'](_0x3d0a('0x15'),this[_0x3d0a('0x16')][_0x3d0a('0x14')](this));ami['on'](_0x3d0a('0x17'),this['voiceAgentReport'][_0x3d0a('0x14')](this));ami['on'](_0x3d0a('0x18'),this[_0x3d0a('0x19')][_0x3d0a('0x14')](this));ami['on'](_0x3d0a('0x1a'),this[_0x3d0a('0x1b')][_0x3d0a('0x14')](this));ami['on'](_0x3d0a('0x1c'),this[_0x3d0a('0x1d')][_0x3d0a('0x14')](this));}};Report[_0x3d0a('0x10')]['findAgent']=function(_0x52ae61){var _0x4c3708;_0x4c3708=_[_0x3d0a('0x1e')](this['agents'],function(_0x553e3b){return _0x553e3b[_0x3d0a('0x1f')]==_0x52ae61||_0x553e3b[_0x3d0a('0x20')]==_0x52ae61;});if(_[_0x3d0a('0x21')](_0x4c3708)){var _0x2c2aad=_[_0x3d0a('0x1e')](this['telephones'],function(_0x15b46c){return _0x15b46c[_0x3d0a('0x1f')]==_0x52ae61||_0x15b46c['name']==_0x52ae61;});if(_0x2c2aad){_0x4c3708=_[_0x3d0a('0x1e')](this[_0x3d0a('0xe')],function(_0x23f819){return _0x23f819[_0x3d0a('0x22')]==util[_0x3d0a('0x23')](_0x3d0a('0x24'),_0x2c2aad[_0x3d0a('0x20')]);});}}return _0x4c3708;};Report[_0x3d0a('0x10')][_0x3d0a('0x13')]=function(_0x5ea50d){for(var _0x32575e=0x0;_0x32575e<_0x5ea50d['length'];_0x32575e+=0x1){var _0x4554b3=this[_0x3d0a('0x25')](_0x5ea50d[_0x32575e][_0x3d0a('0x26')]);if(_0x4554b3){_0x5ea50d[_0x32575e][_0x3d0a('0x1f')]=_0x4554b3['accountcode'];_0x5ea50d[_0x32575e][_0x3d0a('0x27')]=!![];_0x5ea50d[_0x32575e][_0x3d0a('0x28')]=_0x4554b3[_0x3d0a('0x20')];_0x5ea50d[_0x32575e][_0x3d0a('0x22')]=_[_0x3d0a('0x21')](_0x4554b3[_0x3d0a('0x22')])?util[_0x3d0a('0x23')]('SIP/%s',_0x4554b3[_0x3d0a('0x20')]):_0x4554b3[_0x3d0a('0x22')];if(_0x5ea50d[_0x32575e][_0x3d0a('0x29')]){_0x5ea50d[_0x32575e]['queuecallercompleteAt']=moment()[_0x3d0a('0x23')](_0x3d0a('0x2a'));}if(_0x5ea50d[_0x32575e][_0x3d0a('0x2b')]){_0x5ea50d[_0x32575e][_0x3d0a('0x2c')]=moment()['format'](_0x3d0a('0x2a'));}RpcMemberReport[_0x3d0a('0x13')](_0x5ea50d[_0x32575e]);}RpcVoiceQueueReport['create'](_0x5ea50d[_0x32575e]);}};function extractCalleridNumber(_0x392f95){var _0x1c5c68=_0x392f95[_0x3d0a('0x2d')](/<(.*?)>/);return _0x1c5c68?_0x1c5c68[0x1]:_0x392f95;}Report['prototype'][_0x3d0a('0x16')]=function(_0x56806a){_0x56806a[_0x3d0a('0x2e')]=_0x56806a[_0x3d0a('0x2e')]||_0x56806a[_0x3d0a('0x2f')];if(_0x56806a['type']==_0x3d0a('0x30')){_0x56806a[_0x3d0a('0x31')]='queue';_0x56806a['lastdata']=_0x56806a[_0x3d0a('0x32')];if(_0x56806a[_0x3d0a('0x33')]==_0x3d0a('0x34')){_0x56806a[_0x3d0a('0x1f')]='';_0x56806a[_0x3d0a('0x2e')]=extractCalleridNumber(_0x56806a[_0x3d0a('0x35')]);}else if(_0x56806a[_0x3d0a('0x33')]==_0x3d0a('0x36')){if(_0x56806a[_0x3d0a('0x2e')]=='xcally-motion-preview'){_0x56806a['destination']=extractCalleridNumber(_0x56806a[_0x3d0a('0x37')]);_0x56806a[_0x3d0a('0x38')]=_0x56806a[_0x3d0a('0x39')];_0x56806a['destinationchannel']=[_0x56806a['channel'],_0x56806a[_0x3d0a('0x3a')]=_0x56806a[_0x3d0a('0x3b')]][0x0];_0x56806a[_0x3d0a('0x35')]=_0x56806a[_0x3d0a('0x37')];}else{_0x56806a[_0x3d0a('0x2e')]=_0x56806a[_0x3d0a('0x38')];_0x56806a['calleridnum']=_0x56806a['originatecalleridnum'];if(_0x56806a[_0x3d0a('0x3c')]==_0x3d0a('0x3d')){_0x56806a['accountcode']=_0x56806a['connectedlinenum'];}else{_0x56806a[_0x3d0a('0x1f')]='';}}}}else{_0x56806a[_0x3d0a('0x35')]=util['format']('\x22%s\x22\x20<%s>',_0x56806a['calleridname'],_0x56806a[_0x3d0a('0x38')]);}if(RpcVoiceTransferReport['transfers'][_0x56806a[_0x3d0a('0x3e')]]){var _0x4779ea=RpcVoiceTransferReport[_0x3d0a('0x3f')][_0x56806a[_0x3d0a('0x3e')]];_0x4779ea[_0x3d0a('0x40')]=_0x56806a[_0x3d0a('0x41')];RpcVoiceTransferReport[_0x3d0a('0x1b')](_0x4779ea);delete RpcVoiceTransferReport[_0x3d0a('0x3f')][_0x56806a[_0x3d0a('0x3e')]];}RpcVoiceCallReport[_0x3d0a('0x42')](_0x56806a);if(_0x56806a[_0x3d0a('0x43')]){for(var _0x5eda8b=0x0;_0x5eda8b<_0x56806a['monitors'][_0x3d0a('0x44')];_0x5eda8b+=0x1){_0x56806a[_0x3d0a('0x45')]=_0x56806a[_0x3d0a('0x46')][_0x5eda8b][_0x3d0a('0x47')];_0x56806a[_0x3d0a('0x48')]=_0x56806a[_0x3d0a('0x46')][_0x5eda8b]['createdAt'];if(_0x56806a[_0x3d0a('0x2f')]==_0x3d0a('0x49')){_0x56806a[_0x3d0a('0x38')]=_0x56806a[_0x3d0a('0x26')];_0x56806a['calleridname']=_0x56806a[_0x3d0a('0x4a')];_0x56806a[_0x3d0a('0x26')]=_0x56806a['accountcode'];_0x56806a['connectedlinename']=_0x56806a['membername'];_0x56806a[_0x3d0a('0x2f')]=_0x56806a[_0x3d0a('0x39')];}else if(_0x56806a[_0x3d0a('0x2f')]==_0x3d0a('0x4b')){_0x56806a[_0x3d0a('0x38')]=_0x56806a[_0x3d0a('0x2e')];_0x56806a['exten']=_0x56806a[_0x3d0a('0x39')];}RpcVoiceRecording[_0x3d0a('0x42')](_0x56806a);}}};Report[_0x3d0a('0x10')][_0x3d0a('0x4c')]=function(_0x1f3946){if(_[_0x3d0a('0x4d')](_0x1f3946)){_0x1f3946['forEach'](function(_0x4a71df){RpcVoiceAgentReport['create'](_0x4a71df);});}else{RpcVoiceAgentReport[_0x3d0a('0x42')](_0x1f3946);}};Report[_0x3d0a('0x10')][_0x3d0a('0x19')]=function(_0x58a66a){RpcVoiceDialReport[_0x3d0a('0x42')](_0x58a66a);var _0x58015a;var _0x141244;var _0x4c7db2=_0x58a66a[_0x3d0a('0x3a')];if(_[_0x3d0a('0x4e')](_0x4c7db2,'Local')){_0x141244=_0x4c7db2[_0x3d0a('0x4f')](_0x4c7db2[_0x3d0a('0x50')]('/')+0x1,_0x4c7db2[_0x3d0a('0x50')]('@'));_0x58015a=_['find'](this['agents'],function(_0x158b7b){return _0x158b7b[_0x3d0a('0x51')]==_0x141244||_0x158b7b['phone']==_0x141244||_0x158b7b[_0x3d0a('0x1f')]==_0x141244;});}else{_0x141244=_0x4c7db2[_0x3d0a('0x4f')](_0x4c7db2[_0x3d0a('0x50')]('/')+0x1,_0x4c7db2[_0x3d0a('0x52')]('-'));_0x58015a=this['findAgent'](_0x141244);}if(_0x58015a){_0x58a66a['interface']=_[_0x3d0a('0x21')](_0x58015a['interface'])?util[_0x3d0a('0x23')](_0x3d0a('0x24'),_0x58015a['name']):_0x58015a[_0x3d0a('0x22')];_0x58a66a['membername']=_0x58015a[_0x3d0a('0x20')];_0x58a66a[_0x3d0a('0x1f')]=_0x58015a[_0x3d0a('0x1f')];RpcMemberReport['voiceDialReport'](_0x58a66a);}};Report[_0x3d0a('0x10')][_0x3d0a('0x1b')]=function(_0x80173e){RpcVoiceTransferReport[_0x3d0a('0x3f')][_0x80173e[_0x3d0a('0x53')]]=_0x80173e;};Report[_0x3d0a('0x10')][_0x3d0a('0x1d')]=function(_0x40cd0d){RpcVoiceTransferReport['attendedTransfer'](_0x40cd0d);};module[_0x3d0a('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 8b2047e..5cbdf92 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 _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 +var _0x7785=['isNotNull','isUndefined','info','[userReport][registry]\x20registry:%s\x20state:%s','state','[userReport][registry]','username','stateRegistry','merge','omit','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','emit','format','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','name','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','util','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','redis','trunks','agents','telephones','registryentry','bind','syncRegistry','syncDeviceState','peerstatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','catch','[userReport][devicestatelist]','[userReport][sippeerstatus]','prototype'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x7785,0x104));var _0x5778=function(_0x385092,_0x5bb396){_0x385092=_0x385092-0x0;var _0x3e2762=_0x7785[_0x385092];return _0x3e2762;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x5778('0x0'));var Redis=require(_0x5778('0x1'));var BPromise=require('bluebird');var config=require(_0x5778('0x2'));var logger=require(_0x5778('0x3'))('ami');var ami=require('../ami');config['redis']=_[_0x5778('0x4')](config['redis'],{'host':_0x5778('0x5'),'port':0x18eb});var io=require(_0x5778('0x6'))(new Redis(config[_0x5778('0x7')]));function UserReport(_0x7c613a){this[_0x5778('0x8')]=_0x7c613a[_0x5778('0x8')];this[_0x5778('0x9')]=_0x7c613a[_0x5778('0x9')];this[_0x5778('0xa')]=_0x7c613a['telephones'];ami['on'](_0x5778('0xb'),this['syncRegistry'][_0x5778('0xc')](this));ami['on']('registry',this[_0x5778('0xd')][_0x5778('0xc')](this));ami['on']('devicestatechange',this[_0x5778('0xe')][_0x5778('0xc')](this));ami['on'](_0x5778('0xf'),this['syncPeerStatus'][_0x5778('0xc')](this));return this[_0x5778('0x10')]();}function showSipRegistrations(){Promise[_0x5778('0x11')]()[_0x5778('0x12')](ami[_0x5778('0x13')]())['catch'](function(_0x409af6){logger[_0x5778('0x14')](_0x5778('0x15'),util[_0x5778('0x16')](_0x409af6,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x5778('0x11')]()['then'](ami[_0x5778('0x17')]())[_0x5778('0x18')](function(_0x51c62a){logger[_0x5778('0x14')](_0x5778('0x19'),util[_0x5778('0x16')](_0x51c62a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x5778('0x11')]()[_0x5778('0x12')](ami['actionSipPeerStatus']())[_0x5778('0x18')](function(_0x3b71bc){logger[_0x5778('0x14')](_0x5778('0x1a'),util[_0x5778('0x16')](_0x3b71bc,{'showHidden':![],'depth':null}));});}UserReport[_0x5778('0x1b')][_0x5778('0x10')]=function(){setInterval(function(){BPromise[_0x5778('0x11')]()[_0x5778('0x12')](showSipRegistrations())[_0x5778('0x12')](listDeviceStates())[_0x5778('0x12')](showPeersStatus());},0x32c8);};UserReport[_0x5778('0x1b')][_0x5778('0x1c')]=function(_0x48ff8b){return _0x48ff8b!==null&&!_[_0x5778('0x1d')](_0x48ff8b);};UserReport[_0x5778('0x1b')]['emit']=function(_0x1c60c1,_0x5e14f2,_0x5063ab){io['to'](_0x1c60c1)['emit'](_0x5e14f2,_0x5063ab);};UserReport['prototype'][_0x5778('0xd')]=function(_0x51a341){try{if(this['isNotNull'](_0x51a341)){logger[_0x5778('0x1e')](_0x5778('0x1f'),_0x51a341['username'],_0x51a341[_0x5778('0x20')]);logger['debug'](_0x5778('0x21'),util[_0x5778('0x16')](_0x51a341,{'showHidden':![],'depth':null}));var _0x40ba1f=_['find'](this[_0x5778('0x8')],{'registry':_0x51a341[_0x5778('0x22')]});if(_0x40ba1f){_0x51a341[_0x5778('0x23')]=_0x51a341[_0x5778('0x20')];_[_0x5778('0x24')](_0x40ba1f,_[_0x5778('0x25')](_0x51a341,[_0x5778('0x26'),_0x5778('0x27'),_0x5778('0x22'),_0x5778('0x20')]));logger[_0x5778('0x28')](_0x5778('0x29'),util['inspect'](_0x40ba1f,{'showHidden':![],'depth':null}));this[_0x5778('0x2a')](util[_0x5778('0x2b')]('trunk:%s',_0x40ba1f['name']),_0x5778('0x2c'),_0x40ba1f);}}}catch(_0x3b1781){logger['error'](_0x5778('0x21'),util[_0x5778('0x16')](_0x3b1781,{'showHidden':![],'depth':null}));}};UserReport[_0x5778('0x1b')]['syncDeviceState']=function(_0x111f36){try{if(this[_0x5778('0x1c')](_0x111f36)){logger['info'](_0x5778('0x2d'),_0x111f36['device'],_0x111f36[_0x5778('0x20')]);logger[_0x5778('0x28')](_0x5778('0x2e'),util[_0x5778('0x16')](_0x111f36,{'showHidden':![],'depth':null}));if(this['agents'][_0x111f36['device']]){if(!this['agents'][_0x111f36[_0x5778('0x2f')]]['local']||_0x111f36[_0x5778('0x20')][_0x5778('0x30')]()==_0x5778('0x31')){this[_0x5778('0x9')][_0x111f36[_0x5778('0x2f')]][_0x5778('0x32')]=![];if(this[_0x5778('0x9')][_0x111f36[_0x5778('0x2f')]]['state']!==_0x111f36[_0x5778('0x20')]['toLowerCase']()){this[_0x5778('0x9')][_0x111f36[_0x5778('0x2f')]][_0x5778('0x33')]=_[_0x5778('0x34')](moment()[_0x5778('0x2b')]('x'));}this[_0x5778('0x9')][_0x111f36['device']][_0x5778('0x20')]=_0x111f36[_0x5778('0x20')][_0x5778('0x30')]();this['agents'][_0x111f36[_0x5778('0x2f')]][_0x5778('0x35')](_0x111f36);}}else if(this[_0x5778('0xa')][_0x111f36[_0x5778('0x2f')]]){if(this[_0x5778('0xa')][_0x111f36[_0x5778('0x2f')]][_0x5778('0x20')]!==_0x111f36[_0x5778('0x20')][_0x5778('0x30')]()){this[_0x5778('0xa')][_0x111f36['device']][_0x5778('0x33')]=_[_0x5778('0x34')](moment()[_0x5778('0x2b')]('x'));}this[_0x5778('0xa')][_0x111f36[_0x5778('0x2f')]][_0x5778('0x20')]=_0x111f36['state'][_0x5778('0x30')]();logger[_0x5778('0x28')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this['telephones'][_0x111f36[_0x5778('0x2f')]],{'showHidden':![],'depth':null}));this[_0x5778('0x2a')](util[_0x5778('0x2b')](_0x5778('0x36'),this['telephones'][_0x111f36[_0x5778('0x2f')]]['name']),_0x5778('0x37'),this[_0x5778('0xa')][_0x111f36[_0x5778('0x2f')]]);}else if(this['trunks'][_0x111f36[_0x5778('0x2f')]]){if(this['trunks'][_0x111f36['device']]['state']!==_0x111f36[_0x5778('0x20')]['toLowerCase']()){this[_0x5778('0x8')][_0x111f36[_0x5778('0x2f')]]['stateTime']=_[_0x5778('0x34')](moment()[_0x5778('0x2b')]('x'));}this[_0x5778('0x8')][_0x111f36[_0x5778('0x2f')]]['state']=_0x111f36['state']['toLowerCase']();logger[_0x5778('0x28')](_0x5778('0x38'),util[_0x5778('0x16')](this[_0x5778('0x8')][_0x111f36[_0x5778('0x2f')]],{'showHidden':![],'depth':null}));this[_0x5778('0x2a')](util[_0x5778('0x2b')](_0x5778('0x39'),this['trunks'][_0x111f36[_0x5778('0x2f')]][_0x5778('0x3a')]),'trunk:save',this[_0x5778('0x8')][_0x111f36[_0x5778('0x2f')]]);}else if(_['startsWith'](_0x111f36[_0x5778('0x2f')],'Local')){var _0x289092=_0x111f36[_0x5778('0x2f')];var _0x5b893c=_0x289092[_0x5778('0x3b')](_0x289092['indexOf']('/')+0x1,_0x289092[_0x5778('0x3c')]('@'));var _0x51e122=_['find'](this[_0x5778('0x9')],function(_0x5822c0){return _0x5822c0[_0x5778('0x3d')]==_0x5b893c||_0x5822c0[_0x5778('0x3e')]==_0x5b893c||_0x5822c0[_0x5778('0x3f')]==_0x5b893c;});if(_0x51e122){if(_0x51e122['state']!==_0x111f36[_0x5778('0x20')][_0x5778('0x30')]()){_0x51e122[_0x5778('0x33')]=_[_0x5778('0x34')](moment()[_0x5778('0x2b')]('x'));}_0x51e122[_0x5778('0x20')]=_0x111f36[_0x5778('0x20')]['toLowerCase']();_0x51e122[_0x5778('0x32')]=!![];_0x51e122[_0x5778('0x35')](_0x111f36);}}}}catch(_0xbed69e){logger[_0x5778('0x14')](_0x5778('0x2e'),util[_0x5778('0x16')](_0xbed69e,{'showHidden':![],'depth':null}));}};UserReport[_0x5778('0x1b')][_0x5778('0x40')]=function(_0x3c2550){try{if(this['isNotNull'](_0x3c2550)&&this[_0x5778('0x1c')](_0x3c2550[_0x5778('0xf')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x3c2550[_0x5778('0x41')],_0x3c2550[_0x5778('0x42')],_0x3c2550['peerstatus']);logger[_0x5778('0x28')](_0x5778('0x43'),util[_0x5778('0x16')](_0x3c2550,{'showHidden':![],'depth':null}));if(this[_0x5778('0x9')][_0x3c2550[_0x5778('0x41')]]){if(!this['agents'][_0x3c2550['peer']][_0x5778('0x32')]||_0x3c2550[_0x5778('0xf')]['toLowerCase']()==_0x5778('0x44')){this[_0x5778('0x9')][_0x3c2550[_0x5778('0x41')]][_0x5778('0x32')]=![];this[_0x5778('0x9')][_0x3c2550['peer']][_0x5778('0x45')]=_0x3c2550[_0x5778('0xf')][_0x5778('0x30')]();this[_0x5778('0x9')][_0x3c2550[_0x5778('0x41')]][_0x5778('0x42')]=_0x3c2550[_0x5778('0x42')];this[_0x5778('0x9')][_0x3c2550[_0x5778('0x41')]][_0x5778('0x35')](_0x3c2550);}}else if(this['telephones'][_0x3c2550[_0x5778('0x41')]]){this['telephones'][_0x3c2550[_0x5778('0x41')]][_0x5778('0x45')]=_0x3c2550[_0x5778('0xf')][_0x5778('0x30')]();this[_0x5778('0xa')][_0x3c2550['peer']][_0x5778('0x42')]=_0x3c2550[_0x5778('0x42')];logger[_0x5778('0x28')](_0x5778('0x46'),util[_0x5778('0x16')](this['telephones'][_0x3c2550[_0x5778('0x41')]],{'showHidden':![],'depth':null}));this[_0x5778('0x2a')](util[_0x5778('0x2b')](_0x5778('0x36'),this['telephones'][_0x3c2550['peer']][_0x5778('0x3a')]),_0x5778('0x37'),this['telephones'][_0x3c2550['peer']]);}else if(this['trunks'][_0x3c2550['peer']]){this[_0x5778('0x8')][_0x3c2550[_0x5778('0x41')]][_0x5778('0x45')]=_0x3c2550[_0x5778('0xf')]['toLowerCase']();this['trunks'][_0x3c2550[_0x5778('0x41')]]['address']=_0x3c2550[_0x5778('0x42')];logger[_0x5778('0x28')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x5778('0x16')](this[_0x5778('0x8')][_0x3c2550[_0x5778('0x41')]],{'showHidden':![],'depth':null}));this[_0x5778('0x2a')](util[_0x5778('0x2b')]('trunk:%s',this['trunks'][_0x3c2550[_0x5778('0x41')]][_0x5778('0x3a')]),_0x5778('0x2c'),this[_0x5778('0x8')][_0x3c2550[_0x5778('0x41')]]);}}}catch(_0x4556d4){logger[_0x5778('0x14')](_0x5778('0x43'),util[_0x5778('0x16')](_0x4556d4,{'showHidden':![],'depth':null}));}};module[_0x5778('0x47')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index fb15195..4ac2940 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 _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 +var _0x30c0=['hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','prototype','emit','isNotNull','isUndefined','syncAgentCalled','info','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','format','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','lastevent','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','ioredis','../../../config/logger','../ami','localhost','socket.io-emitter','redis','channels','voiceQueues','agents','variables','agentcalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','agentcomplete','syncAgentComplete','syncVarSet'];(function(_0x4d6cfa,_0x310a9e){var _0x324d58=function(_0x19b28c){while(--_0x19b28c){_0x4d6cfa['push'](_0x4d6cfa['shift']());}};_0x324d58(++_0x310a9e);}(_0x30c0,0x82));var _0x030c=function(_0x582c95,_0x5c9e0a){_0x582c95=_0x582c95-0x0;var _0x4caa80=_0x30c0[_0x582c95];return _0x4caa80;};'use strict';var _=require(_0x030c('0x0'));var moment=require(_0x030c('0x1'));var util=require(_0x030c('0x2'));var Redis=require(_0x030c('0x3'));var config=require('../../../config/environment');var logger=require(_0x030c('0x4'))('ami');var ami=require(_0x030c('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0x030c('0x6'),'port':0x18eb});var io=require(_0x030c('0x7'))(new Redis(config[_0x030c('0x8')]));function VoiceAgentReport(_0x5d3988){this[_0x030c('0x9')]={};this['voiceQueues']=_0x5d3988[_0x030c('0xa')];this['agents']=_0x5d3988[_0x030c('0xb')];this[_0x030c('0xc')]={};ami['on'](_0x030c('0xd'),this['syncAgentCalled'][_0x030c('0xe')](this));ami['on'](_0x030c('0xf'),this[_0x030c('0x10')][_0x030c('0xe')](this));ami['on'](_0x030c('0x11'),this[_0x030c('0x12')][_0x030c('0xe')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x030c('0xe')](this));ami['on'](_0x030c('0x13'),this[_0x030c('0x14')][_0x030c('0xe')](this));ami['on']('varset',this[_0x030c('0x15')][_0x030c('0xe')](this));ami['on'](_0x030c('0x16'),this[_0x030c('0x17')][_0x030c('0xe')](this));ami['on'](_0x030c('0x18'),this['syncMusicOnHoldStart'][_0x030c('0xe')](this));ami['on'](_0x030c('0x19'),this[_0x030c('0x1a')][_0x030c('0xe')](this));ami['on'](_0x030c('0x1b'),this[_0x030c('0x1c')][_0x030c('0xe')](this));ami['on'](_0x030c('0x1d'),this['syncBlindTransfer'][_0x030c('0xe')](this));}VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x1f')]=function(_0x22cb75,_0x12259c,_0x402465){io['to'](_0x22cb75)[_0x030c('0x1f')](_0x12259c,_0x402465);};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x20')]=function(_0x33e1bc){return _0x33e1bc!==null&&!_[_0x030c('0x21')](_0x33e1bc);};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x22')]=function(_0x4ddb4e){try{if(this[_0x030c('0x20')](_0x4ddb4e)){logger[_0x030c('0x23')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4ddb4e[_0x030c('0x24')],_0x4ddb4e[_0x030c('0x25')],_0x4ddb4e[_0x030c('0x26')]);logger[_0x030c('0x27')](_0x030c('0x28'),_0x4ddb4e[_0x030c('0x24')],util[_0x030c('0x29')](_0x4ddb4e,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0x4ddb4e[_0x030c('0x24')]])){this[_0x030c('0x9')][_0x4ddb4e[_0x030c('0x24')]]={};}if(_[_0x030c('0x21')](this['channels'][_0x4ddb4e['uniqueid']][_0x4ddb4e[_0x030c('0x26')]])){this[_0x030c('0x9')][_0x4ddb4e[_0x030c('0x24')]][_0x4ddb4e[_0x030c('0x26')]]={'agentcalledAt':moment()['format'](_0x030c('0x2a')),'lastevent':_0x030c('0x2b'),'mandatoryDisposition':this[_0x030c('0xa')][_0x4ddb4e[_0x030c('0x2c')]]?this[_0x030c('0xa')][_0x4ddb4e[_0x030c('0x2c')]][_0x030c('0x2d')]||![]:![],'type':this[_0x030c('0xa')][_0x4ddb4e['queue']]?this[_0x030c('0xa')][_0x4ddb4e[_0x030c('0x2c')]][_0x030c('0x2e')]||_0x030c('0x2f'):_0x030c('0x2f'),'variables':this[_0x030c('0xc')][_0x4ddb4e[_0x030c('0x24')]]};}_[_0x030c('0x30')](this[_0x030c('0x9')][_0x4ddb4e['uniqueid']][_0x4ddb4e[_0x030c('0x26')]],_[_0x030c('0x31')](_0x4ddb4e,[_0x030c('0x32'),_0x030c('0x33')]));logger[_0x030c('0x27')](_0x030c('0x34'),_0x4ddb4e[_0x030c('0x24')],util['inspect'](this[_0x030c('0x9')][_0x4ddb4e[_0x030c('0x24')]][_0x4ddb4e[_0x030c('0x26')]],{'showHidden':![],'depth':null}));ami[_0x030c('0x1f')](_0x030c('0x35'),this[_0x030c('0x9')][_0x4ddb4e['uniqueid']][_0x4ddb4e['destuniqueid']]);logger[_0x030c('0x27')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x4ddb4e[_0x030c('0x24')],util[_0x030c('0x29')](this['channels'][_0x4ddb4e[_0x030c('0x24')]][_0x4ddb4e[_0x030c('0x26')]],{'showHidden':![],'depth':null}));this[_0x030c('0x1f')](util[_0x030c('0x36')](_0x030c('0x37'),_0x4ddb4e['membername']),_0x030c('0x38'),this['channels'][_0x4ddb4e['uniqueid']][_0x4ddb4e[_0x030c('0x26')]]);}}catch(_0x207724){logger[_0x030c('0x39')](_0x030c('0x3a'),_0x4ddb4e[_0x030c('0x24')],util['inspect'](_0x207724,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x10')]=function(_0x19f6c7){try{if(this['isNotNull'](_0x19f6c7)){if(this[_0x030c('0x9')][_0x19f6c7['uniqueid']]){logger[_0x030c('0x27')](_0x030c('0x3b'),_0x19f6c7[_0x030c('0x24')],util[_0x030c('0x29')](_0x19f6c7,{'showHidden':![],'depth':null}));for(var _0x14e44d in this[_0x030c('0x9')][_0x19f6c7['uniqueid']]){if(this[_0x030c('0x9')][_0x19f6c7['uniqueid']][_0x030c('0x3c')](_0x14e44d)){if(_0x19f6c7[_0x030c('0x26')]===_0x14e44d){logger[_0x030c('0x23')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x19f6c7[_0x030c('0x24')],_0x19f6c7['membername'],_0x19f6c7[_0x030c('0x26')]);this[_0x030c('0x9')][_0x19f6c7['uniqueid']][_0x14e44d][_0x030c('0x3d')]=moment()['format'](_0x030c('0x2a'));this[_0x030c('0x9')][_0x19f6c7['uniqueid']][_0x14e44d][_0x030c('0x3e')]=_0x19f6c7[_0x030c('0x3e')];this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x3f')]=_0x19f6c7[_0x030c('0x3f')];this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x40')]=_0x19f6c7[_0x030c('0x40')];this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x41')]=_0x19f6c7[_0x030c('0x41')];this['channels'][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x42')]=_0x19f6c7[_0x030c('0x42')];this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d]['lastevent']=_0x030c('0x43');_[_0x030c('0x30')](this[_0x030c('0xb')][_0x19f6c7[_0x030c('0x44')]],_[_0x030c('0x45')](_0x19f6c7,[_0x030c('0x2c'),_0x030c('0x46')]));logger[_0x030c('0x27')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x19f6c7[_0x030c('0x24')],util[_0x030c('0x29')](this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x19f6c7[_0x030c('0x26')]],{'showHidden':![],'depth':null}));ami['emit'](_0x030c('0x47'),this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x19f6c7[_0x030c('0x26')]]);logger['debug'](_0x030c('0x48'),_0x19f6c7[_0x030c('0x24')],util[_0x030c('0x29')](this['channels'][_0x19f6c7[_0x030c('0x24')]][_0x19f6c7['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x030c('0x1f')](util[_0x030c('0x36')](_0x030c('0x37'),_0x19f6c7[_0x030c('0x25')]),_0x030c('0x49'),this[_0x030c('0x9')][_0x19f6c7['uniqueid']][_0x19f6c7[_0x030c('0x26')]]);}else if(!this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x11')]&&!this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x13')]){logger['info'](_0x030c('0x4a'),_0x19f6c7['uniqueid'],this['channels'][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x25')],_0x14e44d);this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x11')]=!![];this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x4b')]=moment()[_0x030c('0x36')](_0x030c('0x2a'));this['channels'][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x4c')]=_0x19f6c7[_0x030c('0x26')];this['channels'][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x4d')]=_0x19f6c7[_0x030c('0x25')];this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d]['lastevent']=_0x030c('0x4e');this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d][_0x030c('0x4f')]=_0x030c('0x4e');logger[_0x030c('0x27')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x19f6c7[_0x030c('0x24')],util['inspect'](this['channels'][_0x19f6c7['uniqueid']][_0x14e44d],{'showHidden':![],'depth':null}));ami[_0x030c('0x1f')](_0x030c('0x50'),this[_0x030c('0x9')][_0x19f6c7[_0x030c('0x24')]][_0x14e44d]);}}}}}}catch(_0x1bd0b3){logger[_0x030c('0x39')](_0x030c('0x51'),_0x19f6c7[_0x030c('0x24')],util[_0x030c('0x29')](_0x1bd0b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')]['syncAgentRingNoAnswer']=function(_0x6d54f9){try{if(this[_0x030c('0x20')](_0x6d54f9)){logger[_0x030c('0x27')](_0x030c('0x52'),_0x6d54f9[_0x030c('0x24')],util['inspect'](_0x6d54f9,{'showHidden':![],'depth':null}));if(this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]]&&this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9[_0x030c('0x26')]]){logger[_0x030c('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x6d54f9['uniqueid'],_0x6d54f9[_0x030c('0x25')],_0x6d54f9[_0x030c('0x26')]);this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9['destuniqueid']][_0x030c('0x11')]=!![];this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9[_0x030c('0x26')]][_0x030c('0x4b')]=moment()['format'](_0x030c('0x2a'));this['channels'][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9[_0x030c('0x26')]][_0x030c('0x53')]='rejected';this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9['destuniqueid']][_0x030c('0x4f')]=_0x030c('0x54');logger['debug'](_0x030c('0x55'),_0x6d54f9[_0x030c('0x24')],util['inspect'](this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9[_0x030c('0x26')]],{'showHidden':![],'depth':null}));ami[_0x030c('0x1f')](_0x030c('0x56'),this[_0x030c('0x9')][_0x6d54f9[_0x030c('0x24')]][_0x6d54f9[_0x030c('0x26')]]);}}}catch(_0x357794){logger['error'](_0x030c('0x57'),_0x6d54f9[_0x030c('0x24')],util[_0x030c('0x29')](_0x357794,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x58')]=function(_0x463734){try{if(this[_0x030c('0x20')](_0x463734)){logger[_0x030c('0x27')](_0x030c('0x59'),_0x463734[_0x030c('0x24')],util[_0x030c('0x29')](_0x463734,{'showHidden':![],'depth':null}));if(this['channels'][_0x463734[_0x030c('0x24')]]){for(var _0x8db58b in this['channels'][_0x463734[_0x030c('0x24')]]){if(this['channels'][_0x463734[_0x030c('0x24')]]['hasOwnProperty'](_0x8db58b)&&!this[_0x030c('0x9')][_0x463734['uniqueid']][_0x8db58b][_0x030c('0x11')]&&!this[_0x030c('0x9')][_0x463734[_0x030c('0x24')]][_0x8db58b][_0x030c('0x13')]){logger[_0x030c('0x23')](_0x030c('0x5a'),_0x463734['uniqueid'],this[_0x030c('0x9')][_0x463734[_0x030c('0x24')]][_0x8db58b][_0x030c('0x25')],_0x8db58b);this['channels'][_0x463734['uniqueid']][_0x8db58b][_0x030c('0x11')]=!![];this[_0x030c('0x9')][_0x463734[_0x030c('0x24')]][_0x8db58b][_0x030c('0x4b')]=moment()[_0x030c('0x36')](_0x030c('0x2a'));this[_0x030c('0x9')][_0x463734[_0x030c('0x24')]][_0x8db58b][_0x030c('0x53')]=_0x030c('0x5b');this['channels'][_0x463734['uniqueid']][_0x8db58b][_0x030c('0x4f')]=_0x030c('0x5b');logger[_0x030c('0x27')](_0x030c('0x5c'),_0x463734['uniqueid'],util[_0x030c('0x29')](this[_0x030c('0x9')][_0x463734[_0x030c('0x24')]][_0x8db58b],{'showHidden':![],'depth':null}));ami[_0x030c('0x1f')]('custom:agentqueuecallerabandon',this[_0x030c('0x9')][_0x463734[_0x030c('0x24')]][_0x8db58b]);}}}}}catch(_0x3443f3){logger[_0x030c('0x39')]('[%s][voiceAgentReport][queuecallerabandon]',_0x463734[_0x030c('0x24')],util[_0x030c('0x29')](_0x3443f3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')]['syncAgentComplete']=function(_0x2df3ef){try{if(this['isNotNull'](_0x2df3ef)){logger[_0x030c('0x27')](_0x030c('0x5d'),_0x2df3ef[_0x030c('0x24')],util[_0x030c('0x29')](_0x2df3ef,{'showHidden':![],'depth':null}));if(this['channels'][_0x2df3ef[_0x030c('0x24')]]){for(var _0x1a1a6c in this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]]){if(this[_0x030c('0x9')][_0x2df3ef['uniqueid']][_0x030c('0x3c')](_0x1a1a6c)){if(this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c][_0x030c('0x3d')]&&!this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c][_0x030c('0x13')]){logger[_0x030c('0x23')](_0x030c('0x5e'),_0x2df3ef[_0x030c('0x24')],this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c][_0x030c('0x25')],_0x1a1a6c);this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c][_0x030c('0x13')]=!![];this[_0x030c('0x9')][_0x2df3ef['uniqueid']][_0x1a1a6c][_0x030c('0x5f')]=moment()[_0x030c('0x36')](_0x030c('0x2a'));this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c][_0x030c('0x53')]='complete';this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c]['reason']=_0x2df3ef['reason']==_0x030c('0x60')?_0x030c('0x61'):_0x2df3ef[_0x030c('0x4f')];this[_0x030c('0x9')][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c][_0x030c('0x62')]=_0x2df3ef[_0x030c('0x62')];if(this[_0x030c('0xa')][_0x2df3ef[_0x030c('0x2c')]]&&this[_0x030c('0xa')][_0x2df3ef[_0x030c('0x2c')]]['acw']){this[_0x030c('0x9')][_0x2df3ef['uniqueid']][_0x1a1a6c][_0x030c('0x63')]=this['voiceQueues'][_0x2df3ef['queue']][_0x030c('0x64')];this['channels'][_0x2df3ef['uniqueid']][_0x1a1a6c][_0x030c('0x65')]=!![];}this[_0x030c('0xb')][_0x2df3ef[_0x030c('0x44')]]=_[_0x030c('0x31')](this[_0x030c('0xb')][_0x2df3ef['interface']],[_0x030c('0x2c'),'destconnectedlinenum']);logger['debug'](_0x030c('0x66'),_0x2df3ef[_0x030c('0x24')],util[_0x030c('0x29')](this[_0x030c('0x9')][_0x2df3ef['uniqueid']][_0x1a1a6c],{'showHidden':![],'depth':null}));ami[_0x030c('0x1f')](_0x030c('0x67'),this['channels'][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x2df3ef[_0x030c('0x24')],util[_0x030c('0x29')](this['channels'][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c],{'showHidden':![],'depth':null}));this[_0x030c('0x1f')](util['format'](_0x030c('0x37'),_0x2df3ef['membername']),'user:agentcomplete',this['channels'][_0x2df3ef[_0x030c('0x24')]][_0x1a1a6c]);}}}}}}catch(_0x5db173){logger[_0x030c('0x39')]('[%s][voiceAgentReport][agentcomplete]',_0x2df3ef['uniqueid'],util[_0x030c('0x29')](_0x5db173,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x15')]=function(_0x2fde16){try{if(this[_0x030c('0x20')](_0x2fde16)){logger[_0x030c('0x27')](_0x030c('0x68'),_0x2fde16['uniqueid'],util[_0x030c('0x29')](_0x2fde16,{'showHidden':![],'depth':null}));this[_0x030c('0x69')](_0x2fde16[_0x030c('0x24')],_[_0x030c('0x6a')](_0x2fde16[_0x030c('0x6b')])[0x0],_0x2fde16['value']);if(this['channels'][_0x2fde16['uniqueid']]){for(var _0x1e6abf in this[_0x030c('0x9')][_0x2fde16[_0x030c('0x24')]]){if(this['channels'][_0x2fde16[_0x030c('0x24')]][_0x030c('0x3c')](_0x1e6abf)){logger[_0x030c('0x23')](_0x030c('0x6c'),_0x2fde16[_0x030c('0x24')],_0x1e6abf,_[_0x030c('0x6a')](_0x2fde16['variable'])[0x0],_0x2fde16[_0x030c('0x6d')]);if(_[_0x030c('0x21')](this[_0x030c('0x9')][_0x2fde16[_0x030c('0x24')]][_0x1e6abf][_0x030c('0xc')])){this['channels'][_0x2fde16[_0x030c('0x24')]][_0x1e6abf]['variables']={};}this[_0x030c('0x9')][_0x2fde16[_0x030c('0x24')]][_0x1e6abf][_0x030c('0xc')]=this['variables'][_0x2fde16[_0x030c('0x24')]];}}}}}catch(_0x19c456){logger[_0x030c('0x39')](_0x030c('0x6e'),_0x2fde16[_0x030c('0x24')],util['inspect'](_0x19c456,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')]['addVariable']=function(_0x2a20c7,_0x434cdf,_0x509ebb){var _0x28d50b=[_0x030c('0x6f'),_0x030c('0x70'),'rtpaudioqosjitter','rtpaudioqosjitterbridged',_0x030c('0x71'),_0x030c('0x72'),_0x030c('0x73'),_0x030c('0x74'),_0x030c('0x75'),_0x030c('0x76'),_0x030c('0x77'),_0x030c('0x78'),'membercalls',_0x030c('0x79'),_0x030c('0x7a'),_0x030c('0x7b'),_0x030c('0x25'),'memberpenalty',_0x030c('0x7c')];if(!_[_0x030c('0x7d')](_0x434cdf)&&!_['includes'](_0x28d50b,_0x434cdf)){if(_[_0x030c('0x21')](this[_0x030c('0xc')][_0x2a20c7])){this['variables'][_0x2a20c7]={};}this['variables'][_0x2a20c7][_0x434cdf]=_0x509ebb;}};VoiceAgentReport['prototype'][_0x030c('0x17')]=function(_0x305d81){try{if(this[_0x030c('0x20')](_0x305d81)){logger[_0x030c('0x27')](_0x030c('0x7e'),_0x305d81[_0x030c('0x24')],util['inspect'](_0x305d81,{'showHidden':![],'depth':null}));if(this[_0x030c('0x9')][_0x305d81[_0x030c('0x24')]]){for(var _0x4c4f55 in this[_0x030c('0x9')][_0x305d81[_0x030c('0x24')]]){if(this[_0x030c('0x9')][_0x305d81[_0x030c('0x24')]][_0x030c('0x3c')](_0x4c4f55)){if(this[_0x030c('0x9')][_0x305d81[_0x030c('0x24')]][_0x4c4f55][_0x030c('0x4f')]==_0x030c('0x60')&&this[_0x030c('0x9')][_0x305d81[_0x030c('0x24')]][_0x4c4f55][_0x030c('0x13')]){logger[_0x030c('0x23')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x305d81[_0x030c('0x24')],_0x4c4f55);this[_0x030c('0x9')][_0x305d81['uniqueid']][_0x4c4f55]['agentcompleteAt']=moment()[_0x030c('0x36')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0x030c('0x27')](_0x030c('0x7f'),_0x305d81[_0x030c('0x24')],util[_0x030c('0x29')](_[_0x030c('0x80')](this[_0x030c('0x9')][_0x305d81['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x030c('0x1f')]('custom:voiceAgentReport',_[_0x030c('0x80')](this[_0x030c('0x9')][_0x305d81[_0x030c('0x24')]]));delete this['channels'][_0x305d81[_0x030c('0x24')]];}if(this[_0x030c('0xc')][_0x305d81[_0x030c('0x24')]]){delete this['variables'][_0x305d81['uniqueid']];}}}catch(_0x47c982){logger[_0x030c('0x39')]('[%s][voiceAgentReport][hangup]',_0x305d81[_0x030c('0x24')],util['inspect'](_0x47c982,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x1c')]=function(_0x24d530){try{if(this[_0x030c('0x20')](_0x24d530)){logger[_0x030c('0x27')](_0x030c('0x81'),_0x24d530['uniqueid'],util[_0x030c('0x29')](_0x24d530,{'showHidden':![],'depth':null}));if(this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]]){for(var _0x5ce495 in this['channels'][_0x24d530[_0x030c('0x82')]]){if(this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]][_0x030c('0x3c')](_0x5ce495)){if(_0x24d530[_0x030c('0x83')]===_0x5ce495){logger[_0x030c('0x23')](_0x030c('0x84'),_0x24d530[_0x030c('0x24')],this['channels'][_0x24d530[_0x030c('0x82')]][_0x5ce495][_0x030c('0x25')],_0x5ce495);var _0x149bb3=moment();this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]][_0x5ce495][_0x030c('0x13')]=!![];this[_0x030c('0x9')][_0x24d530['transfereeuniqueid']][_0x5ce495][_0x030c('0x5f')]=moment()[_0x030c('0x36')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]][_0x5ce495][_0x030c('0x53')]=_0x030c('0x85');this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]][_0x5ce495][_0x030c('0x4f')]=_0x030c('0x60');this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]][_0x5ce495][_0x030c('0x62')]=_0x149bb3[_0x030c('0x86')](this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]][_0x5ce495]['agentconnectAt'],_0x030c('0x87'));}}}}if(this['channels'][_0x24d530[_0x030c('0x88')]]){var _0x3eef29=this[_0x030c('0x9')][_0x24d530[_0x030c('0x88')]];this['channels'][_0x24d530[_0x030c('0x88')]]=this[_0x030c('0x9')][_0x24d530[_0x030c('0x82')]];this[_0x030c('0x9')][_0x24d530['transfereeuniqueid']]=_0x3eef29;}}}catch(_0xfee4b1){logger[_0x030c('0x39')](_0x030c('0x89'),_0x24d530[_0x030c('0x24')],util[_0x030c('0x29')](_0xfee4b1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x8a')]=function(_0x50b418){try{if(this[_0x030c('0x20')](_0x50b418)){logger['debug'](_0x030c('0x8b'),_0x50b418['uniqueid'],util[_0x030c('0x29')](_0x50b418,{'showHidden':![],'depth':null}));if(this[_0x030c('0x9')][_0x50b418[_0x030c('0x82')]]){for(var _0x1f94f1 in this[_0x030c('0x9')][_0x50b418['transfereeuniqueid']]){if(this[_0x030c('0x9')][_0x50b418[_0x030c('0x82')]][_0x030c('0x3c')](_0x1f94f1)){if(_0x50b418[_0x030c('0x8c')]===_0x1f94f1){logger['info'](_0x030c('0x8d'),_0x50b418[_0x030c('0x24')],this['channels'][_0x50b418[_0x030c('0x82')]][_0x1f94f1][_0x030c('0x25')],_0x1f94f1);var _0x212eeb=moment();this[_0x030c('0x9')][_0x50b418[_0x030c('0x82')]][_0x1f94f1][_0x030c('0x13')]=!![];this[_0x030c('0x9')][_0x50b418['transfereeuniqueid']][_0x1f94f1]['agentcompleteAt']=_0x212eeb;this['channels'][_0x50b418[_0x030c('0x82')]][_0x1f94f1][_0x030c('0x53')]=_0x030c('0x85');this[_0x030c('0x9')][_0x50b418[_0x030c('0x82')]][_0x1f94f1]['reason']=_0x030c('0x60');this[_0x030c('0x9')][_0x50b418[_0x030c('0x82')]][_0x1f94f1][_0x030c('0x62')]=_0x212eeb[_0x030c('0x86')](this[_0x030c('0x9')][_0x50b418['transfereeuniqueid']][_0x1f94f1][_0x030c('0x3d')],_0x030c('0x87'));}}}}}}catch(_0x3bda95){logger[_0x030c('0x39')]('[%s][voiceAgentReport][blindtransfer]',_0x50b418[_0x030c('0x24')],util[_0x030c('0x29')](_0x3bda95,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x8e')]=function(_0x13d00a){var _0x20d223='';try{if(this[_0x030c('0x20')](_0x13d00a)){logger[_0x030c('0x27')](_0x030c('0x8f'),_0x13d00a[_0x030c('0x24')],util[_0x030c('0x29')](_0x13d00a,{'showHidden':![],'depth':null}));if(_0x13d00a[_0x030c('0x90')]){_0x20d223=_0x13d00a[_0x030c('0x90')]['substring'](0x0,_0x13d00a[_0x030c('0x90')]['lastIndexOf']('-'));if(this[_0x030c('0xb')][_0x20d223]){logger[_0x030c('0x23')](_0x030c('0x91'),_0x13d00a['uniqueid'],_0x20d223);this[_0x030c('0xb')][_0x20d223][_0x030c('0x92')]=!![];}}}}catch(_0x1eee18){logger[_0x030c('0x39')](_0x030c('0x93'),_0x13d00a[_0x030c('0x24')],util['inspect'](_0x1eee18,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x030c('0x1e')][_0x030c('0x1a')]=function(_0x1c4690){var _0x489cb2='';try{if(this[_0x030c('0x20')](_0x1c4690)){logger[_0x030c('0x27')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x1c4690[_0x030c('0x24')],util['inspect'](_0x1c4690,{'showHidden':![],'depth':null}));if(_0x1c4690[_0x030c('0x90')]){_0x489cb2=_0x1c4690[_0x030c('0x90')][_0x030c('0x94')](0x0,_0x1c4690['channel'][_0x030c('0x95')]('-'));if(this[_0x030c('0xb')][_0x489cb2]){logger[_0x030c('0x23')](_0x030c('0x96'),_0x1c4690[_0x030c('0x24')],_0x489cb2);this['agents'][_0x489cb2]['onhold']=![];}}}}catch(_0x588758){logger[_0x030c('0x39')]('[%s][voiceAgentReport][musiconholdstop]',_0x1c4690['uniqueid'],util['inspect'](_0x588758,{'showHidden':![],'depth':null}));}};module[_0x030c('0x97')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index cc6246b..449746a 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 _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 +var _0x688d=['[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','channel','split','destconnectedlinenum','accountcode','format','user:%s','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','disposition','includes','lastapplication','lastdata','set','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','xcally-motion-preview','UserId','membername','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','monitors','isNil','push','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','destination','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','diff','from-sip','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','event','BlindTransfer','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','unavailable','ringing','ringinuse','onhold','queue','agi','playback','voicemail','FAILED','ANSWERED','redis','defaults','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','prototype','isNotNull','isUndefined','emit','info'];(function(_0x22eb96,_0x3c2d8d){var _0x5e1adf=function(_0x22e392){while(--_0x22e392){_0x22eb96['push'](_0x22eb96['shift']());}};_0x5e1adf(++_0x3c2d8d);}(_0x688d,0x1d7));var _0xd688=function(_0x2b108f,_0x21411f){_0x2b108f=_0x2b108f-0x0;var _0x373040=_0x688d[_0x2b108f];return _0x373040;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var moment=require(_0xd688('0x0'));var util=require(_0xd688('0x1'));var path=require(_0xd688('0x2'));var Redis=require('ioredis');var config=require(_0xd688('0x3'));var logger=require(_0xd688('0x4'))(_0xd688('0x5'));var ami=require(_0xd688('0x6'));var Channel=require(_0xd688('0x7'));var statusDesc=[_0xd688('0x8'),'not_inuse',_0xd688('0x9'),'busy','invalid',_0xd688('0xa'),_0xd688('0xb'),_0xd688('0xc'),_0xd688('0xd')];var applications=['set',_0xd688('0xe'),_0xd688('0xf'),'dial',_0xd688('0x10'),_0xd688('0x11')];var dispositions=['NO\x20ANSWER',_0xd688('0x12'),_0xd688('0x12'),'NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xd688('0x13'),'BUSY','FAILED',_0xd688('0x12'),'FAILED'];var actions={};config[_0xd688('0x14')]=_[_0xd688('0x15')](config[_0xd688('0x14')],{'host':_0xd688('0x16'),'port':0x18eb});var io=require(_0xd688('0x17'))(new Redis(config[_0xd688('0x14')]));function VoiceCallReport(_0x38690f){this[_0xd688('0x18')]=_0x38690f['channels'];this[_0xd688('0x19')]=_0x38690f['agents'];this['blindTransfers']={};ami['on'](_0xd688('0x1a'),this['syncNewExten'][_0xd688('0x1b')](this));ami['on'](_0xd688('0x1c'),this[_0xd688('0x1d')][_0xd688('0x1b')](this));ami['on'](_0xd688('0x1e'),this[_0xd688('0x1f')][_0xd688('0x1b')](this));ami['on'](_0xd688('0x20'),this[_0xd688('0x21')][_0xd688('0x1b')](this));ami['on'](_0xd688('0x22'),this[_0xd688('0x23')][_0xd688('0x1b')](this));ami['on']('hangup',this[_0xd688('0x24')]['bind'](this));ami['on']('newcallerid',this[_0xd688('0x25')][_0xd688('0x1b')](this));ami['on'](_0xd688('0x26'),this['syncAttendedTransfer'][_0xd688('0x1b')](this));ami['on'](_0xd688('0x27'),this[_0xd688('0x28')][_0xd688('0x1b')](this));ami['on'](_0xd688('0x29'),this[_0xd688('0x2a')][_0xd688('0x1b')](this));ami['on'](_0xd688('0x2b'),this[_0xd688('0x2c')]['bind'](this));try{logger['info'](_0xd688('0x2d'));ami[_0xd688('0x2e')]();}catch(_0x4d8234){logger[_0xd688('0x2f')]('[voiceCallReport][coreshowchannels]',util[_0xd688('0x30')](_0x4d8234,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xd688('0x31')][_0xd688('0x32')]=function(_0x28daf2){return _0x28daf2!==null&&!_[_0xd688('0x33')](_0x28daf2);};VoiceCallReport[_0xd688('0x31')][_0xd688('0x34')]=function(_0x3a6979,_0x668159,_0x20e960){io['to'](_0x3a6979)[_0xd688('0x34')](_0x668159,_0x20e960);};VoiceCallReport[_0xd688('0x31')][_0xd688('0x25')]=function(_0x424757){try{if(this[_0xd688('0x32')](_0x424757)){logger[_0xd688('0x35')](_0xd688('0x36'),_0x424757[_0xd688('0x37')],_0x424757['calleridname'],_0x424757[_0xd688('0x38')]);logger[_0xd688('0x39')](_0xd688('0x3a'),_0x424757[_0xd688('0x37')],util[_0xd688('0x30')](_0x424757,{'showHidden':![],'depth':null}));if(_0x424757['uniqueid']===_0x424757[_0xd688('0x3b')]){if(!_['isUndefined'](this[_0xd688('0x18')][_0x424757['uniqueid']])){_[_0xd688('0x3c')](this[_0xd688('0x18')][_0x424757['uniqueid']],_[_0xd688('0x3d')](_0x424757,_[_0xd688('0x3e')](this[_0xd688('0x18')][_0x424757[_0xd688('0x37')]])));}}}}catch(_0x45d1e7){logger['error'](_0xd688('0x3f'),_0x424757[_0xd688('0x37')],util[_0xd688('0x30')](_0x45d1e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd688('0x31')]['syncNewChannel']=function(_0x531a4f){try{if(this[_0xd688('0x32')](_0x531a4f)){logger[_0xd688('0x39')](_0xd688('0x40'),_0x531a4f[_0xd688('0x37')],util[_0xd688('0x30')](_0x531a4f,{'showHidden':![],'depth':null}));if(_0x531a4f[_0xd688('0x37')]===_0x531a4f[_0xd688('0x3b')]&&_0x531a4f['channel']!=_0xd688('0x41')){if(_[_0xd688('0x33')](this[_0xd688('0x18')][_0x531a4f[_0xd688('0x37')]])){logger['info'](_0xd688('0x42'),_0x531a4f[_0xd688('0x37')],_0x531a4f[_0xd688('0x43')],_0x531a4f[_0xd688('0x44')]);this[_0xd688('0x18')][_0x531a4f['uniqueid']]=new Channel();this[_0xd688('0x18')][_0x531a4f[_0xd688('0x37')]][_0xd688('0x45')]=moment()['format'](_0xd688('0x46'));this['channels'][_0x531a4f[_0xd688('0x37')]]['disposition']=dispositions[_[_0xd688('0x47')](_0x531a4f[_0xd688('0x48')])];_[_0xd688('0x3c')](this[_0xd688('0x18')][_0x531a4f['uniqueid']],_[_0xd688('0x3d')](_0x531a4f,_[_0xd688('0x3e')](this[_0xd688('0x18')][_0x531a4f[_0xd688('0x37')]])));if(_0x531a4f[_0xd688('0x43')]==='from-sip'){if(this[_0xd688('0x19')][_0x531a4f[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]]){this[_0xd688('0x19')][_0x531a4f[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]][_0xd688('0x4b')]=_0x531a4f[_0xd688('0x44')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x531a4f[_0xd688('0x37')],util[_0xd688('0x30')]({'destaccountcode':this['agents'][_0x531a4f[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]][_0xd688('0x4c')],'destconnectedlinenum':_0x531a4f['exten']},{'showHidden':![],'depth':null}));this[_0xd688('0x34')](util[_0xd688('0x4d')](_0xd688('0x4e'),this[_0xd688('0x19')][_0x531a4f[_0xd688('0x49')]['split']('-')[0x0]][_0xd688('0x4f')]),_0xd688('0x50'),{'destaccountcode':this[_0xd688('0x19')][_0x531a4f[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]][_0xd688('0x4c')],'destconnectedlinenum':_0x531a4f['exten']});}}}}}}catch(_0x225ea7){logger[_0xd688('0x2f')]('[%s][voiceCallReport][newchannel]',_0x531a4f[_0xd688('0x37')],util[_0xd688('0x30')](_0x225ea7,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x4ce02c){try{if(this[_0xd688('0x32')](_0x4ce02c)){logger[_0xd688('0x39')](_0xd688('0x51'),_0x4ce02c['uniqueid'],util[_0xd688('0x30')](_0x4ce02c,{'showHidden':![],'depth':null}));if(_0x4ce02c[_0xd688('0x37')]===_0x4ce02c['linkedid']&&_0x4ce02c[_0xd688('0x44')]!='h'&&_0x4ce02c[_0xd688('0x49')]!=_0xd688('0x41')){_0x4ce02c[_0xd688('0x52')]=_0x4ce02c['application'][_0xd688('0x53')]();_0x4ce02c[_0xd688('0x54')]=(_0x4ce02c['appdata']||_0x4ce02c[_0xd688('0x54')])[_0xd688('0x53')]();logger['info'](_0xd688('0x55'),_0x4ce02c['uniqueid'],_0x4ce02c[_0xd688('0x52')],_0x4ce02c['applicationdata']);if(_[_0xd688('0x33')](this[_0xd688('0x18')][_0x4ce02c[_0xd688('0x37')]])){this[_0xd688('0x18')][_0x4ce02c['uniqueid']]=new Channel();this['channels'][_0x4ce02c[_0xd688('0x37')]]['starttime']=_0x4ce02c['duration']?moment()['subtract'](moment[_0xd688('0x56')](_0x4ce02c[_0xd688('0x56')])[_0xd688('0x57')](),_0xd688('0x57'))[_0xd688('0x4d')](_0xd688('0x46')):moment()['format'](_0xd688('0x46'));this[_0xd688('0x18')][_0x4ce02c['uniqueid']][_0xd688('0x58')]='NO\x20ANSWER';}_[_0xd688('0x3c')](this[_0xd688('0x18')][_0x4ce02c[_0xd688('0x37')]],_[_0xd688('0x3d')](_0x4ce02c,_['keys'](this[_0xd688('0x18')][_0x4ce02c[_0xd688('0x37')]])));if(_[_0xd688('0x59')](applications,_0x4ce02c[_0xd688('0x52')])){this[_0xd688('0x18')][_0x4ce02c[_0xd688('0x37')]][_0xd688('0x5a')]=_0x4ce02c['application'];this['channels'][_0x4ce02c['uniqueid']][_0xd688('0x5b')]=_0x4ce02c[_0xd688('0x54')];if(_0x4ce02c[_0xd688('0x52')]===_0xd688('0x5c')&&_[_0xd688('0x5d')](_0x4ce02c[_0xd688('0x54')],_0xd688('0x5e'))){var _0x2cb1ca=_0x4ce02c['applicationdata'][_0xd688('0x4a')]('=');var _0x369f26=_0x2cb1ca[0x0]['match'](/cdr\((.*)\)/);if(_0x369f26){this[_0xd688('0x18')][_0x4ce02c[_0xd688('0x37')]][_0x369f26[0x1]]=_0x2cb1ca[0x1];}}else if(_0x4ce02c['application']===_0xd688('0xe')){this[_0xd688('0x18')][_0x4ce02c[_0xd688('0x37')]]['queue']=_0x4ce02c[_0xd688('0x54')]['split'](',')[0x0];}}}}}catch(_0x313774){logger[_0xd688('0x2f')](_0xd688('0x5f'),_0x4ce02c[_0xd688('0x37')],util['inspect'](_0x313774,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd688('0x31')][_0xd688('0x21')]=function(_0x4deff4){try{if(this[_0xd688('0x32')](_0x4deff4)){logger['info'](_0xd688('0x60'),_0x4deff4[_0xd688('0x37')],_0x4deff4[_0xd688('0x3b')],_0x4deff4[_0xd688('0x61')],_0x4deff4['calleridnum']);logger['debug'](_0xd688('0x62'),_0x4deff4[_0xd688('0x37')],util[_0xd688('0x30')](_0x4deff4,{'showHidden':![],'depth':null}));if(_0x4deff4[_0xd688('0x37')]!==_0x4deff4['linkedid']){if(this[_0xd688('0x18')][_0x4deff4['linkedid']]){if(_0x4deff4['channelstate']==='6'){if(!this[_0xd688('0x18')][_0x4deff4[_0xd688('0x3b')]][_0xd688('0x63')]){var _0x453563=moment();this[_0xd688('0x18')][_0x4deff4['linkedid']]['answered']=!![];this[_0xd688('0x18')][_0x4deff4[_0xd688('0x3b')]][_0xd688('0x64')]=_0x453563[_0xd688('0x4d')](_0xd688('0x46'));if(this['channels'][_0x4deff4['linkedid']][_0xd688('0x45')]){this[_0xd688('0x18')][_0x4deff4[_0xd688('0x3b')]][_0xd688('0x65')]=_0x453563['diff'](this['channels'][_0x4deff4[_0xd688('0x3b')]][_0xd688('0x45')],'seconds');}}this['channels'][_0x4deff4['linkedid']][_0xd688('0x3b')]=_0x4deff4[_0xd688('0x37')];if(_0x4deff4['calleridnum']!==_0xd688('0x66')){this['channels'][_0x4deff4[_0xd688('0x3b')]]['connectedlinenum']=_0x4deff4[_0xd688('0x38')];}this[_0xd688('0x18')][_0x4deff4[_0xd688('0x3b')]]['connectedlinename']=_0x4deff4[_0xd688('0x61')];this['channels'][_0x4deff4[_0xd688('0x3b')]]['destinationchannel']=_0x4deff4[_0xd688('0x49')];this['channels'][_0x4deff4['linkedid']][_0xd688('0x58')]=dispositions[_[_0xd688('0x47')](_0x4deff4[_0xd688('0x48')])];if(this[_0xd688('0x19')][_0x4deff4[_0xd688('0x49')]['split']('-')[0x0]]){this[_0xd688('0x18')][_0x4deff4[_0xd688('0x3b')]][_0xd688('0x67')]=this[_0xd688('0x19')][_0x4deff4[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]]['id'];this['channels'][_0x4deff4[_0xd688('0x3b')]][_0xd688('0x68')]=this[_0xd688('0x19')][_0x4deff4[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]][_0xd688('0x4f')];}}}}else{if(this[_0xd688('0x18')][_0x4deff4[_0xd688('0x37')]]){if(_0x4deff4[_0xd688('0x48')]==='6'){if(this[_0xd688('0x19')][_0x4deff4[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]]){this[_0xd688('0x18')][_0x4deff4['uniqueid']]['UserId']=this[_0xd688('0x19')][_0x4deff4[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]]['id'];this[_0xd688('0x18')][_0x4deff4['uniqueid']]['membername']=this['agents'][_0x4deff4[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]]['name'];}}}}}}catch(_0x31cac6){logger[_0xd688('0x2f')](_0xd688('0x69'),_0x4deff4[_0xd688('0x37')],util[_0xd688('0x30')](_0x31cac6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd688('0x31')][_0xd688('0x6a')]=function(_0x1a1453,_0x1f8c95){try{if(this[_0xd688('0x18')][_0x1a1453]){logger[_0xd688('0x35')](_0xd688('0x6b'),_0x1a1453,_0x1f8c95);this['channels'][_0x1a1453][_0xd688('0x6c')]=!![];if(_[_0xd688('0x6d')](_0x1f8c95,_0xd688('0x6e'))){_0x1f8c95=_0x1f8c95[_0xd688('0x6f')](_0xd688('0x6e'),_0xd688('0x70'));}this[_0xd688('0x18')][_0x1a1453][_0xd688('0x71')]=_0x1f8c95;var _0x146c31=_['find'](this[_0xd688('0x18')][_0x1a1453][_0xd688('0x72')],{'filename':_0x1f8c95});if(_[_0xd688('0x73')](_0x146c31)){this[_0xd688('0x18')][_0x1a1453][_0xd688('0x72')][_0xd688('0x74')]({'filename':_0x1f8c95,'createdAt':moment()[_0xd688('0x4d')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0xbf2d76){logger[_0xd688('0x2f')]('[%s][voiceCallReport][mixMonitorFilename]',_0x1a1453,util['inspect'](_0xbf2d76,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncVarSet']=function(_0x2e069b){try{if(this['isNotNull'](_0x2e069b)){logger[_0xd688('0x39')](_0xd688('0x75'),_0x2e069b[_0xd688('0x37')],util[_0xd688('0x30')](_0x2e069b,{'showHidden':![],'depth':null}));if(this[_0xd688('0x18')][_0x2e069b[_0xd688('0x37')]]&&_0x2e069b[_0xd688('0x49')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x2e069b[_0xd688('0x76')])){if(this['isNotNull'](_0x2e069b[_0xd688('0x76')][_0xd688('0x77')])){logger[_0xd688('0x35')](_0xd688('0x78'),_0x2e069b[_0xd688('0x37')],_0x2e069b[_0xd688('0x79')]);this[_0xd688('0x6a')](_0x2e069b['uniqueid'],_0x2e069b[_0xd688('0x79')]);}else if(this['isNotNull'](_0x2e069b[_0xd688('0x76')][_0xd688('0x7a')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x2e069b['uniqueid'],_0x2e069b[_0xd688('0x79')]);this[_0xd688('0x18')][_0x2e069b['uniqueid']][_0xd688('0x38')]=_0x2e069b[_0xd688('0x79')];}else if(this['isNotNull'](_0x2e069b[_0xd688('0x76')][_0xd688('0x7b')])){logger[_0xd688('0x35')](_0xd688('0x7c'),_0x2e069b[_0xd688('0x37')],_0x2e069b[_0xd688('0x79')]);this[_0xd688('0x18')][_0x2e069b['uniqueid']]['callerid']=_0x2e069b[_0xd688('0x79')];}else if(this[_0xd688('0x32')](_0x2e069b[_0xd688('0x76')][_0xd688('0x7d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x2e069b['uniqueid'],_0x2e069b[_0xd688('0x79')]);this['channels'][_0x2e069b[_0xd688('0x37')]][_0xd688('0x7e')]=_0x2e069b['value'];}else if(this[_0xd688('0x32')](_0x2e069b['variable'][_0xd688('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x2e069b[_0xd688('0x37')],_0x2e069b[_0xd688('0x79')][_0xd688('0x4a')](',')[0x0]);this[_0xd688('0x18')][_0x2e069b[_0xd688('0x37')]]['queue']=_0x2e069b[_0xd688('0x79')]['split'](',')[0x0];}else if(this[_0xd688('0x32')](_0x2e069b[_0xd688('0x76')][_0xd688('0x80')])){logger[_0xd688('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2e069b[_0xd688('0x37')],_0x2e069b[_0xd688('0x79')]);this['channels'][_0x2e069b[_0xd688('0x37')]][_0xd688('0x81')]=_0x2e069b[_0xd688('0x79')];}else if(this[_0xd688('0x32')](_0x2e069b[_0xd688('0x76')]['xmd-destination'])){logger[_0xd688('0x35')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x2e069b[_0xd688('0x37')],_0x2e069b[_0xd688('0x79')]);this[_0xd688('0x18')][_0x2e069b[_0xd688('0x37')]][_0xd688('0x82')]=_0x2e069b[_0xd688('0x79')];}else if(this['isNotNull'](_0x2e069b[_0xd688('0x76')][_0xd688('0x83')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x2e069b['uniqueid'],_0x2e069b[_0xd688('0x79')]);this[_0xd688('0x18')][_0x2e069b[_0xd688('0x37')]]['calleridpreview']=_0x2e069b[_0xd688('0x79')];}else if(this['isNotNull'](_0x2e069b[_0xd688('0x76')][_0xd688('0x84')])){logger['info'](_0xd688('0x85'),_0x2e069b[_0xd688('0x37')],_0x2e069b['value']);this[_0xd688('0x18')][_0x2e069b[_0xd688('0x37')]][_0xd688('0xe')]=_0x2e069b[_0xd688('0x79')];}else if(this['isNotNull'](_0x2e069b['variable'][_0xd688('0x86')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x2e069b[_0xd688('0x37')],_0x2e069b[_0xd688('0x79')]);this[_0xd688('0x18')][_0x2e069b[_0xd688('0x37')]][_0xd688('0x87')]=_0x2e069b[_0xd688('0x79')];}}}else if(this[_0xd688('0x32')](_0x2e069b['variable'][_0xd688('0x77')])){if(_0x2e069b['value']){var _0x5d5d63=path[_0xd688('0x88')](_0x2e069b['value'])[_0xd688('0x4f')];logger[_0xd688('0x35')](_0xd688('0x78'),_0x5d5d63,_0x2e069b[_0xd688('0x79')]);this['syncMixMonitorFilename'](_0x5d5d63,_0x2e069b['value']);}}else if(this['channels'][_0x2e069b['linkedid']]){if(this[_0xd688('0x32')](_0x2e069b[_0xd688('0x76')])){if(this[_0xd688('0x32')](_0x2e069b[_0xd688('0x76')]['sipcallid'])){logger[_0xd688('0x35')](_0xd688('0x89'),_0x2e069b[_0xd688('0x3b')],_0x2e069b['value']);this[_0xd688('0x18')][_0x2e069b['linkedid']][_0xd688('0x8a')]=_0x2e069b[_0xd688('0x79')];}}}}}catch(_0x407029){logger[_0xd688('0x2f')](_0xd688('0x8b'),_0x2e069b[_0xd688('0x37')],util[_0xd688('0x30')](_0x407029,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd688('0x31')][_0xd688('0x24')]=function(_0x424d1e){try{if(this['isNotNull'](_0x424d1e)){logger[_0xd688('0x39')]('[%s][voiceCallReport][hangup]\x20event:',_0x424d1e[_0xd688('0x37')],util[_0xd688('0x30')](_0x424d1e,{'showHidden':![],'depth':null}));if(this['channels'][_0x424d1e[_0xd688('0x37')]]){logger[_0xd688('0x35')](_0xd688('0x8c'),_0x424d1e['uniqueid'],_0x424d1e[_0xd688('0x8d')]);var _0x10c093=moment();this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]]['endtime']=_0x10c093[_0xd688('0x4d')](_0xd688('0x46'));this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x56')]=_0x10c093['diff'](this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x45')],_0xd688('0x57'));if(this['channels'][_0x424d1e['uniqueid']]['answered']){this['channels'][_0x424d1e['uniqueid']][_0xd688('0x8e')]=_0x10c093[_0xd688('0x8f')](this[_0xd688('0x18')][_0x424d1e['uniqueid']][_0xd688('0x64')],_0xd688('0x57'));this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]]['holdtime']=this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x56')]-this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x8e')];}if(_0x424d1e['context']===_0xd688('0x90')){if(this['agents'][_0x424d1e['channel'][_0xd688('0x4a')]('-')[0x0]]){this[_0xd688('0x19')][_0x424d1e[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]]=_['omit'](this[_0xd688('0x19')][_0x424d1e[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]],['destconnectedlinenum']);logger[_0xd688('0x39')](_0xd688('0x91'),_0x424d1e[_0xd688('0x37')],util[_0xd688('0x30')]({'destaccountcode':this['agents'][_0x424d1e['channel'][_0xd688('0x4a')]('-')[0x0]][_0xd688('0x4c')]},{'showHidden':![],'depth':null}));this[_0xd688('0x34')](util[_0xd688('0x4d')]('user:%s',this[_0xd688('0x19')][_0x424d1e[_0xd688('0x49')][_0xd688('0x4a')]('-')[0x0]][_0xd688('0x4f')]),'user:agentcomplete',{'destaccountcode':this[_0xd688('0x19')][_0x424d1e[_0xd688('0x49')]['split']('-')[0x0]][_0xd688('0x4c')]});}}if(_0x424d1e[_0xd688('0x92')]===_0xd688('0x93')){this[_0xd688('0x94')][_0x424d1e['uniqueid']]=this[_0xd688('0x18')][_0x424d1e['uniqueid']];}else{if(this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x7e')]===_0xd688('0x95')&&this[_0xd688('0x94')][_0x424d1e[_0xd688('0x37')]]){this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x37')]=[this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]][_0xd688('0x3b')],this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]]['linkedid']=this['channels'][_0x424d1e[_0xd688('0x37')]]['uniqueid']][0x0];delete this[_0xd688('0x94')][_0x424d1e[_0xd688('0x37')]];}}logger[_0xd688('0x39')](_0xd688('0x96'),_0x424d1e[_0xd688('0x37')],util[_0xd688('0x30')](this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]],{'showHidden':![],'depth':null}));ami[_0xd688('0x34')]('custom:voiceCallReport',this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]]);delete this[_0xd688('0x18')][_0x424d1e[_0xd688('0x37')]];}}}catch(_0x117a06){logger[_0xd688('0x2f')](_0xd688('0x97'),_0x424d1e[_0xd688('0x37')],util['inspect'](_0x117a06,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd688('0x98')]=function(_0xe0b456){try{if(this[_0xd688('0x32')](_0xe0b456)){logger['info'](_0xd688('0x99'),_0xe0b456[_0xd688('0x37')],_0xe0b456[_0xd688('0x9a')],_0xe0b456[_0xd688('0x9b')]);logger[_0xd688('0x39')](_0xd688('0x9c'),_0xe0b456[_0xd688('0x37')],util[_0xd688('0x30')](_0xe0b456,{'showHidden':![],'depth':null}));if(this[_0xd688('0x18')][_0xe0b456['transfereeuniqueid']]){this[_0xd688('0x18')][_0xe0b456['transfereeuniqueid']][_0xd688('0x9d')]=_0xe0b456[_0xd688('0x9a')];this[_0xd688('0x18')][_0xe0b456[_0xd688('0x9e')]][_0xd688('0x9f')]=_0xe0b456[_0xd688('0x9b')];if(this['channels'][_0xe0b456['secondtransfereruniqueid']]){var _0x1ed753=this[_0xd688('0x18')][_0xe0b456[_0xd688('0xa0')]];this[_0xd688('0x18')][_0xe0b456[_0xd688('0xa0')]]=this[_0xd688('0x18')][_0xe0b456[_0xd688('0x9e')]];this[_0xd688('0x18')][_0xe0b456[_0xd688('0x9e')]]=_0x1ed753;}}else if(this[_0xd688('0x18')][_0xe0b456['transfertargetuniqueid']]){this[_0xd688('0x18')][_0xe0b456[_0xd688('0xa1')]]['transfercalleridnum']=_0xe0b456['origtransferercalleridnum'];this[_0xd688('0x18')][_0xe0b456[_0xd688('0xa1')]][_0xd688('0x9f')]=_0xe0b456[_0xd688('0x9b')];if(this['channels'][_0xe0b456[_0xd688('0xa2')]]){var _0x1ed753=this[_0xd688('0x18')][_0xe0b456[_0xd688('0xa2')]];this[_0xd688('0x18')][_0xe0b456['origtransfereruniqueid']]=this[_0xd688('0x18')][_0xe0b456[_0xd688('0xa1')]];this[_0xd688('0x18')][_0xe0b456['transfertargetuniqueid']]=_0x1ed753;}}}}catch(_0x89ccd1){logger[_0xd688('0x2f')](_0xd688('0xa3'),_0xe0b456[_0xd688('0x37')],util[_0xd688('0x30')](_0x89ccd1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xd688('0x28')]=function(_0x5db5fa){try{if(this['isNotNull'](_0x5db5fa)){logger[_0xd688('0x35')](_0xd688('0xa4'),_0x5db5fa[_0xd688('0x37')],_0x5db5fa[_0xd688('0xa5')],_0x5db5fa[_0xd688('0xa6')]);logger[_0xd688('0x39')](_0xd688('0xa7'),_0x5db5fa[_0xd688('0x37')],util[_0xd688('0x30')](_0x5db5fa,{'showHidden':![],'depth':null}));if(this[_0xd688('0x18')][_0x5db5fa['transfereeuniqueid']]){this[_0xd688('0x18')][_0x5db5fa[_0xd688('0x9e')]]['transfercalleridnum']=_0x5db5fa[_0xd688('0xa5')];this['channels'][_0x5db5fa[_0xd688('0x9e')]][_0xd688('0x9f')]=_0x5db5fa[_0xd688('0xa6')];this[_0xd688('0x24')]({'event':_0xd688('0x93'),'uniqueid':_0x5db5fa[_0xd688('0x9e')],'context':_0x5db5fa[_0xd688('0x43')],'channel':_0x5db5fa[_0xd688('0xa8')]});}}}catch(_0xfc168f){logger['error'](_0xd688('0xa9'),_0x5db5fa[_0xd688('0x37')],util['inspect'](_0xfc168f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x1c7e29){try{if(this[_0xd688('0x32')](_0x1c7e29)){logger['debug'](_0xd688('0xaa'),_0x1c7e29[_0xd688('0x37')],util[_0xd688('0x30')](_0x1c7e29,{'showHidden':![],'depth':null}));if(this[_0xd688('0x18')][_0x1c7e29['uniqueid']]){if(!_[_0xd688('0x73')](this[_0xd688('0x18')][_0x1c7e29[_0xd688('0x37')]][_0xd688('0x64')])){this['channels'][_0x1c7e29['uniqueid']][_0xd688('0xab')]=moment()[_0xd688('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd688('0x35')](_0xd688('0xac'),_0x1c7e29[_0xd688('0x37')],this[_0xd688('0x18')][_0x1c7e29[_0xd688('0x37')]][_0xd688('0xab')]);}}}}catch(_0x33bb25){logger['error']('[%s][voiceCallReport][musiconholdstart]',_0x1c7e29[_0xd688('0x37')],util[_0xd688('0x30')](_0x33bb25,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xd688('0x31')][_0xd688('0x2c')]=function(_0x4c059a){try{if(this[_0xd688('0x32')](_0x4c059a)){logger[_0xd688('0x39')](_0xd688('0xad'),_0x4c059a[_0xd688('0x37')],util[_0xd688('0x30')](_0x4c059a,{'showHidden':![],'depth':null}));if(this[_0xd688('0x18')][_0x4c059a[_0xd688('0x37')]]){if(!_[_0xd688('0x73')](this['channels'][_0x4c059a[_0xd688('0x37')]][_0xd688('0xab')])){this['channels'][_0x4c059a[_0xd688('0x37')]]['mohtime']+=moment()['milliseconds'](0x0)[_0xd688('0x8f')](this[_0xd688('0x18')][_0x4c059a[_0xd688('0x37')]]['mohstarttime'],_0xd688('0x57'));logger['info']('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x4c059a['uniqueid'],this['channels'][_0x4c059a[_0xd688('0x37')]]['mohtime']);delete this[_0xd688('0x18')][_0x4c059a[_0xd688('0x37')]][_0xd688('0xab')];}}}}catch(_0x44e4b2){logger[_0xd688('0x2f')](_0xd688('0xae'),_0x4c059a[_0xd688('0x37')],util[_0xd688('0x30')](_0x44e4b2,{'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 64214c8..6b9a841 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 _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 +var _0xc61e=['seconds','complete','total','answertime','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','duration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','../../../config/logger','../ami','redis','defaults','socket.io-emitter','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','channels','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','variable','value','isUndefined','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','diff','starttime'];(function(_0x17b2b7,_0x3c58ab){var _0x45ed4f=function(_0x564b46){while(--_0x564b46){_0x17b2b7['push'](_0x17b2b7['shift']());}};_0x45ed4f(++_0x3c58ab);}(_0xc61e,0xe7));var _0xec61=function(_0x38389d,_0x352691){_0x38389d=_0x38389d-0x0;var _0x34f74e=_0xc61e[_0x38389d];return _0x34f74e;};'use strict';var _=require(_0xec61('0x0'));var moment=require(_0xec61('0x1'));var util=require(_0xec61('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xec61('0x3'))('ami');var ami=require(_0xec61('0x4'));config[_0xec61('0x5')]=_[_0xec61('0x6')](config[_0xec61('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xec61('0x7'))(new Redis(config[_0xec61('0x5')]));function VoiceDialReport(_0x3e5583){this['channels']=_0x3e5583[_0xec61('0x8')];this['outbound']=_0x3e5583[_0xec61('0x9')];this[_0xec61('0xa')]={};ami['on'](_0xec61('0xb'),this[_0xec61('0xc')][_0xec61('0xd')](this));ami['on'](_0xec61('0xe'),this[_0xec61('0xf')][_0xec61('0xd')](this));ami['on'](_0xec61('0x10'),this['syncVarSet']['bind'](this));ami['on'](_0xec61('0x11'),this[_0xec61('0x12')][_0xec61('0xd')](this));}VoiceDialReport[_0xec61('0x13')][_0xec61('0x14')]=function(_0x31837c){return _0x31837c!==null&&!_['isUndefined'](_0x31837c);};VoiceDialReport[_0xec61('0x13')][_0xec61('0x15')]=function(_0xb4f172,_0xee178e,_0x1fc407){io['to'](_0xb4f172)[_0xec61('0x15')](_0xee178e,_0x1fc407);};VoiceDialReport[_0xec61('0x13')][_0xec61('0xc')]=function(_0xa1dcfa){try{if(this[_0xec61('0x14')](_0xa1dcfa)){logger['debug'](_0xec61('0x16'),_0xa1dcfa[_0xec61('0x17')],util[_0xec61('0x18')](_0xa1dcfa,{'showHidden':![],'depth':null}));if(this['channels'][_0xa1dcfa[_0xec61('0x17')]]){_[_0xec61('0x19')](this[_0xec61('0x1a')][_0xa1dcfa[_0xec61('0x17')]],{'starttime':moment()[_0xec61('0x1b')](_0xec61('0x1c')),'lastevent':'called','interface':_0xa1dcfa['channel']['substring'](0x0,_0xa1dcfa[_0xec61('0x1d')]['lastIndexOf']('-')),'membername':_0xa1dcfa[_0xec61('0x1d')]['substring'](_0xa1dcfa[_0xec61('0x1d')][_0xec61('0x1e')]('/')+0x1,_0xa1dcfa['channel'][_0xec61('0x1e')]('-'))},_['omit'](_0xa1dcfa,['event',_0xec61('0x1f')]));logger['info'](_0xec61('0x20'),_0xa1dcfa['uniqueid'],this[_0xec61('0x1a')][_0xa1dcfa[_0xec61('0x17')]]['membername'],this['channels'][_0xa1dcfa[_0xec61('0x17')]][_0xec61('0x21')]);logger[_0xec61('0x22')](_0xec61('0x23'),_0xa1dcfa[_0xec61('0x17')],util[_0xec61('0x18')](this[_0xec61('0x1a')][_0xa1dcfa[_0xec61('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0xec61('0x24'),_0xec61('0x25'),this[_0xec61('0x1a')][_0xa1dcfa[_0xec61('0x17')]]);logger[_0xec61('0x22')](_0xec61('0x26'),_0xa1dcfa[_0xec61('0x17')],util[_0xec61('0x18')](this[_0xec61('0x1a')][_0xa1dcfa[_0xec61('0x17')]],{'showHidden':![],'depth':null}));ami['emit'](_0xec61('0x27'),this[_0xec61('0x1a')][_0xa1dcfa[_0xec61('0x17')]]);}}}catch(_0x2ec23f){logger[_0xec61('0x28')](_0xec61('0x29'),_0xa1dcfa[_0xec61('0x17')],util['inspect'](_0x2ec23f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec61('0x13')]['syncDialEnd']=function(_0x369678){try{if(this[_0xec61('0x14')](_0x369678)){logger[_0xec61('0x22')]('[%s][voiceDialReport][dialend]\x20event:',_0x369678['uniqueid'],util[_0xec61('0x18')](_0x369678,{'showHidden':![],'depth':null}));if(this[_0xec61('0x1a')][_0x369678[_0xec61('0x17')]]){this[_0xec61('0x1a')][_0x369678[_0xec61('0x17')]][_0xec61('0x2a')]=_0x369678[_0xec61('0x2a')];if(_0x369678['dialstatus']===_0xec61('0x2b')){this['channels'][_0x369678[_0xec61('0x17')]][_0xec61('0x2c')]=_0x369678['connectedlinenum'];this[_0xec61('0x1a')][_0x369678[_0xec61('0x17')]]['connectedlinename']=_0x369678[_0xec61('0x2d')];this['channels'][_0x369678[_0xec61('0x17')]]['answertime']=moment()['format'](_0xec61('0x1c'));this[_0xec61('0x1a')][_0x369678['uniqueid']][_0xec61('0x2e')]=_0xec61('0x2f');logger[_0xec61('0x30')](_0xec61('0x31'),_0x369678[_0xec61('0x17')],_0x369678[_0xec61('0x1d')][_0xec61('0x32')](_0x369678[_0xec61('0x1d')][_0xec61('0x1e')]('/')+0x1,_0x369678['channel'][_0xec61('0x1e')]('-')));logger['debug'](_0xec61('0x33'),_0x369678[_0xec61('0x17')],util[_0xec61('0x18')](this['channels'][_0x369678[_0xec61('0x17')]],{'showHidden':![],'depth':null}));ami[_0xec61('0x15')](_0xec61('0x34'),this[_0xec61('0x1a')][_0x369678[_0xec61('0x17')]]);}logger[_0xec61('0x22')](_0xec61('0x35'),_0x369678[_0xec61('0x17')],util['inspect'](this[_0xec61('0x1a')][_0x369678[_0xec61('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0xec61('0x24'),_0xec61('0x25'),this['channels'][_0x369678[_0xec61('0x17')]]);}}}catch(_0x786643){logger['error'](_0xec61('0x36'),_0x369678[_0xec61('0x17')],util['inspect'](_0x786643,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec61('0x13')][_0xec61('0x37')]=function(_0x4b8e4e){try{if(this[_0xec61('0x14')](_0x4b8e4e)){logger[_0xec61('0x22')](_0xec61('0x38'),_0x4b8e4e['uniqueid'],util[_0xec61('0x18')](_0x4b8e4e,{'showHidden':![],'depth':null}));this['addVariable'](_0x4b8e4e['uniqueid'],_['keys'](_0x4b8e4e[_0xec61('0x39')])[0x0],_0x4b8e4e[_0xec61('0x3a')]);if(this[_0xec61('0x14')](_0x4b8e4e[_0xec61('0x39')])&&this[_0xec61('0x14')](_0x4b8e4e[_0xec61('0x39')]['outboundrouteid'])){if(_[_0xec61('0x3b')](this[_0xec61('0x1a')][_0x4b8e4e[_0xec61('0x17')]])){this[_0xec61('0x1a')][_0x4b8e4e['uniqueid']]={'routeId':_0x4b8e4e['value'],'variables':this[_0xec61('0xa')][_0x4b8e4e['uniqueid']]};logger[_0xec61('0x30')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x4b8e4e[_0xec61('0x17')],_0x4b8e4e['variable'][_0xec61('0x3c')],_['keys'](_0x4b8e4e[_0xec61('0x39')])[0x0],_0x4b8e4e[_0xec61('0x3a')]);logger['debug'](_0xec61('0x3d'),_0x4b8e4e['uniqueid'],util[_0xec61('0x18')](this[_0xec61('0x1a')][_0x4b8e4e[_0xec61('0x17')]],{'showHidden':![],'depth':null}));this[_0xec61('0x15')](_0xec61('0x24'),_0xec61('0x25'),this[_0xec61('0x1a')][_0x4b8e4e[_0xec61('0x17')]]);}}}}catch(_0x28ff94){logger[_0xec61('0x28')](_0xec61('0x3e'),_0x4b8e4e[_0xec61('0x17')],util[_0xec61('0x18')](_0x28ff94,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xec61('0x13')]['addVariable']=function(_0x1a2430,_0x334f03,_0x16da1f){var _0x296d89=['rtpaudioqos','rtpaudioqosbridged',_0xec61('0x3f'),'rtpaudioqosjitterbridged',_0xec61('0x40'),_0xec61('0x41'),_0xec61('0x42'),_0xec61('0x43'),_0xec61('0x44'),_0xec61('0x45'),_0xec61('0x46'),_0xec61('0x47'),_0xec61('0x48'),_0xec61('0x49'),_0xec61('0x4a'),_0xec61('0x4b'),_0xec61('0x4c'),_0xec61('0x4d'),'memberrealtime'];if(!_['isNil'](_0x334f03)&&!_[_0xec61('0x4e')](_0x296d89,_0x334f03)){if(_[_0xec61('0x3b')](this[_0xec61('0xa')][_0x1a2430])){this[_0xec61('0xa')][_0x1a2430]={};}this[_0xec61('0xa')][_0x1a2430][_0x334f03]=_0x16da1f;}};VoiceDialReport[_0xec61('0x13')]['syncHangup']=function(_0x334965){try{if(this[_0xec61('0x14')](_0x334965)){logger[_0xec61('0x22')](_0xec61('0x4f'),_0x334965['uniqueid'],util[_0xec61('0x18')](_0x334965,{'showHidden':![],'depth':null}));if(this['channels'][_0x334965[_0xec61('0x17')]]){logger[_0xec61('0x30')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x334965['uniqueid'],_0x334965[_0xec61('0x50')]);this[_0xec61('0x1a')][_0x334965['uniqueid']][_0xec61('0x51')]=moment()[_0xec61('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x334965['uniqueid']]['duration']=moment(this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]][_0xec61('0x51')])[_0xec61('0x52')](this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]][_0xec61('0x53')],_0xec61('0x54'));this[_0xec61('0x1a')][_0x334965['uniqueid']][_0xec61('0x2e')]=_0xec61('0x55');this[_0xec61('0x9')][_0xec61('0x56')]+=0x1;if(this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]][_0xec61('0x57')]){this[_0xec61('0x9')][_0xec61('0x58')]+=0x1;this['channels'][_0x334965[_0xec61('0x17')]][_0xec61('0x59')]=moment(this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]]['answertime'])[_0xec61('0x52')](this[_0xec61('0x1a')][_0x334965['uniqueid']][_0xec61('0x53')],_0xec61('0x54'));this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]]['billableseconds']=moment(this['channels'][_0x334965[_0xec61('0x17')]][_0xec61('0x51')])[_0xec61('0x52')](this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]][_0xec61('0x57')],_0xec61('0x54'));this['outbound'][_0xec61('0x5a')]+=this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]][_0xec61('0x59')]||0x0;this[_0xec61('0x9')][_0xec61('0x5b')]+=this[_0xec61('0x1a')][_0x334965['uniqueid']][_0xec61('0x5c')];}this[_0xec61('0x9')][_0xec61('0x5d')]+=this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]][_0xec61('0x5e')];logger[_0xec61('0x22')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x334965['uniqueid'],util[_0xec61('0x18')](this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]],{'showHidden':![],'depth':null}));ami['emit'](_0xec61('0x5f'),this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]]);logger[_0xec61('0x22')](_0xec61('0x60'),_0x334965[_0xec61('0x17')],util['inspect'](this['channels'][_0x334965[_0xec61('0x17')]],{'showHidden':![],'depth':null}));ami[_0xec61('0x15')]('custom:dialend',this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]]);logger[_0xec61('0x22')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x334965[_0xec61('0x17')],util[_0xec61('0x18')](this['channels'][_0x334965[_0xec61('0x17')]],{'showHidden':![],'depth':null}));this[_0xec61('0x15')](_0xec61('0x24'),'voice_outbound:save',this[_0xec61('0x9')]);logger[_0xec61('0x30')](_0xec61('0x61'),JSON[_0xec61('0x62')](this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]]));logger['debug'](_0xec61('0x63'),_0x334965[_0xec61('0x17')],util[_0xec61('0x18')](this[_0xec61('0x1a')][_0x334965[_0xec61('0x17')]],{'showHidden':![],'depth':null}));this[_0xec61('0x15')](_0xec61('0x24'),_0xec61('0x64'),this['channels'][_0x334965['uniqueid']]);delete this[_0xec61('0x1a')][_0x334965['uniqueid']];}else if(this[_0xec61('0x1a')][_0x334965[_0xec61('0x65')]]){this[_0xec61('0x1a')][_0x334965[_0xec61('0x65')]][_0xec61('0x17')]=this['channels'][_0x334965['linkedid']][_0xec61('0x66')];}if(this[_0xec61('0xa')][_0x334965[_0xec61('0x17')]]){delete this[_0xec61('0xa')][_0x334965['uniqueid']];}}}catch(_0xa54fa3){logger[_0xec61('0x28')](_0xec61('0x67'),_0x334965[_0xec61('0x17')],util['inspect'](_0xa54fa3,{'showHidden':![],'depth':null}));}};module[_0xec61('0x68')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index a648f1c..febec1d 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 _0x6a25=['queue','info','[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','available','loggedIn','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','pick','keys','push','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','ABANDONED','lastAssignedTo','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','queuecallerexitreason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','local/','linkedid','queuecallerexit','seconds','transfertype','FORWARD','transferexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','agentcomplete','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','[%s][voiceQueueReport][hangup]','length','unmanaged','sumHoldTime','milliseconds','diff','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','transfereeuniqueid','ATTENDEDTRANSFER','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]','exports','moment','ioredis','../../../config/logger','../ami','redis','defaults','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','syncHangup','fullybooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','prototype','clearZombieChannels','switch','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','syncFullyBooted','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','name','voice_queue_channel:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','sumDuration','abandoned','Trunk','active','callerid','Interval','stringify','md5',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','[voiceQueueReport][queuesummary]'];(function(_0x1d211b,_0x475f3b){var _0x47c88b=function(_0x3126f5){while(--_0x3126f5){_0x1d211b['push'](_0x1d211b['shift']());}};_0x47c88b(++_0x475f3b);}(_0x6a25,0x156));var _0x56a2=function(_0x47d378,_0x13fab1){_0x47d378=_0x47d378-0x0;var _0x4b82d4=_0x6a25[_0x47d378];return _0x4b82d4;};'use strict';var _=require('lodash');var moment=require(_0x56a2('0x0'));var util=require('util');var md5=require('md5');var Redis=require(_0x56a2('0x1'));var config=require('../../../config/environment');var logger=require(_0x56a2('0x2'))('ami');var ami=require(_0x56a2('0x3'));var QueueReport=require('../model/queueReport');config[_0x56a2('0x4')]=_[_0x56a2('0x5')](config[_0x56a2('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x56a2('0x4')]));var Sequence=function(){};Sequence['prototype'][_0x56a2('0x6')]=function(_0x5afc13){this[_0x56a2('0x7')]=this['tail']?this['tail'][_0x56a2('0x8')](_0x5afc13):_0x5afc13();};function VoiceQueueReport(_0x4fd9ea){this['sequence']=new Sequence();this[_0x56a2('0x9')]={};this[_0x56a2('0xa')]=_0x4fd9ea[_0x56a2('0xa')];this[_0x56a2('0xb')]=_0x4fd9ea[_0x56a2('0xc')];this[_0x56a2('0xd')]=_0x4fd9ea[_0x56a2('0xd')];this[_0x56a2('0xe')]=!![];this['campaigns']=_0x4fd9ea[_0x56a2('0xf')];this[_0x56a2('0x10')]={};ami['on'](_0x56a2('0x11'),this[_0x56a2('0x12')][_0x56a2('0x13')](this));ami['on']('queuesummarycomplete',this[_0x56a2('0x14')][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x15'),this[_0x56a2('0x16')][_0x56a2('0x13')](this));ami['on']('queuecallerabandon',this[_0x56a2('0x17')][_0x56a2('0x13')](this));ami['on']('queuecallerleave',this[_0x56a2('0x18')][_0x56a2('0x13')](this));ami['on']('agentcomplete',this[_0x56a2('0x19')][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x1a'),this[_0x56a2('0x1b')][_0x56a2('0x13')](this));ami['on']('varset',this[_0x56a2('0x1c')][_0x56a2('0x13')](this));ami['on']('hangup',this[_0x56a2('0x1d')][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x1e'),this['syncFullyBooted'][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x1f'),this[_0x56a2('0x20')][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x21'),this[_0x56a2('0x22')][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x23'),this[_0x56a2('0x24')][_0x56a2('0x13')](this));ami['on'](_0x56a2('0x25'),this[_0x56a2('0x26')][_0x56a2('0x13')](this));this[_0x56a2('0x27')]();this['loopQueueShow']();}function clearChannels(_0x2d2789){if(!_[_0x56a2('0x28')](_0x2d2789)){for(var _0x3d4ab8 in _0x2d2789){if(_0x2d2789[_0x56a2('0x29')](_0x3d4ab8)){delete _0x2d2789[_0x3d4ab8];}}}}function clearCampaigns(_0x173286){if(!_['isEmpty'](_0x173286)){for(var _0x3fa0c8 in _0x173286){if(_0x173286[_0x56a2('0x29')](_0x3fa0c8)){_0x173286[_0x3fa0c8][_0x56a2('0x2a')]=0x0;}}}}function clearVoiceQueues(_0x47980c){if(!_['isEmpty'](_0x47980c)){for(var _0x501d95 in _0x47980c){if(_0x47980c['hasOwnProperty'](_0x501d95)){_0x47980c[_0x501d95][_0x56a2('0x2a')]=0x0;_0x47980c[_0x501d95][_0x56a2('0x2b')]=0x0;_0x47980c[_0x501d95][_0x56a2('0x2c')]=0x0;_0x47980c[_0x501d95][_0x56a2('0x2d')]=0x0;_0x47980c[_0x501d95][_0x56a2('0x2e')]=!![];}}}}function clearAgentBooked(_0x183bc4){if(!_[_0x56a2('0x28')](_0x183bc4)){for(var _0x2c7e5f in _0x183bc4){if(_0x183bc4[_0x56a2('0x29')](_0x2c7e5f)){_0x183bc4[_0x2c7e5f]['unlockRR']=!![];}}}}VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x30')]=function(){var _0x3d0bed=this;for(var _0x23a330 in this[_0x56a2('0xb')]){if(this[_0x56a2('0xb')][_0x56a2('0x29')](_0x23a330)&&!this[_0x56a2('0xb')][_0x23a330][_0x56a2('0x31')]){this['sequence'][_0x56a2('0x6')](function(){if(!_[_0x56a2('0x32')](_0x3d0bed[_0x56a2('0xb')][_0x23a330])){return ami[_0x56a2('0x33')]({'action':_0x56a2('0x34'),'channel':_0x3d0bed[_0x56a2('0xb')][_0x23a330][_0x56a2('0x35')]})[_0x56a2('0x36')](function(_0x5a36e1){if(_0x5a36e1[_0x56a2('0x37')]===_0x56a2('0x38')){setTimeout(function(){if(_0x3d0bed[_0x56a2('0xb')][_0x23a330]){delete _0x3d0bed[_0x56a2('0xb')][_0x23a330];logger[_0x56a2('0x39')]('[%s][voiceQueueReport][checkChannel]',_0x23a330,util[_0x56a2('0x3a')](_0x5a36e1,{'showHidden':![],'depth':null}));}if(_0x3d0bed[_0x56a2('0x9')][_0x23a330]){delete _0x3d0bed[_0x56a2('0x9')][_0x23a330];logger[_0x56a2('0x39')](_0x56a2('0x3b'),_0x23a330,util[_0x56a2('0x3a')](_0x5a36e1,{'showHidden':![],'depth':null}));}if(_0x3d0bed['variables'][_0x23a330]){delete _0x3d0bed['variables'][_0x23a330];logger[_0x56a2('0x39')]('[%s][voiceQueueReport][checkVariables]',_0x23a330,util[_0x56a2('0x3a')](_0x5a36e1,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x3c')]=function(){logger[_0x56a2('0x39')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x56a2('0xb')]);this[_0x56a2('0x3d')](this['queueReports']);clearAgentBooked(this[_0x56a2('0xa')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0x56a2('0x3d')]=function(_0x344c8a){var _0x346468=this;if(!_[_0x56a2('0x28')](_0x344c8a)){for(var _0x587b05 in _0x344c8a){if(_0x344c8a[_0x56a2('0x29')](_0x587b05)){_0x346468[_0x56a2('0x3e')](_0x344c8a[_0x587b05],_0x56a2('0x3f'));delete _0x344c8a[_0x587b05];}}}};VoiceQueueReport[_0x56a2('0x2f')]['emit']=function(_0x8e62,_0x323f15,_0x5078c8){io['to'](_0x8e62)[_0x56a2('0x40')](_0x323f15,_0x5078c8);};VoiceQueueReport['prototype'][_0x56a2('0x41')]=function(_0x1e8f63,_0x28d85d){logger[_0x56a2('0x42')](_0x56a2('0x43')+_0x28d85d+_0x56a2('0x44'),_0x1e8f63[_0x56a2('0x45')],util[_0x56a2('0x3a')](_0x1e8f63,{'showHidden':![],'depth':null}));this[_0x56a2('0x40')](util[_0x56a2('0x46')](_0x56a2('0x47'),_0x1e8f63['name']),_0x56a2('0x48'),_0x1e8f63);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x171660,_0x103afb){logger[_0x56a2('0x42')](_0x56a2('0x43')+_0x103afb+_0x56a2('0x49'),_0x171660['uniqueid'],util[_0x56a2('0x3a')](_0x171660,{'showHidden':![],'depth':null}));this['emit'](util[_0x56a2('0x46')](_0x56a2('0x47'),_0x171660[_0x56a2('0x4a')]),_0x56a2('0x4b'),_0x171660);};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x4c')]=function(_0x10d459,_0x32a2d3){if(_0x10d459[_0x56a2('0x4d')]===_0x56a2('0x4e')){var _0x5e82c7={'id':_0x10d459['id'],'name':_0x10d459[_0x56a2('0x4a')],'strategy':_0x10d459[_0x56a2('0x4f')],'answered':_0x10d459[_0x56a2('0x50')],'available':_0x10d459['available'],'loggedIn':_0x10d459['loggedIn'],'pTalking':_0x10d459['pTalking'],'sumBillable':_0x10d459['sumBillable'],'sumDuration':_0x10d459[_0x56a2('0x51')],'sumHoldTime':_0x10d459['sumHoldTime']||0x0,'talking':_0x10d459[_0x56a2('0x2b')],'total':_0x10d459['total'],'type':_0x10d459[_0x56a2('0x4d')],'unmanaged':_0x10d459['unmanaged'],'abandoned':_0x10d459[_0x56a2('0x52')],'waiting':_0x10d459['waiting']};if(_0x10d459[_0x56a2('0x53')]){_0x5e82c7[_0x56a2('0x53')]={'id':_0x10d459[_0x56a2('0x53')]['id'],'name':_0x10d459[_0x56a2('0x53')][_0x56a2('0x4a')],'active':_0x10d459['Trunk'][_0x56a2('0x54')],'callerid':_0x10d459[_0x56a2('0x53')][_0x56a2('0x55')]};}if(_0x10d459[_0x56a2('0x56')]){_0x5e82c7[_0x56a2('0x56')]={'id':_0x10d459[_0x56a2('0x56')]['id'],'name':_0x10d459[_0x56a2('0x56')]['name']};}var _0x4bc8cc=md5(JSON[_0x56a2('0x57')](_0x5e82c7));if(_0x10d459[_0x56a2('0x58')]!==_0x4bc8cc){_0x10d459[_0x56a2('0x58')]=_0x4bc8cc;logger[_0x56a2('0x42')]('[voiceQueueReport]['+_0x32a2d3+_0x56a2('0x59'),util[_0x56a2('0x3a')](_0x5e82c7,{'showHidden':![],'depth':null}));this['emit'](util[_0x56a2('0x46')](_0x56a2('0x47'),_0x5e82c7[_0x56a2('0x4a')]),_0x56a2('0x5a'),_0x5e82c7);}}};VoiceQueueReport['prototype'][_0x56a2('0x5b')]=function(_0x2b2710){return _0x2b2710!==null&&!_[_0x56a2('0x5c')](_0x2b2710);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x35cdc5=this;setInterval(function(){_0x35cdc5['clearZombieChannels']();ami[_0x56a2('0x33')]({'action':_0x56a2('0x5d')})[_0x56a2('0x36')](function(_0x546760){logger[_0x56a2('0x39')](_0x56a2('0x5e'),util[_0x56a2('0x3a')](_0x546760,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x27')]=function(){var _0x5b7821=this;setInterval(function(){if(_0x5b7821[_0x56a2('0xe')]){return ami[_0x56a2('0x33')]({'action':_0x56a2('0x11')})['then'](function(_0x299498){_0x5b7821['flagQueueSummary']=![];})[_0x56a2('0x36')](function(_0x4385b6){logger['error'](_0x56a2('0x5f'),util['inspect'](_0x4385b6,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x56a2('0x2f')][_0x56a2('0x12')]=function(_0x18a810){try{if(this[_0x56a2('0x5b')](_0x18a810)&&this[_0x56a2('0x5b')](_0x18a810[_0x56a2('0x60')])){logger[_0x56a2('0x42')]('[voiceQueueReport][queuesummary]\x20event:',util[_0x56a2('0x3a')](_0x18a810,{'showHidden':![],'depth':null}));if(this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]]){logger[_0x56a2('0x61')](_0x56a2('0x62'),_0x18a810[_0x56a2('0x60')]);var _0x3c83ed=_[_0x56a2('0x63')](this[_0x56a2('0xb')],'queue')[_0x18a810['queue']]||0x0;var _0x2b15a1=_0x3c83ed-_0x18a810[_0x56a2('0x64')];if(this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x2d')]!==_[_0x56a2('0x65')](_0x18a810['callers'])||this[_0x56a2('0xd')][_0x18a810['queue']]['loggedIn']!==_[_0x56a2('0x65')](_0x18a810['loggedin'])||this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x66')]!==_[_0x56a2('0x65')](_0x18a810['available'])||this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x2b')]!==_0x2b15a1){this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x2d')]=_['toNumber'](_0x18a810['callers']);this[_0x56a2('0xd')][_0x18a810['queue']][_0x56a2('0x67')]=_[_0x56a2('0x65')](_0x18a810[_0x56a2('0x68')]);this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]][_0x56a2('0x66')]=_[_0x56a2('0x65')](_0x18a810[_0x56a2('0x66')]);this[_0x56a2('0xd')][_0x18a810[_0x56a2('0x60')]]['talking']=_0x2b15a1>0x0?_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={};_0x22f90f0x0?_0x4ff982:0x0;this[_0x8e06('0x11')][_0x2c9ad4[_0x8e06('0x64')]][_0x8e06('0x2e')]=this['voiceQueues'][_0x2c9ad4[_0x8e06('0x64')]]['talking']>_[_0x8e06('0x6a')](_0x2c9ad4[_0x8e06('0x6b')])?_['toNumber'](_0x2c9ad4[_0x8e06('0x6b')]):this[_0x8e06('0x11')][_0x2c9ad4['queue']][_0x8e06('0x2e')];this[_0x8e06('0x4e')](this[_0x8e06('0x11')][_0x2c9ad4[_0x8e06('0x64')]],'queuesummary');}logger[_0x8e06('0x44')](_0x8e06('0x6d'),util[_0x8e06('0x47')](this[_0x8e06('0x11')][_0x2c9ad4[_0x8e06('0x64')]],{'showHidden':![],'depth':null}));ami[_0x8e06('0x42')](_0x8e06('0x6e'),this[_0x8e06('0x11')][_0x2c9ad4[_0x8e06('0x64')]]);}}}catch(_0x4578d1){logger[_0x8e06('0x3a')](_0x8e06('0x63'),util[_0x8e06('0x47')](_0x4578d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e06('0x9')]['syncQueueSummaryComplete']=function(_0x426983){logger[_0x8e06('0x44')](_0x8e06('0x6f'),util[_0x8e06('0x47')](_0x426983,{'showHidden':![],'depth':null}));this[_0x8e06('0x12')]=!![];};VoiceQueueReport[_0x8e06('0x9')][_0x8e06('0x70')]=function(_0x939eac){try{if(this[_0x8e06('0x60')](_0x939eac)){logger[_0x8e06('0x44')]('[%s][voiceQueueReport][queuecallerjoin]',_0x939eac['uniqueid'],util[_0x8e06('0x47')](_0x939eac,{'showHidden':![],'depth':null}));if(_[_0x8e06('0x61')](this[_0x8e06('0xd')][_0x939eac[_0x8e06('0x46')]])){this[_0x8e06('0xd')][_0x939eac['uniqueid']]=[];this[_0x8e06('0xf')][_0x939eac[_0x8e06('0x46')]]={};}var _0x1ca966=new QueueReport();_0x1ca966[_0x8e06('0x4c')]=_0x939eac[_0x8e06('0x64')];_0x1ca966[_0x8e06('0x4f')]=this[_0x8e06('0x11')][_0x1ca966[_0x8e06('0x4c')]]&&this[_0x8e06('0x11')][_0x1ca966[_0x8e06('0x4c')]][_0x8e06('0x4f')]?this[_0x8e06('0x11')][_0x1ca966[_0x8e06('0x4c')]]['type']||'inbound':'inbound';_0x1ca966[_0x8e06('0x64')]=_0x939eac['queue'];_0x1ca966[_0x8e06('0x71')]=moment()[_0x8e06('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ca966['position']=_0x939eac[_0x8e06('0x72')];_0x1ca966[_0x8e06('0x73')]=_0x939eac[_0x8e06('0x73')];_0x1ca966[_0x8e06('0x46')]=_0x939eac['uniqueid'];logger[_0x8e06('0x66')](_0x8e06('0x74'),_0x1ca966[_0x8e06('0x4c')],_0x1ca966[_0x8e06('0x4f')]);_[_0x8e06('0x75')](_0x1ca966,_[_0x8e06('0x76')](_0x939eac,_[_0x8e06('0x77')](_0x1ca966)));this[_0x8e06('0xd')][_0x939eac[_0x8e06('0x46')]]['push'](_0x1ca966);this[_0x8e06('0xf')][_0x939eac['uniqueid']]=_0x1ca966;this[_0x8e06('0x43')](_0x1ca966,_0x8e06('0x78'));}}catch(_0x5adcbc){logger[_0x8e06('0x3a')](_0x8e06('0x79'),_0x939eac[_0x8e06('0x46')],util['inspect'](_0x5adcbc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e06('0x9')][_0x8e06('0x1a')]=function(_0x2a6971){try{if(this[_0x8e06('0x60')](_0x2a6971)){logger[_0x8e06('0x44')](_0x8e06('0x7a'),_0x2a6971[_0x8e06('0x46')],util[_0x8e06('0x47')](_0x2a6971,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2a6971['uniqueid']]){var _0x362dac=_['last'](this[_0x8e06('0xd')][_0x2a6971[_0x8e06('0x46')]]);_0x362dac['queuecallercomplete']=![];_0x362dac[_0x8e06('0x7b')]=null;_0x362dac[_0x8e06('0x7c')]=_0x2a6971[_0x8e06('0x7c')];_0x362dac[_0x8e06('0x7d')]=_0x2a6971['originalposition'];_0x362dac[_0x8e06('0x19')]=!![];_0x362dac[_0x8e06('0x7e')]=moment()['format'](_0x8e06('0x7f'));_0x362dac[_0x8e06('0x80')]=_0x8e06('0x81');_0x362dac['lastAssignedTo']=null;logger['info'](_0x8e06('0x82'),_0x362dac[_0x8e06('0x4c')],_0x362dac[_0x8e06('0x4f')]);this['channels'][_0x2a6971[_0x8e06('0x46')]]=_0x362dac;this[_0x8e06('0x40')](_0x362dac,_0x8e06('0x19'));}}}catch(_0x421694){logger[_0x8e06('0x3a')](_0x8e06('0x7a'),_0x2a6971['uniqueid'],util[_0x8e06('0x47')](_0x421694,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8e06('0x1c')]=function(_0x22677a){try{if(this['isNotNull'](_0x22677a)){logger[_0x8e06('0x44')](_0x8e06('0x83'),_0x22677a[_0x8e06('0x46')],util[_0x8e06('0x47')](_0x22677a,{'showHidden':![],'depth':null}));if(this[_0x8e06('0xd')][_0x22677a[_0x8e06('0x46')]]){var _0x312018=_[_0x8e06('0x84')](this['queueReports'][_0x22677a[_0x8e06('0x46')]]);_0x312018[_0x8e06('0x85')]=moment()[_0x8e06('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x312018[_0x8e06('0x86')]=_0x22677a['connectedlinenum'];_0x312018[_0x8e06('0x87')]=_0x22677a[_0x8e06('0x87')];logger[_0x8e06('0x66')](_0x8e06('0x88'),_0x312018[_0x8e06('0x4c')],_0x312018[_0x8e06('0x4f')],_0x22677a[_0x8e06('0x86')],_0x22677a[_0x8e06('0x87')]);this[_0x8e06('0xf')][_0x22677a['uniqueid']]=_0x312018;this[_0x8e06('0x43')](_0x312018,_0x8e06('0x1b'));}}}catch(_0x115b73){logger[_0x8e06('0x3a')](_0x8e06('0x83'),_0x22677a[_0x8e06('0x46')],util['inspect'](_0x115b73,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e06('0x9')][_0x8e06('0x1f')]=function(_0x12bcce){try{if(this[_0x8e06('0x60')](_0x12bcce)){logger[_0x8e06('0x44')]('[%s][voiceQueueReport][agentconnect]',_0x12bcce['uniqueid'],util[_0x8e06('0x47')](_0x12bcce,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12bcce[_0x8e06('0x46')]]){var _0xc6d0ca=_['last'](this[_0x8e06('0xd')][_0x12bcce['uniqueid']]);_0xc6d0ca[_0x8e06('0x89')]=!![];_0xc6d0ca[_0x8e06('0x80')]=_0x8e06('0x8a');logger['info'](_0x8e06('0x8b'),_0xc6d0ca[_0x8e06('0x4c')],_0xc6d0ca['type']);}}}catch(_0x3740e4){logger[_0x8e06('0x3a')](_0x8e06('0x8c'),_0x12bcce['uniqueid'],util[_0x8e06('0x47')](_0x3740e4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e06('0x9')]['syncAgentComplete']=function(_0x11931b){try{if(this['isNotNull'](_0x11931b)){logger[_0x8e06('0x44')](_0x8e06('0x8d'),_0x11931b['uniqueid'],util[_0x8e06('0x47')](_0x11931b,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x11931b['uniqueid']]){var _0x1bc775=_[_0x8e06('0x84')](this[_0x8e06('0xd')][_0x11931b['uniqueid']]);_0x1bc775[_0x8e06('0x19')]=![];_0x1bc775[_0x8e06('0x7e')]=null;_0x1bc775[_0x8e06('0x8e')]=!![];_0x1bc775['lastAssignedTo']=_0x11931b[_0x8e06('0x8f')];_0x1bc775['holdtime']=_0x11931b[_0x8e06('0x7c')];_0x1bc775[_0x8e06('0x89')]=!![];_0x1bc775[_0x8e06('0x90')]=![];_0x1bc775[_0x8e06('0x91')]=null;if(!_0x1bc775[_0x8e06('0x92')]){if(_0x11931b[_0x8e06('0x93')]=='transfer'){_0x1bc775[_0x8e06('0x80')]='COMPLETED';logger[_0x8e06('0x66')](_0x8e06('0x94'),_0x1bc775[_0x8e06('0x4c')],_0x1bc775[_0x8e06('0x4f')]);}else{if(_[_0x8e06('0x95')](_0x11931b[_0x8e06('0x36')][_0x8e06('0x96')](),_0x8e06('0x97'))){if(this[_0x8e06('0xd')][_0x11931b['linkedid']]){var _0x478687=_[_0x8e06('0x84')](this[_0x8e06('0xd')][_0x11931b[_0x8e06('0x98')]]);_0x478687[_0x8e06('0x89')]=![];_0x478687[_0x8e06('0x90')]=!![];_0x478687[_0x8e06('0x91')]=moment(_0x1bc775[_0x8e06('0x71')])['add'](_0x11931b[_0x8e06('0x7c')],_0x8e06('0x99'))[_0x8e06('0x48')](_0x8e06('0x7f'));_0x478687[_0x8e06('0x80')]=_0x8e06('0x9a');_0x478687[_0x8e06('0x92')]=!![];_0x478687[_0x8e06('0x9b')]=_0x8e06('0x9c');_0x478687[_0x8e06('0x9d')]=_0x11931b[_0x8e06('0x9e')];_0x478687[_0x8e06('0x9f')]=_0x11931b[_0x8e06('0x46')];logger[_0x8e06('0x66')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x478687[_0x8e06('0x4c')],_0x478687['type']);var _0x14fee2=this[_0x8e06('0xd')][_0x11931b[_0x8e06('0x98')]];this[_0x8e06('0xd')][_0x11931b['linkedid']]=this[_0x8e06('0xd')][_0x11931b[_0x8e06('0x46')]];this[_0x8e06('0xd')][_0x11931b[_0x8e06('0x46')]]=_0x14fee2;}}else{_0x1bc775[_0x8e06('0x80')]=_0x8e06('0xa0')+_0x11931b['reason'][_0x8e06('0xa1')]();logger[_0x8e06('0x66')](_0x8e06('0xa2'),_0x1bc775['name'],_0x1bc775[_0x8e06('0x4f')],_0x1bc775[_0x8e06('0x80')]);}}}this[_0x8e06('0xf')][_0x11931b[_0x8e06('0x46')]]=_0x1bc775;this['emitVoiceQueueChannelRemove'](_0x1bc775,_0x8e06('0x1d'));}}}catch(_0x3adfeb){logger[_0x8e06('0x3a')](_0x8e06('0x8d'),_0x11931b[_0x8e06('0x46')],util[_0x8e06('0x47')](_0x3adfeb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e06('0x9')][_0x8e06('0x21')]=function(_0x57b595){try{if(this[_0x8e06('0x60')](_0x57b595)){logger[_0x8e06('0x44')]('[%s][voiceQueueReport][varset]',_0x57b595[_0x8e06('0x46')],util[_0x8e06('0x47')](_0x57b595,{'showHidden':![],'depth':null}));this[_0x8e06('0xa3')](_0x57b595[_0x8e06('0x46')],_['keys'](_0x57b595[_0x8e06('0xa4')])[0x0],_0x57b595[_0x8e06('0xa5')]);if(this[_0x8e06('0xd')][_0x57b595[_0x8e06('0x46')]]){var _0x55c39f=_[_0x8e06('0x84')](this[_0x8e06('0xd')][_0x57b595[_0x8e06('0x46')]]);if(_0x55c39f){if(this['isNotNull'](_0x57b595['variable'])&&this[_0x8e06('0x60')](_0x57b595[_0x8e06('0xa4')][_0x8e06('0xa6')])){switch(_0x57b595[_0x8e06('0xa5')]){case'CONTINUE':_0x55c39f[_0x8e06('0x90')]=![];_0x55c39f['queuecallerexitAt']=null;break;case'TIMEOUT':_0x55c39f[_0x8e06('0xa7')]=_0x8e06('0xa8');_0x55c39f[_0x8e06('0x90')]=!![];_0x55c39f[_0x8e06('0x91')]=moment()[_0x8e06('0x48')](_0x8e06('0x7f'));_0x55c39f[_0x8e06('0x85')]=moment()[_0x8e06('0x48')](_0x8e06('0x7f'));logger[_0x8e06('0x44')](_0x8e06('0xa9'),_0x57b595[_0x8e06('0x46')],util['inspect'](_0x55c39f,{'showHidden':![],'depth':null}));ami[_0x8e06('0x42')]('custom:timeout',_0x55c39f);break;default:_0x55c39f[_0x8e06('0x90')]=!![];_0x55c39f['queuecallerexitAt']=moment()[_0x8e06('0x48')](_0x8e06('0x7f'));_0x55c39f['queuecallerleaveAt']=moment()[_0x8e06('0x48')](_0x8e06('0x7f'));}_0x55c39f[_0x8e06('0x19')]=![];_0x55c39f[_0x8e06('0x7e')]=null;_0x55c39f[_0x8e06('0x80')]=_0x57b595[_0x8e06('0xa5')];this['channels'][_0x57b595['uniqueid']]=_0x55c39f;this[_0x8e06('0x40')](_0x55c39f,_0x8e06('0x20'));}else if(this[_0x8e06('0x60')](_0x57b595['variable'])&&this[_0x8e06('0x60')](_0x57b595[_0x8e06('0xa4')]['queueposition'])){if(!_0x55c39f[_0x8e06('0x19')]){_0x55c39f[_0x8e06('0x90')]=!![];_0x55c39f[_0x8e06('0x91')]=moment()[_0x8e06('0x48')](_0x8e06('0x7f'));_0x55c39f['queuecallerexitreason']=_0x8e06('0xaa');_0x55c39f[_0x8e06('0x85')]=moment()['format'](_0x8e06('0x7f'));this[_0x8e06('0xf')][_0x57b595['uniqueid']]=_0x55c39f;}}logger[_0x8e06('0x66')](_0x8e06('0xab'),_0x57b595['uniqueid'],_0x55c39f[_0x8e06('0x4c')],_0x55c39f[_0x8e06('0x4f')],_[_0x8e06('0x77')](_0x57b595[_0x8e06('0xa4')])[0x0],_0x57b595[_0x8e06('0xa5')]);_0x55c39f[_0x8e06('0x14')]=this['variables'][_0x57b595[_0x8e06('0x46')]];}}}}catch(_0x3ca9fa){logger[_0x8e06('0x3a')](_0x8e06('0xac'),_0x57b595['uniqueid'],util[_0x8e06('0x47')](_0x3ca9fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8e06('0x9')][_0x8e06('0xa3')]=function(_0x59a196,_0x45b1cd,_0x366988){var _0x40641e=[_0x8e06('0xad'),_0x8e06('0xae'),_0x8e06('0xaf'),_0x8e06('0xb0'),'rtpaudioqosloss',_0x8e06('0xb1'),_0x8e06('0xb2'),_0x8e06('0xb3'),_0x8e06('0xb4'),_0x8e06('0xb5'),_0x8e06('0xb6'),_0x8e06('0xb7'),'membercalls',_0x8e06('0xb8'),_0x8e06('0xb9'),_0x8e06('0xba'),_0x8e06('0x8f'),_0x8e06('0xbb'),_0x8e06('0xbc')];if(!_[_0x8e06('0xbd')](_0x45b1cd)&&!_['includes'](_0x40641e,_0x45b1cd)){if(_[_0x8e06('0x61')](this[_0x8e06('0x14')][_0x59a196])){this[_0x8e06('0x14')][_0x59a196]={};}this[_0x8e06('0x14')][_0x59a196][_0x45b1cd]=_0x366988;}};VoiceQueueReport[_0x8e06('0x9')]['syncHangup']=function(_0x4c2d7e){try{if(this[_0x8e06('0x60')](_0x4c2d7e)){logger[_0x8e06('0x44')]('[%s][voiceQueueReport][hangup]',_0x4c2d7e[_0x8e06('0x46')],util[_0x8e06('0x47')](_0x4c2d7e,{'showHidden':![],'depth':null}));if(this[_0x8e06('0xd')][_0x4c2d7e[_0x8e06('0x46')]]){for(var _0x5724a6=0x0,_0x378a2d={};_0x5724a6=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 +var _0x5e34=['../client','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','seconds','exten','queue','agent','toNumber','accountcode','uniqueid','voiceDialReport','voice','membername','TALKING','starttime','endtime','outbound','dialstring','lodash','util'];(function(_0xd00c36,_0x3a2605){var _0x1cc1ee=function(_0x4d4619){while(--_0x4d4619){_0xd00c36['push'](_0xd00c36['shift']());}};_0x1cc1ee(++_0x3a2605);}(_0x5e34,0xe6));var _0x45e3=function(_0x56b05b,_0x2fa917){_0x56b05b=_0x56b05b-0x0;var _0x56c3d4=_0x5e34[_0x56b05b];return _0x56c3d4;};'use strict';var moment=require('moment');var _=require(_0x45e3('0x0'));var util=require(_0x45e3('0x1'));var client=require(_0x45e3('0x2'));exports['voiceQueueReport']=function(_0x4c3598){var _0x1c3fd9=_0x4c3598[_0x45e3('0x3')]||_0x4c3598[_0x45e3('0x4')];return client[_0x45e3('0x5')](_0x45e3('0x6'),{'body':{'channel':'voice','membername':_0x4c3598[_0x45e3('0x7')],'interface':_[_0x45e3('0x8')](_0x4c3598[_0x45e3('0x9')])?util[_0x45e3('0xa')](_0x45e3('0xb'),_0x4c3598[_0x45e3('0x7')]):_0x4c3598[_0x45e3('0x9')],'type':'TALKING','enterAt':_0x4c3598[_0x45e3('0xc')],'exitAt':_0x1c3fd9,'duration':moment(_0x1c3fd9)[_0x45e3('0xd')](_0x4c3598['queuecallerleaveAt'],_0x45e3('0xe')),'data1':'inbound','data2':_0x4c3598['calleridnum'],'data3':_0x4c3598[_0x45e3('0xf')],'data4':null,'data5':_0x4c3598[_0x45e3('0x10')],'role':_0x45e3('0x11'),'internal':_0x4c3598['accountcode']?_[_0x45e3('0x12')](_0x4c3598[_0x45e3('0x13')]):undefined,'uniqueid':_0x4c3598[_0x45e3('0x14')]},'log':_0x45e3('0x6')});};exports[_0x45e3('0x15')]=function(_0x1cd380){return client[_0x45e3('0x5')](_0x45e3('0x6'),{'body':{'channel':_0x45e3('0x16'),'membername':_0x1cd380[_0x45e3('0x17')],'interface':_0x1cd380[_0x45e3('0x9')],'type':_0x45e3('0x18'),'enterAt':_0x1cd380[_0x45e3('0x19')],'exitAt':_0x1cd380['endtime'],'duration':moment(_0x1cd380['endtime'])[_0x45e3('0xd')](_0x1cd380['starttime'],_0x45e3('0xe'))>=0x0?moment(_0x1cd380[_0x45e3('0x1a')])['diff'](_0x1cd380[_0x45e3('0x19')],'seconds'):null,'data1':_0x45e3('0x1b'),'data2':_0x1cd380['accountcode'],'data3':_0x1cd380[_0x45e3('0xf')],'data4':_0x1cd380[_0x45e3('0x1c')]||null,'role':_0x45e3('0x11'),'internal':_0x1cd380['accountcode']?_[_0x45e3('0x12')](_0x1cd380['accountcode']):undefined,'uniqueid':_0x1cd380['uniqueid']},'log':_0x45e3('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index de7a1d5..a4e294f 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 _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 +var _0x235a=['name','html','GetTemplate','../client','getTemplates','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x235a,0x1ef));var _0xa235=function(_0x515609,_0x2011b2){_0x515609=_0x515609-0x0;var _0x20df9f=_0x235a[_0x515609];return _0x20df9f;};'use strict';var client=require(_0xa235('0x0'));exports[_0xa235('0x1')]=function(_0x95e7f5){return function(_0x49f946){return client[_0xa235('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xa235('0x3'),_0xa235('0x4')]},'log':_0xa235('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index f36a63c..df327b9 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 _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 +var _0xa877=['value','Action','Actions','action','data1','data2','data3','data5','data6','data7','Request','GetTrigger','name','channel','status','Condition','AllConditions','field','operator'];(function(_0xa173a5,_0x41a77d){var _0x124532=function(_0x48fc23){while(--_0x48fc23){_0xa173a5['push'](_0xa173a5['shift']());}};_0x124532(++_0x41a77d);}(_0xa877,0x69));var _0x7a87=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa877[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports['getTriggers']=function(_0x5db06b){return function(_0x10660e){return client[_0x7a87('0x0')](_0x7a87('0x1'),{'options':{'raw':![],'attributes':['id',_0x7a87('0x2'),_0x7a87('0x3'),_0x7a87('0x4')],'include':[{'model':_0x7a87('0x5'),'as':_0x7a87('0x6'),'attributes':['id',_0x7a87('0x7'),_0x7a87('0x8'),_0x7a87('0x9')]},{'model':_0x7a87('0x5'),'as':'AnyConditions','attributes':['id',_0x7a87('0x7'),_0x7a87('0x8'),_0x7a87('0x9')]},{'model':_0x7a87('0xa'),'as':_0x7a87('0xb'),'attributes':['id',_0x7a87('0xc'),_0x7a87('0xd'),_0x7a87('0xe'),_0x7a87('0xf'),'data4',_0x7a87('0x10'),_0x7a87('0x11'),_0x7a87('0x12')]}]},'log':_0x7a87('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6190d27..66799fa 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 _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 +var _0x263b=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x378a94,_0x5a7a6f){var _0x5545b2=function(_0x561677){while(--_0x561677){_0x378a94['push'](_0x378a94['shift']());}};_0x5545b2(++_0x5a7a6f);}(_0x263b,0x170));var _0xb263=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x263b[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xb263('0x0'));exports[_0xb263('0x1')]=function(_0x3b224d){return function(_0x3fee87){return client[_0xb263('0x2')](_0xb263('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb263('0x4'),'registry']},'log':_0xb263('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 06a85ff..1a69e5d 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 _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 +var _0x9c96=['UnpauseUser','getAgent','../client','Request','GetUser','agent','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','getAgents','getTelephones','telephone','accountcode','internal','savePause','saveUnpause'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x9c96,0x120));var _0x69c9=function(_0x690f2d,_0x5d70f2){_0x690f2d=_0x690f2d-0x0;var _0x291396=_0x9c96[_0x690f2d];return _0x291396;};'use strict';var client=require(_0x69c9('0x0'));exports['getAgents']=function(){return function(){return client[_0x69c9('0x1')](_0x69c9('0x2'),{'options':{'raw':![],'where':{'role':_0x69c9('0x3')},'attributes':['id','name',_0x69c9('0x4'),'accountcode',_0x69c9('0x5'),_0x69c9('0x6'),_0x69c9('0x7'),_0x69c9('0x8'),_0x69c9('0x9'),_0x69c9('0xa'),_0x69c9('0xb'),_0x69c9('0xc'),'interface']},'log':_0x69c9('0xd')});};};exports[_0x69c9('0xe')]=function(){return function(){return client[_0x69c9('0x1')](_0x69c9('0x2'),{'options':{'raw':!![],'where':{'role':_0x69c9('0xf')},'attributes':['id','name',_0x69c9('0x10'),_0x69c9('0x11')]},'log':_0x69c9('0xe')});};};exports[_0x69c9('0x12')]=function(_0x3c89d1,_0x32fb64,_0x35685f){return client[_0x69c9('0x1')]('PauseUser',{'body':{'type':_0x32fb64,'uniqueid':_0x35685f},'options':{'where':{'id':_0x3c89d1['id']}},'log':_0x69c9('0x12')});};exports[_0x69c9('0x13')]=function(_0x6cfc2a){return client[_0x69c9('0x1')](_0x69c9('0x14'),{'body':{},'options':{'where':{'id':_0x6cfc2a['id']}},'log':_0x69c9('0x12')});};exports[_0x69c9('0x15')]=function(_0x51c02c){return client[_0x69c9('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':'agent','id':_0x51c02c},'attributes':['id','name',_0x69c9('0x4'),_0x69c9('0x10'),'fullname',_0x69c9('0x6'),_0x69c9('0x7'),'pauseType',_0x69c9('0x9'),_0x69c9('0xa'),'interface']},'log':_0x69c9('0x15')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 9aba3f9..ae51274 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 _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 +var _0x93ac=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x337cf6,_0x186e49){var _0x389ac8=function(_0x328779){while(--_0x328779){_0x337cf6['push'](_0x337cf6['shift']());}};_0x389ac8(++_0x186e49);}(_0x93ac,0x9e));var _0xc93a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ac[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc93a('0x0'));exports[_0xc93a('0x1')]=function(_0x3b4db5){return client[_0xc93a('0x2')]('CreateVoiceAgentReport',{'body':_0x3b4db5,'log':_0xc93a('0x3')});};exports[_0xc93a('0x4')]=function(_0x50b82a,_0x4f1388,_0x3966a0){return client[_0xc93a('0x2')](_0xc93a('0x5'),{'body':_0x50b82a,'options':{'where':{'uniqueid':_0x4f1388,'interface':_0x3966a0,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 88a08d5..b486c47 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 _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 +var _0xe998=['context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','YYYY-MM-DD\x20HH:mm:ss','day','format','type','disposition','duration','GetVoiceCallReports','util','../client','create','merge','calleridnum'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe998,0xcc));var _0x8e99=function(_0x54c1b0,_0x1a98ac){_0x54c1b0=_0x54c1b0-0x0;var _0x238c99=_0xe998[_0x54c1b0];return _0x238c99;};'use strict';var moment=require('moment');var util=require(_0x8e99('0x0'));var _=require('lodash');var client=require(_0x8e99('0x1'));exports[_0x8e99('0x2')]=function(_0x7ada37){return client['Request']('CreateVoiceCallReport',{'body':_[_0x8e99('0x3')](_0x7ada37,{'source':_0x7ada37[_0x8e99('0x4')],'destinationcontext':_0x7ada37[_0x8e99('0x5')],'callerid':_0x7ada37['callerid'],'amaflags':_0x8e99('0x6')}),'log':_0x8e99('0x7')});};exports[_0x8e99('0x8')]=function(){return function(){return client['Request'](_0x8e99('0x9'),{'options':{'where':{'type':[_0x8e99('0xa')],'createdAt':{'$between':[moment()[_0x8e99('0xb')]('day')['format'](_0x8e99('0xc')),moment()['endOf'](_0x8e99('0xd'))[_0x8e99('0xe')](_0x8e99('0xc'))]}},'attributes':[_0x8e99('0xf'),_0x8e99('0x10'),_0x8e99('0x11'),'billableseconds']},'log':_0x8e99('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a0e7f29..4fefc91 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 _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 +var _0x7d16=['Request','CreateVoiceDialReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d16,0x19d));var _0x67d1=function(_0x364c8d,_0x2cd88c){_0x364c8d=_0x364c8d-0x0;var _0x568e2c=_0x7d16[_0x364c8d];return _0x568e2c;};'use strict';var client=require(_0x67d1('0x0'));exports['create']=function(_0x4e499a){return client[_0x67d1('0x1')](_0x67d1('0x2'),{'body':_0x4e499a,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 96abed0..1b81ac0 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 _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 +var _0xd53c=['exten','recordingFormat','../client','getVoiceExtensions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd53c,0xe6));var _0xcd53=function(_0x10e012,_0x4078c0){_0x10e012=_0x10e012-0x0;var _0x5a1878=_0xd53c[_0x10e012];return _0x5a1878;};'use strict';var client=require(_0xcd53('0x0'));exports[_0xcd53('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xcd53('0x2'),_0xcd53('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 8409b8a..e9eedf3 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 _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 +var _0x9c07=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','name','callerid','mandatoryDispositionPause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','acwTimeout','autopause','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0x11e38a,_0x2872a2){var _0xc45259=function(_0x138e9f){while(--_0x138e9f){_0x11e38a['push'](_0x11e38a['shift']());}};_0xc45259(++_0x2872a2);}(_0x9c07,0x9b));var _0x79c0=function(_0x1800fa,_0x42c327){_0x1800fa=_0x1800fa-0x0;var _0x1d8063=_0x9c07[_0x1800fa];return _0x1d8063;};'use strict';var client=require(_0x79c0('0x0'));exports[_0x79c0('0x1')]=function(){return function(){return client[_0x79c0('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x79c0('0x3'),_0x79c0('0x4'),'monitor_format','type',_0x79c0('0x5'),_0x79c0('0x6'),'dialLimitChannel',_0x79c0('0x7'),'dialPowerLevel',_0x79c0('0x8'),'dialPredictiveOptimizationPercentage',_0x79c0('0x9'),'dialOriginateCallerIdName',_0x79c0('0xa'),_0x79c0('0xb'),_0x79c0('0xc'),_0x79c0('0xd'),_0x79c0('0xe'),_0x79c0('0xf'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x79c0('0x10'),_0x79c0('0x11'),_0x79c0('0x12'),_0x79c0('0x13'),'dialTimezone',_0x79c0('0x14'),_0x79c0('0x15'),_0x79c0('0x16'),_0x79c0('0x17'),'dialAMDInitialSilence',_0x79c0('0x18'),_0x79c0('0x19'),_0x79c0('0x1a'),_0x79c0('0x1b'),'dialAMDBetweenWordsSilence',_0x79c0('0x1c'),_0x79c0('0x1d'),_0x79c0('0x1e'),_0x79c0('0x1f'),_0x79c0('0x20'),_0x79c0('0x21'),_0x79c0('0x22'),'dialAgiAfterHangupAgent',_0x79c0('0x23'),_0x79c0('0x24'),'monitor_format',_0x79c0('0x25'),'dialRandomLastDigitCallerIdNumber',_0x79c0('0x26'),'dialNoSuchNumberMaxRetry',_0x79c0('0x27'),_0x79c0('0x28'),'dialDropRetryFrequency',_0x79c0('0x29'),'dialAbandonedRetryFrequency',_0x79c0('0x2a'),_0x79c0('0x2b'),_0x79c0('0x2c'),_0x79c0('0x2d'),_0x79c0('0x2e'),'dialPredictiveIntervalMaxThreshold',_0x79c0('0x2f')],'include':[{'model':_0x79c0('0x30'),'as':_0x79c0('0x30'),'attributes':['id',_0x79c0('0x31'),_0x79c0('0x32'),'active']},{'model':'Pause','as':_0x79c0('0x33'),'attributes':['id',_0x79c0('0x31')]},{'model':_0x79c0('0x30'),'as':_0x79c0('0x34'),'attributes':['id',_0x79c0('0x31'),'callerid',_0x79c0('0x35')]},{'model':'Interval','as':_0x79c0('0x36'),'attributes':['id',_0x79c0('0x31')],'include':[{'model':_0x79c0('0x36'),'as':_0x79c0('0x37'),'attributes':['id',_0x79c0('0x31'),_0x79c0('0x38')]}]}]},'log':_0x79c0('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d4636d8..0b47b97 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 _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 +var _0xf4bb=['getVoiceQueueReports','startOf','YYYY-MM-DD\x20HH:mm:ss','day','format','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallerexit','queuecallerexitAt','queuecallerabandon','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xf4bb,0x118));var _0xbf4b=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xf4bb[_0x3a6efd];return _0x487b9a;};'use strict';var moment=require(_0xbf4b('0x0'));var _=require(_0xbf4b('0x1'));var client=require('../client');exports[_0xbf4b('0x2')]=function(_0x4a450a){return client[_0xbf4b('0x3')]('CreateVoiceQueueReport',{'body':_0x4a450a,'log':_0xbf4b('0x4')});};exports[_0xbf4b('0x5')]=function(){return function(){return client[_0xbf4b('0x3')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0xbf4b('0x6')]('day')['format'](_0xbf4b('0x7')),moment()['endOf'](_0xbf4b('0x8'))[_0xbf4b('0x9')](_0xbf4b('0x7'))]}},'attributes':[_0xbf4b('0xa'),_0xbf4b('0xb'),_0xbf4b('0xc'),_0xbf4b('0xd'),_0xbf4b('0xe'),'queuecallercompleteAt',_0xbf4b('0xf'),_0xbf4b('0x10'),_0xbf4b('0x11'),'queuecallerabandonAt']},'log':_0xbf4b('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index fbd0612..57c704e 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 _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 +var _0xbed7=['getVoiceQueueRtPauses','Request'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xbed7,0xde));var _0x7bed=function(_0x12e900,_0xf572c7){_0x12e900=_0x12e900-0x0;var _0x101674=_0xbed7[_0x12e900];return _0x101674;};'use strict';var client=require('../client');exports[_0x7bed('0x0')]=function(_0x2a6941){return function(){return client[_0x7bed('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x2a6941,'paused':!![]},'raw':!![]},'log':_0x7bed('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 8637f0d..7090ce7 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 _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 +var _0xe8df=['Request','CreateVoiceRecording','merge','../client'];(function(_0xaa8d69,_0x25177c){var _0xd6ab89=function(_0x31b42a){while(--_0x31b42a){_0xaa8d69['push'](_0xaa8d69['shift']());}};_0xd6ab89(++_0x25177c);}(_0xe8df,0x123));var _0xfe8d=function(_0x19d58e,_0x3c70da){_0x19d58e=_0x19d58e-0x0;var _0x1f4d00=_0xe8df[_0x19d58e];return _0x1f4d00;};'use strict';var _=require('lodash');var client=require(_0xfe8d('0x0'));exports['create']=function(_0x3a3773){return client[_0xfe8d('0x1')](_0xfe8d('0x2'),{'body':_[_0xfe8d('0x3')](_0x3a3773,{'value':_0x3a3773['monitorFilename']}),'log':_0xfe8d('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 8510d1b..b959371 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 _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 +var _0xe34e=['Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xe34e,0x70));var _0xee34=function(_0x258ec9,_0x29c861){_0x258ec9=_0x258ec9-0x0;var _0x1fcd8d=_0xe34e[_0x258ec9];return _0x1fcd8d;};'use strict';var client=require(_0xee34('0x0'));exports['transfers']={};exports[_0xee34('0x1')]=function(_0x504d55){return client[_0xee34('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x504d55[_0xee34('0x3')],'transfererchannel':_0x504d55[_0xee34('0x4')],'transferercalleridnum':_0x504d55[_0xee34('0x5')],'transferercalleridname':_0x504d55[_0xee34('0x6')],'transfererconnectedlinenum':_0x504d55[_0xee34('0x7')],'transfererconnectedlinename':_0x504d55[_0xee34('0x8')],'transfereraccountcode':_0x504d55[_0xee34('0x9')],'transferercontext':_0x504d55['transferercontext'],'transfererexten':_0x504d55[_0xee34('0xa')],'transfererlinkedid':_0x504d55['transfererlinkedid'],'transfereechannel':_0x504d55[_0xee34('0xb')],'transfereecalleridnum':_0x504d55[_0xee34('0xc')],'transfereecalleridname':_0x504d55['transfereecalleridname'],'transfereeconnectedlinenum':_0x504d55['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x504d55[_0xee34('0xd')],'transfereeaccountcode':_0x504d55[_0xee34('0xe')],'transfereecontext':_0x504d55[_0xee34('0xf')],'transfereeexten':_0x504d55['transfereeexten'],'transfereelinkedid':_0x504d55[_0xee34('0x10')],'isexternal':_0x504d55[_0xee34('0x11')],'context':_0x504d55[_0xee34('0x12')],'extension':_0x504d55['extension'],'type':_0xee34('0x13')},'log':_0xee34('0x14')});};exports[_0xee34('0x15')]=function(_0x462925){return client[_0xee34('0x2')](_0xee34('0x14'),{'body':{'result':_0x462925[_0xee34('0x3')],'transfererchannel':_0x462925[_0xee34('0x16')],'transferercalleridnum':_0x462925[_0xee34('0x17')],'transferercalleridname':_0x462925[_0xee34('0x18')],'transfererconnectedlinenum':_0x462925[_0xee34('0x19')],'transfererconnectedlinename':_0x462925[_0xee34('0x1a')],'transfereraccountcode':_0x462925[_0xee34('0x1b')],'transferercontext':_0x462925[_0xee34('0x1c')],'transfererexten':_0x462925['secondtransfererexten'],'transfererlinkedid':_0x462925[_0xee34('0x1d')],'transfereechannel':_0x462925['transfertargetchannel'],'transfereecalleridnum':_0x462925[_0xee34('0x1e')],'transfereecalleridname':_0x462925['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x462925['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x462925[_0xee34('0x1f')],'transfereeaccountcode':_0x462925[_0xee34('0x20')],'transfereecontext':_0x462925[_0xee34('0x21')],'transfereeexten':_0x462925[_0xee34('0x22')],'transfereelinkedid':_0x462925[_0xee34('0x23')],'isexternal':_0x462925[_0xee34('0x11')],'context':_0x462925[_0xee34('0x24')],'extension':_0x462925['origtransfererexten'],'type':_0xee34('0x25')},'log':_0xee34('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6f40087..804890f 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 _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 +var _0x816e=['AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','moment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','ami\x20disconnected','join','pick','keys','Reload','Action','message','action','Command','then','content','catch','voiceQueues','hasOwnProperty','answered','available','pTalking','sumBillable','talking','type','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','Interval','push','length','channels','isConnected','username','voicechannel','map','channel','format','%s.%s','filename','uniqueid','wav','MixMonitor','ai(mixmonitorid)','find','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','validate','resolve','StopMixMonitor','stop','StopMixMonitor\x20Success','values','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','127.0.0.1','log'];(function(_0x629b4c,_0x2b75f5){var _0x1f568b=function(_0xfed13c){while(--_0xfed13c){_0x629b4c['push'](_0x629b4c['shift']());}};_0x1f568b(++_0x2b75f5);}(_0x816e,0x89));var _0xe816=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x816e[_0x3e0763];return _0x351ca2;};'use strict';var _=require(_0xe816('0x0'));var util=require(_0xe816('0x1'));var jayson=require(_0xe816('0x2'));var schema=require('validate');var BPromise=require('bluebird');var moment=require(_0xe816('0x3'));var config=require('../../../config/environment');var properties=require(_0xe816('0x4'));var ami=require(_0xe816('0x5'));exports[_0xe816('0x6')]=function(_0xcf1bc,_0x1d40dc,_0x4c4d25){return new BPromise(function(_0x333c0c,_0x6dc9b8){var _0x51ecaa={'QueuePause':function(_0x59c8d6){return new Promise(function(_0x32e501,_0x423f37){var _0x4a93da=util['format'](_0xe816('0x7'),_0xe816('0x8'),_0x59c8d6[_0xe816('0x9')]);if(_0xcf1bc[_0xe816('0xa')]&&_0xcf1bc[_0xe816('0xa')][_0x4a93da]&&_0xcf1bc[_0xe816('0xa')][_0x4a93da][_0xe816('0xb')]){_0xcf1bc[_0xe816('0xa')][_0x4a93da][_0xe816('0xc')]();}if(_0xcf1bc[_0xe816('0xd')][_0x4a93da]){_0xcf1bc[_0xe816('0xd')][_0x4a93da][_0xe816('0xe')]({'statePause':_0x59c8d6[_0xe816('0xf')]?!![]:![]});}_0x32e501({'code':0xc8,'message':_0xe816('0x10')});});},'Reload':function(_0xeee581){var _0x1566c6=this;return new Promise(function(_0xa667e1,_0x5dbedf){if(ami['isConnected']()==![]){return _0x5dbedf(_0x1566c6[_0xe816('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xe816('0x12')]['username'],_0xe816('0x13')][_0xe816('0x14')]('\x20')));}_0xeee581=_[_0xe816('0x15')](_0xeee581,_[_0xe816('0x16')](properties['module']));_0xeee581['action']=_0xe816('0x17');return ami[_0xe816('0x18')](_0xeee581)['then'](function(_0x2be398){_0xa667e1({'code':0xc8,'message':_0x2be398['message']});})['catch'](function(_0xf7b060){_0x5dbedf(_0x1566c6[_0xe816('0x11')](0x1f5,_0xf7b060[_0xe816('0x19')]));});});},'Command':function(_0x1e6b14){var _0x1c9eb7=this;return new Promise(function(_0x422b24,_0x7606dc){if(ami['isConnected']()==![]){return _0x7606dc(_0x1c9eb7['error'](0x1f4,[config['asterisk']['ip'],config[_0xe816('0x12')]['username'],_0xe816('0x13')][_0xe816('0x14')]('\x20')));}_0x1e6b14=_[_0xe816('0x15')](_0x1e6b14,'command');_0x1e6b14[_0xe816('0x1a')]=_0xe816('0x1b');return ami[_0xe816('0x18')](_0x1e6b14)[_0xe816('0x1c')](function(_0x4f67b7){_0x422b24({'code':0xc8,'message':_0x4f67b7[_0xe816('0x1d')]});})[_0xe816('0x1e')](function(_0x52318f){_0x7606dc(_0x1c9eb7[_0xe816('0x11')](0x1f5,_0x52318f[_0xe816('0x19')]));});});},'VoiceQueues':function(_0x1c5901){return new Promise(function(_0x1eb7fa,_0x4e25ff){var _0x10f529=[];for(var _0x37148c in _0xcf1bc[_0xe816('0x1f')]){if(_0xcf1bc[_0xe816('0x1f')][_0xe816('0x20')](_0x37148c)){var _0x277990=_0xcf1bc[_0xe816('0x1f')][_0x37148c];var _0x44fdee={'id':_0x277990['id'],'name':_0x277990[_0xe816('0x9')],'strategy':_0x277990['strategy'],'answered':_0x277990[_0xe816('0x21')],'available':_0x277990[_0xe816('0x22')],'loggedIn':_0x277990['loggedIn'],'pTalking':_0x277990[_0xe816('0x23')],'sumBillable':_0x277990[_0xe816('0x24')],'sumDuration':_0x277990['sumDuration'],'sumHoldTime':_0x277990['sumHoldTime']||0x0,'talking':_0x277990[_0xe816('0x25')],'total':_0x277990['total'],'type':_0x277990[_0xe816('0x26')],'unmanaged':_0x277990['unmanaged'],'abandoned':_0x277990[_0xe816('0x27')],'waiting':_0x277990[_0xe816('0x28')],'loggedInDb':_0x277990[_0xe816('0x29')]};if(_0x277990['type']===_0xe816('0x2a')){_0x44fdee[_0xe816('0x2b')]=_0x277990[_0xe816('0x2b')];_0x44fdee[_0xe816('0x2c')]=_0x277990[_0xe816('0x2c')];_0x44fdee['dialOriginateCallerIdName']=_0x277990['dialOriginateCallerIdName'];_0x44fdee['dialOriginateCallerIdNumber']=_0x277990[_0xe816('0x2d')];_0x44fdee['dialOriginateTimeout']=_0x277990[_0xe816('0x2e')];_0x44fdee[_0xe816('0x2f')]=_0x277990[_0xe816('0x2f')];_0x44fdee[_0xe816('0x30')]=_0x277990['outboundAnswerAgiCallsDay'];_0x44fdee[_0xe816('0x31')]=_0x277990[_0xe816('0x31')];_0x44fdee[_0xe816('0x32')]=_0x277990[_0xe816('0x32')];_0x44fdee[_0xe816('0x33')]=_0x277990[_0xe816('0x33')];_0x44fdee[_0xe816('0x34')]=_0x277990[_0xe816('0x34')];_0x44fdee['outboundDropCallsDayACS']=_0x277990[_0xe816('0x35')];_0x44fdee['outboundDropCallsDayCallersExit']=_0x277990[_0xe816('0x36')];_0x44fdee[_0xe816('0x37')]=_0x277990['outboundDropCallsDayTimeout'];_0x44fdee[_0xe816('0x38')]=_0x277990[_0xe816('0x38')];_0x44fdee[_0xe816('0x39')]=_0x277990[_0xe816('0x39')];_0x44fdee[_0xe816('0x3a')]=_0x277990['outboundOriginateFailureCallsDay'];_0x44fdee[_0xe816('0x3b')]=_0x277990[_0xe816('0x3b')];_0x44fdee[_0xe816('0x3c')]=_0x277990[_0xe816('0x3c')];_0x44fdee[_0xe816('0x3d')]=_0x277990[_0xe816('0x3d')];_0x44fdee['predictiveIntervalAnsweredCalls']=_0x277990['predictiveIntervalAnsweredCalls'];_0x44fdee['predictiveIntervalAvgHoldtime']=_0x277990[_0xe816('0x3e')];_0x44fdee['predictiveIntervalAvgTalktime']=_0x277990[_0xe816('0x3f')];_0x44fdee[_0xe816('0x40')]=_0x277990[_0xe816('0x40')];_0x44fdee[_0xe816('0x41')]=_0x277990[_0xe816('0x41')];_0x44fdee[_0xe816('0x42')]=_0x277990[_0xe816('0x42')];_0x44fdee[_0xe816('0x43')]=_0x277990[_0xe816('0x43')];_0x44fdee[_0xe816('0x44')]=_0x277990[_0xe816('0x44')];_0x44fdee[_0xe816('0x45')]=_0x277990[_0xe816('0x45')];_0x44fdee[_0xe816('0x46')]=_0x277990[_0xe816('0x46')];_0x44fdee[_0xe816('0x47')]=_0x277990['predictiveIntervalAvailable'];_0x44fdee[_0xe816('0x48')]=_0x277990[_0xe816('0x48')];_0x44fdee[_0xe816('0x19')]=_0x277990[_0xe816('0x19')];_0x44fdee[_0xe816('0x49')]=_0x277990[_0xe816('0x49')];_0x44fdee['erlangCalls']=_0x277990[_0xe816('0x4a')];_0x44fdee[_0xe816('0x4b')]=_0x277990[_0xe816('0x4b')];_0x44fdee['erlangAbandonmentRate']=_0x277990[_0xe816('0x4c')];_0x44fdee[_0xe816('0x4d')]=_0x277990['erlangBusyFactor'];_0x44fdee['startPredictive']=_0x277990['startPredictive'];_0x44fdee[_0xe816('0x4e')]=_0x277990[_0xe816('0x4e')];}if(_0x277990['Trunk']){_0x44fdee[_0xe816('0x4f')]={'id':_0x277990['Trunk']['id'],'name':_0x277990[_0xe816('0x4f')][_0xe816('0x9')],'active':_0x277990['Trunk']['active'],'callerid':_0x277990[_0xe816('0x4f')]['callerid']};}if(_0x277990['Interval']){_0x44fdee[_0xe816('0x50')]={'id':_0x277990[_0xe816('0x50')]['id'],'name':_0x277990[_0xe816('0x50')][_0xe816('0x9')]};}_0x10f529[_0xe816('0x51')](_0x44fdee);}}_0x1eb7fa({'count':_0x10f529[_0xe816('0x52')],'rows':_0x10f529});});},'VoiceChannels':function(_0x1b206a){return new Promise(function(_0x1b3569,_0xe9924){var _0x2ad086=_['values'](_0xcf1bc[_0xe816('0x53')]);_0x1b3569({'count':_0x2ad086[_0xe816('0x52')],'rows':_0x2ad086});});},'VoiceChannelMixMonitor':function(_0xf6cbe0){var _0x2e93e3=this;return new Promise(function(_0x5038fe,_0x32d2d8){if(ami[_0xe816('0x54')]()==![]){return _0x32d2d8(_0x2e93e3[_0xe816('0x11')](0x1f4,[config[_0xe816('0x12')]['ip'],config[_0xe816('0x12')][_0xe816('0x55')],_0xe816('0x13')][_0xe816('0x14')]('\x20')));}var _0x16779c=schema(properties[_0xe816('0x56')])['validate'](_0xf6cbe0);if(_0x16779c[_0xe816('0x52')]>0x0){return _0x32d2d8(_0x2e93e3['error'](0x1f4,_[_0xe816('0x57')](_0x16779c,_0xe816('0x19'))['join'](',\x20')));}var _0x3bfa3c=_['find'](_0xcf1bc[_0xe816('0x53')],{'uniqueid':_0xf6cbe0['uniqueid']});if(_0x3bfa3c&&_0x3bfa3c[_0xe816('0x58')]){var _0x5dcaaf=util[_0xe816('0x59')](_0xe816('0x5a'),_0xf6cbe0[_0xe816('0x5b')]||_0xf6cbe0[_0xe816('0x5c')],_0xf6cbe0[_0xe816('0x59')]||_0xe816('0x5d'));return ami[_0xe816('0x18')]({'action':_0xe816('0x5e'),'channel':_0x3bfa3c[_0xe816('0x58')],'file':_0x5dcaaf,'options':_0xe816('0x5f')})['then'](function(_0x40b7fd){var _0x364064=_[_0xe816('0x60')](_0x3bfa3c[_0xe816('0x61')],{'filename':'/var/spool/asterisk/monitor/'+_0x5dcaaf['toLowerCase']()});if(_[_0xe816('0x62')](_0x364064)){_0x3bfa3c['monitors'][_0xe816('0x51')]({'filename':_0xe816('0x63')+_0x5dcaaf[_0xe816('0x64')](),'createdAt':moment()['format'](_0xe816('0x65')),'mixmonitorid':_0x40b7fd[_0xe816('0x66')],'status':'rec'});}else{_0x364064[_0xe816('0x66')]=_0x40b7fd[_0xe816('0x66')];_0x364064[_0xe816('0x67')]=_0xe816('0x68');}_0x5038fe({'code':0xc8,'message':[_0xf6cbe0[_0xe816('0x5c')],_0xe816('0x69'),_0x40b7fd[_0xe816('0x66')]][_0xe816('0x14')]('\x20'),'mixmonitorid':_0x40b7fd['mixmonitorid']});})[_0xe816('0x1e')](function(_0x2cc96c){_0x32d2d8(_0x2e93e3['error'](0x1f5,[_0xf6cbe0['uniqueid'],_0x2cc96c[_0xe816('0x19')][_0xe816('0x64')]()][_0xe816('0x14')]('\x20')));});}else{return _0x32d2d8(_0x2e93e3['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x3ea8f9){var _0x474203=this;return new Promise(function(_0x3935b6,_0x1937fc){if(ami['isConnected']()==![]){return _0x1937fc(_0x474203[_0xe816('0x11')](0x1f4,[config[_0xe816('0x12')]['ip'],config[_0xe816('0x12')][_0xe816('0x55')],'ami\x20disconnected'][_0xe816('0x14')]('\x20')));}var _0x287761=schema(properties['voicechannel'])[_0xe816('0x6a')](_0x3ea8f9);if(_0x287761[_0xe816('0x52')]>0x0){return _0x1937fc(_0x474203['error'](0x1f4,_[_0xe816('0x57')](_0x287761,'message')[_0xe816('0x14')](',\x20')));}var _0x4b6242=_[_0xe816('0x60')](_0xcf1bc[_0xe816('0x53')],{'uniqueid':_0x3ea8f9[_0xe816('0x5c')]});if(_0x4b6242){return BPromise[_0xe816('0x6b')]()[_0xe816('0x1c')](function(){if(_0x4b6242[_0xe816('0x58')]){return ami[_0xe816('0x18')]({'action':_0xe816('0x6c'),'channel':_0x4b6242[_0xe816('0x58')],'mixmonitorid':_0x3ea8f9['mixmonitorid']})[_0xe816('0x1e')](function(_0x616824){});}})[_0xe816('0x1c')](function(){if(_0x4b6242['destinationchannel']){return ami[_0xe816('0x18')]({'action':_0xe816('0x6c'),'channel':_0x4b6242['destinationchannel'],'mixmonitorid':_0x3ea8f9[_0xe816('0x66')]})[_0xe816('0x1e')](function(_0x1c5a64){});}})[_0xe816('0x1c')](function(_0x3b2411){var _0x3782fd=_['find'](_0x4b6242[_0xe816('0x61')],{'mixmonitorid':_0x3ea8f9[_0xe816('0x66')]});if(_0x3782fd){_0x3782fd['status']=_0xe816('0x6d');}})[_0xe816('0x1c')](function(){var _0x2006ff=util[_0xe816('0x59')](_0xe816('0x5a'),_0x3ea8f9[_0xe816('0x5b')]||_0x3ea8f9[_0xe816('0x5c')],_0x3ea8f9['format']||_0xe816('0x5d'));var _0x5ba0d8=_[_0xe816('0x60')](_0x4b6242['monitors'],{'filename':_0xe816('0x63')+_0x2006ff[_0xe816('0x64')]()});if(_0x5ba0d8){_0x5ba0d8[_0xe816('0x67')]=_0xe816('0x6d');}})['then'](function(){_0x3935b6({'code':0xc8,'message':[_0x3ea8f9['uniqueid'],_0xe816('0x6e')]['join']('\x20')});})[_0xe816('0x1e')](function(_0x9dc9dd){_0x1937fc(_0x474203[_0xe816('0x11')](0x1f5,[_0x3ea8f9['uniqueid'],_0x9dc9dd[_0xe816('0x19')]['toLowerCase']()][_0xe816('0x14')]('\x20')));});}else{return _0x1937fc(_0x474203[_0xe816('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5ab2b6){return new Promise(function(_0x544b43,_0x58533f){var _0x5ba8cb=_[_0xe816('0x6f')](_0xcf1bc[_0xe816('0x70')]);_0x544b43({'count':_0x5ba8cb['length'],'rows':_0x5ba8cb});});},'VoiceQueuesChannel':function(_0x2715c7){var _0x5acd9f=this;return new Promise(function(_0x593c79,_0x434640){var _0x54d4de=schema(properties['voicequeuechannel'])[_0xe816('0x6a')](_0x2715c7);if(_0x54d4de['length']>0x0){return _0x434640(_0x5acd9f['error'](0x1f4,_['map'](_0x54d4de,_0xe816('0x19'))[_0xe816('0x14')](',\x20')));}var _0x42ce7b=_['find'](_0xcf1bc[_0xe816('0x70')],{'uniqueid':_0x2715c7[_0xe816('0x5c')]});if(_0x42ce7b){_0x593c79(_0x42ce7b);}else{return _0x434640(_0x5acd9f[_0xe816('0x11')](0x1f5,_0xe816('0x71')));}});},'VoiceQueuesChannelHangup':function(_0x5aa8cb){var _0x8d06f=this;return new Promise(function(_0x14ddc3,_0x1781d9){if(ami[_0xe816('0x54')]()==![]){return _0x1781d9(_0x8d06f[_0xe816('0x11')](0x1f4,[config[_0xe816('0x12')]['ip'],config[_0xe816('0x12')][_0xe816('0x55')],'ami\x20disconnected'][_0xe816('0x14')]('\x20')));}var _0x43265e=schema(properties[_0xe816('0x72')])[_0xe816('0x6a')](_0x5aa8cb);if(_0x43265e[_0xe816('0x52')]>0x0){return _0x1781d9(_0x8d06f[_0xe816('0x11')](0x1f4,_[_0xe816('0x57')](_0x43265e,'message')[_0xe816('0x14')](',\x20')));}var _0x5b1703=_[_0xe816('0x60')](_0xcf1bc[_0xe816('0x70')],{'uniqueid':_0x5aa8cb[_0xe816('0x5c')]});if(_0x5b1703&&_0x5b1703['channel']){return ami[_0xe816('0x18')]({'action':_0xe816('0x73'),'channel':_0x5b1703[_0xe816('0x58')]})[_0xe816('0x1c')](function(_0xe9eab1){_0x14ddc3({'code':0xc8,'message':[_0x5aa8cb[_0xe816('0x5c')],_0xe9eab1[_0xe816('0x19')][_0xe816('0x64')]()][_0xe816('0x14')]('\x20')});})['catch'](function(_0x41afe7){_0x1781d9(_0x8d06f[_0xe816('0x11')](0x1f5,[_0x5aa8cb[_0xe816('0x5c')],_0x41afe7['message']['toLowerCase']()][_0xe816('0x14')]('\x20')));});}else{return _0x1781d9(_0x8d06f[_0xe816('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x24976d){var _0x107d0e=this;return new Promise(function(_0x2a9316,_0x4bc034){if(ami['isConnected']()==![]){return _0x4bc034(_0x107d0e['error'](0x1f4,[config[_0xe816('0x12')]['ip'],config['asterisk']['username'],_0xe816('0x13')]['join']('\x20')));}var _0x524f8a=schema(properties[_0xe816('0x74')])[_0xe816('0x6a')](_0x24976d);if(_0x524f8a['length']>0x0){return _0x4bc034(_0x107d0e[_0xe816('0x11')](0x1f4,_[_0xe816('0x57')](_0x524f8a,'message')[_0xe816('0x14')](',\x20')));}var _0x3bbe8e=_['find'](_0xcf1bc[_0xe816('0x70')],{'uniqueid':_0x24976d[_0xe816('0x5c')]});if(_0x3bbe8e&&_0x3bbe8e['channel']){return ami['Action']({'action':_0xe816('0x75'),'channel':_0x3bbe8e[_0xe816('0x58')],'exten':_0x24976d[_0xe816('0x76')],'context':_0x24976d[_0xe816('0x77')]||_0x3bbe8e[_0xe816('0x77')],'priority':0x1})[_0xe816('0x1c')](function(_0x257fb6){_0x2a9316({'code':0xc8,'message':[_0x24976d[_0xe816('0x5c')],_0x257fb6['message']['toLowerCase']()]['join']('\x20')});})[_0xe816('0x1e')](function(_0x1c87d3){_0x4bc034(_0x107d0e[_0xe816('0x11')](0x1f5,[_0x24976d[_0xe816('0x5c')],_0x1c87d3[_0xe816('0x19')][_0xe816('0x64')]()]['join']('\x20')));});}else{return _0x4bc034(_0x107d0e[_0xe816('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x32b3d1){return new Promise(function(_0x29628a,_0x31e6a4){var _0x2c6035=_['values'](_0xcf1bc[_0xe816('0xd')]);_0x29628a({'count':_0x2c6035[_0xe816('0x52')],'rows':_0x2c6035});});},'Telephones':function(_0x32f9b5){return new Promise(function(_0xa0b799,_0x338937){var _0x333a43=_['values'](_0xcf1bc[_0xe816('0x78')]);_0xa0b799({'count':_0x333a43[_0xe816('0x52')],'rows':_0x333a43});});},'Trunks':function(_0x3d5c9e){return new Promise(function(_0x3846f9,_0x4dfd90){var _0xb67f30=_['values'](_0xcf1bc[_0xe816('0x79')]);_0x3846f9({'count':_0xb67f30[_0xe816('0x52')],'rows':_0xb67f30});});},'OutboundChannels':function(_0x33c29d){return new Promise(function(_0x4d84e8,_0x29ac6e){var _0x912c68=_[_0xe816('0x6f')](_0xcf1bc[_0xe816('0x7a')]);_0x4d84e8({'count':_0x912c68[_0xe816('0x52')],'rows':_0x912c68});});},'Outbound':function(_0x58493f){return new Promise(function(_0x4390ae,_0x113aaf){_0x4390ae(_0xcf1bc[_0xe816('0x2a')]);});},'Campaigns':function(_0x3e0d93){return new Promise(function(_0x59a08,_0x10e011){var _0x677629=_['values'](_0xcf1bc[_0xe816('0x7b')]);_0x59a08({'count':_0x677629[_0xe816('0x52')],'rows':_0x677629});});},'VoiceQueuesPreview':function(_0x385b30){var _0x2b3bd2=this;return new Promise(function(_0xf3353c,_0x3e0cc8){_0x1d40dc[_0xe816('0x7c')](_0x385b30['id'])[_0xe816('0x1c')](function(_0x2308fe){_0xf3353c({'code':0xc8,'message':_0x2308fe[_0xe816('0x19')]});})[_0xe816('0x1e')](function(_0x340168){_0x3e0cc8(_0x2b3bd2['error'](0x1f4,_0x340168[_0xe816('0x19')]));});});},'EventManager':function(_0x197f03){var _0x504372=this;return new Promise(function(_0x2c8971,_0x80bad0){if(!_0x197f03[_0xe816('0x7d')]){return _0x80bad0(_0x504372['error'](0x1f4,_0xe816('0x7e')));}ami[_0xe816('0x7f')](_0xe816('0x80')+_0x197f03[_0xe816('0x7d')],_0x197f03['message']);_0x2c8971({'code':0xc8,'message':_0x197f03});});},'FaxAccounts':function(_0x206cb6){return new Promise(function(_0x3778ce,_0x25c189){var _0xabcaf7=_[_0xe816('0x6f')](_0xcf1bc[_0xe816('0x81')]);_0x3778ce({'count':_0xabcaf7[_0xe816('0x52')],'rows':_0xabcaf7});});},'SendFax':function(_0x242e8a){var _0x1a6eac=this;return new Promise(function(_0x27e151,_0x24f83e){_0x4c4d25[_0xe816('0x82')](_0x242e8a)[_0xe816('0x1c')](function(_0x45944f){_0x27e151({'code':0xc8,'message':_0x45944f[_0xe816('0x19')]});})[_0xe816('0x1e')](function(_0x2f0f67){_0x24f83e(_0x1a6eac[_0xe816('0x11')](0x1f4,_0x2f0f67[_0xe816('0x19')]));});});},'CheckAfterSend':function(_0x1fbaff){var _0x20ef90=this;return new Promise(function(_0x4a2c10,_0x318b6d){_0x4c4d25[_0xe816('0x83')](_0x1fbaff)[_0xe816('0x1c')](function(_0x7c94f){_0x4a2c10({'code':0xc8,'message':_0x7c94f[_0xe816('0x19')]});})[_0xe816('0x1e')](function(_0x3af306){_0x318b6d(_0x20ef90[_0xe816('0x11')](0x1f4,_0x3af306[_0xe816('0x19')]));});});}};var _0x5db853=jayson['server'](_0x51ecaa)[_0xe816('0x84')]();_0x5db853['on']('error',function(_0x5726c7){return _0x6dc9b8(_0x5726c7);});_0x5db853['listen'](0x232a,_0xe816('0x85'),function(){console[_0xe816('0x86')](_0xe816('0x87'),0x232a);return _0x333c0c('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 9248b98..bfa9599 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 _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 +var _0xe1ef=['mobile','fax','createdAt','scheduledAt','union','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','isNil','destcalleridnum','calleridname','','Unknown','destcalleridname','resolve','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','calleridnum','push','format','user:%s','trigger:%s','action','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','firstName'];(function(_0xaf25ae,_0x2001c1){var _0x49732d=function(_0x5b764d){while(--_0x5b764d){_0xaf25ae['push'](_0xaf25ae['shift']());}};_0x49732d(++_0x2001c1);}(_0xe1ef,0x16d));var _0xfe1e=function(_0x2eccad,_0x5935c3){_0x2eccad=_0x2eccad-0x0;var _0x4b0a25=_0xe1ef[_0x2eccad];return _0x4b0a25;};'use strict';var _=require(_0xfe1e('0x0'));var BPromise=require(_0xfe1e('0x1'));var Redis=require(_0xfe1e('0x2'));var util=require(_0xfe1e('0x3'));var config=require(_0xfe1e('0x4'));var logger=require(_0xfe1e('0x5'))(_0xfe1e('0x6'));var cmContactRpc=require(_0xfe1e('0x7'));config[_0xfe1e('0x8')]=_[_0xfe1e('0x9')](config[_0xfe1e('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xfe1e('0xa'))(new Redis(config[_0xfe1e('0x8')]));function emit(_0x192180,_0x3e0ba8,_0x4cc0e8,_0x3bd3c1,_0x1770a2){logger[_0xfe1e('0xb')](_0xfe1e('0xc'),_0x192180,_0x3e0ba8['id'],_0x4cc0e8,_0x3bd3c1,JSON[_0xfe1e('0xd')](_0x1770a2));io['to'](_0x4cc0e8)[_0xfe1e('0xe')](_0x3bd3c1,_0x1770a2);}exports[_0xfe1e('0xf')]=function(_0x23b6ed,_0x473a0a,_0xa4fa1c,_0x25ee0e){var _0x5e7759,_0x585895;var _0x3036b4={};var _0x262235=Number(_0xa4fa1c[_0xfe1e('0x10')]);var _0x44de22=_0xa4fa1c[_0xfe1e('0x11')]?Boolean(Number(_0xa4fa1c[_0xfe1e('0x11')])):![];var _0x491af0;if(_0x25ee0e[_0xfe1e('0x12')]){_0x3036b4['id']=_0x25ee0e[_0xfe1e('0x12')];}if(!_0x3036b4['id']){_0x3036b4[_0xfe1e('0x13')]=_0x262235;_0x491af0=_0xa4fa1c[_0xfe1e('0x14')]&&_0xa4fa1c[_0xfe1e('0x14')]!=='0'?_0xa4fa1c[_0xfe1e('0x14')][_0xfe1e('0x15')](','):[_0xfe1e('0x16')];_0x3036b4[_0xfe1e('0x17')]=_[_0xfe1e('0x18')](_0x491af0,function(_0x29bdbc){var _0x5f458a={};_0x5f458a[_0x29bdbc]=_0x25ee0e[_0xfe1e('0x19')]?_0x25ee0e['destcalleridnum']:_0x25ee0e['calleridnum'];return _0x5f458a;});}var _0x561ff4=['id',_0xfe1e('0x1a'),'lastName',_0xfe1e('0x16'),_0xfe1e('0x1b'),_0xfe1e('0x1c'),'ListId',_0xfe1e('0x1d'),_0xfe1e('0x1e'),'updatedAt'];var _0x324bed=_[_0xfe1e('0x1f')](_0x561ff4,_0x491af0);BPromise['resolve']()['then'](cmContactRpc['getContacts']({'attributes':_0x324bed,'where':_0x3036b4}))[_0xfe1e('0x20')](function(_0x52fff3){_0x585895=_0x52fff3;if(!_[_0xfe1e('0x21')](_0x585895)){if(_0x585895[_0xfe1e('0x22')]===0x1){_0x5e7759=_0x585895[0x0];logger[_0xfe1e('0xb')](_0xfe1e('0x23'),_0x25ee0e[_0xfe1e('0x24')],_0x473a0a['id'],_0x5e7759['id']);}else{logger['info'](_0xfe1e('0x25'),_0x25ee0e['uniqueid'],_0x473a0a['id'],_[_0xfe1e('0x18')](_0x585895,'id')[_0xfe1e('0x26')](','));}return;}else{logger[_0xfe1e('0xb')](_0xfe1e('0x27'),_0x25ee0e[_0xfe1e('0x24')],_0x473a0a['id']);var _0xfe9013={'ListId':_0x262235};var _0x2b73a3=_0xa4fa1c[_0xfe1e('0x28')]&&_0xa4fa1c[_0xfe1e('0x28')]!=='0'?_0xa4fa1c[_0xfe1e('0x28')]:'phone';if(_0x44de22){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x25ee0e[_0xfe1e('0x24')],_0x473a0a['id']);_0xfe9013[_0x2b73a3]=_[_0xfe1e('0x29')](_0x25ee0e['routeId'])?_0x25ee0e['calleridnum']:_0x25ee0e[_0xfe1e('0x2a')];if(_['isNil'](_0x25ee0e[_0xfe1e('0x19')])){_0xfe9013[_0xfe1e('0x1a')]=_0x25ee0e[_0xfe1e('0x2b')]&&_0x25ee0e[_0xfe1e('0x2b')]!==_0xfe1e('0x2c')?_0x25ee0e[_0xfe1e('0x2b')]:_0xfe1e('0x2d');}else{_0xfe9013[_0xfe1e('0x1a')]=_0x25ee0e[_0xfe1e('0x2e')]&&_0x25ee0e[_0xfe1e('0x2e')]!==''?_0x25ee0e[_0xfe1e('0x2e')]:'Unknown';}return BPromise[_0xfe1e('0x2f')]()['then'](cmContactRpc[_0xfe1e('0x30')](_0xfe9013))[_0xfe1e('0x20')](function(_0x2bc66b){_0x5e7759=_0x2bc66b;_0x585895['push'](_0x2bc66b);if(_0x5e7759){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x25ee0e[_0xfe1e('0x24')],_0x473a0a['id'],_0x5e7759['id']);}return;});}else{logger['info'](_0xfe1e('0x31'),_0x25ee0e[_0xfe1e('0x24')],_0x473a0a['id']);_0xfe9013[_0x2b73a3]=_['isNil'](_0x25ee0e[_0xfe1e('0x19')])?_0x25ee0e[_0xfe1e('0x32')]:_0x25ee0e[_0xfe1e('0x2a')];if(_[_0xfe1e('0x29')](_0x25ee0e[_0xfe1e('0x19')])){_0xfe9013[_0xfe1e('0x1a')]=_0x25ee0e['calleridname']&&_0x25ee0e[_0xfe1e('0x2b')]!==_0xfe1e('0x2c')?_0x25ee0e[_0xfe1e('0x2b')]:'Unknown';}else{_0xfe9013[_0xfe1e('0x1a')]=_0x25ee0e[_0xfe1e('0x2e')]&&_0x25ee0e[_0xfe1e('0x2e')]!==_0xfe1e('0x2c')?_0x25ee0e[_0xfe1e('0x2e')]:_0xfe1e('0x2d');}_0x5e7759=_0xfe9013;_0x585895[_0xfe1e('0x33')](_0xfe9013);return;}}})[_0xfe1e('0x20')](function(){if(_0x23b6ed){emit(_0x25ee0e[_0xfe1e('0x24')],_0x473a0a,util[_0xfe1e('0x34')](_0xfe1e('0x35'),_0x23b6ed['name']),util[_0xfe1e('0x34')](_0xfe1e('0x36'),_0xa4fa1c[_0xfe1e('0x37')]['toLowerCase']()),{'evt':_['merge'](_0x25ee0e,{'autoCreate':_0x44de22}),'contact':_0x5e7759===undefined?{}:_0x5e7759,'contacts':_0x585895['length']===0x0?undefined:_0x585895});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f4dc16b..a6af321 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 _0x22c5=['custom:agentreject','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','clone','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','action','toLowerCase','contactmanager','browser','data1','TemplateId','data2','html','render','buildUri','isNil','data3','data4','uriLocation','windowWidth','data5','800','windowHeight','600','data6','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','trigger:%s','exec','voiceQueues','queue','urlforward','script','parse','query','search','AllConditions','every','checkConditions','AnyConditions','some','field','account','chat','ChatWebsiteId','operator','AccountId','value','upperFirst','message','channel','agent','membername','lastevent','routeId','exports','lodash','mustache','./integration','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','salesforceAccounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion'];(function(_0x189dc1,_0x1e21ad){var _0x4f8045=function(_0x5e25de){while(--_0x5e25de){_0x189dc1['push'](_0x189dc1['shift']());}};_0x4f8045(++_0x1e21ad);}(_0x22c5,0xc1));var _0x522c=function(_0x2e3b52,_0x274f2f){_0x2e3b52=_0x2e3b52-0x0;var _0x126637=_0x22c5[_0x2e3b52];return _0x126637;};'use strict';var util=require('util');var _=require(_0x522c('0x0'));var url=require('url');var Mustache=require(_0x522c('0x1'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x522c('0x2'));var cmContact=require('./cmContact');var script=require(_0x522c('0x3'));var config=require(_0x522c('0x4'));var logger=require(_0x522c('0x5'))('trigger');var ami=require(_0x522c('0x6'));config[_0x522c('0x7')]=_[_0x522c('0x8')](config[_0x522c('0x7')],{'host':_0x522c('0x9'),'port':0x18eb});var io=require(_0x522c('0xa'))(new Redis(config[_0x522c('0x7')]));var operators={'equals':function(_0x25e411,_0x254984){return _0x25e411==_0x254984;},'not_equals':function(_0x3ead45,_0x26b984){return _0x3ead45!=_0x26b984;}};var barAndWebActions=[_0x522c('0xb'),_0x522c('0xc'),_0x522c('0xd')];function Trigger(_0x2ff828){this[_0x522c('0xe')]=_0x2ff828['triggers'];this[_0x522c('0xf')]=_0x2ff828['agents'];this['voiceQueues']=_0x2ff828['voiceQueues'];this[_0x522c('0x10')]=_0x2ff828[_0x522c('0x10')];this[_0x522c('0x11')]=_0x2ff828['voiceExtensions'];this[_0x522c('0x12')]=_0x2ff828[_0x522c('0x12')];this[_0x522c('0x13')]=_0x2ff828['freshdeskAccounts'];this['salesforceAccounts']=_0x2ff828['salesforceAccounts'];this[_0x522c('0x14')]=_0x2ff828[_0x522c('0x14')];this[_0x522c('0x15')]=_0x2ff828[_0x522c('0x15')];this[_0x522c('0x16')]=_0x2ff828[_0x522c('0x16')];this['vtigerAccounts']=_0x2ff828[_0x522c('0x17')];this[_0x522c('0x18')]=_0x2ff828[_0x522c('0x18')];this[_0x522c('0x19')]=_0x2ff828['dynamics365Accounts'];this['freshsalesAccounts']=_0x2ff828['freshsalesAccounts'];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x522c('0x1a')],'freshdesk':this[_0x522c('0x13')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x522c('0x15')],'desk':this[_0x522c('0x16')],'vtiger':this[_0x522c('0x17')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x522c('0x1b')],'servicenow':this[_0x522c('0x18')]};ami['on'](_0x522c('0x1c'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on']('custom:agentconnect',this[_0x522c('0x1d')]['bind'](this));ami['on'](_0x522c('0x1f'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x20'),this['syncCustomEvent']['bind'](this));ami['on'](_0x522c('0x21'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x22'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x23'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x24'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x25'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x522c('0x1e')](this));ami['on'](_0x522c('0x26'),this['syncCustomEvent'][_0x522c('0x1e')](this));ami['on'](_0x522c('0x27'),this[_0x522c('0x28')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x29'),this['syncAgentDial'][_0x522c('0x1e')](this));ami['on'](_0x522c('0x2a'),this[_0x522c('0x28')][_0x522c('0x1e')](this));ami['on']('custom:newinteraction',this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent']['bind'](this));ami['on'](_0x522c('0x2b'),this[_0x522c('0x1d')]['bind'](this));ami['on'](_0x522c('0x2c'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));ami['on'](_0x522c('0x2d'),this['syncCustomEvent'][_0x522c('0x1e')](this));ami['on'](_0x522c('0x2e'),this[_0x522c('0x1d')][_0x522c('0x1e')](this));}Trigger[_0x522c('0x2f')][_0x522c('0x30')]=function(_0x38c668,_0x4b4966,_0x2d9eef){logger[_0x522c('0x31')](_0x38c668,_0x4b4966,JSON['stringify'](_0x2d9eef));io['to'](_0x38c668)['emit'](_0x4b4966,_0x2d9eef);};Trigger[_0x522c('0x2f')][_0x522c('0x1d')]=function(_0x50d665){var _0x32b2b9=_[_0x522c('0x32')](_0x50d665);this['checkTriggers'](_0x32b2b9);};Trigger[_0x522c('0x2f')][_0x522c('0x28')]=function(_0x357d08){if(this['agents'][_0x357d08[_0x522c('0x33')]]){this[_0x522c('0x1d')](_0x357d08);}};Trigger['prototype'][_0x522c('0x34')]=function(_0x43a5ac){var _0x1782b6;for(var _0x4d7dd9 in this['triggers']){if(this[_0x522c('0xe')][_0x522c('0x35')](_0x4d7dd9)){if(this[_0x522c('0xe')][_0x4d7dd9][_0x522c('0x36')]){_0x1782b6=this[_0x522c('0x37')](this[_0x522c('0xe')][_0x4d7dd9],_0x43a5ac);if(_0x1782b6){_[_0x522c('0x38')](_0x43a5ac,_0x43a5ac[_0x522c('0x39')]);for(var _0x5d9e31=0x0,_0x505106,_0x2ed744,_0x18a9de;_0x5d9e310x0){_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(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 6fb2071..fed809d 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 _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 +var _0x6095=['message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','validateEmail','email','userEmail','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','internalemailaddress','outbound','destcalleridnum','calleridnum','contacts','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase','contactid',']\x20Enduser\x20Created!','type','string','nameField','customField','idField','indexOf','ticketType','incidents','assign','getString','Descriptions','Fields','phonecalls','Subjects','/contacts(','/systemusers(','callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:','unmanaged',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!'];(function(_0x667ff8,_0x59e7df){var _0x2ddfc7=function(_0x5a4a46){while(--_0x5a4a46){_0x667ff8['push'](_0x667ff8['shift']());}};_0x2ddfc7(++_0x59e7df);}(_0x6095,0x103));var _0x5609=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6095[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0x5609('0x0'));var BPromise=require(_0x5609('0x1'));var rp=require(_0x5609('0x2'));var util=require(_0x5609('0x3'));var intUtil=require('./util');var md5=require('md5');var Redis=require('ioredis');var logger=require(_0x5609('0x4'))(_0x5609('0x5'));var config=require(_0x5609('0x6'));config[_0x5609('0x7')]=_[_0x5609('0x8')](config['redis'],{'host':_0x5609('0x9'),'port':0x18eb});var io=require(_0x5609('0xa'))(new Redis(config[_0x5609('0x7')]));function getAuthToken(_0x4e22b8,_0x363cd7,_0xc17f1e){var _0x1ee94b={'method':_0x5609('0xb'),'uri':_0x363cd7,'form':{'client_id':_0x4e22b8[_0x5609('0xc')],'resource':_0x4e22b8[_0x5609('0xd')],'username':_0x4e22b8[_0x5609('0xe')],'password':_0x4e22b8['password'],'grant_type':_0x5609('0xf'),'client_secret':_0x4e22b8[_0x5609('0x10')]},'json':!![]};return rp(_0x1ee94b)[_0x5609('0x11')](function(_0x168bfd){return _0x168bfd[_0x5609('0x12')];})[_0x5609('0x13')](function(_0x5657b9){logger[_0x5609('0x14')]('['+[_0xc17f1e[_0x5609('0x15')]()]+_0x5609('0x16'));return _0x5657b9[_0x5609('0x17')];});}function getUser(_0x439020,_0x2a8554,_0x28c483,_0x2a3de1,_0x1432c4,_0x37fc65){return new BPromise(function(_0x5d30a5,_0x138a64){return getAuthToken(_0x2a8554,_0x2a3de1,_0x37fc65)[_0x5609('0x11')](function(_0x46325b){var _0x128fde={'method':_0x5609('0x18'),'uri':_0x1432c4+_0x5609('0x19'),'headers':{'Authorization':_0x5609('0x1a')+_0x46325b,'OData-Version':_0x5609('0x1b')},'json':!![]};return rp(_0x128fde);})[_0x5609('0x11')](function(_0x58ef6a){var _0x142f32=_0x58ef6a[_0x5609('0x1c')];var _0x515cb3=![];var _0x254255=null;if(!_['isNil'](_0x28c483)){if(intUtil[_0x5609('0x1d')](_0x28c483[_0x5609('0x1e')])){_0x439020[_0x5609('0x1f')]=_0x28c483[_0x5609('0x1e')];for(_0x254255=0x0;_0x254255<_0x142f32[_0x5609('0x20')];_0x254255++){if(_0x142f32[_0x254255]['internalemailaddress']===_0x28c483[_0x5609('0x1e')]&&!_0x142f32[_0x254255][_0x5609('0x21')]){_0x515cb3=!![];logger[_0x5609('0x22')]('['+[_0x37fc65[_0x5609('0x15')]()]+_0x5609('0x23')+_0x142f32[_0x254255][_0x5609('0x24')]+'!');_0x439020[_0x5609('0x25')]=_0x142f32[_0x254255]['systemuserid'];}}}}if(!_0x515cb3){logger[_0x5609('0x22')]('['+[_0x37fc65[_0x5609('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x439020[_0x5609('0x1f')]=_0x2a8554[_0x5609('0xe')];for(_0x254255=0x0;_0x254255<_0x142f32[_0x5609('0x20')];_0x254255++){if(_0x142f32[_0x254255][_0x5609('0x26')]===_0x2a8554[_0x5609('0xe')]){_0x439020[_0x5609('0x25')]=_0x142f32[_0x254255][_0x5609('0x24')];}}}_0x5d30a5(_0x439020);})[_0x5609('0x13')](function(_0x5bdf6e){_0x138a64(_0x5bdf6e[_0x5609('0x17')]);});});}function createEndUser(_0x3a3789,_0x655435,_0x321af8,_0x108caa,_0x4fd6bc,_0x191819){return new BPromise(function(_0x3bc7bf,_0x1629bb){return getAuthToken(_0x655435,_0x321af8,_0x191819)[_0x5609('0x11')](function(_0x3b1b31){var _0x1591c6=_0x191819['toLowerCase']()===_0x5609('0x27')?_0x4fd6bc[_0x5609('0x28')]:_0x4fd6bc[_0x5609('0x29')];var _0x5b3c67={'method':_0x5609('0xb'),'uri':_0x108caa+_0x5609('0x2a'),'body':{'telephone1':_0x1591c6,'fullname':_0x1591c6,'firstname':_0x1591c6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3a3789[_0x5609('0x25')]+')'},'headers':{'Authorization':_0x5609('0x1a')+_0x3b1b31,'OData-Version':_0x5609('0x1b')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x5b3c67);})[_0x5609('0x11')](function(_0x401640){var _0xae460a=_0x401640[_0x5609('0x2b')][_0x5609('0x2c')];var _0x2a3052=_0xae460a[_0x5609('0x2d')](_0xae460a[_0x5609('0x2e')]('(')+0x1,_0xae460a[_0x5609('0x2e')](')'));_0x3a3789[_0x5609('0x2f')]=_0x2a3052;_0x3bc7bf(_0x3a3789);})[_0x5609('0x13')](function(_0x1376a3){_0x1629bb(_0x1376a3[_0x5609('0x17')]);});});}function getEndUser(_0xbe5645,_0x3e4379,_0x589cbc,_0x269724,_0x1aa7b3,_0x4222e0){return new BPromise(function(_0x22301b,_0x442b03){return getAuthToken(_0x3e4379,_0x589cbc,_0x4222e0)[_0x5609('0x11')](function(_0x581bbf){var _0x449abc={'method':_0x5609('0x18'),'uri':_0x269724+_0x5609('0x30'),'headers':{'Authorization':_0x5609('0x1a')+_0x581bbf,'If-None-Match':null,'OData-Version':_0x5609('0x1b')},'json':!![]};return rp(_0x449abc);})['then'](function(_0x20c7df){var _0x5e61a4=null;if(_0x20c7df){var _0x5c3a24=_0x20c7df[_0x5609('0x1c')];var _0xb5eeb0=![];for(_0x5e61a4=0x0;_0x5e61a4<_0x5c3a24[_0x5609('0x20')];_0x5e61a4++){var _0x580689=_0x4222e0[_0x5609('0x31')]()==='outbound'?_0x1aa7b3[_0x5609('0x28')]:_0x1aa7b3['calleridnum'];if(_0x5c3a24[_0x5e61a4]['telephone1']===_0x580689){_0xb5eeb0=!![];_0xbe5645[_0x5609('0x2f')]=_0x5c3a24[_0x5e61a4][_0x5609('0x32')];}}if(_0xb5eeb0){_0x22301b(_0xbe5645);}else{return createEndUser(_0xbe5645,_0x3e4379,_0x589cbc,_0x269724,_0x1aa7b3,_0x4222e0)[_0x5609('0x11')](function(_0xa0c170){logger[_0x5609('0x22')]('['+[_0x4222e0[_0x5609('0x15')]()]+']\x20Enduser\x20created!',_0xa0c170[_0x5609('0x2f')]);_0x22301b(_0xa0c170);});}}else{return createEndUser(_0xbe5645,_0x3e4379,_0x589cbc,_0x269724,_0x1aa7b3,_0x4222e0)[_0x5609('0x11')](function(_0x14b438){logger[_0x5609('0x22')]('['+[_0x4222e0[_0x5609('0x15')]()]+_0x5609('0x33'),_0x14b438['enduserId']);_0x22301b(_0x14b438);});}});});}function getCustomFields(_0x224a5e,_0x38be63,_0x3ab097){var _0x4d6fdf={};if(_0x224a5e[_0x5609('0x20')]>0x0){_['forEach'](_0x224a5e,function(_0x287b91){if(_0x287b91[_0x5609('0x34')]===_0x5609('0x35')&&_0x287b91[_0x5609('0x36')]&&!_0x287b91[_0x5609('0x37')]){var _0x148b14=_0x287b91[_0x5609('0x38')][_0x5609('0x31')]();var _0x37c0eb=_0x148b14[_0x5609('0x2d')](0x0,_0x148b14[_0x5609('0x39')]('_'));var _0x1f1f55=_0x148b14['substring'](_0x148b14[_0x5609('0x39')]('_')+0x1);if(_0x37c0eb===_0x3ab097){_0x4d6fdf[_0x1f1f55]=_0x287b91['content'];}}});}return _0x4d6fdf;}function getTicket(_0x2c0cfd,_0x13d521,_0x334b77,_0x54136b,_0x2a27d8,_0x39a5e0,_0x4f0741){return new BPromise(function(_0x319865,_0x47a54e){var _0x3876c9;return getAuthToken(_0x13d521,_0x334b77,_0x4f0741)['then'](function(_0x405b30){if(_0x39a5e0[_0x5609('0x3a')]==='incident'){_0x3876c9={'method':_0x5609('0xb'),'uri':_0x54136b+_0x5609('0x3b'),'body':Object[_0x5609('0x3c')]({},{'title':intUtil[_0x5609('0x3d')](_0x39a5e0['Subjects'],_0x2a27d8,'\x20'),'description':intUtil['getString'](_0x39a5e0[_0x5609('0x3e')],_0x2a27d8,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2c0cfd[_0x5609('0x2f')]+')','ownerid@odata.bind':'/systemusers('+_0x2c0cfd[_0x5609('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x39a5e0[_0x5609('0x3f')],_0x2a27d8,_0x39a5e0[_0x5609('0x3a')])),'headers':{'Authorization':_0x5609('0x1a')+_0x405b30,'OData-Version':_0x5609('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x39a5e0[_0x5609('0x3a')]==='phonecall'){_0x3876c9={'method':_0x5609('0xb'),'uri':_0x54136b+_0x5609('0x40'),'body':Object[_0x5609('0x3c')]({},{'subject':intUtil[_0x5609('0x3d')](_0x39a5e0[_0x5609('0x41')],_0x2a27d8,'\x20'),'phonenumber':String(_0x2a27d8[_0x5609('0x29')]),'description':intUtil[_0x5609('0x3d')](_0x39a5e0['Descriptions'],_0x2a27d8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5609('0x42')+_0x2c0cfd['enduserId']+')','ownerid@odata.bind':_0x5609('0x43')+_0x2c0cfd[_0x5609('0x25')]+')','directioncode':_0x2c0cfd[_0x5609('0x44')]===_0x5609('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2c0cfd[_0x5609('0x25')]+')','participationtypemask':_0x2c0cfd[_0x5609('0x44')]===_0x5609('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x5609('0x42')+_0x2c0cfd[_0x5609('0x2f')]+')','participationtypemask':_0x2c0cfd[_0x5609('0x44')]===_0x5609('0x45')?0x1:0x2}]},getCustomFields(_0x39a5e0[_0x5609('0x3f')],_0x2a27d8,_0x39a5e0[_0x5609('0x3a')])),'headers':{'Authorization':_0x5609('0x1a')+_0x405b30,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3876c9);})[_0x5609('0x11')](function(_0x1b8406){var _0x2951b3=_0x1b8406[_0x5609('0x2b')][_0x5609('0x2c')];var _0x2e57a8=_0x2951b3[_0x5609('0x2d')](_0x2951b3[_0x5609('0x2e')]('(')+0x1,_0x2951b3[_0x5609('0x2e')](')'));_0x2c0cfd[_0x5609('0x46')]=_0x2e57a8;_0x319865(_0x2c0cfd);})[_0x5609('0x13')](function(_0x5840d5){_0x47a54e(_0x5840d5[_0x5609('0x17')]);});});}function emit(_0x575ec5,_0x2f9f03,_0x5c8145,_0x3e4017){var _0x5d1cdb={'uri':util[_0x5609('0x47')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x575ec5,_0x5c8145,_0x3e4017)};io['to'](util[_0x5609('0x47')](_0x5609('0x48'),_0x2f9f03))[_0x5609('0x49')](_0x5609('0x4a'),_0x5d1cdb);}exports['cs']=function(_0xd071d0,_0x3bc8ba,_0x47e533,_0x3ef4f5,_0x5273dd,_0x357ad3,_0x29db96,_0x407632){var _0x5894d3={};_0x357ad3['remoteUri']=intUtil[_0x5609('0x4b')](_0x357ad3[_0x5609('0xd')]);_0x357ad3[_0x5609('0x4c')]=intUtil[_0x5609('0x4b')](_0x357ad3['serverUrl']);_0x5894d3[_0x5609('0x44')]=_0x407632===_0x5609('0x45')||_0x407632==='unmanaged'?_0x5609('0x45'):_0x5609('0x27');var _0x24c85c=util['format'](_0x5609('0x4d'),_0x357ad3[_0x5609('0xd')]);var _0x40ed18=util[_0x5609('0x47')](_0x5609('0x4e'),_0x357ad3[_0x5609('0x4f')]);var _0x4b8bcf=util[_0x5609('0x47')](_0x5609('0x50'),_0x357ad3[_0x5609('0x4c')],_0x3bc8ba[_0x5609('0x51')],md5(_0x3bc8ba[_0x5609('0x51')]));if(_0x5273dd&&_0x5273dd[_0x5609('0x52')]){logger[_0x5609('0x22')](_0x5609('0x53'),'Recording\x20is\x20enabled!');_0x3bc8ba[_0x5609('0x54')]=_0x4b8bcf;}else if(_0x29db96&&_0x29db96['recordingFormat']&&_0x29db96[_0x5609('0x55')]!=='none'){logger[_0x5609('0x22')](_0x5609('0x56'),_0x5609('0x57'));_0x3bc8ba[_0x5609('0x54')]=_0x4b8bcf;}else{_0x3bc8ba[_0x5609('0x54')]='';}return getUser(_0x5894d3,_0x357ad3,_0x3ef4f5,_0x40ed18,_0x24c85c,_0x407632)[_0x5609('0x11')](function(_0x4d7c33){logger[_0x5609('0x22')]('['+_0x407632['toUpperCase']()+_0x5609('0x58'),_0x4d7c33[_0x5609('0x25')]);logger[_0x5609('0x22')]('['+_0x407632['toUpperCase']()+_0x5609('0x59'),_0x4d7c33['userEmail']);return getEndUser(_0x4d7c33,_0x357ad3,_0x40ed18,_0x24c85c,_0x3bc8ba,_0x407632);})['then'](function(_0x14eb2f){logger[_0x5609('0x22')]('['+_0x407632[_0x5609('0x15')]()+_0x5609('0x5a'),_0x14eb2f[_0x5609('0x2f')]);logger['info']('['+_0x407632[_0x5609('0x15')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3bc8ba[_0x5609('0x29')]);return getTicket(_0x14eb2f,_0x357ad3,_0x40ed18,_0x24c85c,_0x3bc8ba,_0x47e533,_0x407632);})[_0x5609('0x11')](function(_0x5852ff){logger[_0x5609('0x22')](util[_0x5609('0x47')]('['+_0x407632[_0x5609('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x47e533[_0x5609('0x3a')],_0x5852ff[_0x5609('0x46')]));logger['info'](util[_0x5609('0x47')]('['+_0x407632['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x407632));if(_0x407632!==_0x5609('0x5b')){logger[_0x5609('0x22')]('['+_0x407632[_0x5609('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x357ad3[_0x5609('0xd')],_0x3ef4f5['name'],_0x47e533['ticketType'],_0x5852ff[_0x5609('0x46')]);}})[_0x5609('0x13')](function(_0x10df68){logger[_0x5609('0x14')]('['+_0x407632[_0x5609('0x15')]()+_0x5609('0x5c'),util[_0x5609('0x5d')](_0x10df68,{'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 a718eb2..5f38a73 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 _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 +var _0xf984=['debug','[HTTP]','string','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','toUpperCase','request-promise','md5','util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','then','length','Agent\x20found!','find','contact','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','apiKey','toString','base64'];(function(_0x50e89b,_0x4bded8){var _0x4b9202=function(_0x2b3dc6){while(--_0x2b3dc6){_0x50e89b['push'](_0x50e89b['shift']());}};_0x4b9202(++_0x4bded8);}(_0xf984,0x180));var _0x4f98=function(_0x4c7b5e,_0x4efbba){_0x4c7b5e=_0x4c7b5e-0x0;var _0x3f7e02=_0xf984[_0x4c7b5e];return _0x3f7e02;};'use strict';var _=require('lodash');var rp=require(_0x4f98('0x0'));var md5=require(_0x4f98('0x1'));var util=require(_0x4f98('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x4f98('0x3'));var logger=require(_0x4f98('0x4'))('freshdesk');config[_0x4f98('0x5')]=_['defaults'](config[_0x4f98('0x5')],{'host':_0x4f98('0x6'),'port':0x18eb});var io=require(_0x4f98('0x7'))(new Redis(config[_0x4f98('0x5')]));var headers={'Content-Type':'application/json','Accept':_0x4f98('0x8')};function emit(_0x269489,_0x151cc0,_0x56bdfb){io['to'](_0x269489)[_0x4f98('0x9')](_0x151cc0,_0x56bdfb);}function getTicket(_0x5976a4,_0x225630,_0x1a44bf,_0x5ae668,_0x2de651){logger[_0x4f98('0xa')](_0x4f98('0xb'));var _0x250d24=_[_0x4f98('0xc')]({'responder_id':_0x225630['id'],'requester_id':_0x1a44bf['id'],'name':util['format'](_0x4f98('0xd'),_0x2de651[_0x4f98('0xe')]),'phone':_0x2de651[_0x4f98('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4f98('0x10')](_0x5ae668[_0x4f98('0x11')],_0x2de651,'\x20'),'description':intUtil[_0x4f98('0x10')](_0x5ae668[_0x4f98('0x12')],_0x2de651,_0x4f98('0x13')),'tags':getTags(_0x5ae668[_0x4f98('0x14')],_0x4f98('0x15'))},getCustomFields(_0x5ae668[_0x4f98('0x16')],_0x2de651));_0x250d24[_0x4f98('0x17')]=_[_0x4f98('0x18')](_[_0x4f98('0x19')](_0x250d24[_0x4f98('0x17')],'id'),_0x4f98('0x1a'));return request({'uri':util[_0x4f98('0x1b')](_0x4f98('0x1c'),_0x5976a4['remoteUri']),'method':'POST','body':_0x250d24})['then'](function(_0x5ba792){logger[_0x4f98('0xa')](_0x4f98('0x1d'));return _0x5ba792;});}function getUser(_0x3a10e6,_0x354b75){if(intUtil[_0x4f98('0x1e')](_0x354b75)){return request({'uri':util[_0x4f98('0x1b')](_0x4f98('0x1f'),_0x3a10e6[_0x4f98('0x20')]),'qs':{'email':_0x354b75}})[_0x4f98('0x21')](function(_0x449809){if(_0x449809[_0x4f98('0x22')]){logger[_0x4f98('0xa')](_0x4f98('0x23'));return _[_0x4f98('0x24')](_0x449809,function(_0x3157a0){return _0x3157a0[_0x4f98('0x25')]['email']===_0x354b75;});}else{logger[_0x4f98('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x4f98('0x26'),_0x3a10e6[_0x4f98('0x20')])})[_0x4f98('0x21')](function(_0x5e5877){logger[_0x4f98('0xa')]('Admin\x20account\x20selected.');return _0x5e5877;});}});}else{logger[_0x4f98('0xa')](_0x4f98('0x27'));return request({'uri':util[_0x4f98('0x1b')](_0x4f98('0x26'),_0x3a10e6[_0x4f98('0x20')])})[_0x4f98('0x21')](function(_0x1ca437){logger['info'](_0x4f98('0x28'));return _0x1ca437;});}}function getEndUser(_0x198ec9,_0x1e5b3a,_0x3fd327){logger[_0x4f98('0xa')]('Searching\x20enduser\x20with\x20phone',_0x3fd327);return request({'uri':util['format'](_0x4f98('0x29'),_0x198ec9[_0x4f98('0x20')]),'qs':{'phone':_0x3fd327}})[_0x4f98('0x21')](function(_0x2db261){if(_0x2db261[_0x4f98('0x22')]){logger['info'](_0x4f98('0x2a'));return _[_0x4f98('0x24')](_0x2db261,{'phone':_0x3fd327});}else{logger[_0x4f98('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x4f98('0x1b')](_0x4f98('0x29'),_0x198ec9['remoteUri']),'method':'POST','body':{'name':_0x1e5b3a,'phone':_0x3fd327}})[_0x4f98('0x21')](function(_0x1e4744){logger[_0x4f98('0xa')]('Enduser\x20created.');return _0x1e4744;});}});}function getAuth(_0x29a8cb){return util[_0x4f98('0x1b')]('Basic\x20%s',new Buffer(_0x29a8cb[_0x4f98('0x2b')]+':X')[_0x4f98('0x2c')](_0x4f98('0x2d')));}function request(_0x2dd491){logger[_0x4f98('0x2e')](_0x4f98('0x2f'),JSON['stringify'](_0x2dd491));return rp(_['defaults'](_0x2dd491,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1ce0d6,_0xfec0d3){var _0x4b3a43=[];if(_0x1ce0d6&&_0x1ce0d6[_0x4f98('0x22')]>0x0){_0x4b3a43=_['map'](_0x1ce0d6,_0xfec0d3);}return _0x4b3a43;}function getCustomFields(_0x3aa4f7,_0x583202){var _0x5a442d=[];var _0x28a667={'custom_fields':[]};if(_0x3aa4f7['length']>0x0){_['forEach'](_0x3aa4f7,function(_0x33fb74){if(_0x33fb74['type']===_0x4f98('0x30')&&_0x33fb74[_0x4f98('0x31')]&&!_0x33fb74[_0x4f98('0x32')]){_0x28a667[_0x33fb74[_0x4f98('0x31')][_0x4f98('0x33')]()]=_0x33fb74[_0x4f98('0x34')][_0x4f98('0x2c')]();}else if(_0x33fb74[_0x4f98('0x35')]===_0x4f98('0x30')&&_0x33fb74[_0x4f98('0x36')]&&_0x33fb74[_0x4f98('0x32')]){_0x28a667['custom_fields'][_0x4f98('0x37')]({'id':_0x33fb74[_0x4f98('0x36')],'value':_0x33fb74[_0x4f98('0x34')][_0x4f98('0x2c')]()});}else if(_0x33fb74[_0x4f98('0x35')]===_0x4f98('0x38')&&_0x33fb74[_0x4f98('0x39')]&&_0x33fb74[_0x4f98('0x36')]&&_0x33fb74[_0x4f98('0x32')]){_0x583202[_0x33fb74[_0x4f98('0x39')]]&&_0x28a667[_0x4f98('0x17')][_0x4f98('0x37')]({'id':_0x33fb74[_0x4f98('0x36')],'value':_0x583202[_0x33fb74['variableName']]['toString']()});}else if(_0x33fb74[_0x4f98('0x35')]==='customVariable'&&_0x33fb74[_0x4f98('0x3a')]&&_0x33fb74[_0x4f98('0x3a')][_0x4f98('0x15')]&&_0x33fb74[_0x4f98('0x36')]&&_0x33fb74['customField']){_0x583202[_0x33fb74[_0x4f98('0x3a')][_0x4f98('0x15')][_0x4f98('0x33')]()]&&_0x28a667[_0x4f98('0x17')][_0x4f98('0x37')]({'id':_0x33fb74[_0x4f98('0x36')],'value':_0x583202[_0x33fb74[_0x4f98('0x3a')][_0x4f98('0x15')][_0x4f98('0x33')]()]['toString']()});}});}return _0x28a667;}exports[_0x4f98('0x3b')]=function(_0x310828,_0x49eb2c,_0x1c5c74,_0x540ac9,_0x5801dc,_0x17b164){var _0x5b96a4,_0x24d09e;_0x17b164[_0x4f98('0x20')]=intUtil[_0x4f98('0x3c')](_0x17b164[_0x4f98('0x20')]);_0x17b164[_0x4f98('0x3d')]=intUtil[_0x4f98('0x3c')](_0x17b164['serverUrl']);if(_0x5801dc&&_0x5801dc[_0x4f98('0x3e')]){logger[_0x4f98('0xa')](_0x4f98('0x3f'),_0x4f98('0x40'));_0x49eb2c[_0x4f98('0x41')]=util[_0x4f98('0x1b')](_0x4f98('0x42'),_0x17b164[_0x4f98('0x3d')],_0x49eb2c[_0x4f98('0x43')],md5(_0x49eb2c[_0x4f98('0x43')]));}else{_0x49eb2c['recordingURL']='';}headers['Authorization']=getAuth(_0x17b164);return getUser(_0x17b164,_0x540ac9[_0x4f98('0x44')])[_0x4f98('0x21')](function(_0x5ca3ac){_0x5b96a4=_0x5ca3ac;logger[_0x4f98('0xa')](_0x4f98('0x45'),_0x5b96a4['id']);return getEndUser(_0x17b164,_0x49eb2c[_0x4f98('0xe')],_0x49eb2c[_0x4f98('0xf')]);})[_0x4f98('0x21')](function(_0x26ef99){_0x24d09e=_0x26ef99;logger[_0x4f98('0xa')]('The\x20Enduser\x20ID\x20is:',_0x24d09e['id']);return getTicket(_0x17b164,_0x5b96a4,_0x24d09e,_0x1c5c74,_0x49eb2c);})[_0x4f98('0x21')](function(_0x17c9fb){if(_0x17c9fb&&_0x17c9fb['id']){logger[_0x4f98('0xa')](_0x4f98('0x1d'));logger[_0x4f98('0xa')]('The\x20Ticket\x20ID\x20is:',_0x17c9fb['id']);logger[_0x4f98('0xa')](_0x4f98('0x3f'),_0x4f98('0x46'));emit(util[_0x4f98('0x1b')](_0x4f98('0x47'),_0x540ac9['name']),_0x4f98('0x48'),{'uri':util['format'](_0x4f98('0x49'),_0x17b164[_0x4f98('0x20')],_0x17c9fb['id'])});}})[_0x4f98('0x4a')](function(_0x7356ba){logger[_0x4f98('0x4b')](_0x4f98('0x3f'),JSON[_0x4f98('0x4c')](_0x7356ba));});};exports[_0x4f98('0x4d')]=function(_0x2d9da6,_0x43f4b4,_0x166f40,_0xbc5834,_0x383ce8,_0x41ad00,_0x2b5058){var _0x3197c7,_0x207053;_0x41ad00['remoteUri']=intUtil['stripTrailingSlash'](_0x41ad00[_0x4f98('0x20')]);_0x41ad00[_0x4f98('0x3d')]=intUtil[_0x4f98('0x3c')](_0x41ad00['serverUrl']);if(_0x2b5058&&_0x2b5058['recordingFormat']&&_0x2b5058[_0x4f98('0x4e')]!==_0x4f98('0x4f')){logger[_0x4f98('0xa')]('[OUTBOUND]',_0x4f98('0x40'));_0x43f4b4['recordingURL']=util[_0x4f98('0x1b')](_0x4f98('0x42'),_0x41ad00['serverUrl'],_0x43f4b4[_0x4f98('0x43')],md5(_0x43f4b4[_0x4f98('0x43')]));}headers[_0x4f98('0x50')]=getAuth(_0x41ad00);return getUser(_0x41ad00,_0xbc5834[_0x4f98('0x44')])[_0x4f98('0x21')](function(_0x3255a7){_0x3197c7=_0x3255a7;logger['info'](_0x4f98('0x45'),_0x3197c7['id']);return getEndUser(_0x41ad00,_0x43f4b4[_0x4f98('0x51')],_0x43f4b4[_0x4f98('0x52')]);})['then'](function(_0x3d7af4){_0x207053=_0x3d7af4;logger[_0x4f98('0xa')](_0x4f98('0x53'),_0x207053['id']);return getTicket(_0x41ad00,_0x3197c7,_0x207053,_0x166f40,_0x43f4b4);})['then'](function(_0x1f7710){if(_0x1f7710&&_0x1f7710['id']){logger[_0x4f98('0xa')]('Ticket\x20created!');logger[_0x4f98('0xa')]('The\x20Ticket\x20ID\x20is:',_0x1f7710['id']);logger[_0x4f98('0xa')](_0x4f98('0x54'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x4f98('0x1b')]('user:%s',_0xbc5834[_0x4f98('0x15')]),_0x4f98('0x48'),{'uri':util[_0x4f98('0x1b')](_0x4f98('0x49'),_0x41ad00[_0x4f98('0x20')],_0x1f7710['id'])});}})[_0x4f98('0x4a')](function(_0x3139d9){logger[_0x4f98('0x4b')](_0x4f98('0x54'),JSON[_0x4f98('0x4c')](_0x3139d9));});};exports['unmanaged']=function(_0x424c00,_0x5920b9,_0x7070aa,_0x4f219e,_0x18935a,_0x3c9047){var _0x40d660,_0x52ea49;_0x3c9047[_0x4f98('0x20')]=intUtil[_0x4f98('0x3c')](_0x3c9047[_0x4f98('0x20')]);_0x3c9047[_0x4f98('0x3d')]=intUtil['stripTrailingSlash'](_0x3c9047['serverUrl']);if(_0x18935a&&_0x18935a[_0x4f98('0x3e')]){logger['info']('['+_0x5920b9['lastevent'][_0x4f98('0x55')]()+']','Recording\x20is\x20enabled!');_0x5920b9[_0x4f98('0x41')]=util[_0x4f98('0x1b')](_0x4f98('0x42'),_0x3c9047[_0x4f98('0x3d')],_0x5920b9[_0x4f98('0x43')],md5(_0x5920b9['uniqueid']));}else{_0x5920b9[_0x4f98('0x41')]='';}headers['Authorization']=getAuth(_0x3c9047);return getUser(_0x3c9047,'')[_0x4f98('0x21')](function(_0x105411){_0x40d660=_0x105411;logger[_0x4f98('0xa')](_0x4f98('0x45'),_0x40d660['id']);return getEndUser(_0x3c9047,_0x5920b9[_0x4f98('0xe')],_0x5920b9[_0x4f98('0xf')]);})[_0x4f98('0x21')](function(_0x2e46ab){_0x52ea49=_0x2e46ab;logger['info'](_0x4f98('0x53'),_0x52ea49['id']);return getTicket(_0x3c9047,_0x40d660,_0x52ea49,_0x7070aa,_0x5920b9);})[_0x4f98('0x21')](function(_0x2aa57f){if(_0x2aa57f){logger[_0x4f98('0xa')]('Ticket\x20created!');logger[_0x4f98('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2aa57f['id']);}})['catch'](function(_0x31d78c){logger[_0x4f98('0x4b')]('['+_0x5920b9['lastevent'][_0x4f98('0x55')]()+']',JSON['stringify'](_0x31d78c));});}; \ 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 e79c8ba..14e8407 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 _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 +var _0x4d87=['request-promise','md5','util','bluebird','ioredis','../../../../config/logger','freshsales','redis','defaults','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','catch','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','userId','User\x20found:','Admin\x20selected','Requested\x20Resource\x20not\x20Found','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Descriptions','add','ticketId','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','destcalleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect'];(function(_0xe5d5d3,_0x311893){var _0x4e4a97=function(_0x4707e3){while(--_0x4707e3){_0xe5d5d3['push'](_0xe5d5d3['shift']());}};_0x4e4a97(++_0x311893);}(_0x4d87,0xf0));var _0x74d8=function(_0x16f625,_0x5b12d5){_0x16f625=_0x16f625-0x0;var _0x30c011=_0x4d87[_0x16f625];return _0x30c011;};'use strict';var _=require('lodash');var rp=require(_0x74d8('0x0'));var md5=require(_0x74d8('0x1'));var util=require(_0x74d8('0x2'));var moment=require('moment');var Promise=require(_0x74d8('0x3'));var Redis=require(_0x74d8('0x4'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x74d8('0x5'))(_0x74d8('0x6'));config[_0x74d8('0x7')]=_[_0x74d8('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x74d8('0x7')]));function getAdminId(_0x3a3b78,_0x3e6af4,_0x2fb2ae,_0xac2e5d){return new Promise(function(_0x2e7799,_0x5e1ba0){var _0x924d2c=![];var _0xbf5ea1={'method':_0x74d8('0x9'),'uri':_0xac2e5d+_0x74d8('0xa'),'json':!![]};_0xbf5ea1[_0x74d8('0xb')]=_0x2fb2ae;logger[_0x74d8('0xc')](_0x74d8('0xd'));return rp(_0xbf5ea1)[_0x74d8('0xe')](function(_0x1ba1e5){if(_0x1ba1e5){var _0x4e5ec2=_0x1ba1e5[_0x74d8('0xf')];var _0x2d7a54=null;for(_0x2d7a54=0x0;_0x2d7a54<_0x4e5ec2['length'];_0x2d7a54++){if(_0x4e5ec2[_0x2d7a54][_0x74d8('0x10')]===_0x3a3b78[_0x74d8('0x11')]){_0x3a3b78[_0x74d8('0x12')]=_0x4e5ec2[_0x2d7a54]['id'];_0x924d2c=!![];}}if(_0x924d2c){logger[_0x74d8('0xc')](_0x74d8('0x13'),_0x3a3b78['adminId']);_0x2e7799(_0x3a3b78);}else{_0x5e1ba0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x5e1ba0({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x74d8('0x14')](function(_0x2ba0ce){logger[_0x74d8('0x15')]('['+[_0x3e6af4[_0x74d8('0x16')]()]+']',_0x2ba0ce[_0x74d8('0x17')]);_0x5e1ba0(_0x2ba0ce);});});}function getUser(_0x469148,_0x539c0c,_0x2da434){return function(_0x55334a){return new Promise(function(_0x24dd5d,_0x221da2){var _0x3ff6d1={'method':_0x74d8('0x9'),'uri':_0x2da434+_0x74d8('0xa'),'json':!![]};_0x3ff6d1[_0x74d8('0xb')]=_0x539c0c;logger[_0x74d8('0xc')]('Getting\x20user\x20list');return rp(_0x3ff6d1)[_0x74d8('0xe')](function(_0x2823f5){if(_0x2823f5){var _0x480b8a=_0x2823f5[_0x74d8('0xf')];var _0x3ea248=![];var _0x35d96a=null;if(_0x55334a[_0x74d8('0x18')]!==null){logger[_0x74d8('0xc')](_0x74d8('0x19'),_0x55334a[_0x74d8('0x18')]);_0x55334a[_0x74d8('0x1a')]=_0x55334a[_0x74d8('0x18')];for(_0x35d96a=0x0;_0x35d96a<_0x480b8a[_0x74d8('0x1b')];_0x35d96a++){if(_0x480b8a[_0x35d96a][_0x74d8('0x10')]===_0x55334a[_0x74d8('0x18')]){_0x3ea248=!![];_0x55334a[_0x74d8('0x1c')]=_0x480b8a[_0x35d96a]['id'];logger[_0x74d8('0xc')](_0x74d8('0x1d'),_0x55334a[_0x74d8('0x1c')]);}}}if(!_0x3ea248){logger[_0x74d8('0xc')](_0x74d8('0x1e'));_0x55334a[_0x74d8('0x1a')]=_0x55334a['adminEmail'];_0x55334a[_0x74d8('0x1c')]=_0x55334a[_0x74d8('0x12')];_0x3ea248=!![];}if(_0x3ea248){_0x24dd5d(_0x55334a);}else{_0x221da2({'statusCode':0x194,'message':_0x74d8('0x1f')});}}else{_0x221da2({'statusCode':0x194,'message':_0x74d8('0x1f')});}})[_0x74d8('0x14')](function(_0x243424){logger[_0x74d8('0x15')]('['+[_0x469148[_0x74d8('0x16')]()]+']',_0x243424[_0x74d8('0x17')]);_0x221da2(_0x243424);});});};}function searchContact(_0x2e8e5a,_0x3ba8e7,_0x4db2cf,_0xa51fc1){return new Promise(function(_0x2716dd,_0x54124d){var _0x2a4b15={'method':_0x74d8('0x9'),'headers':_0x3ba8e7,'uri':_0x2e8e5a+_0x74d8('0x20')+_0xa51fc1+_0x74d8('0x21')+_0x4db2cf+'&entities=contact','json':!![]};rp(_0x2a4b15)[_0x74d8('0xe')](function(_0x280640){var _0x1bf6ec=_[_0x74d8('0x22')](_0x280640['contacts'][_0x74d8('0x23')],[_0x4db2cf,_0xa51fc1]);_0x2716dd(_0x1bf6ec);})[_0x74d8('0x14')](function(_0x6bdf1d){_0x54124d(_0x6bdf1d);});});}function getEndUser(_0x14ebf6,_0x4bf210,_0x18c6a2){return function(_0x8eae17){return new Promise(function(_0x1608b4,_0x57fee4){logger[_0x74d8('0xc')](util[_0x74d8('0x24')](_0x74d8('0x25'),_0x8eae17[_0x74d8('0x26')]));searchContact(_0x18c6a2,_0x4bf210,_0x74d8('0x27'),_0x8eae17[_0x74d8('0x26')])[_0x74d8('0xe')](function(_0x226bf8){if(_0x226bf8){_0x8eae17[_0x74d8('0x28')]=_0x226bf8['id'];logger[_0x74d8('0xc')](_0x74d8('0x29'),_0x8eae17[_0x74d8('0x28')]);return _0x1608b4(_0x8eae17);}searchContact(_0x18c6a2,_0x4bf210,_0x74d8('0x2a'),_0x8eae17['contactNumber'])[_0x74d8('0xe')](function(_0xeb0dce){if(_0xeb0dce){_0x8eae17['endUserId']=_0xeb0dce['id'];logger[_0x74d8('0xc')](_0x74d8('0x2b'),_0x8eae17[_0x74d8('0x28')]);return _0x1608b4(_0x8eae17);}createEndUser(_0x8eae17,_0x14ebf6,_0x4bf210,_0x18c6a2)[_0x74d8('0xe')](function(_0x2d1b53){logger[_0x74d8('0xc')](_0x74d8('0x2c'),_0x2d1b53[_0x74d8('0x28')]);return _0x1608b4(_0x2d1b53);});});})['catch'](function(_0x1598fb){_0x57fee4(_0x1598fb);});});};}function createEndUser(_0x408eb8,_0xbcf109,_0x2a7363,_0xb10f74){return new Promise(function(_0x2aa92c,_0x35211e){var _0x893285=moment();var _0x2616e1={'method':_0x74d8('0x2d'),'uri':_0xb10f74+'/api/contacts','body':{'contact':{'last_name':_0x408eb8[_0x74d8('0x26')],'work_number':_0x408eb8[_0x74d8('0x26')],'mobile_number':_0x408eb8[_0x74d8('0x26')],'owner_id':_0x408eb8[_0x74d8('0x1c')],'created_at':_0x893285[_0x74d8('0x24')](_0x74d8('0x2e'))}},'json':!![]};_0x2616e1[_0x74d8('0xb')]=_0x2a7363;logger[_0x74d8('0xc')](_0x74d8('0x2f'));return rp(_0x2616e1)[_0x74d8('0xe')](function(_0x26eafc){_0x408eb8[_0x74d8('0x28')]=_0x26eafc[_0x74d8('0x30')]['id'];_0x2aa92c(_0x408eb8);})[_0x74d8('0x14')](function(_0x3cb08a){logger[_0x74d8('0x15')]('['+[_0xbcf109[_0x74d8('0x16')]()]+']',_0x3cb08a[_0x74d8('0x17')]);_0x35211e(_0x3cb08a[_0x74d8('0x17')]);});});}function getTicket(_0x2aa861,_0x1f3a81,_0x248af4,_0x554161,_0x2f7ff4){return function(_0x3c16f8){logger[_0x74d8('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x1c27b4,_0x5bcbf7){var _0x52fa7d=moment();var _0x2f0a1b={'method':_0x74d8('0x2d'),'uri':_0x248af4+_0x74d8('0x31'),'body':{'title':intUtil[_0x74d8('0x32')](_0x554161[_0x74d8('0x33')],_0x2f7ff4,'\x20'),'description':intUtil[_0x74d8('0x32')](_0x554161[_0x74d8('0x34')],_0x2f7ff4,'\x0a'),'owner_id':_0x3c16f8[_0x74d8('0x1c')],'creater_id':_0x3c16f8['adminId'],'targetable_id':_0x3c16f8[_0x74d8('0x28')],'targetable_type':'Contact','created_at':_0x52fa7d['format'](_0x74d8('0x2e')),'due_date':_0x52fa7d[_0x74d8('0x35')](0x1e,'m')[_0x74d8('0x24')](_0x74d8('0x2e'))},'json':!![]};_0x2f0a1b['headers']=_0x1f3a81;return rp(_0x2f0a1b)['then'](function(_0x2e5571){_0x3c16f8[_0x74d8('0x36')]=_0x2e5571['task']['id'];logger[_0x74d8('0xc')](_0x74d8('0x37'),_0x3c16f8[_0x74d8('0x36')]);_0x1c27b4(_0x3c16f8);})[_0x74d8('0x14')](function(_0x2efeed){logger[_0x74d8('0x15')]('['+[_0x2aa861[_0x74d8('0x16')]()]+']',_0x2efeed['message']);_0x5bcbf7(_0x2efeed[_0x74d8('0x17')]);});});};}function emit(_0x4bb427,_0x3e2fe0,_0x57d7ec){var _0x427a6b={'uri':_0x4bb427+_0x74d8('0x38')+_0x57d7ec};io['to'](util['format'](_0x74d8('0x39'),_0x3e2fe0))['emit'](_0x74d8('0x3a'),_0x427a6b);}exports['cs']=function(_0x2a114b,_0x470dff,_0x5500a1,_0x4821b4,_0x15e92a,_0x4734cf,_0xfa95d3,_0x5ad483){var _0x4bca6a={};var _0xe6ad84={'Authorization':_0x74d8('0x3b')+_0x4734cf[_0x74d8('0x3c')]};_0x4734cf['remoteUri']=intUtil[_0x74d8('0x3d')](_0x4734cf[_0x74d8('0x3e')]);_0x4734cf['serverUrl']=intUtil[_0x74d8('0x3d')](_0x4734cf[_0x74d8('0x3f')]);var _0x342ecd=_0x4734cf[_0x74d8('0x3e')];_0x4bca6a[_0x74d8('0x11')]=_0x4734cf[_0x74d8('0x40')];_0x4bca6a[_0x74d8('0x26')]=_0x5ad483[_0x74d8('0x41')]()==='outbound'?_0x470dff[_0x74d8('0x42')]:_0x470dff['calleridnum'];_0x4bca6a[_0x74d8('0x43')]=_0x5ad483==='queue'||_0x5ad483===_0x74d8('0x44')?_0x74d8('0x45'):'outbound';if(_0x4821b4){_0x4bca6a[_0x74d8('0x18')]=_0x4821b4[_0x74d8('0x10')];}var _0x54ec94=util[_0x74d8('0x24')](_0x74d8('0x46'),_0x4734cf[_0x74d8('0x3f')],_0x470dff[_0x74d8('0x47')],md5(_0x470dff['uniqueid']));if(_0x15e92a&&_0x15e92a['monitor_format']){logger['info'](_0x74d8('0x48'),_0x74d8('0x49'));_0x470dff[_0x74d8('0x4a')]=_0x54ec94;}else if(_0xfa95d3&&_0xfa95d3['recordingFormat']&&_0xfa95d3[_0x74d8('0x4b')]!==_0x74d8('0x4c')){logger[_0x74d8('0xc')]('[OUTBOUND]',_0x74d8('0x49'));_0x470dff['recordingURL']=_0x54ec94;}else{_0x470dff[_0x74d8('0x4a')]='';}return getAdminId(_0x4bca6a,_0x5ad483,_0xe6ad84,_0x342ecd)[_0x74d8('0xe')](getUser(_0x5ad483,_0xe6ad84,_0x342ecd))[_0x74d8('0xe')](getEndUser(_0x5ad483,_0xe6ad84,_0x342ecd))[_0x74d8('0xe')](getTicket(_0x5ad483,_0xe6ad84,_0x342ecd,_0x5500a1,_0x470dff))[_0x74d8('0xe')](function(_0xacff03){logger[_0x74d8('0xc')](util[_0x74d8('0x24')]('The\x20ticket\x20ID\x20is:\x20%s',_0xacff03[_0x74d8('0x36')]));if(_0x5ad483!=='unmanaged'){logger[_0x74d8('0xc')]('['+[_0x5ad483[_0x74d8('0x16')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x342ecd,_0x4821b4[_0x74d8('0x4d')],_0xacff03[_0x74d8('0x28')]);}})[_0x74d8('0x14')](function(_0x19149b){logger[_0x74d8('0x15')]('['+[_0x5ad483[_0x74d8('0x16')]()]+_0x74d8('0x4e'),util[_0x74d8('0x4f')](_0x19149b,{'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 c754c58..cd1be60 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(_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 +var _0x1775=['queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1','data2','find','Configurations','data3'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var zendesk=require(_0x5177('0x1'));var salesforce=require(_0x5177('0x2'));var sugarcrm=require(_0x5177('0x3'));var freshdesk=require(_0x5177('0x4'));var zoho=require(_0x5177('0x5'));var desk=require(_0x5177('0x6'));var vtiger=require(_0x5177('0x7'));var servicenow=require(_0x5177('0x8'));var dynamics365=require(_0x5177('0x9'));var freshsales=require(_0x5177('0xa'));var integrations=[_0x5177('0xb'),_0x5177('0xc'),_0x5177('0xd'),_0x5177('0xe'),_0x5177('0xf'),_0x5177('0x10'),_0x5177('0x11'),_0x5177('0x12'),_0x5177('0x13'),_0x5177('0x14')];exports[_0x5177('0x15')]=function(_0x5bdca9,_0x4ae3d2,_0x13c7f6,_0x1d7116,_0xf3ce11,_0x227316){if(_0x13c7f6){if(_[_0x5177('0x16')](integrations,_0x5bdca9['data1'][_0x5177('0x17')]())){try{var _0x22fe21=null;var _0xc613b9='';var _0x3c4ced=_0x13c7f6[_0x5bdca9[_0x5177('0x18')][_0x5177('0x17')]()];if(_0x3c4ced){var _0x1ab4f1=_0x3c4ced[_0x5bdca9[_0x5177('0x19')]];if(_0x1ab4f1){var _0x3e6224=_[_0x5177('0x1a')](_0x1ab4f1[_0x5177('0x1b')],{'id':parseInt(_0x5bdca9[_0x5177('0x1c')],0xa)});if(_0x3e6224){if(_0x1d7116){if(_0xf3ce11&&_0x4ae3d2[_0x5177('0x1d')]){_0xc613b9=_0x5177('0x1d');}else if(_0x4ae3d2[_0x5177('0x1e')]){_0xc613b9=_0x5177('0x1f');}else{console[_0x5177('0x20')](_0x5177('0x21'),_0x4ae3d2);}}else{_0xc613b9=_0x5177('0x22');}switch(_0x5bdca9['data1'][_0x5177('0x17')]()){case _0x5177('0xb'):zendesk[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0xc'):salesforce[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0xd'):sugarcrm[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case'freshdesk':freshdesk[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0xf'):zoho[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0x10'):desk[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case _0x5177('0x11'):vtiger[_0xc613b9](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316);break;case'freshsales':freshsales['cs'](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316,_0xc613b9);break;case _0x5177('0x14'):servicenow['cs'](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316,_0xc613b9);break;case'dynamics365':dynamics365['cs'](_0x5bdca9,_0x4ae3d2,_0x3e6224,_0x1d7116,_0xf3ce11,_0x1ab4f1,_0x227316,_0xc613b9);break;default:console[_0x5177('0x20')](_0x5177('0x23'));}}else{_0x22fe21=require(_0x5177('0x24'))(_0x5bdca9[_0x5177('0x18')][_0x5177('0x17')]());_0x22fe21[_0x5177('0x25')](_0x5177('0x26'),util[_0x5177('0x27')](_0x5177('0x28'),_0x5bdca9[_0x5177('0x18')][_0x5177('0x17')](),_0x5bdca9[_0x5177('0x1c')]));}}else{_0x22fe21=require('../../../../config/logger')(_0x5bdca9[_0x5177('0x18')]['toLowerCase']());_0x22fe21[_0x5177('0x25')](_0x5177('0x26'),util[_0x5177('0x27')](_0x5177('0x29'),_0x5bdca9['data1'][_0x5177('0x17')](),_0x5bdca9['data2']));}}else{}}catch(_0x564139){console[_0x5177('0x25')](_0x564139);}}}}; \ 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 b0bcb22..3e39e4e 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 _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 +var _0xa3e5=['login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','stringify','unmanaged','lastevent','isNil',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','assign','utc','getString','Subjects','WhoId','Case','Descriptions','ContactId','sobject','create','validateEmail','User','find','execute','then','Email','info','Agent\x20%s\x20found.','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','length','contact','Contact','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','lead','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','No\x20Company','upperFirst','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientSecret'];(function(_0x228640,_0x12a8e1){var _0x1189a6=function(_0x57cb97){while(--_0x57cb97){_0x228640['push'](_0x228640['shift']());}};_0x1189a6(++_0x12a8e1);}(_0xa3e5,0x1f0));var _0x5a3e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa3e5[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x5a3e('0x0'));var rp=require(_0x5a3e('0x1'));var moment=require('moment');var BPromise=require(_0x5a3e('0x2'));var md5=require(_0x5a3e('0x3'));var jsforce=require(_0x5a3e('0x4'));var util=require(_0x5a3e('0x5'));var Redis=require(_0x5a3e('0x6'));var intUtil=require('./util');var config=require(_0x5a3e('0x7'));var logger=require(_0x5a3e('0x8'))(_0x5a3e('0x9'));config[_0x5a3e('0xa')]=_[_0x5a3e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5a3e('0xc'))(new Redis(config[_0x5a3e('0xa')]));function emit(_0x59b174,_0x12bf77,_0x315a66){io['to'](_0x59b174)[_0x5a3e('0xd')](_0x12bf77,_0x315a66);}function getTicket(_0x16aabb,_0x12110f,_0x2a53fe,_0x5a5645,_0x3d00cf,_0x8bc645,_0x5e32db,_0x215b6f){var _0x5907ae={};if(_0x5a5645[_0x5a3e('0xe')]==='Task'){_0x5907ae=Object[_0x5a3e('0xf')]({},{'OwnerId':_0x12110f['id'],'ActivityDate':moment[_0x5a3e('0x10')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x5a3e('0x11')](_0x5a5645[_0x5a3e('0x12')],_0x3d00cf,'\x20'),'Description':intUtil[_0x5a3e('0x11')](_0x5a5645['Descriptions'],_0x3d00cf,'\x0a')},getCustomFields(_0x8bc645,_0x3d00cf));if(_0x2a53fe){_0x5907ae[_0x5a3e('0x13')]=_0x2a53fe['id'];}}else if(_0x5a5645[_0x5a3e('0xe')]===_0x5a3e('0x14')){_0x5907ae=Object[_0x5a3e('0xf')]({},{'OwnerId':_0x12110f['id'],'Subject':intUtil['getString'](_0x5a5645[_0x5a3e('0x12')],_0x3d00cf,'\x20'),'Description':intUtil[_0x5a3e('0x11')](_0x5a5645[_0x5a3e('0x15')],_0x3d00cf,'\x0a')},getCustomFields(_0x8bc645,_0x3d00cf));if(_0x2a53fe){_0x5907ae[_0x5a3e('0x16')]=_0x2a53fe['id'];}}return _0x5e32db[_0x5a3e('0x17')](_0x5a5645[_0x5a3e('0xe')])[_0x5a3e('0x18')](_0x5907ae);}function getUser(_0xb3c15f,_0x5c2367,_0x2256c4){if(!_['isNil'](_0x5c2367)&&intUtil[_0x5a3e('0x19')](_0x5c2367)){var _0x39f90a={'Email':_0x5c2367};var _0x54e407={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2256c4[_0x5a3e('0x17')](_0x5a3e('0x1a'))[_0x5a3e('0x1b')](_0x39f90a,_0x54e407)[_0x5a3e('0x1c')]()[_0x5a3e('0x1d')](function(_0x1ae5de){if(_0x1ae5de['length']){var _0x3f88a8=_[_0x5a3e('0x1b')](_0x1ae5de,function(_0x2f67cc){return _0x2f67cc[_0x5a3e('0x1e')]===_0x5c2367;});if(_0x3f88a8){logger[_0x5a3e('0x1f')](_0x5a3e('0x20'),_0x5c2367);return BPromise[_0x5a3e('0x21')]({'id':_0x3f88a8['Id'],'name':_0x3f88a8[_0x5a3e('0x22')]});}}else{logger[_0x5a3e('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x5c2367);return _0x2256c4[_0x5a3e('0x23')]()[_0x5a3e('0x1d')](function(_0xa737d3){return BPromise['resolve']({'id':_0xa737d3[_0x5a3e('0x24')],'name':_0xa737d3[_0x5a3e('0x25')]});});}});}else{logger[_0x5a3e('0x1f')](_0x5a3e('0x26'),_0x5c2367);return _0x2256c4[_0x5a3e('0x23')]()[_0x5a3e('0x1d')](function(_0x460f7f){return BPromise[_0x5a3e('0x21')]({'id':_0x460f7f[_0x5a3e('0x24')],'name':_0x460f7f[_0x5a3e('0x25')]});});}}function getEndUser(_0x16a31e,_0x1efec7,_0xb44758,_0x56fbde,_0x2d76cb){var _0x9a278f={'Phone':_0x56fbde};var _0x9e5119={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x5a3e('0x1d')](function(){if(_0x1efec7[_0x5a3e('0xe')]===_0x5a3e('0x27')){logger[_0x5a3e('0x1f')](_0x5a3e('0x28'),_0x56fbde,_0x1efec7['moduleSearch']);switch(_0x1efec7[_0x5a3e('0x29')]){case _0x5a3e('0x2a'):return _0x2d76cb[_0x5a3e('0x17')]('Contact')[_0x5a3e('0x1b')](_0x9a278f,_0x9e5119)[_0x5a3e('0x1c')]()[_0x5a3e('0x1d')](function(_0x3ace12){if(_0x3ace12&&_0x3ace12[_0x5a3e('0x2b')]){return _0x3ace12;}else{return _0x2d76cb['sobject']('Lead')[_0x5a3e('0x1b')](_0x9a278f,_0x9e5119);}});case _0x5a3e('0x2c'):return _0x2d76cb[_0x5a3e('0x17')](_0x5a3e('0x2d'))[_0x5a3e('0x1b')](_0x9a278f,_0x9e5119)['execute']();case'lead':return _0x2d76cb['sobject']('Lead')['find'](_0x9a278f,_0x9e5119);default:return null;}}else if(_0x1efec7['ticketType']===_0x5a3e('0x14')){logger[_0x5a3e('0x1f')](_0x5a3e('0x28'),_0x56fbde,_0x5a3e('0x2c'));return _0x2d76cb[_0x5a3e('0x17')](_0x5a3e('0x2d'))['find'](_0x9a278f,_0x9e5119)[_0x5a3e('0x1c')]();}})[_0x5a3e('0x1d')](function(_0x52c044){if(_0x52c044&&_0x52c044['length']){var _0x2cd9dc=_[_0x5a3e('0x1b')](_0x52c044,function(_0xd38271){return _0xd38271[_0x5a3e('0x2e')]===_0x56fbde;});if(_0x2cd9dc){return BPromise['resolve']({'id':_0x2cd9dc['Id'],'name':_0x2cd9dc[_0x5a3e('0x22')],'phone':_0x2cd9dc[_0x5a3e('0x2e')]});}}})['then'](function(_0x50ac65){if(_0x50ac65){logger['info']('Enduser\x20with\x20phone\x20%s\x20found.',_0x56fbde);return BPromise[_0x5a3e('0x21')](_0x50ac65);}else{logger['info'](_0x5a3e('0x2f'),_0x56fbde);var _0xdae9={'LastName':_0xb44758!==_0x5a3e('0x30')?_0xb44758:util[_0x5a3e('0x31')](_0x5a3e('0x32'),_0x56fbde),'Phone':_0x56fbde};if(_0x1efec7[_0x5a3e('0x33')]){if(_0x1efec7[_0x5a3e('0x33')]===_0x5a3e('0x2c')){logger[_0x5a3e('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x56fbde,_0x1efec7[_0x5a3e('0x33')]);}else if(_0x1efec7[_0x5a3e('0x33')]===_0x5a3e('0x34')&&_0x1efec7[_0x5a3e('0xe')]===_0x5a3e('0x27')){logger[_0x5a3e('0x1f')](_0x5a3e('0x35'),_0x56fbde,_0x1efec7[_0x5a3e('0x33')]);_0xdae9['Company']=_0x5a3e('0x36');}else{return null;}}return _0x2d76cb[_0x5a3e('0x17')](_[_0x5a3e('0x37')](_0x1efec7[_0x5a3e('0x33')]))[_0x5a3e('0x18')](_0xdae9);}});}function getCustomFields(_0x51fd9e,_0x2a5abf){var _0x3afe28={};if(_0x51fd9e['length']>0x0){_[_0x5a3e('0x38')](_0x51fd9e,function(_0x74bb6e){if(_0x74bb6e[_0x5a3e('0x39')]===_0x5a3e('0x3a')&&_0x74bb6e[_0x5a3e('0x3b')]){_0x3afe28[_0x74bb6e['idField']]=_0x74bb6e[_0x5a3e('0x3c')][_0x5a3e('0x3d')]();}else if(_0x74bb6e[_0x5a3e('0x39')]===_0x5a3e('0x3e')&&_0x74bb6e[_0x5a3e('0x3f')]&&_0x74bb6e[_0x5a3e('0x3b')]){_0x2a5abf[_0x74bb6e[_0x5a3e('0x3f')]]&&(_0x3afe28[_0x74bb6e['idField']]=_0x2a5abf[_0x74bb6e[_0x5a3e('0x3f')]]['toString']());}else if(_0x74bb6e[_0x5a3e('0x39')]===_0x5a3e('0x40')&&_0x74bb6e[_0x5a3e('0x41')]&&_0x74bb6e[_0x5a3e('0x41')][_0x5a3e('0x42')]&&_0x74bb6e[_0x5a3e('0x3b')]){_0x2a5abf[_0x74bb6e[_0x5a3e('0x41')]['name'][_0x5a3e('0x43')]()]&&(_0x3afe28[_0x74bb6e[_0x5a3e('0x3b')]]=_0x2a5abf[_0x74bb6e[_0x5a3e('0x41')][_0x5a3e('0x42')][_0x5a3e('0x43')]()][_0x5a3e('0x3d')]());}});}return _0x3afe28;}function getConnection(_0x104a2d){var _0x44606e=_0x104a2d[_0x5a3e('0x44')][_0x5a3e('0x45')](_0x104a2d[_0x5a3e('0x46')]);var _0x1786fc=new jsforce[(_0x5a3e('0x47'))]({'oauth2':{'loginUrl':_0x104a2d['remoteUri']||_0x5a3e('0x48'),'clientId':_0x104a2d['clientId'],'clientSecret':_0x104a2d[_0x5a3e('0x49')]}});return _0x1786fc[_0x5a3e('0x4a')](_0x104a2d['username'],_0x44606e)['then'](function(){logger[_0x5a3e('0x1f')](_0x5a3e('0x4b'));return _0x1786fc;});}exports[_0x5a3e('0x4c')]=function(_0x4615f4,_0x354b28,_0x4cb430,_0x1a147a,_0xf50d7d,_0x364252){var _0x37b03a,_0x5c3716,_0x1d4486,_0x1e4f53;_0x364252[_0x5a3e('0x4d')]=intUtil[_0x5a3e('0x4e')](_0x364252[_0x5a3e('0x4d')]);_0x364252[_0x5a3e('0x4f')]=intUtil[_0x5a3e('0x4e')](_0x364252[_0x5a3e('0x4f')]);if(_0xf50d7d&&_0xf50d7d[_0x5a3e('0x50')]){logger[_0x5a3e('0x1f')]('[QUEUE]',_0x5a3e('0x51'));_0x354b28['recordingURL']=util[_0x5a3e('0x31')](_0x5a3e('0x52'),_0x364252[_0x5a3e('0x4d')],_0x354b28[_0x5a3e('0x53')],md5(_0x354b28[_0x5a3e('0x53')]));}else{_0x354b28[_0x5a3e('0x54')]='';}return getConnection(_0x364252)[_0x5a3e('0x1d')](function(_0x289f66){_0x1e4f53=_0x289f66;return getUser(_0x364252,_0x1a147a[_0x5a3e('0x55')],_0x1e4f53);})[_0x5a3e('0x1d')](function(_0x1dfe7f){_0x37b03a=_0x1dfe7f;return getEndUser(_0x364252,_0x4cb430,_0x354b28[_0x5a3e('0x56')],_0x354b28[_0x5a3e('0x57')],_0x1e4f53);})['then'](function(_0x2a68f5){_0x5c3716=_0x2a68f5;return getTicket(_0x364252,_0x37b03a,_0x5c3716,_0x4cb430,_0x354b28,_0x4cb430['Fields'],_0x1e4f53,_0x5a3e('0x4c'));})['then'](function(_0x503d17){_0x1d4486=_0x503d17;logger[_0x5a3e('0x1f')](_0x5a3e('0x58'),_0x1d4486['id']);logger[_0x5a3e('0x1f')](_0x5a3e('0x59'),_0x1d4486['id'],_0x1a147a[_0x5a3e('0x42')],_0x364252['type']);switch(_0x364252[_0x5a3e('0x39')]){case _0x5a3e('0x5a'):emit(util[_0x5a3e('0x31')](_0x5a3e('0x5b'),_0x1a147a['name']),_0x5a3e('0x5c'),{'recordId':_0x1d4486['id']});break;case _0x5a3e('0x5d'):emit(util[_0x5a3e('0x31')]('user:%s',_0x1a147a['name']),_0x5a3e('0x5e'),{'uri':util['format'](_0x5a3e('0x5f'),_0x1e4f53[_0x5a3e('0x60')],_0x1d4486['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x13c90e){logger[_0x5a3e('0x61')](_0x5a3e('0x62'),JSON['stringify'](_0x13c90e));});};exports[_0x5a3e('0x63')]=function(_0x4e31bc,_0x3fcba6,_0xa29b8,_0x1eb5fe,_0xc4aeeb,_0x37b57b,_0x280e44){var _0x268d49,_0x4ab94d,_0x5fab9f,_0x27061c;_0x37b57b[_0x5a3e('0x4d')]=intUtil[_0x5a3e('0x4e')](_0x37b57b[_0x5a3e('0x4d')]);_0x37b57b[_0x5a3e('0x4f')]=intUtil[_0x5a3e('0x4e')](_0x37b57b['remoteUri']);if(_0x280e44&&_0x280e44[_0x5a3e('0x64')]&&_0x280e44[_0x5a3e('0x64')]!=='none'){logger[_0x5a3e('0x1f')](_0x5a3e('0x65'),_0x5a3e('0x51'));_0x3fcba6[_0x5a3e('0x54')]=util['format'](_0x5a3e('0x52'),_0x37b57b[_0x5a3e('0x4d')],_0x3fcba6[_0x5a3e('0x53')],md5(_0x3fcba6[_0x5a3e('0x53')]));}return getConnection(_0x37b57b)[_0x5a3e('0x1d')](function(_0x55f393){_0x27061c=_0x55f393;return getUser(_0x37b57b,_0x1eb5fe['email'],_0x27061c);})[_0x5a3e('0x1d')](function(_0xda49c8){_0x268d49=_0xda49c8;return getEndUser(_0x37b57b,_0xa29b8,_0x3fcba6[_0x5a3e('0x66')],_0x3fcba6['destcalleridnum'],_0x27061c);})[_0x5a3e('0x1d')](function(_0x271c92){_0x4ab94d=_0x271c92;return getTicket(_0x37b57b,_0x268d49,_0x4ab94d,_0xa29b8,_0x3fcba6,_0xa29b8[_0x5a3e('0x67')],_0x27061c,_0x5a3e('0x63'));})[_0x5a3e('0x1d')](function(_0x280ea8){_0x5fab9f=_0x280ea8;logger[_0x5a3e('0x1f')](_0x5a3e('0x68'),_0x5fab9f['id']);logger[_0x5a3e('0x1f')](_0x5a3e('0x69'),_0x5fab9f['id'],_0x1eb5fe['name'],_0x37b57b[_0x5a3e('0x39')]);switch(_0x37b57b['type']){case _0x5a3e('0x5a'):emit(util[_0x5a3e('0x31')](_0x5a3e('0x5b'),_0x1eb5fe[_0x5a3e('0x42')]),_0x5a3e('0x5c'),{'recordId':_0x5fab9f['id']});break;case _0x5a3e('0x5d'):emit(util[_0x5a3e('0x31')](_0x5a3e('0x5b'),_0x1eb5fe['name']),_0x5a3e('0x5e'),{'uri':util[_0x5a3e('0x31')]('%s/%s/e',_0x27061c[_0x5a3e('0x60')],_0x5fab9f['id'])});break;default:logger[_0x5a3e('0x61')]('[OUTBOUND]',_0x5a3e('0x6a'));}})['catch'](function(_0x5ac2d3){logger[_0x5a3e('0x61')](_0x5a3e('0x65'),JSON[_0x5a3e('0x6b')](_0x5ac2d3));});};exports[_0x5a3e('0x6c')]=function(_0x1bb4a4,_0x4074ac,_0x5828d0,_0x389e2a,_0x3e5e38,_0x1f5f18){var _0x42c7e9,_0x8c8162,_0x3d3f63,_0x22b50c;_0x1f5f18[_0x5a3e('0x4d')]=intUtil['stripTrailingSlash'](_0x1f5f18[_0x5a3e('0x4d')]);_0x1f5f18[_0x5a3e('0x4f')]=intUtil[_0x5a3e('0x4e')](_0x1f5f18[_0x5a3e('0x4f')]);if(_0x3e5e38&&_0x3e5e38[_0x5a3e('0x50')]){logger[_0x5a3e('0x1f')]('['+_0x4074ac[_0x5a3e('0x6d')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4074ac[_0x5a3e('0x54')]=util[_0x5a3e('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1f5f18[_0x5a3e('0x4d')],_0x4074ac[_0x5a3e('0x53')],md5(_0x4074ac['uniqueid']));}else{_0x4074ac['recordingURL']='';}return getConnection(_0x1f5f18)['then'](function(_0x36e91f){_0x22b50c=_0x36e91f;if(!_[_0x5a3e('0x6e')](_0x389e2a)){return getUser(_0x1f5f18,_0x389e2a[_0x5a3e('0x42')],_0x22b50c);}else{return getUser(_0x1f5f18,null,_0x22b50c);}})[_0x5a3e('0x1d')](function(_0x377151){_0x42c7e9=_0x377151;return getEndUser(_0x1f5f18,_0x5828d0,_0x4074ac[_0x5a3e('0x56')],_0x4074ac[_0x5a3e('0x57')],_0x22b50c);})['then'](function(_0x1bd441){_0x8c8162=_0x1bd441;return getTicket(_0x1f5f18,_0x42c7e9,_0x8c8162,_0x5828d0,_0x4074ac,_0x5828d0['Fields'],_0x22b50c);})['then'](function(_0x2ae4e2){_0x3d3f63=_0x2ae4e2;logger['info']('['+_0x4074ac[_0x5a3e('0x6d')]['toUpperCase']()+_0x5a3e('0x6f'),_0x3d3f63['id']);logger[_0x5a3e('0x1f')]('['+_0x4074ac[_0x5a3e('0x6d')][_0x5a3e('0x70')]()+_0x5a3e('0x71'),_0x1f5f18[_0x5a3e('0x39')]);})['catch'](function(_0x54f73d){logger['error']('['+_0x4074ac[_0x5a3e('0x6d')]['toUpperCase']()+']',JSON[_0x5a3e('0x6b')](_0x54f73d));});}; \ 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 b545ca1..d99a543 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 _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 +var _0x7a54=['getString','Descriptions','Fields','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','type','string','nameField','customField','idField','toLowerCase','content','toString','variable','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x7a54,0x106));var _0x47a5=function(_0x8e0e35,_0x59dd59){_0x8e0e35=_0x8e0e35-0x0;var _0x35824b=_0x7a54[_0x8e0e35];return _0x35824b;};'use strict';var _=require(_0x47a5('0x0'));var Promise=require(_0x47a5('0x1'));var rp=require(_0x47a5('0x2'));var util=require('util');var md5=require(_0x47a5('0x3'));var Redis=require(_0x47a5('0x4'));var intUtil=require('./util');var config=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));function getAdminUser(_0x30e405,_0x506eda,_0x194fb0,_0x5077f3,_0x5d90b3,_0x582352){return new Promise(function(_0x2a0e98,_0x2baee7){var _0x5e31dd={'method':_0x47a5('0xb'),'uri':_0x5077f3+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5d90b3+'&'+_0x582352,'auth':_0x506eda,'json':!![]};return rp(_0x5e31dd)['then'](function(_0x1f47f4){if(_0x1f47f4[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x194fb0[_0x47a5('0xe')]=_0x1f47f4[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}logger[_0x47a5('0x10')]('['+[_0x30e405['toUpperCase']()]+_0x47a5('0x11'),_0x194fb0);_0x2a0e98(_0x194fb0);})[_0x47a5('0x12')](function(_0x1cf309){logger[_0x47a5('0x13')]('['+[_0x30e405[_0x47a5('0x14')]()]+']',_0x1cf309[_0x47a5('0x15')]);_0x2baee7(_0x1cf309[_0x47a5('0x15')]);});});}function getUser(_0x190faa,_0x4e99a8,_0x362359,_0x11faf5,_0x3b001e){return function(_0x2a2cbb){logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x2a2cbb);return new Promise(function(_0x138bc0,_0x4b966e){if(intUtil['validateEmail'](_0x2a2cbb[_0x47a5('0x16')])){var _0xaf70a6={'method':_0x47a5('0xb'),'uri':_0x362359+_0x47a5('0x17')+_0x2a2cbb[_0x47a5('0x16')]+'&'+_0x11faf5+'&'+_0x3b001e,'auth':_0x4e99a8,'json':!![]};logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x18'),_0xaf70a6);return rp(_0xaf70a6)[_0x47a5('0x19')](function(_0x4a9fcb){logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+'],\x20getUser\x20entity',_0x4a9fcb);if(_0x4a9fcb[_0x47a5('0xc')][_0x47a5('0xd')]>0x0&&String(_0x4a9fcb[_0x47a5('0xc')][0x0]['active'])===_0x47a5('0x1a')){_0x2a2cbb[_0x47a5('0x1b')]=_0x4a9fcb[_0x47a5('0xc')][0x0][_0x47a5('0xf')];}else{_0x2a2cbb['userId']=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb['adminEmail'];}logger[_0x47a5('0x10')]('['+[_0x190faa[_0x47a5('0x14')]()]+_0x47a5('0x1c'),_0x2a2cbb);_0x138bc0(_0x2a2cbb);})[_0x47a5('0x12')](function(_0x3abd6a){logger['error']('['+[_0x190faa['toUpperCase']()]+']',_0x3abd6a[_0x47a5('0x15')]);_0x4b966e(_0x3abd6a['message']);});}else{logger[_0x47a5('0x10')]('['+[_0x190faa['toUpperCase']()]+_0x47a5('0x1d'));_0x2a2cbb[_0x47a5('0x1b')]=_0x2a2cbb[_0x47a5('0xe')];_0x2a2cbb[_0x47a5('0x16')]=_0x2a2cbb[_0x47a5('0x1e')];_0x138bc0(_0x2a2cbb);}});};}function createEndUser(_0x3ba0b7,_0x24b162,_0x136b14,_0x16631f,_0x361bfa){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+_0x47a5('0x1f'),_0x136b14);return new Promise(function(_0x528582,_0x243210){var _0x51833b={'method':_0x47a5('0x20'),'uri':_0x16631f+_0x47a5('0x21')+_0x361bfa,'body':{'user_name':_0x136b14[_0x47a5('0x22')],'roles':'user','first_name':_0x136b14[_0x47a5('0x22')],'active':_0x47a5('0x1a'),'date_format':_0x47a5('0x23'),'phone':_0x136b14[_0x47a5('0x22')]},'auth':_0x24b162,'json':!![]};return rp(_0x51833b)['then'](function(_0x50d875){logger[_0x47a5('0x10')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+'],\x20EndUser\x20schema',_0x50d875['result']);_0x136b14[_0x47a5('0x24')]=_0x50d875[_0x47a5('0xc')]['sys_id'];_0x528582(_0x136b14);})[_0x47a5('0x12')](function(_0x53119b){logger[_0x47a5('0x13')]('['+[_0x3ba0b7[_0x47a5('0x14')]()]+']',_0x53119b['message']);_0x243210(_0x53119b['message']);});});}function getEndUser(_0x274e34,_0x5910bb,_0x403028,_0x87e4c9,_0xf269a8){return function(_0x52749b){logger[_0x47a5('0x10')]('['+[_0x274e34['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x52749b);return new Promise(function(_0x65542e,_0x5a8a7c){var _0x25cce0={'method':'GET','uri':_0x403028+_0x47a5('0x25')+_0x52749b[_0x47a5('0x22')]+'&'+_0x87e4c9+'&'+_0xf269a8,'auth':_0x5910bb,'json':!![]};return rp(_0x25cce0)[_0x47a5('0x19')](function(_0x199698){if(_0x199698[_0x47a5('0xc')][_0x47a5('0xd')]>0x0){_0x52749b[_0x47a5('0x24')]=_0x199698[_0x47a5('0xc')][0x0][_0x47a5('0xf')];logger['info']('['+[_0x274e34[_0x47a5('0x14')]()]+_0x47a5('0x26'),_0x52749b);_0x65542e(_0x52749b);}else{return createEndUser(_0x274e34,_0x5910bb,_0x52749b,_0x403028,_0x87e4c9)['then'](function(_0x2c50d6){logger[_0x47a5('0x10')]('['+[_0x274e34[_0x47a5('0x14')]()]+'],\x20createEndUser\x20crm',_0x2c50d6);_0x65542e(_0x2c50d6);});}})[_0x47a5('0x12')](function(_0x10f660){logger['error']('['+[_0x274e34[_0x47a5('0x14')]()]+']',_0x10f660[_0x47a5('0x15')]);_0x5a8a7c(_0x10f660['message']);});});};}function getCustomFields(_0x55c5eb,_0x5ebd8c){var _0x12d9f2={};if(_0x55c5eb['length']>0x0){_[_0x47a5('0x27')](_0x55c5eb,function(_0x1f9631){if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2a')]&&!_0x1f9631[_0x47a5('0x2b')]){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x29')&&_0x1f9631[_0x47a5('0x2c')]&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')][_0x47a5('0x2d')]()]=_0x1f9631[_0x47a5('0x2e')][_0x47a5('0x2f')]();}else if(_0x1f9631['type']===_0x47a5('0x30')&&_0x1f9631['variableName']&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631['idField'][_0x47a5('0x2d')]()]=_0x5ebd8c[_0x1f9631['variableName']][_0x47a5('0x2f')]();}else if(_0x1f9631[_0x47a5('0x28')]===_0x47a5('0x31')&&_0x1f9631['Variable']&&_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')]&&_0x1f9631['idField']&&_0x1f9631['customField']){_0x12d9f2[_0x1f9631[_0x47a5('0x2c')]['toLowerCase']()]=_0x5ebd8c[_0x1f9631[_0x47a5('0x32')][_0x47a5('0x33')][_0x47a5('0x2d')]()][_0x47a5('0x2f')]();}});}return _0x12d9f2;}function getTicket(_0x34a9ae,_0xf0edbb,_0x434227,_0x17cc42,_0xac9c15,_0x162fa0){return function(_0x24ecb1){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+_0x47a5('0x34'),_0x24ecb1);return new Promise(function(_0x4e5e7,_0x3a2b38){var _0x512e65=_0x34a9ae[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x24ecb1['userId']:_0x24ecb1['endUserId'];var _0x3d0a88={'method':'POST','uri':_0x434227+_0x47a5('0x36')+'?'+_0x162fa0,'body':Object[_0x47a5('0x37')]({},{'active':'true','caller_id':_0x512e65,'assigned_to':_0x24ecb1['userId'],'short_description':intUtil[_0x47a5('0x38')](_0x17cc42['Subjects'],_0xac9c15,'\x20'),'description':intUtil[_0x47a5('0x38')](_0x17cc42[_0x47a5('0x39')],_0xac9c15,'\x0a')},getCustomFields(_0x17cc42[_0x47a5('0x3a')],_0xac9c15)),'auth':_0xf0edbb,'json':!![]};return rp(_0x3d0a88)[_0x47a5('0x19')](function(_0x44fe8a){logger[_0x47a5('0x10')]('['+[_0x34a9ae[_0x47a5('0x14')]()]+']\x20POST\x20incident\x20entity\x20schema',_0x44fe8a['result']);_0x24ecb1[_0x47a5('0x3b')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0xf')];_0x24ecb1[_0x47a5('0x3c')]=_0x44fe8a[_0x47a5('0xc')][_0x47a5('0x3d')];logger[_0x47a5('0x10')]('['+[_0x34a9ae['toUpperCase']()]+_0x47a5('0x3e'),_0x24ecb1);_0x4e5e7(_0x24ecb1);})[_0x47a5('0x12')](function(_0x5f6a){logger['error']('['+[_0x34a9ae[_0x47a5('0x14')]()]+']',_0x5f6a['message']);_0x3a2b38(_0x5f6a[_0x47a5('0x15')]);});});};}function createRemoteTag(_0xe31817,_0x46e90b,_0xf03bd5,_0x588551){return new Promise(function(_0x3adf14,_0x1e6de3){var _0x2f66e9={'method':_0x47a5('0x20'),'uri':_0xf03bd5+_0x47a5('0x3f')+'?'+_0x588551,'body':{'short_description':_0xe31817,'global':!![],'active':!![],'name':_0xe31817},'auth':_0x46e90b,'json':!![]};return rp(_0x2f66e9)[_0x47a5('0x19')](function(_0x24e9f4){var _0x481089=_0x24e9f4[_0x47a5('0xc')][_0x47a5('0xf')];_0x3adf14(_0x481089);});});}function getRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf,_0x572233){return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581={'method':'GET','uri':_0x3329aa+_0x47a5('0x3f')+_0x47a5('0x40')+_0x187d7e+'&'+_0x1ab0bf,'auth':_0x8da9fb,'json':!![]};return rp(_0x1aa581)[_0x47a5('0x19')](function(_0x5d8d4a){if(_0x5d8d4a['result'][_0x47a5('0xd')]>0x0){var _0x376e1d=_0x5d8d4a['result'][0x0]['sys_id'];_0x1ad6a9(_0x376e1d);}else{return createRemoteTag(_0x187d7e,_0x8da9fb,_0x3329aa,_0x1ab0bf)[_0x47a5('0x19')](function(_0x4d6a82){_0x1ad6a9(_0x4d6a82);});}});});}function assignTagToIncident(_0x16bb8a,_0x5d383d,_0x482de6,_0x389ed9,_0x46d2d3){return new Promise(function(_0x53eedf,_0x1b958b){var _0x72fe={'method':'POST','uri':_0x482de6+'label_entry'+'?'+_0x46d2d3,'body':{'label':_0x16bb8a,'table':_0x47a5('0x36'),'id_type':_0x47a5('0x41'),'table_key':_0x389ed9[_0x47a5('0x3b')],'title':_0x47a5('0x42')+_0x389ed9['ticketNumber'],'id_display':_0x389ed9[_0x47a5('0x3c')]},'auth':_0x5d383d,'json':!![]};return rp(_0x72fe)[_0x47a5('0x19')](function(_0x1af800){_0x53eedf();})['catch'](function(){_0x53eedf();});});}function manageTags(_0x30ea7a,_0x4db625,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b,_0x3603b7){return new Promise(function(_0x4966af,_0x144af9){var _0x5d1550=[];_0x4db625['forEach'](function(_0x5eb150){_0x5d1550['push'](getRemoteTag(_0x5eb150,_0x485e3c,_0x470da6,_0x1c485b,_0x3603b7));});return Promise[_0x47a5('0x43')](_0x5d1550)[_0x47a5('0x19')](function(_0x1e2bb4){if(_0x1e2bb4['length']){logger['info']('['+[_0x30ea7a[_0x47a5('0x14')]()]+_0x47a5('0x44'),_0x1e2bb4);var _0x45d4b6=[];_0x1e2bb4[_0x47a5('0x27')](function(_0xc45e25){_0x45d4b6['push'](assignTagToIncident(_0xc45e25,_0x485e3c,_0x470da6,_0x943a15,_0x1c485b));});return Promise[_0x47a5('0x43')](_0x45d4b6)['then'](function(){_0x4966af();})[_0x47a5('0x12')](function(){_0x4966af();});}else{_0x4966af();}});});}function getTags(_0x274d31,_0x4d545f,_0x32b4de,_0x345104,_0x132854,_0x3e8274){return function(_0x2d6494){return new Promise(function(_0x215634,_0x35cca8){var _0x3ac38c=[];var _0x57ed0a=_0x345104[_0x47a5('0x45')];if(_0x57ed0a&&_0x57ed0a[_0x47a5('0xd')]>0x0){_0x3ac38c=_[_0x47a5('0x46')](_0x57ed0a,_0x47a5('0x33'));}if(_0x3ac38c[_0x47a5('0xd')]>0x0){return manageTags(_0x274d31,_0x3ac38c,_0x4d545f,_0x32b4de,_0x2d6494,_0x132854,_0x3e8274)['then'](function(){_0x215634(_0x2d6494);});}else{_0x215634(_0x2d6494);}});};}function emit(_0xbec033,_0xdfcecc,_0x1224bc){var _0x144aaa=_0x47a5('0x47')+_0x47a5('0x48')+_0x47a5('0x49')+_0x47a5('0x4a');var _0x350af8={'uri':_0xbec033+_0x47a5('0x4b')+_0x1224bc+_0x144aaa};io['to'](util[_0x47a5('0x4c')](_0x47a5('0x4d'),_0xdfcecc))[_0x47a5('0x4e')](_0x47a5('0x4f'),_0x350af8);}exports['cs']=function(_0x3edd17,_0x5a6161,_0x42dd7d,_0x284fb8,_0x30504e,_0x4b42f3,_0x37ac59,_0x2e46af){var _0x36c67={};var _0x26f1ac={'user':_0x4b42f3['username'],'pass':_0x4b42f3[_0x47a5('0x50')]};var _0x522ccf=_0x47a5('0x51');var _0x487e21=_0x47a5('0x52');_0x4b42f3['remoteUri']=intUtil[_0x47a5('0x53')](_0x4b42f3[_0x47a5('0x54')]);_0x4b42f3[_0x47a5('0x55')]=intUtil['stripTrailingSlash'](_0x4b42f3['serverUrl']);var _0x4b8084=util[_0x47a5('0x4c')](_0x47a5('0x56'),_0x4b42f3[_0x47a5('0x54')]);_0x36c67[_0x47a5('0x16')]=!_['isNil'](_0x284fb8)?_0x284fb8[_0x47a5('0x57')]:null;_0x36c67[_0x47a5('0x1e')]=_0x4b42f3[_0x47a5('0x57')];_0x36c67[_0x47a5('0x22')]=_0x2e46af[_0x47a5('0x2d')]()===_0x47a5('0x35')?_0x5a6161[_0x47a5('0x58')]:_0x5a6161[_0x47a5('0x59')];_0x36c67[_0x47a5('0x5a')]=_0x2e46af===_0x47a5('0x5b')||_0x2e46af===_0x47a5('0x5c')?_0x47a5('0x5b'):'outbound';var _0x1e3212=util['format'](_0x47a5('0x5d'),_0x4b42f3[_0x47a5('0x55')],_0x5a6161[_0x47a5('0x5e')],md5(_0x5a6161[_0x47a5('0x5e')]));if(_0x30504e&&_0x30504e[_0x47a5('0x5f')]){logger[_0x47a5('0x10')](_0x47a5('0x60'),_0x47a5('0x61'));_0x5a6161[_0x47a5('0x62')]=_0x1e3212;}else if(_0x37ac59&&_0x37ac59[_0x47a5('0x63')]&&_0x37ac59[_0x47a5('0x63')]!==_0x47a5('0x64')){logger[_0x47a5('0x10')](_0x47a5('0x65'),_0x47a5('0x61'));_0x5a6161['recordingURL']=_0x1e3212;}else{_0x5a6161['recordingURL']='';}return getAdminUser(_0x2e46af,_0x26f1ac,_0x36c67,_0x4b8084,_0x487e21,_0x522ccf)['then'](getUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))['then'](getEndUser(_0x2e46af,_0x26f1ac,_0x4b8084,_0x487e21,_0x522ccf))[_0x47a5('0x19')](getTicket(_0x2e46af,_0x26f1ac,_0x4b8084,_0x42dd7d,_0x5a6161,_0x487e21))[_0x47a5('0x19')](function(_0x5d6916){logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x66'),_0x5d6916[_0x47a5('0x3b')]));logger[_0x47a5('0x10')](util[_0x47a5('0x4c')](_0x47a5('0x67'),_0x2e46af));if(_0x2e46af!==_0x47a5('0x5c')){logger[_0x47a5('0x10')]('['+[_0x2e46af[_0x47a5('0x14')]()]+']',_0x47a5('0x68'));emit(_0x4b42f3['remoteUri'],_0x284fb8[_0x47a5('0x33')],_0x5d6916[_0x47a5('0x3b')]);}})[_0x47a5('0x12')](function(_0x4f35ff){logger[_0x47a5('0x13')]('['+[_0x2e46af[_0x47a5('0x14')]()]+_0x47a5('0x69'),util['inspect'](_0x4f35ff,{'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 4af16c0..5912670 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 _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 +var _0xae3f=['get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','forEach','string','customField','nameField','toLowerCase','content','idField','variable','type','customVariable','Variable','custom_fields','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','date_start','toISOString','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','push','variableName','set_entry','JSON','stringify','format','toString','isNil','Getting\x20agent\x20with\x20name','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone'];(function(_0x58bf36,_0x395dc6){var _0x41aeac=function(_0xc5be55){while(--_0xc5be55){_0x58bf36['push'](_0x58bf36['shift']());}};_0x41aeac(++_0x395dc6);}(_0xae3f,0x136));var _0xfae3=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xae3f[_0x22b68a];return _0x1ac67a;};'use strict';var _=require('lodash');var rp=require(_0xfae3('0x0'));var BPromise=require(_0xfae3('0x1'));var md5=require(_0xfae3('0x2'));var util=require(_0xfae3('0x3'));var Redis=require(_0xfae3('0x4'));var intUtil=require(_0xfae3('0x5'));var config=require(_0xfae3('0x6'));var logger=require(_0xfae3('0x7'))(_0xfae3('0x8'));config[_0xfae3('0x9')]=_[_0xfae3('0xa')](config[_0xfae3('0x9')],{'host':_0xfae3('0xb'),'port':0x18eb});var io=require(_0xfae3('0xc'))(new Redis(config['redis']));var def={'method':_0xfae3('0xd'),'json':!![]};function emit(_0x324a30,_0x200a98,_0x1f2695){io['to'](_0x324a30)[_0xfae3('0xe')](_0x200a98,_0x1f2695);}function getTicket(_0x148f66,_0x5f3544,_0x3de298,_0x3fbf6e,_0xea046c,_0x43fc72,_0x3b7f72,_0x4774c8){logger[_0xfae3('0xf')](_0xfae3('0x10'));var _0x1a322a=new Date();var _0xe37e66=[{'name':_0xfae3('0x11'),'value':intUtil[_0xfae3('0x12')](_0x3fbf6e[_0xfae3('0x13')],_0xea046c,'\x20')},{'name':'assigned_user_id','value':_0x5f3544['id']},{'name':'created_by','value':_0x5f3544['id']},{'name':_0xfae3('0x14'),'value':intUtil[_0xfae3('0x12')](_0x3fbf6e[_0xfae3('0x15')],_0xea046c,'\x0a')},{'name':_0xfae3('0x16'),'value':_0x1a322a[_0xfae3('0x17')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0xfae3('0x18'),'value':'0'},{'name':_0xfae3('0x19'),'value':'15'},{'name':_0xfae3('0x1a'),'value':_0x3de298['id']},{'name':'parent_type','value':_0xfae3('0x1b')},{'name':_0xfae3('0x1c'),'value':_0x3de298['name']},{'name':_0xfae3('0x1d'),'value':_0x4774c8}];if(_0x43fc72[_0xfae3('0x1e')]){_['forEach'](_0x43fc72,function(_0x482b79){if(_0xea046c[_0x482b79['variableName']]){_0xe37e66[_0xfae3('0x1f')]({'name':_0x482b79['idField'],'value':_0xea046c[_0x482b79[_0xfae3('0x20')]]});}});}return request({'form':{'method':_0xfae3('0x21'),'input_type':'JSON','response_type':_0xfae3('0x22'),'rest_data':JSON[_0xfae3('0x23')]({'session':_0x3b7f72['id'],'module_name':'Calls','name_value_list':_0xe37e66})}});}function getAuth(_0x468955){return util[_0xfae3('0x24')]('Basic\x20%s',new Buffer(_0x468955['apiKey']+':X')[_0xfae3('0x25')]('base64'));}function getServerInfo(_0x251537){return request({'form':{'method':'get_server_info','input_type':_0xfae3('0x22'),'response_type':_0xfae3('0x22'),'rest_data':JSON[_0xfae3('0x23')]({'session':_0x251537['id']})}});}function getUser(_0x74d1d4,_0x23be47,_0x15419a){if(!_[_0xfae3('0x26')](_0x23be47)){logger[_0xfae3('0xf')](_0xfae3('0x27'),_0x23be47);return request({'form':{'method':'get_entry_list','input_type':_0xfae3('0x22'),'response_type':'JSON','rest_data':JSON[_0xfae3('0x23')]({'session':_0x15419a['id'],'module_name':'Employees','query':util['format'](_0xfae3('0x28'),_0x23be47),'order_by':'','offset':'0','select_fields':['id',_0xfae3('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfae3('0x29')](function(_0x4d0504){if(_0x4d0504[_0xfae3('0x2a')]['length']){var _0x392930=_['find'](_0x4d0504[_0xfae3('0x2a')],function(_0x29467f){return _0x29467f[_0xfae3('0x2b')][_0xfae3('0x2c')][_0xfae3('0x2d')]===_0x23be47;});if(_0x392930){logger[_0xfae3('0xf')]('Agent\x20found!');return BPromise['resolve']({'id':_0x392930[_0xfae3('0x2b')]['id']['value'],'name':_0x392930[_0xfae3('0x2b')][_0xfae3('0x11')][_0xfae3('0x2d')]});}}logger[_0xfae3('0xf')](_0xfae3('0x2e'));return BPromise['resolve']({'id':_0x15419a[_0xfae3('0x2b')]['user_id'][_0xfae3('0x2d')],'name':_0x15419a['name_value_list'][_0xfae3('0x2c')][_0xfae3('0x2d')]});});}else{logger[_0xfae3('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xfae3('0x2f')]({'id':_0x15419a[_0xfae3('0x2b')][_0xfae3('0x30')][_0xfae3('0x2d')],'name':_0x15419a[_0xfae3('0x2b')][_0xfae3('0x2c')][_0xfae3('0x2d')]});}}function getEndUser(_0x120aed,_0x11efe6,_0x4c1d7b,_0x444d65){logger[_0xfae3('0xf')](_0xfae3('0x31'),_0x4c1d7b);return request({'form':{'method':_0xfae3('0x32'),'input_type':_0xfae3('0x22'),'response_type':'JSON','rest_data':JSON[_0xfae3('0x23')]({'session':_0x444d65['id'],'module_name':_0xfae3('0x1b'),'query':util[_0xfae3('0x24')](_0xfae3('0x33'),_0x4c1d7b),'order_by':'','offset':'0','select_fields':['id','name',_0xfae3('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xfae3('0x29')](function(_0x4e00a7){if(_0x4e00a7[_0xfae3('0x2a')][_0xfae3('0x1e')]){var _0x2f4ee2=_['find'](_0x4e00a7[_0xfae3('0x2a')],function(_0xb9d7dc){return _0xb9d7dc['name_value_list']['phone_home'][_0xfae3('0x2d')]===_0x4c1d7b;});if(_0x2f4ee2){logger[_0xfae3('0xf')]('Enduser\x20found!');return BPromise[_0xfae3('0x2f')]({'id':_0x2f4ee2[_0xfae3('0x2b')]['id'][_0xfae3('0x2d')],'name':_0x2f4ee2[_0xfae3('0x2b')]['name'][_0xfae3('0x2d')],'phone':_0x2f4ee2['name_value_list'][_0xfae3('0x34')][_0xfae3('0x2d')]});}}else{logger[_0xfae3('0xf')](_0xfae3('0x35'));return request({'form':{'method':_0xfae3('0x21'),'input_type':_0xfae3('0x22'),'response_type':'JSON','rest_data':JSON[_0xfae3('0x23')]({'session':_0x444d65['id'],'module_name':'Contacts','name_value_list':[{'name':_0xfae3('0x36'),'value':_0x11efe6!==_0xfae3('0x37')?_0x11efe6:util[_0xfae3('0x24')](_0xfae3('0x38'),_0x4c1d7b)},{'name':_0xfae3('0x34'),'value':_0x4c1d7b}]})}})[_0xfae3('0x29')](function(_0x31ea6a){logger['info'](_0xfae3('0x39'));return BPromise[_0xfae3('0x2f')]({'id':_0x31ea6a['id'],'name':_0x31ea6a[_0xfae3('0x2a')][_0xfae3('0x36')][_0xfae3('0x2d')],'phone':_0x31ea6a['entry_list'][_0xfae3('0x34')][_0xfae3('0x2d')]});});}});}function request(_0x5be1ff){logger[_0xfae3('0x3a')]('[HTTP]',JSON[_0xfae3('0x23')](_0x5be1ff));return rp(_[_0xfae3('0x3b')](def,_0x5be1ff));}function getTags(_0x4de17b,_0x4d46e5){var _0x1194b5=[];if(_0x4de17b&&_0x4de17b[_0xfae3('0x1e')]>0x0){_0x1194b5=_[_0xfae3('0x3c')](_0x4de17b,_0x4d46e5);}return _0x1194b5;}function getCustomFields(_0x155ff0,_0x230bca){var _0x2f8b70=[];var _0x1109bd={'custom_fields':[]};if(_0x155ff0[_0xfae3('0x1e')]>0x0){_[_0xfae3('0x3d')](_0x155ff0,function(_0x760f1c){if(_0x760f1c['type']===_0xfae3('0x3e')&&_0x760f1c['nameField']&&!_0x760f1c[_0xfae3('0x3f')]){_0x1109bd[_0x760f1c[_0xfae3('0x40')][_0xfae3('0x41')]()]=_0x760f1c[_0xfae3('0x42')]['toString']();}else if(_0x760f1c['type']===_0xfae3('0x3e')&&_0x760f1c[_0xfae3('0x43')]&&_0x760f1c[_0xfae3('0x3f')]){_0x1109bd['custom_fields'][_0xfae3('0x1f')]({'id':_0x760f1c[_0xfae3('0x43')],'value':_0x760f1c['content'][_0xfae3('0x25')]()});}else if(_0x760f1c['type']===_0xfae3('0x44')&&_0x760f1c[_0xfae3('0x20')]&&_0x760f1c[_0xfae3('0x43')]&&_0x760f1c[_0xfae3('0x3f')]){_0x230bca[_0x760f1c[_0xfae3('0x20')]]&&_0x1109bd['custom_fields'][_0xfae3('0x1f')]({'id':_0x760f1c['idField'],'value':_0x230bca[_0x760f1c[_0xfae3('0x20')]]['toString']()});}else if(_0x760f1c[_0xfae3('0x45')]===_0xfae3('0x46')&&_0x760f1c[_0xfae3('0x47')]&&_0x760f1c['Variable']['name']&&_0x760f1c['idField']&&_0x760f1c[_0xfae3('0x3f')]){_0x230bca[_0x760f1c[_0xfae3('0x47')]['name'][_0xfae3('0x41')]()]&&_0x1109bd[_0xfae3('0x48')]['push']({'id':_0x760f1c[_0xfae3('0x43')],'value':_0x230bca[_0x760f1c[_0xfae3('0x47')]['name']['toLowerCase']()][_0xfae3('0x25')]()});}});}return _0x1109bd;}function getConnection(_0x161cbd){return request({'method':_0xfae3('0xd'),'form':{'method':_0xfae3('0x49'),'input_type':_0xfae3('0x22'),'response_type':'JSON','rest_data':JSON[_0xfae3('0x23')]({'user_auth':{'user_name':_0x161cbd[_0xfae3('0x4a')],'password':_0x161cbd[_0xfae3('0x4b')],'encryption':_0xfae3('0x4c')},'application':_0xfae3('0x4d')})}})[_0xfae3('0x29')](function(_0x8c7c46){var _0x2abb10=_0x8c7c46;if(_0x2abb10['id']){def[_0xfae3('0x4e')]=_0x2abb10['id'];return BPromise[_0xfae3('0x2f')](_0x2abb10);}else{throw new Error(util['format'](_0xfae3('0x4f'),_0x161cbd['id']));}});}function setRelationship(_0x2795ac,_0x38a1b6,_0x48d496,_0x312029){return request({'form':{'method':_0xfae3('0x50'),'input_type':_0xfae3('0x22'),'response_type':_0xfae3('0x22'),'rest_data':JSON['stringify']({'session':_0x2795ac['id'],'module_name':_0xfae3('0x51'),'module_id':_0x48d496['id'],'link_field_name':_0x312029,'related_ids':[_0x38a1b6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xfae3('0x52')]=function(_0x4ffe4e,_0x501b34,_0x3a6b60,_0x150e25,_0x56abbf,_0x48e0de){var _0x57613d,_0x4a5d93,_0x420beb,_0x3989d1;_0x48e0de[_0xfae3('0x53')]=intUtil[_0xfae3('0x54')](_0x48e0de[_0xfae3('0x53')]);_0x48e0de['serverUrl']=intUtil[_0xfae3('0x54')](_0x48e0de['serverUrl']);def[_0xfae3('0x55')]=util[_0xfae3('0x24')](_0xfae3('0x56'),_0x48e0de[_0xfae3('0x53')]);if(_0x56abbf&&_0x56abbf[_0xfae3('0x57')]){logger['info'](_0xfae3('0x58'),_0xfae3('0x59'));_0x501b34[_0xfae3('0x5a')]=util[_0xfae3('0x24')](_0xfae3('0x5b'),_0x48e0de[_0xfae3('0x5c')],_0x501b34[_0xfae3('0x5d')],md5(_0x501b34[_0xfae3('0x5d')]));}else{_0x501b34[_0xfae3('0x5a')]='';}return getConnection(_0x48e0de)[_0xfae3('0x29')](function(_0x2454fe){_0x3989d1=_0x2454fe;return getUser(_0x48e0de,_0x150e25['name'],_0x3989d1);})[_0xfae3('0x29')](function(_0x449a39){_0x57613d=_0x449a39;logger[_0xfae3('0xf')](_0xfae3('0x5e'),_0x57613d['id']);return getEndUser(_0x48e0de,_0x501b34[_0xfae3('0x5f')],_0x501b34[_0xfae3('0x60')],_0x3989d1);})['then'](function(_0x5da167){_0x4a5d93=_0x5da167;logger[_0xfae3('0xf')](_0xfae3('0x61'),_0x4a5d93['id']);return getTicket(_0x48e0de,_0x57613d,_0x4a5d93,_0x3a6b60,_0x501b34,_0x3a6b60[_0xfae3('0x62')],_0x3989d1,_0xfae3('0x63'));})[_0xfae3('0x29')](function(_0x4eb092){_0x420beb=_0x4eb092;logger[_0xfae3('0xf')](_0xfae3('0x64'));logger[_0xfae3('0xf')](_0xfae3('0x65'),_0x420beb['id']);return setRelationship(_0x3989d1,_0x57613d,_0x420beb,_0xfae3('0x66'));})[_0xfae3('0x29')](function(){return setRelationship(_0x3989d1,_0x4a5d93,_0x420beb,_0xfae3('0x67'));})[_0xfae3('0x29')](function(){return getServerInfo(_0x3989d1);})[_0xfae3('0x29')](function(_0x51ae8b){var _0x49c63f=parseInt(_0x51ae8b['version'][_0xfae3('0x68')](0x0));var _0x2fa22b=util['format'](_0xfae3('0x69'),_0x48e0de[_0xfae3('0x53')],_0x420beb['id']);if(_0x49c63f>0x6){_0x2fa22b=util[_0xfae3('0x24')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x48e0de[_0xfae3('0x53')],_0x420beb['id']);}logger['info']('[QUEUE]',_0xfae3('0x6a'));emit(util[_0xfae3('0x24')]('user:%s',_0x150e25[_0xfae3('0x11')]),'trigger:browser:url',{'uri':_0x2fa22b});})[_0xfae3('0x6b')](function(_0x322554){logger[_0xfae3('0x6c')](_0xfae3('0x58'),JSON[_0xfae3('0x23')](_0x322554));});};exports[_0xfae3('0x6d')]=function(_0x364a99,_0x4cbf88,_0x199f4d,_0x11248b,_0x35b33e,_0x1e574d,_0x89d70f){var _0x1e08d1,_0x3e0e39,_0x2abf4e,_0x43c0f0;_0x1e574d[_0xfae3('0x53')]=intUtil[_0xfae3('0x54')](_0x1e574d[_0xfae3('0x53')]);_0x1e574d[_0xfae3('0x5c')]=intUtil[_0xfae3('0x54')](_0x1e574d[_0xfae3('0x5c')]);def[_0xfae3('0x55')]=util[_0xfae3('0x24')](_0xfae3('0x56'),_0x1e574d[_0xfae3('0x53')]);if(_0x89d70f&&_0x89d70f['recordingFormat']&&_0x89d70f[_0xfae3('0x6e')]!==_0xfae3('0x6f')){logger[_0xfae3('0xf')](_0xfae3('0x70'),'Recording\x20is\x20enabled!');_0x4cbf88[_0xfae3('0x5a')]=util[_0xfae3('0x24')](_0xfae3('0x5b'),_0x1e574d[_0xfae3('0x5c')],_0x4cbf88[_0xfae3('0x5d')],md5(_0x4cbf88[_0xfae3('0x5d')]));}return getConnection(_0x1e574d)['then'](function(_0x5afc69){_0x43c0f0=_0x5afc69;return getUser(_0x1e574d,_0x11248b[_0xfae3('0x11')],_0x43c0f0);})[_0xfae3('0x29')](function(_0x352d07){_0x1e08d1=_0x352d07;logger['info'](_0xfae3('0x5e'),_0x1e08d1['id']);return getEndUser(_0x1e574d,_0x4cbf88['destcalleridname'],_0x4cbf88[_0xfae3('0x71')],_0x43c0f0);})[_0xfae3('0x29')](function(_0x4898ef){_0x3e0e39=_0x4898ef;logger['info'](_0xfae3('0x61'),_0x3e0e39['id']);return getTicket(_0x1e574d,_0x1e08d1,_0x3e0e39,_0x199f4d,_0x4cbf88,_0x199f4d['Fields'],_0x43c0f0,'Outbound');})[_0xfae3('0x29')](function(_0x1392b){_0x2abf4e=_0x1392b;logger[_0xfae3('0xf')]('Ticket\x20created!');logger[_0xfae3('0xf')](_0xfae3('0x65'),_0x2abf4e['id']);return setRelationship(_0x43c0f0,_0x1e08d1,_0x2abf4e,_0xfae3('0x66'));})[_0xfae3('0x29')](function(){return setRelationship(_0x43c0f0,_0x3e0e39,_0x2abf4e,_0xfae3('0x67'));})[_0xfae3('0x29')](function(){return getServerInfo(_0x43c0f0);})[_0xfae3('0x29')](function(_0x1e9c6b){var _0x5c45fd=parseInt(_0x1e9c6b[_0xfae3('0x72')][_0xfae3('0x68')](0x0));var _0x35bb5a=util[_0xfae3('0x24')](_0xfae3('0x69'),_0x1e574d[_0xfae3('0x53')],_0x2abf4e['id']);if(_0x5c45fd>0x6){_0x35bb5a=util[_0xfae3('0x24')](_0xfae3('0x73'),_0x1e574d['remoteUri'],_0x2abf4e['id']);}logger[_0xfae3('0xf')]('[OUTBOUND]',_0xfae3('0x6a'));emit(util[_0xfae3('0x24')]('user:%s',_0x11248b[_0xfae3('0x11')]),_0xfae3('0x74'),{'uri':_0x35bb5a});})[_0xfae3('0x6b')](function(_0x3f1b99){logger[_0xfae3('0x6c')](_0xfae3('0x70'),JSON['stringify'](_0x3f1b99));});};exports[_0xfae3('0x75')]=function(_0x429b5b,_0x49e280,_0x1db644,_0x1bd229,_0x42d73a,_0x3e446c){var _0x168e45,_0x54c489,_0x435cf0,_0x4689cf;_0x3e446c[_0xfae3('0x53')]=intUtil[_0xfae3('0x54')](_0x3e446c[_0xfae3('0x53')]);_0x3e446c[_0xfae3('0x5c')]=intUtil[_0xfae3('0x54')](_0x3e446c['serverUrl']);def[_0xfae3('0x55')]=util[_0xfae3('0x24')](_0xfae3('0x56'),_0x3e446c[_0xfae3('0x53')]);if(_0x42d73a&&_0x42d73a['monitor_format']){logger[_0xfae3('0xf')]('['+_0x49e280['lastevent']['toUpperCase']()+']',_0xfae3('0x59'));_0x49e280[_0xfae3('0x5a')]=util['format'](_0xfae3('0x5b'),_0x3e446c[_0xfae3('0x5c')],_0x49e280[_0xfae3('0x5d')],md5(_0x49e280['uniqueid']));}else{_0x49e280['recordingURL']='';}return getConnection(_0x3e446c)[_0xfae3('0x29')](function(_0x5ad077){_0x4689cf=_0x5ad077;if(!_[_0xfae3('0x26')](_0x1bd229)){return getUser(_0x3e446c,_0x1bd229[_0xfae3('0x11')],_0x4689cf);}else{return getUser(_0x3e446c,null,_0x4689cf);}})[_0xfae3('0x29')](function(_0x50c1e5){_0x168e45=_0x50c1e5;logger[_0xfae3('0xf')](_0xfae3('0x5e'),_0x168e45['id']);return getEndUser(_0x3e446c,_0x49e280['calleridname'],_0x49e280[_0xfae3('0x60')],_0x4689cf);})[_0xfae3('0x29')](function(_0x21cd3e){_0x54c489=_0x21cd3e;logger['info'](_0xfae3('0x61'),_0x54c489['id']);return getTicket(_0x3e446c,_0x168e45,_0x54c489,_0x1db644,_0x49e280,_0x1db644[_0xfae3('0x62')],_0x4689cf,_0xfae3('0x63'));})[_0xfae3('0x29')](function(_0x498e81){_0x435cf0=_0x498e81;logger[_0xfae3('0xf')](_0xfae3('0x64'));logger[_0xfae3('0xf')](_0xfae3('0x65'),_0x435cf0['id']);return setRelationship(_0x4689cf,_0x168e45,_0x435cf0,_0xfae3('0x66'));})[_0xfae3('0x29')](function(){return setRelationship(_0x4689cf,_0x54c489,_0x435cf0,_0xfae3('0x67'));})[_0xfae3('0x29')](function(){return getServerInfo(_0x4689cf);})[_0xfae3('0x6b')](function(_0x1accbd){logger['error']('['+_0x49e280[_0xfae3('0x76')][_0xfae3('0x77')]()+']',JSON[_0xfae3('0x23')](_0x1accbd));});}; \ 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 53284e7..22c8f71 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 _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 +var _0xe5a0=['keyType','string','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','lodash','util','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue'];(function(_0x2be3b1,_0x58685a){var _0x54dc5b=function(_0x56e6f2){while(--_0x56e6f2){_0x2be3b1['push'](_0x2be3b1['shift']());}};_0x54dc5b(++_0x58685a);}(_0xe5a0,0x81));var _0x0e5a=function(_0x5d66d6,_0x4a9326){_0x5d66d6=_0x5d66d6-0x0;var _0x2d72cf=_0xe5a0[_0x5d66d6];return _0x2d72cf;};'use strict';var _=require(_0x0e5a('0x0'));var util=require(_0x0e5a('0x1'));exports[_0x0e5a('0x2')]=function(_0x452ae,_0x1914fb,_0x2e4309){var _0x1e5ae1=[];if(_0x452ae[_0x0e5a('0x3')]>0x0){var _0x4ccfe9=_[_0x0e5a('0x4')](_0x452ae,['id']);for(var _0x56e173=0x0;_0x56e173<_0x4ccfe9[_0x0e5a('0x3')];_0x56e173++){var _0x4c4619=_0x4ccfe9[_0x56e173];if(_0x4c4619['type']==='string'){_0x1e5ae1[_0x0e5a('0x5')](_0x4c4619[_0x0e5a('0x6')]);}else if(_0x4c4619[_0x0e5a('0x7')]===_0x0e5a('0x8')&&_0x4c4619[_0x0e5a('0x9')]){_0x1914fb[_0x4c4619[_0x0e5a('0x9')]]&&_0x1e5ae1[_0x0e5a('0x5')](_0x1914fb[_0x4c4619[_0x0e5a('0x9')]][_0x0e5a('0xa')]());}else if(_0x4c4619[_0x0e5a('0x7')]===_0x0e5a('0xb')&&_0x4c4619['Variable']&&_0x4c4619[_0x0e5a('0xc')]['name']){_0x1914fb[_0x4c4619['Variable'][_0x0e5a('0xd')][_0x0e5a('0xe')]()]&&_0x1e5ae1[_0x0e5a('0x5')](_0x1914fb[_0x4c4619[_0x0e5a('0xc')][_0x0e5a('0xd')]['toLowerCase']()]['toString']());}else if(_0x4c4619['type']===_0x0e5a('0xf')){if(_0x4c4619[_0x0e5a('0x10')]===_0x0e5a('0x11')&&_0x4c4619[_0x0e5a('0x12')]){_0x1e5ae1['push'](util['format'](_0x0e5a('0x13'),_0x4c4619['key'],_0x4c4619[_0x0e5a('0x14')]));}else if(_0x4c4619[_0x0e5a('0x10')]===_0x0e5a('0x8')&&_0x4c4619['variableName']&&_0x4c4619[_0x0e5a('0x12')]){_0x1914fb[_0x4c4619['variableName']]&&_0x1e5ae1[_0x0e5a('0x5')](util[_0x0e5a('0x15')](_0x0e5a('0x13'),_0x4c4619[_0x0e5a('0x12')],_0x1914fb[_0x4c4619[_0x0e5a('0x9')]]));}else if(_0x4c4619[_0x0e5a('0x10')]===_0x0e5a('0xb')&&_0x4c4619[_0x0e5a('0xc')]&&_0x4c4619[_0x0e5a('0xc')][_0x0e5a('0xd')]&&_0x4c4619[_0x0e5a('0x12')]){_0x1914fb[_0x4c4619[_0x0e5a('0xc')][_0x0e5a('0xd')][_0x0e5a('0xe')]()]&&_0x1e5ae1['push'](util[_0x0e5a('0x15')]('%s:\x20%s',_0x4c4619['key'],_0x1914fb[_0x4c4619[_0x0e5a('0xc')][_0x0e5a('0xd')][_0x0e5a('0xe')]()]));}}}}return _0x1e5ae1[_0x0e5a('0x16')](_0x2e4309);};exports[_0x0e5a('0x17')]=function(_0x2a277b){var _0x46473f=_0x2a277b[_0x0e5a('0x18')](-0x1);if(_0x46473f==='/'){_0x2a277b=_0x2a277b[_0x0e5a('0x19')](0x0,_0x2a277b[_0x0e5a('0x1a')](_0x46473f));}return _0x2a277b;};exports[_0x0e5a('0x1b')]=function(_0x50c365){if(!_[_0x0e5a('0x1c')](_0x50c365)&&_0x50c365!==''){var _0x97cb2c=/^(([^<>()\[\]\\.,;:\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 _0x97cb2c['test'](String(_0x50c365)[_0x0e5a('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 2ed6823..0642a8c 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 _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 +var _0x9800=['createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','Agent\x20found!','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','catch','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','Searching\x20end\x20user\x20with\x20phone','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridnum','trigger:browser:url','unmanaged','toUpperCase','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','then','success','resolve','result','stringify','error','statusCode'];(function(_0x4c3267,_0xf2b77){var _0xfa5c9=function(_0x445e6d){while(--_0x445e6d){_0x4c3267['push'](_0x4c3267['shift']());}};_0xfa5c9(++_0xf2b77);}(_0x9800,0x17b));var _0x0980=function(_0x53df06,_0x35c07c){_0x53df06=_0x53df06-0x0;var _0x211e96=_0x9800[_0x53df06];return _0x211e96;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x0980('0x0'));var md5=require(_0x0980('0x1'));var util=require(_0x0980('0x2'));var Redis=require(_0x0980('0x3'));var intUtil=require(_0x0980('0x4'));var config=require(_0x0980('0x5'));var logger=require('../../../../config/logger')(_0x0980('0x6'));config[_0x0980('0x7')]=_[_0x0980('0x8')](config[_0x0980('0x7')],{'host':_0x0980('0x9'),'port':0x18eb});var io=require(_0x0980('0xa'))(new Redis(config[_0x0980('0x7')]));function emit(_0x3d280a,_0xd50383,_0x264caa){io['to'](_0x3d280a)[_0x0980('0xb')](_0xd50383,_0x264caa);}function getCustomFields(_0x6d709,_0x125c20){var _0x2249f4={};if(_0x6d709[_0x0980('0xc')]>0x0){_['forEach'](_0x6d709,function(_0x1ad6e1){if(_0x1ad6e1['type']===_0x0980('0xd')&&_0x1ad6e1['idField']){_0x2249f4[_0x1ad6e1[_0x0980('0xe')]]=_0x1ad6e1[_0x0980('0xf')][_0x0980('0x10')]();}else if(_0x1ad6e1[_0x0980('0x11')]===_0x0980('0x12')&&_0x1ad6e1[_0x0980('0x13')]&&_0x1ad6e1[_0x0980('0xe')]&&_0x125c20[_0x1ad6e1[_0x0980('0x13')]]){_0x2249f4[_0x1ad6e1[_0x0980('0xe')]]=_0x125c20[_0x1ad6e1[_0x0980('0x13')]][_0x0980('0x10')]();}else if(_0x1ad6e1['type']===_0x0980('0x14')&&_0x1ad6e1['Variable']&&_0x1ad6e1[_0x0980('0x15')][_0x0980('0x16')]&&_0x1ad6e1['idField']&&_0x125c20[_0x1ad6e1[_0x0980('0x15')]['name'][_0x0980('0x17')]()]){_0x2249f4[_0x1ad6e1[_0x0980('0xe')]]=_0x125c20[_0x1ad6e1[_0x0980('0x15')][_0x0980('0x16')][_0x0980('0x17')]()][_0x0980('0x10')]();}});}return _0x2249f4;}function createTicket(_0x339a75,_0x29ad06,_0x4697de,_0x30f46d,_0x54c1cd,_0x2e6e64,_0x369d55){logger[_0x0980('0x18')](_0x0980('0x19'));var _0x56c725=_[_0x0980('0x1a')]({'parent_id':'','assigned_user_id':_0x29ad06['id'],'ticketpriorities':_0x0980('0x1b'),'ticketstatus':_0x0980('0x1c'),'ticket_title':intUtil[_0x0980('0x1d')](_0x30f46d[_0x0980('0x1e')],_0x54c1cd,'\x20'),'description':intUtil[_0x0980('0x1d')](_0x30f46d['Descriptions'],_0x54c1cd,'\x0a'),'contact_id':_0x4697de['id']},getCustomFields(_0x2e6e64,_0x54c1cd));var _0x18a6bc={'method':'POST','uri':util[_0x0980('0x1f')](_0x0980('0x20'),_0x339a75[_0x0980('0x21')]),'form':{'operation':_0x0980('0x22'),'username':_0x339a75[_0x0980('0x23')],'sessionName':_0x369d55[_0x0980('0x24')],'elementType':_0x0980('0x25'),'element':JSON['stringify'](_0x56c725)},'json':!![]};return request(_0x18a6bc)[_0x0980('0x26')](function(_0x271c1e){if(_0x271c1e[_0x0980('0x27')]){return BPromise[_0x0980('0x28')]({'id':_0x271c1e[_0x0980('0x29')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x0980('0x2a')](_0x271c1e[_0x0980('0x2b')])));}})['catch'](function(_0x36c0d3){var _0x5f1167=_0x36c0d3[_0x0980('0x2c')]||0x1f4;logger[_0x0980('0x2b')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0980('0x2d'),_0x5f1167,JSON[_0x0980('0x2a')](_0x36c0d3));});}function getUser(_0x273054,_0x191164,_0x228c93){if(intUtil[_0x0980('0x2e')](_0x191164)){logger[_0x0980('0x18')](_0x0980('0x2f'),_0x191164);return request({'method':_0x0980('0x30'),'uri':util[_0x0980('0x1f')](_0x0980('0x20'),_0x273054[_0x0980('0x21')]),'qs':{'operation':'query','username':_0x273054[_0x0980('0x23')],'sessionName':_0x228c93[_0x0980('0x24')],'query':util[_0x0980('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x191164)},'json':!![]})[_0x0980('0x26')](function(_0x19a00b){if(_0x19a00b[_0x0980('0x27')]&&_0x19a00b['result'][_0x0980('0xc')]){logger['info'](_0x0980('0x31'));return BPromise['resolve']({'id':_0x19a00b['result'][0x0]['id'],'email':_0x19a00b[_0x0980('0x29')][0x0]['email1'],'name':_0x19a00b[_0x0980('0x29')][0x0][_0x0980('0x32')]+'\x20'+_0x19a00b['result'][_0x0980('0x33')]});}else{logger[_0x0980('0x18')](_0x0980('0x34'));return BPromise['resolve']({'id':_0x228c93[_0x0980('0x35')],'email':_0x273054['username'],'name':'admin'});}})[_0x0980('0x36')](function(_0x11c130){var _0x1048b1=_0x11c130['statusCode']||0x1f4;logger[_0x0980('0x2b')](_0x0980('0x37'),_0x0980('0x38'),_0x1048b1,JSON[_0x0980('0x2a')](_0x11c130));});}else{logger[_0x0980('0x18')](_0x0980('0x34'));return BPromise['resolve']({'id':_0x228c93[_0x0980('0x35')],'email':_0x273054[_0x0980('0x23')],'name':_0x0980('0x39')})[_0x0980('0x36')](function(_0x42a64c){var _0x197dc8=_0x42a64c['statusCode']||0x1f4;logger[_0x0980('0x2b')](_0x0980('0x37'),_0x0980('0x38'),_0x197dc8,JSON['stringify'](_0x42a64c));});}}function getEndUser(_0x4bd006,_0x54c430,_0x495aa7,_0x3e4e24){logger[_0x0980('0x18')](_0x0980('0x3a'),_0x495aa7);return request({'method':_0x0980('0x30'),'uri':util[_0x0980('0x1f')](_0x0980('0x20'),_0x4bd006[_0x0980('0x21')]),'qs':{'operation':_0x0980('0x3b'),'username':_0x4bd006[_0x0980('0x23')],'sessionName':_0x3e4e24[_0x0980('0x24')],'query':util['format'](_0x0980('0x3c'),_0x495aa7,_0x495aa7,_0x495aa7,_0x495aa7,_0x495aa7)},'json':!![]})['then'](function(_0x9fd9ab){if(_0x9fd9ab[_0x0980('0x27')]&&_0x9fd9ab[_0x0980('0x29')]['length']){logger[_0x0980('0x18')]('Enduser\x20found!');return BPromise[_0x0980('0x28')]({'id':_0x9fd9ab[_0x0980('0x29')][0x0]['id'],'name':_0x9fd9ab[_0x0980('0x29')][0x0][_0x0980('0x3d')]+'\x20'+_0x9fd9ab[_0x0980('0x29')][0x0][_0x0980('0x3e')],'phone':_0x495aa7});}else{logger[_0x0980('0x18')](_0x0980('0x3f'));return request({'method':_0x0980('0x40'),'uri':util[_0x0980('0x1f')](_0x0980('0x20'),_0x4bd006[_0x0980('0x21')]),'form':{'operation':'create','sessionName':_0x3e4e24[_0x0980('0x24')],'elementType':_0x0980('0x41'),'element':JSON[_0x0980('0x2a')]({'lastname':_0x54c430,'phone':_0x495aa7,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x56f9f6){logger[_0x0980('0x18')](_0x0980('0x42'));return BPromise[_0x0980('0x28')]({'id':_0x56f9f6['result']['id'],'name':_0x56f9f6['result'][_0x0980('0x3e')],'phone':_0x56f9f6[_0x0980('0x29')][_0x0980('0x43')]});})[_0x0980('0x36')](function(_0x4e0d0b){var _0x273386=_0x4e0d0b[_0x0980('0x2c')]||0x1f4;logger['error'](_0x0980('0x37'),_0x0980('0x44'),_0x273386,JSON[_0x0980('0x2a')](_0x4e0d0b));});}});}function getConnection(_0xcf6085){var _0x497256=_0xcf6085[_0x0980('0x23')];var _0x39f8e0=_0xcf6085[_0x0980('0x45')];return request({'method':_0x0980('0x30'),'uri':util['format'](_0x0980('0x20'),_0xcf6085[_0x0980('0x21')]),'qs':{'operation':_0x0980('0x46'),'username':_0x497256},'json':!![]})[_0x0980('0x26')](function(_0x2eacb5){if(_0x2eacb5[_0x0980('0x27')]){return request({'method':_0x0980('0x40'),'uri':util[_0x0980('0x1f')](_0x0980('0x20'),_0xcf6085[_0x0980('0x21')]),'form':{'operation':_0x0980('0x47'),'username':_0x497256,'accessKey':md5(_0x2eacb5[_0x0980('0x29')][_0x0980('0x48')]+_0x39f8e0)},'json':!![]});}})['then'](function(_0x18842a){if(_0x18842a[_0x0980('0x27')]){return BPromise[_0x0980('0x28')](_0x18842a[_0x0980('0x29')]);}else{throw new Error(util[_0x0980('0x1f')](_0x0980('0x49'),_0xcf6085['id']));}})[_0x0980('0x36')](function(_0x31532d){var _0x24a8fd=_0x31532d[_0x0980('0x2c')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x0980('0x4a'),_0x24a8fd,JSON[_0x0980('0x2a')](_0x31532d));});}function request(_0x599e1b){logger[_0x0980('0x18')](_0x0980('0x4b'),JSON[_0x0980('0x2a')](_0x599e1b));return rp(_0x599e1b);}exports[_0x0980('0x4c')]=function(_0x82d8e0,_0x3435c5,_0x44fb9d,_0x3fba7f,_0x1f3aca,_0x4dd4d3){var _0x476359,_0x52b263,_0x57dc2c,_0x26a0ea;_0x4dd4d3[_0x0980('0x21')]=intUtil[_0x0980('0x4d')](_0x4dd4d3[_0x0980('0x21')]);if(_0x1f3aca&&_0x1f3aca[_0x0980('0x4e')]){logger['info']('[QUEUE]',_0x0980('0x4f'));_0x3435c5['recordingURL']=util[_0x0980('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4dd4d3[_0x0980('0x50')],_0x3435c5[_0x0980('0x51')],md5(_0x3435c5[_0x0980('0x51')]));}else{_0x3435c5[_0x0980('0x52')]='';}return getConnection(_0x4dd4d3)[_0x0980('0x26')](function(_0x3a4047){_0x26a0ea=_0x3a4047;return getUser(_0x4dd4d3,_0x3fba7f[_0x0980('0x53')],_0x26a0ea);})['then'](function(_0x4b37d5){_0x476359=_0x4b37d5;logger[_0x0980('0x18')]('The\x20User\x20ID\x20is:',_0x476359['id']);return getEndUser(_0x4dd4d3,_0x3435c5[_0x0980('0x54')],_0x3435c5[_0x0980('0x55')],_0x26a0ea);})[_0x0980('0x26')](function(_0x4fcae4){_0x52b263=_0x4fcae4;logger[_0x0980('0x18')](_0x0980('0x56'),_0x52b263['id']);return createTicket(_0x4dd4d3,_0x476359,_0x52b263,_0x44fb9d,_0x3435c5,_0x44fb9d[_0x0980('0x57')],_0x26a0ea);})[_0x0980('0x26')](function(_0x173549){_0x57dc2c=_0x173549;logger['info'](_0x0980('0x58'));logger['info'](_0x0980('0x59'),_0x57dc2c['id']);var _0x507b8a=util[_0x0980('0x1f')](_0x0980('0x5a'),_0x4dd4d3[_0x0980('0x21')],_[_0x0980('0x5b')](_0x57dc2c['id'],'x')[0x1]);logger[_0x0980('0x18')](_0x0980('0x5c'),_0x0980('0x5d'));emit(util['format'](_0x0980('0x5e'),_0x3fba7f['name']),'trigger:browser:url',{'uri':_0x507b8a});})[_0x0980('0x36')](function(_0x132a4c){logger[_0x0980('0x2b')](_0x0980('0x5c'),JSON[_0x0980('0x2a')](_0x132a4c));});};exports[_0x0980('0x5f')]=function(_0x3f727a,_0x516308,_0x46a8f0,_0x25c880,_0x3f40b3,_0x5840d2,_0x3ed634){var _0x2e29a6,_0x197b5e,_0x8c1d99,_0x4d7685;_0x5840d2[_0x0980('0x21')]=intUtil[_0x0980('0x4d')](_0x5840d2[_0x0980('0x21')]);_0x5840d2[_0x0980('0x50')]=intUtil[_0x0980('0x4d')](_0x5840d2['serverUrl']);if(_0x3ed634&&_0x3ed634[_0x0980('0x60')]&&_0x3ed634[_0x0980('0x60')]!==_0x0980('0x61')){logger[_0x0980('0x18')](_0x0980('0x62'),_0x0980('0x4f'));_0x516308[_0x0980('0x52')]=util[_0x0980('0x1f')](_0x0980('0x63'),_0x5840d2[_0x0980('0x50')],_0x516308[_0x0980('0x51')],md5(_0x516308[_0x0980('0x51')]));}return getConnection(_0x5840d2)['then'](function(_0x5eea28){_0x4d7685=_0x5eea28;return getUser(_0x5840d2,_0x25c880['email'],_0x4d7685);})[_0x0980('0x26')](function(_0x75c5da){_0x2e29a6=_0x75c5da;logger[_0x0980('0x18')](_0x0980('0x64'),_0x2e29a6['id']);return getEndUser(_0x5840d2,_0x516308['destcalleridname'],_0x516308[_0x0980('0x65')],_0x4d7685);})[_0x0980('0x26')](function(_0x4c15b5){_0x197b5e=_0x4c15b5;logger[_0x0980('0x18')]('The\x20Enduser\x20ID\x20is:',_0x197b5e['id']);return createTicket(_0x5840d2,_0x2e29a6,_0x197b5e,_0x46a8f0,_0x516308,_0x46a8f0[_0x0980('0x57')],_0x4d7685);})[_0x0980('0x26')](function(_0x2d024f){_0x8c1d99=_0x2d024f;logger['info'](_0x0980('0x58'));logger[_0x0980('0x18')](_0x0980('0x59'),_0x8c1d99['id']);var _0x175f57=util['format'](_0x0980('0x5a'),_0x5840d2['remoteUri'],_[_0x0980('0x5b')](_0x8c1d99['id'],'x')[0x1]);logger['info']('[OUTBOUND]',_0x0980('0x5d'));emit(util[_0x0980('0x1f')](_0x0980('0x5e'),_0x25c880[_0x0980('0x16')]),_0x0980('0x66'),{'uri':_0x175f57});})['catch'](function(_0xec53f9){logger[_0x0980('0x2b')](_0x0980('0x62'),JSON[_0x0980('0x2a')](_0xec53f9));});};exports[_0x0980('0x67')]=function(_0xb8d670,_0x4f0ff9,_0x535b6e,_0x47f7c5,_0x2efe02,_0x3dff44){var _0x1e9a34,_0x420c8f,_0x19b209,_0x19be9f;_0x3dff44['remoteUri']=intUtil[_0x0980('0x4d')](_0x3dff44[_0x0980('0x21')]);_0x3dff44['serverUrl']=intUtil[_0x0980('0x4d')](_0x3dff44[_0x0980('0x50')]);if(_0x2efe02&&_0x2efe02['monitor_format']){logger[_0x0980('0x18')]('['+_0x4f0ff9['lastevent'][_0x0980('0x68')]()+']',_0x0980('0x4f'));_0x4f0ff9[_0x0980('0x52')]=util['format'](_0x0980('0x63'),_0x3dff44[_0x0980('0x50')],_0x4f0ff9[_0x0980('0x51')],md5(_0x4f0ff9[_0x0980('0x51')]));}else{_0x4f0ff9[_0x0980('0x52')]='';}return getConnection(_0x3dff44)[_0x0980('0x26')](function(_0x5408b6){_0x19be9f=_0x5408b6;return getUser(_0x3dff44,'',_0x19be9f);})[_0x0980('0x26')](function(_0x520292){_0x1e9a34=_0x520292;logger['info'](_0x0980('0x64'),_0x1e9a34['id']);return getEndUser(_0x3dff44,_0x4f0ff9[_0x0980('0x54')],_0x4f0ff9[_0x0980('0x55')],_0x19be9f);})[_0x0980('0x26')](function(_0x3fcc4c){_0x420c8f=_0x3fcc4c;logger['info'](_0x0980('0x56'),_0x420c8f['id']);return createTicket(_0x3dff44,_0x1e9a34,_0x420c8f,_0x535b6e,_0x4f0ff9,_0x535b6e['Fields'],_0x19be9f);})[_0x0980('0x26')](function(_0x2994ce){_0x19b209=_0x2994ce;logger[_0x0980('0x18')]('Ticket\x20created!');logger[_0x0980('0x18')](_0x0980('0x59'),_0x19b209['id']);})[_0x0980('0x36')](function(_0x45da17){logger[_0x0980('0x2b')]('['+_0x4f0ff9[_0x0980('0x69')][_0x0980('0x68')]()+']',JSON[_0x0980('0x2a')](_0x45da17));});}; \ 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 8f4d7bb..ccfed18 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 _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 +var _0xb4d5=['%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','authType','password','%s:%s','username','%s/token:%s','token','base64','debug','[HTTP]','GET','forEach','type','string','nameField','customField','content','toString','idField','custom_fields','variable','variableName','customVariable','Variable','toLowerCase','push','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','[OUTBOUND]','user:%s','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','POST','merge','Tags','name','Subjects','getString','Descriptions','then','info','Ticket\x20created!','ticket'];(function(_0x5646fe,_0x1aa9c0){var _0x2171ea=function(_0xd812e1){while(--_0xd812e1){_0x5646fe['push'](_0x5646fe['shift']());}};_0x2171ea(++_0x1aa9c0);}(_0xb4d5,0x18e));var _0x5b4d=function(_0x1047e2,_0x218385){_0x1047e2=_0x1047e2-0x0;var _0x1c957c=_0xb4d5[_0x1047e2];return _0x1c957c;};'use strict';var _=require(_0x5b4d('0x0'));var rp=require(_0x5b4d('0x1'));var md5=require(_0x5b4d('0x2'));var util=require('util');var Redis=require(_0x5b4d('0x3'));var intUtil=require(_0x5b4d('0x4'));var config=require(_0x5b4d('0x5'));var logger=require(_0x5b4d('0x6'))(_0x5b4d('0x7'));config[_0x5b4d('0x8')]=_[_0x5b4d('0x9')](config[_0x5b4d('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x5b4d('0xa'))(new Redis(config[_0x5b4d('0x8')]));function emit(_0x2933ab,_0x1f7084,_0x11afa1){io['to'](_0x2933ab)[_0x5b4d('0xb')](_0x1f7084,_0x11afa1);}var headers={'Content-Type':_0x5b4d('0xc'),'Accept':_0x5b4d('0xc')};function getTicket(_0x1ffe3d,_0x4d0e1a,_0x507cb0,_0x5dbd55,_0x4c044a){logger['info'](_0x5b4d('0xd'));return request({'uri':util[_0x5b4d('0xe')]('%s/tickets.json',_0x1ffe3d['remoteUri']),'method':_0x5b4d('0xf'),'body':{'ticket':_[_0x5b4d('0x10')]({'requester_id':_0x507cb0['id'],'submitter_id':_0x4d0e1a?_0x4d0e1a['id']:undefined,'assignee_id':_0x4d0e1a?_0x4d0e1a['id']:undefined,'tags':getTags(_0x5dbd55[_0x5b4d('0x11')],_0x5b4d('0x12')),'subject':intUtil['getString'](_0x5dbd55[_0x5b4d('0x13')],_0x4c044a,'\x20'),'description':intUtil[_0x5b4d('0x14')](_0x5dbd55[_0x5b4d('0x15')],_0x4c044a,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5b4d('0x14')](_0x5dbd55[_0x5b4d('0x15')],_0x4c044a,'\x0a')}},getCustomFields(_0x5dbd55['Fields'],_0x4c044a))}})[_0x5b4d('0x16')](function(_0x504655){logger[_0x5b4d('0x17')](_0x5b4d('0x18'));return _0x504655[_0x5b4d('0x19')];});}function getUser(_0x1f2b78,_0x5f074e){if(intUtil['validateEmail'](_0x5f074e)){logger['info']('Getting\x20agent\x20with\x20email',_0x5f074e);return request({'uri':util[_0x5b4d('0xe')](_0x5b4d('0x1a'),_0x1f2b78[_0x5b4d('0x1b')]),'qs':{'query':util[_0x5b4d('0xe')](_0x5b4d('0x1c'),_0x5f074e)}})[_0x5b4d('0x16')](function(_0x227423){if(_0x227423[_0x5b4d('0x1d')]){logger['info'](_0x5b4d('0x1e'));return _['find'](_0x227423[_0x5b4d('0x1f')],{'email':_0x5f074e,'role':'agent'});}else{logger[_0x5b4d('0x17')](_0x5b4d('0x20'));return request({'uri':util[_0x5b4d('0xe')](_0x5b4d('0x21'),_0x1f2b78[_0x5b4d('0x1b')])})['then'](function(_0x85f45c){logger[_0x5b4d('0x17')](_0x5b4d('0x22'));return _0x85f45c[_0x5b4d('0x23')];});}});}else{logger[_0x5b4d('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5b4d('0xe')](_0x5b4d('0x21'),_0x1f2b78['remoteUri'])})[_0x5b4d('0x16')](function(_0x49752d){logger[_0x5b4d('0x17')]('Admin\x20account\x20selected.');return _0x49752d[_0x5b4d('0x23')];});}}function getEndUser(_0x54b50b,_0x595626,_0x4b02f7){logger[_0x5b4d('0x17')](_0x5b4d('0x24'),_0x4b02f7);return request({'uri':util[_0x5b4d('0xe')]('%s/search.json',_0x54b50b[_0x5b4d('0x1b')]),'qs':{'query':util[_0x5b4d('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x4b02f7)}})[_0x5b4d('0x16')](function(_0x4f6b5d){var _0x1cfff6;if(_0x4f6b5d[_0x5b4d('0x1f')][_0x5b4d('0x25')]){_0x4f6b5d[_0x5b4d('0x1f')]=_[_0x5b4d('0x26')](_0x4f6b5d[_0x5b4d('0x1f')],{'suspended':![],'role':_0x5b4d('0x27')});if(_0x4f6b5d[_0x5b4d('0x1f')][_0x5b4d('0x25')]){_0x1cfff6=_[_0x5b4d('0x28')](_0x4f6b5d['results']);}}if(_0x1cfff6){logger['info'](_0x5b4d('0x29'));return _0x1cfff6;}else{logger[_0x5b4d('0x17')](_0x5b4d('0x2a'));return request({'uri':util[_0x5b4d('0xe')](_0x5b4d('0x2b'),_0x54b50b['remoteUri']),'method':_0x5b4d('0xf'),'body':{'user':{'role':_0x5b4d('0x27'),'name':util['format']('Caller\x20-\x20%s',_0x595626||_0x4b02f7),'phone':_0x4b02f7}}})[_0x5b4d('0x16')](function(_0x1234e3){logger['info']('Enduser\x20created.');return _0x1234e3[_0x5b4d('0x23')];});}});}function getAuth(_0x314659){var _0x598441;if(_0x314659[_0x5b4d('0x2c')]===_0x5b4d('0x2d')){_0x598441=util[_0x5b4d('0xe')](_0x5b4d('0x2e'),_0x314659[_0x5b4d('0x2f')],_0x314659[_0x5b4d('0x2d')]);}else if(_0x314659[_0x5b4d('0x2c')]==='token'){_0x598441=util['format'](_0x5b4d('0x30'),_0x314659[_0x5b4d('0x2f')],_0x314659[_0x5b4d('0x31')]);}return util[_0x5b4d('0xe')]('Basic\x20%s',new Buffer(_0x598441)['toString'](_0x5b4d('0x32')));}function request(_0x189f7f){logger[_0x5b4d('0x33')](_0x5b4d('0x34'),JSON['stringify'](_0x189f7f));return rp(_[_0x5b4d('0x9')](_0x189f7f,{'method':_0x5b4d('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x1c717c,_0x3c052a){var _0x5abc1a=[];if(_0x1c717c&&_0x1c717c[_0x5b4d('0x25')]>0x0){_0x5abc1a=_['map'](_0x1c717c,_0x3c052a);}return _0x5abc1a;}function getCustomFields(_0x354a39,_0x194496){var _0x4fe55d=[];var _0x51e8bc={'custom_fields':[]};if(_0x354a39[_0x5b4d('0x25')]>0x0){_[_0x5b4d('0x36')](_0x354a39,function(_0x253ecc){if(_0x253ecc[_0x5b4d('0x37')]===_0x5b4d('0x38')&&_0x253ecc[_0x5b4d('0x39')]&&!_0x253ecc[_0x5b4d('0x3a')]){_0x51e8bc[_0x253ecc['nameField']['toLowerCase']()]=_0x253ecc[_0x5b4d('0x3b')][_0x5b4d('0x3c')]();}else if(_0x253ecc[_0x5b4d('0x37')]===_0x5b4d('0x38')&&_0x253ecc[_0x5b4d('0x3d')]&&_0x253ecc['customField']){_0x51e8bc[_0x5b4d('0x3e')]['push']({'id':_0x253ecc[_0x5b4d('0x3d')],'value':_0x253ecc[_0x5b4d('0x3b')][_0x5b4d('0x3c')]()});}else if(_0x253ecc[_0x5b4d('0x37')]===_0x5b4d('0x3f')&&_0x253ecc['variableName']&&_0x253ecc[_0x5b4d('0x3d')]&&_0x253ecc[_0x5b4d('0x3a')]){_0x194496[_0x253ecc[_0x5b4d('0x40')]]&&_0x51e8bc[_0x5b4d('0x3e')]['push']({'id':_0x253ecc[_0x5b4d('0x3d')],'value':_0x194496[_0x253ecc[_0x5b4d('0x40')]][_0x5b4d('0x3c')]()});}else if(_0x253ecc['type']===_0x5b4d('0x41')&&_0x253ecc[_0x5b4d('0x42')]&&_0x253ecc[_0x5b4d('0x42')][_0x5b4d('0x12')]&&_0x253ecc[_0x5b4d('0x3d')]&&_0x253ecc[_0x5b4d('0x3a')]){_0x194496[_0x253ecc['Variable'][_0x5b4d('0x12')][_0x5b4d('0x43')]()]&&_0x51e8bc[_0x5b4d('0x3e')][_0x5b4d('0x44')]({'id':_0x253ecc[_0x5b4d('0x3d')],'value':_0x194496[_0x253ecc['Variable'][_0x5b4d('0x12')]['toLowerCase']()][_0x5b4d('0x3c')]()});}});}return _0x51e8bc;}exports['queue']=function(_0x26b80c,_0x293444,_0x5d3d12,_0xe6c9d3,_0x18c8f6,_0x2ca448){var _0x24eafd,_0x2265b3;_0x2ca448[_0x5b4d('0x1b')]=intUtil[_0x5b4d('0x45')](_0x2ca448['remoteUri']);_0x2ca448['serverUrl']=intUtil['stripTrailingSlash'](_0x2ca448['serverUrl']);if(_0x18c8f6&&_0x18c8f6[_0x5b4d('0x46')]){logger[_0x5b4d('0x17')](_0x5b4d('0x47'),_0x5b4d('0x48'));_0x293444[_0x5b4d('0x49')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2ca448[_0x5b4d('0x4a')],_0x293444[_0x5b4d('0x4b')],md5(_0x293444[_0x5b4d('0x4b')]));}else{_0x293444['recordingURL']='';}headers[_0x5b4d('0x4c')]=getAuth(_0x2ca448);return getUser(_0x2ca448,_0xe6c9d3[_0x5b4d('0x4d')])['then'](function(_0x157ff4){_0x24eafd=_0x157ff4;logger[_0x5b4d('0x17')]('The\x20User\x20ID\x20is:',_0x24eafd['id']);return getEndUser(_0x2ca448,_0x293444[_0x5b4d('0x4e')],_0x293444[_0x5b4d('0x4f')]);})[_0x5b4d('0x16')](function(_0x135a56){_0x2265b3=_0x135a56;logger['info'](_0x5b4d('0x50'),_0x2265b3['id']);return getTicket(_0x2ca448,_0x24eafd,_0x2265b3,_0x5d3d12,_0x293444);})[_0x5b4d('0x16')](function(_0x2a98bd){if(_0x2a98bd){logger[_0x5b4d('0x17')](_0x5b4d('0x51'),_0x2a98bd['id']);switch(_0x2ca448[_0x5b4d('0x37')]){case'integrationTab':logger[_0x5b4d('0x17')]('[QUEUE]',_0x5b4d('0x52'));return request({'uri':util[_0x5b4d('0xe')](_0x5b4d('0x53'),_0x2ca448[_0x5b4d('0x1b')],_0x24eafd['id'],_0x2a98bd['id']),'method':_0x5b4d('0xf')});case'newTab':logger[_0x5b4d('0x17')](_0x5b4d('0x47'),_0x5b4d('0x54'));emit(util[_0x5b4d('0xe')]('user:%s',_0xe6c9d3[_0x5b4d('0x12')]),_0x5b4d('0x55'),{'uri':util[_0x5b4d('0xe')]('%s/agent/tickets/%s',_0x2ca448[_0x5b4d('0x1b')][_0x5b4d('0x56')](_0x5b4d('0x57'),''),_0x2a98bd['id'])});break;default:logger[_0x5b4d('0x58')](_0x5b4d('0x47'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5b4d('0x59')](function(_0x301ba9){logger[_0x5b4d('0x58')](_0x5b4d('0x5a'),util[_0x5b4d('0x5b')](_0x301ba9,{'showHidden':!![],'depth':null}));});};exports[_0x5b4d('0x5c')]=function(_0xe523c4,_0x20cc1f,_0x3345b6,_0x11fbe9,_0x46ddcc,_0x2d9fc5,_0x32c40c){var _0x2d85dc,_0x50f2fc;_0x2d9fc5[_0x5b4d('0x1b')]=intUtil[_0x5b4d('0x45')](_0x2d9fc5['remoteUri']);_0x2d9fc5['serverUrl']=intUtil[_0x5b4d('0x45')](_0x2d9fc5[_0x5b4d('0x4a')]);if(_0x32c40c&&_0x32c40c['recordingFormat']&&_0x32c40c[_0x5b4d('0x5d')]!==_0x5b4d('0x5e')){logger[_0x5b4d('0x17')]('[OUTBOUND]',_0x5b4d('0x48'));_0x20cc1f[_0x5b4d('0x49')]=util[_0x5b4d('0xe')](_0x5b4d('0x5f'),_0x2d9fc5[_0x5b4d('0x4a')],_0x20cc1f[_0x5b4d('0x4b')],md5(_0x20cc1f['uniqueid']));}headers['Authorization']=getAuth(_0x2d9fc5);return getUser(_0x2d9fc5,_0x11fbe9[_0x5b4d('0x4d')])[_0x5b4d('0x16')](function(_0x6605c7){_0x2d85dc=_0x6605c7;logger[_0x5b4d('0x17')](_0x5b4d('0x60'),_0x2d85dc['id']);return getEndUser(_0x2d9fc5,_0x20cc1f[_0x5b4d('0x61')],_0x20cc1f['destcalleridnum']);})['then'](function(_0x40ede7){_0x50f2fc=_0x40ede7;logger[_0x5b4d('0x17')](_0x5b4d('0x50'),_0x50f2fc['id']);return getTicket(_0x2d9fc5,_0x2d85dc,_0x50f2fc,_0x3345b6,_0x20cc1f);})['then'](function(_0x2ea150){if(_0x2ea150){logger[_0x5b4d('0x17')](_0x5b4d('0x51'),_0x2ea150['id']);switch(_0x2d9fc5['type']){case'integrationTab':logger['info'](_0x5b4d('0x62'),_0x5b4d('0x52'));return request({'uri':util[_0x5b4d('0xe')](_0x5b4d('0x53'),_0x2d9fc5['remoteUri'],_0x2d85dc['id'],_0x2ea150['id']),'method':'POST'});case'newTab':logger['info'](_0x5b4d('0x62'),_0x5b4d('0x54'));emit(util[_0x5b4d('0xe')](_0x5b4d('0x63'),_0x11fbe9[_0x5b4d('0x12')]),_0x5b4d('0x55'),{'uri':util[_0x5b4d('0xe')](_0x5b4d('0x64'),_0x2d9fc5[_0x5b4d('0x1b')][_0x5b4d('0x56')](_0x5b4d('0x57'),''),_0x2ea150['id'])});break;default:logger[_0x5b4d('0x58')](_0x5b4d('0x62'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5b4d('0x59')](function(_0x13bf42){logger[_0x5b4d('0x58')](_0x5b4d('0x65'),util[_0x5b4d('0x5b')](_0x13bf42,{'showHidden':!![],'depth':null}));});};exports[_0x5b4d('0x66')]=function(_0x4cc4e3,_0x1435a0,_0x51f925,_0x5aa319,_0x2232c4,_0x406bdb){var _0x2cf13b,_0x4e65b9;_0x406bdb[_0x5b4d('0x1b')]=intUtil[_0x5b4d('0x45')](_0x406bdb['remoteUri']);_0x406bdb[_0x5b4d('0x4a')]=intUtil[_0x5b4d('0x45')](_0x406bdb[_0x5b4d('0x4a')]);if(_0x2232c4&&_0x2232c4[_0x5b4d('0x46')]){logger[_0x5b4d('0x17')]('['+_0x1435a0[_0x5b4d('0x67')]['toUpperCase']()+']',_0x5b4d('0x48'));_0x1435a0[_0x5b4d('0x49')]=util['format'](_0x5b4d('0x5f'),_0x406bdb['serverUrl'],_0x1435a0[_0x5b4d('0x4b')],md5(_0x1435a0['uniqueid']));}else{_0x1435a0[_0x5b4d('0x49')]='';}headers['Authorization']=getAuth(_0x406bdb);return getUser(_0x406bdb)[_0x5b4d('0x16')](function(_0x1b8d0c){_0x2cf13b=_0x1b8d0c;logger[_0x5b4d('0x17')]('The\x20User\x20ID\x20is:',_0x2cf13b['id']);return getEndUser(_0x406bdb,_0x1435a0['calleridname'],_0x1435a0['calleridnum']);})[_0x5b4d('0x16')](function(_0xdd6c04){_0x4e65b9=_0xdd6c04;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4e65b9['id']);return getTicket(_0x406bdb,_0x2cf13b,_0x4e65b9,_0x51f925,_0x1435a0);})['then'](function(_0x4a244e){if(_0x4a244e){logger[_0x5b4d('0x17')](_0x5b4d('0x51'),_0x4a244e['id']);}})['catch'](function(_0x4d8d7c){logger['error']('['+_0x1435a0[_0x5b4d('0x67')][_0x5b4d('0x68')]()+']'+_0x5b4d('0x69'),util['inspect'](_0x4d8d7c,{'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 9934b58..b9586a4 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 _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 +var _0x7d8a=['email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','serverUrl','recordingFormat','none','[OUTBOUND]','com','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','[HTTP]','length','string','idField','toString','type','variableName','customVariable','Variable','name','toLowerCase','indexOf','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','error','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','then','users','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','enduserType','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Who_Id','Full_Name','Last_Name','What_Id','First_Name','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','merge','/crm/v2/Calls','Call\x20created!','details','err','queue','host','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu'];(function(_0x311398,_0x468143){var _0x144159=function(_0x114a66){while(--_0x114a66){_0x311398['push'](_0x311398['shift']());}};_0x144159(++_0x468143);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0x7d8a[_0xc77819];return _0x1c9434;};'use strict';var _=require(_0xa7d8('0x0'));var rp=require(_0xa7d8('0x1'));var md5=require(_0xa7d8('0x2'));var util=require(_0xa7d8('0x3'));var intUtil=require(_0xa7d8('0x4'));var moment=require(_0xa7d8('0x5'));var Redis=require(_0xa7d8('0x6'));var BPromise=require(_0xa7d8('0x7'));var config=require(_0xa7d8('0x8'));var logger=require(_0xa7d8('0x9'))(_0xa7d8('0xa'));config[_0xa7d8('0xb')]=_[_0xa7d8('0xc')](config[_0xa7d8('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xa7d8('0xd'))(new Redis(config[_0xa7d8('0xb')]));function emit(_0x1807cc,_0x455082,_0xb1602){io['to'](_0x1807cc)['emit'](_0x455082,_0xb1602);}function request(_0x40f419){logger['debug'](_0xa7d8('0xe'),JSON['stringify'](_0x40f419));return rp(_0x40f419);}function getCustomFields(_0xb65b09,_0x52bbea){var _0x46922b={};if(_0xb65b09[_0xa7d8('0xf')]>0x0){_['forEach'](_0xb65b09,function(_0x3a25d0){if(_0x3a25d0['type']===_0xa7d8('0x10')&&_0x3a25d0[_0xa7d8('0x11')]){_0x46922b[_0x3a25d0[_0xa7d8('0x11')]]=_0x3a25d0['content'][_0xa7d8('0x12')]();}else if(_0x3a25d0[_0xa7d8('0x13')]==='variable'&&_0x3a25d0['variableName']&&_0x3a25d0['idField']&&_0x52bbea[_0x3a25d0[_0xa7d8('0x14')]]){_0x46922b[_0x3a25d0[_0xa7d8('0x11')]]=_0x52bbea[_0x3a25d0[_0xa7d8('0x14')]][_0xa7d8('0x12')]();}else if(_0x3a25d0[_0xa7d8('0x13')]===_0xa7d8('0x15')&&_0x3a25d0[_0xa7d8('0x16')]&&_0x3a25d0[_0xa7d8('0x16')][_0xa7d8('0x17')]&&_0x3a25d0[_0xa7d8('0x11')]&&_0x52bbea[_0x3a25d0[_0xa7d8('0x16')][_0xa7d8('0x17')][_0xa7d8('0x18')]()]){_0x46922b[_0x3a25d0['idField']]=_0x52bbea[_0x3a25d0[_0xa7d8('0x16')][_0xa7d8('0x17')]['toLowerCase']()][_0xa7d8('0x12')]();}});}return _0x46922b;}function getName(_0x4114e7){if(_0x4114e7[_0xa7d8('0x19')]('\x20')>0x0){var _0xc299a=_0x4114e7['split'](/ (.+)/);if(_0xc299a[0x1]){return _0xc299a;}}return[_0x4114e7,_0x4114e7];}var accountsTokens={};function getAccessToken(_0x41d587){return new Promise(function(_0x5ec4d4,_0x33f117){if(!_[_0xa7d8('0x1a')](accountsTokens[_0x41d587['id']])&&!_['isNil'](accountsTokens[_0x41d587['id']][_0xa7d8('0x1b')])){if(moment()[_0xa7d8('0x1c')](accountsTokens[_0x41d587['id']][_0xa7d8('0x1d')])){_0x5ec4d4(accountsTokens[_0x41d587['id']][_0xa7d8('0x1b')]);}}var _0x46d9a9;switch(_0x41d587['zone']){case'US':_0x46d9a9=_0xa7d8('0x1e');break;case'AU':_0x46d9a9=_0xa7d8('0x1f');break;case'EU':_0x46d9a9='https://accounts.zoho.eu';break;case'IN':_0x46d9a9=_0xa7d8('0x20');break;case'CN':_0x46d9a9=_0xa7d8('0x21');break;default:_0x46d9a9='https://accounts.zoho.eu';break;}var _0xd09e17={'method':_0xa7d8('0x22'),'uri':_0x46d9a9+_0xa7d8('0x23'),'qs':{'refresh_token':_0x41d587[_0xa7d8('0x24')],'client_id':_0x41d587[_0xa7d8('0x25')],'client_secret':_0x41d587[_0xa7d8('0x26')],'grant_type':_0xa7d8('0x27')},'json':!![]};return rp(_0xd09e17)['then'](function(_0x2aed5b){accountsTokens[_0x41d587['id']]={'access_token':_0x2aed5b['access_token'],'expires_in':moment()[_0xa7d8('0x28')](_0x2aed5b['expires_in'],'seconds')};_0x5ec4d4(_0x2aed5b['access_token']);})['catch'](function(_0x45b800){logger[_0xa7d8('0x29')]('Failing\x20creating\x20the\x20access_token',_0x45b800[_0xa7d8('0x2a')]);_0x33f117(_0x45b800);});});}function getUser(_0x23ca78,_0x31b73d,_0x54676b,_0x4ea479){logger[_0xa7d8('0x2b')](_0xa7d8('0x2c'));return request({'method':'GET','uri':util[_0xa7d8('0x2d')](_0xa7d8('0x2e'),_0x31b73d),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23ca78},'json':!![]})[_0xa7d8('0x2f')](function(_0x3d31fa){if(_0x3d31fa[_0xa7d8('0x30')]){var _0x5b50c3=-0x1;if(_['isArrayLikeObject'](_0x3d31fa['users'])){if(!_[_0xa7d8('0x1a')](_0x4ea479)){_0x5b50c3=_[_0xa7d8('0x31')](_0x3d31fa['users'],function(_0x26433d){return _0x26433d['email']===_0x4ea479;});}if(_0x5b50c3>=0x0){logger[_0xa7d8('0x2b')]('Agent\x20found!');}else{logger[_0xa7d8('0x2b')](_0xa7d8('0x32'));_0x5b50c3=_[_0xa7d8('0x31')](_0x3d31fa['users'],function(_0x3d6c3e){return _0x3d6c3e[_0xa7d8('0x33')][_0xa7d8('0x17')]===_0xa7d8('0x34');});}return _0x3d31fa[_0xa7d8('0x30')][_0x5b50c3];}else{if(_0x3d31fa[_0xa7d8('0x35')][_0xa7d8('0x33')][_0xa7d8('0x17')]===_0xa7d8('0x34')){logger[_0xa7d8('0x2b')](_0xa7d8('0x32'));user=_0x3d31fa['user'];return user;}else{logger[_0xa7d8('0x29')](_0xa7d8('0x36'),JSON[_0xa7d8('0x37')](_0x3d31fa));throw new Error(_0xa7d8('0x38')+JSON[_0xa7d8('0x37')](_0x3d31fa));}}}else{logger['error'](_0xa7d8('0x36'),JSON[_0xa7d8('0x37')](_0x3d31fa));throw new Error(_0xa7d8('0x38')+JSON[_0xa7d8('0x37')](_0x3d31fa));}})[_0xa7d8('0x39')](function(_0x1c5cf8){console[_0xa7d8('0x29')](_0x1c5cf8);});}function getZohoUser(_0x2e1357,_0x7a614e){return new BPromise(function(_0x168478,_0x30cb87){request(_0x2e1357)[_0xa7d8('0x2f')](function(_0x5411b5){var _0x5d5e73=null;if(_0x5411b5){_0x5d5e73=_0x5411b5[_0xa7d8('0x3a')][0x0];_0x5d5e73['enduserType']=_0x7a614e;}_0x168478(_0x5d5e73);})[_0xa7d8('0x39')](function(_0x59a79a){_0x30cb87(_0x59a79a);});});}function createEndUser(_0x288bd0,_0x290bf0,_0xa83e3b,_0x3924bc,_0x177164,_0x53b328){var _0xa83e3b=getName(_0xa83e3b);return request({'method':'POST','uri':_0xa7d8('0x3b')+_0x290bf0+'/crm/v2/'+_[_0xa7d8('0x3c')](_0x53b328[_0xa7d8('0x3d')])+'s','body':{'data':[{'Last_Name':_0xa83e3b[0x1],'First_Name':_0xa83e3b[0x0],'Phone':_0x3924bc,'Owner':{'name':!_[_0xa7d8('0x1a')](_0x177164[_0xa7d8('0x3e')][_0xa7d8('0x17')])?_0x177164[_0xa7d8('0x3e')][_0xa7d8('0x17')]:!_[_0xa7d8('0x1a')](_0x177164[_0xa7d8('0x3f')])?_0x177164[_0xa7d8('0x3f')]+'\x20'+_0x177164[_0xa7d8('0x40')]:_0x177164[_0xa7d8('0x40')],'id':_0x177164['id']}}]},'headers':{'Authorization':_0xa7d8('0x41')+_0x288bd0},'json':!![]})['then'](function(_0x506efa){if(_0x506efa&&_0x506efa[_0xa7d8('0x3a')][0x0][_0xa7d8('0x42')]===_0xa7d8('0x43')){var _0x428a7d=_0x506efa[_0xa7d8('0x3a')][0x0]['details'];_0x428a7d[_0xa7d8('0x44')]=_[_0xa7d8('0x3c')](_0x53b328[_0xa7d8('0x3d')])+'s';return _0x428a7d;}logger[_0xa7d8('0x29')]('The\x20failing\x20result\x20is',JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0xa7d8('0x37')](data));})['catch'](function(_0xe7aed1){console[_0xa7d8('0x45')](_0xa7d8('0x46'),_0xe7aed1);});}function getEndUser(_0x48763c,_0x4b2241,_0x1e7970,_0x1447f8,_0x197491,_0x27e40f,_0x3f8af6){var _0x17e9b2={'method':_0xa7d8('0x47'),'uri':'','headers':{'Authorization':_0xa7d8('0x41')+_0x48763c},'json':!![]};switch(_0x3f8af6[_0xa7d8('0x48')]){case _0xa7d8('0x49'):_0x17e9b2[_0xa7d8('0x4a')]=_0xa7d8('0x3b')+_0x4b2241+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x197491+'))';return getZohoUser(_0x17e9b2,_0xa7d8('0x4b'))['then'](function(_0xd09bfd){if(_0xd09bfd)return _0xd09bfd;_0x17e9b2['uri']=_0xa7d8('0x3b')+_0x4b2241+_0xa7d8('0x4c')+_0x197491+'))';return getZohoUser(_0x17e9b2,_0xa7d8('0x4d'))[_0xa7d8('0x2f')](function(_0x2ab25e){if(_0x2ab25e)return _0x2ab25e;if(_0x3f8af6[_0xa7d8('0x3d')]!='nothing'){return createEndUser(_0x48763c,_0x4b2241,_0x1447f8,_0x197491,_0x27e40f,_0x3f8af6);}else{return{};}});});break;case _0xa7d8('0x4e'):_0x17e9b2[_0xa7d8('0x4a')]='https://www.zohoapis.'+_0x4b2241+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x197491+'))';return getZohoUser(_0x17e9b2,'Contacts')['then'](function(_0x3e089c){if(_0x3e089c)return _0x3e089c;if(_0x3f8af6['moduleCreate']!=_0xa7d8('0x4f')){return createEndUser(_0x48763c,_0x4b2241,_0x1447f8,_0x197491,_0x27e40f,_0x3f8af6);}else{return{};}});break;case _0xa7d8('0x50'):_0x17e9b2[_0xa7d8('0x4a')]='https://www.zohoapis.'+_0x4b2241+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x197491+'))';return getZohoUser(_0x17e9b2,'Leads')[_0xa7d8('0x2f')](function(_0x1688b3){if(_0x1688b3)return _0x1688b3;if(_0x3f8af6[_0xa7d8('0x3d')]!=_0xa7d8('0x4f')){return createEndUser(_0x48763c,_0x4b2241,_0x1447f8,_0x197491,_0x27e40f,_0x3f8af6);}else{return{};}});break;}}function getCall(_0x45798c,_0x3a419f,_0x5aee0d,_0x169696,_0x425431,_0x346bd9,_0x206acc,_0x87b8b0){logger[_0xa7d8('0x2b')](_0xa7d8('0x51'));var _0x1d3f80={};_0x1d3f80[_0xa7d8('0x52')]={'name':!_['isNil'](_0x169696['role'][_0xa7d8('0x17')])&&!_[_0xa7d8('0x1a')](_0x169696[_0xa7d8('0x33')][_0xa7d8('0x17')])&&_0x169696[_0xa7d8('0x33')]['name']===_0xa7d8('0x53')?_0x169696[_0xa7d8('0x3e')][_0xa7d8('0x17')]:!_[_0xa7d8('0x1a')](_0x169696[_0xa7d8('0x3f')])?_0x169696[_0xa7d8('0x3f')]+'\x20'+_0x169696[_0xa7d8('0x40')]:_0x169696[_0xa7d8('0x40')],'id':_0x169696['id']};_0x1d3f80[_0xa7d8('0x54')]=intUtil[_0xa7d8('0x55')](_0x346bd9['Subjects'],_0x206acc,'\x20');_0x1d3f80['Description']=intUtil[_0xa7d8('0x55')](_0x346bd9['Descriptions'],_0x206acc,'\x0a');if(_0x425431['enduserType']===_0xa7d8('0x4b')){_0x1d3f80[_0xa7d8('0x56')]={'name':!_[_0xa7d8('0x1a')](_0x425431[_0xa7d8('0x57')])?_0x425431[_0xa7d8('0x57')]:!_[_0xa7d8('0x1a')](_0x425431['First_Name'])?_0x425431['First_Name']+'\x20'+_0x425431[_0xa7d8('0x58')]:_0x425431[_0xa7d8('0x58')],'id':_0x425431['id']};}if(_0x425431[_0xa7d8('0x44')]===_0xa7d8('0x4d')){_0x1d3f80[_0xa7d8('0x59')]={'name':!_[_0xa7d8('0x1a')](_0x425431[_0xa7d8('0x57')])?_0x425431[_0xa7d8('0x57')]:!_[_0xa7d8('0x1a')](_0x425431[_0xa7d8('0x5a')])?_0x425431['First_Name']+'\x20'+_0x425431[_0xa7d8('0x58')]:_0x425431[_0xa7d8('0x58')],'id':_0x425431['id']};_0x1d3f80['$se_module']=_['startCase'](_0x425431[_0xa7d8('0x44')]);}if(_0x206acc[_0xa7d8('0x5b')]){_0x1d3f80[_0xa7d8('0x5c')]=moment[_0xa7d8('0x5d')](parseInt(_0x206acc['talktime'])*0x3e8)[_0xa7d8('0x2d')](_0xa7d8('0x5e'));}else if(_0x206acc[_0xa7d8('0x5f')]&&_0x206acc['endtime']){_0x1d3f80['Call_Duration']=moment['utc'](moment(_0x206acc[_0xa7d8('0x60')],_0xa7d8('0x61'))['diff'](moment(_0x206acc[_0xa7d8('0x62')],_0xa7d8('0x61'))))['format'](_0xa7d8('0x5e'));}switch(_0x206acc['lastevent']){case _0xa7d8('0x63'):_0x1d3f80[_0xa7d8('0x64')]=_0xa7d8('0x65');break;case _0xa7d8('0x66'):case _0xa7d8('0x67'):_0x1d3f80[_0xa7d8('0x64')]='Answered';break;case _0xa7d8('0x68'):_0x1d3f80[_0xa7d8('0x64')]=_0xa7d8('0x69');break;case _0xa7d8('0x6a'):_0x1d3f80[_0xa7d8('0x64')]='Abandoned';break;case _0xa7d8('0x6b'):_0x1d3f80[_0xa7d8('0x64')]=_0xa7d8('0x6c');default:}_0x1d3f80['Call_Start_Time']=(_0x87b8b0===_0xa7d8('0x6d')?moment(_0x206acc['starttime'])[_0xa7d8('0x2d')](_0xa7d8('0x61')):moment(_0x206acc[_0xa7d8('0x6e')])[_0xa7d8('0x2d')](_0xa7d8('0x61')))||moment()[_0xa7d8('0x2d')](_0xa7d8('0x61'));_0x1d3f80[_0xa7d8('0x6f')]=_0x87b8b0||'Inbound';_0x1d3f80=_[_0xa7d8('0x70')](_0x1d3f80,getCustomFields(_0x346bd9['Fields'],_0x206acc));return request({'method':_0xa7d8('0x22'),'uri':_0xa7d8('0x3b')+_0x3a419f+_0xa7d8('0x71'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x45798c},'body':{'data':[_0x1d3f80]},'json':!![]})[_0xa7d8('0x2f')](function(_0xa4e94){if(_0xa4e94&&_0xa4e94['data'][0x0][_0xa7d8('0x42')]===_0xa7d8('0x43')){logger[_0xa7d8('0x2b')](_0xa7d8('0x72'));return{'id':_0xa4e94[_0xa7d8('0x3a')][0x0][_0xa7d8('0x73')]['id']};}})[_0xa7d8('0x39')](function(_0x1c2239){logger[_0xa7d8('0x2b')](_0xa7d8('0x74'),_0x1c2239[_0xa7d8('0x2a')]);console[_0xa7d8('0x45')](_0xa7d8('0x74'),_0x1c2239);});}exports[_0xa7d8('0x75')]=function(_0x13d064,_0x59b6b7,_0x4c09ad,_0x365f8a,_0x270ea4,_0x368dd7){var _0xd7105f,_0xa3879f,_0xa0f7f9;_0x368dd7['host']=intUtil['stripTrailingSlash'](_0x368dd7[_0xa7d8('0x76')]);_0x368dd7['serverUrl']=intUtil[_0xa7d8('0x77')](_0x368dd7['serverUrl']);if(_0x270ea4&&_0x270ea4['monitor_format']){logger[_0xa7d8('0x2b')]('[QUEUE]',_0xa7d8('0x78'));_0x59b6b7[_0xa7d8('0x79')]=_0x368dd7['serverUrl']+_0xa7d8('0x7a')+_0x59b6b7[_0xa7d8('0x7b')]+_0xa7d8('0x7c')+md5(_0x59b6b7[_0xa7d8('0x7b')]);}else{_0x59b6b7['recordingURL']='';}var _0x41785b=_0x368dd7['host']===_0xa7d8('0x7d')?'eu':'com';return getAccessToken(_0x368dd7)[_0xa7d8('0x2f')](function(_0x220e16){_0xa0f7f9=_0x220e16;return getUser(_0xa0f7f9,_0x41785b,_0x368dd7,_0x365f8a[_0xa7d8('0x7e')]);})[_0xa7d8('0x2f')](function(_0x12e55d){_0xd7105f=_0x12e55d;logger[_0xa7d8('0x2b')](_0xa7d8('0x7f'),_0xd7105f['id']);return getEndUser(_0xa0f7f9,_0x41785b,_0x368dd7,_0x59b6b7[_0xa7d8('0x80')],_0x59b6b7[_0xa7d8('0x81')],_0xd7105f,_0x4c09ad);})[_0xa7d8('0x2f')](function(_0x3cda6a){_0xa3879f=_0x3cda6a;return getCall(_0xa0f7f9,_0x41785b,_0x368dd7,_0xd7105f,_0xa3879f,_0x4c09ad,_0x59b6b7,'Inbound');})[_0xa7d8('0x2f')](function(_0x2e7cc9){if(_0x2e7cc9){logger[_0xa7d8('0x2b')](_0xa7d8('0x82'),_0x2e7cc9['id']);logger[_0xa7d8('0x2b')]('[QUEUE]',_0xa7d8('0x83'));emit(util[_0xa7d8('0x2d')](_0xa7d8('0x84'),_0x365f8a[_0xa7d8('0x17')]),'trigger:browser:url',{'uri':_0xa7d8('0x85')+_0x368dd7[_0xa7d8('0x76')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2e7cc9['id']});}})[_0xa7d8('0x39')](function(_0x5a21dc){logger[_0xa7d8('0x29')]('[QUEUE]',JSON[_0xa7d8('0x37')](_0x5a21dc));});};exports[_0xa7d8('0x6d')]=function(_0x7e6a88,_0x3e91dd,_0x6913f3,_0x241c07,_0x963dee,_0x352458,_0x565295){var _0x373626,_0x34791b,_0xa14bbe;_0x352458['host']=intUtil[_0xa7d8('0x77')](_0x352458[_0xa7d8('0x76')]);_0x352458[_0xa7d8('0x86')]=intUtil[_0xa7d8('0x77')](_0x352458['serverUrl']);if(_0x565295&&_0x565295[_0xa7d8('0x87')]&&_0x565295[_0xa7d8('0x87')]!==_0xa7d8('0x88')){logger[_0xa7d8('0x2b')](_0xa7d8('0x89'),_0xa7d8('0x78'));_0x3e91dd['recordingURL']=_0x352458[_0xa7d8('0x86')]+_0xa7d8('0x7a')+_0x3e91dd[_0xa7d8('0x7b')]+_0xa7d8('0x7c')+md5(_0x3e91dd['uniqueid']);}var _0x3ddb44=_0x352458['host']==='zoho.eu'?'eu':_0xa7d8('0x8a');return getAccessToken(_0x352458)[_0xa7d8('0x2f')](function(_0x6ee63f){_0xa14bbe=_0x6ee63f;return getUser(_0xa14bbe,_0x3ddb44,_0x352458,_0x241c07[_0xa7d8('0x7e')]);})[_0xa7d8('0x2f')](function(_0x89e26f){_0x373626=_0x89e26f;logger['info'](_0xa7d8('0x7f'),_0x373626['id']);return getEndUser(_0xa14bbe,_0x3ddb44,_0x352458,_0x3e91dd[_0xa7d8('0x8b')],_0x3e91dd[_0xa7d8('0x8c')],_0x373626,_0x6913f3);})[_0xa7d8('0x2f')](function(_0x302c99){_0x34791b=_0x302c99;return getCall(_0xa14bbe,_0x3ddb44,_0x352458,_0x373626,_0x34791b,_0x6913f3,_0x3e91dd,_0xa7d8('0x8d'));})['then'](function(_0x6c8245){if(_0x6c8245){logger[_0xa7d8('0x2b')](_0xa7d8('0x82'),_0x6c8245['id']);logger['info']('[OUTBOUND]',_0xa7d8('0x83'));emit(util['format']('user:%s',_0x241c07[_0xa7d8('0x17')]),_0xa7d8('0x8e'),{'uri':'https://crm.'+_0x352458[_0xa7d8('0x76')]+_0xa7d8('0x8f')+_0x6c8245['id']});}})[_0xa7d8('0x39')](function(_0x1c15be){logger['error'](_0xa7d8('0x89'),JSON[_0xa7d8('0x37')](_0x1c15be));});};exports['unmanaged']=function(_0x2c4321,_0x1843d9,_0xa28ad5,_0x1d3f78,_0x596032,_0x1f1423){var _0x510f95,_0x502844,_0x33b32f;_0x1f1423[_0xa7d8('0x76')]=intUtil[_0xa7d8('0x77')](_0x1f1423[_0xa7d8('0x76')]);_0x1f1423[_0xa7d8('0x86')]=intUtil[_0xa7d8('0x77')](_0x1f1423['serverUrl']);if(_0x596032&&_0x596032['monitor_format']){logger[_0xa7d8('0x2b')]('['+_0x1843d9[_0xa7d8('0x90')][_0xa7d8('0x91')]()+']',_0xa7d8('0x78'));_0x1843d9[_0xa7d8('0x79')]=_0x1f1423[_0xa7d8('0x86')]+'/api/voice/recordings/'+_0x1843d9[_0xa7d8('0x7b')]+_0xa7d8('0x7c')+md5(_0x1843d9[_0xa7d8('0x7b')]);}else{_0x1843d9['recordingURL']='';}var _0x403587=_0x1f1423[_0xa7d8('0x76')]===_0xa7d8('0x7d')?'eu':'com';return getAccessToken(_0x1f1423)[_0xa7d8('0x2f')](function(_0x40b6ab){_0x33b32f=_0x40b6ab;return getUser(_0x33b32f,_0x403587,_0x1f1423);})[_0xa7d8('0x2f')](function(_0xfe2e3){_0x510f95=_0xfe2e3;logger['info']('The\x20User\x20ID\x20is:',_0x510f95['id']);return getEndUser(_0x33b32f,_0x403587,_0x1f1423,_0x1843d9[_0xa7d8('0x80')],_0x1843d9[_0xa7d8('0x81')],_0x510f95,_0xa28ad5);})['then'](function(_0x26a864){_0x502844=_0x26a864;return getCall(_0x33b32f,_0x403587,_0x1f1423,_0x510f95,_0x502844,_0xa28ad5,_0x1843d9,'Inbound');})[_0xa7d8('0x2f')](function(_0x12a9f5){if(_0x12a9f5){logger[_0xa7d8('0x2b')](_0xa7d8('0x82'),_0x12a9f5['id']);}})[_0xa7d8('0x39')](function(_0x30689b){logger['error']('['+_0x1843d9['lastevent'][_0xa7d8('0x91')]()+']',JSON[_0xa7d8('0x37')](_0x30689b));});}; \ 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 020aba1..ed6bbf8 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(_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 +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(_0x32f99c,_0xa6e7d2){var _0x9698a=function(_0x3dd6ab){while(--_0x3dd6ab){_0x32f99c['push'](_0x32f99c['shift']());}};_0x9698a(++_0xa6e7d2);}(_0x7a54,0x106));var _0x47a5=function(_0x21376b,_0x5a3781){_0x21376b=_0x21376b-0x0;var _0x5b536a=_0x7a54[_0x21376b];return _0x5b536a;};'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 e0963ca..e856130 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(_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 +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0xcc20,_0x352956){var _0x1ef85c=function(_0x2520fa){while(--_0x2520fa){_0xcc20['push'](_0xcc20['shift']());}};_0x1ef85c(++_0x352956);}(_0xb10b,0x12a));var _0xbb10=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0xb10b[_0x58dc25];return _0x21b0a7;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7abee0b..579bad6 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 _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 +var _0x1de4=['rpc','error','message','result','catch','jayson/promise','bluebird','../../config/logger','routing','http','Request','then','debug'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1de4,0x94));var _0x41de=function(_0x181fba,_0x3e23f4){_0x181fba=_0x181fba-0x0;var _0x509d8d=_0x1de4[_0x181fba];return _0x509d8d;};'use strict';var jayson=require(_0x41de('0x0'));var BPromise=require(_0x41de('0x1'));var logger=require(_0x41de('0x2'))(_0x41de('0x3'));var client=jayson['client'][_0x41de('0x4')]({'port':0x2329});client[_0x41de('0x5')]=function(_0xcc46f7,_0x5dd1cb){return new BPromise(function(_0x378cbe,_0xdfa30){return client['request'](_0xcc46f7,_0x5dd1cb)[_0x41de('0x6')](function(_0x122565){logger[_0x41de('0x7')](_0x41de('0x8'),'routing',_0xcc46f7,_0x5dd1cb,_0x122565);if(_0x122565['error']){logger[_0x41de('0x9')](_0x41de('0x8'),_0x41de('0x3'),_0xcc46f7,_0x122565[_0x41de('0x9')][_0x41de('0xa')],_0x5dd1cb);return _0xdfa30(_0x122565[_0x41de('0x9')]['message']);}else{return _0x378cbe(_0x122565[_0x41de('0xb')]);}})[_0x41de('0xc')](function(_0x1de0ed){logger[_0x41de('0x9')](_0x41de('0x8'),_0x41de('0x3'),_0xcc46f7,_0x1de0ed,_0x5dd1cb);return _0xdfa30(_0x1de0ed);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7e8f4e5..ae65486 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 _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 +var _0x1501=['./server','./realtime','./lib/email','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','loginMailFrequency','catch','log'];(function(_0x3861f7,_0x995b22){var _0x50879f=function(_0x3003f1){while(--_0x3003f1){_0x3861f7['push'](_0x3861f7['shift']());}};_0x50879f(++_0x995b22);}(_0x1501,0x126));var _0x1150=function(_0x2e223b,_0x354b69){_0x2e223b=_0x2e223b-0x0;var _0x50aabd=_0x1501[_0x2e223b];return _0x50aabd;};'use strict';var BPromise=require('bluebird');var server=require(_0x1150('0x0'));var Realtime=require(_0x1150('0x1'));var EmailChannel=require(_0x1150('0x2'));var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x1150('0x3'))['db'];function initRealtime(){return BPromise[_0x1150('0x4')]()[_0x1150('0x5')](mailAccount[_0x1150('0x6')]())['then'](realtime[_0x1150('0x7')]())['then'](function(){email[_0x1150('0x8')](realtime[_0x1150('0x9')]);return realtime;});}function main(){return server[_0x1150('0xa')](realtime,email)[_0x1150('0x5')](function(_0x24340c){return initRealtime();})[_0x1150('0x5')](function(_0x2da67d){return db['Setting']['findOne']({'attributes':['id',_0x1150('0xb')],'raw':!![]});})[_0x1150('0x5')](function(_0x4d28c6){return setInterval(initRealtime,_0x4d28c6['loginMailFrequency']*0x3e8);})[_0x1150('0xc')](function(_0x29d989){console[_0x1150('0xd')](_0x29d989);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d7a5fb6..574821d 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 _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 +var _0x8b27=['prototype','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','status','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','error','stringify','lastSync','sendMail','smtp','verifySmtp','isNil','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','emit','name','key','active','Imap','messageStatus','total'];(function(_0x1744ac,_0xb86ea8){var _0x34f55a=function(_0x3d3f38){while(--_0x3d3f38){_0x1744ac['push'](_0x1744ac['shift']());}};_0x34f55a(++_0xb86ea8);}(_0x8b27,0x90));var _0x78b2=function(_0x4ba1c5,_0x61d5b5){_0x4ba1c5=_0x4ba1c5-0x0;var _0x2a65af=_0x8b27[_0x4ba1c5];return _0x2a65af;};'use strict';var _=require(_0x78b2('0x0'));var moment=require(_0x78b2('0x1'));var BPromise=require(_0x78b2('0x2'));var md5=require(_0x78b2('0x3'));var Redis=require(_0x78b2('0x4'));var config=require(_0x78b2('0x5'));var logger=require(_0x78b2('0x6'))(_0x78b2('0x7'));config[_0x78b2('0x8')]=_[_0x78b2('0x9')](config[_0x78b2('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x78b2('0xa'))(new Redis(config[_0x78b2('0x8')]));var EmailImap=require(_0x78b2('0xb'));var EmailSmtp=require(_0x78b2('0xc'));var mailAccount=require(_0x78b2('0xd'));var md5Accounts={};function EmailChannel(_0x194db4){logger[_0x78b2('0xe')](_0x78b2('0xf'));this[_0x78b2('0x10')]=_0x194db4[_0x78b2('0x10')];this['imapAccounts']={};this['smtp']=new EmailSmtp();}EmailChannel['prototype'][_0x78b2('0x11')]=function(_0x4ad6bc){var _0x52cb61=this[_0x78b2('0x10')][_0x4ad6bc];var _0x3aa7bc={'id':_0x52cb61['id'],'name':_0x52cb61[_0x78b2('0x12')],'key':_0x52cb61[_0x78b2('0x13')],'active':_0x52cb61[_0x78b2('0x14')],'Imap':{'status':_0x52cb61[_0x78b2('0x15')]['status'],'messageStatus':_0x52cb61['Imap'][_0x78b2('0x16')],'total':_0x52cb61[_0x78b2('0x15')][_0x78b2('0x17')]}};if(_['isNil'](md5Accounts[_0x4ad6bc])){md5Accounts[_0x4ad6bc]={};}var _0x150ece=md5(JSON['stringify'](_0x3aa7bc));if(md5Accounts[_0x4ad6bc][_0x78b2('0x3')]!==_0x150ece){md5Accounts[_0x4ad6bc][_0x78b2('0x3')]=_0x150ece;io[_0x78b2('0x11')]('mailAccount:update',_0x3aa7bc);}};EmailChannel[_0x78b2('0x18')]['refresh']=function(_0x25b7de){for(var _0x3ebe43 in _0x25b7de){if(_0x25b7de[_0x78b2('0x19')](_0x3ebe43)){if(_0x25b7de[_0x3ebe43]['Imap']&&_0x25b7de[_0x3ebe43][_0x78b2('0x14')]){var _0x47ed85=_0x25b7de[_0x3ebe43][_0x78b2('0x15')];if(!this['imapAccounts'][_0x78b2('0x19')](_0x47ed85['id'])){this[_0x78b2('0x1a')][_0x47ed85['id']]=new EmailImap(_0x47ed85,_0x25b7de[_0x3ebe43][_0x78b2('0x7')]);this[_0x78b2('0x1a')][_0x47ed85['id']]['on'](_0x78b2('0x1b'),this[_0x78b2('0x1c')][_0x78b2('0x1d')](this,_0x3ebe43));this['imapAccounts'][_0x47ed85['id']]['on'](_0x78b2('0x7'),this[_0x78b2('0x1e')][_0x78b2('0x1d')](this,_0x3ebe43));this[_0x78b2('0x1a')][_0x47ed85['id']]['on'](_0x78b2('0x1f'),this[_0x78b2('0x20')]['bind'](this,_0x3ebe43));this[_0x78b2('0x1a')][_0x47ed85['id']]['on']('error',this[_0x78b2('0x21')][_0x78b2('0x1d')](this,_0x3ebe43));}}else{if(_['isNil'](this['mailAccounts'][_0x3ebe43][_0x78b2('0x15')])){this[_0x78b2('0x10')][_0x3ebe43][_0x78b2('0x15')]={};}this[_0x78b2('0x10')][_0x3ebe43]['Imap'][_0x78b2('0x22')]=_0x78b2('0x23');this[_0x78b2('0x10')][_0x3ebe43][_0x78b2('0x15')]['messageStatus']='';this[_0x78b2('0x11')](_0x3ebe43);}}}};EmailChannel[_0x78b2('0x18')]['handleImapBox']=function(_0x21c85f,_0x1ba3ab){if(this[_0x78b2('0x10')][_0x21c85f]){this[_0x78b2('0x10')][_0x21c85f]['Imap'][_0x78b2('0x22')]='connected';this[_0x78b2('0x10')][_0x21c85f][_0x78b2('0x15')][_0x78b2('0x16')]=_0x1ba3ab[_0x78b2('0x12')];if(_0x1ba3ab[_0x78b2('0x24')]){this[_0x78b2('0x10')][_0x21c85f]['Imap'][_0x78b2('0x17')]=_0x1ba3ab[_0x78b2('0x24')][_0x78b2('0x17')];}return this[_0x78b2('0x11')](_0x21c85f);}};EmailChannel[_0x78b2('0x18')][_0x78b2('0x1e')]=function(_0x30b876,_0x34333c){logger[_0x78b2('0xe')](_0x78b2('0x25'),_0x34333c[_0x78b2('0x26')],_0x34333c[_0x78b2('0x27')],_0x34333c[_0x78b2('0x28')],_0x30b876);if(this['mailAccounts'][_0x30b876]){return mailAccount[_0x78b2('0x29')](_0x30b876,_0x34333c)[_0x78b2('0x2a')](function(_0x262736){if(_0x262736){logger[_0x78b2('0xe')](_0x78b2('0x2b'));}})[_0x78b2('0x2c')](function(_0x592a1d){logger[_0x78b2('0x2d')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x78b2('0x2e')](_0x592a1d));});}};EmailChannel[_0x78b2('0x18')][_0x78b2('0x20')]=function(_0x4a7b7a){if(this['mailAccounts'][_0x4a7b7a]&&this[_0x78b2('0x10')][_0x4a7b7a][_0x78b2('0x15')]){if(this[_0x78b2('0x1a')][this[_0x78b2('0x10')][_0x4a7b7a][_0x78b2('0x15')]['id']]){delete this[_0x78b2('0x1a')][this[_0x78b2('0x10')][_0x4a7b7a][_0x78b2('0x15')]['id']];}this['mailAccounts'][_0x4a7b7a][_0x78b2('0x15')][_0x78b2('0x2f')]=moment();this['emit'](_0x4a7b7a);}};EmailChannel[_0x78b2('0x18')][_0x78b2('0x21')]=function(_0x398a6e,_0x25bc68){if(this[_0x78b2('0x10')][_0x398a6e]){this['mailAccounts'][_0x398a6e][_0x78b2('0x15')][_0x78b2('0x22')]=_0x78b2('0x2d');this[_0x78b2('0x10')][_0x398a6e][_0x78b2('0x15')][_0x78b2('0x16')]=_0x25bc68;return this['emit'](_0x398a6e);}};EmailChannel[_0x78b2('0x18')][_0x78b2('0x30')]=function(_0x183e41,_0x57078d){return this[_0x78b2('0x31')]['send'](_0x183e41,_0x57078d);};EmailChannel[_0x78b2('0x18')][_0x78b2('0x32')]=function(_0x420345){var _0x36dddd=this;if(this[_0x78b2('0x10')][_0x420345['id']]){if(_[_0x78b2('0x33')](this[_0x78b2('0x10')][_0x420345['id']][_0x78b2('0x34')])){this[_0x78b2('0x10')][_0x420345['id']][_0x78b2('0x34')]={};}this[_0x78b2('0x10')][_0x420345['id']][_0x78b2('0x34')][_0x78b2('0x2f')]=moment();return new BPromise(function(_0x180898,_0x262f45){return _0x36dddd[_0x78b2('0x31')][_0x78b2('0x35')](_0x420345)[_0x78b2('0x2a')](function(_0x43fb16){_0x36dddd['mailAccounts'][_0x420345['id']][_0x78b2('0x34')][_0x78b2('0x22')]=_0x78b2('0x36');_0x36dddd[_0x78b2('0x10')][_0x420345['id']][_0x78b2('0x34')][_0x78b2('0x16')]='';_0x36dddd['emit'](_0x420345['id']);_0x180898(_0x43fb16);})[_0x78b2('0x2c')](function(_0x15480f){_0x36dddd[_0x78b2('0x10')][_0x420345['id']][_0x78b2('0x34')][_0x78b2('0x22')]=_0x78b2('0x2d');_0x36dddd['mailAccounts'][_0x420345['id']][_0x78b2('0x34')]['messageStatus']=_0x15480f;_0x36dddd[_0x78b2('0x11')](_0x420345['id']);_0x262f45(_0x15480f);});});}return this[_0x78b2('0x31')]['verify'](_0x420345);};module[_0x78b2('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 0a895d3..9009a55 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 _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 +var _0xc96a=['handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleCloseBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','closeBox','handleEnd','stringify','textCode','upperFirst','exports','path','util','imap','lodash','randomstring','simpleParser','iconv','Iconv','events','./utils','email','mailbox','INBOX','account','ready','handleReady','once','end','bind','error','handleError','prototype','getAccount','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','autotls','required','service','anonymous@xcally.com'];(function(_0x1b4d6d,_0x3d1622){var _0x507da1=function(_0x21078d){while(--_0x21078d){_0x1b4d6d['push'](_0x1b4d6d['shift']());}};_0x507da1(++_0x3d1622);}(_0xc96a,0x14a));var _0xac96=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0xc96a[_0x903228];return _0xcec81d;};'use strict';var fs=require('fs');var path=require(_0xac96('0x0'));var util=require(_0xac96('0x1'));var Imap=require(_0xac96('0x2'));var _=require(_0xac96('0x3'));var rs=require(_0xac96('0x4'));var simpleParser=require('mailparser')[_0xac96('0x5')];var Iconv=require(_0xac96('0x6'))[_0xac96('0x7')];var EventEmitter=require(_0xac96('0x8'))['EventEmitter'];var utils=require(_0xac96('0x9'));var logger=require('../../../config/logger')(_0xac96('0xa'));function EmailImap(_0x108466,_0x4a9d5c){this[_0xac96('0xb')]=_0xac96('0xc');this[_0xac96('0xd')]=this['getAccount'](_0x108466,_0x4a9d5c);this[_0xac96('0x2')]=new Imap(this[_0xac96('0xd')]);this['imap']['once'](_0xac96('0xe'),this[_0xac96('0xf')]['bind'](this));this['imap'][_0xac96('0x10')](_0xac96('0x11'),this['handleEnd'][_0xac96('0x12')](this));this['imap']['on'](_0xac96('0x13'),this[_0xac96('0x14')][_0xac96('0x12')](this));this[_0xac96('0x2')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xac96('0x15')][_0xac96('0x16')]=function(_0xa9b167,_0x543cc5){var _0x1e5b5b={'connTimeout':_0xa9b167['connTimeout']?_0xa9b167[_0xac96('0x17')]*0x3e8:0x2710,'authTimeout':_0xa9b167[_0xac96('0x18')]?_0xa9b167[_0xac96('0x18')]*0x3e8:0x1388};if(_[_0xac96('0x19')](_0xa9b167['service'])){if(_0xa9b167[_0xac96('0x1a')]){_0x1e5b5b['user']=_0xa9b167[_0xac96('0x1b')];_0x1e5b5b[_0xac96('0x1c')]=_0xa9b167[_0xac96('0x1c')];}_0x1e5b5b['host']=_0xa9b167[_0xac96('0x1d')];_0x1e5b5b['port']=_0xa9b167[_0xac96('0x1e')]||0x3e1;if(_0xa9b167[_0xac96('0x1f')]){_0x1e5b5b[_0xac96('0x1f')]=!![];}else{_0x1e5b5b[_0xac96('0x1f')]=![];_0x1e5b5b[_0xac96('0x20')]=_0xac96('0x21');}}else{_0x1e5b5b['user']=_0xa9b167[_0xac96('0x1b')];_0x1e5b5b['password']=_0xa9b167[_0xac96('0x1c')];_0x1e5b5b[_0xac96('0x1d')]=utils['getHost'](_0xa9b167[_0xac96('0x22')]);_0x1e5b5b[_0xac96('0x1e')]=0x3e1;_0x1e5b5b[_0xac96('0x1f')]=!![];}_0x1e5b5b[_0xac96('0xa')]=_0x543cc5||_0xa9b167[_0xac96('0x1b')]||_0xac96('0x23');return _0x1e5b5b;};EmailImap['prototype'][_0xac96('0xf')]=function(){this[_0xac96('0x2')]['openBox'](this[_0xac96('0xb')],![],this[_0xac96('0x24')][_0xac96('0x12')](this));};EmailImap['prototype'][_0xac96('0x24')]=function(_0x15c575,_0x2ae06d){if(_0x15c575){this['handleError'](_0x15c575,!![]);}else{this[_0xac96('0x25')](_0xac96('0x26'),_0x2ae06d);this[_0xac96('0x27')]();}};EmailImap[_0xac96('0x15')]['handleCloseBox']=function(_0x572a29){if(_0x572a29){this['handleError'](_0x572a29,!![]);}else{this[_0xac96('0x2')][_0xac96('0x11')]();}};EmailImap[_0xac96('0x15')][_0xac96('0x27')]=function(){this[_0xac96('0x2')][_0xac96('0x28')]([_0xac96('0x29')],this[_0xac96('0x2a')]['bind'](this));};EmailImap[_0xac96('0x15')][_0xac96('0x2a')]=function(_0x109082,_0x5a262e){if(_0x109082){this[_0xac96('0x14')](_0x109082,!![]);}else{if(_0x5a262e[_0xac96('0x2b')]){try{var _0x5870b9=this[_0xac96('0x2')][_0xac96('0x2c')](_0x5a262e,{'bodies':'','markSeen':!![]});_0x5870b9['on']('message',this[_0xac96('0x2d')][_0xac96('0x12')](this));_0x5870b9[_0xac96('0x10')](_0xac96('0x13'),this[_0xac96('0x2e')][_0xac96('0x12')](this));_0x5870b9[_0xac96('0x10')](_0xac96('0x11'),this['handleFetchEnd'][_0xac96('0x12')](this));}catch(_0x3136f0){logger[_0xac96('0x13')](_0x3136f0);}}else{this[_0xac96('0x2')]['closeBox'](!![],this[_0xac96('0x2f')]['bind'](this));}}};EmailImap[_0xac96('0x15')]['handleFetchMessage']=function(_0x3c58c0,_0x444ec4){_0x3c58c0['on']('body',this[_0xac96('0x30')][_0xac96('0x12')](this));_0x3c58c0[_0xac96('0x10')](_0xac96('0x31'),this[_0xac96('0x32')][_0xac96('0x12')](this));_0x3c58c0[_0xac96('0x10')](_0xac96('0x11'),this[_0xac96('0x33')][_0xac96('0x12')](this));};EmailImap[_0xac96('0x15')][_0xac96('0x30')]=function(_0x2554ea,_0x4cc90b){simpleParser(_0x2554ea,{'Iconv':Iconv},this[_0xac96('0x34')]['bind'](this));};EmailImap[_0xac96('0x15')]['handleMessageAttributes']=function(_0x10df4d){};EmailImap['prototype'][_0xac96('0x33')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x259932,_0x548109){if(_0x259932){logger[_0xac96('0x13')](_0x259932);}else{var _0x4cee10=this;utils[_0xac96('0x35')](this[_0xac96('0xd')],_0x548109,function(_0x598794){_0x4cee10['emit'](_0xac96('0xa'),_0x598794);});}};EmailImap['prototype'][_0xac96('0x36')]=function(){this[_0xac96('0x2')][_0xac96('0x37')](!![],this[_0xac96('0x2f')]['bind'](this));};EmailImap['prototype'][_0xac96('0x2e')]=function(_0x103ce0){this[_0xac96('0x14')](_0x103ce0);this[_0xac96('0x2')][_0xac96('0x37')](!![],this['handleCloseBox'][_0xac96('0x12')](this));};EmailImap[_0xac96('0x15')][_0xac96('0x38')]=function(){this[_0xac96('0x25')](_0xac96('0x11'));};EmailImap[_0xac96('0x15')][_0xac96('0x14')]=function(_0x358e72,_0x10e275){logger[_0xac96('0x13')](_0xac96('0x14'),this['account'][_0xac96('0xa')],JSON[_0xac96('0x39')](_0x358e72));var _0x367060='';if(_0x358e72){if(_0x358e72['textCode']){_0x367060=_0x358e72[_0xac96('0x3a')];}else{for(var _0x506d9b in _0x358e72){if(_0x358e72['hasOwnProperty'](_0x506d9b)){_0x367060+=_[_0xac96('0x3b')](_0x506d9b)+':\x20'+_0x358e72[_0x506d9b]+'\x0a';}}}}if(_0x10e275){this[_0xac96('0x2')][_0xac96('0x11')]();}else{this[_0xac96('0x25')](_0xac96('0x13'),_0x367060);this[_0xac96('0x25')]('end');}};module[_0xac96('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index fa67f1b..74ef65e 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 _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 +var _0x528e=['nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired','exports','nodemailer'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x528e,0x78));var _0xe528=function(_0x43278e,_0x1eae39){_0x43278e=_0x43278e-0x0;var _0x39b662=_0x528e[_0x43278e];return _0x39b662;};'use strict';var nodemailer=require(_0xe528('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0xe528('0x1'));function EmailSmtp(){}EmailSmtp[_0xe528('0x2')][_0xe528('0x3')]=function(_0x334fe7,_0x7948ee){return new BPromise(function(_0x1d32ac,_0x1cb2b1){var _0xdd0f2e=nodemailer[_0xe528('0x4')](_0x334fe7);_0xdd0f2e[_0xe528('0x5')](_0xe528('0x6'),inlineBase64());_0xdd0f2e['sendMail'](_0x7948ee,function(_0x58d488,_0x489424){if(_0x58d488){_0x1cb2b1(_0x58d488[_0xe528('0x7')]());}else{_0x1d32ac(_0x489424);}});});};EmailSmtp[_0xe528('0x2')][_0xe528('0x8')]=function(_0x6b871c){return new BPromise(function(_0xaa24d5,_0x1cb1e7){var _0x33fe03=nodemailer[_0xe528('0x4')](_0x6b871c);_0x33fe03['verify'](function(_0x5f0464,_0x50a358){if(_0x5f0464){_0x1cb1e7(_0x5f0464[_0xe528('0x7')]());}else{if(_0x50a358){_0xaa24d5(_0x50a358);}else{_0x1cb1e7(_0xe528('0x9'));}}});});};module[_0xe528('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index b99bdbf..4646d12 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 _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')](/Empty\x20message

','getHost','gmail','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','split','length','Anonymous','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x59bcd8['pop']():'';}return'';}function getMails(_0x371101,_0x2ae277){var _0x326fa9='';for(var _0x52d089=0x0;_0x52d089<_0x2ae277[_0x671a('0x8')][_0x671a('0xe')];_0x52d089+=0x1){if(_0x2ae277[_0x671a('0x8')][_0x52d089]['address']!==_0x371101){if(!_['isEmpty'](_0x326fa9)){_0x326fa9+=',';}_0x326fa9+=_0x2ae277[_0x671a('0x8')][_0x52d089][_0x671a('0xc')]||_0x2ae277[_0x671a('0x8')][_0x52d089][_0x671a('0x9')]||'';_0x326fa9+='\x20<';_0x326fa9+=_0x2ae277[_0x671a('0x8')][_0x52d089][_0x671a('0x9')]?_0x2ae277[_0x671a('0x8')][_0x52d089]['address']:_0x671a('0xa')+random['generate'](0x6)+_0x671a('0xb');_0x326fa9+='>';}}return _0x326fa9;}function parseEmail(_0x27c9a3,_0xc62a87,_0x227217){if(_0xc62a87['html']){var _0x579d95=/)<[^<]*)*<\/script>/gi;while(_0x579d95[_0x671a('0x10')](_0xc62a87[_0x671a('0x11')])){_0xc62a87[_0x671a('0x11')]=_0xc62a87[_0x671a('0x11')][_0x671a('0x12')](_0x579d95,'');}if(_0xc62a87[_0x671a('0x11')][_0x671a('0x13')](_0x671a('0x14'))){var _0x5882c9=[];_0xc62a87[_0x671a('0x15')]['forEach'](_0x32b62c=>{_0x5882c9['push'](_0x32b62c[_0x671a('0x16')]);});var _0xcc4024=/]+>/g;var _0x41bfc4=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x3ae442=_0xc62a87['html'][_0x671a('0x12')](_0x41bfc4,'_SRC');var _0x14dceb=_0x3ae442['replace'](_0xcc4024,_0x671a('0x17'));for(let _0x3d5d77=0x0;_0x3d5d77<_0x5882c9[_0x671a('0xe')];_0x3d5d77++){var _0x35546d=_0x14dceb[_0x671a('0x12')](_0x671a('0x17'),_0x671a('0x18')+_0x5882c9[_0x3d5d77]+_0x671a('0x19'));_0x14dceb=_0x35546d;}_0xc62a87[_0x671a('0x11')]=_0x14dceb;}_0x227217[_0x671a('0x1a')]=_0xc62a87[_0x671a('0x11')];}else{_0x227217[_0x671a('0x1a')]=_0xc62a87[_0x671a('0x1b')];}if(_0x227217[_0x671a('0x1a')]){_0x227217['body']=_0x227217[_0x671a('0x1a')][_0x671a('0x12')](/Empty\x20message

';if(_0x230e50[_0x671a('0x39')]){for(var _0x3f60e9=0x0;_0x3f60e9<_0x230e50[_0x671a('0x39')][_0x671a('0xe')];_0x3f60e9++){var _0x791dca=_0x230e50[_0x671a('0x39')][_0x3f60e9];_0x520dbc[_0x671a('0x1d')][_0x671a('0x15')]['push']({'filename':_0x791dca['Title'],'content':new Buffer(_0x791dca[_0x671a('0x3a')])});}}}_0x502d02(parseEmail(_0x207f99,_0x5a4e67,_0x520dbc));});}else{_0x5a4e67[_0x671a('0x11')]=_0x671a('0x3b');_0x502d02(parseEmail(_0x207f99,_0x5a4e67,_0x520dbc));}}else{_0x502d02(parseEmail(_0x207f99,_0x5a4e67,_0x520dbc));}};exports[_0x671a('0x3c')]=function(_0x2b8f66){switch(_0x2b8f66){case _0x671a('0x3d'):return _0x671a('0x3e');case'yahoo':return'imap.mail.yahoo.com';case _0x671a('0x3f'):return _0x671a('0x40');case _0x671a('0x41'):return _0x671a('0x42');}return _0x671a('0x43');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f02fdbf..be7d888 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa2dc=['exports','Service','key','active','Imap','Smtp'];(function(_0xc051b2,_0x3d6d9d){var _0x599dc2=function(_0x235ded){while(--_0x235ded){_0xc051b2['push'](_0xc051b2['shift']());}};_0x599dc2(++_0x3d6d9d);}(_0xa2dc,0xa9));var _0xca2d=function(_0x596c43,_0x28647a){_0x596c43=_0x596c43-0x0;var _0x4e1315=_0xa2dc[_0x596c43];return _0x4e1315;};'use strict';var _=require('lodash');function MailAccount(_0x2762d6){this['id']=_0x2762d6['id']||0x0;this['name']=_0x2762d6['name']||_0xca2d('0x0');this[_0xca2d('0x1')]=_0x2762d6[_0xca2d('0x1')]||'SERV';this['active']=_0x2762d6[_0xca2d('0x2')]||![];this[_0xca2d('0x3')]=_0x2762d6['Imap']||[];this[_0xca2d('0x4')]=_0x2762d6['Smtp']||[];}module[_0xca2d('0x5')]=MailAccount; \ No newline at end of file +var _0x254f=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0xa8883,_0x1f107f){var _0x479426=function(_0x4e56b9){while(--_0x4e56b9){_0xa8883['push'](_0xa8883['shift']());}};_0x479426(++_0x1f107f);}(_0x254f,0x74));var _0xf254=function(_0x14e169,_0x40f0f9){_0x14e169=_0x14e169-0x0;var _0x368038=_0x254f[_0x14e169];return _0x368038;};'use strict';var _=require(_0xf254('0x0'));function MailAccount(_0xddee37){this['id']=_0xddee37['id']||0x0;this[_0xf254('0x1')]=_0xddee37[_0xf254('0x1')]||_0xf254('0x2');this[_0xf254('0x3')]=_0xddee37[_0xf254('0x3')]||_0xf254('0x4');this[_0xf254('0x5')]=_0xddee37['active']||![];this[_0xf254('0x6')]=_0xddee37[_0xf254('0x6')]||[];this[_0xf254('0x7')]=_0xddee37['Smtp']||[];}module[_0xf254('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 6bcf61a..57b975d 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x298f=['isUndefined','mailAccounts','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x33ffd6,_0x465bec){var _0x351aa9=function(_0x2c2a83){while(--_0x2c2a83){_0x33ffd6['push'](_0x33ffd6['shift']());}};_0x351aa9(++_0x465bec);}(_0x298f,0x12b));var _0xf298=function(_0x472387,_0xb16fed){_0x472387=_0x472387-0x0;var _0x1dd7f3=_0x298f[_0x472387];return _0x1dd7f3;};'use strict';var _=require('lodash');var MailAccount=require(_0xf298('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1219ac,_0x50726a,_0x4c0d9a){var _0x1ddd0a=_[_0xf298('0x1')](_0x1219ac,function(_0xe96d22,_0x1d72dd){return _0xe96d22[_0x4c0d9a];});for(var _0x30345f in _0x50726a){if(_0x50726a[_0xf298('0x2')](_0x30345f)){if(!_0x1ddd0a[_0x30345f]){delete _0x50726a[_0x30345f];}}}}Realtime[_0xf298('0x3')][_0xf298('0x4')]=function(_0x149a71,_0x1cec6d){for(var _0x11ba92 in _0x1cec6d){if(_0x149a71[_0xf298('0x2')](_0x11ba92)){_0x149a71[_0x11ba92]=_0x1cec6d[_0x11ba92];}}};Realtime[_0xf298('0x3')][_0xf298('0x5')]=function(){var _0x18fe80=this;return function(_0x13d0b1){if(_0x13d0b1){freeIsNotKey(_0x13d0b1,_0x18fe80['mailAccounts'],'id');for(var _0x2ae6b5=0x0,_0x5f2ba4={},_0x186d49={};_0x2ae6b5<_0x13d0b1[_0xf298('0x6')];_0x2ae6b5+=0x1){_0x5f2ba4=_0x13d0b1[_0x2ae6b5];if(_[_0xf298('0x7')](_0x18fe80['mailAccounts'][_0x5f2ba4['id']])){_0x18fe80[_0xf298('0x8')][_0x5f2ba4['id']]=new MailAccount(_0x5f2ba4);}else{_['merge'](_0x18fe80[_0xf298('0x8')][_0x5f2ba4['id']],_0x5f2ba4);}}}return _0x18fe80['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xc1aa=['prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x135a2c,_0x30a064){var _0xe16108=function(_0x39f2ec){while(--_0x39f2ec){_0x135a2c['push'](_0x135a2c['shift']());}};_0xe16108(++_0x30a064);}(_0xc1aa,0x131));var _0xac1a=function(_0x31b75f,_0x5560a2){_0x31b75f=_0x31b75f-0x0;var _0x161f93=_0xc1aa[_0x31b75f];return _0x161f93;};'use strict';var _=require('lodash');var MailAccount=require(_0xac1a('0x0'));var Realtime=function(){this[_0xac1a('0x1')]={};};function freeIsNotKey(_0x92ea37,_0x55d4aa,_0x3e2989){var _0x2a9d1f=_[_0xac1a('0x2')](_0x92ea37,function(_0x4f3e28,_0xb5a211){return _0x4f3e28[_0x3e2989];});for(var _0x1734d9 in _0x55d4aa){if(_0x55d4aa['hasOwnProperty'](_0x1734d9)){if(!_0x2a9d1f[_0x1734d9]){delete _0x55d4aa[_0x1734d9];}}}}Realtime[_0xac1a('0x3')][_0xac1a('0x4')]=function(_0x5f1084,_0x410c86){for(var _0x3ce3a7 in _0x410c86){if(_0x5f1084[_0xac1a('0x5')](_0x3ce3a7)){_0x5f1084[_0x3ce3a7]=_0x410c86[_0x3ce3a7];}}};Realtime[_0xac1a('0x3')][_0xac1a('0x6')]=function(){var _0x23634c=this;return function(_0x4f76f7){if(_0x4f76f7){freeIsNotKey(_0x4f76f7,_0x23634c[_0xac1a('0x1')],'id');for(var _0x5271cf=0x0,_0x3a9321={},_0x124212={};_0x5271cf<_0x4f76f7[_0xac1a('0x7')];_0x5271cf+=0x1){_0x3a9321=_0x4f76f7[_0x5271cf];if(_[_0xac1a('0x8')](_0x23634c[_0xac1a('0x1')][_0x3a9321['id']])){_0x23634c[_0xac1a('0x1')][_0x3a9321['id']]=new MailAccount(_0x3a9321);}else{_[_0xac1a('0x9')](_0x23634c['mailAccounts'][_0x3a9321['id']],_0x3a9321);}}}return _0x23634c['mailAccounts'];};};module[_0xac1a('0xa')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 34ffd93..975cc16 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8b8e=['name','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','Request'];(function(_0x2a030a,_0x2c3111){var _0x5bd0fa=function(_0x4b5322){while(--_0x4b5322){_0x2a030a['push'](_0x2a030a['shift']());}};_0x5bd0fa(++_0x2c3111);}(_0x8b8e,0x108));var _0xe8b8=function(_0x5f1ff7,_0x520c02){_0x5f1ff7=_0x5f1ff7-0x0;var _0x1fd46c=_0x8b8e[_0x5f1ff7];return _0x1fd46c;};'use strict';var client=require(_0xe8b8('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xe8b8('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xe8b8('0x2'),'service','email',_0xe8b8('0x3'),_0xe8b8('0x4'),_0xe8b8('0x5'),_0xe8b8('0x6')],'raw':![],'include':[{'model':_0xe8b8('0x7'),'as':_0xe8b8('0x8')},{'model':_0xe8b8('0x9'),'as':_0xe8b8('0xa')}]},'log':_0xe8b8('0xb')});};};exports[_0xe8b8('0xc')]=function(_0x4ce796,_0x2a4ccd){return client['Request'](_0xe8b8('0xd'),{'account':{'id':_0x4ce796},'body':_0x2a4ccd,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x7278=['key','ListId','TemplateId','MailServerIn','Imap','Smtp','getMailAccount','notify','../client','getMailAccounts','Request','GetMailAccount','name','email','active'];(function(_0x2cde7a,_0x5e9457){var _0x2659b5=function(_0x4785a9){while(--_0x4785a9){_0x2cde7a['push'](_0x2cde7a['shift']());}};_0x2659b5(++_0x5e9457);}(_0x7278,0x161));var _0x8727=function(_0x3d0220,_0x1070da){_0x3d0220=_0x3d0220-0x0;var _0x49bb03=_0x7278[_0x3d0220];return _0x49bb03;};'use strict';var client=require(_0x8727('0x0'));exports[_0x8727('0x1')]=function(){return function(){return client[_0x8727('0x2')](_0x8727('0x3'),{'options':{'attributes':['id',_0x8727('0x4'),'service',_0x8727('0x5'),_0x8727('0x6'),_0x8727('0x7'),_0x8727('0x8'),_0x8727('0x9')],'raw':![],'include':[{'model':_0x8727('0xa'),'as':_0x8727('0xb')},{'model':'MailServerOut','as':_0x8727('0xc')}]},'log':_0x8727('0xd')});};};exports[_0x8727('0xe')]=function(_0x435911,_0x4160c3){return client['Request']('NotifyMailAccount',{'account':{'id':_0x435911},'body':_0x4160c3,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 960c56b..16fd7dc 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4cbf=['stringify','listen','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','sendMail','account','message','then','catch','error','verifySmtp','Verified','values','length','Imap','password','Smtp','pass','server','http'];(function(_0x65db2d,_0x44ff75){var _0x3e861f=function(_0x1d1c5e){while(--_0x1d1c5e){_0x65db2d['push'](_0x65db2d['shift']());}};_0x3e861f(++_0x44ff75);}(_0x4cbf,0x164));var _0xf4cb=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x4cbf[_0x5834bc];return _0x3e183a;};'use strict';var jayson=require(_0xf4cb('0x0'));var BPromise=require(_0xf4cb('0x1'));var _=require(_0xf4cb('0x2'));var logger=require('../../../config/logger')('email');exports['listen']=function(_0x49b111,_0x4e3a21){return new BPromise(function(_0xee3346,_0xba5785){var _0x344430={'SendMail':function(_0x8fb51f){var _0x470aab=this;return new Promise(function(_0x2805cc,_0x1d88b3){_0x4e3a21[_0xf4cb('0x3')](_0x8fb51f[_0xf4cb('0x4')],_0x8fb51f[_0xf4cb('0x5')])[_0xf4cb('0x6')](function(_0x503718){_0x2805cc({'code':0xc8,'message':_0x503718});})[_0xf4cb('0x7')](function(_0x1858de){_0x1d88b3(_0x470aab[_0xf4cb('0x8')](0x1f4,_0x1858de));});});},'VerifySmtp':function(_0x583cd6){var _0x218f95=this;return new Promise(function(_0x56ef16,_0x2053a6){_0x4e3a21[_0xf4cb('0x9')](_0x583cd6['account'])['then'](function(_0xa7a3e2){_0x56ef16({'code':0xc8,'message':_0xf4cb('0xa')});})['catch'](function(_0x3f96f5){_0x2053a6(_0x218f95[_0xf4cb('0x8')](0x1f4,_0x3f96f5));});});},'MailAccounts':function(_0x4909bf){return new Promise(function(_0x426724,_0x515e4d){var _0x387a96=_[_0xf4cb('0xb')](_0x49b111['mailAccounts']);for(var _0x4e303b=0x0;_0x4e303b<_0x387a96[_0xf4cb('0xc')];_0x4e303b+=0x1){if(_0x387a96[_0x4e303b][_0xf4cb('0xd')]&&_0x387a96[_0x4e303b]['Imap'][_0xf4cb('0xe')]){delete _0x387a96[_0x4e303b][_0xf4cb('0xd')][_0xf4cb('0xe')];}if(_0x387a96[_0x4e303b][_0xf4cb('0xf')]&&_0x387a96[_0x4e303b][_0xf4cb('0xf')][_0xf4cb('0x10')]){delete _0x387a96[_0x4e303b][_0xf4cb('0xf')][_0xf4cb('0x10')];}}_0x426724({'count':_0x387a96[_0xf4cb('0xc')],'rows':_0x387a96});});}};var _0x4b8c39=jayson[_0xf4cb('0x11')](_0x344430)[_0xf4cb('0x12')]();_0x4b8c39['on'](_0xf4cb('0x8'),function(_0x11112e){logger[_0xf4cb('0x8')](JSON[_0xf4cb('0x13')](_0x11112e));return _0xba5785(_0x11112e);});_0x4b8c39[_0xf4cb('0x14')](0x232b,_0xf4cb('0x15'),function(){console[_0xf4cb('0x16')](_0xf4cb('0x17'),0x232b);return _0xee3346(_0xf4cb('0x18')+0x232b);});});}; \ No newline at end of file +var _0x4e9f=['account','message','catch','error','verifySmtp','then','Verified','values','mailAccounts','length','Imap','password','Smtp','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','bluebird','lodash','../../../config/logger','sendMail'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x4e9f,0xb4));var _0xf4e9=function(_0x4e44e0,_0x21b681){_0x4e44e0=_0x4e44e0-0x0;var _0x40de28=_0x4e9f[_0x4e44e0];return _0x40de28;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xf4e9('0x0'));var _=require(_0xf4e9('0x1'));var logger=require(_0xf4e9('0x2'))('email');exports['listen']=function(_0x19c5e8,_0x590901){return new BPromise(function(_0x3e7234,_0x19ecc8){var _0x40cd50={'SendMail':function(_0xc089cc){var _0x44c02e=this;return new Promise(function(_0x376689,_0x435856){_0x590901[_0xf4e9('0x3')](_0xc089cc[_0xf4e9('0x4')],_0xc089cc[_0xf4e9('0x5')])['then'](function(_0x5e56d0){_0x376689({'code':0xc8,'message':_0x5e56d0});})[_0xf4e9('0x6')](function(_0x614d08){_0x435856(_0x44c02e[_0xf4e9('0x7')](0x1f4,_0x614d08));});});},'VerifySmtp':function(_0x57ddfb){var _0x396949=this;return new Promise(function(_0x2ce4d4,_0x3188ee){_0x590901[_0xf4e9('0x8')](_0x57ddfb[_0xf4e9('0x4')])[_0xf4e9('0x9')](function(_0x1b4458){_0x2ce4d4({'code':0xc8,'message':_0xf4e9('0xa')});})[_0xf4e9('0x6')](function(_0x3b8d36){_0x3188ee(_0x396949[_0xf4e9('0x7')](0x1f4,_0x3b8d36));});});},'MailAccounts':function(_0x3b2005){return new Promise(function(_0x5dbce0,_0x5eb0fb){var _0x232698=_[_0xf4e9('0xb')](_0x19c5e8[_0xf4e9('0xc')]);for(var _0x53550e=0x0;_0x53550e<_0x232698[_0xf4e9('0xd')];_0x53550e+=0x1){if(_0x232698[_0x53550e][_0xf4e9('0xe')]&&_0x232698[_0x53550e][_0xf4e9('0xe')][_0xf4e9('0xf')]){delete _0x232698[_0x53550e][_0xf4e9('0xe')]['password'];}if(_0x232698[_0x53550e][_0xf4e9('0x10')]&&_0x232698[_0x53550e]['Smtp']['pass']){delete _0x232698[_0x53550e][_0xf4e9('0x10')]['pass'];}}_0x5dbce0({'count':_0x232698[_0xf4e9('0xd')],'rows':_0x232698});});}};var _0x419ca4=jayson['server'](_0x40cd50)[_0xf4e9('0x11')]();_0x419ca4['on'](_0xf4e9('0x7'),function(_0xd99179){logger[_0xf4e9('0x7')](JSON[_0xf4e9('0x12')](_0xd99179));return _0x19ecc8(_0xd99179);});_0x419ca4['listen'](0x232b,_0xf4e9('0x13'),function(){console[_0xf4e9('0x14')](_0xf4e9('0x15'),0x232b);return _0x3e7234(_0xf4e9('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index f960af9..6a27e25 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6164=['sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','defaults','redis','localhost','socket.io-redis','../../config/triggers','../../config/socketio','../../config/express','default','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express'];(function(_0x57048e,_0x4058f4){var _0x24d679=function(_0x249379){while(--_0x249379){_0x57048e['push'](_0x57048e['shift']());}};_0x24d679(++_0x4058f4);}(_0x6164,0xcd));var _0x4616=function(_0x29b2a2,_0x4b7224){_0x29b2a2=_0x29b2a2-0x0;var _0x836e8c=_0x6164[_0x29b2a2];return _0x836e8c;};'use strict';var _=require(_0x4616('0x0'));var http=require(_0x4616('0x1'));var express=require(_0x4616('0x2'));var sticky=require(_0x4616('0x3'));var Redis=require(_0x4616('0x4'));var config=require(_0x4616('0x5'));var app=express();var server=http[_0x4616('0x6')](app);server[_0x4616('0x7')]=0xdbba0;if(sticky[_0x4616('0x8')](server,config['port'])){var socketio=require(_0x4616('0x9'))(server,{'transports':[_0x4616('0xa'),_0x4616('0xb')]});config['redis']=_[_0x4616('0xc')](config[_0x4616('0xd')],{'host':_0x4616('0xe'),'port':0x18eb});socketio['adapter'](require(_0x4616('0xf'))({'pubClient':new Redis(config[_0x4616('0xd')]),'subClient':new Redis(config[_0x4616('0xd')])}));require(_0x4616('0x10'))['default']();require(_0x4616('0x11'))['default'](socketio);require(_0x4616('0x12'))[_0x4616('0x13')](app);require(_0x4616('0x14'))['default'](app);}else{server[_0x4616('0x15')](_0x4616('0x16'),function(){console['log'](_0x4616('0x17'),config[_0x4616('0x18')]);});}exports=module[_0x4616('0x19')]=app; \ No newline at end of file +var _0x7433=['polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../routes','once','listening','log','port','exports','lodash','http','sticky-session','ioredis','timeout','listen','socket.io','websocket'];(function(_0x5b474c,_0x426d87){var _0x273b2c=function(_0x2a3fcf){while(--_0x2a3fcf){_0x5b474c['push'](_0x5b474c['shift']());}};_0x273b2c(++_0x426d87);}(_0x7433,0xb0));var _0x3743=function(_0x5ce6e7,_0x485dd3){_0x5ce6e7=_0x5ce6e7-0x0;var _0x2248dc=_0x7433[_0x5ce6e7];return _0x2248dc;};'use strict';var _=require(_0x3743('0x0'));var http=require(_0x3743('0x1'));var express=require('express');var sticky=require(_0x3743('0x2'));var Redis=require(_0x3743('0x3'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x3743('0x4')]=0xdbba0;if(sticky[_0x3743('0x5')](server,config['port'])){var socketio=require(_0x3743('0x6'))(server,{'transports':[_0x3743('0x7'),_0x3743('0x8')]});config[_0x3743('0x9')]=_[_0x3743('0xa')](config['redis'],{'host':_0x3743('0xb'),'port':0x18eb});socketio[_0x3743('0xc')](require(_0x3743('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x3743('0x9')])}));require(_0x3743('0xe'))[_0x3743('0xf')]();require(_0x3743('0x10'))[_0x3743('0xf')](socketio);require('../../config/express')[_0x3743('0xf')](app);require(_0x3743('0x11'))[_0x3743('0xf')](app);}else{server[_0x3743('0x12')](_0x3743('0x13'),function(){console[_0x3743('0x14')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x3743('0x15')]);});}exports=module[_0x3743('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c030aa1..d4259e9 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4350=['catch','exports','jayson/promise','bluebird','routing','http','Request','request','rpc','error','message'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4350,0x1d0));var _0x0435=function(_0x5c2f27,_0xe2d202){_0x5c2f27=_0x5c2f27-0x0;var _0x3e76ea=_0x4350[_0x5c2f27];return _0x3e76ea;};'use strict';var jayson=require(_0x0435('0x0'));var BPromise=require(_0x0435('0x1'));var logger=require('../../config/logger')(_0x0435('0x2'));var client=jayson['client'][_0x0435('0x3')]({'port':0x2329});client[_0x0435('0x4')]=function(_0x517d8d,_0x247a54){return new BPromise(function(_0xd41628,_0x2dcbfe){return client[_0x0435('0x5')](_0x517d8d,_0x247a54)['then'](function(_0x580eeb){logger['debug']('rpc',_0x0435('0x2'),_0x517d8d,_0x247a54,_0x580eeb);if(_0x580eeb['error']){logger['error'](_0x0435('0x6'),'routing',_0x517d8d,_0x580eeb[_0x0435('0x7')][_0x0435('0x8')],_0x247a54);return _0x2dcbfe(_0x580eeb['error'][_0x0435('0x8')]);}else{return _0xd41628(_0x580eeb['result']);}})[_0x0435('0x9')](function(_0x3ea40f){logger[_0x0435('0x7')](_0x0435('0x6'),_0x0435('0x2'),_0x517d8d,_0x3ea40f,_0x247a54);return _0x2dcbfe(_0x3ea40f);});});};module[_0x0435('0xa')]=client; \ No newline at end of file +var _0x2cc1=['http','Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client'];(function(_0x4fa7a5,_0x219a4e){var _0x3ea660=function(_0x46770b){while(--_0x46770b){_0x4fa7a5['push'](_0x4fa7a5['shift']());}};_0x3ea660(++_0x219a4e);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x2cc1[_0x35b7d4];return _0x4e8cee;};'use strict';var jayson=require(_0x12cc('0x0'));var BPromise=require(_0x12cc('0x1'));var logger=require(_0x12cc('0x2'))(_0x12cc('0x3'));var client=jayson[_0x12cc('0x4')][_0x12cc('0x5')]({'port':0x2329});client[_0x12cc('0x6')]=function(_0x4316fc,_0x49436d){return new BPromise(function(_0x587141,_0xfc8836){return client[_0x12cc('0x7')](_0x4316fc,_0x49436d)['then'](function(_0x496867){logger[_0x12cc('0x8')](_0x12cc('0x9'),_0x12cc('0x3'),_0x4316fc,_0x49436d,_0x496867);if(_0x496867[_0x12cc('0xa')]){logger[_0x12cc('0xa')](_0x12cc('0x9'),_0x12cc('0x3'),_0x4316fc,_0x496867[_0x12cc('0xa')][_0x12cc('0xb')],_0x49436d);return _0xfc8836(_0x496867[_0x12cc('0xa')][_0x12cc('0xb')]);}else{return _0x587141(_0x496867[_0x12cc('0xc')]);}})[_0x12cc('0xd')](function(_0x4fcf41){logger[_0x12cc('0xa')]('rpc',_0x12cc('0x3'),_0x4316fc,_0x4fcf41,_0x49436d);return _0xfc8836(_0x4fcf41);});});};module[_0x12cc('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 846ec2e..9f4cfb4 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7378=['log','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch'];(function(_0x202d61,_0xb7dc8b){var _0x111b6f=function(_0x208a75){while(--_0x208a75){_0x202d61['push'](_0x202d61['shift']());}};_0x111b6f(++_0xb7dc8b);}(_0x7378,0x145));var _0x8737=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7378[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x8737('0x0'));var interval=require(_0x8737('0x1'));var openchannelQueue=require(_0x8737('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x8737('0x3'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x8737('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x8737('0x5')]()['then'](user['getAgents']())[_0x8737('0x6')](realtime['initAgents']())[_0x8737('0x6')](interval[_0x8737('0x7')]())[_0x8737('0x6')](realtime['initIntervals']())['then'](openchannelQueue[_0x8737('0x8')]())[_0x8737('0x6')](realtime[_0x8737('0x9')]())['then'](chatQueue['getChatQueues']())[_0x8737('0x6')](realtime['initChatQueues']())[_0x8737('0x6')](smsQueue['getSmsQueues']())[_0x8737('0x6')](realtime['initSmsQueues']())[_0x8737('0x6')](mailQueue[_0x8737('0xa')]())['then'](realtime[_0x8737('0xb')]())[_0x8737('0x6')](faxQueue['getFaxQueues']())[_0x8737('0x6')](realtime[_0x8737('0xc')]())[_0x8737('0x6')](whatsappQueue[_0x8737('0xd')]())[_0x8737('0x6')](realtime[_0x8737('0xe')]())[_0x8737('0x6')](function(){return realtime;});}function main(){return server[_0x8737('0xf')](realtime)[_0x8737('0x6')](function(_0x58c97a){return initRealtime();})['then'](function(_0x5f5bb3){return setInterval(initRealtime,0x1388);})[_0x8737('0x10')](function(_0x53f44f){console[_0x8737('0x11')](_0x53f44f);});}main(); \ No newline at end of file +var _0x854c=['bluebird','./server','./realtime','./rpc/user','./rpc/chatQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','catch','log'];(function(_0x242a4a,_0x332fe5){var _0x33c586=function(_0x2815b2){while(--_0x2815b2){_0x242a4a['push'](_0x242a4a['shift']());}};_0x33c586(++_0x332fe5);}(_0x854c,0xc6));var _0xc854=function(_0x36e216,_0x978113){_0x36e216=_0x36e216-0x0;var _0x2f6863=_0x854c[_0x36e216];return _0x2f6863;};'use strict';var BPromise=require(_0xc854('0x0'));var server=require(_0xc854('0x1'));var Realtime=require(_0xc854('0x2'));var user=require(_0xc854('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xc854('0x4'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xc854('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc854('0x6')]()[_0xc854('0x7')](user[_0xc854('0x8')]())[_0xc854('0x7')](realtime[_0xc854('0x9')]())[_0xc854('0x7')](interval[_0xc854('0xa')]())[_0xc854('0x7')](realtime[_0xc854('0xb')]())[_0xc854('0x7')](openchannelQueue[_0xc854('0xc')]())[_0xc854('0x7')](realtime['initOpenchannelQueues']())[_0xc854('0x7')](chatQueue[_0xc854('0xd')]())[_0xc854('0x7')](realtime[_0xc854('0xe')]())['then'](smsQueue['getSmsQueues']())['then'](realtime['initSmsQueues']())[_0xc854('0x7')](mailQueue[_0xc854('0xf')]())['then'](realtime[_0xc854('0x10')]())['then'](faxQueue[_0xc854('0x11')]())[_0xc854('0x7')](realtime[_0xc854('0x12')]())[_0xc854('0x7')](whatsappQueue[_0xc854('0x13')]())[_0xc854('0x7')](realtime['initWhatsappQueues']())[_0xc854('0x7')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xc854('0x7')](function(_0x104ab0){return initRealtime();})['then'](function(_0x376b00){return setInterval(initRealtime,0x1388);})[_0xc854('0x14')](function(_0x5238da){console[_0xc854('0x15')](_0x5238da);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 4e25432..d62991c 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfbdf=['init','rules','activeRules','isArray','concat','isObject','push','sync','filter','orderBy','execute','clone','consequence','ruleRef','name','index_','nextTick','call','next','isEqual','restart','length','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','map','condition','toString','isString','parse','object','exports','lodash','util','events','EventEmitter','isNil','register','inherits','prototype'];(function(_0x330fda,_0x21e587){var _0x5623c7=function(_0x3898ef){while(--_0x3898ef){_0x330fda['push'](_0x330fda['shift']());}};_0x5623c7(++_0x21e587);}(_0xfbdf,0x106));var _0xffbd=function(_0x34ac75,_0x75b3a2){_0x34ac75=_0x34ac75-0x0;var _0x389365=_0xfbdf[_0x34ac75];return _0x389365;};'use strict';var _=require(_0xffbd('0x0'));var util=require(_0xffbd('0x1'));var EventEmitter=require(_0xffbd('0x2'))[_0xffbd('0x3')];function RuleEngine(_0x22797f,_0x17dc83){this['init']();if(!_[_0xffbd('0x4')](_0x22797f)){this[_0xffbd('0x5')](_0x22797f);}if(_0x17dc83){this['ignoreFactChanges']=_0x17dc83['ignoreFactChanges'];}return this;}util[_0xffbd('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xffbd('0x7')][_0xffbd('0x8')]=function(_0x19caa4){this[_0xffbd('0x9')]=[];this[_0xffbd('0xa')]=[];};RuleEngine['prototype'][_0xffbd('0x5')]=function(_0x5af06e){if(Array[_0xffbd('0xb')](_0x5af06e)){this['rules']=this[_0xffbd('0x9')][_0xffbd('0xc')](_0x5af06e);}else if(_0x5af06e!==null&&_[_0xffbd('0xd')](_0x5af06e)){this['rules'][_0xffbd('0xe')](_0x5af06e);}this[_0xffbd('0xf')]();};RuleEngine[_0xffbd('0x7')][_0xffbd('0xf')]=function(){this['activeRules']=this[_0xffbd('0x9')][_0xffbd('0x10')](function(_0x5c1394){if(_[_0xffbd('0x4')](_0x5c1394['on'])){_0x5c1394['on']=!![];}if(_0x5c1394['on']===!![]){return _0x5c1394;}});this[_0xffbd('0xa')]=_[_0xffbd('0x11')](this[_0xffbd('0xa')],['p'],['asc']);};RuleEngine[_0xffbd('0x7')][_0xffbd('0x12')]=function(_0x158ae8,_0x1c6897){var _0x2e9b2f=![];_0x158ae8['result']=!![];var _0x350676=_['clone'](_0x158ae8);var _0x29656c=_[_0xffbd('0x13')](_0x158ae8);var _0x3fa6e1=this['activeRules'];var _0x1f0dc1=[];var _0x5de0bc=this['ignoreFactChanges'];(function FnRuleLoop(_0x1c2311){var _0x52fb52={'rules':function(){return _0x3fa6e1;},'rule':function(){return _0x3fa6e1[_0x1c2311];},'when':function(_0xd91ba6){if(_0xd91ba6){var _0x3224b5=_0x3fa6e1[_0x1c2311][_0xffbd('0x14')];_0x3224b5[_0xffbd('0x15')]=_0x3fa6e1[_0x1c2311]['id']||_0x3fa6e1[_0x1c2311][_0xffbd('0x16')]||_0xffbd('0x17')+_0x1c2311;process[_0xffbd('0x18')](function(){_0x1f0dc1[_0xffbd('0xe')](_0x3224b5[_0xffbd('0x15')]);_0x3224b5[_0xffbd('0x19')](_0x350676,_0x52fb52);});}else{process[_0xffbd('0x18')](function(){_0x52fb52[_0xffbd('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2e9b2f=!![];return FnRuleLoop(0x0);},'next':function(_0x48e5fa){if(!_0x5de0bc&&!_[_0xffbd('0x1b')](_0x29656c,_0x350676)){_0x29656c=_[_0xffbd('0x13')](_0x350676);process[_0xffbd('0x18')](function(){_0x52fb52[_0xffbd('0x1c')]();});}else{process['nextTick'](function(){if(_['isNil'](_0x48e5fa)){return FnRuleLoop(_0x1c2311+0x1);}else{return FnRuleLoop(_0x48e5fa);}});}}};if(_0x1c2311<_0x3fa6e1[_0xffbd('0x1d')]&&_0x2e9b2f===![]){var _0x5b395d=_0x3fa6e1[_0x1c2311]['condition'];_0x5b395d[_0xffbd('0x19')](_0x350676,_0x52fb52);}else{process[_0xffbd('0x18')](function(){_0x350676[_0xffbd('0x1e')]=_0x1f0dc1;return _0x1c6897?_0x1c6897(_0x350676):_[_0xffbd('0x1f')]();});}}(0x0));};RuleEngine[_0xffbd('0x7')][_0xffbd('0x20')]=function(_0x3a38b8){if(_['isNil'](_0x3a38b8)){return this[_0xffbd('0x9')];}else{var _0x145a12=_[_0xffbd('0x21')](_0x3a38b8);return _[_0xffbd('0x10')](this[_0xffbd('0x9')],_0x145a12);}};RuleEngine[_0xffbd('0x7')][_0xffbd('0x22')]=function(_0xdb5638,_0x7a1f9){var _0x4baf61=_0xdb5638==='on'||_0xdb5638==='ON'?!![]:![];var _0x90b93=this['findRules'](_0x7a1f9);for(var _0x2133ad=0x0,_0x33bcef=_0x90b93['length'];_0x2133ad<_0x33bcef;_0x2133ad+=0x1){_0x90b93[_0x2133ad]['on']=_0x4baf61;}this['sync']();};RuleEngine[_0xffbd('0x7')][_0xffbd('0x23')]=function(_0x53ceab,_0x555b3d){_0x53ceab=parseInt(_0x53ceab,0xa);var _0x52daa4=this['findRules'](_0x555b3d);for(var _0x580118=0x0,_0x53e33c=_0x52daa4[_0xffbd('0x1d')];_0x580118<_0x53e33c;_0x580118+=0x1){_0x52daa4[_0x580118][_0xffbd('0x24')]=_0x53ceab;}this[_0xffbd('0xf')]();};RuleEngine[_0xffbd('0x7')][_0xffbd('0x25')]=function(){var _0x3d25e0=this[_0xffbd('0x9')];if(_0x3d25e0 instanceof Array){_0x3d25e0=_0x3d25e0[_0xffbd('0x26')](function(_0x536ee8){_0x536ee8[_0xffbd('0x27')]=_0x536ee8['condition']['toString']();_0x536ee8[_0xffbd('0x14')]=_0x536ee8[_0xffbd('0x14')][_0xffbd('0x28')]();return _0x536ee8;});}else if(!_[_0xffbd('0x4')](_0x3d25e0)){_0x3d25e0[_0xffbd('0x27')]=_0x3d25e0[_0xffbd('0x27')][_0xffbd('0x28')]();_0x3d25e0[_0xffbd('0x14')]=_0x3d25e0[_0xffbd('0x14')][_0xffbd('0x28')]();}return _0x3d25e0;};RuleEngine[_0xffbd('0x7')]['fromJSON']=function(_0x1ca223){this[_0xffbd('0x8')]();if(_[_0xffbd('0x29')](_0x1ca223)){_0x1ca223=JSON[_0xffbd('0x2a')](_0x1ca223);}if(_0x1ca223 instanceof Array){_0x1ca223=_0x1ca223[_0xffbd('0x26')](function(_0x116301){_0x116301[_0xffbd('0x27')]=eval('('+_0x116301[_0xffbd('0x27')]+')');_0x116301[_0xffbd('0x14')]=eval('('+_0x116301['consequence']+')');return _0x116301;});}else if(_0x1ca223!==null&&typeof _0x1ca223==_0xffbd('0x2b')){_0x1ca223[_0xffbd('0x27')]=eval('('+_0x1ca223['condition']+')');_0x1ca223[_0xffbd('0x14')]=eval('('+_0x1ca223[_0xffbd('0x14')]+')');}this[_0xffbd('0x5')](_0x1ca223);};module[_0xffbd('0x2c')]=RuleEngine; \ No newline at end of file +var _0xa99d=['isNil','ignoreFactChanges','inherits','prototype','activeRules','register','rules','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','index_','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','turn','prioritize','priority','toJSON','map','toString','fromJSON','parse','exports','lodash','util','events','init'];(function(_0x2081f1,_0x36e8ce){var _0x2ad889=function(_0x51ce96){while(--_0x51ce96){_0x2081f1['push'](_0x2081f1['shift']());}};_0x2ad889(++_0x36e8ce);}(_0xa99d,0x144));var _0xda99=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0xa99d[_0x671369];return _0x33f2b4;};'use strict';var _=require(_0xda99('0x0'));var util=require(_0xda99('0x1'));var EventEmitter=require(_0xda99('0x2'))['EventEmitter'];function RuleEngine(_0x51d314,_0x26c250){this[_0xda99('0x3')]();if(!_[_0xda99('0x4')](_0x51d314)){this['register'](_0x51d314);}if(_0x26c250){this[_0xda99('0x5')]=_0x26c250[_0xda99('0x5')];}return this;}util[_0xda99('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xda99('0x7')][_0xda99('0x3')]=function(_0x4d2957){this['rules']=[];this[_0xda99('0x8')]=[];};RuleEngine[_0xda99('0x7')][_0xda99('0x9')]=function(_0x3bc573){if(Array['isArray'](_0x3bc573)){this[_0xda99('0xa')]=this[_0xda99('0xa')]['concat'](_0x3bc573);}else if(_0x3bc573!==null&&_['isObject'](_0x3bc573)){this[_0xda99('0xa')][_0xda99('0xb')](_0x3bc573);}this[_0xda99('0xc')]();};RuleEngine[_0xda99('0x7')]['sync']=function(){this['activeRules']=this[_0xda99('0xa')][_0xda99('0xd')](function(_0x45ac60){if(_[_0xda99('0x4')](_0x45ac60['on'])){_0x45ac60['on']=!![];}if(_0x45ac60['on']===!![]){return _0x45ac60;}});this[_0xda99('0x8')]=_[_0xda99('0xe')](this[_0xda99('0x8')],['p'],[_0xda99('0xf')]);};RuleEngine[_0xda99('0x7')][_0xda99('0x10')]=function(_0x3e7b95,_0xf9dd40){var _0x25ec7d=![];_0x3e7b95[_0xda99('0x11')]=!![];var _0x44137f=_[_0xda99('0x12')](_0x3e7b95);var _0x56dc5c=_[_0xda99('0x12')](_0x3e7b95);var _0x5da86d=this[_0xda99('0x8')];var _0x78951d=[];var _0x321d84=this['ignoreFactChanges'];(function FnRuleLoop(_0x186c08){var _0x92d9b1={'rules':function(){return _0x5da86d;},'rule':function(){return _0x5da86d[_0x186c08];},'when':function(_0x23660f){if(_0x23660f){var _0x51b7c8=_0x5da86d[_0x186c08][_0xda99('0x13')];_0x51b7c8[_0xda99('0x14')]=_0x5da86d[_0x186c08]['id']||_0x5da86d[_0x186c08]['name']||_0xda99('0x15')+_0x186c08;process['nextTick'](function(){_0x78951d['push'](_0x51b7c8[_0xda99('0x14')]);_0x51b7c8[_0xda99('0x16')](_0x44137f,_0x92d9b1);});}else{process[_0xda99('0x17')](function(){_0x92d9b1[_0xda99('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x25ec7d=!![];return FnRuleLoop(0x0);},'next':function(_0x2808d1){if(!_0x321d84&&!_[_0xda99('0x19')](_0x56dc5c,_0x44137f)){_0x56dc5c=_[_0xda99('0x12')](_0x44137f);process['nextTick'](function(){_0x92d9b1[_0xda99('0x1a')]();});}else{process[_0xda99('0x17')](function(){if(_[_0xda99('0x4')](_0x2808d1)){return FnRuleLoop(_0x186c08+0x1);}else{return FnRuleLoop(_0x2808d1);}});}}};if(_0x186c08<_0x5da86d[_0xda99('0x1b')]&&_0x25ec7d===![]){var _0x406d14=_0x5da86d[_0x186c08][_0xda99('0x1c')];_0x406d14[_0xda99('0x16')](_0x44137f,_0x92d9b1);}else{process[_0xda99('0x17')](function(){_0x44137f[_0xda99('0x1d')]=_0x78951d;return _0xf9dd40?_0xf9dd40(_0x44137f):_[_0xda99('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0xda99('0x1f')]=function(_0xdca0de){if(_[_0xda99('0x4')](_0xdca0de)){return this['rules'];}else{var _0xb51549=_['matches'](_0xdca0de);return _[_0xda99('0xd')](this[_0xda99('0xa')],_0xb51549);}};RuleEngine[_0xda99('0x7')][_0xda99('0x20')]=function(_0x1f2a03,_0x47a8e8){var _0x2228b1=_0x1f2a03==='on'||_0x1f2a03==='ON'?!![]:![];var _0x13ea82=this[_0xda99('0x1f')](_0x47a8e8);for(var _0x31f24a=0x0,_0x4396ea=_0x13ea82[_0xda99('0x1b')];_0x31f24a<_0x4396ea;_0x31f24a+=0x1){_0x13ea82[_0x31f24a]['on']=_0x2228b1;}this[_0xda99('0xc')]();};RuleEngine[_0xda99('0x7')][_0xda99('0x21')]=function(_0x29ec1a,_0x502be0){_0x29ec1a=parseInt(_0x29ec1a,0xa);var _0xcdaba2=this['findRules'](_0x502be0);for(var _0x19137b=0x0,_0xde6d86=_0xcdaba2[_0xda99('0x1b')];_0x19137b<_0xde6d86;_0x19137b+=0x1){_0xcdaba2[_0x19137b][_0xda99('0x22')]=_0x29ec1a;}this[_0xda99('0xc')]();};RuleEngine['prototype'][_0xda99('0x23')]=function(){var _0x4117da=this[_0xda99('0xa')];if(_0x4117da instanceof Array){_0x4117da=_0x4117da[_0xda99('0x24')](function(_0x3b297b){_0x3b297b[_0xda99('0x1c')]=_0x3b297b[_0xda99('0x1c')][_0xda99('0x25')]();_0x3b297b[_0xda99('0x13')]=_0x3b297b[_0xda99('0x13')][_0xda99('0x25')]();return _0x3b297b;});}else if(!_[_0xda99('0x4')](_0x4117da)){_0x4117da['condition']=_0x4117da['condition'][_0xda99('0x25')]();_0x4117da[_0xda99('0x13')]=_0x4117da[_0xda99('0x13')][_0xda99('0x25')]();}return _0x4117da;};RuleEngine[_0xda99('0x7')][_0xda99('0x26')]=function(_0x53e0de){this['init']();if(_['isString'](_0x53e0de)){_0x53e0de=JSON[_0xda99('0x27')](_0x53e0de);}if(_0x53e0de instanceof Array){_0x53e0de=_0x53e0de[_0xda99('0x24')](function(_0x1710b1){_0x1710b1['condition']=eval('('+_0x1710b1['condition']+')');_0x1710b1[_0xda99('0x13')]=eval('('+_0x1710b1['consequence']+')');return _0x1710b1;});}else if(_0x53e0de!==null&&typeof _0x53e0de=='object'){_0x53e0de[_0xda99('0x1c')]=eval('('+_0x53e0de['condition']+')');_0x53e0de[_0xda99('0x13')]=eval('('+_0x53e0de[_0xda99('0x13')]+')');}this[_0xda99('0x9')](_0x53e0de);};module[_0xda99('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 19b2614..2b5a7ec 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x2d093a,_0x305652){var _0x5dc397=function(_0x49f9a2){while(--_0x49f9a2){_0x2d093a['push'](_0x2d093a['shift']());}};_0x5dc397(++_0x305652);}(_0x814b,0x1a2));var _0xb814=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x814b[_0x3aeb36];return _0xa2ef21;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x379183,_0x1c0d08){var _0x5606a3=function(_0x59cc0c){while(--_0x59cc0c){_0x379183['push'](_0x379183['shift']());}};_0x5606a3(++_0x1c0d08);}(_0x814b,0x1a2));var _0xb814=function(_0x5e2b34,_0x58385c){_0x5e2b34=_0x5e2b34-0x0;var _0x4859f9=_0x814b[_0x5e2b34];return _0x4859f9;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b013184..090563f 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0xd070=['smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','busy','getChannelStatus','CurrentCapacity','working','idle','prototype','updateRealtime','chat','fax','sms','Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','faxStatusTime','faxCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCurrentCapacity','busyQueue','stringify','emit','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','smsStatus'];(function(_0x464a8b,_0x33cb2a){var _0x492582=function(_0x23ce69){while(--_0x23ce69){_0x464a8b['push'](_0x464a8b['shift']());}};_0x492582(++_0x33cb2a);}(_0xd070,0x8e));var _0x0d07=function(_0x1c0e7e,_0x161e34){_0x1c0e7e=_0x1c0e7e-0x0;var _0x547ac2=_0xd070[_0x1c0e7e];return _0x547ac2;};'use strict';var _=require(_0x0d07('0x0'));var moment=require('moment');var md5=require(_0x0d07('0x1'));var Redis=require(_0x0d07('0x2'));var config=require(_0x0d07('0x3'));config[_0x0d07('0x4')]=_[_0x0d07('0x5')](config[_0x0d07('0x4')],{'host':_0x0d07('0x6'),'port':0x18eb});var io=require(_0x0d07('0x7'))(new Redis(config[_0x0d07('0x4')]));function Agent(_0x64ec6e){this['id']=_0x64ec6e['id']||0x0;this[_0x0d07('0x8')]=_0x64ec6e['name']||'';this[_0x0d07('0x9')]=_0x64ec6e['online']||!![];this[_0x0d07('0xa')]=_0x64ec6e[_0x0d07('0xa')]||![];this[_0x0d07('0xb')]=_0x64ec6e[_0x0d07('0xb')]||![];this[_0x0d07('0xc')]=_0x64ec6e[_0x0d07('0xc')]||![];this[_0x0d07('0xd')]=_0x64ec6e[_0x0d07('0xd')]||![];this[_0x0d07('0xe')]=_0x64ec6e[_0x0d07('0xe')]||![];this['openchannelPause']=_0x64ec6e['openchannelPause']||![];this[_0x0d07('0xf')]=_0x0d07('0x10');this['chatStatusTime']=0x0;this[_0x0d07('0x11')]=_0x64ec6e['chatCapacity']||0x0;this[_0x0d07('0x12')]=0x0;this[_0x0d07('0x13')]='unknown';this[_0x0d07('0x14')]=0x0;this[_0x0d07('0x15')]=_0x64ec6e[_0x0d07('0x15')]||0x0;this[_0x0d07('0x16')]=0x0;this[_0x0d07('0x17')]=_0x0d07('0x10');this['faxStatusTime']=0x0;this[_0x0d07('0x18')]=_0x64ec6e['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x0d07('0x19')]=_0x0d07('0x10');this[_0x0d07('0x1a')]=0x0;this[_0x0d07('0x1b')]=_0x64ec6e[_0x0d07('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0x0d07('0x1c')]=0x0;this[_0x0d07('0x1d')]=_0x64ec6e['whatsappCapacity']||0x0;this[_0x0d07('0x1e')]=0x0;this['openchannelStatus']=_0x0d07('0x10');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x64ec6e[_0x0d07('0x1f')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x0d07('0x20')]=![];this['busyQueue']=undefined;this[_0x0d07('0x1')]='';this['updateRealtime']();}Agent['prototype'][_0x0d07('0x21')]=function(_0x411e4c){if(this[_0x411e4c+_0x0d07('0x22')]>0x0){if(this[_0x411e4c+'Capacity']>0x0&&this[_0x411e4c+_0x0d07('0x22')]>=this[_0x411e4c+'Capacity']){return'maxcapacity';}else{return _0x0d07('0x23');}}else{return _0x0d07('0x24');}};Agent[_0x0d07('0x25')][_0x0d07('0x26')]=function(){var _0x4e0c97=['mail',_0x0d07('0x27'),'openchannel',_0x0d07('0x28'),_0x0d07('0x29'),'whatsapp'];for(var _0x44a14c=0x0;_0x44a14c<_0x4e0c97['length'];_0x44a14c+=0x1){var _0x483cb7=this['getChannelStatus'](_0x4e0c97[_0x44a14c]);if(this[_0x4e0c97[_0x44a14c]+_0x0d07('0x2a')]!==_0x483cb7){this[_0x4e0c97[_0x44a14c]+_0x0d07('0x2b')]=_[_0x0d07('0x2c')](moment()[_0x0d07('0x2d')]('x'));}this[_0x4e0c97[_0x44a14c]+_0x0d07('0x2a')]=_0x483cb7;}var _0x3fdfa9={'id':this['id'],'name':this[_0x0d07('0x8')],'online':this[_0x0d07('0x9')],'voicePause':this['voicePause'],'chatPause':this['chatPause'],'mailPause':this[_0x0d07('0xc')],'smsPause':this[_0x0d07('0xe')],'faxPause':this[_0x0d07('0xd')],'openchannelPause':this[_0x0d07('0x2e')],'chatStatus':this[_0x0d07('0xf')],'chatStatusTime':this[_0x0d07('0x2f')],'chatCapacity':this[_0x0d07('0x11')],'chatCurrentCapacity':this[_0x0d07('0x12')],'mailStatus':this[_0x0d07('0x13')],'mailStatusTime':this[_0x0d07('0x14')],'mailCapacity':this[_0x0d07('0x15')],'mailCurrentCapacity':this[_0x0d07('0x16')],'faxStatus':this[_0x0d07('0x17')],'faxStatusTime':this[_0x0d07('0x30')],'faxCapacity':this[_0x0d07('0x18')],'faxCurrentCapacity':this[_0x0d07('0x31')],'smsStatus':this[_0x0d07('0x19')],'smsStatusTime':this[_0x0d07('0x1a')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x0d07('0x1c')],'whatsappCapacity':this[_0x0d07('0x1d')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x0d07('0x32')],'openchannelStatusTime':this[_0x0d07('0x33')],'openchannelCapacity':this[_0x0d07('0x1f')],'openchannelCurrentCapacity':this[_0x0d07('0x34')],'busy':this['busy'],'busyQueue':this[_0x0d07('0x35')]};var _0x577273=md5(JSON[_0x0d07('0x36')](_0x3fdfa9));if(this['md5']!==_0x577273){this['md5']=_0x577273;io[_0x0d07('0x37')]('user:save',_0x3fdfa9);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d8ed610..4541fdc 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 _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 +var _0x2e3b=['Agents','mapAgentsId','waiting','md5','updateRealtime','updateRouting','_rr','prototype','loggedIn','paused','online','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x599906,_0x1e7056){var _0xfd4c41=function(_0x5a9cc0){while(--_0x5a9cc0){_0x599906['push'](_0x599906['shift']());}};_0xfd4c41(++_0x1e7056);}(_0x2e3b,0xd6));var _0xb2e3=function(_0x583048,_0x3fc6a6){_0x583048=_0x583048-0x0;var _0x45c0ca=_0x2e3b[_0x583048];return _0x45c0ca;};'use strict';var _=require(_0xb2e3('0x0'));var md5=require('md5');var util=require(_0xb2e3('0x1'));var Redis=require(_0xb2e3('0x2'));var config=require(_0xb2e3('0x3'));config[_0xb2e3('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xb2e3('0x5'))(new Redis(config['redis']));function ChatQueue(_0x8520a5){this['id']=_0x8520a5['id']||0x0;this[_0xb2e3('0x6')]=_0x8520a5[_0xb2e3('0x6')]||'';this[_0xb2e3('0x7')]=_0x8520a5[_0xb2e3('0x7')]||0xa;this[_0xb2e3('0x8')]=_0x8520a5[_0xb2e3('0x8')]||_0xb2e3('0x9');this[_0xb2e3('0xa')]=_0x8520a5['Agents'];this[_0xb2e3('0xb')]={};this[_0xb2e3('0xc')]=0x0;this[_0xb2e3('0xd')]='';this['updateRouting']();this[_0xb2e3('0xe')]();}ChatQueue['prototype'][_0xb2e3('0xf')]=function(){var _0x51b5d4=this['mapAgentsId'][_0xb2e3('0x10')];this[_0xb2e3('0xb')]=_['map'](this[_0xb2e3('0xa')],'id');this[_0xb2e3('0xb')][_0xb2e3('0x10')]=_0x51b5d4;};ChatQueue[_0xb2e3('0x11')]['updateRealtime']=function(){this[_0xb2e3('0x12')]=0x0;this[_0xb2e3('0x13')]=0x0;for(var _0x18dc5b=0x0;_0x18dc5b=0x0?this[_0xb2e3('0x15')]:0x0;var _0x432be2={'id':this['id'],'available':this['available'],'loggedIn':this[_0xb2e3('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb2e3('0xc')]};var _0x391305=md5(JSON[_0xb2e3('0x16')](_0x432be2));if(this['md5']!==_0x391305){this['md5']=_0x391305;io['to'](util[_0xb2e3('0x17')](_0xb2e3('0x18'),_0x432be2[_0xb2e3('0x6')]))[_0xb2e3('0x19')](_0xb2e3('0x1a'),_0x432be2);}};module[_0xb2e3('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index fd757fc..5dfa988 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(_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 +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(_0x2726a2,_0x3b21ef){var _0x5601d7=function(_0x57337a){while(--_0x57337a){_0x2726a2['push'](_0x2726a2['shift']());}};_0x5601d7(++_0x3b21ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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 21ea223..ea784d3 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 _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 +var _0x81a5=['name','Intervals'];(function(_0x4f51f9,_0x5d5613){var _0x533984=function(_0x578319){while(--_0x578319){_0x4f51f9['push'](_0x4f51f9['shift']());}};_0x533984(++_0x5d5613);}(_0x81a5,0x17c));var _0x581a=function(_0x5ceef2,_0x29767a){_0x5ceef2=_0x5ceef2-0x0;var _0x28fa0d=_0x81a5[_0x5ceef2];return _0x28fa0d;};'use strict';function Interval(_0x3ae964){this['id']=_0x3ae964['id']||0x0;this[_0x581a('0x0')]=_0x3ae964[_0x581a('0x0')]||'';this[_0x581a('0x1')]=_0x3ae964[_0x581a('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 02916bd..512bf78 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 _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 +var _0xf82b=['prototype','updateRouting','mapAgentsId','_rr','loggedIn','paused','length','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','updateRealtime'];(function(_0x5af763,_0x379667){var _0x30cea8=function(_0x2d02ed){while(--_0x2d02ed){_0x5af763['push'](_0x5af763['shift']());}};_0x30cea8(++_0x379667);}(_0xf82b,0xe3));var _0xbf82=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf82b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbf82('0x0'));var md5=require(_0xbf82('0x1'));var util=require(_0xbf82('0x2'));var Redis=require(_0xbf82('0x3'));var config=require(_0xbf82('0x4'));config[_0xbf82('0x5')]=_[_0xbf82('0x6')](config[_0xbf82('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xbf82('0x7'))(new Redis(config[_0xbf82('0x5')]));function MailQueue(_0x418a78){this['id']=_0x418a78['id']||0x0;this['name']=_0x418a78[_0xbf82('0x8')]||'';this[_0xbf82('0x9')]=_0x418a78[_0xbf82('0x9')]||0xa;this[_0xbf82('0xa')]=_0x418a78['strategy']||'beepall';this['Agents']=_0x418a78[_0xbf82('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0xbf82('0xc')]();}MailQueue[_0xbf82('0xd')][_0xbf82('0xe')]=function(){var _0x409ef6=this[_0xbf82('0xf')]['_rr'];this[_0xbf82('0xf')]=_['map'](this[_0xbf82('0xb')],'id');this[_0xbf82('0xf')][_0xbf82('0x10')]=_0x409ef6;};MailQueue['prototype'][_0xbf82('0xc')]=function(){this[_0xbf82('0x11')]=0x0;this[_0xbf82('0x12')]=0x0;for(var _0x33c17e=0x0;_0x33c17e=0x0?this['available']:0x0;var _0x2df109={'id':this['id'],'available':this[_0xbf82('0x16')],'loggedIn':this[_0xbf82('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xbf82('0x17')]};var _0x1de126=md5(JSON[_0xbf82('0x18')](_0x2df109));if(this['md5']!==_0x1de126){this['md5']=_0x1de126;io['to'](util[_0xbf82('0x19')](_0xbf82('0x1a'),_0x2df109[_0xbf82('0x8')]))[_0xbf82('0x1b')](_0xbf82('0x1c'),_0x2df109);}};module[_0xbf82('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 c931ceb..095c42d 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 _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 +var _0x3fcd=['beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','openchannelPause','available','stringify','format','openchannel:queue:%s','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x365c5c,_0x3eaf74){var _0x39b5ba=function(_0x3f0e23){while(--_0x3f0e23){_0x365c5c['push'](_0x365c5c['shift']());}};_0x39b5ba(++_0x3eaf74);}(_0x3fcd,0x90));var _0xd3fc=function(_0x1f59f7,_0x2cb774){_0x1f59f7=_0x1f59f7-0x0;var _0x107d50=_0x3fcd[_0x1f59f7];return _0x107d50;};'use strict';var _=require(_0xd3fc('0x0'));var md5=require(_0xd3fc('0x1'));var util=require('util');var Redis=require(_0xd3fc('0x2'));var config=require(_0xd3fc('0x3'));config['redis']=_[_0xd3fc('0x4')](config[_0xd3fc('0x5')],{'host':_0xd3fc('0x6'),'port':0x18eb});var io=require(_0xd3fc('0x7'))(new Redis(config[_0xd3fc('0x5')]));function OpenchannelQueue(_0x43f4d0){this['id']=_0x43f4d0['id']||0x0;this[_0xd3fc('0x8')]=_0x43f4d0[_0xd3fc('0x8')]||'';this['timeout']=_0x43f4d0[_0xd3fc('0x9')]||0xa;this[_0xd3fc('0xa')]=_0x43f4d0[_0xd3fc('0xa')]||_0xd3fc('0xb');this[_0xd3fc('0xc')]=_0x43f4d0[_0xd3fc('0xc')];this['mapAgentsId']={};this[_0xd3fc('0xd')]=0x0;this[_0xd3fc('0x1')]='';this[_0xd3fc('0xe')]();this[_0xd3fc('0xf')]();}OpenchannelQueue['prototype'][_0xd3fc('0xe')]=function(){var _0xb0cb6b=this[_0xd3fc('0x10')][_0xd3fc('0x11')];this[_0xd3fc('0x10')]=_[_0xd3fc('0x12')](this[_0xd3fc('0xc')],'id');this[_0xd3fc('0x10')]['_rr']=_0xb0cb6b;};OpenchannelQueue[_0xd3fc('0x13')]['updateRealtime']=function(){this[_0xd3fc('0x14')]=0x0;this[_0xd3fc('0x15')]=0x0;for(var _0x410b54=0x0;_0x410b54=0x0?this[_0xd3fc('0x19')]:0x0;var _0x589ac3={'id':this['id'],'available':this[_0xd3fc('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xd3fc('0x15')],'waiting':this[_0xd3fc('0xd')]};var _0x427307=md5(JSON[_0xd3fc('0x1a')](_0x589ac3));if(this['md5']!==_0x427307){this[_0xd3fc('0x1')]=_0x427307;io['to'](util[_0xd3fc('0x1b')](_0xd3fc('0x1c'),_0x589ac3[_0xd3fc('0x8')]))['emit'](_0xd3fc('0x1d'),_0x589ac3);}};module[_0xd3fc('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 be00e3a..ceb2acf 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 _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 +var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x28a8c2,_0x494d5){var _0x37ac3c=function(_0x2882b3){while(--_0x2882b3){_0x28a8c2['push'](_0x28a8c2['shift']());}};_0x37ac3c(++_0x494d5);}(_0xe706,0xa3));var _0x6e70=function(_0x1bb07c,_0x43cd16){_0x1bb07c=_0x1bb07c-0x0;var _0x30bb8a=_0xe706[_0x1bb07c];return _0x30bb8a;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3c6a90c..64e0f7e 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 _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 +var _0x296d=['updateRealtime','loggedIn','paused','Agents','length','online','whatsappPause','available','format','whatsapp:queue:%s','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','waiting','updateRouting','mapAgentsId','_rr','map'];(function(_0x1dc484,_0x46350a){var _0x5cf305=function(_0xee791a){while(--_0xee791a){_0x1dc484['push'](_0x1dc484['shift']());}};_0x5cf305(++_0x46350a);}(_0x296d,0xc8));var _0xd296=function(_0x5ddda9,_0x43e558){_0x5ddda9=_0x5ddda9-0x0;var _0x53a004=_0x296d[_0x5ddda9];return _0x53a004;};'use strict';var _=require('lodash');var md5=require(_0xd296('0x0'));var util=require(_0xd296('0x1'));var Redis=require(_0xd296('0x2'));var config=require(_0xd296('0x3'));config['redis']=_[_0xd296('0x4')](config[_0xd296('0x5')],{'host':_0xd296('0x6'),'port':0x18eb});var io=require(_0xd296('0x7'))(new Redis(config[_0xd296('0x5')]));function WhatsappQueue(_0x58e462){this['id']=_0x58e462['id']||0x0;this['name']=_0x58e462[_0xd296('0x8')]||'';this[_0xd296('0x9')]=_0x58e462['timeout']||0xa;this['strategy']=_0x58e462[_0xd296('0xa')]||'beepall';this['Agents']=_0x58e462['Agents'];this['mapAgentsId']={};this[_0xd296('0xb')]=0x0;this['md5']='';this[_0xd296('0xc')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xd296('0xc')]=function(){var _0x1621a2=this[_0xd296('0xd')][_0xd296('0xe')];this[_0xd296('0xd')]=_[_0xd296('0xf')](this['Agents'],'id');this[_0xd296('0xd')][_0xd296('0xe')]=_0x1621a2;};WhatsappQueue['prototype'][_0xd296('0x10')]=function(){this[_0xd296('0x11')]=0x0;this[_0xd296('0x12')]=0x0;for(var _0x50a1fb=0x0;_0x50a1fb=0x0?this[_0xd296('0x17')]:0x0;var _0x569e8f={'id':this['id'],'available':this[_0xd296('0x17')],'loggedIn':this[_0xd296('0x11')],'name':this[_0xd296('0x8')],'paused':this[_0xd296('0x12')],'waiting':this[_0xd296('0xb')]};var _0x1b9911=md5(JSON['stringify'](_0x569e8f));if(this['md5']!==_0x1b9911){this['md5']=_0x1b9911;io['to'](util[_0xd296('0x18')](_0xd296('0x19'),_0x569e8f[_0xd296('0x8')]))['emit']('whatsapp_queue:save',_0x569e8f);}};module[_0xd296('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 78e6a8f..631202e 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 _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 +var _0x008c=['faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','mergeFromDatabase','updateRealtime','chatQueues','updateRouting','initSmsQueues','initMailQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','smsQueues'];(function(_0x5250fe,_0x443cac){var _0x38465d=function(_0x54b135){while(--_0x54b135){_0x5250fe['push'](_0x5250fe['shift']());}};_0x38465d(++_0x443cac);}(_0x008c,0x188));var _0xc008=function(_0x12fb36,_0x2285e9){_0x12fb36=_0x12fb36-0x0;var _0x37952d=_0x008c[_0x12fb36];return _0x37952d;};'use strict';var BPromise=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var _=require(_0xc008('0x2'));var moment=require(_0xc008('0x3'));var Agent=require(_0xc008('0x4'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xc008('0x5'));var ChatQueue=require(_0xc008('0x6'));var SmsQueue=require(_0xc008('0x7'));var MailQueue=require(_0xc008('0x8'));var FaxQueue=require(_0xc008('0x9'));var WhatsappQueue=require(_0xc008('0xa'));var Realtime=function(){this[_0xc008('0xb')]={};this[_0xc008('0xc')]={};this[_0xc008('0xd')]={};this['chatQueues']={};this[_0xc008('0xe')]={};this['mailQueues']={};this[_0xc008('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xc008('0x10')]={};this[_0xc008('0x11')]={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x1eacfa,_0xc881aa,_0x5b2004){var _0xae2dab=_[_0xc008('0x12')](_0x1eacfa,function(_0x2ea200,_0x2a5b4e){return _0x2ea200[_0x5b2004];});for(var _0x9ffa93 in _0xc881aa){if(_0xc881aa[_0xc008('0x13')](_0x9ffa93)){if(!_0xae2dab[_0x9ffa93]){delete _0xc881aa[_0x9ffa93];}}}}Realtime[_0xc008('0x14')]['mergeFromDatabase']=function(_0x560e28,_0x33f44c){for(var _0x50c1ab in _0x33f44c){if(_0x560e28[_0xc008('0x13')](_0x50c1ab)){_0x560e28[_0x50c1ab]=_0x33f44c[_0x50c1ab];}}};Realtime[_0xc008('0x14')][_0xc008('0x15')]=function(){var _0x339ffc=this;return function(_0x3f0ecf){if(_0x3f0ecf){freeIsNotKey(_0x3f0ecf,_0x339ffc['agents'],'id');for(var _0x5e894e=0x0,_0x4bd0f4={},_0x11ef38={};_0x5e894e<_0x3f0ecf[_0xc008('0x16')];_0x5e894e+=0x1){_0x4bd0f4=_0x3f0ecf[_0x5e894e];if(_[_0xc008('0x17')](_0x339ffc[_0xc008('0xb')][_0x4bd0f4['id']])){_0x339ffc['agents'][_0x4bd0f4['id']]=new Agent(_0x4bd0f4);}else{_0x339ffc['mergeFromDatabase'](_0x339ffc['agents'][_0x4bd0f4['id']],_0x4bd0f4);}}}return _0x339ffc['agents'];};};Realtime[_0xc008('0x14')][_0xc008('0x18')]=function(){var _0x501137=this;return function(_0x813397){if(_0x813397){freeIsNotKey(_0x813397,_0x501137['intervals'],'id');for(var _0x4bd611=0x0,_0x543e5d={},_0x50261c={};_0x4bd611<_0x813397[_0xc008('0x16')];_0x4bd611+=0x1){_0x543e5d=_0x813397[_0x4bd611];if(_['isUndefined'](_0x501137['intervals'][_0x543e5d['id']])){_0x501137['intervals'][_0x543e5d['id']]=new Interval(_0x543e5d);}else{_0x501137['mergeFromDatabase'](_0x501137['intervals'][_0x543e5d['id']],_0x543e5d);}}}return _0x501137[_0xc008('0xc')];};};Realtime[_0xc008('0x14')][_0xc008('0x19')]=function(){var _0x415af3=this;return function(_0x11cc75){if(_0x11cc75){freeIsNotKey(_0x11cc75,_0x415af3[_0xc008('0xd')],'id');for(var _0x4f43e2=0x0,_0x459fd9={},_0x5c85f2={};_0x4f43e2<_0x11cc75['length'];_0x4f43e2+=0x1){_0x459fd9=_0x11cc75[_0x4f43e2];if(_[_0xc008('0x17')](_0x415af3[_0xc008('0xd')][_0x459fd9['id']])){_0x415af3[_0xc008('0xd')][_0x459fd9['id']]=new OpenchannelQueue(_0x459fd9);}else{_0x415af3[_0xc008('0x1a')](_0x415af3['openchannelQueues'][_0x459fd9['id']],_0x459fd9);}_0x415af3['openchannelQueues'][_0x459fd9['id']]['updateRouting']();_0x415af3[_0xc008('0xd')][_0x459fd9['id']][_0xc008('0x1b')]();}}return _0x415af3[_0xc008('0xd')];};};Realtime[_0xc008('0x14')]['initChatQueues']=function(){var _0x5e2aca=this;return function(_0x4fce9c){if(_0x4fce9c){freeIsNotKey(_0x4fce9c,_0x5e2aca['chatQueues'],'id');for(var _0x4caaf4=0x0,_0x3865c0={},_0x29ba43={};_0x4caaf4<_0x4fce9c[_0xc008('0x16')];_0x4caaf4+=0x1){_0x3865c0=_0x4fce9c[_0x4caaf4];if(_['isUndefined'](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']])){_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]=new ChatQueue(_0x3865c0);}else{_0x5e2aca[_0xc008('0x1a')](_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']],_0x3865c0);}_0x5e2aca['chatQueues'][_0x3865c0['id']][_0xc008('0x1d')]();_0x5e2aca[_0xc008('0x1c')][_0x3865c0['id']]['updateRealtime']();}}return _0x5e2aca['chatQueues'];};};Realtime['prototype'][_0xc008('0x1e')]=function(){var _0x267abd=this;return function(_0xf831f2){if(_0xf831f2){freeIsNotKey(_0xf831f2,_0x267abd[_0xc008('0xe')],'id');for(var _0x1de04b=0x0,_0xceebc3={},_0x294f97={};_0x1de04b<_0xf831f2[_0xc008('0x16')];_0x1de04b+=0x1){_0xceebc3=_0xf831f2[_0x1de04b];if(_[_0xc008('0x17')](_0x267abd[_0xc008('0xe')][_0xceebc3['id']])){_0x267abd[_0xc008('0xe')][_0xceebc3['id']]=new SmsQueue(_0xceebc3);}else{_0x267abd[_0xc008('0x1a')](_0x267abd['smsQueues'][_0xceebc3['id']],_0xceebc3);}_0x267abd[_0xc008('0xe')][_0xceebc3['id']][_0xc008('0x1d')]();_0x267abd['smsQueues'][_0xceebc3['id']][_0xc008('0x1b')]();}}return _0x267abd[_0xc008('0xe')];};};Realtime[_0xc008('0x14')][_0xc008('0x1f')]=function(){var _0xd0e05a=this;return function(_0x3cd878){if(_0x3cd878){freeIsNotKey(_0x3cd878,_0xd0e05a[_0xc008('0x20')],'id');for(var _0x470e79=0x0,_0x29d4b3={},_0x4f14d2={};_0x470e79<_0x3cd878[_0xc008('0x16')];_0x470e79+=0x1){_0x29d4b3=_0x3cd878[_0x470e79];if(_[_0xc008('0x17')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']])){_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]=new MailQueue(_0x29d4b3);}else{_0xd0e05a[_0xc008('0x1a')](_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']],_0x29d4b3);}_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']]['updateRouting']();_0xd0e05a[_0xc008('0x20')][_0x29d4b3['id']][_0xc008('0x1b')]();}}return _0xd0e05a['mailQueues'];};};Realtime[_0xc008('0x14')][_0xc008('0x21')]=function(){var _0x5e38d5=this;return function(_0x263473){if(_0x263473){freeIsNotKey(_0x263473,_0x5e38d5[_0xc008('0xf')],'id');for(var _0x280e9b=0x0,_0x55ff48={},_0x53b353={};_0x280e9b<_0x263473['length'];_0x280e9b+=0x1){_0x55ff48=_0x263473[_0x280e9b];if(_[_0xc008('0x17')](_0x5e38d5['faxQueues'][_0x55ff48['id']])){_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']]=new FaxQueue(_0x55ff48);}else{_0x5e38d5[_0xc008('0x1a')](_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']],_0x55ff48);}_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1d')]();_0x5e38d5[_0xc008('0xf')][_0x55ff48['id']][_0xc008('0x1b')]();}}return _0x5e38d5[_0xc008('0xf')];};};Realtime[_0xc008('0x14')][_0xc008('0x22')]=function(){var _0x3ebb83=this;return function(_0xdfca2e){if(_0xdfca2e){freeIsNotKey(_0xdfca2e,_0x3ebb83[_0xc008('0x23')],'id');for(var _0x2bf3fd=0x0,_0x4cace5={},_0x3238b4={};_0x2bf3fd<_0xdfca2e[_0xc008('0x16')];_0x2bf3fd+=0x1){_0x4cace5=_0xdfca2e[_0x2bf3fd];if(_[_0xc008('0x17')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']])){_0x3ebb83['whatsappQueues'][_0x4cace5['id']]=new WhatsappQueue(_0x4cace5);}else{_0x3ebb83[_0xc008('0x1a')](_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']],_0x4cace5);}_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']][_0xc008('0x1d')]();_0x3ebb83[_0xc008('0x23')][_0x4cace5['id']]['updateRealtime']();}}return _0x3ebb83[_0xc008('0x23')];};};module[_0xc008('0x24')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index ecc8007..e278bb1 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 _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 +var _0x4ca7=['AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4ca7,0x19e));var _0x74ca=function(_0x137c40,_0x39a20c){_0x137c40=_0x137c40-0x0;var _0x412d61=_0x4ca7[_0x137c40];return _0x412d61;};'use strict';var client=require(_0x74ca('0x0'));exports[_0x74ca('0x1')]=function(_0x34d0d3,_0x1ee2e3){return client[_0x74ca('0x2')](_0x74ca('0x3'),{'body':_0x1ee2e3,'options':{'where':{'id':_0x34d0d3}},'log':_0x74ca('0x4')});};exports[_0x74ca('0x5')]=function(_0x19d6b6,_0x489bb9){return client[_0x74ca('0x2')](_0x74ca('0x6'),{'body':_0x489bb9,'options':{'where':{'id':_0x19d6b6}},'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 4b4108c..73b1d05 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 _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 +var _0xc006=['CreateChatMessage','createChatMessage','../client','create'];(function(_0x5bfcf0,_0x44185c){var _0x4338cc=function(_0x31f2be){while(--_0x31f2be){_0x5bfcf0['push'](_0x5bfcf0['shift']());}};_0x4338cc(++_0x44185c);}(_0xc006,0x11a));var _0x6c00=function(_0x31e965,_0xbd1e54){_0x31e965=_0x31e965-0x0;var _0x120351=_0xc006[_0x31e965];return _0x120351;};'use strict';var client=require(_0x6c00('0x0'));exports[_0x6c00('0x1')]=function(_0x5f3001){return client['Request'](_0x6c00('0x2'),{'body':_0x5f3001,'log':_0x6c00('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 64eec0b..e159267 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 _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 +var _0x43c2=['timeout','strategy','User','Agents','chatPause','getChatQueues','Request','GetChatQueue','name'];(function(_0x1196bd,_0xba4aea){var _0x26014f=function(_0x542a3d){while(--_0x542a3d){_0x1196bd['push'](_0x1196bd['shift']());}};_0x26014f(++_0xba4aea);}(_0x43c2,0x10a));var _0x243c=function(_0x21e1bb,_0x5713dd){_0x21e1bb=_0x21e1bb-0x0;var _0x362752=_0x43c2[_0x21e1bb];return _0x362752;};'use strict';var client=require('../client');exports[_0x243c('0x0')]=function(){return function(){return client[_0x243c('0x1')](_0x243c('0x2'),{'options':{'raw':![],'attributes':['id',_0x243c('0x3'),_0x243c('0x4'),_0x243c('0x5')],'include':[{'model':_0x243c('0x6'),'as':_0x243c('0x7'),'attributes':['id',_0x243c('0x3'),'online',_0x243c('0x8')]}]},'log':_0x243c('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index d6df5c1..9c497c9 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 _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 +var _0x3c6d=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x194ba6,_0x19a7f9){var _0x323080=function(_0x39989f){while(--_0x39989f){_0x194ba6['push'](_0x194ba6['shift']());}};_0x323080(++_0x19a7f9);}(_0x3c6d,0x199));var _0xd3c6=function(_0x5082e5,_0x82646b){_0x5082e5=_0x5082e5-0x0;var _0x57e501=_0x3c6d[_0x5082e5];return _0x57e501;};'use strict';var client=require(_0xd3c6('0x0'));exports[_0xd3c6('0x1')]=function(_0x223ca0){return client[_0xd3c6('0x2')]('CreateChatQueueReport',{'body':_0x223ca0,'log':_0xd3c6('0x3')});};exports[_0xd3c6('0x4')]=function(_0x2a3a62,_0x28b706){return client[_0xd3c6('0x2')](_0xd3c6('0x5'),{'body':_0x28b706,'options':{'where':{'uniqueid':_0x2a3a62},'order':[['id','DESC']],'limit':0x1},'log':_0xd3c6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 6e844e6..ea4fd79 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 _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 +var _0x07f6=['addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','Request','UpdateFaxInteraction'];(function(_0xaff1bd,_0x5380c4){var _0x52ad89=function(_0x50720e){while(--_0x50720e){_0xaff1bd['push'](_0xaff1bd['shift']());}};_0x52ad89(++_0x5380c4);}(_0x07f6,0x14c));var _0x607f=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x07f6[_0x40d8d7];return _0x3454cc;};'use strict';var client=require(_0x607f('0x0'));exports[_0x607f('0x1')]=function(_0x27dbf6,_0x5303bf){return client[_0x607f('0x2')](_0x607f('0x3'),{'body':_0x5303bf,'options':{'where':{'id':_0x27dbf6}},'log':'updateFaxInteraction'});};exports[_0x607f('0x4')]=function(_0x1d1c13,_0xb17d38){return client[_0x607f('0x2')](_0x607f('0x5'),{'body':_0xb17d38,'options':{'where':{'id':_0x1d1c13}},'log':_0x607f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a163d3e..d0cc951 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 _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 +var _0x6aef=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x6aef,0xfb));var _0xf6ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aef[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf6ae('0x0'));exports[_0xf6ae('0x1')]=function(_0x1fd006){return client[_0xf6ae('0x2')](_0xf6ae('0x3'),{'body':_0x1fd006,'log':_0xf6ae('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 23149de..24d085c 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 _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 +var _0xd8e7=['name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User'];(function(_0x895368,_0x1e04a5){var _0x1605bd=function(_0x41a8fc){while(--_0x41a8fc){_0x895368['push'](_0x895368['shift']());}};_0x1605bd(++_0x1e04a5);}(_0xd8e7,0x19d));var _0x7d8e=function(_0x3faf76,_0x37e3d4){_0x3faf76=_0x3faf76-0x0;var _0x558f48=_0xd8e7[_0x3faf76];return _0x558f48;};'use strict';var client=require(_0x7d8e('0x0'));exports[_0x7d8e('0x1')]=function(){return function(){return client[_0x7d8e('0x2')](_0x7d8e('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x7d8e('0x4'),_0x7d8e('0x5')],'include':[{'model':_0x7d8e('0x6'),'as':'Agents','attributes':['id',_0x7d8e('0x7'),_0x7d8e('0x8'),_0x7d8e('0x9')]}]},'log':_0x7d8e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8a6c00e..4b2112c 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 _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 +var _0xfc90=['DESC','../client','create','Request','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x467488,_0x38c7ae){var _0x56107f=function(_0x4992b3){while(--_0x4992b3){_0x467488['push'](_0x467488['shift']());}};_0x56107f(++_0x38c7ae);}(_0xfc90,0x17b));var _0x0fc9=function(_0x13a684,_0x364ac7){_0x13a684=_0x13a684-0x0;var _0x1f969f=_0xfc90[_0x13a684];return _0x1f969f;};'use strict';var client=require(_0x0fc9('0x0'));exports[_0x0fc9('0x1')]=function(_0x959a34){return client[_0x0fc9('0x2')](_0x0fc9('0x3'),{'body':_0x959a34,'log':_0x0fc9('0x3')});};exports['update']=function(_0x2a749f,_0x2418f8){return client[_0x0fc9('0x2')](_0x0fc9('0x4'),{'body':_0x2418f8,'options':{'where':{'uniqueid':_0x2a749f},'order':[['id',_0x0fc9('0x5')]],'limit':0x1},'log':_0x0fc9('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 93d9589..62ab717 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 _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 +var _0x0647=['GetInterval','name','Interval','Intervals','getIntervals','../client','Request'];(function(_0x5de9ef,_0x37d5a3){var _0x5cee7a=function(_0x480d3b){while(--_0x480d3b){_0x5de9ef['push'](_0x5de9ef['shift']());}};_0x5cee7a(++_0x37d5a3);}(_0x0647,0xd0));var _0x7064=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0x0647[_0x4017b0];return _0x5ed4f7;};'use strict';var client=require(_0x7064('0x0'));exports['getIntervals']=function(){return function(){return client[_0x7064('0x1')](_0x7064('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7064('0x3')],'include':[{'model':_0x7064('0x4'),'as':_0x7064('0x5'),'attributes':['id','name','interval']}]},'log':_0x7064('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index d193b7c..8d44a4f 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 _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 +var _0x653c=['update','Request','UpdateMailInteraction','updateMailInteraction','AddTagsToMailInteraction','../client'];(function(_0x51b76f,_0x45b90c){var _0x5bb26c=function(_0x165d65){while(--_0x165d65){_0x51b76f['push'](_0x51b76f['shift']());}};_0x5bb26c(++_0x45b90c);}(_0x653c,0x1eb));var _0xc653=function(_0x549ac9,_0x149b4e){_0x549ac9=_0x549ac9-0x0;var _0x1d29db=_0x653c[_0x549ac9];return _0x1d29db;};'use strict';var client=require(_0xc653('0x0'));exports[_0xc653('0x1')]=function(_0x5aec16,_0x4e348f){return client[_0xc653('0x2')](_0xc653('0x3'),{'body':_0x4e348f,'options':{'where':{'id':_0x5aec16}},'log':_0xc653('0x4')});};exports['addTags']=function(_0x2b2d98,_0x51943e){return client[_0xc653('0x2')](_0xc653('0x5'),{'body':_0x51943e,'options':{'where':{'id':_0x2b2d98}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 65fe7e0..92f0899 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 _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 +var _0x6d6e=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x36b55f,_0x54c5fe){var _0x21f0d6=function(_0x197880){while(--_0x197880){_0x36b55f['push'](_0x36b55f['shift']());}};_0x21f0d6(++_0x54c5fe);}(_0x6d6e,0x156));var _0xe6d6=function(_0x16bf97,_0x35303e){_0x16bf97=_0x16bf97-0x0;var _0x4d65c3=_0x6d6e[_0x16bf97];return _0x4d65c3;};'use strict';var client=require(_0xe6d6('0x0'));exports[_0xe6d6('0x1')]=function(_0x475466){return client['Request'](_0xe6d6('0x2'),{'body':_0x475466,'log':_0xe6d6('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index c015e8a..40925f6 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 _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 +var _0xc144=['timeout','strategy','User','online','mailPause','getMailQueues','../client','Request','name'];(function(_0x4b784d,_0x5efb2f){var _0x2cdeaf=function(_0x106242){while(--_0x106242){_0x4b784d['push'](_0x4b784d['shift']());}};_0x2cdeaf(++_0x5efb2f);}(_0xc144,0x177));var _0x4c14=function(_0x30c1a4,_0x543f1f){_0x30c1a4=_0x30c1a4-0x0;var _0x20e02a=_0xc144[_0x30c1a4];return _0x20e02a;};'use strict';var client=require(_0x4c14('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x4c14('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x4c14('0x2'),_0x4c14('0x3'),_0x4c14('0x4')],'include':[{'model':_0x4c14('0x5'),'as':'Agents','attributes':['id','name',_0x4c14('0x6'),_0x4c14('0x7')]}]},'log':_0x4c14('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 06a2cc2..fa36283 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 _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 +var _0x0dc9=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x50174b,_0x1b9259){var _0x245090=function(_0xa9d811){while(--_0xa9d811){_0x50174b['push'](_0x50174b['shift']());}};_0x245090(++_0x1b9259);}(_0x0dc9,0x1c7));var _0x90dc=function(_0x266b0c,_0x4fb269){_0x266b0c=_0x266b0c-0x0;var _0xd1bfa7=_0x0dc9[_0x266b0c];return _0xd1bfa7;};'use strict';var client=require('../client');exports[_0x90dc('0x0')]=function(_0x3dfac6){return client[_0x90dc('0x1')](_0x90dc('0x2'),{'body':_0x3dfac6,'log':_0x90dc('0x2')});};exports[_0x90dc('0x3')]=function(_0x28e14a,_0x5ddb80){return client[_0x90dc('0x1')]('UpdateMailQueueReport',{'body':_0x5ddb80,'options':{'where':{'uniqueid':_0x28e14a},'order':[['id','DESC']],'limit':0x1},'log':_0x90dc('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index ffb51ce..13c8243 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 _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 +var _0x497d=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x5197c3,_0x1c6148){var _0x3b75bb=function(_0x24b622){while(--_0x24b622){_0x5197c3['push'](_0x5197c3['shift']());}};_0x3b75bb(++_0x1c6148);}(_0x497d,0x122));var _0xd497=function(_0x35cff4,_0x50d071){_0x35cff4=_0x35cff4-0x0;var _0x2409c7=_0x497d[_0x35cff4];return _0x2409c7;};'use strict';var client=require(_0xd497('0x0'));exports[_0xd497('0x1')]=function(_0x35e218,_0xeb4378){return client[_0xd497('0x2')](_0xd497('0x3'),{'body':_0xeb4378,'options':{'where':{'id':_0x35e218}},'log':_0xd497('0x4')});};exports[_0xd497('0x5')]=function(_0x280da2,_0x22d113){return client['Request']('AddTagsToOpenchannelInteraction',{'body':_0x22d113,'options':{'where':{'id':_0x280da2}},'log':_0xd497('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 91e257e..10a5bde 100644 --- a/server/services/routing/rpc/openchannelMessage.js +++ b/server/services/routing/rpc/openchannelMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf109=['../client','create'];(function(_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 +var _0x91a7=['create','Request','createOpenchannelMessage'];(function(_0x279382,_0x1191ae){var _0x4e1845=function(_0x1b4eb3){while(--_0x1b4eb3){_0x279382['push'](_0x279382['shift']());}};_0x4e1845(++_0x1191ae);}(_0x91a7,0xe7));var _0x791a=function(_0x3e62b0,_0x3ff0ea){_0x3e62b0=_0x3e62b0-0x0;var _0x55e166=_0x91a7[_0x3e62b0];return _0x55e166;};'use strict';var client=require('../client');exports[_0x791a('0x0')]=function(_0x3d6eab){return client[_0x791a('0x1')]('CreateOpenchannelMessage',{'body':_0x3d6eab,'log':_0x791a('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 6a3da41..3aff9a9 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 _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 +var _0x33a6=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents','online'];(function(_0x597eb2,_0x165f5c){var _0x56875f=function(_0x5de36e){while(--_0x5de36e){_0x597eb2['push'](_0x597eb2['shift']());}};_0x56875f(++_0x165f5c);}(_0x33a6,0x97));var _0x633a=function(_0x2e52ca,_0x291aa0){_0x2e52ca=_0x2e52ca-0x0;var _0x363720=_0x33a6[_0x2e52ca];return _0x363720;};'use strict';var client=require(_0x633a('0x0'));exports[_0x633a('0x1')]=function(){return function(){return client[_0x633a('0x2')](_0x633a('0x3'),{'options':{'raw':![],'attributes':['id',_0x633a('0x4'),'timeout',_0x633a('0x5')],'include':[{'model':_0x633a('0x6'),'as':_0x633a('0x7'),'attributes':['id',_0x633a('0x4'),_0x633a('0x8'),_0x633a('0x9')]}]},'log':_0x633a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index e5e9e03..c0715e6 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 _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 +var _0x1985=['Request','UpdateOpenchannelQueueReport','DESC','create'];(function(_0xf3d4dd,_0x3d1208){var _0x1f4e7b=function(_0x4ac2dc){while(--_0x4ac2dc){_0xf3d4dd['push'](_0xf3d4dd['shift']());}};_0x1f4e7b(++_0x3d1208);}(_0x1985,0x1c7));var _0x5198=function(_0x519680,_0x1167eb){_0x519680=_0x519680-0x0;var _0xfc5e1=_0x1985[_0x519680];return _0xfc5e1;};'use strict';var client=require('../client');exports[_0x5198('0x0')]=function(_0x2760da){return client[_0x5198('0x1')]('CreateOpenchannelQueueReport',{'body':_0x2760da,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x386f02,_0x1fdecc){return client[_0x5198('0x1')](_0x5198('0x2'),{'body':_0x1fdecc,'options':{'where':{'uniqueid':_0x386f02},'order':[['id',_0x5198('0x3')]],'limit':0x1},'log':_0x5198('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 14b24d9..7066277 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 _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 +var _0x5b5a=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','update','Request','UpdateSmsInteraction'];(function(_0x53a7f3,_0x102923){var _0x5e8e66=function(_0x364c0b){while(--_0x364c0b){_0x53a7f3['push'](_0x53a7f3['shift']());}};_0x5e8e66(++_0x102923);}(_0x5b5a,0xc3));var _0xa5b5=function(_0xa720e9,_0xf162db){_0xa720e9=_0xa720e9-0x0;var _0x902310=_0x5b5a[_0xa720e9];return _0x902310;};'use strict';var client=require('../client');exports[_0xa5b5('0x0')]=function(_0x21fcb3,_0x5e479b){return client[_0xa5b5('0x1')](_0xa5b5('0x2'),{'body':_0x5e479b,'options':{'where':{'id':_0x21fcb3}},'log':_0xa5b5('0x3')});};exports[_0xa5b5('0x4')]=function(_0x1c76ae,_0x45f433){return client[_0xa5b5('0x1')](_0xa5b5('0x5'),{'body':_0x45f433,'options':{'where':{'id':_0x1c76ae}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index a6e593e..4335c8f 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 _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 +var _0x834d=['create','Request','../client'];(function(_0x356da1,_0x5e84af){var _0x4f583c=function(_0x496d27){while(--_0x496d27){_0x356da1['push'](_0x356da1['shift']());}};_0x4f583c(++_0x5e84af);}(_0x834d,0x140));var _0xd834=function(_0x54b092,_0x54d931){_0x54b092=_0x54b092-0x0;var _0x2b6418=_0x834d[_0x54b092];return _0x2b6418;};'use strict';var client=require(_0xd834('0x0'));exports[_0xd834('0x1')]=function(_0x595403){return client[_0xd834('0x2')]('CreateSmsMessage',{'body':_0x595403,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 00137bf..7d34a3d 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 _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 +var _0x94ba=['Agents','../client','getSmsQueues','Request','GetSmsQueue','name','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x94ba,0xbe));var _0xa94b=function(_0xe2cbd3,_0x678694){_0xe2cbd3=_0xe2cbd3-0x0;var _0x5155e3=_0x94ba[_0xe2cbd3];return _0x5155e3;};'use strict';var client=require(_0xa94b('0x0'));exports[_0xa94b('0x1')]=function(){return function(){return client[_0xa94b('0x2')](_0xa94b('0x3'),{'options':{'raw':![],'attributes':['id',_0xa94b('0x4'),'timeout',_0xa94b('0x5')],'include':[{'model':'User','as':_0xa94b('0x6'),'attributes':['id',_0xa94b('0x4'),'online','smsPause']}]},'log':_0xa94b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3c20845..92129de 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 _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 +var _0xf274=['update','UpdateSmsQueueReport','DESC','create','Request','CreateSmsQueueReport'];(function(_0x4c3da1,_0x4f2c33){var _0xd8ccb7=function(_0x424616){while(--_0x424616){_0x4c3da1['push'](_0x4c3da1['shift']());}};_0xd8ccb7(++_0x4f2c33);}(_0xf274,0x99));var _0x4f27=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xf274[_0x725b8e];return _0x43ac45;};'use strict';var client=require('../client');exports[_0x4f27('0x0')]=function(_0x2dfd34){return client[_0x4f27('0x1')](_0x4f27('0x2'),{'body':_0x2dfd34,'log':_0x4f27('0x2')});};exports[_0x4f27('0x3')]=function(_0x4d3b84,_0x1b71bf){return client[_0x4f27('0x1')](_0x4f27('0x4'),{'body':_0x1b71bf,'options':{'where':{'uniqueid':_0x4d3b84},'order':[['id',_0x4f27('0x5')]],'limit':0x1},'log':_0x4f27('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index ab0f728..a3b181d 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 _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 +var _0xd044=['../client','getAgents','Request','GetUser','name','lastPauseAt','voicePause','mailPause','smsPause','whatsappPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','openchannelCapacity'];(function(_0x2b237b,_0x2ee7e0){var _0x23b15f=function(_0x43b79b){while(--_0x43b79b){_0x2b237b['push'](_0x2b237b['shift']());}};_0x23b15f(++_0x2ee7e0);}(_0xd044,0xb4));var _0x4d04=function(_0x27dfe7,_0x3acd6f){_0x27dfe7=_0x27dfe7-0x0;var _0x9d647c=_0xd044[_0x27dfe7];return _0x9d647c;};'use strict';var client=require(_0x4d04('0x0'));exports[_0x4d04('0x1')]=function(){return function(){return client[_0x4d04('0x2')](_0x4d04('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x4d04('0x4'),'online','pauseType',_0x4d04('0x5'),_0x4d04('0x6'),'chatPause',_0x4d04('0x7'),'faxPause',_0x4d04('0x8'),_0x4d04('0x9'),'openchannelPause',_0x4d04('0xa'),_0x4d04('0xb'),'faxCapacity',_0x4d04('0xc'),_0x4d04('0xd'),_0x4d04('0xe')]},'log':_0x4d04('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index e889502..d2eef57 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 _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 +var _0x3189=['../client','update','Request','UpdateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x34513e,_0x482878){var _0x30e3a6=function(_0x749481){while(--_0x749481){_0x34513e['push'](_0x34513e['shift']());}};_0x30e3a6(++_0x482878);}(_0x3189,0xae));var _0x9318=function(_0x2f78a7,_0x305d7d){_0x2f78a7=_0x2f78a7-0x0;var _0x1d44de=_0x3189[_0x2f78a7];return _0x1d44de;};'use strict';var client=require(_0x9318('0x0'));exports[_0x9318('0x1')]=function(_0x4d5650,_0x402f32){return client[_0x9318('0x2')](_0x9318('0x3'),{'body':_0x402f32,'options':{'where':{'id':_0x4d5650}},'log':'updateWhatsappInteraction'});};exports[_0x9318('0x4')]=function(_0x4ed87f,_0x53a864){return client[_0x9318('0x2')](_0x9318('0x5'),{'body':_0x53a864,'options':{'where':{'id':_0x4ed87f}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0856180..e331210 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 _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 +var _0x0602=['create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0xbbc3d6,_0x14d65c){var _0xb74576=function(_0x41bec6){while(--_0x41bec6){_0xbbc3d6['push'](_0xbbc3d6['shift']());}};_0xb74576(++_0x14d65c);}(_0x0602,0x1cc));var _0x2060=function(_0x28c1f4,_0xa99173){_0x28c1f4=_0x28c1f4-0x0;var _0x55e89c=_0x0602[_0x28c1f4];return _0x55e89c;};'use strict';var client=require('../client');exports[_0x2060('0x0')]=function(_0x324017){return client[_0x2060('0x1')](_0x2060('0x2'),{'body':_0x324017,'log':_0x2060('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5f8b712..d0d51ab 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 _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 +var _0x4058=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents'];(function(_0x2d88fd,_0x4e4302){var _0x2d8996=function(_0x27aa9e){while(--_0x27aa9e){_0x2d88fd['push'](_0x2d88fd['shift']());}};_0x2d8996(++_0x4e4302);}(_0x4058,0x129));var _0x8405=function(_0x4bcdaa,_0x243f3e){_0x4bcdaa=_0x4bcdaa-0x0;var _0x295dfc=_0x4058[_0x4bcdaa];return _0x295dfc;};'use strict';var client=require(_0x8405('0x0'));exports[_0x8405('0x1')]=function(){return function(){return client[_0x8405('0x2')](_0x8405('0x3'),{'options':{'raw':![],'attributes':['id',_0x8405('0x4'),_0x8405('0x5'),_0x8405('0x6')],'include':[{'model':_0x8405('0x7'),'as':_0x8405('0x8'),'attributes':['id','name','online','whatsappPause']}]},'log':_0x8405('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1d35cb3..286d814 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 _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 +var _0x138d=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','create'];(function(_0x15451d,_0x378b87){var _0x7a959d=function(_0x585daf){while(--_0x585daf){_0x15451d['push'](_0x15451d['shift']());}};_0x7a959d(++_0x378b87);}(_0x138d,0xd3));var _0xd138=function(_0x3932eb,_0x43b210){_0x3932eb=_0x3932eb-0x0;var _0x5316e5=_0x138d[_0x3932eb];return _0x5316e5;};'use strict';var client=require('../client');exports[_0xd138('0x0')]=function(_0x2db179){return client['Request'](_0xd138('0x1'),{'body':_0x2db179,'log':_0xd138('0x1')});};exports['update']=function(_0x53fe46,_0xcf0d41){return client['Request'](_0xd138('0x2'),{'body':_0xcf0d41,'options':{'where':{'uniqueid':_0x53fe46},'order':[['id',_0xd138('0x3')]],'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 39d4418..61f439e 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 _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 +var _0x6046=['number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','name','timeout','createQueue','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','validate','../../../../config/logger','routing','./strategy'];(function(_0x425b54,_0x40a8a4){var _0x1bbb97=function(_0x19ca30){while(--_0x19ca30){_0x425b54['push'](_0x425b54['shift']());}};_0x1bbb97(++_0x40a8a4);}(_0x6046,0x11c));var _0x6604=function(_0x45ca06,_0x36aacf){_0x45ca06=_0x45ca06-0x0;var _0x2d3c9d=_0x6046[_0x45ca06];return _0x2d3c9d;};'use strict';var schema=require(_0x6604('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0x6604('0x1'))(_0x6604('0x2'));var strategy=require(_0x6604('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x6604('0x4'),'message':_0x6604('0x5')}});function writeLog(_0x178b9a,_0x4f6e9c,_0x27ad1c){return logger[_0x6604('0x6')](util[_0x6604('0x7')](_0x6604('0x8'),_0x178b9a,_0x4f6e9c['name'],_0x27ad1c));}function handleFindAgent(_0x36bfde){return function(_0x167876){return _0x167876['name']['toLowerCase']()===_0x36bfde['toLowerCase']();};}exports[_0x6604('0x9')]=function(_0x23c99c,_0x127153,_0x5d6901,_0xf42538){return function(_0x4a5bcb){try{var _0x52a75b={'name':_0x127153[0x0],'timeout':_0x127153[0x1]};var _0x2e7179=queue['validate'](_0x52a75b,{'typecast':!![]});if(_0x2e7179[_0x6604('0xa')]){logger[_0x6604('0xb')](_0x6604('0xc'),_0x23c99c,_[_0x6604('0xd')](_0x2e7179,'message')[_0x6604('0xe')](',\x20'));_0x4a5bcb[_0x6604('0xf')]();}else{var _0x4bd90d=_[_0x6604('0x10')](_0x5d6901[_0x6604('0x11')],handleFindAgent(_0x52a75b[_0x6604('0x12')]));if(_0x4bd90d){var _0xc26038=(_0x52a75b[_0x6604('0x13')]||0xa)*0x3e8;var _0x265978,_0x53d1f7;var _0x584a4a=seqqueue[_0x6604('0x14')](_0xc26038);_0x584a4a['id']=_0x23c99c;_0x584a4a['atimeout']=_0xc26038;_0x584a4a['channel']=_0xf42538['channel'];writeLog(_0x23c99c,_0x4bd90d,util[_0x6604('0x7')](_0x6604('0x15'),_0xc26038));_0x5d6901[_0x6604('0x16')][_0x23c99c]['on'](_0x6604('0x17'),function(){logger[_0x6604('0x6')](_0x6604('0x18'),_0x23c99c);clearTimeout(_0x53d1f7);_0x53d1f7=undefined;_0x584a4a[_0x6604('0x19')]();if(_0x5d6901[_0x6604('0x16')][_0x23c99c]){delete _0x5d6901['rules'][_0x23c99c];}_0x4a5bcb['stop']();});_0x5d6901['rules'][_0x23c99c]['on']('complete',function(){if(_0x5d6901[_0x6604('0x16')][_0x23c99c]){delete _0x5d6901[_0x6604('0x16')][_0x23c99c];}});_0x53d1f7=setTimeout(function(){logger[_0x6604('0x6')](_0x6604('0x1a'),_0x23c99c);clearTimeout(_0x53d1f7);_0x584a4a['close']();_0x4a5bcb[_0x6604('0x1b')]();},_0xc26038);strategy[_0x6604('0x1c')](_0x584a4a,_0x4bd90d,_0x5d6901,_0xf42538);}else{logger[_0x6604('0xb')](_0x6604('0x1d'),_0x23c99c,_0x52a75b[_0x6604('0x12')]);_0x4a5bcb[_0x6604('0xf')]();}}}catch(_0x43cbf6){console[_0x6604('0x1e')](_0x43cbf6);logger[_0x6604('0xb')](_0x6604('0x1f'),_0x23c99c,_0x43cbf6['stack']);_0x4a5bcb[_0x6604('0xf')]();}};}; \ 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 7986965..cdfa2ed 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 _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 +var _0xf93d=['error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','toString','postText','amazonlex','providerResponse','stringify','dialogState','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch'];(function(_0x1a77e8,_0x374c98){var _0x1ea975=function(_0x5e8217){while(--_0x5e8217){_0x1a77e8['push'](_0x1a77e8['shift']());}};_0x1ea975(++_0x374c98);}(_0xf93d,0x17b));var _0xdf93=function(_0x5bbed2,_0x567f1f){_0x5bbed2=_0x5bbed2-0x0;var _0x954856=_0xf93d[_0x5bbed2];return _0x954856;};'use strict';var _=require(_0xdf93('0x0'));var moment=require(_0xdf93('0x1'));var AWS=require(_0xdf93('0x2'));var utils=require(_0xdf93('0x3'));var logger=require('../../../../config/logger')(_0xdf93('0x4'));var rpc={'chatMessage':require(_0xdf93('0x5')),'openchannelMessage':require(_0xdf93('0x6')),'mailMessage':require(_0xdf93('0x7')),'smsMessage':require(_0xdf93('0x8')),'faxMessage':require(_0xdf93('0x9')),'whatsappMessage':require(_0xdf93('0xa'))};exports['consequence']=function(_0x211879,_0x3117c9){return function(_0x1e1967){try{if(!_[_0xdf93('0xb')](this['interaction']['UserId'])){logger[_0xdf93('0xc')](_0xdf93('0xd'),_0x211879,_0xdf93('0xe'));return _0x1e1967[_0xdf93('0xf')]();}var _0x358471={'ContactId':this[_0xdf93('0x10')]['id'],'sentAt':moment()['format'](_0xdf93('0x11')),'direction':'out'};if(this[_0xdf93('0x12')]==='sms'||this[_0xdf93('0x12')]==='whatsapp'){_0x358471[_0xdf93('0x13')]=this[_0xdf93('0x14')][_0xdf93('0x13')];}var _0x2585a4=this['channel'];if(_0x2585a4===_0xdf93('0x15')){_0x358471[_0xdf93('0x16')]=this[_0xdf93('0x17')]['id'];}else{_0x358471[_[_0xdf93('0x18')](_0x2585a4)+_0xdf93('0x19')]=this[_0xdf93('0x17')]['id'];}_0x358471[_[_0xdf93('0x18')](_0x2585a4)+_0xdf93('0x1a')]=this[_0xdf93('0x14')]['id'];if(this['interaction'][_0xdf93('0x1b')]){var _0x34afb3=_0x3117c9[0x4];if(!_[_0xdf93('0x1c')](_0x34afb3)){_0x358471[_0xdf93('0x1d')]=utils[_0xdf93('0x1e')](_0x34afb3,this);return rpc[_0x2585a4+_0xdf93('0x1f')][_0xdf93('0x20')](_0x358471)[_0xdf93('0x21')](function(_0x4e34dc){logger['info']('[%s][AMAZONLEX]\x20%s',_0x211879,_0x358471[_0xdf93('0x1d')]);})[_0xdf93('0x22')](function(_0x4e1e9a){logger[_0xdf93('0x23')](_0xdf93('0xd'),_0x211879,JSON['stringify'](_0x4e1e9a));})['finally'](function(){logger['info'](_0xdf93('0x24'),_0x211879);_0x1e1967[_0xdf93('0x25')]();});}else{logger[_0xdf93('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x211879);_0x1e1967['stop']();}}else{var _0x1777c1=this;var _0x4c3cf1=new AWS['LexRuntime']({'accessKeyId':_0x3117c9[0x0],'secretAccessKey':_0x3117c9[0x1],'region':_0x3117c9[0x2]});var _0x9270e9={'botAlias':_0xdf93('0x26'),'botName':_0x3117c9[0x3],'inputText':this[_0xdf93('0x27')][_0xdf93('0x1d')],'userId':this[_0xdf93('0x12')]+':'+this[_0xdf93('0x14')]['id'][_0xdf93('0x28')]()};_0x4c3cf1[_0xdf93('0x29')](_0x9270e9,function(_0x3a6e32,_0xd04c09){if(_0x3a6e32){logger[_0xdf93('0x23')](_0xdf93('0xd'),_0x211879,_0x3a6e32[_0xdf93('0x27')]);_0x1e1967['next']();}else if(_0xd04c09&&_0xd04c09[_0xdf93('0x27')]){_0x1777c1[_0xdf93('0x1d')][_0xdf93('0x2a')]=_0xd04c09;_0x358471[_0xdf93('0x1d')]=_0xd04c09[_0xdf93('0x27')];_0x358471['providerName']=_0xdf93('0x2a');_0x358471[_0xdf93('0x2b')]=JSON[_0xdf93('0x2c')](_0xd04c09);return rpc[_0x2585a4+'Message']['create'](_0x358471)[_0xdf93('0x21')](function(_0x299136){logger[_0xdf93('0xc')]('[%s][AMAZONLEX]\x20%s',_0x211879,_0x358471['body']);if(_0xd04c09[_0xdf93('0x2d')]=='Failed'){_0x1e1967[_0xdf93('0xf')]();}else{_0x1e1967[_0xdf93('0x25')]();}})[_0xdf93('0x22')](function(_0x51b63b){logger[_0xdf93('0x23')](_0xdf93('0xd'),_0x211879,JSON['stringify'](_0x51b63b));_0x1e1967['next']();});}else{_0x1e1967['next']();}});}}catch(_0x11ff08){logger[_0xdf93('0x23')](_0xdf93('0xd'),_0x211879,JSON[_0xdf93('0x2c')](_0x11ff08));_0x1e1967[_0xdf93('0x25')]();}};}; \ 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 fac18eb..ffcbf8c 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 _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','','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','catch','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/whatsappMessage','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x53e6,0x178));var _0x653e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x53e6[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x653e('0x0'));var moment=require(_0x653e('0x1'));var utils=require(_0x653e('0x2'));var logger=require(_0x653e('0x3'))(_0x653e('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x653e('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x653e('0x6'))};var mailRpc=require(_0x653e('0x7'));exports[_0x653e('0x8')]=function(_0xe94957,_0x7df625){return function(_0x58fadb){try{if(_0x7df625[0x0]==='1'&&(_[_0x653e('0x9')](this[_0x653e('0xa')]['created'])||!this['interaction'][_0x653e('0xb')])){logger[_0x653e('0xc')](_0x653e('0xd'),_0xe94957,_0x653e('0xe'));return _0x58fadb[_0x653e('0xf')]();}var _0x17b573=this[_0x653e('0x10')];var _0x515804={'ContactId':this[_0x653e('0x11')]['id'],'sentAt':moment()[_0x653e('0x12')](_0x653e('0x13')),'direction':_0x653e('0x14')};if(this[_0x653e('0x10')]===_0x653e('0x15')){_0x515804['body']=utils[_0x653e('0x16')](_0x7df625[0x2],this);}else{_0x515804[_0x653e('0x17')]=utils['getMustacheRender'](_0x7df625[0x1],this);}if(this[_0x653e('0x18')]){_0x515804['to']=this[_0x653e('0x18')][_0x653e('0x19')]||'';if(this[_0x653e('0x10')]===_0x653e('0x15')&&_0x7df625[0x1]==='1'){_0x515804['cc']=this['message']['cc']||'';}_0x515804[_0x653e('0x19')]=this[_0x653e('0x18')]['to']||'';_0x515804['phone']=this['message'][_0x653e('0x1a')]||'';_0x515804[_0x653e('0x1b')]=!![];if(this[_0x653e('0x18')][_0x653e('0x1c')]){_0x515804[_0x653e('0x1c')]='';_0x515804[_0x653e('0x1c')]+=_['startsWith'](this[_0x653e('0x18')][_0x653e('0x1c')],_0x653e('0x1d'))?'':_0x653e('0x1e');_0x515804[_0x653e('0x1c')]+=this[_0x653e('0x18')][_0x653e('0x1c')];}}if(this[_0x653e('0x10')]===_0x653e('0x1f')){_0x515804[_0x653e('0x20')]=this['account']['id'];}else{_0x515804[_[_0x653e('0x21')](this[_0x653e('0x10')])+_0x653e('0x22')]=this[_0x653e('0x23')]['id'];}_0x515804[_[_0x653e('0x21')](this[_0x653e('0x10')])+'InteractionId']=this[_0x653e('0xa')]['id'];if(rpc[this[_0x653e('0x10')]+_0x653e('0x24')]){if(this['channel']===_0x653e('0x15')){var _0x104608={'tls':{'rejectUnauthorized':![]}};if(this[_0x653e('0x23')][_0x653e('0x25')][_0x653e('0x26')]){_0x104608[_0x653e('0x26')]=this[_0x653e('0x23')][_0x653e('0x25')][_0x653e('0x26')];}else{_0x104608[_0x653e('0x27')]=this[_0x653e('0x23')][_0x653e('0x25')][_0x653e('0x27')];_0x104608[_0x653e('0x28')]=this[_0x653e('0x23')]['Smtp'][_0x653e('0x28')];_0x104608['secure']=this[_0x653e('0x23')][_0x653e('0x25')][_0x653e('0x29')];}if(this['account'][_0x653e('0x25')][_0x653e('0x2a')]){_0x104608[_0x653e('0x2b')]={'user':this[_0x653e('0x23')][_0x653e('0x25')][_0x653e('0x2c')],'pass':this[_0x653e('0x23')]['Smtp'][_0x653e('0x2d')]};}_0x515804[_0x653e('0x2e')]=this['message'][_0x653e('0x2f')];_0x515804[_0x653e('0x30')]=_0x653e('0x31')+_['replace'](_0x515804[_0x653e('0x17')],_0x653e('0x32'),_0x653e('0x33'))+_0x653e('0x34');_0x515804['headers']={'Auto-Submitted':_0x653e('0x35'),'X-Auto-Response-Suppress':_0x653e('0x36'),'Precedence':_0x653e('0x37')};return mailRpc[_0x653e('0x38')](_0x104608,_0x515804)[_0x653e('0x39')](function(_0x423e86){logger['info'](_0x653e('0x3a'),_0xe94957);_0x515804[_0x653e('0x2f')]=_0x423e86[_0x653e('0x18')]['messageId'];return rpc[_0x17b573+'Message'][_0x653e('0x3b')](_0x515804);})[_0x653e('0x39')](function(_0x387be6){logger[_0x653e('0xc')]('[%s][AUTOREPLY]\x20%s',_0xe94957,JSON[_0x653e('0x3c')](_0x387be6));})['catch'](function(_0x1e5622){logger[_0x653e('0x3d')](_0x653e('0x3e'),_0xe94957,JSON[_0x653e('0x3c')](_0x1e5622));})[_0x653e('0x3f')](function(){_0x58fadb['next']();});}else{return rpc[this[_0x653e('0x10')]+_0x653e('0x24')]['create'](_0x515804)[_0x653e('0x39')](function(_0x1d7b10){logger[_0x653e('0xc')]('[%s][AUTOREPLY]\x20%s',_0xe94957,_0x515804[_0x653e('0x17')]);})[_0x653e('0x40')](function(_0x485b37){logger[_0x653e('0x3d')]('[%s][AUTOREPLY]\x20%s',_0xe94957,JSON['stringify'](_0x485b37));})['finally'](function(){_0x58fadb[_0x653e('0xf')]();});}}}catch(_0x317966){logger[_0x653e('0x3d')]('[%s][AUTOREPLY]\x20%s',_0xe94957,JSON[_0x653e('0x3c')](_0x317966));_0x58fadb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index d3b6354..d284b3f 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa280=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0xa280,0xc4));var _0x0a28=function(_0x56f14,_0x4c1ee2){_0x56f14=_0x56f14-0x0;var _0x429577=_0xa280[_0x56f14];return _0x429577;};'use strict';var moment=require(_0x0a28('0x0'));var logger=require(_0x0a28('0x1'))('routing');var rpc={'chatInteraction':require(_0x0a28('0x2')),'openchannelInteraction':require(_0x0a28('0x3')),'smsInteraction':require(_0x0a28('0x4')),'mailInteraction':require(_0x0a28('0x5')),'faxInteraction':require(_0x0a28('0x6')),'whatsappInteraction':require(_0x0a28('0x7'))};exports[_0x0a28('0x8')]=function(_0x4682fa,_0x1a7093,_0x3b8362,_0x297fe1){return function(_0x4705e4){try{logger[_0x0a28('0x9')](_0x0a28('0xa'),_0x4682fa,_0x1a7093[0x0]);var _0x1d627c={'closed':0x1,'closedAt':moment()[_0x0a28('0xb')](_0x0a28('0xc')),'closeReason':_0x0a28('0xd'),'disposition':_0x1a7093[0x0]};if(rpc[_0x297fe1['channel']+_0x0a28('0xe')]){rpc[_0x297fe1[_0x0a28('0xf')]+'Interaction'][_0x0a28('0x10')](_0x297fe1[_0x0a28('0x11')]['id'],_0x1d627c)['then'](function(_0x5a8192){logger[_0x0a28('0x9')](_0x0a28('0x12'),_0x4682fa,_0x297fe1[_0x0a28('0x11')]['id']);})[_0x0a28('0x13')](function(_0x17942d){logger[_0x0a28('0x14')](_0x0a28('0x15'),_0x4682fa,JSON['stringify'](_0x17942d));})[_0x0a28('0x16')](function(){_0x4705e4[_0x0a28('0x17')]();});}}catch(_0x5e94cf){logger[_0x0a28('0x14')](_0x0a28('0x15'),_0x4682fa,JSON[_0x0a28('0x18')](_0x5e94cf));_0x4705e4[_0x0a28('0x17')]();}};}; \ No newline at end of file +var _0x1a44=['../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','stop','moment','routing'];(function(_0x481bdf,_0x231538){var _0x281a12=function(_0x264b18){while(--_0x264b18){_0x481bdf['push'](_0x481bdf['shift']());}};_0x281a12(++_0x231538);}(_0x1a44,0xc4));var _0x41a4=function(_0x290ef4,_0x538150){_0x290ef4=_0x290ef4-0x0;var _0x26f2be=_0x1a44[_0x290ef4];return _0x26f2be;};'use strict';var moment=require(_0x41a4('0x0'));var logger=require('../../../../config/logger')(_0x41a4('0x1'));var rpc={'chatInteraction':require(_0x41a4('0x2')),'openchannelInteraction':require(_0x41a4('0x3')),'smsInteraction':require(_0x41a4('0x4')),'mailInteraction':require(_0x41a4('0x5')),'faxInteraction':require(_0x41a4('0x6')),'whatsappInteraction':require(_0x41a4('0x7'))};exports['consequence']=function(_0x20ab2d,_0x26b91a,_0xb62f3c,_0x412bd8){return function(_0x599ccc){try{logger['info'](_0x41a4('0x8'),_0x20ab2d,_0x26b91a[0x0]);var _0x141ae3={'closed':0x1,'closedAt':moment()[_0x41a4('0x9')](_0x41a4('0xa')),'closeReason':_0x41a4('0xb'),'disposition':_0x26b91a[0x0]};if(rpc[_0x412bd8['channel']+'Interaction']){rpc[_0x412bd8[_0x41a4('0xc')]+_0x41a4('0xd')][_0x41a4('0xe')](_0x412bd8[_0x41a4('0xf')]['id'],_0x141ae3)[_0x41a4('0x10')](function(_0x3e5320){logger['info'](_0x41a4('0x11'),_0x20ab2d,_0x412bd8[_0x41a4('0xf')]['id']);})[_0x41a4('0x12')](function(_0x184baf){logger['error'](_0x41a4('0x13'),_0x20ab2d,JSON[_0x41a4('0x14')](_0x184baf));})['finally'](function(){_0x599ccc[_0x41a4('0x15')]();});}}catch(_0x43150b){logger['error']('[%s][CLOSE]\x20%s',_0x20ab2d,JSON[_0x41a4('0x14')](_0x43150b));_0x599ccc[_0x41a4('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index c2dbb6a..7d1d3a7 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fa6=['interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','then','body','error','stringify','stop','textRequest','message','dialogflow','result','fulfillment','speech','create','endConversation','next','catch','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x1fa6,0x10b));var _0x61fa=function(_0x5c5d1b,_0x300152){_0x5c5d1b=_0x5c5d1b-0x0;var _0x5ac220=_0x1fa6[_0x5c5d1b];return _0x5ac220;};'use strict';var _=require(_0x61fa('0x0'));var moment=require(_0x61fa('0x1'));var apiai=require(_0x61fa('0x2'));var md5=require(_0x61fa('0x3'));var utils=require(_0x61fa('0x4'));var logger=require(_0x61fa('0x5'))(_0x61fa('0x6'));var rpc={'chatMessage':require(_0x61fa('0x7')),'openchannelMessage':require(_0x61fa('0x8')),'mailMessage':require(_0x61fa('0x9')),'smsMessage':require(_0x61fa('0xa')),'faxMessage':require(_0x61fa('0xb')),'whatsappMessage':require(_0x61fa('0xc'))};exports[_0x61fa('0xd')]=function(_0x2853a8,_0x4379b6){return function(_0x27aeec){try{if(!_[_0x61fa('0xe')](this[_0x61fa('0xf')]['UserId'])){logger[_0x61fa('0x10')](_0x61fa('0x11'),_0x2853a8,_0x61fa('0x12'));return _0x27aeec['next']();}var _0x10b670={'ContactId':this['contact']['id'],'sentAt':moment()[_0x61fa('0x13')](_0x61fa('0x14')),'direction':_0x61fa('0x15')};if(this[_0x61fa('0x16')]==='sms'||this[_0x61fa('0x16')]===_0x61fa('0x17')){_0x10b670[_0x61fa('0x18')]=this[_0x61fa('0xf')][_0x61fa('0x18')];}var _0x321c92=this[_0x61fa('0x16')];if(_0x321c92===_0x61fa('0x19')){_0x10b670[_0x61fa('0x1a')]=this[_0x61fa('0x1b')]['id'];}else{_0x10b670[_[_0x61fa('0x1c')](_0x321c92)+_0x61fa('0x1d')]=this[_0x61fa('0x1b')]['id'];}_0x10b670[_[_0x61fa('0x1c')](_0x321c92)+_0x61fa('0x1e')]=this[_0x61fa('0xf')]['id'];if(this[_0x61fa('0xf')][_0x61fa('0x1f')]){var _0x19f558=_0x4379b6[0x2];if(!_['isEmpty'](_0x19f558)){_0x10b670['body']=utils['getMustacheRender'](_0x19f558,this);return rpc[_0x321c92+'Message']['create'](_0x10b670)[_0x61fa('0x20')](function(_0x9aca97){logger[_0x61fa('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x2853a8,_0x10b670[_0x61fa('0x21')]);})['catch'](function(_0x5c7263){logger[_0x61fa('0x22')](_0x61fa('0x11'),_0x2853a8,JSON[_0x61fa('0x23')](_0x5c7263));})['finally'](function(){logger[_0x61fa('0x10')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2853a8);_0x27aeec['stop']();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2853a8);_0x27aeec[_0x61fa('0x24')]();}}else{var _0x33389e=this;var _0x338b72=apiai(_0x4379b6[0x0],{'language':_0x4379b6[0x1]||'en'});return _0x338b72[_0x61fa('0x25')](this[_0x61fa('0x26')][_0x61fa('0x21')],{'sessionId':md5(this['interaction']['id'])})[_0x61fa('0x20')](function(_0x1067bf){_0x33389e[_0x61fa('0x21')][_0x61fa('0x27')]=_0x1067bf;_0x10b670[_0x61fa('0x21')]=_0x1067bf[_0x61fa('0x28')][_0x61fa('0x29')][_0x61fa('0x2a')];_0x10b670['providerName']=_0x61fa('0x27');_0x10b670['providerResponse']=JSON['stringify'](_0x1067bf);return rpc[_0x321c92+'Message'][_0x61fa('0x2b')](_0x10b670)[_0x61fa('0x20')](function(_0x44446f){logger[_0x61fa('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x2853a8,_0x10b670['body']);if(_0x1067bf[_0x61fa('0x28')]['metadata'][_0x61fa('0x2c')]){_0x27aeec[_0x61fa('0x2d')]();}else{_0x27aeec[_0x61fa('0x24')]();}})[_0x61fa('0x2e')](function(_0x4e60d1){logger[_0x61fa('0x22')](_0x61fa('0x11'),_0x2853a8,JSON[_0x61fa('0x23')](_0x4e60d1));_0x27aeec[_0x61fa('0x2d')]();});})[_0x61fa('0x2e')](function(_0x14f953){logger[_0x61fa('0x22')](_0x61fa('0x11'),_0x2853a8,_0x14f953[_0x61fa('0x26')]);_0x27aeec[_0x61fa('0x2d')]();});}}catch(_0x57f324){logger[_0x61fa('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x2853a8,JSON[_0x61fa('0x23')](_0x57f324));_0x27aeec[_0x61fa('0x24')]();}};}; \ No newline at end of file +var _0x75d0=['info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','providerName','providerResponse','create','result','endConversation','lodash','moment','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','interaction','UserId'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x75d0,0x1bd));var _0x075d=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x75d0[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x075d('0x0'));var moment=require(_0x075d('0x1'));var apiai=require(_0x075d('0x2'));var md5=require(_0x075d('0x3'));var utils=require('./utils');var logger=require(_0x075d('0x4'))('routing');var rpc={'chatMessage':require(_0x075d('0x5')),'openchannelMessage':require(_0x075d('0x6')),'mailMessage':require(_0x075d('0x7')),'smsMessage':require(_0x075d('0x8')),'faxMessage':require(_0x075d('0x9')),'whatsappMessage':require(_0x075d('0xa'))};exports[_0x075d('0xb')]=function(_0x53fdb4,_0xae52e7){return function(_0x4ab8f5){try{if(!_['isNil'](this[_0x075d('0xc')][_0x075d('0xd')])){logger[_0x075d('0xe')](_0x075d('0xf'),_0x53fdb4,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4ab8f5[_0x075d('0x10')]();}var _0x21d91c={'ContactId':this[_0x075d('0x11')]['id'],'sentAt':moment()[_0x075d('0x12')](_0x075d('0x13')),'direction':_0x075d('0x14')};if(this[_0x075d('0x15')]==='sms'||this[_0x075d('0x15')]===_0x075d('0x16')){_0x21d91c[_0x075d('0x17')]=this[_0x075d('0xc')]['phone'];}var _0x341ec1=this[_0x075d('0x15')];if(_0x341ec1===_0x075d('0x18')){_0x21d91c[_0x075d('0x19')]=this[_0x075d('0x1a')]['id'];}else{_0x21d91c[_[_0x075d('0x1b')](_0x341ec1)+_0x075d('0x1c')]=this[_0x075d('0x1a')]['id'];}_0x21d91c[_[_0x075d('0x1b')](_0x341ec1)+_0x075d('0x1d')]=this[_0x075d('0xc')]['id'];if(this[_0x075d('0xc')][_0x075d('0x1e')]){var _0x2fb9cf=_0xae52e7[0x2];if(!_['isEmpty'](_0x2fb9cf)){_0x21d91c[_0x075d('0x1f')]=utils[_0x075d('0x20')](_0x2fb9cf,this);return rpc[_0x341ec1+_0x075d('0x21')]['create'](_0x21d91c)[_0x075d('0x22')](function(_0x20b5fa){logger[_0x075d('0xe')](_0x075d('0xf'),_0x53fdb4,_0x21d91c[_0x075d('0x1f')]);})[_0x075d('0x23')](function(_0xca97b9){logger[_0x075d('0x24')]('[%s][DIALOGFLOW]\x20%s',_0x53fdb4,JSON[_0x075d('0x25')](_0xca97b9));})[_0x075d('0x26')](function(){logger[_0x075d('0xe')](_0x075d('0x27'),_0x53fdb4);_0x4ab8f5[_0x075d('0x28')]();});}else{logger[_0x075d('0xe')](_0x075d('0x29'),_0x53fdb4);_0x4ab8f5[_0x075d('0x28')]();}}else{var _0x2cabfd=this;var _0x39f781=apiai(_0xae52e7[0x0],{'language':_0xae52e7[0x1]||'en'});return _0x39f781[_0x075d('0x2a')](this[_0x075d('0x2b')][_0x075d('0x1f')],{'sessionId':md5(this[_0x075d('0xc')]['id'])})[_0x075d('0x22')](function(_0x3fdd6f){_0x2cabfd[_0x075d('0x1f')][_0x075d('0x2c')]=_0x3fdd6f;_0x21d91c['body']=_0x3fdd6f['result'][_0x075d('0x2d')]['speech'];_0x21d91c[_0x075d('0x2e')]=_0x075d('0x2c');_0x21d91c[_0x075d('0x2f')]=JSON['stringify'](_0x3fdd6f);return rpc[_0x341ec1+_0x075d('0x21')][_0x075d('0x30')](_0x21d91c)['then'](function(_0x3222eb){logger['info'](_0x075d('0xf'),_0x53fdb4,_0x21d91c['body']);if(_0x3fdd6f[_0x075d('0x31')]['metadata'][_0x075d('0x32')]){_0x4ab8f5[_0x075d('0x10')]();}else{_0x4ab8f5[_0x075d('0x28')]();}})[_0x075d('0x23')](function(_0x2f0ee7){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x53fdb4,JSON[_0x075d('0x25')](_0x2f0ee7));_0x4ab8f5['next']();});})[_0x075d('0x23')](function(_0x108e70){logger[_0x075d('0x24')](_0x075d('0xf'),_0x53fdb4,_0x108e70[_0x075d('0x2b')]);_0x4ab8f5[_0x075d('0x10')]();});}}catch(_0x2679d2){logger['error'](_0x075d('0xf'),_0x53fdb4,JSON['stringify'](_0x2679d2));_0x4ab8f5[_0x075d('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index df2ae91..b706958 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xda12=['dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','action','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','providerName','providerResponse','length','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','clone','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','out','sms','channel','phone','chat','ChatWebsiteId','account','isEmpty','getMustacheRender','catch','error','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','message','detectIntent'];(function(_0x1785cd,_0x1e4753){var _0x10a79d=function(_0x56e70b){while(--_0x56e70b){_0x1785cd['push'](_0x1785cd['shift']());}};_0x10a79d(++_0x1e4753);}(_0xda12,0x198));var _0x2da1=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xda12[_0x2112d4];return _0x434972;};'use strict';var _=require(_0x2da1('0x0'));var dialogflow=require(_0x2da1('0x1'));var md5=require(_0x2da1('0x2'));var moment=require(_0x2da1('0x3'));var Promise=require(_0x2da1('0x4'));var logger=require('../../../../config/logger')(_0x2da1('0x5'));var utils=require(_0x2da1('0x6'));var rpc={'chatMessage':require(_0x2da1('0x7')),'openchannelMessage':require(_0x2da1('0x8')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2da1('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x5a3b9d,_0x231c79,_0xf0272,_0xc6b273){return new Promise(function(_0x35ca97,_0x19d0b1){var _0x83f539=_[_0x2da1('0xa')](_0xf0272);_0x83f539[_0x2da1('0xb')]=_0xc6b273;return rpc[_0x231c79+_0x2da1('0xc')][_0x2da1('0xd')](_0x83f539)[_0x2da1('0xe')](function(){logger['info'](_0x2da1('0xf'),_0x5a3b9d,_0x83f539[_0x2da1('0xb')]);_0x35ca97();})['catch'](function(_0x1c6a08){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x5a3b9d,JSON[_0x2da1('0x10')](_0x1c6a08));_0x19d0b1(_0x1c6a08);});});}exports[_0x2da1('0x11')]=function(_0x2ba1c3,_0x5b8d1d){return function(_0x56a964){try{if(!_[_0x2da1('0x12')](this[_0x2da1('0x13')]['UserId'])){logger[_0x2da1('0x14')](_0x2da1('0xf'),_0x2ba1c3,_0x2da1('0x15'));return _0x56a964[_0x2da1('0x16')]();}var _0x639c08={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2da1('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2da1('0x18')};if(this['channel']===_0x2da1('0x19')||this[_0x2da1('0x1a')]==='whatsapp'){_0x639c08['phone']=this['interaction'][_0x2da1('0x1b')];}var _0xb0f934=this['channel'];if(_0xb0f934===_0x2da1('0x1c')){_0x639c08[_0x2da1('0x1d')]=this[_0x2da1('0x1e')]['id'];}else{_0x639c08[_['upperFirst'](_0xb0f934)+'AccountId']=this[_0x2da1('0x1e')]['id'];}_0x639c08[_['upperFirst'](_0xb0f934)+'InteractionId']=this[_0x2da1('0x13')]['id'];if(this[_0x2da1('0x13')]['created']){var _0x3f9d17=_0x5b8d1d[0x4];if(!_[_0x2da1('0x1f')](_0x3f9d17)){_0x639c08[_0x2da1('0xb')]=utils[_0x2da1('0x20')](_0x3f9d17,this);return rpc[_0xb0f934+_0x2da1('0xc')][_0x2da1('0xd')](_0x639c08)['then'](function(_0x135648){logger[_0x2da1('0x14')](_0x2da1('0xf'),_0x2ba1c3,_0x639c08[_0x2da1('0xb')]);})[_0x2da1('0x21')](function(_0x54a9e2){logger[_0x2da1('0x22')]('[%s][DIALOGFLOWV2]\x20%s',_0x2ba1c3,JSON[_0x2da1('0x10')](_0x54a9e2));})['finally'](function(){logger[_0x2da1('0x14')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2ba1c3);_0x56a964[_0x2da1('0x23')]();});}else{logger['info'](_0x2da1('0x24'),_0x2ba1c3);_0x56a964['stop']();}}else{var _0x56a7a3=this;var _0x48563d=_0x5b8d1d[0x2]['replace'](/\\n/g,'\x0a');var _0x33ae64={'credentials':{'private_key':_0x48563d,'client_email':_0x5b8d1d[0x1]}};var _0xa5fde9=new dialogflow['SessionsClient'](_0x33ae64);var _0x1cba93=_0xa5fde9[_0x2da1('0x25')](_0x5b8d1d[0x0],md5(_0x56a7a3[_0x2da1('0x13')]['id']));var _0x42738a={'session':_0x1cba93,'queryInput':{'text':{'text':_0x56a7a3[_0x2da1('0x26')][_0x2da1('0xb')],'languageCode':_0x5b8d1d[0x3]||'en'}}};return _0xa5fde9[_0x2da1('0x27')](_0x42738a)[_0x2da1('0xe')](function(_0x122ab4){if(_0x122ab4&&_0x122ab4['length']){_0x56a7a3[_0x2da1('0xb')][_0x2da1('0x28')]=_0x122ab4;var _0x26426c=_0x122ab4[0x0];var _0x3fee21=_0x26426c[_0x2da1('0x29')][_0x2da1('0x2a')]&&_0x26426c[_0x2da1('0x29')][_0x2da1('0x2a')][_0x2da1('0x2b')]?_0x26426c[_0x2da1('0x29')][_0x2da1('0x2a')]['fields'][_0x2da1('0x2c')]['boolValue']:![];_0x56a7a3[_0x2da1('0xb')]['DIALOGFLOWV2_ACTION']=_0x26426c[_0x2da1('0x29')][_0x2da1('0x2d')];_0x56a7a3[_0x2da1('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x26426c[_0x2da1('0x29')]['allRequiredParamsPresent'];_0x56a7a3[_0x2da1('0xb')][_0x2da1('0x2e')]=_0x26426c[_0x2da1('0x29')][_0x2da1('0x2a')]&&_0x26426c['queryResult'][_0x2da1('0x2a')][_0x2da1('0x2b')]?_0x26426c['queryResult'][_0x2da1('0x2a')][_0x2da1('0x2b')][_0x2da1('0x2c')][_0x2da1('0x2f')]:![];_0x56a7a3['body'][_0x2da1('0x30')]=_0x26426c[_0x2da1('0x29')][_0x2da1('0x31')][_0x2da1('0x32')];_0x56a7a3[_0x2da1('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x26426c['queryResult'][_0x2da1('0x31')][_0x2da1('0x33')];_0x56a7a3[_0x2da1('0xb')][_0x2da1('0x34')]=_0x26426c[_0x2da1('0x29')]['intent'][_0x2da1('0x35')];_0x56a7a3['body'][_0x2da1('0x36')]=_0x26426c['queryResult'][_0x2da1('0x37')];_0x56a7a3['body'][_0x2da1('0x38')]=_0x26426c[_0x2da1('0x29')]['queryText'];_0x56a7a3[_0x2da1('0xb')][_0x2da1('0x39')]=_0x26426c[_0x2da1('0x29')]['intentDetectionConfidence'];_0x639c08[_0x2da1('0x3a')]='dialogflowV2';_0x639c08[_0x2da1('0x3b')]=JSON[_0x2da1('0x10')](_0x122ab4);var _0x2d6d6d=[];for(var _0x253b88=0x0;_0x253b88<_0x122ab4[_0x2da1('0x3c')];_0x253b88++){var _0x595e0f=_0x122ab4[_0x253b88];if(_0x595e0f&&_0x595e0f['queryResult']&&_0x595e0f[_0x2da1('0x29')][_0x2da1('0x3d')]){_0x2d6d6d[_0x2da1('0x3e')](createMessage(_0x2ba1c3,_0xb0f934,_0x639c08,_0x595e0f[_0x2da1('0x29')][_0x2da1('0x3d')]));}}return Promise[_0x2da1('0x3f')](_0x2d6d6d)[_0x2da1('0xe')](function(){if(_0x3fee21){_0x56a964['next']();}else{_0x56a964[_0x2da1('0x23')]();}})[_0x2da1('0x21')](function(_0x1bfeee){logger[_0x2da1('0x22')](_0x2da1('0xf'),_0x2ba1c3,JSON[_0x2da1('0x10')](_0x1bfeee));_0x56a964[_0x2da1('0x16')]();});}})[_0x2da1('0x21')](function(_0x41f021){logger[_0x2da1('0x22')](_0x2da1('0xf'),_0x2ba1c3,_0x41f021[_0x2da1('0x26')]);_0x56a964[_0x2da1('0x16')]();});}}catch(_0x37c0e4){logger[_0x2da1('0x22')]('[%s][DIALOGFLOWV2]\x20%s',_0x2ba1c3,JSON[_0x2da1('0x10')](_0x37c0e4));_0x56a964['stop']();}};}; \ No newline at end of file +var _0x6aa9=['displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','next','catch','lodash','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/faxMessage','clone','body','then','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','interaction','UserId','info','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name'];(function(_0x16ebbf,_0x429317){var _0x48d0d3=function(_0xa281a5){while(--_0xa281a5){_0x16ebbf['push'](_0x16ebbf['shift']());}};_0x48d0d3(++_0x429317);}(_0x6aa9,0xd7));var _0x96aa=function(_0x2e2fa8,_0x471829){_0x2e2fa8=_0x2e2fa8-0x0;var _0xa093fb=_0x6aa9[_0x2e2fa8];return _0xa093fb;};'use strict';var _=require(_0x96aa('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x96aa('0x1'));var Promise=require(_0x96aa('0x2'));var logger=require(_0x96aa('0x3'))(_0x96aa('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x96aa('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x96aa('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x1b7534,_0x2c84af,_0x15681b,_0x24bb9f){return new Promise(function(_0x10cbfc,_0x456b01){var _0x5b3ba0=_[_0x96aa('0x7')](_0x15681b);_0x5b3ba0[_0x96aa('0x8')]=_0x24bb9f;return rpc[_0x2c84af+'Message']['create'](_0x5b3ba0)[_0x96aa('0x9')](function(){logger['info'](_0x96aa('0xa'),_0x1b7534,_0x5b3ba0[_0x96aa('0x8')]);_0x10cbfc();})['catch'](function(_0x3782eb){logger[_0x96aa('0xb')](_0x96aa('0xa'),_0x1b7534,JSON[_0x96aa('0xc')](_0x3782eb));_0x456b01(_0x3782eb);});});}exports[_0x96aa('0xd')]=function(_0x279838,_0x48a3e4){return function(_0x333817){try{if(!_['isNil'](this[_0x96aa('0xe')][_0x96aa('0xf')])){logger[_0x96aa('0x10')](_0x96aa('0xa'),_0x279838,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x333817['next']();}var _0x255b80={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x96aa('0x11')),'direction':_0x96aa('0x12')};if(this[_0x96aa('0x13')]==='sms'||this[_0x96aa('0x13')]===_0x96aa('0x14')){_0x255b80[_0x96aa('0x15')]=this[_0x96aa('0xe')][_0x96aa('0x15')];}var _0x568db4=this[_0x96aa('0x13')];if(_0x568db4===_0x96aa('0x16')){_0x255b80[_0x96aa('0x17')]=this[_0x96aa('0x18')]['id'];}else{_0x255b80[_[_0x96aa('0x19')](_0x568db4)+'AccountId']=this['account']['id'];}_0x255b80[_[_0x96aa('0x19')](_0x568db4)+_0x96aa('0x1a')]=this[_0x96aa('0xe')]['id'];if(this['interaction']['created']){var _0x3a9b93=_0x48a3e4[0x4];if(!_[_0x96aa('0x1b')](_0x3a9b93)){_0x255b80['body']=utils[_0x96aa('0x1c')](_0x3a9b93,this);return rpc[_0x568db4+_0x96aa('0x1d')][_0x96aa('0x1e')](_0x255b80)['then'](function(_0x4129cd){logger[_0x96aa('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x279838,_0x255b80[_0x96aa('0x8')]);})['catch'](function(_0x3a5b2c){logger[_0x96aa('0xb')](_0x96aa('0xa'),_0x279838,JSON[_0x96aa('0xc')](_0x3a5b2c));})[_0x96aa('0x1f')](function(){logger[_0x96aa('0x10')](_0x96aa('0x20'),_0x279838);_0x333817[_0x96aa('0x21')]();});}else{logger[_0x96aa('0x10')](_0x96aa('0x22'),_0x279838);_0x333817['stop']();}}else{var _0x234c4e=this;var _0x24ef20=_0x48a3e4[0x2]['replace'](/\\n/g,'\x0a');var _0x79d93e={'credentials':{'private_key':_0x24ef20,'client_email':_0x48a3e4[0x1]}};var _0x24b629=new dialogflow[(_0x96aa('0x23'))](_0x79d93e);var _0x5e0bd5=_0x24b629[_0x96aa('0x24')](_0x48a3e4[0x0],md5(_0x234c4e[_0x96aa('0xe')]['id']));var _0x4229f0={'session':_0x5e0bd5,'queryInput':{'text':{'text':_0x234c4e[_0x96aa('0x25')]['body'],'languageCode':_0x48a3e4[0x3]||'en'}}};return _0x24b629[_0x96aa('0x26')](_0x4229f0)[_0x96aa('0x9')](function(_0x1601ab){if(_0x1601ab&&_0x1601ab['length']){_0x234c4e['body'][_0x96aa('0x27')]=_0x1601ab;var _0x3a60a6=_0x1601ab[0x0];var _0x2455c2=_0x3a60a6['queryResult']['diagnosticInfo']&&_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')]['fields']?_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')][_0x96aa('0x2a')][_0x96aa('0x2b')][_0x96aa('0x2c')]:![];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x2d')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x2e')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x2f')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x30')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x31')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')]&&_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')][_0x96aa('0x2a')]?_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x29')][_0x96aa('0x2a')][_0x96aa('0x2b')]['boolValue']:![];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x32')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x33')][_0x96aa('0x34')];_0x234c4e[_0x96aa('0x8')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x33')][_0x96aa('0x35')];_0x234c4e['body'][_0x96aa('0x36')]=_0x3a60a6[_0x96aa('0x28')]['intent'][_0x96aa('0x37')];_0x234c4e[_0x96aa('0x8')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x38')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x39')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x3a')];_0x234c4e[_0x96aa('0x8')][_0x96aa('0x3b')]=_0x3a60a6[_0x96aa('0x28')][_0x96aa('0x3c')];_0x255b80[_0x96aa('0x3d')]=_0x96aa('0x27');_0x255b80[_0x96aa('0x3e')]=JSON[_0x96aa('0xc')](_0x1601ab);var _0x571ae0=[];for(var _0x34cd00=0x0;_0x34cd00<_0x1601ab['length'];_0x34cd00++){var _0x56d5cd=_0x1601ab[_0x34cd00];if(_0x56d5cd&&_0x56d5cd[_0x96aa('0x28')]&&_0x56d5cd[_0x96aa('0x28')][_0x96aa('0x3f')]){_0x571ae0[_0x96aa('0x40')](createMessage(_0x279838,_0x568db4,_0x255b80,_0x56d5cd[_0x96aa('0x28')][_0x96aa('0x3f')]));}}return Promise['all'](_0x571ae0)[_0x96aa('0x9')](function(){if(_0x2455c2){_0x333817[_0x96aa('0x41')]();}else{_0x333817['stop']();}})[_0x96aa('0x42')](function(_0xa68a31){logger[_0x96aa('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x279838,JSON[_0x96aa('0xc')](_0xa68a31));_0x333817[_0x96aa('0x41')]();});}})[_0x96aa('0x42')](function(_0x3514b4){logger['error'](_0x96aa('0xa'),_0x279838,_0x3514b4[_0x96aa('0x25')]);_0x333817[_0x96aa('0x41')]();});}}catch(_0x920e42){logger[_0x96aa('0xb')](_0x96aa('0xa'),_0x279838,JSON['stringify'](_0x920e42));_0x333817[_0x96aa('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index c610432..f6b2900 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _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 +var _0x75d4=['length','[%s][GOTOIF]\x20%s','message','join','stop','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','fromString','replace'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x75d4,0x145));var _0x475d=function(_0x160144,_0x5c1497){_0x160144=_0x160144-0x0;var _0x3a94f8=_0x75d4[_0x160144];return _0x3a94f8;};'use strict';var schema=require(_0x475d('0x0'));var _=require(_0x475d('0x1'));var htmlToText=require(_0x475d('0x2'));var utils=require(_0x475d('0x3'));var logger=require('../../../../config/logger')(_0x475d('0x4'));var gotoif=schema({'condition':{'type':_0x475d('0x5'),'required':!![],'message':_0x475d('0x6')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x475d('0x7'),'message':_0x475d('0x8')}});exports['consequence']=function(_0x5ed01b,_0x40e08b){return function(_0x326fc9){try{var _0x46ec06={'condition':htmlToText[_0x475d('0x9')](utils['getMustacheRender'](_0x40e08b[0x0],this),{'wordwrap':![]})[_0x475d('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x40e08b[0x1],'priorityFalse':_0x40e08b[0x2]};var _0x1c6853=gotoif[_0x475d('0x0')](_0x46ec06,{'typecast':!![]});if(_0x1c6853[_0x475d('0xb')]){logger['error'](_0x475d('0xc'),_0x5ed01b,_['map'](_0x1c6853,_0x475d('0xd'))[_0x475d('0xe')](',\x20'));_0x326fc9[_0x475d('0xf')]();}else{try{var _0x4165f6=eval('('+_0x46ec06['condition']+')');var _0x28f05d=_0x4165f6?_0x46ec06[_0x475d('0x10')]:_0x46ec06['priorityFalse'];logger['info'](_0x475d('0x11'),_0x5ed01b,_0x46ec06[_0x475d('0x12')],_0x4165f6,_0x28f05d||_0x475d('0x13'));if(_0x28f05d){var _0x98d6a1=_[_0x475d('0x14')](_0x326fc9[_0x475d('0x15')](),{'p':_0x28f05d});if(_0x98d6a1>=0x0){logger[_0x475d('0x16')](_0x475d('0x17'),_0x5ed01b,_0x28f05d||_0x475d('0x13'),_0x98d6a1);_0x326fc9[_0x475d('0x13')](_0x98d6a1);}else{logger['info'](_0x475d('0x18'),_0x5ed01b,_0x28f05d||_0x475d('0x13'));_0x326fc9[_0x475d('0xf')]();}}else{_0x326fc9[_0x475d('0x13')]();}}catch(_0x2844ce){logger[_0x475d('0x19')](_0x475d('0x1a'),_0x5ed01b,_0x2844ce[_0x475d('0xd')]);_0x326fc9[_0x475d('0xf')]();}}}catch(_0x15909d){logger[_0x475d('0x19')](_0x475d('0xc'),_0x5ed01b,JSON[_0x475d('0x1b')](_0x15909d));_0x326fc9['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index ebe59ef..9edbaf8 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 _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 +var _0x9d93=['info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop'];(function(_0x50dcff,_0x1b57ef){var _0x54c556=function(_0x2d734b){while(--_0x2d734b){_0x50dcff['push'](_0x50dcff['shift']());}};_0x54c556(++_0x1b57ef);}(_0x9d93,0xeb));var _0x39d9=function(_0x4977ca,_0x3bdce1){_0x4977ca=_0x4977ca-0x0;var _0xc095eb=_0x9d93[_0x4977ca];return _0xc095eb;};'use strict';var schema=require(_0x39d9('0x0'));var _=require('lodash');var logger=require('../../../../config/logger')(_0x39d9('0x1'));var gotop=schema({'priority':{'type':_0x39d9('0x2'),'required':!![],'message':_0x39d9('0x3')}});exports[_0x39d9('0x4')]=function(_0x16cd91,_0x2ab3f2){return function(_0x28fa4d){try{var _0x4f7d40={'priority':_0x2ab3f2[0x0]};var _0x46dbf9=gotop['validate'](_0x4f7d40,{'typecast':!![]});if(_0x46dbf9[_0x39d9('0x5')]){logger[_0x39d9('0x6')](_0x39d9('0x7'),_0x16cd91,_[_0x39d9('0x8')](_0x46dbf9,_0x39d9('0x9'))[_0x39d9('0xa')](',\x20'));_0x28fa4d[_0x39d9('0xb')]();}else{logger[_0x39d9('0xc')](_0x39d9('0xd'),_0x16cd91,_0x4f7d40['priority']);if(_0x4f7d40[_0x39d9('0xe')]){var _0x37ea1c=_[_0x39d9('0xf')](_0x28fa4d['rules'](),{'p':_0x4f7d40[_0x39d9('0xe')]});if(_0x37ea1c>=0x0){logger[_0x39d9('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x16cd91,_0x4f7d40['priority']||_0x39d9('0x10'),_0x37ea1c);_0x28fa4d[_0x39d9('0x10')](_0x37ea1c);}else{logger[_0x39d9('0xc')](_0x39d9('0x11'),_0x16cd91,_0x4f7d40[_0x39d9('0xe')]||_0x39d9('0x10'));_0x28fa4d[_0x39d9('0xb')]();}}else{_0x28fa4d['next']();}}}catch(_0x3654c0){logger[_0x39d9('0x6')](_0x39d9('0x7'),_0x16cd91,JSON[_0x39d9('0x12')](_0x3654c0));_0x28fa4d[_0x39d9('0xb')]();}};}; \ 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 b1b8cf0..ca94802 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 _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 +var _0x0f44=['lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','info','body','next','error','[%s][MESSAGE]\x20%s','stringify','stop'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x0f44,0x96));var _0x40f4=function(_0x36e087,_0x606765){_0x36e087=_0x36e087-0x0;var _0x289943=_0x0f44[_0x36e087];return _0x289943;};'use strict';var _=require(_0x40f4('0x0'));var utils=require('./utils');var logger=require(_0x40f4('0x1'))(_0x40f4('0x2'));var rpc={'chatMessage':require(_0x40f4('0x3')),'openchannelMessage':require(_0x40f4('0x4')),'mailMessage':require(_0x40f4('0x5')),'smsMessage':require(_0x40f4('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x40f4('0x7')]=function(_0x55e564,_0x42cbc0){return function(_0x5f5daf){try{var _0x4aed81={'body':utils[_0x40f4('0x8')](_0x42cbc0[0x0],this),'ContactId':this['contact']['id']};if(this[_0x40f4('0x9')]===_0x40f4('0xa')){_0x4aed81[_0x40f4('0xb')]=this[_0x40f4('0xc')]['id'];}else{_0x4aed81[_[_0x40f4('0xd')](this[_0x40f4('0x9')])+_0x40f4('0xe')]=this['account']['id'];}_0x4aed81[_['upperFirst'](this[_0x40f4('0x9')])+'InteractionId']=this[_0x40f4('0xf')]['id'];if(rpc[this[_0x40f4('0x9')]+_0x40f4('0x10')]){return rpc[this[_0x40f4('0x9')]+_0x40f4('0x10')][_0x40f4('0x11')](_0x4aed81)['then'](function(_0x12bfcf){logger[_0x40f4('0x12')]('[%s][MESSAGE]\x20%s',_0x55e564,_0x4aed81[_0x40f4('0x13')]);_0x5f5daf[_0x40f4('0x14')]();})['catch'](function(_0x7d049f){logger[_0x40f4('0x15')]('[%s][MESSAGE]\x20%s',_0x55e564,JSON['stringify'](_0x7d049f));_0x5f5daf['stop']();});}}catch(_0x591468){logger[_0x40f4('0x15')](_0x40f4('0x16'),_0x55e564,JSON[_0x40f4('0x17')](_0x591468));_0x5f5daf[_0x40f4('0x18')]();}};}; \ 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 d94b5bf..9fad361 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 _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 +var _0x7c73=['../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils'];(function(_0x412972,_0xb063b8){var _0x31f3cc=function(_0x2870ee){while(--_0x2870ee){_0x412972['push'](_0x412972['shift']());}};_0x31f3cc(++_0xb063b8);}(_0x7c73,0x104));var _0x37c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c73[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0x37c7('0x0'));var logger=require(_0x37c7('0x1'))(_0x37c7('0x2'));exports['consequence']=function(_0x3c7c9e,_0x5b45a2){return function(_0x3e9dbc){try{logger[_0x37c7('0x3')](_0x37c7('0x4'),_0x3c7c9e,utils[_0x37c7('0x5')](_0x5b45a2[0x0],this));_0x3e9dbc[_0x37c7('0x6')]();}catch(_0x2fc074){logger[_0x37c7('0x7')](_0x37c7('0x4'),_0x3c7c9e,JSON[_0x37c7('0x8')](_0x2fc074));_0x3e9dbc['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 9eb4c82..efe06bb 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 _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 +var _0xedd9=['[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','close','rules','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','redis','defaults','localhost','account','queue','from','joinAt','emit','clone','queue_id','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','interaction','MessageId','chat','AccountId','info','name','message','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted'];(function(_0xf54f7f,_0x2a7cad){var _0x231da2=function(_0x5ae764){while(--_0x5ae764){_0xf54f7f['push'](_0xf54f7f['shift']());}};_0x231da2(++_0x2a7cad);}(_0xedd9,0xfc));var _0x9edd=function(_0x13c673,_0x73db44){_0x13c673=_0x13c673-0x0;var _0x27dd05=_0xedd9[_0x13c673];return _0x27dd05;};'use strict';var schema=require('validate');var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var seqqueue=require(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var config=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))(_0x9edd('0x7'));var strategy=require('./strategy');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));var attributes=['id','queue_id',_0x9edd('0xb'),_0x9edd('0xc'),_0x9edd('0xd'),_0x9edd('0xe')];function emit(_0x49d5e3,_0x494a24,_0x5d2f90){io['to'](_0x49d5e3)[_0x9edd('0xf')](_0x494a24,_0x5d2f90);}function emitChannelQueueInteraction(_0x138767,_0x523026,_0xbf9da6,_0x13dc4f,_0x5b6c00,_0x30c0d7,_0x1b73d1,_0x25e64c){var _0xfd544a=_[_0x9edd('0x10')](_0xbf9da6);_0xfd544a[_0x9edd('0x11')]=_0x25e64c;_0xfd544a[_0x9edd('0xc')]=_0x523026;_0xfd544a[_0x9edd('0xb')]=_0x13dc4f;_0xfd544a['id']=_0x5b6c00;if(_0x30c0d7){_0x1b73d1[util['format'](_0x9edd('0x12'),_0x138767)][_0x5b6c00]=_[_0x9edd('0x13')](_0xfd544a,attributes);}else{delete _0x1b73d1[util[_0x9edd('0x14')](_0x9edd('0x12'),_0x138767)][_0x5b6c00];}emit(util[_0x9edd('0x14')](_0x9edd('0x15'),_0x138767,_0x523026),util[_0x9edd('0x14')](_0x9edd('0x16'),_0x138767,_0x30c0d7?'save':_0x9edd('0x17')),_[_0x9edd('0x13')](_0xfd544a,attributes));}var rpc={'openchannelQueueReport':require(_0x9edd('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x9edd('0x19')),'smsQueueReport':require(_0x9edd('0x1a')),'faxQueueReport':require(_0x9edd('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x9edd('0x1c'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x9edd('0x1d'),'message':_0x9edd('0x1e')}});function startRouting(_0x4bdb88,_0x498977,_0x45c3ab,_0x50338f){if(_0x4bdb88&&_0x498977&&_0x45c3ab){_0x498977[_0x9edd('0x1f')]+=0x1;var _0x54a03f={'uniqueid':_0x4bdb88,'from':_0x45c3ab['body']?_0x45c3ab[_0x9edd('0x20')][_0x9edd('0xd')]:'','joinAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x45c3ab[_0x9edd('0x21')]?_0x45c3ab[_0x9edd('0x21')]['id']:null,'ListId':_0x45c3ab[_0x9edd('0x22')]?_0x45c3ab['list']['id']:null};_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x25')]=_0x498977['id']||null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+'InteractionId']=_0x45c3ab[_0x9edd('0x26')]?_0x45c3ab[_0x9edd('0x26')]['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+_0x9edd('0x27')]=_0x45c3ab['message']?_0x45c3ab['message']['id']:null;_0x54a03f[_[_0x9edd('0x23')](_0x45c3ab[_0x9edd('0x24')])+(_0x45c3ab[_0x9edd('0x24')]!==_0x9edd('0x28')?_0x9edd('0x29'):'WebsiteId')]=_0x45c3ab['account']?_0x45c3ab[_0x9edd('0xb')]['id']:null;logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][START:QUEUE][NAME:%s]',_0x4bdb88,_0x498977[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x45c3ab[_0x9edd('0x24')],_0x498977[_0x9edd('0x2b')],_0x54a03f,_0x45c3ab[_0x9edd('0xb')]['name'],_0x45c3ab[_0x9edd('0x2c')]['id'],!![],_0x50338f,_0x498977['id']);if(rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x45c3ab[_0x9edd('0x24')]+_0x9edd('0x2d')][_0x9edd('0x2e')](_0x54a03f)[_0x9edd('0x2f')](function(_0x1fba7b){logger[_0x9edd('0x30')](_0x9edd('0x31'));});}}}function stopRouting(_0x4fd03f,_0x138002,_0x6907a5,_0xa55906){if(_0x4fd03f&&_0x138002){_0x138002[_0x9edd('0x1f')]-=0x1;var _0x5af178={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'acceptAt':moment()[_0x9edd('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x9edd('0x33')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')](_0x9edd('0x34'),_0x4fd03f,_0x138002[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x6907a5[_0x9edd('0x24')],_0x138002[_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x20')],_0x6907a5[_0x9edd('0xb')][_0x9edd('0x2b')],_0x6907a5[_0x9edd('0x2c')]['id'],![],_0xa55906,_0x138002['id']);if(rpc[_0x6907a5[_0x9edd('0x24')]+_0x9edd('0x2d')]){return rpc[_0x6907a5[_0x9edd('0x24')]+'QueueReport'][_0x9edd('0x35')](_0x4fd03f,_0x5af178)['catch'](function(_0x968303){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function endRouting(_0x434d26,_0x16770e,_0x4fa5ab,_0x6de835){if(_0x434d26&&_0x16770e){_0x16770e[_0x9edd('0x1f')]-=0x1;var _0x2b3469={'leaveAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'exitAt':moment()[_0x9edd('0x14')](_0x9edd('0x32')),'reason':_0x9edd('0x37')};logger[_0x9edd('0x2a')](util[_0x9edd('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x434d26,_0x16770e[_0x9edd('0x2b')]));emitChannelQueueInteraction(_0x4fa5ab['channel'],_0x16770e[_0x9edd('0x2b')],_0x4fa5ab['body'],_0x4fa5ab[_0x9edd('0xb')][_0x9edd('0x2b')],_0x4fa5ab[_0x9edd('0x2c')]['id'],![],_0x6de835);if(rpc[_0x4fa5ab['channel']+_0x9edd('0x2d')]){return rpc[_0x4fa5ab[_0x9edd('0x24')]+_0x9edd('0x2d')]['update'](_0x434d26,_0x2b3469)[_0x9edd('0x2f')](function(_0x51ad91){logger[_0x9edd('0x30')](_0x9edd('0x36'));});}}}function handleFindQueue(_0x50be2c){return function(_0x315f52){return _0x315f52[_0x9edd('0x2b')][_0x9edd('0x38')]()===_0x50be2c[_0x9edd('0x38')]();};}exports['consequence']=function(_0x449f01,_0x5bbdf8,_0x2bdb3f,_0xc1e657){return function(_0x587d74){try{var _0x318757={'name':_0x5bbdf8[0x0],'timeout':_0x5bbdf8[0x1]};var _0x49a128=queue['validate'](_0x318757,{'typecast':!![]});if(_0x49a128[_0x9edd('0x39')]){logger[_0x9edd('0x30')](_0x9edd('0x3a'),_0x449f01,_[_0x9edd('0x3b')](_0x49a128,_0x9edd('0x2c'))[_0x9edd('0x3c')](',\x20'));_0x587d74[_0x9edd('0x3d')]();}else{var _0x75efbe=_[_0x9edd('0x3e')](_0x2bdb3f[_0xc1e657[_0x9edd('0x24')]+_0x9edd('0x3f')],handleFindQueue(_0x318757[_0x9edd('0x2b')]));if(_0x75efbe){startRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);var _0x3d5eba=(_0x75efbe[_0x9edd('0x37')]||0xa)*0x3e8;var _0x46e9f4=(_0x318757['timeout']||0x14)*0x3e8;var _0x13197d,_0x2570e3;if(_0x3d5eba>_0x46e9f4){_0x46e9f4=_0x3d5eba;}var _0x2231c1=seqqueue[_0x9edd('0x40')](_0x3d5eba);_0x2231c1['id']=_0x449f01;_0x2231c1[_0x9edd('0x41')]=_0x3d5eba;_0x2231c1[_0x9edd('0x42')]=_0x46e9f4;_0x2231c1[_0x9edd('0x24')]=_0xc1e657['channel'];_0x2bdb3f['rules'][_0x449f01]['on']('end',function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x449f01);stopRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x13197d=undefined;_0x2231c1[_0x9edd('0x43')](!![]);if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}_0x587d74[_0x9edd('0x3d')]();});_0x2bdb3f[_0x9edd('0x44')][_0x449f01]['on']('complete',function(){if(_0x2bdb3f[_0x9edd('0x44')][_0x449f01]){delete _0x2bdb3f[_0x9edd('0x44')][_0x449f01];}});_0x13197d=setTimeout(function(){logger[_0x9edd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x449f01);endRouting(_0x449f01,_0x75efbe,_0xc1e657,_0x2bdb3f);clearTimeout(_0x13197d);_0x2231c1[_0x9edd('0x43')](!![]);_0x587d74[_0x9edd('0x45')]();},_0x46e9f4);switch(_0x75efbe[_0x9edd('0x46')]){case _0x9edd('0x47'):strategy[_0x9edd('0x47')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);break;default:strategy[_0x9edd('0x48')](_0x2231c1,_0x75efbe,_0x2bdb3f,_0xc1e657);}}else{logger['error'](_0x9edd('0x49'),_0x449f01,_0x318757[_0x9edd('0x2b')]);_0x587d74['stop']();}}}catch(_0xb93816){console[_0x9edd('0x4a')](_0xb93816);logger['error'](_0x9edd('0x3a'),_0x449f01,_0xb93816[_0x9edd('0x4b')]);_0x587d74[_0x9edd('0x3d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 8cd4152..343ea88 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 _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 +var _0x0fca=['forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','routing','notificationId','agent','realtime','squeue','push','handleRun','bind','timeout','prototype','handleTimeout','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x47fadd,_0x106340){var _0x2b411d=function(_0x35ef6a){while(--_0x35ef6a){_0x47fadd['push'](_0x47fadd['shift']());}};_0x2b411d(++_0x106340);}(_0x0fca,0x185));var _0xa0fc=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0fca[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xa0fc('0x0'));var uuid=require(_0xa0fc('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xa0fc('0x2'));var Agent=function(_0x8887a1,_0x28c036,_0x4a6ff4,_0x1ec5b2){this[_0xa0fc('0x3')]=uuid['v4']();this['squeue']=_0x8887a1;this[_0xa0fc('0x4')]=_0x28c036;this[_0xa0fc('0x5')]=_0x4a6ff4;this[_0xa0fc('0x2')]=_0x1ec5b2;this[_0xa0fc('0x6')][_0xa0fc('0x7')](this[_0xa0fc('0x8')][_0xa0fc('0x9')](this),this['handleTimeout']['bind'](this));this[_0xa0fc('0x6')]['on'](_0xa0fc('0xa'),this['handleTimeout'][_0xa0fc('0x9')](this));this[_0xa0fc('0x6')]['on']('drained',this['handleDrained'][_0xa0fc('0x9')](this));};Agent[_0xa0fc('0xb')][_0xa0fc('0x7')]=function(){this[_0xa0fc('0x6')][_0xa0fc('0x7')](this[_0xa0fc('0x8')][_0xa0fc('0x9')](this),this[_0xa0fc('0xc')][_0xa0fc('0x9')](this));};Agent[_0xa0fc('0xb')][_0xa0fc('0xd')]=function(){this[_0xa0fc('0xc')](!![]);};Agent['prototype'][_0xa0fc('0x8')]=function(_0x12ab29){logger[_0xa0fc('0xe')](_0xa0fc('0xf'),this[_0xa0fc('0x6')]['id'],this[_0xa0fc('0x4')]['id']);if(_[_0xa0fc('0x10')](this[_0xa0fc('0x5')][_0xa0fc('0x11')][this[_0xa0fc('0x4')]['id']])){logger[_0xa0fc('0xe')](_0xa0fc('0x12'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0xa0fc('0x7')][_0xa0fc('0x9')](this),0x3e8);}else{if(this[_0xa0fc('0x2')][_0xa0fc('0x13')]||util[_0xa0fc('0x14')](this['squeue']['id'],this[_0xa0fc('0x5')]['agents'][this[_0xa0fc('0x4')]['id']],this['squeue'][_0xa0fc('0x15')],![])){this['realtime'][_0xa0fc('0x11')][this[_0xa0fc('0x4')]['id']][_0xa0fc('0x16')]=!![];this[_0xa0fc('0x5')][_0xa0fc('0x11')][this[_0xa0fc('0x4')]['id']][_0xa0fc('0x17')]=undefined;util[_0xa0fc('0x18')](this[_0xa0fc('0x3')],this[_0xa0fc('0x6')]['id'],this[_0xa0fc('0x5')]['agents'][this['agent']['id']],null,this[_0xa0fc('0x2')]);util[_0xa0fc('0x19')](this[_0xa0fc('0x6')]['id'],this[_0xa0fc('0x5')]['agents'][this[_0xa0fc('0x4')]['id']],_0xa0fc('0x1a')+(this[_0xa0fc('0x2')][_0xa0fc('0x13')]?_0xa0fc('0x1b'):''));}else{logger[_0xa0fc('0xe')](_0xa0fc('0x1c'),this[_0xa0fc('0x6')]['id'],this[_0xa0fc('0x4')]['id']);setTimeout(this[_0xa0fc('0x7')][_0xa0fc('0x9')](this),0x3e8);}}};Agent[_0xa0fc('0xb')][_0xa0fc('0xc')]=function(_0x317a6b){if(_['isNil'](this['realtime'][_0xa0fc('0x11')][this['agent']['id']])){return logger['info'](_0xa0fc('0x12'),this['squeue']['id'],this[_0xa0fc('0x4')]['id']);}else{logger[_0xa0fc('0xe')](_0xa0fc('0x1d'),this[_0xa0fc('0x6')]['id'],this['agent']['id']);util[_0xa0fc('0x1e')](this['notificationId'],this[_0xa0fc('0x6')]['id'],this[_0xa0fc('0x5')][_0xa0fc('0x11')][this[_0xa0fc('0x4')]['id']],null,this[_0xa0fc('0x2')]);this[_0xa0fc('0x5')][_0xa0fc('0x11')][this['agent']['id']]['busy']=![];this[_0xa0fc('0x5')][_0xa0fc('0x11')][this['agent']['id']][_0xa0fc('0x17')]=undefined;util[_0xa0fc('0x19')](this[_0xa0fc('0x6')]['id'],this['realtime']['agents'][this[_0xa0fc('0x4')]['id']],_0x317a6b?_0xa0fc('0x1f'):_0xa0fc('0x20'));}if(!_0x317a6b){setTimeout(this[_0xa0fc('0x7')][_0xa0fc('0x9')](this),0x3e8);}};function agent(_0xe2a1e4,_0x3fa606,_0x249bec,_0x5db7e8){return new Agent(_0xe2a1e4,_0x3fa606,_0x249bec,_0x5db7e8);}module[_0xa0fc('0x21')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index cb5813a..5cae5b1 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 _0x5691=['hideNotification','STOP','TIMEOUT','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','routing','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','isNil','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY'];(function(_0x159b01,_0x2656a5){var _0x493527=function(_0x5c57cc){while(--_0x5c57cc){_0x159b01['push'](_0x159b01['shift']());}};_0x493527(++_0x2656a5);}(_0x5691,0x113));var _0x1569=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5691[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var uuid=require(_0x1569('0x0'));var util=require(_0x1569('0x1'));var logger=require(_0x1569('0x2'))('routing');var Beepall=function(_0x390482,_0x1c3dca,_0x3a9c05,_0x4dfe62){this[_0x1569('0x3')]=uuid['v4']();this[_0x1569('0x4')]=_0x390482;this[_0x1569('0x5')]=_0x1c3dca;this['realtime']=_0x3a9c05;this[_0x1569('0x6')]=_0x4dfe62;this[_0x1569('0x4')][_0x1569('0x7')](this[_0x1569('0x8')][_0x1569('0x9')](this),this['handleTimeout'][_0x1569('0x9')](this));this[_0x1569('0x4')]['on'](_0x1569('0xa'),this['handleTimeout']['bind'](this));this[_0x1569('0x4')]['on'](_0x1569('0xb'),this[_0x1569('0xc')]['bind'](this));};Beepall[_0x1569('0xd')][_0x1569('0x7')]=function(){this[_0x1569('0x4')][_0x1569('0x7')](this[_0x1569('0x8')]['bind'](this),this['handleTimeout'][_0x1569('0x9')](this));};Beepall['prototype'][_0x1569('0xc')]=function(_0x3f7365){this[_0x1569('0xe')](!![]);};Beepall[_0x1569('0xd')][_0x1569('0x8')]=function(_0x2d90a8){var _0x49fe6c=!![];if(!_[_0x1569('0xf')](this[_0x1569('0x5')])&&!_[_0x1569('0xf')](this[_0x1569('0x5')][_0x1569('0x10')])&&this[_0x1569('0x5')]['Agents'][_0x1569('0x11')]>0x0){for(var _0x253286=0x0,_0x30eb8d;_0x2532860x0){for(var _0x51a42f=0x0,_0x5efb38;_0x51a42f0x0&&_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 +var _0x47c7=['name','split','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','error','[%s][QUEUE]\x20%s','message','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','online','Pause','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','../../../../../config/logger','routing','redis','defaults','localhost','emit','format','user:%s'];(function(_0x172f19,_0x3b48cd){var _0xce2860=function(_0x515c82){while(--_0x515c82){_0x172f19['push'](_0x172f19['shift']());}};_0xce2860(++_0x3b48cd);}(_0x47c7,0x1f3));var _0x747c=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x47c7[_0x367e5b];return _0x4b909e;};'use strict';var _=require('lodash');var util=require(_0x747c('0x0'));var utils=require(_0x747c('0x1'));var Mustache=require(_0x747c('0x2'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0x747c('0x3'))(_0x747c('0x4'));config[_0x747c('0x5')]=_[_0x747c('0x6')](config['redis'],{'host':_0x747c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x747c('0x5')]));function emit(_0x351f82,_0x808bac,_0x2e0e82){io['to'](_0x351f82)[_0x747c('0x8')](_0x808bac,_0x2e0e82);}function sendNotification(_0x310e2f,_0x15f61b,_0x3ed002,_0x2c526d,_0x14ffb6,_0x28039c){io['to'](util[_0x747c('0x9')](_0x747c('0xa'),_0x2c526d[_0x747c('0xb')]))['emit']('user:save',_0x2c526d);var _0xd87e08=_0x28039c||{};var _0x42fe7f=_0x3ed002[_0x747c('0xc')]('.');var _0x1b3d76={'uniqueid':_0x15f61b,'channel':_0x42fe7f[0x0],'id':_0x42fe7f[0x1],'title':_0x42fe7f[0x0]+'\x20interaction','interactionId':_0x42fe7f[0x2],'queue':_0x14ffb6?_0x14ffb6['name']:null,'sound':_0xd87e08[_0x747c('0xd')][_0x747c('0xe')],'shake':_0xd87e08[_0x747c('0xd')][_0x747c('0xf')]};try{if(!_0xd87e08[_0x747c('0x10')]){_0xd87e08[_0x747c('0x10')]={};}if(_0x14ffb6){_0xd87e08[_0x747c('0x10')][_0x747c('0x11')]=_0x14ffb6;}else if(_0xd87e08['body'][_0x747c('0x11')]){delete _0xd87e08[_0x747c('0x10')][_0x747c('0x11')];}_0x1b3d76[_0x747c('0x12')]=utils['getMustacheRender'](_0xd87e08[_0x747c('0xd')][_0x747c('0x13')],_0xd87e08);}catch(_0x5f3e27){_0x1b3d76['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x747c('0x14')](util['format'](_0x747c('0x15'),_0x15f61b,_0x5f3e27[_0x747c('0x16')]));}io['to'](util[_0x747c('0x9')](_0x747c('0xa'),_0x2c526d[_0x747c('0xb')]))['emit'](util[_0x747c('0x9')]('notification:%s',_0x310e2f?_0x747c('0x17'):'remove'),_0x1b3d76);}function writeLog(_0x336ef0,_0x2a816c,_0x1eb0f5){return logger['info'](util[_0x747c('0x9')](_0x747c('0x18'),_0x336ef0,_0x2a816c['name'],_0x1eb0f5));}exports[_0x747c('0x19')]=function(_0xd60bab,_0x3c0fe7,_0x3fafc7,_0x33ba1f){if(_0x3c0fe7['busy']){writeLog(_0xd60bab,_0x3c0fe7,'BUSY');return![];}if(!_0x3c0fe7[_0x747c('0x1a')]){writeLog(_0xd60bab,_0x3c0fe7,'OFFLINE');return![];}if(_0x3c0fe7[_0x3fafc7+_0x747c('0x1b')]){writeLog(_0xd60bab,_0x3c0fe7,'PAUSE');return![];}if(_0x33ba1f&&_0x3c0fe7['hasOwnProperty'](_0x3fafc7+_0x747c('0x1c'))&&_0x3c0fe7['hasOwnProperty'](_0x3fafc7+'CurrentCapacity')){if(_0x3c0fe7[_0x3fafc7+_0x747c('0x1c')]>0x0&&_0x3c0fe7[_0x3fafc7+'CurrentCapacity']>=_0x3c0fe7[_0x3fafc7+'Capacity']){writeLog(_0xd60bab,_0x3c0fe7,_0x3fafc7[_0x747c('0x1d')]()+_0x747c('0x1e'));return![];}}return!![];};exports[_0x747c('0x1f')]=function(_0x40b696,_0x3085d0,_0x257a64,_0x1b87f3,_0x45f60b){return sendNotification(!![],_0x40b696,_0x3085d0,_0x257a64,_0x1b87f3,_0x45f60b);};exports[_0x747c('0x20')]=function(_0x53650f,_0x57e82a,_0x401808,_0x3da07b,_0x568038){return sendNotification(![],_0x53650f,_0x57e82a,_0x401808,_0x3da07b,_0x568038);};exports[_0x747c('0x21')]=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 330be22..8ee052c 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 _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 +var _0xeab9=['isObject','stringify','validate','shelljs','./utils','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','CONSEQ','log','inside\x20R\x20function','SYS\x20obj','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','inside\x20error'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xeab9,0x8e));var _0x9eab=function(_0x20cc05,_0xee6987){_0x20cc05=_0x20cc05-0x0;var _0x92b4ba=_0xeab9[_0x20cc05];return _0x92b4ba;};'use strict';var schema=require(_0x9eab('0x0'));var sh=require(_0x9eab('0x1'));var _=require('lodash');var utils=require(_0x9eab('0x2'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x9eab('0x3')}});exports[_0x9eab('0x4')]=function(_0x55cf0d,_0x2a5eff){console['log'](_0x9eab('0x5'));return function(_0x36d1bb){console[_0x9eab('0x6')](_0x9eab('0x7'),_0x36d1bb);try{var _0x585111={'command':_0x2a5eff[0x0]};console[_0x9eab('0x6')](_0x9eab('0x8'),_0x585111);var _0xea9996=system[_0x9eab('0x0')](_0x585111,{'typecast':!![]});if(_0xea9996['length']){logger[_0x9eab('0x9')](_0x9eab('0xa'),_0x55cf0d,_['map'](_0xea9996,_0x9eab('0xb'))[_0x9eab('0xc')](',\x20'));logger[_0x9eab('0xd')](_0x9eab('0xe'),_0x55cf0d);_0x36d1bb[_0x9eab('0xf')]();}else{var _0x599a79=this;var _0x3a1526=utils[_0x9eab('0x10')](_0x2a5eff[0x0],this);logger['info'](_0x9eab('0x11'),_0x55cf0d,_0x3a1526);sh[_0x9eab('0x12')](_[_0x9eab('0x13')](_0x3a1526),function(_0x267e13,_0x34a5d8){logger[_0x9eab('0xd')](_0x9eab('0x14'),_0x55cf0d,_0x267e13);if(_0x267e13==0x0){var _0x2f79a7=_0x34a5d8[_0x9eab('0x15')](/(\r\n|\n|\r)/gm,'');if(_[_0x9eab('0x16')](_0x2a5eff[0x1])||_[_0x9eab('0x17')](_0x2a5eff[0x1])){logger[_0x9eab('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x55cf0d);_0x599a79['body'][_0x2a5eff[0x1]]=_0x2f79a7;}else{logger[_0x9eab('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x55cf0d,_0x2a5eff[0x1],_0x2f79a7);_0x599a79[_0x9eab('0x18')][_0x2a5eff[0x1]]=_0x2f79a7;}}_0x36d1bb['next']();});}}catch(_0x3eff25){console[_0x9eab('0x6')](_0x9eab('0x19'),_0x3eff25);logger['error'](_0x9eab('0xa'),_0x55cf0d,_[_0x9eab('0x1a')](_0x3eff25)?JSON[_0x9eab('0x1b')](_0x3eff25):_0x3eff25);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x55cf0d);_0x36d1bb[_0x9eab('0xf')]();}};}; \ 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 ea1999f..6d17d31 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 _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 +var _0x2cc3=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','consequence','validate','error','[%s][TAG]\x20%s','map','message','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction'];(function(_0x579d29,_0x370a6e){var _0x5b4fbd=function(_0x1b7a5c){while(--_0x1b7a5c){_0x579d29['push'](_0x579d29['shift']());}};_0x5b4fbd(++_0x370a6e);}(_0x2cc3,0x125));var _0x32cc=function(_0x7534d1,_0x14a266){_0x7534d1=_0x7534d1-0x0;var _0x3dc708=_0x2cc3[_0x7534d1];return _0x3dc708;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0x32cc('0x0')),'openchannelInteraction':require(_0x32cc('0x1')),'smsInteraction':require(_0x32cc('0x2')),'mailInteraction':require(_0x32cc('0x3')),'faxInteraction':require(_0x32cc('0x4')),'whatsappInteraction':require(_0x32cc('0x5'))};var logger=require(_0x32cc('0x6'))(_0x32cc('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x32cc('0x8')]=function(_0x1457ff,_0x574b28,_0x106db4,_0xd6ad38){return function(_0xebe9be){try{var _0x473106={'tag':_0x574b28[0x0]};var _0x2dfc7a=tag[_0x32cc('0x9')](_0x473106,{'typecast':!![]});if(_0x2dfc7a['length']){logger[_0x32cc('0xa')](_0x32cc('0xb'),_0x1457ff,_[_0x32cc('0xc')](_0x2dfc7a,_0x32cc('0xd'))['join'](',\x20'));logger[_0x32cc('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1457ff);_0xebe9be[_0x32cc('0xf')]();}else{var _0x4ca85c={'ids':[_0x574b28[0x0]]};if(rpc[_0xd6ad38[_0x32cc('0x10')]+_0x32cc('0x11')]){rpc[_0xd6ad38[_0x32cc('0x10')]+_0x32cc('0x11')][_0x32cc('0x12')](_0xd6ad38[_0x32cc('0x13')]['id'],_0x4ca85c)[_0x32cc('0x14')](function(_0x323322){logger['info'](_0x32cc('0x15'),_0x1457ff,_0x574b28[0x1],_0xd6ad38['channel'],_0xd6ad38[_0x32cc('0x13')]['id']);})[_0x32cc('0x16')](function(_0x12bc71){logger[_0x32cc('0xa')]('[%s][TAG]\x20%s',_0x1457ff,JSON[_0x32cc('0x17')](_0x12bc71));logger[_0x32cc('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x1457ff);})[_0x32cc('0x18')](function(){_0xebe9be['next']();});}}}catch(_0x3273a4){logger['error'](_0x32cc('0xb'),_0x1457ff,_[_0x32cc('0x19')](_0x3273a4)?JSON[_0x32cc('0x17')](_0x3273a4):_0x3273a4);logger['info'](_0x32cc('0x1a'),_0x1457ff);_0xebe9be[_0x32cc('0xf')]();}};}; \ 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 452d092..c4c510c 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 _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 +var _0x8482=['list','lodash','exports','render','merge','body','contact','message','account'];(function(_0x16d3f8,_0x3f5dd3){var _0x49a172=function(_0x2f730d){while(--_0x2f730d){_0x16d3f8['push'](_0x16d3f8['shift']());}};_0x49a172(++_0x3f5dd3);}(_0x8482,0x14e));var _0x2848=function(_0x24810e,_0x106118){_0x24810e=_0x24810e-0x0;var _0x2bde2a=_0x8482[_0x24810e];return _0x2bde2a;};'use strict';var Mustache=require('mustache');var _=require(_0x2848('0x0'));module[_0x2848('0x1')]={'getMustacheRender':function(_0x24b414,_0xecfb19){return Mustache[_0x2848('0x2')](_0x24b414,_[_0x2848('0x3')](_0xecfb19[_0x2848('0x4')],{'contact':_0xecfb19[_0x2848('0x5')],'message':_0xecfb19[_0x2848('0x6')],'account':_0xecfb19[_0x2848('0x7')],'interaction':_0xecfb19['interaction'],'list':_0xecfb19[_0x2848('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7e72543..c065659 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 _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 +var _0x7579=['loggedIn','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','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/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','join','app','.js','autoreply','appdata','split','mail','push','slice','dialogflowv2','amazonlex','TagId','%s:%s:%s','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','emit','stack','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','waiting','mailQueues'];(function(_0x5d0e4f,_0xe4f92a){var _0x104229=function(_0x548602){while(--_0x548602){_0x5d0e4f['push'](_0x5d0e4f['shift']());}};_0x104229(++_0xe4f92a);}(_0x7579,0x1e2));var _0x9757=function(_0x24bf6e,_0x55b06b){_0x24bf6e=_0x24bf6e-0x0;var _0x55d7ad=_0x7579[_0x24bf6e];return _0x55d7ad;};'use strict';var _=require(_0x9757('0x0'));var util=require(_0x9757('0x1'));var path=require(_0x9757('0x2'));var fs=require('fs');var jayson=require(_0x9757('0x3'));var BPromise=require(_0x9757('0x4'));var uuid=require(_0x9757('0x5'));var config=require('../../../config/environment');var logger=require(_0x9757('0x6'))(_0x9757('0x7'));var rpc={'openchannelQueueReport':require(_0x9757('0x8')),'mailQueueReport':require(_0x9757('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x9757('0xa')),'faxQueueReport':require(_0x9757('0xb')),'whatsappQueueReport':require(_0x9757('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x28a14a,_0x51a1c8,_0x2d65dd){return util[_0x9757('0xd')](_0x9757('0xe'),_0x28a14a,_0x51a1c8||0x0,_0x2d65dd||0x0);}function getIntervals(_0x5b5749,_0x375d91){var _0x13f01a=[];if(!_[_0x9757('0xf')](_0x375d91[_0x9757('0x10')])&&!_[_0x9757('0xf')](_0x5b5749[_0x375d91[_0x9757('0x10')]])&&!_[_0x9757('0xf')](_0x5b5749[_0x375d91[_0x9757('0x10')]][_0x9757('0x11')])){_0x13f01a=_[_0x9757('0x12')](_0x5b5749[_0x375d91[_0x9757('0x10')]]['Intervals'],_0x9757('0x13'));}else if(!_[_0x9757('0xf')](_0x375d91[_0x9757('0x13')])){_0x13f01a=[_0x375d91['interval']];}return _0x13f01a;}exports[_0x9757('0x14')]=function(_0x39fa5c){_0x39fa5c[_0x9757('0x15')]={};return new BPromise(function(_0x14f67c,_0x224229){var _0x3abf05={'Start':function(_0x105e56){var _0x4b994d=this;return new Promise(function(_0x1fd6f6,_0x55ded7){if(_0x105e56){try{var _0x17ab45=[];var _0xcc8f94=getId(_0x105e56[_0x9757('0x16')],_0x105e56[_0x9757('0x17')]?_0x105e56[_0x9757('0x17')]['id']:0x0,_0x105e56[_0x9757('0x18')]?_0x105e56['interaction']['id']:0x0);if(_0x105e56[_0x9757('0x19')]&&_[_0x9757('0x1a')](_0x105e56[_0x9757('0x19')])&&_0x105e56[_0x9757('0x19')][_0x9757('0x1b')]){for(var _0xd2306b=0x0;_0xd2306b<_0x105e56[_0x9757('0x19')]['length'];_0xd2306b+=0x1){var _0x185506=_0x105e56['applications'][_0xd2306b];if(fs['existsSync'](path[_0x9757('0x1c')](__dirname,_0x9757('0x19'),_0x185506[_0x9757('0x1d')]+_0x9757('0x1e')))){var _0x559135=[];switch(_0x185506['app']['toLowerCase']()){case _0x9757('0x1f'):var _0x32054f=_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');if(_0x105e56['channel']===_0x9757('0x22')){_0x559135[_0x9757('0x23')](_0x32054f[0x0]);_0x559135['push'](_0x32054f[0x1]);_0x559135[_0x9757('0x23')](_0x32054f[_0x9757('0x24')](0x2,_0x32054f['length'])[_0x9757('0x1c')](','));}else{_0x559135[_0x9757('0x23')](_0x32054f[0x0]);_0x559135[_0x9757('0x23')](_0x32054f[_0x9757('0x24')](0x1,_0x32054f[_0x9757('0x1b')])[_0x9757('0x1c')](','));}break;case'dialogflow':var _0x2a9438=_0x185506['appdata'][_0x9757('0x21')](',');_0x559135[_0x9757('0x23')](_0x2a9438[0x0]);_0x559135['push'](_0x2a9438[0x1]);_0x559135['push'](_0x2a9438[_0x9757('0x24')](0x2,_0x2a9438[_0x9757('0x1b')])[_0x9757('0x1c')](','));break;case _0x9757('0x25'):var _0x4ebdb6=_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');_0x559135[_0x9757('0x23')](_0x4ebdb6[0x0]);_0x559135[_0x9757('0x23')](_0x4ebdb6[0x1]);_0x559135[_0x9757('0x23')](_0x4ebdb6[0x2]);_0x559135[_0x9757('0x23')](_0x4ebdb6[0x3]);_0x559135['push'](_0x4ebdb6[_0x9757('0x24')](0x4,_0x4ebdb6[_0x9757('0x1b')])[_0x9757('0x1c')](','));break;case _0x9757('0x26'):var _0x478199=_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');_0x559135['push'](_0x478199[0x0]);_0x559135[_0x9757('0x23')](_0x478199[0x1]);_0x559135[_0x9757('0x23')](_0x478199[0x2]);_0x559135[_0x9757('0x23')](_0x478199[0x3]);_0x559135[_0x9757('0x23')](_0x478199[_0x9757('0x24')](0x4,_0x478199[_0x9757('0x1b')])[_0x9757('0x1c')](','));break;case _0x9757('0x17'):_0x559135['push'](_0x185506[_0x9757('0x20')]);break;case'tag':_0x559135[_0x9757('0x23')](_0x185506[_0x9757('0x27')]);_0x559135['push'](_0x185506[_0x9757('0x20')]);break;default:_0x559135=_[_0x9757('0xf')](_0x185506[_0x9757('0x20')])?[]:_0x185506[_0x9757('0x20')][_0x9757('0x21')](',');}var _0x2f2688={'id':util[_0x9757('0xd')](_0x9757('0x28'),_0xcc8f94,_0x185506['id'],_0x185506[_0x9757('0x1d')]),'condition':require(_0x9757('0x29'))['condition'](_0xcc8f94,getIntervals(_0x39fa5c[_0x9757('0x2a')],_0x185506),_0x39fa5c),'consequence':require(_0x9757('0x2b')+_0x185506[_0x9757('0x1d')])['consequence'](_0xcc8f94,_0x559135,_0x39fa5c,_0x105e56),'p':_0x185506[_0x9757('0x2c')]||0x0};logger[_0x9757('0x2d')](_0x9757('0x2e'),_0x2f2688['id'],_0x9757('0x2f'),getIntervals(_0x39fa5c[_0x9757('0x2a')],_0x185506)[_0x9757('0x1c')](_0x9757('0x30')));_0x17ab45[_0x9757('0x23')](_0x2f2688);}else{logger[_0x9757('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0x9757('0x19'),_0x185506[_0x9757('0x1d')]+_0x9757('0x1e')));}}_0x39fa5c[_0x9757('0x15')][_0xcc8f94]=new RuleEngine(_0x17ab45);_0x39fa5c['rules'][_0xcc8f94][_0x9757('0x32')](_0x105e56,function(_0x4dfa93){logger[_0x9757('0x2d')](_0x9757('0x33'),JSON[_0x9757('0x34')](_0x4dfa93['matchPath']));if(_0x39fa5c[_0x9757('0x15')][_0xcc8f94]){_0x39fa5c[_0x9757('0x15')][_0xcc8f94][_0x9757('0x35')]('complete');}});return _0x1fd6f6({'code':0xc8,'message':_0x105e56});}else{logger[_0x9757('0x2d')]('No\x20applications\x20to\x20execute');return _0x1fd6f6({'code':0xc8,'message':_0x105e56});}}catch(_0x50f0e4){logger[_0x9757('0x31')](_0x50f0e4[_0x9757('0x36')]);return _0x55ded7(_0x4b994d[_0x9757('0x31')](0x1f4,_0x50f0e4));}}return _0x55ded7(_0x9757('0x37'));});},'AcceptMessage':function(_0xb90596){var _0x4f30db=this;return new Promise(function(_0x49429a,_0x4f1cdd){if(_0xb90596[_0x9757('0x38')]&&_0xb90596[_0x9757('0x38')]['id']){if(_0x39fa5c[_0x9757('0x39')][_0xb90596['agent']['id']]){_0x39fa5c[_0x9757('0x39')][_0xb90596[_0x9757('0x38')]['id']]['busy']=![];_0x39fa5c[_0x9757('0x39')][_0xb90596[_0x9757('0x38')]['id']][_0x9757('0x3a')]=undefined;}}if(_0xb90596[_0x9757('0x17')]&&_0xb90596['message']['id']){try{var _0xc312a8=getId(_0xb90596[_0x9757('0x16')],_0xb90596[_0x9757('0x17')]?_0xb90596[_0x9757('0x17')]['id']:0x0,_0xb90596[_0x9757('0x18')]?_0xb90596[_0x9757('0x18')]['id']:0x0);if(_0x39fa5c[_0x9757('0x15')][_0xc312a8]){_0x39fa5c[_0x9757('0x15')][_0xc312a8][_0x9757('0x35')]('end');if(rpc[_0xb90596['channel']+_0x9757('0x3b')]){rpc[_0xb90596[_0x9757('0x16')]+_0x9757('0x3b')]['update'](_0xc312a8,{'UserId':_0xb90596[_0x9757('0x17')][_0x9757('0x3c')]})[_0x9757('0x3d')](function(_0x59ae0e){logger[_0x9757('0x31')](_0x9757('0x3e'));});}}return _0x49429a({'code':0xc8,'message':_0xb90596});}catch(_0x497542){logger['error'](_0x497542['stack']);return _0x4f1cdd(_0x4f30db[_0x9757('0x31')](0x1f4,_0x497542));}}logger[_0x9757('0x31')](_0x9757('0x3f'));return _0x4f1cdd(_0x4f30db['error'](0x1f4,_0x9757('0x3f')));});},'RejectMessage':function(_0x5aaadf){var _0xf2f0dc=this;return new Promise(function(_0x173f0f,_0x5e4430){if(_0x5aaadf[_0x9757('0x38')]&&_0x5aaadf[_0x9757('0x38')]['id']){try{if(_0x39fa5c[_0x9757('0x39')][_0x5aaadf[_0x9757('0x38')]['id']]){_0x39fa5c[_0x9757('0x39')][_0x5aaadf['agent']['id']][_0x9757('0x40')]=![];_0x39fa5c[_0x9757('0x39')][_0x5aaadf[_0x9757('0x38')]['id']][_0x9757('0x3a')]=undefined;}return _0x173f0f({'code':0xc8,'message':_0x5aaadf});}catch(_0x3bff1d){logger[_0x9757('0x31')](_0x3bff1d[_0x9757('0x36')]);return _0x5e4430(_0xf2f0dc['error'](0x1f4,_0x3bff1d));}}logger['error'](_0x9757('0x3f'));return _0x5e4430(_0xf2f0dc['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x41419a){var _0x59fed4=this;return new Promise(function(_0x410177,_0x14c0c8){if(_0x41419a['channel']&&_0x41419a['interaction']&&_0x41419a[_0x9757('0x18')]['id']){try{var _0x502321=getId(_0x41419a[_0x9757('0x16')],_0x41419a['message']?_0x41419a[_0x9757('0x17')]['id']:0x0,_0x41419a['interaction']?_0x41419a[_0x9757('0x18')]['id']:0x0);if(_0x39fa5c[_0x9757('0x15')][_0x502321]){_0x39fa5c[_0x9757('0x15')][_0x502321][_0x9757('0x35')](_0x9757('0x41'));}return _0x410177({'code':0xc8,'message':_0x41419a});}catch(_0x25ae79){logger[_0x9757('0x31')](_0x25ae79[_0x9757('0x36')]);return _0x14c0c8(_0x59fed4['error'](0x1f4,_0x25ae79));}}logger[_0x9757('0x31')](_0x9757('0x3f'));return _0x14c0c8(_0x59fed4[_0x9757('0x31')](0x1f4,_0x9757('0x3f')));});},'AgentCapacity':function(_0x39ee2a){var _0x277948=this;return new Promise(function(_0x11bff1,_0x297e1b){if(_0x39fa5c[_0x9757('0x39')][_0x9757('0x42')](_0x39ee2a['id'])){for(var _0x1fa7df in _0x39ee2a[_0x9757('0x43')]){if(_0x39ee2a[_0x9757('0x43')]['hasOwnProperty'](_0x1fa7df)){if(_0x39fa5c['agents'][_0x39ee2a['id']][_0x9757('0x42')](_0x1fa7df+'CurrentCapacity')){_0x39fa5c[_0x9757('0x39')][_0x39ee2a['id']][_0x1fa7df+_0x9757('0x44')]=parseInt(_0x39ee2a[_0x9757('0x43')][_0x1fa7df],0xa);}}}_0x39fa5c['agents'][_0x39ee2a['id']][_0x9757('0x45')]();return _0x11bff1({'code':0xc8,'message':_0x39fa5c[_0x9757('0x39')][_0x39ee2a['id']]});}else{return _0x297e1b(_0x277948[_0x9757('0x31')](0x1f4,_0x9757('0x46')));}});},'Agents':function(_0x282d59){return new Promise(function(_0x333268,_0x2746f7){var _0x19ca63=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x39')]);_0x333268({'count':_0x19ca63[_0x9757('0x1b')],'rows':_0x19ca63});});},'ChatQueues':function(_0x496bae){return new Promise(function(_0x2aa462,_0x3bc9f5){var _0x3ccb1e=[];for(var _0x628036 in _0x39fa5c[_0x9757('0x48')]){if(_0x39fa5c[_0x9757('0x48')][_0x9757('0x42')](_0x628036)){var _0x518fd7=_0x39fa5c[_0x9757('0x48')][_0x628036];var _0xf2aa31={'id':_0x518fd7['id'],'available':_0x518fd7[_0x9757('0x49')],'loggedIn':_0x518fd7['loggedIn'],'name':_0x518fd7['name'],'paused':_0x518fd7['paused'],'waiting':_0x518fd7[_0x9757('0x4a')]};_0x3ccb1e[_0x9757('0x23')](_0xf2aa31);}}_0x2aa462({'count':_0x3ccb1e[_0x9757('0x1b')],'rows':_0x3ccb1e});});},'MailQueues':function(_0x4d7d40){return new Promise(function(_0x3eb0da,_0x5d5188){var _0xca6f89=[];for(var _0x48e505 in _0x39fa5c['mailQueues']){if(_0x39fa5c[_0x9757('0x4b')][_0x9757('0x42')](_0x48e505)){var _0xaf096e=_0x39fa5c['mailQueues'][_0x48e505];var _0xc706a={'id':_0xaf096e['id'],'available':_0xaf096e[_0x9757('0x49')],'loggedIn':_0xaf096e[_0x9757('0x4c')],'name':_0xaf096e[_0x9757('0x4d')],'paused':_0xaf096e[_0x9757('0x4e')],'waiting':_0xaf096e[_0x9757('0x4a')]};_0xca6f89[_0x9757('0x23')](_0xc706a);}}_0x3eb0da({'count':_0xca6f89[_0x9757('0x1b')],'rows':_0xca6f89});});},'OpenchannelQueues':function(_0x567b05){return new Promise(function(_0x4df00e,_0x5b6c80){var _0x5e014c=[];for(var _0x40333f in _0x39fa5c[_0x9757('0x4f')]){if(_0x39fa5c[_0x9757('0x4f')][_0x9757('0x42')](_0x40333f)){var _0x4c584e=_0x39fa5c['openchannelQueues'][_0x40333f];var _0x18fede={'id':_0x4c584e['id'],'available':_0x4c584e['available'],'loggedIn':_0x4c584e[_0x9757('0x4c')],'name':_0x4c584e[_0x9757('0x4d')],'paused':_0x4c584e[_0x9757('0x4e')],'waiting':_0x4c584e[_0x9757('0x4a')]};_0x5e014c[_0x9757('0x23')](_0x18fede);}}_0x4df00e({'count':_0x5e014c[_0x9757('0x1b')],'rows':_0x5e014c});});},'SmsQueues':function(_0x2c84b2){return new Promise(function(_0x161a21,_0x1aaf50){var _0x3d9930=[];for(var _0x3a5449 in _0x39fa5c[_0x9757('0x50')]){if(_0x39fa5c[_0x9757('0x50')][_0x9757('0x42')](_0x3a5449)){var _0x5a3cce=_0x39fa5c[_0x9757('0x50')][_0x3a5449];var _0x4587e5={'id':_0x5a3cce['id'],'available':_0x5a3cce[_0x9757('0x49')],'loggedIn':_0x5a3cce[_0x9757('0x4c')],'name':_0x5a3cce[_0x9757('0x4d')],'paused':_0x5a3cce[_0x9757('0x4e')],'waiting':_0x5a3cce[_0x9757('0x4a')]};_0x3d9930['push'](_0x4587e5);}}_0x161a21({'count':_0x3d9930[_0x9757('0x1b')],'rows':_0x3d9930});});},'FaxQueues':function(_0x299cea){return new Promise(function(_0x37fe52,_0x490ec5){var _0x52980a=[];for(var _0x28c10e in _0x39fa5c['faxQueues']){if(_0x39fa5c[_0x9757('0x51')][_0x9757('0x42')](_0x28c10e)){var _0x22ff21=_0x39fa5c['faxQueues'][_0x28c10e];var _0x18a919={'id':_0x22ff21['id'],'available':_0x22ff21[_0x9757('0x49')],'loggedIn':_0x22ff21[_0x9757('0x4c')],'name':_0x22ff21[_0x9757('0x4d')],'paused':_0x22ff21[_0x9757('0x4e')],'waiting':_0x22ff21[_0x9757('0x4a')]};_0x52980a[_0x9757('0x23')](_0x18a919);}}_0x37fe52({'count':_0x52980a[_0x9757('0x1b')],'rows':_0x52980a});});},'WhatsappQueues':function(_0x179350){return new Promise(function(_0x947ac4,_0x37e31f){var _0x24ef73=[];for(var _0x53cffa in _0x39fa5c['whatsappQueues']){if(_0x39fa5c[_0x9757('0x52')][_0x9757('0x42')](_0x53cffa)){var _0x4a2655=_0x39fa5c['whatsappQueues'][_0x53cffa];var _0x2e430e={'id':_0x4a2655['id'],'available':_0x4a2655['available'],'loggedIn':_0x4a2655['loggedIn'],'name':_0x4a2655[_0x9757('0x4d')],'paused':_0x4a2655[_0x9757('0x4e')],'waiting':_0x4a2655['waiting']};_0x24ef73['push'](_0x2e430e);}}_0x947ac4({'count':_0x24ef73[_0x9757('0x1b')],'rows':_0x24ef73});});},'ChatQueuesWaitingInteractions':function(_0x1b56f5){return new Promise(function(_0x4aaaee,_0xf7d8aa){var _0x2ef3d2=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x53')]);_0x4aaaee({'count':_0x2ef3d2['length'],'rows':_0x2ef3d2});});},'MailQueuesWaitingInteractions':function(_0x2d8a7d){return new Promise(function(_0x270b8e,_0x3b024c){var _0x55ebf5=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x54')]);_0x270b8e({'count':_0x55ebf5[_0x9757('0x1b')],'rows':_0x55ebf5});});},'OpenchannelQueuesWaitingInteractions':function(_0x57845e){return new Promise(function(_0x3fe6c7,_0x19203d){var _0x3adcf7=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x55')]);_0x3fe6c7({'count':_0x3adcf7['length'],'rows':_0x3adcf7});});},'SmsQueuesWaitingInteractions':function(_0x11d268){return new Promise(function(_0x3848e7,_0x354e2b){var _0x4390b8=_[_0x9757('0x47')](_0x39fa5c[_0x9757('0x56')]);_0x3848e7({'count':_0x4390b8[_0x9757('0x1b')],'rows':_0x4390b8});});},'FaxQueuesWaitingInteractions':function(_0x5460bd){return new Promise(function(_0x5739e9,_0x310e7a){var _0x48f208=_[_0x9757('0x47')](_0x39fa5c['faxQueuesWaitingInteractions']);_0x5739e9({'count':_0x48f208[_0x9757('0x1b')],'rows':_0x48f208});});},'WhatsappQueuesWaitingInteractions':function(_0x3bf395){return new Promise(function(_0x13977c,_0x48c90b){var _0x316385=_['values'](_0x39fa5c['whatsappQueuesWaitingInteractions']);_0x13977c({'count':_0x316385[_0x9757('0x1b')],'rows':_0x316385});});}};var _0x179f48=jayson[_0x9757('0x57')](_0x3abf05)[_0x9757('0x58')]();_0x179f48['on'](_0x9757('0x31'),function(_0x1572b2){logger[_0x9757('0x31')](JSON['stringify'](_0x1572b2));return _0x224229(_0x1572b2);});_0x179f48['listen'](0x232c,_0x9757('0x59'),function(){console[_0x9757('0x5a')](_0x9757('0x5b'),0x232c);return _0x14f67c(_0x9757('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 2a9cfc7..e81e0ce 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 _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 +var _0x95a8=['then','error','message','result','condition','rules','info','stop','length','Command','format','iftime\x20%s','indexOf','true','catch','some','join','when','log','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','util','bluebird','jayson/promise','lodash','routing','client','http'];(function(_0x379435,_0x49e8b1){var _0x1084fa=function(_0x1416a8){while(--_0x1416a8){_0x379435['push'](_0x379435['shift']());}};_0x1084fa(++_0x49e8b1);}(_0x95a8,0x1b9));var _0x895a=function(_0x3b4631,_0x2d7d37){_0x3b4631=_0x3b4631-0x0;var _0x40a54f=_0x95a8[_0x3b4631];return _0x40a54f;};'use strict';var util=require(_0x895a('0x0'));var BPromise=require(_0x895a('0x1'));var jayson=require(_0x895a('0x2'));var _=require(_0x895a('0x3'));var logger=require('../../../config/logger')(_0x895a('0x4'));var client=jayson[_0x895a('0x5')][_0x895a('0x6')]({'port':0x232a});function request(_0x5ba91a,_0xf03e5){return new BPromise(function(_0xb8df06,_0x14d36a){return client['request'](_0x5ba91a,_0xf03e5)[_0x895a('0x7')](function(_0x3dff95){if(_0x3dff95['error']){return _0x14d36a(_0x3dff95[_0x895a('0x8')][_0x895a('0x9')]);}else{return _0xb8df06(_0x3dff95[_0x895a('0xa')]);}})['catch'](function(_0x129048){return _0x14d36a(_0x129048);});});}exports[_0x895a('0xb')]=function(_0x1811bd,_0x1cd60d,_0x2ccdd5){return function(_0x1aa484){if(_0x2ccdd5[_0x895a('0xc')]&&!_0x2ccdd5[_0x895a('0xc')][_0x1811bd]){logger[_0x895a('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x1811bd);return _0x1aa484[_0x895a('0xe')]();}var _0xae1e53=[];for(var _0x262708=0x0;_0x262708<_0x1cd60d[_0x895a('0xf')];_0x262708+=0x1){_0xae1e53['push'](request(_0x895a('0x10'),{'command':util[_0x895a('0x11')](_0x895a('0x12'),_0x1cd60d[_0x262708])})[_0x895a('0x7')](function(_0xa8041e){return _0xa8041e&&_0xa8041e[_0x895a('0x9')]&&_0xa8041e[_0x895a('0x9')][_0x895a('0x13')](_0x895a('0x14'))>=0x0?!![]:![];})[_0x895a('0x15')](function(_0x171192){logger['error']('[%s][INTERVAL]\x20%s',_0x1811bd,_0x1cd60d[_0x262708]);}));}BPromise['all'](_0xae1e53)['then'](function(_0x39a6cd){var _0x493ef6=_[_0x895a('0x16')](_0x39a6cd);logger[_0x895a('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0x1811bd,_0x1cd60d[_0x895a('0x17')]('\x20|\x20'),_0x493ef6);_0x1aa484[_0x895a('0x18')](_0x493ef6);})[_0x895a('0x15')](function(_0x51c7fe){console[_0x895a('0x19')](_0x51c7fe);logger['error'](_0x895a('0x1a'),_0x1811bd,_0x1cd60d[_0x895a('0x17')](_0x895a('0x1b')),_0x51c7fe['stack']);_0x1aa484['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 89ce4c7..b91f818 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 _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 +var _0x68cb=['answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','[%s][agents][blindtransfer]','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfer','ATTENDED','transfereeuniqueid','agententerreason','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','[%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','membername','interface','calleridnum','connectedlinenum','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','agentcalledAt','now','lastevent','called','connectedlinename','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','push','forIn','includes','debug','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','ringtime','answered_elsewhere','answeredelsewheredestinationuniqueid'];(function(_0x337252,_0x23c238){var _0x4507cb=function(_0x10b0b7){while(--_0x10b0b7){_0x337252['push'](_0x337252['shift']());}};_0x4507cb(++_0x23c238);}(_0x68cb,0x125));var _0xb68c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x68cb[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb68c('0x0'));var util=require(_0xb68c('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x228f74,_0x4653a3){utils[_0xb68c('0x2')](util[_0xb68c('0x3')](_0xb68c('0x4'),_0x228f74[_0xb68c('0x5')],_0x228f74[_0xb68c('0x6')],_0x228f74['queue'],_0x228f74[_0xb68c('0x7')],_0x228f74[_0xb68c('0x8')],_0x228f74[_0xb68c('0x9')],_0x228f74[_0xb68c('0xa')],_0x228f74['lastevent']));if(_0x228f74['queue']){utils['getVoiceQueueByName'](_0x228f74[_0xb68c('0xb')])['then'](function(_0x37bfca){if(_0x37bfca){_0x228f74[_0xb68c('0xc')]=_0x37bfca[_0xb68c('0xc')];_0x228f74[_0xb68c('0xd')]=_0x228f74[_0xb68c('0xe')]?_0x37bfca[_0xb68c('0xf')]:![];_0x228f74[_0xb68c('0x10')]=_0x228f74['agentacw']?_0x37bfca[_0xb68c('0x11')]:0x0;}utils['request']('CreateVoiceAgentReport',_0x228f74);});}else{utils[_0xb68c('0x12')](_0xb68c('0x13'),_0x228f74);}if(_0x4653a3){delete transfers[_0x228f74['uniqueid']];}else{delete agents[_0x228f74[_0xb68c('0x14')]];}}exports[_0xb68c('0x15')]=function(_0x55fe95){try{utils['debug'](util['format'](_0xb68c('0x16'),_0x55fe95[_0xb68c('0x5')]),_0x55fe95);agents[_0x55fe95[_0xb68c('0x14')]]=_0x55fe95;agents[_0x55fe95[_0xb68c('0x14')]][_0xb68c('0x17')]=utils[_0xb68c('0x18')]();agents[_0x55fe95[_0xb68c('0x14')]][_0xb68c('0x19')]=_0xb68c('0x1a');agents[_0x55fe95[_0xb68c('0x14')]][_0xb68c('0xa')]=null;agents[_0x55fe95[_0xb68c('0x14')]][_0xb68c('0x1b')]=null;utils[_0xb68c('0x2')](util[_0xb68c('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x55fe95['uniqueid'],agents[_0x55fe95[_0xb68c('0x14')]][_0xb68c('0x7')],_0x55fe95[_0xb68c('0x14')]));}catch(_0x45d95b){utils[_0xb68c('0x1c')](util[_0xb68c('0x3')](_0xb68c('0x16'),_0x55fe95[_0xb68c('0x5')]),_0x45d95b);}};exports[_0xb68c('0x1d')]=function(_0x43776b){try{if(!_['isNil'](agents[_0x43776b[_0xb68c('0x14')]])){utils['debug'](util[_0xb68c('0x3')](_0xb68c('0x1e'),_0x43776b['uniqueid']),_0x43776b);utils[_0xb68c('0x2')](util[_0xb68c('0x3')](_0xb68c('0x1f'),_0x43776b['uniqueid'],agents[_0x43776b[_0xb68c('0x14')]]['membername'],_0x43776b[_0xb68c('0x14')]));agents[_0x43776b['destuniqueid']]['agentringnoanswer']=!![];agents[_0x43776b[_0xb68c('0x14')]][_0xb68c('0x20')]=utils['now']();agents[_0x43776b[_0xb68c('0x14')]]['lastevent']=_0xb68c('0x21');agents[_0x43776b['destuniqueid']][_0xb68c('0x22')]=_0xb68c('0x21');agents[_0x43776b['destuniqueid']]['holdtime']=_0x43776b['ringtime']?parseInt(_0x43776b['ringtime'])/0x3e8:0x0;agents[_0x43776b[_0xb68c('0x14')]]['talktime']=0x0;unanswered[_0xb68c('0x23')](_0x43776b['destuniqueid']);}}catch(_0x392e14){utils[_0xb68c('0x1c')](util['format'](_0xb68c('0x1e'),_0x43776b[_0xb68c('0x5')]),_0x392e14);}};exports['queuecallerabandon']=function(_0x3bbfec){try{_[_0xb68c('0x24')](agents,function(_0x4a331b,_0x2d242a){if(_0x4a331b['uniqueid']==_0x3bbfec[_0xb68c('0x5')]&&!_[_0xb68c('0x25')](unanswered,_0x4a331b[_0xb68c('0x14')])){utils[_0xb68c('0x26')](util[_0xb68c('0x3')](_0xb68c('0x27'),_0x3bbfec[_0xb68c('0x5')]),_0x3bbfec);utils[_0xb68c('0x2')](util[_0xb68c('0x3')](_0xb68c('0x28'),_0x3bbfec[_0xb68c('0x5')],_0x4a331b[_0xb68c('0x7')],_0x4a331b[_0xb68c('0x14')]));_0x4a331b['agentringnoanswer']=!![];_0x4a331b['agentringnoanswerAt']=utils[_0xb68c('0x18')]();_0x4a331b['lastevent']='abandoned';_0x4a331b['reason']=_0xb68c('0x29');_0x4a331b[_0xb68c('0x2a')]=_0x3bbfec[_0xb68c('0x2a')];_0x4a331b[_0xb68c('0x2b')]=0x0;writeDB(_0x4a331b);}});}catch(_0x42d32e){utils[_0xb68c('0x1c')](util[_0xb68c('0x3')]('[%s][agents][queuecallerabandon]',_0x3bbfec[_0xb68c('0x5')]),_0x42d32e);}};exports['agentconnect']=function(_0x22c56a){try{if(agents[_0x22c56a['destuniqueid']]){utils[_0xb68c('0x26')](util[_0xb68c('0x3')]('[%s][agents][agentconnect]',_0x22c56a['uniqueid']),_0x22c56a);utils[_0xb68c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x22c56a['uniqueid'],agents[_0x22c56a[_0xb68c('0x14')]][_0xb68c('0x7')],_0x22c56a[_0xb68c('0x14')]));agents[_0x22c56a[_0xb68c('0x14')]]['agentconnectAt']=utils['now']();agents[_0x22c56a[_0xb68c('0x14')]][_0xb68c('0xa')]=_0x22c56a[_0xb68c('0xa')];agents[_0x22c56a[_0xb68c('0x14')]]['connectedlinename']=_0x22c56a['connectedlinename'];agents[_0x22c56a['destuniqueid']][_0xb68c('0x2a')]=_0x22c56a['ringtime'];agents[_0x22c56a[_0xb68c('0x14')]][_0xb68c('0x19')]='connect';_[_0xb68c('0x24')](agents,function(_0x28c6cb,_0x2eb6f3){if(_0x28c6cb[_0xb68c('0x14')]!=_0x22c56a['destuniqueid']&&_0x28c6cb[_0xb68c('0x5')]==_0x22c56a[_0xb68c('0x5')]){_0x28c6cb[_0xb68c('0x2b')]=0x0;_0x28c6cb['holdtime']=_0x22c56a[_0xb68c('0x2c')];_0x28c6cb[_0xb68c('0x1d')]=!![];_0x28c6cb['agentringnoanswerAt']=utils[_0xb68c('0x18')]();_0x28c6cb['lastevent']='answered_elsewhere';_0x28c6cb[_0xb68c('0x22')]=_0xb68c('0x2d');_0x28c6cb[_0xb68c('0x2e')]=_0x22c56a[_0xb68c('0x14')];_0x28c6cb[_0xb68c('0x2f')]=_0x22c56a[_0xb68c('0x7')];writeDB(_0x28c6cb);}});}}catch(_0x33354f){utils[_0xb68c('0x1c')](util[_0xb68c('0x3')](_0xb68c('0x30'),_0x22c56a[_0xb68c('0x5')]),_0x33354f);}};exports[_0xb68c('0xe')]=function(_0x1f91d4){try{if(!_['isNil'](agents[_0x1f91d4[_0xb68c('0x14')]])){utils[_0xb68c('0x26')](util['format'](_0xb68c('0x31'),_0x1f91d4[_0xb68c('0x5')]),_0x1f91d4);utils['info'](util['format'](_0xb68c('0x32'),_0x1f91d4[_0xb68c('0x5')],agents[_0x1f91d4['destuniqueid']][_0xb68c('0x7')],_0x1f91d4[_0xb68c('0x14')]));agents[_0x1f91d4['destuniqueid']][_0xb68c('0xe')]=!![];agents[_0x1f91d4['destuniqueid']][_0xb68c('0x33')]=utils['now']();agents[_0x1f91d4[_0xb68c('0x14')]]['talktime']=utils[_0xb68c('0x34')](agents[_0x1f91d4['destuniqueid']]['agentcompleteAt'],agents[_0x1f91d4[_0xb68c('0x14')]][_0xb68c('0x35')]);agents[_0x1f91d4[_0xb68c('0x14')]][_0xb68c('0x22')]=_0x1f91d4['reason'];agents[_0x1f91d4[_0xb68c('0x14')]][_0xb68c('0x19')]=_0xb68c('0x36');writeDB(agents[_0x1f91d4[_0xb68c('0x14')]]);}}catch(_0x50cd93){utils['error'](util[_0xb68c('0x3')]('[%s][agents][agentcomplete]',_0x1f91d4[_0xb68c('0x5')]),_0x50cd93);}};exports['blindtransfer']=function(_0x11e6d0){try{if(!_[_0xb68c('0x37')](agents[_0x11e6d0[_0xb68c('0x38')]])){utils[_0xb68c('0x26')](util[_0xb68c('0x3')]('[%s][agents][blindtransfer]',_0x11e6d0[_0xb68c('0x5')]),_0x11e6d0);utils[_0xb68c('0x2')](util[_0xb68c('0x3')](_0xb68c('0x39'),_0x11e6d0[_0xb68c('0x5')],agents[_0x11e6d0['transfereruniqueid']][_0xb68c('0x7')],agents[_0x11e6d0['transfereruniqueid']][_0xb68c('0x5')]));agents[_0x11e6d0[_0xb68c('0x38')]]['transfer']=!![];agents[_0x11e6d0['transfereruniqueid']][_0xb68c('0x3a')]=_0xb68c('0x3b');agents[_0x11e6d0[_0xb68c('0x38')]][_0xb68c('0x3c')]=_0x11e6d0[_0xb68c('0x3d')];agents[_0x11e6d0[_0xb68c('0x38')]][_0xb68c('0x3e')]=agents[_0x11e6d0[_0xb68c('0x38')]][_0xb68c('0x5')];}}catch(_0x5c62b2){utils['error'](util['format'](_0xb68c('0x3f'),_0x11e6d0[_0xb68c('0x5')]),_0x5c62b2);}};exports['attendedtransfer']=function(_0x4654a2){try{utils[_0xb68c('0x26')](util[_0xb68c('0x3')](_0xb68c('0x40'),_0x4654a2[_0xb68c('0x41')]),_0x4654a2);if(_0x4654a2[_0xb68c('0x41')]==_0x4654a2[_0xb68c('0x42')]){if(!_[_0xb68c('0x37')](agents[_0x4654a2['secondtransfereruniqueid']])){utils[_0xb68c('0x2')](util[_0xb68c('0x3')](_0xb68c('0x43'),_0x4654a2[_0xb68c('0x41')],agents[_0x4654a2[_0xb68c('0x44')]][_0xb68c('0x7')]));agents[_0x4654a2[_0xb68c('0x44')]][_0xb68c('0x45')]=!![];agents[_0x4654a2['secondtransfereruniqueid']][_0xb68c('0x3a')]=_0xb68c('0x46');agents[_0x4654a2[_0xb68c('0x44')]][_0xb68c('0x3c')]=_0x4654a2['origtransfererexten'];agents[_0x4654a2[_0xb68c('0x44')]][_0xb68c('0x3e')]=_0x4654a2['origtransfereruniqueid'];}if(_0x4654a2[_0xb68c('0x47')]&&agents[_0x4654a2[_0xb68c('0x47')]]){agents[_0x4654a2[_0xb68c('0x47')]][_0xb68c('0x48')]=0x1;transfers[_0x4654a2[_0xb68c('0x47')]]=_['clone'](agents[_0x4654a2[_0xb68c('0x47')]]);transfers[_0x4654a2['transfereeuniqueid']][_0xb68c('0x9')]=agents[_0x4654a2[_0xb68c('0x44')]][_0xb68c('0x9')];transfers[_0x4654a2[_0xb68c('0x47')]]['calleridname']=agents[_0x4654a2['secondtransfereruniqueid']][_0xb68c('0x49')];transfers[_0x4654a2[_0xb68c('0x47')]][_0xb68c('0x17')]=utils['now']();transfers[_0x4654a2[_0xb68c('0x47')]][_0xb68c('0x35')]=utils[_0xb68c('0x18')]();transfers[_0x4654a2[_0xb68c('0x47')]][_0xb68c('0x2a')]=0x0;transfers[_0x4654a2['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0x4654a2['secondtransfereruniqueid']==_0x4654a2[_0xb68c('0x4a')]){if(!_[_0xb68c('0x37')](agents[_0x4654a2['origtransfereruniqueid']])){utils[_0xb68c('0x2')](util['format'](_0xb68c('0x43'),_0x4654a2['origtransfereruniqueid'],agents[_0x4654a2[_0xb68c('0x41')]][_0xb68c('0x7')]));agents[_0x4654a2[_0xb68c('0x41')]][_0xb68c('0x45')]=!![];agents[_0x4654a2[_0xb68c('0x41')]][_0xb68c('0x3a')]=_0xb68c('0x46');agents[_0x4654a2['origtransfereruniqueid']][_0xb68c('0x3c')]=_0x4654a2[_0xb68c('0x4b')];agents[_0x4654a2[_0xb68c('0x41')]][_0xb68c('0x3e')]=_0x4654a2['secondtransfereruniqueid'];}if(_0x4654a2[_0xb68c('0x4c')]&&agents[_0x4654a2['transfertargetuniqueid']]){agents[_0x4654a2[_0xb68c('0x4c')]][_0xb68c('0x48')]=0x1;transfers[_0x4654a2[_0xb68c('0x4c')]]=_[_0xb68c('0x4d')](agents[_0x4654a2[_0xb68c('0x4c')]]);transfers[_0x4654a2[_0xb68c('0x4c')]][_0xb68c('0x9')]=agents[_0x4654a2[_0xb68c('0x41')]]['calleridnum'];transfers[_0x4654a2[_0xb68c('0x4c')]][_0xb68c('0x49')]=agents[_0x4654a2[_0xb68c('0x41')]][_0xb68c('0x49')];transfers[_0x4654a2[_0xb68c('0x4c')]]['agentcalledAt']=utils[_0xb68c('0x18')]();transfers[_0x4654a2['transfertargetuniqueid']][_0xb68c('0x35')]=utils['now']();transfers[_0x4654a2[_0xb68c('0x4c')]][_0xb68c('0x2a')]=0x0;transfers[_0x4654a2['transfertargetuniqueid']][_0xb68c('0x48')]=0x2;}}}catch(_0xaf51c){utils[_0xb68c('0x1c')](util[_0xb68c('0x3')](_0xb68c('0x40'),_0x4654a2[_0xb68c('0x41')]),_0xaf51c);}};exports['hangup']=function(_0x24d71c){try{utils[_0xb68c('0x26')](util[_0xb68c('0x3')](_0xb68c('0x4e'),_0x24d71c[_0xb68c('0x5')]),_0x24d71c);if(agents[_0x24d71c[_0xb68c('0x5')]]&&agents[_0x24d71c['uniqueid']]['reason']==='timeout'){if(_0x24d71c[_0xb68c('0x4f')]==='21'){agents[_0x24d71c[_0xb68c('0x5')]]['reason']=_0xb68c('0x50');agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x19')]=_0xb68c('0x50');}utils[_0xb68c('0x2')](util[_0xb68c('0x3')](_0xb68c('0x51'),_0x24d71c[_0xb68c('0x5')],agents[_0x24d71c['uniqueid']][_0xb68c('0x7')],agents[_0x24d71c['uniqueid']][_0xb68c('0x22')],agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x19')]));writeDB(agents[_0x24d71c[_0xb68c('0x5')]]);var _0x1c32ec=unanswered[_0xb68c('0x52')](_0x24d71c['uniqueid']);if(_0x1c32ec>-0x1){unanswered[_0xb68c('0x53')](_0x1c32ec,0x1);}}if(transfers[_0x24d71c['uniqueid']]){transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0xe')]=!![];transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x33')]=utils['now']();transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x2b')]=utils[_0xb68c('0x34')](transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x33')],transfers[_0x24d71c[_0xb68c('0x5')]]['agentconnectAt']);transfers[_0x24d71c[_0xb68c('0x5')]]['reason']=_0xb68c('0x54');transfers[_0x24d71c['uniqueid']][_0xb68c('0x19')]=_0xb68c('0x36');utils['info'](util[_0xb68c('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x24d71c['uniqueid'],transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x7')],transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x22')],transfers[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x19')]));writeDB(transfers[_0x24d71c[_0xb68c('0x5')]],!![]);}if(agents[_0x24d71c[_0xb68c('0x5')]]&&agents[_0x24d71c[_0xb68c('0x5')]]['agentconnectAt']){agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0xe')]=!![];agents[_0x24d71c[_0xb68c('0x5')]]['agentcompleteAt']=utils[_0xb68c('0x18')]();agents[_0x24d71c['uniqueid']]['talktime']=utils[_0xb68c('0x34')](agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x33')],agents[_0x24d71c['uniqueid']]['agentconnectAt']);agents[_0x24d71c['uniqueid']]['reason']=agents[_0x24d71c['uniqueid']][_0xb68c('0x45')]?_0xb68c('0x45'):_0xb68c('0x54');agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x19')]=_0xb68c('0x36');utils[_0xb68c('0x2')](util['format'](_0xb68c('0x51'),_0x24d71c[_0xb68c('0x5')],agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x7')],agents[_0x24d71c[_0xb68c('0x5')]]['reason'],agents[_0x24d71c[_0xb68c('0x5')]][_0xb68c('0x19')]));writeDB(agents[_0x24d71c['uniqueid']]);}}catch(_0x38fece){utils[_0xb68c('0x1c')](util[_0xb68c('0x3')](_0xb68c('0x4e'),_0x24d71c[_0xb68c('0x5')]),_0x38fece);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 627ccd6..a76e2f3 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 _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 +var _0x5f13=['[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','lastapplication','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lastdata','[%s][calls][newexten]','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','CreateVoiceCallReport','request','debug','format','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','calleridnum','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','context','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','channelstate','hangup','[%s][calls][hangup]','callerid','calleridname','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum'];(function(_0x4be663,_0x5c3cd7){var _0xaf1b39=function(_0x12ba01){while(--_0x12ba01){_0x4be663['push'](_0x4be663['shift']());}};_0xaf1b39(++_0x5c3cd7);}(_0x5f13,0x1c7));var _0x35f1=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x5f13[_0x5e3b04];return _0x1fc44d;};'use strict';var _=require(_0x35f1('0x0'));var util=require('util');var utils=require(_0x35f1('0x1'));var dispositions=[_0x35f1('0x2'),_0x35f1('0x3'),_0x35f1('0x3'),'NO\x20ANSWER',_0x35f1('0x2'),_0x35f1('0x2'),_0x35f1('0x4'),_0x35f1('0x5'),'FAILED',_0x35f1('0x3'),_0x35f1('0x3')];var channels={};function writeDB(_0x8a862c){utils[_0x35f1('0x6')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x8a862c[_0x35f1('0x7')],_0x8a862c[_0x35f1('0x8')],_0x8a862c[_0x35f1('0x9')],_0x8a862c[_0x35f1('0xa')],_0x8a862c[_0x35f1('0xb')],_0x8a862c['calleridnum'],_0x8a862c[_0x35f1('0xc')],_0x8a862c[_0x35f1('0xd')]));if(_0x8a862c[_0x35f1('0xe')]){utils[_0x35f1('0xf')](_0x8a862c[_0x35f1('0xe')])[_0x35f1('0x10')](function(_0x46a880){if(_0x46a880){_0x8a862c['UserId']=_0x46a880['id'];}utils['request'](_0x35f1('0x11'),_0x8a862c);});}else{utils[_0x35f1('0x12')](_0x35f1('0x11'),_0x8a862c);}if(channels[_0x8a862c[_0x35f1('0x7')]]){delete channels[_0x8a862c[_0x35f1('0x7')]];}}exports['newchannel']=function(_0x2786a8){try{utils[_0x35f1('0x13')](util[_0x35f1('0x14')](_0x35f1('0x15'),_0x2786a8['uniqueid']),_0x2786a8);if(_0x2786a8[_0x35f1('0x7')]==_0x2786a8['linkedid']&&_0x2786a8[_0x35f1('0x8')]!=_0x35f1('0x16')){utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x17'),_0x2786a8[_0x35f1('0x7')],_0x2786a8['context'],_0x2786a8[_0x35f1('0x18')]));channels[_0x2786a8['uniqueid']]={'uniqueid':_0x2786a8[_0x35f1('0x7')],'accountcode':_0x2786a8['accountcode'],'source':_0x2786a8[_0x35f1('0x19')],'destination':_0x2786a8[_0x35f1('0x18')],'destinationcontext':_0x2786a8['context'],'channel':_0x2786a8[_0x35f1('0x8')],'starttime':utils[_0x35f1('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x35f1('0x1b')};}}catch(_0x13d43b){utils[_0x35f1('0x1c')](util[_0x35f1('0x14')]('[%s][calls][newchannel]',_0x2786a8[_0x35f1('0x7')]),_0x13d43b);}};exports[_0x35f1('0x1d')]=function(_0x3aef17){try{utils[_0x35f1('0x13')](util['format'](_0x35f1('0x1e'),_0x3aef17[_0x35f1('0x7')]),_0x3aef17);if(!_[_0x35f1('0x1f')](channels[_0x3aef17[_0x35f1('0x7')]])&&_0x3aef17['channelstate']==0x6){utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x20'),_0x3aef17[_0x35f1('0x7')],_0x3aef17['context'],_0x3aef17[_0x35f1('0x8')]));if(_[_0x35f1('0x1f')](channels[_0x3aef17['uniqueid']][_0x35f1('0x21')])){channels[_0x3aef17[_0x35f1('0x7')]][_0x35f1('0x21')]=utils[_0x35f1('0x1a')]();}}else if(!_[_0x35f1('0x1f')](channels[_0x3aef17[_0x35f1('0x22')]])&&_0x3aef17['channelstate']==0x6&&_0x3aef17[_0x35f1('0x23')]!='transfer'){utils['info'](util['format'](_0x35f1('0x24'),_0x3aef17[_0x35f1('0x7')],_0x3aef17[_0x35f1('0x22')],_0x3aef17['context'],_0x3aef17[_0x35f1('0x8')]));channels[_0x3aef17['linkedid']][_0x35f1('0xe')]=_0x3aef17[_0x35f1('0xe')];channels[_0x3aef17[_0x35f1('0x22')]][_0x35f1('0x25')]=_0x3aef17[_0x35f1('0x8')];if(_[_0x35f1('0x1f')](channels[_0x3aef17['linkedid']][_0x35f1('0x26')])){channels[_0x3aef17[_0x35f1('0x22')]][_0x35f1('0x26')]=utils[_0x35f1('0x1a')]();}channels[_0x3aef17[_0x35f1('0x22')]][_0x35f1('0x27')]=dispositions[_[_0x35f1('0x28')](_0x3aef17[_0x35f1('0x29')])]||'ANSWERED';}}catch(_0x38f386){utils['error'](util[_0x35f1('0x14')](_0x35f1('0x1e'),_0x3aef17[_0x35f1('0x7')]),_0x38f386);}};exports[_0x35f1('0x2a')]=function(_0x3ad80b){try{if(!_['isNil'](channels[_0x3ad80b[_0x35f1('0x7')]])){utils[_0x35f1('0x13')](util[_0x35f1('0x14')](_0x35f1('0x2b'),_0x3ad80b[_0x35f1('0x7')]),_0x3ad80b);if(_['isNil'](channels[_0x3ad80b['uniqueid']][_0x35f1('0x2c')])){channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x2c')]=_0x3ad80b[_0x35f1('0x2d')]+'\x20<'+_0x3ad80b[_0x35f1('0x19')]+'>';}utils[_0x35f1('0x6')](util[_0x35f1('0x14')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3ad80b[_0x35f1('0x7')],channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x2c')],_0x3ad80b['cause-txt']));channels[_0x3ad80b['uniqueid']][_0x35f1('0x2e')]=utils[_0x35f1('0x1a')]();channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x2f')]=utils[_0x35f1('0x30')](channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x2e')],channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x31')]);channels[_0x3ad80b['uniqueid']][_0x35f1('0x32')]=channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x26')]?utils['diffTime'](channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x2e')],channels[_0x3ad80b[_0x35f1('0x7')]][_0x35f1('0x26')]):0x0;writeDB(channels[_0x3ad80b[_0x35f1('0x7')]]);}}catch(_0x4d52be){utils['error'](util['format']('[%s][calls][hangup]',_0x3ad80b['uniqueid']),_0x4d52be);}};exports[_0x35f1('0x33')]=function(_0x19dada){try{if(!_['isNil'](channels[_0x19dada[_0x35f1('0x34')]])){utils[_0x35f1('0x13')](util[_0x35f1('0x14')](_0x35f1('0x35'),_0x19dada[_0x35f1('0x36')]),_0x19dada);if(channels[_0x19dada[_0x35f1('0x34')]][_0x35f1('0x8')]==_0x19dada['transfereechannel']){utils[_0x35f1('0x6')](util['format'](_0x35f1('0x37'),_0x19dada[_0x35f1('0x36')],_0x19dada[_0x35f1('0x34')],_0x19dada[_0x35f1('0x38')]));channels[_0x19dada[_0x35f1('0x34')]][_0x35f1('0x25')]=_0x19dada[_0x35f1('0x38')];channels[_0x19dada[_0x35f1('0x34')]][_0x35f1('0x39')]=_0x35f1('0x3a');}else if(channels[_0x19dada['localtwolinkedid']][_0x35f1('0x8')]=_0x19dada[_0x35f1('0x3b')]){utils[_0x35f1('0x6')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x19dada[_0x35f1('0x36')],_0x19dada['localtwolinkedid'],_0x19dada[_0x35f1('0x3c')]));channels[_0x19dada[_0x35f1('0x34')]][_0x35f1('0x25')]=_0x19dada[_0x35f1('0x3c')];channels[_0x19dada[_0x35f1('0x34')]][_0x35f1('0x39')]=_0x35f1('0x3a');}}}catch(_0x2d73c0){utils[_0x35f1('0x1c')](util[_0x35f1('0x14')](_0x35f1('0x35'),_0x19dada[_0x35f1('0x36')]),_0x2d73c0);}};exports['musiconholdstart']=function(_0x4df772){try{if(!_[_0x35f1('0x1f')](channels[_0x4df772[_0x35f1('0x7')]])){utils['debug'](util[_0x35f1('0x14')](_0x35f1('0x3d'),_0x4df772[_0x35f1('0x7')]),_0x4df772);channels[_0x4df772[_0x35f1('0x7')]][_0x35f1('0x3e')]=utils[_0x35f1('0x1a')]();utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x3f'),_0x4df772[_0x35f1('0x7')],channels[_0x4df772[_0x35f1('0x7')]]['musiconholdstartAt']));}}catch(_0x5a5502){utils[_0x35f1('0x1c')](util[_0x35f1('0x14')]('[%s][calls][musiconholdstart]',_0x4df772[_0x35f1('0x7')]),_0x5a5502);}};exports[_0x35f1('0x40')]=function(_0x259bca){try{if(!_[_0x35f1('0x1f')](channels[_0x259bca[_0x35f1('0x7')]])){utils[_0x35f1('0x13')](util[_0x35f1('0x14')](_0x35f1('0x41'),_0x259bca[_0x35f1('0x7')]),_0x259bca);if(!_[_0x35f1('0x1f')](channels[_0x259bca['uniqueid']]['musiconholdstartAt'])){channels[_0x259bca['uniqueid']][_0x35f1('0x42')]+=utils[_0x35f1('0x30')](utils[_0x35f1('0x1a')](),channels[_0x259bca[_0x35f1('0x7')]][_0x35f1('0x3e')]);utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x43'),_0x259bca[_0x35f1('0x7')],channels[_0x259bca[_0x35f1('0x7')]]['mohtime']));delete channels[_0x259bca[_0x35f1('0x7')]][_0x35f1('0x3e')];}}}catch(_0x49d05f){utils[_0x35f1('0x1c')](util[_0x35f1('0x14')](_0x35f1('0x41'),_0x259bca['uniqueid']),_0x49d05f);}};exports[_0x35f1('0x44')]=function(_0x33646d){try{if(!_[_0x35f1('0x1f')](channels[_0x33646d['uniqueid']])){utils['debug'](util[_0x35f1('0x14')]('[%s][calls][varset]',_0x33646d['uniqueid']),_0x33646d);if(!_['isNil'](_0x33646d['variable'][_0x35f1('0x45')])){utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x46'),_0x33646d[_0x35f1('0x7')],_0x33646d[_0x35f1('0x47')]));channels[_0x33646d[_0x35f1('0x7')]]['source']=_0x33646d[_0x35f1('0x47')];}if(!_[_0x35f1('0x1f')](_0x33646d[_0x35f1('0x48')]['xmd-phone'])){utils[_0x35f1('0x6')](util['format'](_0x35f1('0x49'),_0x33646d[_0x35f1('0x7')],_0x33646d[_0x35f1('0x47')]));channels[_0x33646d[_0x35f1('0x7')]]['destination']=_0x33646d[_0x35f1('0x47')];channels[_0x33646d[_0x35f1('0x7')]][_0x35f1('0x2c')]='\x22'+_0x33646d[_0x35f1('0x47')]+_0x35f1('0x4a')+_0x33646d[_0x35f1('0x47')]+'>';}if(!_['isNil'](_0x33646d[_0x35f1('0x48')]['xmd-callerid-preview'])||!_[_0x35f1('0x1f')](_0x33646d[_0x35f1('0x48')][_0x35f1('0x4b')])){utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x4c'),_0x33646d[_0x35f1('0x7')],!_[_0x35f1('0x1f')](_0x33646d[_0x35f1('0x48')]['xmd-callerid-preview'])?_0x35f1('0x4d'):_0x35f1('0x4b'),_0x33646d['value']));channels[_0x33646d[_0x35f1('0x7')]][_0x35f1('0x2c')]=_0x33646d[_0x35f1('0x47')];}if(!_[_0x35f1('0x1f')](_0x33646d[_0x35f1('0x48')]['xmd-queue'])||!_[_0x35f1('0x1f')](_0x33646d['variable'][_0x35f1('0x4e')])){utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x4c'),_0x33646d[_0x35f1('0x7')],!_[_0x35f1('0x1f')](_0x33646d['variable'][_0x35f1('0x4f')])?_0x35f1('0x4f'):_0x35f1('0x4e'),_0x33646d[_0x35f1('0x47')]));channels[_0x33646d[_0x35f1('0x7')]][_0x35f1('0x50')]='Queue';channels[_0x33646d[_0x35f1('0x7')]]['lastdata']=_0x33646d[_0x35f1('0x47')];channels[_0x33646d['uniqueid']]['queue']=!![];}if(!_[_0x35f1('0x1f')](_0x33646d[_0x35f1('0x48')][_0x35f1('0x51')])){utils[_0x35f1('0x6')](util['format'](_0x35f1('0x52'),_0x33646d[_0x35f1('0x7')],_0x33646d[_0x35f1('0x47')]));channels[_0x33646d[_0x35f1('0x7')]]['ContactId']=_0x33646d[_0x35f1('0x47')];}if(!_[_0x35f1('0x1f')](_0x33646d['variable']['xmd-cdrtype'])){utils[_0x35f1('0x6')](util[_0x35f1('0x14')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x33646d[_0x35f1('0x7')],_0x33646d['value']));channels[_0x33646d[_0x35f1('0x7')]][_0x35f1('0x53')]=_0x33646d['value'];}if(!_[_0x35f1('0x1f')](_0x33646d[_0x35f1('0x48')][_0x35f1('0x54')])){utils['info'](util[_0x35f1('0x14')](_0x35f1('0x55'),_0x33646d[_0x35f1('0x7')],_0x33646d[_0x35f1('0x47')]));channels[_0x33646d[_0x35f1('0x7')]][_0x35f1('0x56')]=_0x33646d[_0x35f1('0x47')];}if(!_[_0x35f1('0x1f')](_0x33646d['variable']['sipcallid'])){utils[_0x35f1('0x6')](util[_0x35f1('0x14')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x33646d[_0x35f1('0x7')],_0x33646d[_0x35f1('0x47')]));channels[_0x33646d[_0x35f1('0x7')]]['sipcallid']=_0x33646d[_0x35f1('0x47')];}}}catch(_0xac92dc){utils[_0x35f1('0x1c')](util['format'](_0x35f1('0x57'),_0x33646d[_0x35f1('0x7')]),_0xac92dc);}};exports[_0x35f1('0x58')]=function(_0x4ae963){try{if(!_['isNil'](channels[_0x4ae963['uniqueid']])){utils[_0x35f1('0x13')](util[_0x35f1('0x14')]('[%s][calls][newexten]',_0x4ae963[_0x35f1('0x7')]),_0x4ae963);utils[_0x35f1('0x6')](util[_0x35f1('0x14')](_0x35f1('0x59'),_0x4ae963[_0x35f1('0x7')],_0x4ae963[_0x35f1('0x5a')],_0x4ae963[_0x35f1('0x5b')]));if(_0x4ae963[_0x35f1('0x5a')][_0x35f1('0x5c')]()==_0x35f1('0x5d')&&_[_0x35f1('0x5e')](_0x4ae963[_0x35f1('0x5b')][_0x35f1('0x5c')](),_0x35f1('0x5f'))){var _0x57630f=_0x4ae963[_0x35f1('0x5b')][_0x35f1('0x60')]('=');var _0x114ee6=_0x57630f[0x0][_0x35f1('0x61')](_0x57630f[0x0][_0x35f1('0x62')]('(')+0x1,_0x57630f[0x0][_0x35f1('0x62')](')'));var _0x39ef04=_0x57630f[0x1];channels[_0x4ae963['uniqueid']][_0x114ee6]=_0x39ef04;}if(!_[_0x35f1('0x63')]([_0x35f1('0x2a'),_0x35f1('0x64'),_0x35f1('0x65'),_0x35f1('0x5d'),_0x35f1('0x66')],_0x4ae963[_0x35f1('0x5a')][_0x35f1('0x5c')]())){channels[_0x4ae963[_0x35f1('0x7')]]['lastapplication']=_0x4ae963['application'];channels[_0x4ae963[_0x35f1('0x7')]][_0x35f1('0x67')]=_0x4ae963[_0x35f1('0x5b')];}}}catch(_0x4b11aa){utils[_0x35f1('0x1c')](util[_0x35f1('0x14')](_0x35f1('0x68'),_0x4ae963[_0x35f1('0x7')]),_0x4b11aa);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 4ca245b..f67029e 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 _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 +var _0x230b=['error','[core]\x20error','close','managerevent','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x5dffc0,_0x38a88d){var _0x2b47ef=function(_0x51626c){while(--_0x51626c){_0x5dffc0['push'](_0x5dffc0['shift']());}};_0x2b47ef(++_0x38a88d);}(_0x230b,0x1c7));var _0xb230=function(_0x4c9c77,_0x2f0d88){_0x4c9c77=_0x4c9c77-0x0;var _0x57a30c=_0x230b[_0x4c9c77];return _0x57a30c;};'use strict';var utils=require('./utils');exports[_0xb230('0x0')]=function(){utils[_0xb230('0x1')](_0xb230('0x2'));};exports[_0xb230('0x3')]=function(){utils[_0xb230('0x1')](_0xb230('0x4'));};exports[_0xb230('0x5')]=function(){utils['info'](_0xb230('0x6'));};exports[_0xb230('0x7')]=function(_0x42b663){utils[_0xb230('0x7')](_0xb230('0x8'),_0x42b663);};exports[_0xb230('0x9')]=function(){utils[_0xb230('0x1')]('[core]\x20close');};exports[_0xb230('0xa')]=function(_0x33a45c){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0021855..60e1037 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 _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 +var _0x4600=['[%s][dials][newexten]','varset','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','[%s][dials][dialend]\x20dialstatus:%s','dialstatus','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','endtime','diffTime','[%s][dials][hangup]','lodash','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','calleridnum','connectedlinenum','newexten','debug','format','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error'];(function(_0x3ceff6,_0xcd9a9a){var _0x3894df=function(_0x160f38){while(--_0x160f38){_0x3ceff6['push'](_0x3ceff6['shift']());}};_0x3894df(++_0xcd9a9a);}(_0x4600,0xc0));var _0x0460=function(_0xcda2bd,_0x3468e4){_0xcda2bd=_0xcda2bd-0x0;var _0x22231c=_0x4600[_0xcda2bd];return _0x22231c;};'use strict';var _=require(_0x0460('0x0'));var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x5016c3){utils[_0x0460('0x1')](util['format'](_0x0460('0x2'),_0x5016c3[_0x0460('0x3')],_0x5016c3[_0x0460('0x4')],_0x5016c3['dialstring'],_0x5016c3[_0x0460('0x5')],_0x5016c3[_0x0460('0x6')],_0x5016c3['dialstatus']));utils['request']('CreateVoiceDialReport',_0x5016c3);delete dials[_0x5016c3[_0x0460('0x3')]];}exports[_0x0460('0x7')]=function(_0x1664f5){try{utils[_0x0460('0x8')](util[_0x0460('0x9')]('[%s][dials][newexten]',_0x1664f5[_0x0460('0x3')]),_0x1664f5);utils[_0x0460('0x1')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x1664f5[_0x0460('0x3')],_0x1664f5[_0x0460('0xa')],_0x1664f5[_0x0460('0xb')]));if(_0x1664f5[_0x0460('0xa')][_0x0460('0xc')]()==_0x0460('0xd')&&_[_0x0460('0xe')](_0x1664f5[_0x0460('0xb')][_0x0460('0xc')](),_0x0460('0xf'))){var _0x4227ea=_0x1664f5[_0x0460('0xb')][_0x0460('0x10')]('=');dials[_0x1664f5[_0x0460('0x3')]]={'routeId':_0x4227ea[0x1]};}}catch(_0x1ffc20){utils[_0x0460('0x11')](util['format'](_0x0460('0x12'),_0x1664f5[_0x0460('0x3')]),_0x1ffc20);}};exports[_0x0460('0x13')]=function(_0x2a0ec4){try{utils[_0x0460('0x8')](util[_0x0460('0x9')]('[%s][dials][varset]',_0x2a0ec4['uniqueid']),_0x2a0ec4);if(!_['isNil'](_0x2a0ec4[_0x0460('0x14')]['outboundrouteid'])){utils[_0x0460('0x1')](util[_0x0460('0x9')](_0x0460('0x15'),_0x2a0ec4['uniqueid'],_0x2a0ec4[_0x0460('0x16')]));dials[_0x2a0ec4[_0x0460('0x3')]]={'routeId':_0x2a0ec4[_0x0460('0x16')]};}}catch(_0x124fd4){utils[_0x0460('0x11')](util[_0x0460('0x9')]('[%s][dials][varset]',_0x2a0ec4[_0x0460('0x3')]),_0x124fd4);}};exports['dialbegin']=function(_0xcb8e9c){try{if(!_[_0x0460('0x17')](dials[_0xcb8e9c[_0x0460('0x3')]])){utils[_0x0460('0x8')](util[_0x0460('0x9')](_0x0460('0x18'),_0xcb8e9c[_0x0460('0x3')]),_0xcb8e9c);dials[_0xcb8e9c['uniqueid']]=_[_0x0460('0x19')](dials[_0xcb8e9c['uniqueid']],_0xcb8e9c);dials[_0xcb8e9c[_0x0460('0x3')]][_0x0460('0x1a')]=utils[_0x0460('0x1b')]();dials[_0xcb8e9c[_0x0460('0x3')]][_0x0460('0x1c')]=_0x0460('0x1d');utils[_0x0460('0x1')](util[_0x0460('0x9')](_0x0460('0x1e'),_0xcb8e9c[_0x0460('0x3')],dials[_0xcb8e9c[_0x0460('0x3')]][_0x0460('0x1a')]));}}catch(_0x266bab){utils[_0x0460('0x11')](util[_0x0460('0x9')](_0x0460('0x18'),_0xcb8e9c['uniqueid']),_0x266bab);}};exports[_0x0460('0x1f')]=function(_0x2ccab3){try{if(!_['isNil'](dials[_0x2ccab3[_0x0460('0x3')]])){utils[_0x0460('0x8')](util[_0x0460('0x9')](_0x0460('0x20'),_0x2ccab3[_0x0460('0x3')]),_0x2ccab3);dials[_0x2ccab3[_0x0460('0x3')]]['dialstatus']=_0x2ccab3['dialstatus'];if(_0x2ccab3['dialstatus']=='ANSWER'){dials[_0x2ccab3[_0x0460('0x3')]]=_[_0x0460('0x19')](dials[_0x2ccab3[_0x0460('0x3')]],_0x2ccab3);dials[_0x2ccab3[_0x0460('0x3')]][_0x0460('0x21')]=utils[_0x0460('0x1b')]();dials[_0x2ccab3['uniqueid']][_0x0460('0x1c')]='connect';utils[_0x0460('0x1')](util[_0x0460('0x9')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x2ccab3['uniqueid'],_0x2ccab3['dialstatus'],dials[_0x2ccab3[_0x0460('0x3')]][_0x0460('0x21')]));}else{utils['info'](util[_0x0460('0x9')](_0x0460('0x22'),_0x2ccab3[_0x0460('0x3')],_0x2ccab3[_0x0460('0x23')]));}}}catch(_0x107537){utils[_0x0460('0x11')](util[_0x0460('0x9')](_0x0460('0x20'),_0x2ccab3[_0x0460('0x3')]),_0x107537);}};exports['hangup']=function(_0x59bf7d){try{if(!_['isNil'](dials[_0x59bf7d[_0x0460('0x3')]])){utils[_0x0460('0x8')](util[_0x0460('0x9')]('[%s][dials][hangup]',_0x59bf7d['uniqueid']),_0x59bf7d);utils[_0x0460('0x1')](util[_0x0460('0x9')](_0x0460('0x24'),_0x59bf7d[_0x0460('0x3')],_0x59bf7d[_0x0460('0x5')],_0x59bf7d[_0x0460('0x25')],_0x59bf7d['cause-txt']));dials[_0x59bf7d[_0x0460('0x3')]]=_['assign'](dials[_0x59bf7d[_0x0460('0x3')]],{'endtime':utils['now'](),'lastevent':'complete'});dials[_0x59bf7d[_0x0460('0x3')]][_0x0460('0x26')]=utils['diffTime'](dials[_0x59bf7d['uniqueid']][_0x0460('0x27')],dials[_0x59bf7d[_0x0460('0x3')]]['starttime']);dials[_0x59bf7d[_0x0460('0x3')]]['holdtime']=utils[_0x0460('0x28')](dials[_0x59bf7d[_0x0460('0x3')]][_0x0460('0x21')]||dials[_0x59bf7d[_0x0460('0x3')]][_0x0460('0x27')],dials[_0x59bf7d[_0x0460('0x3')]]['starttime']);dials[_0x59bf7d[_0x0460('0x3')]]['billableseconds']=dials[_0x59bf7d[_0x0460('0x3')]]['answertime']?utils[_0x0460('0x28')](dials[_0x59bf7d[_0x0460('0x3')]][_0x0460('0x27')],dials[_0x59bf7d['uniqueid']][_0x0460('0x21')]):0x0;writeDB(dials[_0x59bf7d['uniqueid']]);}}catch(_0x2d3e99){utils[_0x0460('0x11')](util[_0x0460('0x9')](_0x0460('0x29'),_0x59bf7d['uniqueid']),_0x2d3e99);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 485a689..fd27b52 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 _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 +var _0x6cf8=['uniqueid','agentconnect','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','./utils','util','asterisk','port','username','password','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]'];(function(_0x36af48,_0x294a80){var _0x12da23=function(_0x27afc4){while(--_0x27afc4){_0x36af48['push'](_0x36af48['shift']());}};_0x12da23(++_0x294a80);}(_0x6cf8,0x1f1));var _0x86cf=function(_0xb70dbf,_0x53a19d){_0xb70dbf=_0xb70dbf-0x0;var _0x1af15e=_0x6cf8[_0xb70dbf];return _0x1af15e;};var AsteriskManager=require(_0x86cf('0x0'));var config=require('../../config/environment');var utils=require(_0x86cf('0x1'));var util=require(_0x86cf('0x2'));var ami=new AsteriskManager(config[_0x86cf('0x3')][_0x86cf('0x4')],config[_0x86cf('0x3')]['ip'],config[_0x86cf('0x3')][_0x86cf('0x5')],config['asterisk'][_0x86cf('0x6')],!![]);ami['keepConnected']();if(config[_0x86cf('0x7')]&&config[_0x86cf('0x7')][_0x86cf('0x8')]){utils['info'](_0x86cf('0x9'));}else{var agents=require(_0x86cf('0xa'));var calls=require(_0x86cf('0xb'));var queues=require(_0x86cf('0xc'));var recordings=require(_0x86cf('0xd'));var members=require(_0x86cf('0xe'));var dials=require(_0x86cf('0xf'));var transfers=require(_0x86cf('0x10'));var core=require(_0x86cf('0x11'));ami['on'](_0x86cf('0x12'),core[_0x86cf('0x12')]);ami['on'](_0x86cf('0x13'),core['shutdown']);ami['on'](_0x86cf('0x14'),core[_0x86cf('0x14')]);ami['on'](_0x86cf('0x15'),core[_0x86cf('0x15')]);ami['on'](_0x86cf('0x16'),core['close']);ami['on'](_0x86cf('0x17'),core[_0x86cf('0x17')]);ami['on'](_0x86cf('0x18'),function(_0x2407b9){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')]('[%s][index][devicestatechange]',_0x2407b9[_0x86cf('0x1b')]),_0x2407b9);members['devicestatechange'](_0x2407b9);}catch(_0x522004){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')]('[%s][index][devicestatechange]',_0x2407b9[_0x86cf('0x1b')]),_0x522004);}});ami['on'](_0x86cf('0x1c'),function(_0x8b2ad5){try{utils[_0x86cf('0x19')](util['format']('[%s][index][agentcalled]',_0x8b2ad5['uniqueid']),_0x8b2ad5);agents[_0x86cf('0x1c')](_0x8b2ad5);}catch(_0x407874){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')]('[%s][index][agentcalled]',_0x8b2ad5['uniqueid']),_0x407874);}});ami['on'](_0x86cf('0x1d'),function(_0x2b6010){try{utils['debug'](util[_0x86cf('0x1a')](_0x86cf('0x1e'),_0x2b6010['uniqueid']),_0x2b6010);agents['agentringnoanswer'](_0x2b6010);}catch(_0x2fd6e9){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')]('[%s][index][agentringnoanswer]',_0x2b6010[_0x86cf('0x1f')]),_0x2fd6e9);}});ami['on'](_0x86cf('0x20'),function(_0x5b1a24){try{utils['debug'](util[_0x86cf('0x1a')]('[%s][index][agentconnect]',_0x5b1a24[_0x86cf('0x1f')]),_0x5b1a24);agents[_0x86cf('0x20')](_0x5b1a24);queues['agentconnect'](_0x5b1a24);}catch(_0x11c112){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')]('[%s][index][agentconnect]',_0x5b1a24['uniqueid']),_0x11c112);}});ami['on']('agentcomplete',function(_0x13bb37){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x21'),_0x13bb37[_0x86cf('0x1f')]),_0x13bb37);agents[_0x86cf('0x22')](_0x13bb37);queues['agentcomplete'](_0x13bb37);members[_0x86cf('0x22')](_0x13bb37);}catch(_0x1b6b3e){utils[_0x86cf('0x15')](util['format'](_0x86cf('0x21'),_0x13bb37[_0x86cf('0x1f')]),_0x1b6b3e);}});ami['on']('queuecallerabandon',function(_0x3ac4aa){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x23'),_0x3ac4aa[_0x86cf('0x1f')]),_0x3ac4aa);agents['queuecallerabandon'](_0x3ac4aa);queues[_0x86cf('0x24')](_0x3ac4aa);}catch(_0x9cd04f){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x23'),_0x3ac4aa[_0x86cf('0x1f')]),_0x9cd04f);}});ami['on']('queuecallerjoin',function(_0x4645db){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x25'),_0x4645db[_0x86cf('0x1f')]),_0x4645db);queues[_0x86cf('0x26')](_0x4645db);recordings['queuecallerjoin'](_0x4645db);}catch(_0x330c20){utils['error'](util['format'](_0x86cf('0x25'),_0x4645db['uniqueid']),_0x330c20);}});ami['on'](_0x86cf('0x27'),function(_0x222aa9){try{utils['debug'](util[_0x86cf('0x1a')](_0x86cf('0x28'),_0x222aa9[_0x86cf('0x1f')]),_0x222aa9);queues[_0x86cf('0x27')](_0x222aa9);}catch(_0x2011d1){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x28'),_0x222aa9[_0x86cf('0x1f')]),_0x2011d1);}});ami['on'](_0x86cf('0x29'),function(_0x501137){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x2a'),_0x501137[_0x86cf('0x1f')]),_0x501137);queues[_0x86cf('0x29')](_0x501137);calls[_0x86cf('0x29')](_0x501137);}catch(_0x393e1e){utils[_0x86cf('0x15')](util['format']('[%s][index][musiconholdstart]',_0x501137[_0x86cf('0x1f')]),_0x393e1e);}});ami['on'](_0x86cf('0x2b'),function(_0x32dfc6){try{utils['debug'](util[_0x86cf('0x1a')]('[%s][index][musiconholdstop]',_0x32dfc6['uniqueid']),_0x32dfc6);queues[_0x86cf('0x2b')](_0x32dfc6);calls[_0x86cf('0x2b')](_0x32dfc6);}catch(_0x25c97c){utils['error'](util[_0x86cf('0x1a')](_0x86cf('0x2c'),_0x32dfc6[_0x86cf('0x1f')]),_0x25c97c);}});ami['on']('newstate',function(_0x1c414a){try{utils['debug'](util[_0x86cf('0x1a')](_0x86cf('0x2d'),_0x1c414a[_0x86cf('0x1f')]),_0x1c414a);calls[_0x86cf('0x2e')](_0x1c414a);recordings['newstate'](_0x1c414a);}catch(_0xf25627){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x2d'),_0x1c414a['uniqueid']),_0xf25627);}});ami['on'](_0x86cf('0x2f'),function(_0x39bda9){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x30'),_0x39bda9['uniqueid']),_0x39bda9);calls[_0x86cf('0x2f')](_0x39bda9);recordings['hangup'](_0x39bda9);dials[_0x86cf('0x2f')](_0x39bda9);agents[_0x86cf('0x2f')](_0x39bda9);queues['hangup'](_0x39bda9);}catch(_0x4951f1){utils[_0x86cf('0x15')](util['format'](_0x86cf('0x30'),_0x39bda9[_0x86cf('0x1f')]),_0x4951f1);}});ami['on']('cdr',function(_0x541322){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x31'),_0x541322['uniqueid']),_0x541322);members['cdr'](_0x541322);}catch(_0x1d4681){utils[_0x86cf('0x15')](util['format'](_0x86cf('0x31'),_0x541322[_0x86cf('0x1f')]),_0x1d4681);}});ami['on'](_0x86cf('0x32'),function(_0x24f671){try{utils[_0x86cf('0x19')](util['format'](_0x86cf('0x33'),_0x24f671[_0x86cf('0x1f')]),_0x24f671);queues[_0x86cf('0x32')](_0x24f671);agents[_0x86cf('0x32')](_0x24f671);transfers[_0x86cf('0x32')](_0x24f671);}catch(_0x2c747a){utils['error'](util[_0x86cf('0x1a')](_0x86cf('0x33'),_0x24f671[_0x86cf('0x1f')]),_0x2c747a);}});ami['on'](_0x86cf('0x34'),function(_0x2a0fbd){try{utils['debug'](util[_0x86cf('0x1a')](_0x86cf('0x35'),_0x2a0fbd[_0x86cf('0x36')]),_0x2a0fbd);queues[_0x86cf('0x34')](_0x2a0fbd);transfers['attendedtransfer'](_0x2a0fbd);agents[_0x86cf('0x34')](_0x2a0fbd);calls[_0x86cf('0x34')](_0x2a0fbd);}catch(_0xba5fe0){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x35'),_0x2a0fbd['origtransfereruniqueid']),_0xba5fe0);}});ami['on'](_0x86cf('0x37'),function(_0x2f27cb){try{utils['debug'](util[_0x86cf('0x1a')](_0x86cf('0x38'),_0x2f27cb[_0x86cf('0x1f')]),_0x2f27cb);queues['varset'](_0x2f27cb);recordings[_0x86cf('0x37')](_0x2f27cb);calls['varset'](_0x2f27cb);dials[_0x86cf('0x37')](_0x2f27cb);}catch(_0x33c580){utils['error'](util[_0x86cf('0x1a')](_0x86cf('0x38'),_0x2f27cb[_0x86cf('0x1f')]),_0x33c580);}});ami['on'](_0x86cf('0x39'),function(_0x2204ab){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x3a'),_0x2204ab[_0x86cf('0x1f')]),_0x2204ab);calls[_0x86cf('0x39')](_0x2204ab);recordings[_0x86cf('0x39')](_0x2204ab);dials[_0x86cf('0x39')](_0x2204ab);}catch(_0x23c968){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x3a'),_0x2204ab[_0x86cf('0x1f')]),_0x23c968);}});ami['on']('newchannel',function(_0x10bbca){try{utils[_0x86cf('0x19')](util[_0x86cf('0x1a')](_0x86cf('0x3b'),_0x10bbca[_0x86cf('0x1f')]),_0x10bbca);calls['newchannel'](_0x10bbca);recordings[_0x86cf('0x3c')](_0x10bbca);}catch(_0x268bd4){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x3b'),_0x10bbca[_0x86cf('0x1f')]),_0x268bd4);}});ami['on'](_0x86cf('0x3d'),function(_0x43024a){try{utils[_0x86cf('0x19')](util['format'](_0x86cf('0x3e'),_0x43024a[_0x86cf('0x1f')]),_0x43024a);dials[_0x86cf('0x3d')](_0x43024a);}catch(_0x5cfeee){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x3f'),_0x43024a[_0x86cf('0x1f')]),_0x5cfeee);}});ami['on'](_0x86cf('0x40'),function(_0x2cd828){try{utils['debug'](util[_0x86cf('0x1a')](_0x86cf('0x41'),_0x2cd828[_0x86cf('0x1f')]),_0x2cd828);dials[_0x86cf('0x40')](_0x2cd828);}catch(_0x5e50f5){utils[_0x86cf('0x15')](util[_0x86cf('0x1a')](_0x86cf('0x41'),_0x2cd828[_0x86cf('0x1f')]),_0x5e50f5);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 4f6b89d..aaf3466 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 _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 +var _0x3407=['CreateMemberReport','getUserByName','split','membername','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','isNil','exitAt','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][cdr]','channel','data1','type','source','data3','destination','info','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','data2','interface','then','name','internal','request'];(function(_0x165076,_0x409927){var _0x9a828=function(_0x53e5ea){while(--_0x53e5ea){_0x165076['push'](_0x165076['shift']());}};_0x9a828(++_0x409927);}(_0x3407,0x12b));var _0x7340=function(_0x5e9cd6,_0x3c1685){_0x5e9cd6=_0x5e9cd6-0x0;var _0x29ac66=_0x3407[_0x5e9cd6];return _0x29ac66;};'use strict';var _=require(_0x7340('0x0'));var util=require(_0x7340('0x1'));var utils=require(_0x7340('0x2'));var members={};var exclude=['Local/_attended@transfer',_0x7340('0x3')];function writeDB(_0x515113){utils['info'](util[_0x7340('0x4')](_0x7340('0x5'),_0x515113[_0x7340('0x6')],_0x515113['interface'],_0x515113['channel'],_0x515113[_0x7340('0x7')],_0x515113['membername'],_0x515113['type']));if(_0x515113['interface']){utils['getUserByInterface'](_0x515113[_0x7340('0x8')])[_0x7340('0x9')](function(_0x58af72){if(_0x58af72){_0x515113['membername']=_0x58af72[_0x7340('0xa')];_0x515113[_0x7340('0xb')]=_0x58af72[_0x7340('0xb')];utils[_0x7340('0xc')](_0x7340('0xd'),_0x515113);}else{utils[_0x7340('0xe')](_0x515113[_0x7340('0x8')][_0x7340('0xf')]('/')[0x1])[_0x7340('0x9')](function(_0x37434d){if(_0x37434d){_0x515113[_0x7340('0x10')]=_0x37434d[_0x7340('0xa')];_0x515113['internal']=_0x37434d['internal'];utils[_0x7340('0xc')](_0x7340('0xd'),_0x515113);}});}})[_0x7340('0x11')](function(_0x4eb204){utils[_0x7340('0x12')](util['format'](_0x7340('0x13'),_0x515113[_0x7340('0x6')]),_0x4eb204);});}delete members[_0x515113[_0x7340('0x8')]];}function startsWith(_0x29dfa1,_0x1e5434){return _[_0x7340('0x14')](_0x29dfa1,function(_0x802728){return _[_0x7340('0x15')](_0x1e5434,_0x802728);});}exports['devicestatechange']=function(_0x256707){try{utils[_0x7340('0x16')](util[_0x7340('0x4')](_0x7340('0x17'),members[_0x256707[_0x7340('0x18')]]?members[_0x256707[_0x7340('0x18')]][_0x7340('0x6')]:_0x256707['device']),_0x256707);utils['info'](util[_0x7340('0x4')](_0x7340('0x19'),members[_0x256707[_0x7340('0x18')]]?members[_0x256707[_0x7340('0x18')]][_0x7340('0x6')]:_0x256707[_0x7340('0x18')],_0x256707[_0x7340('0x1a')],_0x256707[_0x7340('0x18')]));switch(_0x256707[_0x7340('0x1a')]){case _0x7340('0x1b'):case _0x7340('0x1c'):if(!startsWith(exclude,_0x256707[_0x7340('0x18')])){members[_0x256707['device']]={'channel':_0x7340('0x1d'),'interface':_0x256707['device'],'type':_0x7340('0x1e'),'enterAt':utils[_0x7340('0x1f')](),'role':_0x7340('0x20')};}break;case'NOT_INUSE':if(!_[_0x7340('0x21')](members[_0x256707['device']])){members[_0x256707[_0x7340('0x18')]][_0x7340('0x22')]=utils[_0x7340('0x1f')]();members[_0x256707['device']]['duration']=utils[_0x7340('0x23')](members[_0x256707['device']][_0x7340('0x22')],members[_0x256707[_0x7340('0x18')]][_0x7340('0x24')]);if(members[_0x256707[_0x7340('0x18')]][_0x7340('0x6')]){writeDB(members[_0x256707[_0x7340('0x18')]]);}}break;default:break;}}catch(_0x559a1f){utils[_0x7340('0x12')](util[_0x7340('0x4')](_0x7340('0x17'),members[_0x256707[_0x7340('0x18')]]?members[_0x256707[_0x7340('0x18')]][_0x7340('0x6')]:_0x256707[_0x7340('0x18')]),_0x559a1f);}};exports[_0x7340('0x25')]=function(_0x3923b2){try{if(!_[_0x7340('0x21')](members[_0x3923b2[_0x7340('0x8')]])){utils[_0x7340('0x16')](util[_0x7340('0x4')](_0x7340('0x26'),_0x3923b2[_0x7340('0x6')]),_0x3923b2);utils['info'](util['format'](_0x7340('0x27'),_0x3923b2[_0x7340('0x6')],_0x3923b2['interface'],_0x3923b2[_0x7340('0x28')]));members[_0x3923b2['interface']]=_[_0x7340('0x29')](members[_0x3923b2[_0x7340('0x8')]],{'data4':_0x3923b2[_0x7340('0x28')],'uniqueid':_0x3923b2['uniqueid']});}}catch(_0x4b24d6){utils[_0x7340('0x12')](util[_0x7340('0x4')]('[%s][members][agentcomplete]',_0x3923b2[_0x7340('0x6')]),_0x4b24d6);}};exports['cdr']=function(_0x437bec){try{utils[_0x7340('0x16')](util[_0x7340('0x4')](_0x7340('0x2a'),_0x437bec[_0x7340('0x6')]),_0x437bec);if(_0x437bec[_0x7340('0x2b')]){var _0x305929=_0x437bec[_0x7340('0x2b')][_0x7340('0xf')]('-')[0x0];if(!_[_0x7340('0x21')](members[_0x305929])){members[_0x305929]=_['assign'](members[_0x305929],{'data1':members[_0x305929][_0x7340('0x2c')]||_0x437bec[_0x7340('0x2d')],'data2':members[_0x305929][_0x7340('0x7')]||_0x437bec[_0x7340('0x2e')],'data3':members[_0x305929][_0x7340('0x2f')]||_0x437bec[_0x7340('0x30')],'uniqueid':members[_0x305929]['uniqueid']||_0x437bec[_0x7340('0x6')]});utils[_0x7340('0x31')](util[_0x7340('0x4')](_0x7340('0x32'),_0x437bec['uniqueid'],members[_0x305929][_0x7340('0x2c')],members[_0x305929]['data2'],members[_0x305929]['data3']));if(members[_0x305929][_0x7340('0x22')]){writeDB(members[_0x305929]);}}}if(_0x437bec[_0x7340('0x33')]){var _0x5753ba=_0x437bec['destinationchannel'][_0x7340('0xf')]('-')[0x0];if(!_['isNil'](members[_0x5753ba])){members[_0x5753ba]=_['assign'](members[_0x5753ba],{'data1':members[_0x5753ba]['data1']||_0x437bec[_0x7340('0x2d')],'data2':members[_0x5753ba][_0x7340('0x7')]||_0x437bec[_0x7340('0x2e')],'data3':members[_0x5753ba][_0x7340('0x2f')]||_0x437bec[_0x7340('0x30')],'uniqueid':members[_0x5753ba][_0x7340('0x6')]||_0x437bec[_0x7340('0x6')]});utils['info'](util[_0x7340('0x4')](_0x7340('0x32'),_0x437bec[_0x7340('0x6')],members[_0x5753ba][_0x7340('0x2c')],members[_0x5753ba][_0x7340('0x7')],members[_0x5753ba][_0x7340('0x2f')]));if(members[_0x5753ba][_0x7340('0x22')]){writeDB(members[_0x5753ba]);}}}}catch(_0x350ecf){utils[_0x7340('0x12')](util[_0x7340('0x4')](_0x7340('0x2a'),_0x437bec[_0x7340('0x6')]),_0x350ecf);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index aa9c02c..7703292 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 _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 +var _0x2432=['transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','toUpperCase','CONTINUE','queuecallerabandon','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleave','holdtime','diffTime','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED'];(function(_0x3e7653,_0x414e83){var _0x2d518d=function(_0x138626){while(--_0x138626){_0x3e7653['push'](_0x3e7653['shift']());}};_0x2d518d(++_0x414e83);}(_0x2432,0x7a));var _0x2243=function(_0x2b5182,_0x436398){_0x2b5182=_0x2b5182-0x0;var _0x17fe6c=_0x2432[_0x2b5182];return _0x17fe6c;};'use strict';var _=require(_0x2243('0x0'));var util=require(_0x2243('0x1'));var utils=require(_0x2243('0x2'));var queues={};function writeDB(_0x12d5e6){utils['info'](util[_0x2243('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x12d5e6[_0x2243('0x4')],_0x12d5e6[_0x2243('0x5')],_0x12d5e6[_0x2243('0x6')],_0x12d5e6[_0x2243('0x7')],_0x12d5e6[_0x2243('0x8')],_0x12d5e6[_0x2243('0x9')],_0x12d5e6[_0x2243('0xa')]));if(_0x12d5e6[_0x2243('0x6')]){utils[_0x2243('0xb')](_0x12d5e6['queue'])[_0x2243('0xc')](function(_0x128d83){if(_0x128d83){_0x12d5e6[_0x2243('0xd')]=_0x128d83[_0x2243('0xd')];}utils[_0x2243('0xe')](_0x2243('0xf'),_0x12d5e6);});}else{utils[_0x2243('0xe')](_0x2243('0xf'),_0x12d5e6);}if(_0x12d5e6[_0x2243('0x10')]){delete queues[_0x12d5e6[_0x2243('0x10')]];}else{delete queues[_0x12d5e6[_0x2243('0x4')]];}}exports[_0x2243('0x11')]=function(_0x1db7a3){try{utils[_0x2243('0x12')](util[_0x2243('0x3')](_0x2243('0x13'),_0x1db7a3['uniqueid']),_0x1db7a3);utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x15'),_0x1db7a3[_0x2243('0x4')],_0x1db7a3['queue'],_0x1db7a3[_0x2243('0x16')]));queues[_0x1db7a3['uniqueid']]=_[_0x2243('0x17')](_0x1db7a3,{'originalposition':_0x1db7a3['position'],'queuecallerjoinAt':utils[_0x2243('0x18')](),'mohtime':0x0});}catch(_0x6da2e2){utils[_0x2243('0x19')](util[_0x2243('0x3')]('[%s][queues][queuecallerjoin]',_0x1db7a3['uniqueid']),_0x6da2e2);}};exports[_0x2243('0x1a')]=function(_0x31ca17){try{if(!_[_0x2243('0x1b')](queues[_0x31ca17[_0x2243('0x4')]])){utils[_0x2243('0x12')](util[_0x2243('0x3')](_0x2243('0x1c'),_0x31ca17[_0x2243('0x4')]),_0x31ca17);if(queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0x1d')]){if(!queues[_0x31ca17[_0x2243('0x4')]]['queuecallerabandon']&&!queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0x1e')]){queues[_0x31ca17[_0x2243('0x4')]]['queuecallercomplete']=!![];queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0x1f')]=utils[_0x2243('0x18')]();queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0xa')]=_0x2243('0x20');}utils['info'](util[_0x2243('0x3')](_0x2243('0x21'),_0x31ca17[_0x2243('0x4')],queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0x22')],queues[_0x31ca17[_0x2243('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x31ca17[_0x2243('0x4')]]);}else if(queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0x10')]){utils[_0x2243('0x14')](util[_0x2243('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x31ca17[_0x2243('0x4')],queues[_0x31ca17['uniqueid']]['name'],queues[_0x31ca17[_0x2243('0x4')]][_0x2243('0x10')]));queues[queues[_0x31ca17['uniqueid']][_0x2243('0x10')]]=queues[_0x31ca17[_0x2243('0x4')]];queues[queues[_0x31ca17['uniqueid']][_0x2243('0x10')]][_0x2243('0x23')]=0x2;delete queues[_0x31ca17[_0x2243('0x4')]];}}}catch(_0x38248a){utils['error'](util[_0x2243('0x3')](_0x2243('0x1c'),_0x31ca17[_0x2243('0x4')]),_0x38248a);}};exports[_0x2243('0x24')]=function(_0x8525d7){try{utils[_0x2243('0x12')](util[_0x2243('0x3')](_0x2243('0x25'),_0x8525d7[_0x2243('0x4')]),_0x8525d7);if(!_['isNil'](_0x8525d7[_0x2243('0x26')]['queuestatus'])&&_0x8525d7['value'][_0x2243('0x27')]()!==_0x2243('0x28')){if(!_[_0x2243('0x1b')](queues[_0x8525d7['uniqueid']])){queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0x29')]=![];queues[_0x8525d7[_0x2243('0x4')]]['queuecallerabandonAt']=null;queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0x1e')]=!![];queues[_0x8525d7[_0x2243('0x4')]]['queuecallerexitAt']=utils['now']();queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0xa')]=_0x8525d7[_0x2243('0x2a')][_0x2243('0x27')]();utils['info'](util[_0x2243('0x3')](_0x2243('0x2b'),_0x8525d7[_0x2243('0x4')],queues[_0x8525d7['uniqueid']][_0x2243('0x22')],_0x8525d7[_0x2243('0x2a')],queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0xa')]));writeDB(queues[_0x8525d7['uniqueid']]);}}else if(!_[_0x2243('0x1b')](_0x8525d7[_0x2243('0x26')][_0x2243('0x2c')])){if(!_[_0x2243('0x1b')](queues[_0x8525d7[_0x2243('0x4')]])&&!queues[_0x8525d7['uniqueid']][_0x2243('0x29')]){queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0x29')]=![];queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0x2d')]=null;queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0x1e')]=!![];queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0x2e')]=utils[_0x2243('0x18')]();queues[_0x8525d7['uniqueid']][_0x2243('0xa')]='EXITWITHKEY';utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x2f'),_0x8525d7['uniqueid'],queues[_0x8525d7['uniqueid']][_0x2243('0x22')],_0x8525d7[_0x2243('0x2a')],queues[_0x8525d7[_0x2243('0x4')]][_0x2243('0xa')]));}}}catch(_0x21240b){utils[_0x2243('0x19')](util[_0x2243('0x3')](_0x2243('0x25'),_0x8525d7[_0x2243('0x4')]),_0x21240b);}};exports[_0x2243('0x29')]=function(_0x42cc8b){try{if(!_['isNil'](queues[_0x42cc8b[_0x2243('0x4')]])){utils[_0x2243('0x12')](util['format'](_0x2243('0x30'),_0x42cc8b['uniqueid']),_0x42cc8b);queues[_0x42cc8b[_0x2243('0x4')]][_0x2243('0x1e')]=![];queues[_0x42cc8b[_0x2243('0x4')]][_0x2243('0x2e')]=null;queues[_0x42cc8b[_0x2243('0x4')]][_0x2243('0x29')]=!![];queues[_0x42cc8b['uniqueid']][_0x2243('0x2d')]=utils[_0x2243('0x18')]();queues[_0x42cc8b[_0x2243('0x4')]][_0x2243('0xa')]=_0x2243('0x31');utils[_0x2243('0x14')](util['format'](_0x2243('0x32'),_0x42cc8b[_0x2243('0x4')],queues[_0x42cc8b[_0x2243('0x4')]][_0x2243('0x22')],queues[_0x42cc8b['uniqueid']][_0x2243('0xa')]));}}catch(_0x4e2134){utils[_0x2243('0x19')](util[_0x2243('0x3')]('[%s][queues][queuecallerabandon]',_0x42cc8b['uniqueid']),_0x4e2134);}};exports['queuecallerleave']=function(_0x4d9b79){try{if(!_[_0x2243('0x1b')](queues[_0x4d9b79['uniqueid']])){utils[_0x2243('0x12')](util[_0x2243('0x3')](_0x2243('0x33'),_0x4d9b79[_0x2243('0x4')]),_0x4d9b79);utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x34'),_0x4d9b79['uniqueid'],queues[_0x4d9b79[_0x2243('0x4')]][_0x2243('0x22')],_0x4d9b79[_0x2243('0x35')],_0x4d9b79['connectedlinename']));queues[_0x4d9b79[_0x2243('0x4')]][_0x2243('0x36')]=!![];queues[_0x4d9b79[_0x2243('0x4')]][_0x2243('0x1d')]=utils[_0x2243('0x18')]();queues[_0x4d9b79[_0x2243('0x4')]][_0x2243('0x37')]=utils[_0x2243('0x38')](queues[_0x4d9b79[_0x2243('0x4')]][_0x2243('0x1d')],queues[_0x4d9b79[_0x2243('0x4')]]['queuecallerjoinAt']);queues[_0x4d9b79[_0x2243('0x4')]]['position']=_0x4d9b79[_0x2243('0x16')];queues[_0x4d9b79['uniqueid']][_0x2243('0x39')]=_0x4d9b79[_0x2243('0x39')];queues[_0x4d9b79['uniqueid']]['connectedlinenum']=_0x4d9b79[_0x2243('0x35')];queues[_0x4d9b79[_0x2243('0x4')]][_0x2243('0x3a')]=_0x4d9b79['connectedlinename'];}}catch(_0x25a25a){utils[_0x2243('0x19')](util['format'](_0x2243('0x33'),_0x4d9b79['uniqueid']),_0x25a25a);}};exports[_0x2243('0x3b')]=function(_0x4bf6ab){try{if(!_['isNil'](queues[_0x4bf6ab[_0x2243('0x4')]])){utils['debug'](util[_0x2243('0x3')](_0x2243('0x3c'),_0x4bf6ab[_0x2243('0x4')]),_0x4bf6ab);utils[_0x2243('0x14')](util['format'](_0x2243('0x3d'),_0x4bf6ab[_0x2243('0x4')],queues[_0x4bf6ab[_0x2243('0x4')]]['name'],_0x4bf6ab[_0x2243('0x3e')],_0x4bf6ab[_0x2243('0x3f')]));queues[_0x4bf6ab[_0x2243('0x4')]][_0x2243('0x29')]=![];queues[_0x4bf6ab[_0x2243('0x4')]][_0x2243('0x29')]=![];queues[_0x4bf6ab['uniqueid']][_0x2243('0x2d')]=null;queues[_0x4bf6ab[_0x2243('0x4')]][_0x2243('0x1e')]=![];queues[_0x4bf6ab[_0x2243('0x4')]][_0x2243('0xa')]=null;queues[_0x4bf6ab['uniqueid']][_0x2243('0x2e')]=null;queues[_0x4bf6ab[_0x2243('0x4')]][_0x2243('0x40')]=!![];queues[_0x4bf6ab['uniqueid']][_0x2243('0x9')]=_0x4bf6ab[_0x2243('0x3f')];queues[_0x4bf6ab[_0x2243('0x4')]][_0x2243('0x7')]=_0x4bf6ab[_0x2243('0x3e')];}}catch(_0x384f1a){utils[_0x2243('0x19')](util[_0x2243('0x3')](_0x2243('0x3c'),_0x4bf6ab[_0x2243('0x4')]),_0x384f1a);}};exports['agentcomplete']=function(_0x317fb4){try{if(!_[_0x2243('0x1b')](queues[_0x317fb4['uniqueid']])){if(queues[_0x317fb4['uniqueid']][_0x2243('0x1d')]){utils['debug'](util[_0x2243('0x3')]('[%s][queues][agentcomplete]',_0x317fb4[_0x2243('0x4')]),_0x317fb4);queues[_0x317fb4['uniqueid']][_0x2243('0x29')]=![];queues[_0x317fb4[_0x2243('0x4')]][_0x2243('0x29')]=![];queues[_0x317fb4[_0x2243('0x4')]][_0x2243('0x2d')]=null;queues[_0x317fb4[_0x2243('0x4')]]['queuecallerexit']=![];queues[_0x317fb4[_0x2243('0x4')]][_0x2243('0x2e')]=null;queues[_0x317fb4['uniqueid']][_0x2243('0x40')]=!![];queues[_0x317fb4[_0x2243('0x4')]][_0x2243('0x7')]=_0x317fb4[_0x2243('0x3e')];queues[_0x317fb4[_0x2243('0x4')]][_0x2243('0x41')]=!![];queues[_0x317fb4[_0x2243('0x4')]]['queuecallercompleteAt']=utils[_0x2243('0x18')]();if(_0x317fb4[_0x2243('0x42')]==_0x2243('0x43')){if(!queues[_0x317fb4['uniqueid']][_0x2243('0x43')]){queues[_0x317fb4[_0x2243('0x4')]][_0x2243('0xa')]=_0x2243('0x44');}}else{queues[_0x317fb4['uniqueid']][_0x2243('0xa')]=_0x2243('0x45')+_0x317fb4[_0x2243('0x42')][_0x2243('0x27')]();}utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x46'),_0x317fb4[_0x2243('0x4')],queues[_0x317fb4['uniqueid']][_0x2243('0x22')],_0x317fb4['membername'],queues[_0x317fb4['uniqueid']][_0x2243('0xa')]));writeDB(queues[_0x317fb4['uniqueid']]);}}}catch(_0x4acc96){utils[_0x2243('0x19')](util[_0x2243('0x3')](_0x2243('0x47'),_0x317fb4[_0x2243('0x4')]),_0x4acc96);}};exports[_0x2243('0x48')]=function(_0x37140b){try{if(!_[_0x2243('0x1b')](queues[_0x37140b[_0x2243('0x49')]])){utils[_0x2243('0x12')](util['format'](_0x2243('0x4a'),_0x37140b[_0x2243('0x4')]),_0x37140b);queues[_0x37140b[_0x2243('0x49')]]['transfer']=!![];queues[_0x37140b[_0x2243('0x49')]][_0x2243('0x4b')]='BLIND';queues[_0x37140b['transfereeuniqueid']][_0x2243('0x4c')]=_0x37140b[_0x2243('0x4d')];queues[_0x37140b[_0x2243('0x49')]][_0x2243('0x4e')]=_0x37140b['transfereeuniqueid'];queues[_0x37140b['transfereeuniqueid']]['queuecallerexitreason']=_0x2243('0x4f');utils['info'](util[_0x2243('0x3')](_0x2243('0x50'),_0x37140b[_0x2243('0x4')],queues[_0x37140b['transfereeuniqueid']][_0x2243('0x22')],_0x37140b[_0x2243('0x49')],_0x37140b[_0x2243('0x4d')]));}}catch(_0x38beba){utils[_0x2243('0x19')](util[_0x2243('0x3')](_0x2243('0x4a'),_0x37140b[_0x2243('0x4')]),_0x38beba);}};exports['attendedtransfer']=function(_0x307a80){try{utils[_0x2243('0x12')](util[_0x2243('0x3')](_0x2243('0x51'),_0x307a80[_0x2243('0x52')]),_0x307a80);if(_0x307a80[_0x2243('0x52')]==_0x307a80[_0x2243('0x53')]){if(!_[_0x2243('0x1b')](queues[_0x307a80['secondtransfererlinkedid']])){utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x54'),_0x307a80[_0x2243('0x52')],queues[_0x307a80[_0x2243('0x55')]][_0x2243('0x22')],_0x307a80[_0x2243('0x56')]));queues[_0x307a80[_0x2243('0x55')]][_0x2243('0x43')]=!![];queues[_0x307a80['secondtransfererlinkedid']][_0x2243('0x4b')]=_0x2243('0x57');queues[_0x307a80[_0x2243('0x55')]][_0x2243('0x4c')]=_0x307a80[_0x2243('0x56')];queues[_0x307a80[_0x2243('0x55')]][_0x2243('0x4e')]=_0x307a80[_0x2243('0x52')];queues[_0x307a80[_0x2243('0x55')]][_0x2243('0xa')]='ATTENDEDTRANSFER';}if(!_[_0x2243('0x1b')](queues[_0x307a80[_0x2243('0x53')]])){if(_0x307a80[_0x2243('0x58')]&&queues[_0x307a80[_0x2243('0x58')]]){queues[_0x307a80[_0x2243('0x58')]][_0x2243('0x23')]=0x1;queues[_0x307a80[_0x2243('0x49')]]=_[_0x2243('0x59')](queues[_0x307a80[_0x2243('0x58')]]);queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x10')]=_0x307a80[_0x2243('0x5a')];queues[_0x307a80[_0x2243('0x49')]]['queuecallerenterreason']=0x2;queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x8')]=queues[_0x307a80[_0x2243('0x55')]][_0x2243('0x8')];queues[_0x307a80[_0x2243('0x49')]]['calleridname']=queues[_0x307a80[_0x2243('0x55')]][_0x2243('0x5b')];queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x5c')]=utils['now']();queues[_0x307a80['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x2243('0x18')]();queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x37')]=0x0;queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x5d')]=0x0;utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x5e'),_0x307a80[_0x2243('0x52')],queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x22')],queues[_0x307a80[_0x2243('0x49')]][_0x2243('0x8')],queues[_0x307a80['transfereeuniqueid']][_0x2243('0x5b')]));}else{utils[_0x2243('0x14')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x307a80[_0x2243('0x52')],queues[_0x307a80[_0x2243('0x53')]][_0x2243('0x22')],_0x307a80['secondtransfererlinkedid']));queues[_0x307a80[_0x2243('0x53')]]['transfereduniqueid']=_0x307a80['secondtransfererlinkedid'];}}}else if(_0x307a80[_0x2243('0x5f')]==_0x307a80[_0x2243('0x55')]){if(!_[_0x2243('0x1b')](queues[_0x307a80[_0x2243('0x53')]])){utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x60'),_0x307a80[_0x2243('0x52')],queues[_0x307a80[_0x2243('0x53')]][_0x2243('0x22')],_0x307a80[_0x2243('0x5f')],_0x307a80['secondtransfererexten']));queues[_0x307a80['origtransfererlinkedid']][_0x2243('0x43')]=!![];queues[_0x307a80[_0x2243('0x53')]]['transfertype']=_0x2243('0x57');queues[_0x307a80[_0x2243('0x53')]]['transferexten']=_0x307a80[_0x2243('0x61')];queues[_0x307a80[_0x2243('0x53')]]['transferuniqueid']=_0x307a80[_0x2243('0x5f')];queues[_0x307a80[_0x2243('0x53')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x307a80['secondtransfererlinkedid']])){if(_0x307a80[_0x2243('0x62')]&&queues[_0x307a80[_0x2243('0x62')]]){queues[_0x307a80[_0x2243('0x62')]][_0x2243('0x23')]=0x1;queues[_0x307a80['transfertargetuniqueid']]=_[_0x2243('0x59')](queues[_0x307a80[_0x2243('0x62')]]);queues[_0x307a80['transfertargetuniqueid']][_0x2243('0x10')]=_0x307a80['transfertargetuniqueid'];queues[_0x307a80[_0x2243('0x5a')]]['queuecallerenterreason']=0x2;queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x8')]=queues[_0x307a80['origtransfererlinkedid']][_0x2243('0x8')];queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x5b')]=queues[_0x307a80[_0x2243('0x53')]][_0x2243('0x5b')];queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x5c')]=utils[_0x2243('0x18')]();queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x1d')]=utils[_0x2243('0x18')]();queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x37')]=0x0;queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x5d')]=0x0;utils[_0x2243('0x14')](util[_0x2243('0x3')](_0x2243('0x63'),_0x307a80[_0x2243('0x52')],queues[_0x307a80[_0x2243('0x5a')]]['name'],queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x10')],queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x8')],queues[_0x307a80[_0x2243('0x5a')]][_0x2243('0x5b')]));}else{utils[_0x2243('0x14')](util[_0x2243('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x307a80[_0x2243('0x52')],queues[_0x307a80[_0x2243('0x55')]]['name'],_0x307a80[_0x2243('0x53')]));queues[_0x307a80['secondtransfererlinkedid']][_0x2243('0x10')]=_0x307a80[_0x2243('0x53')];}}}}catch(_0x348d79){utils['error'](util[_0x2243('0x3')](_0x2243('0x51'),_0x307a80[_0x2243('0x52')]),_0x348d79);}};exports['musiconholdstart']=function(_0x432adf){try{if(!_[_0x2243('0x1b')](queues[_0x432adf[_0x2243('0x4')]])){utils[_0x2243('0x12')](util[_0x2243('0x3')](_0x2243('0x64'),_0x432adf[_0x2243('0x4')]),_0x432adf);queues[_0x432adf['uniqueid']][_0x2243('0x65')]=utils['now']();utils['info'](util[_0x2243('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x432adf[_0x2243('0x4')],queues[_0x432adf['uniqueid']]['name'],queues[_0x432adf['uniqueid']][_0x2243('0x65')]));}}catch(_0x28478c){utils[_0x2243('0x19')](util[_0x2243('0x3')]('[%s][queues][musiconholdstart]',_0x432adf[_0x2243('0x4')]),_0x28478c);}};exports[_0x2243('0x66')]=function(_0x3f124f){try{if(!_[_0x2243('0x1b')](queues[_0x3f124f[_0x2243('0x4')]])){if(!_[_0x2243('0x1b')](queues[_0x3f124f[_0x2243('0x4')]][_0x2243('0x65')])){utils[_0x2243('0x12')](util[_0x2243('0x3')]('[%s][queues][musiconholdstop]',_0x3f124f['uniqueid']),_0x3f124f);queues[_0x3f124f['uniqueid']][_0x2243('0x5d')]+=utils[_0x2243('0x38')](utils[_0x2243('0x18')](),queues[_0x3f124f[_0x2243('0x4')]]['musiconholdstartAt']);utils[_0x2243('0x14')](util['format'](_0x2243('0x67'),_0x3f124f[_0x2243('0x4')],queues[_0x3f124f[_0x2243('0x4')]][_0x2243('0x22')],queues[_0x3f124f['uniqueid']][_0x2243('0x5d')]));delete queues[_0x3f124f[_0x2243('0x4')]][_0x2243('0x65')];}}}catch(_0x43ad3f){utils[_0x2243('0x19')](util[_0x2243('0x3')](_0x2243('0x68'),_0x3f124f[_0x2243('0x4')]),_0x43ad3f);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 73db2d9..e021312 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 _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 +var _0xdbae=['./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request','CreateVoiceRecording','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','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','[%s][recordings][hangup]','application','appdata','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util'];(function(_0x411988,_0x54e857){var _0x5cf935=function(_0x3b4324){while(--_0x3b4324){_0x411988['push'](_0x411988['shift']());}};_0x5cf935(++_0x54e857);}(_0xdbae,0x116));var _0xedba=function(_0x19cae1,_0x1623e2){_0x19cae1=_0x19cae1-0x0;var _0x4e26ed=_0xdbae[_0x19cae1];return _0x4e26ed;};'use strict';var _=require(_0xedba('0x0'));var util=require(_0xedba('0x1'));var utils=require(_0xedba('0x2'));var recordings={};function writeDB(_0x19ee35){utils[_0xedba('0x3')](util[_0xedba('0x4')](_0xedba('0x5'),_0x19ee35[_0xedba('0x6')]));if(_0x19ee35[_0xedba('0x7')]){utils[_0xedba('0x8')](_0x19ee35[_0xedba('0x7')])[_0xedba('0x9')](function(_0x5bf1b9){if(_0x5bf1b9){_0x19ee35[_0xedba('0xa')]=_0x5bf1b9[_0xedba('0xb')];_0x19ee35[_0xedba('0xc')]=_0x5bf1b9['id'];}utils[_0xedba('0xd')]('CreateVoiceRecording',_0x19ee35);});}else{utils['request'](_0xedba('0xe'),_0x19ee35);}}exports['newchannel']=function(_0x3919b6){try{utils[_0xedba('0xf')](util['format'](_0xedba('0x10'),_0x3919b6[_0xedba('0x6')]),_0x3919b6);if(_0x3919b6[_0xedba('0x6')]==_0x3919b6[_0xedba('0x11')]){utils[_0xedba('0x3')](util[_0xedba('0x4')](_0xedba('0x12'),_0x3919b6['uniqueid'],_0x3919b6[_0xedba('0x13')],_0x3919b6[_0xedba('0x14')]));recordings[_0x3919b6[_0xedba('0x6')]]={'uniqueid':_0x3919b6[_0xedba('0x6')],'accountcode':_0x3919b6[_0xedba('0x7')],'exten':_0x3919b6['exten'],'context':_0x3919b6['context'],'channel':_0x3919b6[_0xedba('0x15')],'monitors':[]};}}catch(_0x14c0c5){utils[_0xedba('0x16')](util[_0xedba('0x4')](_0xedba('0x10'),_0x3919b6[_0xedba('0x6')]),_0x14c0c5);}};exports[_0xedba('0x17')]=function(_0x29131b){try{utils[_0xedba('0xf')](util[_0xedba('0x4')]('[%s][recordings][newstate]',_0x29131b[_0xedba('0x6')]),_0x29131b);if(!_[_0xedba('0x18')](recordings[_0x29131b[_0xedba('0x6')]])&&_0x29131b[_0xedba('0x19')]==0x6){utils['info'](util['format'](_0xedba('0x1a'),_0x29131b[_0xedba('0x6')],_0x29131b[_0xedba('0x13')],_0x29131b[_0xedba('0x15')]));}else if(!_[_0xedba('0x18')](recordings[_0x29131b[_0xedba('0x11')]])&&_0x29131b[_0xedba('0x19')]==0x6&&_0x29131b['context']!='transfer'){utils[_0xedba('0x3')](util[_0xedba('0x4')](_0xedba('0x1b'),_0x29131b[_0xedba('0x6')],_0x29131b[_0xedba('0x11')],_0x29131b['context'],_0x29131b[_0xedba('0x15')]));recordings[_0x29131b[_0xedba('0x11')]]['accountcode']=_0x29131b[_0xedba('0x7')];}}catch(_0x19602d){utils[_0xedba('0x16')](util[_0xedba('0x4')](_0xedba('0x1c'),_0x29131b['uniqueid']),_0x19602d);}};exports[_0xedba('0x1d')]=function(_0x15d52d){try{if(!_[_0xedba('0x18')](_0x15d52d[_0xedba('0x1e')])&&!_['isNil'](_0x15d52d[_0xedba('0x1e')]['mixmonitor_filename'])){utils[_0xedba('0xf')](util['format'](_0xedba('0x1f'),_0x15d52d[_0xedba('0x6')]),_0x15d52d);utils[_0xedba('0x3')](util[_0xedba('0x4')](_0xedba('0x20'),_0x15d52d[_0xedba('0x6')],_0x15d52d[_0xedba('0x1e')],_0x15d52d[_0xedba('0x21')]));if(_[_0xedba('0x22')](_0x15d52d[_0xedba('0x21')],_0xedba('0x23'))){_0x15d52d[_0xedba('0x21')]=_0x15d52d[_0xedba('0x21')][_0xedba('0x24')]('.wav49','.WAV');}if(recordings[_0x15d52d['linkedid']]){var _0x4dcb09=_[_0xedba('0x25')](recordings[_0x15d52d['linkedid']][_0xedba('0x26')],{'value':_0x15d52d[_0xedba('0x21')]});if(_['isNil'](_0x4dcb09)){recordings[_0x15d52d[_0xedba('0x11')]][_0xedba('0x26')][_0xedba('0x27')]({'value':_0x15d52d[_0xedba('0x21')]});}}}}catch(_0x3dbfac){utils['error'](util[_0xedba('0x4')](_0xedba('0x1f'),_0x15d52d[_0xedba('0x6')]),_0x3dbfac);}};exports[_0xedba('0x28')]=function(_0x22f68d){try{if(!_[_0xedba('0x18')](recordings[_0x22f68d[_0xedba('0x6')]])){utils['debug'](util[_0xedba('0x4')]('[%s][recordings][hangup]',_0x22f68d[_0xedba('0x6')]),_0x22f68d);utils['info'](util[_0xedba('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x22f68d[_0xedba('0x6')],_0x22f68d[_0xedba('0x29')],_0x22f68d[_0xedba('0x2a')],_0x22f68d['cause-txt']));recordings[_0x22f68d['uniqueid']][_0xedba('0x29')]=_0x22f68d[_0xedba('0x29')];recordings[_0x22f68d['uniqueid']]['calleridname']=_0x22f68d['calleridname'];recordings[_0x22f68d['uniqueid']]['connectedlinenum']=_0x22f68d[_0xedba('0x2b')];recordings[_0x22f68d['uniqueid']][_0xedba('0x2c')]=_0x22f68d[_0xedba('0x2c')];if(recordings[_0x22f68d['uniqueid']][_0xedba('0x2d')]=='outbound'&&recordings[_0x22f68d[_0xedba('0x6')]][_0xedba('0x7')]){recordings[_0x22f68d[_0xedba('0x6')]][_0xedba('0x2b')]=recordings[_0x22f68d[_0xedba('0x6')]]['accountcode'];recordings[_0x22f68d[_0xedba('0x6')]]['connectedlinename']='';}recordings[_0x22f68d['uniqueid']][_0xedba('0x26')][_0xedba('0x2e')](function(_0x3a9651){var _0x9acf3a=_['clone'](recordings[_0x22f68d[_0xedba('0x6')]]);_0x9acf3a[_0xedba('0x21')]=_0x3a9651[_0xedba('0x21')];writeDB(_0x9acf3a);});delete recordings[_0x22f68d[_0xedba('0x6')]];}}catch(_0x4aa804){utils[_0xedba('0x16')](util[_0xedba('0x4')](_0xedba('0x2f'),_0x22f68d[_0xedba('0x6')]),_0x4aa804);}};exports['newexten']=function(_0x4eeae4){try{if(!_[_0xedba('0x18')](recordings[_0x4eeae4[_0xedba('0x6')]])){utils[_0xedba('0xf')](util['format']('[%s][recordings][newexten]',_0x4eeae4[_0xedba('0x6')]),_0x4eeae4);utils['info'](util[_0xedba('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x4eeae4[_0xedba('0x6')],_0x4eeae4[_0xedba('0x30')],_0x4eeae4[_0xedba('0x31')]));if(_0x4eeae4['application']['toLowerCase']()=='set'&&_['startsWith'](_0x4eeae4[_0xedba('0x31')]['toLowerCase'](),_0xedba('0x32'))){var _0x3b42d2=_0x4eeae4['appdata'][_0xedba('0x33')]('=');var _0x5cfa69=_0x3b42d2[0x0]['substring'](_0x3b42d2[0x0][_0xedba('0x34')]('(')+0x1,_0x3b42d2[0x0][_0xedba('0x34')](')'));var _0x31592f=_0x3b42d2[0x1];recordings[_0x4eeae4[_0xedba('0x6')]][_0x5cfa69]=_0x31592f;}}}catch(_0xbba627){utils[_0xedba('0x16')](util['format']('[%s][recordings][newexten]',_0x4eeae4['uniqueid']),_0xbba627);}};exports[_0xedba('0x35')]=function(_0x360ab7){try{if(!_[_0xedba('0x18')](recordings[_0x360ab7[_0xedba('0x6')]])){utils[_0xedba('0xf')](util['format'](_0xedba('0x36'),_0x360ab7[_0xedba('0x6')]),_0x360ab7);utils[_0xedba('0x3')](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x360ab7[_0xedba('0x6')],_0x360ab7[_0xedba('0x37')]));recordings[_0x360ab7[_0xedba('0x6')]][_0xedba('0x37')]=_0x360ab7['queue'];}}catch(_0x85f9c1){utils[_0xedba('0x16')](util[_0xedba('0x4')](_0xedba('0x36'),_0x360ab7[_0xedba('0x6')]),_0x85f9c1);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 983063a..e7de66a 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 _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 +var _0x072a=['origtransfereruniqueid','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','uniqueid','request','debug','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','assign','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid'];(function(_0x473cfe,_0x317258){var _0x49791e=function(_0x15df40){while(--_0x15df40){_0x473cfe['push'](_0x473cfe['shift']());}};_0x49791e(++_0x317258);}(_0x072a,0x131));var _0xa072=function(_0x3ecc71,_0x54c502){_0x3ecc71=_0x3ecc71-0x0;var _0x3b7654=_0x072a[_0x3ecc71];return _0x3b7654;};'use strict';var _=require(_0xa072('0x0'));var util=require(_0xa072('0x1'));var utils=require(_0xa072('0x2'));function writeDB(_0x11f946){utils[_0xa072('0x3')](util[_0xa072('0x4')](_0xa072('0x5'),_0x11f946[_0xa072('0x6')]==='attended'?_0x11f946['origtransfereruniqueid']:_0x11f946[_0xa072('0x7')],_0x11f946[_0xa072('0x6')]));utils[_0xa072('0x8')]('CreateVoiceTransferReport',_0x11f946);}exports['blindtransfer']=function(_0x4621e1){try{utils[_0xa072('0x9')](util[_0xa072('0x4')]('[%s][transfers][blindtransfer]',_0x4621e1[_0xa072('0x7')]),_0x4621e1);utils[_0xa072('0x3')](util[_0xa072('0x4')](_0xa072('0xa'),_0x4621e1['uniqueid'],_0x4621e1[_0xa072('0xb')],_0x4621e1[_0xa072('0xc')],_0x4621e1['transfereecalleridnum'],_0x4621e1[_0xa072('0xd')]));_0x4621e1[_0xa072('0x6')]=_0xa072('0xe');writeDB(_0x4621e1);}catch(_0x154263){utils['error'](util[_0xa072('0x4')]('[%s][transfers][blindtransfer]',_0x4621e1[_0xa072('0x7')]),_0x154263);}};exports['attendedtransfer']=function(_0x3db507){try{utils[_0xa072('0x9')](util[_0xa072('0x4')](_0xa072('0xf'),_0x3db507['origtransfereruniqueid']),_0x3db507);utils['info'](util[_0xa072('0x4')](_0xa072('0x10'),_0x3db507['origtransfereruniqueid'],_0x3db507['origtransferercalleridnum'],_0x3db507[_0xa072('0x11')],_0x3db507[_0xa072('0x12')],_0x3db507[_0xa072('0x13')]));_0x3db507=_['assign'](_0x3db507,{'transfererchannel':_0x3db507['origtransfererchannel'],'transferercalleridnum':_0x3db507['origtransferercalleridnum'],'transferercalleridname':_0x3db507['origtransferercalleridname'],'transfererconnectedlinenum':_0x3db507[_0xa072('0x14')],'transfererconnectedlinename':_0x3db507[_0xa072('0x15')],'transfereraccountcode':_0x3db507[_0xa072('0x16')],'transferercontext':_0x3db507['secondtransferercontext'],'transfererexten':_0x3db507[_0xa072('0x17')],'transfererlinkedid':_0x3db507[_0xa072('0x18')],'context':_0x3db507[_0xa072('0x19')],'extension':_0x3db507[_0xa072('0x1a')],'type':_0xa072('0x1b')});if(_[_0xa072('0x1c')](_0x3db507['transfereechannel'])){_0x3db507=_[_0xa072('0x1d')](_0x3db507,{'transfereechannel':_0x3db507[_0xa072('0x1e')],'transfereecalleridnum':_0x3db507[_0xa072('0x12')],'transfereecalleridname':_0x3db507[_0xa072('0x13')],'transfereeconnectedlinenum':_0x3db507[_0xa072('0x1f')],'transfereeconnectedlinename':_0x3db507[_0xa072('0x20')],'transfereeaccountcode':_0x3db507[_0xa072('0x21')],'transfereecontext':_0x3db507[_0xa072('0x22')],'transfereeexten':_0x3db507[_0xa072('0x23')],'transfereelinkedid':_0x3db507[_0xa072('0x24')]});}writeDB(_0x3db507);}catch(_0x157ce5){utils['error'](util['format'](_0xa072('0xf'),_0x3db507[_0xa072('0x25')]),_0x157ce5);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index fd3aee4..d5a3c3f 100644 --- a/server/services/xdr/utils.js +++ b/server/services/xdr/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_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 +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(_0x2fe8ab,_0x5e8e7b){var _0x3d5a6d=function(_0xf440c5){while(--_0xf440c5){_0x2fe8ab['push'](_0x2fe8ab['shift']());}};_0x3d5a6d(++_0x5e8e7b);}(_0x7a54,0x106));var _0x47a5=function(_0x2daa54,_0x837cde){_0x2daa54=_0x2daa54-0x0;var _0x3ccc9a=_0x7a54[_0x2daa54];return _0x3ccc9a;};'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